[libvirt] [PATCH] autogen: added glibtool and pkg-config checks

OSX MacPorts has libtool named as glibtool, with libtoolize named as glibtoolize. This patch adds support for this, and also adds a check for pkg-config, to warn when it is missing. --- autogen.sh | 25 ++++++++++++++++++++----- 1 files changed, 20 insertions(+), 5 deletions(-) diff --git a/autogen.sh b/autogen.sh index 01ba59c..810a189 100755 --- a/autogen.sh +++ b/autogen.sh @@ -25,11 +25,18 @@ DIE=0 } (libtool --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have libtool installed to compile libvirt." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/libtool" - DIE=1 + # GNU libtool wasn't found as "libtool", + # so we check if it's known as "glibtool" + (glibtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have libtool installed to compile libvirt." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/libtool" + DIE=1 + } + # These are only used if glibtool is what we want + export LIBTOOL=glibtool + export LIBTOOLIZE=glibtoolize } (automake --version) < /dev/null > /dev/null 2>&1 || { @@ -40,6 +47,14 @@ DIE=0 echo "or see http://www.gnu.org/software/automake" } +(pkg-config --version) < /dev/null > /dev/null 2>&1 || { + echo + DIE=1 + echo "You must have pkg-config installed to compile libvirt." + echo "Download the appropriate package for your distribution," + echo "or see http://pkg-config.freedesktop.org" +} + if test "$DIE" -eq 1; then exit 1 fi -- 1.7.2.2

[adding bug-gnulib] On 09/15/2010 06:36 AM, Justin Clift wrote:
OSX MacPorts has libtool named as glibtool, with libtoolize named as glibtoolize. This patch adds support for this, and also adds a check for pkg-config, to warn when it is missing.
Hmm - would it be easier to make bootstrap.conf list pkg-config as a prerequisite, rather than having to hack up autogen.sh to do that? Also, if I'm reading the code right, changing bootstrap.conf to list 'libtoolize' instead of 'libtool' as the prerequisite will let you get by with overriding just $LIBTOOLIZE instead of both $LIBTOOL and $LIBTOOLIZE. Additionally it may be sufficient to just teach upstream gnulib/build-aux/bootstrap to use 'find_tool LIBTOOLIZE libtoolize glibtoolize', at which point re-syncing to upstream bootstrap will automatically pick up on the right libtool for MacOS without you having to hack libvirt's autogen.sh in the first place :) So, NACK to this version of the libvirt patch, and instead let me do some gnulib work... Not to mention that Gary is working on some upstream patches to improve bootstrap modularity, and there is also a request to add 'bootstrap --skip-git' that I need to respond to... -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 09/16/2010 03:02 AM, Eric Blake wrote:
[adding bug-gnulib]
On 09/15/2010 06:36 AM, Justin Clift wrote:
OSX MacPorts has libtool named as glibtool, with libtoolize named as glibtoolize. This patch adds support for this, and also adds a check for pkg-config, to warn when it is missing.
Hmm - would it be easier to make bootstrap.conf list pkg-config as a prerequisite, rather than having to hack up autogen.sh to do that?
Heh, whatever works best. You know this stuff a lot better than me. :)
Also, if I'm reading the code right, changing bootstrap.conf to list 'libtoolize' instead of 'libtool' as the prerequisite will let you get by with overriding just $LIBTOOLIZE instead of both $LIBTOOL and $LIBTOOLIZE.
Additionally it may be sufficient to just teach upstream gnulib/build-aux/bootstrap to use 'find_tool LIBTOOLIZE libtoolize glibtoolize', at which point re-syncing to upstream bootstrap will automatically pick up on the right libtool for MacOS without you having to hack libvirt's autogen.sh in the first place :)
All good. We'll still have to hack up libvirt's autogen.sh a bit anyway, because at the moment it has the word "libtool" hard coded before it gets up to the bootstrapping: (libtool --version) < /dev/null > /dev/null 2>&1 || {
So, NACK to this version of the libvirt patch, and instead let me do some gnulib work... Not to mention that Gary is working on some upstream patches to improve bootstrap modularity, and there is also a request to add 'bootstrap --skip-git' that I need to respond to...
If you can figure a way to address this OSX specific thing in gnulib at the same time, that would be nifty: http://www.redhat.com/archives/libvir-list/2010-September/msg00248.html :)

On 09/16/2010 03:02 AM, Eric Blake wrote:
[adding bug-gnulib]
OSX MacPorts has libtool named as glibtool, with libtoolize named as glibtoolize. This patch adds support for this, and also adds a check for pkg-config, to warn when it is missing. <snip> So, NACK to this version of the libvirt patch, and instead let me do some gnulib work... Not to mention that Gary is working on some upstream
On 09/15/2010 06:36 AM, Justin Clift wrote: patches to improve bootstrap modularity, and there is also a request to add 'bootstrap --skip-git' that I need to respond to...
Hi guys, Any word on how this is going? Just wanting to get an idea when we can drop the simple override patch for Mac OS X? :) Regards and best wishes, Justin Clift

