From b18b9f3753f9e61c670e8dbe5601b5183ffafa30 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 18 Apr 2006 19:10:59 +0200 Subject: [PATCH] configure: Added check to catch old versions of the dbus library. --- configure | 78 +++++++++++++++++++++++++++++++++++++++++++++++++--- configure.ac | 8 ++++-- 2 files changed, 80 insertions(+), 6 deletions(-) diff --git a/configure b/configure index a89eb51c6fe..104f08f24c8 100755 --- a/configure +++ b/configure @@ -9577,13 +9577,20 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - echo "$as_me:$LINENO: checking for libhal_ctx_new in -lhal" >&5 + +fi + +done + + if test "$ac_cv_header_dbus_dbus_h" = "yes" -a "$ac_cv_header_hal_libhal_h" = "yes" + then + echo "$as_me:$LINENO: checking for libhal_ctx_new in -lhal" >&5 echo $ECHO_N "checking for libhal_ctx_new in -lhal... $ECHO_C" >&6 if test "${ac_cv_lib_hal_libhal_ctx_new+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lhal $ac_hal_libs $LIBS" +LIBS="-lhal $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9641,6 +9648,70 @@ fi echo "$as_me:$LINENO: result: $ac_cv_lib_hal_libhal_ctx_new" >&5 echo "${ECHO_T}$ac_cv_lib_hal_libhal_ctx_new" >&6 if test $ac_cv_lib_hal_libhal_ctx_new = yes; then + echo "$as_me:$LINENO: checking for dbus_connection_close in -ldbus-1" >&5 +echo $ECHO_N "checking for dbus_connection_close in -ldbus-1... $ECHO_C" >&6 +if test "${ac_cv_lib_dbus_1_dbus_connection_close+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldbus-1 $ac_hal_libs $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dbus_connection_close (); +int +main () +{ +dbus_connection_close (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dbus_1_dbus_connection_close=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dbus_1_dbus_connection_close=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dbus_1_dbus_connection_close" >&5 +echo "${ECHO_T}$ac_cv_lib_dbus_1_dbus_connection_close" >&6 +if test $ac_cv_lib_dbus_1_dbus_connection_close = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LIBHAL 1 @@ -9651,8 +9722,7 @@ fi fi -done - + fi CPPFLAGS="$ac_save_CPPFLAGS" fi diff --git a/configure.ac b/configure.ac index c61e55483a8..a4103c490e7 100644 --- a/configure.ac +++ b/configure.ac @@ -513,10 +513,14 @@ then ac_hal_libs="`$PKG_CONFIG --libs hal`" ac_hal_cflags="`$PKG_CONFIG --cflags hal`" CPPFLAGS="$CPPFLAGS $ac_hal_cflags" - AC_CHECK_HEADERS([dbus/dbus.h hal/libhal.h], - [AC_CHECK_LIB(hal, libhal_ctx_new, + AC_CHECK_HEADERS([dbus/dbus.h hal/libhal.h]) + if test "$ac_cv_header_dbus_dbus_h" = "yes" -a "$ac_cv_header_hal_libhal_h" = "yes" + then + AC_CHECK_LIB(hal, libhal_ctx_new, + [AC_CHECK_LIB(dbus-1, dbus_connection_close, [AC_DEFINE(HAVE_LIBHAL, 1, [Define if you have the hal library]) HALINCL="$ac_hal_cflags"],,$ac_hal_libs)]) + fi CPPFLAGS="$ac_save_CPPFLAGS" fi