[libvirt] [PATCH] Put libraries in $LIBS, not $LDFLAGS, during configure tests.

Daniel P. Berrange berrange at redhat.com
Wed Nov 25 11:24:31 UTC 2009


On Mon, Nov 23, 2009 at 09:28:24PM +0000, Nix wrote:
> If libraries go in $LDFLAGS while AC_CHECK_LIBbing, they'll end up in
> front of the object file name, which rarely works well. They belong
> in $LIBS.

What platforms / scenarios show this problem ?   Empirically it has
been working fine on our commonly tested platforms, so it'll be
important to know where to look/test for this problem.


> ---
>  configure.in |   25 ++++++++++++-------------
>  1 files changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/configure.in b/configure.in
> index f735bba..5308364 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -542,14 +542,14 @@ AC_SUBST([LIBXML_LIBS])
>  
>  dnl xmlURI structure has query_raw?
>  old_cflags="$CFLAGS"
> -old_ldflags="$LDFLAGS"
> +old_libs="$LIBS"
>  CFLAGS="$CFLAGS $LIBXML_CFLAGS"
> -LDFLAGS="$LDFLAGS $LIBXML_LIBS"
> +LIBS="$LIBS $LIBXML_LIBS"
>  AC_CHECK_MEMBER([struct _xmlURI.query_raw],
>  		[AC_DEFINE([HAVE_XMLURI_QUERY_RAW], [], [Have query_raw field in libxml2 xmlURI structure])],,
>  		[#include <libxml/uri.h>])
>  CFLAGS="$old_cflags"
> -LDFLAGS="$old_ldflags"
> +LIBS="$old_libs"
>  
>  dnl GnuTLS library
>  GNUTLS_CFLAGS=
> @@ -579,15 +579,15 @@ dnl Old versions of GnuTLS uses types like 'gnutls_session' instead
>  dnl of 'gnutls_session_t'.  Try to detect this type if defined so
>  dnl that we can offer backwards compatibility.
>  old_cflags="$CFLAGS"
> -old_ldflags="$LDFLAGS"
> +old_libs="$LIBS"
>  CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
> -LDFLAGS="$LDFLAGS $GNUTLS_LIBS"
> +LIBS="$LIBS $GNUTLS_LIBS"
>  AC_CHECK_TYPE([gnutls_session],
>  	AC_DEFINE([GNUTLS_1_0_COMPAT],[],
>  		[enable GnuTLS 1.0 compatibility macros]),,
>  	[#include <gnutls/gnutls.h>])
>  CFLAGS="$old_cflags"
> -LDFLAGS="$old_ldflags"
> +LIBS="$old_libs"
>  
>  
>  dnl Cyrus SASL
> @@ -685,12 +685,12 @@ if test "x$with_polkit" = "xyes" -o "x$with_polkit" = "xcheck"; then
>          [use PolicyKit for UNIX socket access checks])
>  
>        old_CFLAGS=$CFLAGS
> -      old_LDFLAGS=$LDFLAGS
> +      old_LIBS=$LIBS
>        CFLAGS="$CFLAGS $POLKIT_CFLAGS"
> -      LDFLAGS="$LDFLAGS $POLKIT_LIBS"
> +      LIBS="$LIBS $POLKIT_LIBS"
>        AC_CHECK_FUNCS([polkit_context_is_caller_authorized])
>        CFLAGS="$old_CFLAGS"
> -      LDFLAGS="$old_LDFLAGS"
> +      LIBS="$old_LIBS"
>  
>        AC_PATH_PROG([POLKIT_AUTH], [polkit-auth])
>        if test "x$POLKIT_AUTH" != "x"; then
> @@ -1682,20 +1682,19 @@ if test "x$with_hal" = "xyes" -o "x$with_hal" = "xcheck"; then
>        [use HAL for host device enumeration])
>  
>      old_CFLAGS=$CFLAGS
> -    old_LDFLAGS=$LDFLAGS
> +    old_LIBS=$LIBS
>      CFLAGS="$CFLAGS $HAL_CFLAGS"
> -    LDFLAGS="$LDFLAGS $HAL_LIBS"
> +    LIBS="$LIBS $HAL_LIBS"
>      AC_CHECK_FUNCS([libhal_get_all_devices],,[with_hal=no])
>      AC_CHECK_FUNCS([dbus_watch_get_unix_fd])
>      CFLAGS="$old_CFLAGS"
> -    LDFLAGS="$old_LDFLAGS"
> +    LIBS="$old_LIBS"
>    fi
>  fi
>  AM_CONDITIONAL([HAVE_HAL], [test "x$with_hal" = "xyes"])
>  AC_SUBST([HAL_CFLAGS])
>  AC_SUBST([HAL_LIBS])
>  
> -
>  dnl udev/libpciaccess library check for alternate host device enumeration
>  UDEV_CFLAGS=
>  UDEV_LIBS=


ACK


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list