Hi Justin, On 28 Sep 2010, at 07:24, Justin Clift wrote:
On 09/16/2010 03:02 AM, Eric Blake wrote:
[adding bug-gnulib]
OSX MacPorts has libtool named as glibtool, with libtoolize named as glibtoolize. This patch adds support for this, and also adds a check for pkg-config, to warn when it is missing. <snip> So, NACK to this version of the libvirt patch, and instead let me do some gnulib work... Not to mention that Gary is working on some upstream
On 09/15/2010 06:36 AM, Justin Clift wrote: patches to improve bootstrap modularity, and there is also a request to add 'bootstrap --skip-git' that I need to respond to...
Hi guys,
Any word on how this is going?
I'm all but finished with my rewrite, and I've added --skip-git support too. I'll be too busy for the next couple of weeks to finish testing, but I'm aiming to submit upstream with before the middle of Oct. I expect I'll find a few more opportunities for enhancements, and fix a bug or two before then. If anyone wants a copy of the script as is, just send me a request. All I ask in return is for feedback on how it works for you.
Just wanting to get an idea when we can drop the simple override patch for Mac OS X? :)
If that was directed at me, I wasn't paying enough attention to the rest of the thread to know what that patch is... ;) Cheers, -- Gary V. Vaughan (gary@gnu.org)

On 09/29/2010 10:13 PM, Gary V. Vaughan wrote: <snip>
Just wanting to get an idea when we can drop the simple override patch for Mac OS X? :)
If that was directed at me, I wasn't paying enough attention to the rest of the thread to know what that patch is... ;)
Nah. With libvirt, we presently have an ./autogen.sh, using hard coded checks for "libtool" and friends prior to running the bootstrap stuff. Eric has mentioned the situation is improving, and is also putting time into fixing things, but for the very short term... I'm using a dodgy (but functional) patch to allow "glibtool" to also be acceptable. It's allowing the autogen.sh to get through to the bootstrap, when run on OS X, and from there onwards most things are ok. With your updated parts, I'm happy to run them and test, but my skill level with this gnulib stuff is practically non-existent. Kind of end user quality... able to run commands, report breakage, etc, but no in depth idea of what it's really doing. :)

Partial reversion of commit 76d87a59, now that bootstrap is smarter. * .gnulib: Update to latest, for poll and bootstrap fixes. * bootstrap: Resync from gnulib. * autogen.sh: Drop redundant tool checks; bootstrap does them better, by honoring environment variables. * examples/domain-events/events-c/Makefile.am (INCLUDES) (event_test_LDADD): Use gnulib library during build. * bootstrap.conf (gnulib_tool_option_extras): Revert --libtool addition, now that updated bootstrap does it for us. Reported by Justin Clift. ---
OSX MacPorts has libtool named as glibtool, with libtoolize named as glibtoolize. This patch adds support for this, and also adds a check for pkg-config, to warn when it is missing.
Hmm - would it be easier to make bootstrap.conf list pkg-config as a prerequisite, rather than having to hack up autogen.sh to do that?
Now done, and verified with Justin on IRC (although double-checking with this exact patch before giving an ACK wouldn't hurt). .gnulib | 2 +- autogen.sh | 37 ------------------------------------- bootstrap | 29 +++++++++++++++++++---------- bootstrap.conf | 1 - 4 files changed, 20 insertions(+), 49 deletions(-) diff --git a/.gnulib b/.gnulib index d45b03e..9f940e9 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit d45b03e4eda2218eec0b302d60496b1b3ca2e87c +Subproject commit 9f940e90a7555c3399c9972d9688483c011068c7 diff --git a/autogen.sh b/autogen.sh index 01ba59c..3fff381 100755 --- a/autogen.sh +++ b/autogen.sh @@ -6,43 +6,6 @@ test -z "$srcdir" && srcdir=. THEDIR=`pwd` cd "$srcdir" -DIE=0 - -(autopoint --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autopoint installed to compile libvirt." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/gettext" - DIE=1 -} - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed to compile libvirt." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/autoconf" - DIE=1 -} - -(libtool --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have libtool installed to compile libvirt." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/libtool" - DIE=1 -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - DIE=1 - echo "You must have automake installed to compile libvirt." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/automake" -} - -if test "$DIE" -eq 1; then - exit 1 -fi test -f src/libvirt.c || { echo "You must run this script in the top-level libvirt directory" diff --git a/bootstrap b/bootstrap index 28df597..e94a29a 100755 --- a/bootstrap +++ b/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh # Print a version string. -scriptversion=2010-09-30.15; # UTC +scriptversion=2010-09-30.17; # UTC # Bootstrap this package from checked-out sources. @@ -379,6 +379,18 @@ print_versions() { # can't depend on column -t } +use_libtool=0 +# We'd like to use grep -E, to see if any of LT_INIT, +# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, +# but that's not portable enough (e.g., for Solaris). +grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ + && use_libtool=1 +grep '^[ ]*LT_INIT' configure.ac >/dev/null \ + && use_libtool=1 +if test $use_libtool = 1; then + find_tool LIBTOOLIZE glibtoolize libtoolize +fi + if ! printf "$buildreq" | check_versions; then test -f README-prereq && echo "See README-prereq for notes on obtaining these prerequisite programs:" >&2 @@ -740,6 +752,12 @@ gnulib_tool_options="\ --local-dir $local_gl_dir\ $gnulib_tool_option_extras\ " +if test $use_libtool = 1; then + case "$gnulib_tool_options " in + *' --libtool '*) ;; + *) gnulib_tool_options="$gnulib_tool_options --libtool" ;; + esac +fi echo "$0: $gnulib_tool $gnulib_tool_options --import ..." $gnulib_tool $gnulib_tool_options --import $gnulib_modules && slurp $bt || exit @@ -788,17 +806,8 @@ for command in \ "${AUTOMAKE-automake} --add-missing --copy --force-missing" do if test "$command" = libtool; then - use_libtool=0 - # We'd like to use grep -E, to see if any of LT_INIT, - # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, - # but that's not portable enough (e.g., for Solaris). - grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ - && use_libtool=1 - grep '^[ ]*LT_INIT' configure.ac >/dev/null \ - && use_libtool=1 test $use_libtool = 0 \ && continue - find_tool LIBTOOLIZE glibtoolize libtoolize command="${LIBTOOLIZE-libtoolize} -c -f" fi echo "$0: $command ..." diff --git a/bootstrap.conf b/bootstrap.conf index 1f1d416..7ce1e5d 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -133,7 +133,6 @@ gnulib_mk=Makefile.am gnulib_tool_option_extras="\ --lgpl=2\ --with-tests\ - --libtool\ " # Convince bootstrap to use multiple m4 directories. -- 1.7.2.3

Partial reversion of commit 76d87a59, now that bootstrap is smarter. * .gnulib: Update to latest, for poll and bootstrap fixes. * bootstrap: Resync from gnulib. * autogen.sh: Drop redundant tool checks; bootstrap does them better, by honoring environment variables. * examples/domain-events/events-c/Makefile.am (INCLUDES) (event_test_LDADD): Use gnulib library during build. * bootstrap.conf (gnulib_tool_option_extras): Revert --libtool addition, now that updated bootstrap does it for us. Reported by Justin Clift. --- Change in v2: actually commit the changes to examples that were mentioned in the commit message. .gnulib | 2 +- autogen.sh | 37 --------------------------- bootstrap | 32 ++++++++++++++++------ bootstrap.conf | 1 - examples/domain-events/events-c/Makefile.am | 6 +++- 5 files changed, 28 insertions(+), 50 deletions(-) diff --git a/.gnulib b/.gnulib index 833bff3..9f940e9 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 833bff3a531e4730779f8c7be1d9f7c471e6f221 +Subproject commit 9f940e90a7555c3399c9972d9688483c011068c7 diff --git a/autogen.sh b/autogen.sh index 01ba59c..3fff381 100755 --- a/autogen.sh +++ b/autogen.sh @@ -6,43 +6,6 @@ test -z "$srcdir" && srcdir=. THEDIR=`pwd` cd "$srcdir" -DIE=0 - -(autopoint --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autopoint installed to compile libvirt." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/gettext" - DIE=1 -} - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed to compile libvirt." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/autoconf" - DIE=1 -} - -(libtool --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have libtool installed to compile libvirt." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/libtool" - DIE=1 -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - DIE=1 - echo "You must have automake installed to compile libvirt." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/automake" -} - -if test "$DIE" -eq 1; then - exit 1 -fi test -f src/libvirt.c || { echo "You must run this script in the top-level libvirt directory" diff --git a/bootstrap b/bootstrap index 5ab4cf7..e94a29a 100755 --- a/bootstrap +++ b/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh # Print a version string. -scriptversion=2010-07-06.10; # UTC +scriptversion=2010-09-30.17; # UTC # Bootstrap this package from checked-out sources. @@ -346,6 +346,10 @@ check_versions() { ret=0 while read app req_ver; do + # We only need libtoolize from the libtool package. + if test "$app" = libtool; then + app=libtoolize + fi # Honor $APP variables ($TAR, $AUTOCONF, etc.) appvar=`echo $app | tr '[a-z]' '[A-Z]'` test "$appvar" = TAR && appvar=AMTAR @@ -375,6 +379,18 @@ print_versions() { # can't depend on column -t } +use_libtool=0 +# We'd like to use grep -E, to see if any of LT_INIT, +# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, +# but that's not portable enough (e.g., for Solaris). +grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ + && use_libtool=1 +grep '^[ ]*LT_INIT' configure.ac >/dev/null \ + && use_libtool=1 +if test $use_libtool = 1; then + find_tool LIBTOOLIZE glibtoolize libtoolize +fi + if ! printf "$buildreq" | check_versions; then test -f README-prereq && echo "See README-prereq for notes on obtaining these prerequisite programs:" >&2 @@ -736,6 +752,12 @@ gnulib_tool_options="\ --local-dir $local_gl_dir\ $gnulib_tool_option_extras\ " +if test $use_libtool = 1; then + case "$gnulib_tool_options " in + *' --libtool '*) ;; + *) gnulib_tool_options="$gnulib_tool_options --libtool" ;; + esac +fi echo "$0: $gnulib_tool $gnulib_tool_options --import ..." $gnulib_tool $gnulib_tool_options --import $gnulib_modules && slurp $bt || exit @@ -784,14 +806,6 @@ for command in \ "${AUTOMAKE-automake} --add-missing --copy --force-missing" do if test "$command" = libtool; then - use_libtool=0 - # We'd like to use grep -E, to see if any of LT_INIT, - # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, - # but that's not portable enough (e.g., for Solaris). - grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ - && use_libtool=1 - grep '^[ ]*LT_INIT' configure.ac >/dev/null \ - && use_libtool=1 test $use_libtool = 0 \ && continue command="${LIBTOOLIZE-libtoolize} -c -f" diff --git a/bootstrap.conf b/bootstrap.conf index 1f1d416..7ce1e5d 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -133,7 +133,6 @@ gnulib_mk=Makefile.am gnulib_tool_option_extras="\ --lgpl=2\ --with-tests\ - --libtool\ " # Convince bootstrap to use multiple m4 directories. diff --git a/examples/domain-events/events-c/Makefile.am b/examples/domain-events/events-c/Makefile.am index 64457c2..176892b 100644 --- a/examples/domain-events/events-c/Makefile.am +++ b/examples/domain-events/events-c/Makefile.am @@ -1,5 +1,7 @@ -INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include +INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ + -I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib noinst_PROGRAMS = event-test event_test_CFLAGS = $(WARN_CFLAGS) event_test_SOURCES = event-test.c -event_test_LDADD = @top_builddir@/src/libvirt.la +event_test_LDADD = $(top_builddir)/src/libvirt.la \ + $(top_builddir)/gnulib/lib/libgnu.la -- 1.7.2.3

On 10/01/2010 03:35 AM, Eric Blake wrote:
Partial reversion of commit 76d87a59, now that bootstrap is smarter.
* .gnulib: Update to latest, for poll and bootstrap fixes. * bootstrap: Resync from gnulib. * autogen.sh: Drop redundant tool checks; bootstrap does them better, by honoring environment variables. * examples/domain-events/events-c/Makefile.am (INCLUDES) (event_test_LDADD): Use gnulib library during build. * bootstrap.conf (gnulib_tool_option_extras): Revert --libtool addition, now that updated bootstrap does it for us. Reported by Justin Clift. ---
Change in v2: actually commit the changes to examples that were mentioned in the commit message.
ACK. Tested here on both 32 and 64 bit MacOS X. Looks good. :)

On 09/30/2010 12:07 PM, Justin Clift wrote:
On 10/01/2010 03:35 AM, Eric Blake wrote: ^^^^^^^^ Thanks for testing, and get some sleep :)
Partial reversion of commit 76d87a59, now that bootstrap is smarter.
* .gnulib: Update to latest, for poll and bootstrap fixes. * bootstrap: Resync from gnulib. * autogen.sh: Drop redundant tool checks; bootstrap does them better, by honoring environment variables. * examples/domain-events/events-c/Makefile.am (INCLUDES) (event_test_LDADD): Use gnulib library during build. * bootstrap.conf (gnulib_tool_option_extras): Revert --libtool addition, now that updated bootstrap does it for us. Reported by Justin Clift. ---
Change in v2: actually commit the changes to examples that were mentioned in the commit message.
ACK. Tested here on both 32 and 64 bit MacOS X. Looks good. :)
Pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Gary V. Vaughan
-
Justin Clift