From cffe49096c0ad784de45d58602b7f52f6d67ffe0 Mon Sep 17 00:00:00 2001 From: Magnus Henoch Date: Mon, 3 Dec 2007 22:04:33 +0000 Subject: [PATCH] * configure.in: Use PKG_CHECK_MODULES to check for D-Bus. * configure: Regenerate. --- ChangeLog | 6 ++ configure | 161 +++++++++++++++++++++++++++++---------------------- configure.in | 6 +- 3 files changed, 99 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75014df3b33..3935fb661f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-12-03 Magnus Henoch + + * configure.in: Use PKG_CHECK_MODULES to check for D-Bus. + + * configure: Regenerate. + 2007-12-03 Michael Albinus * configure.in: No need for DBUS_INFO anymore. diff --git a/configure b/configure index 122bddb939f..19f55c23fe7 100755 --- a/configure +++ b/configure @@ -12004,70 +12004,101 @@ fi HAVE_DBUS=no if test "${with_dbus}" = "yes"; then - { echo "$as_me:$LINENO: checking for dbus_bus_get in -ldbus-1" >&5 -echo $ECHO_N "checking for dbus_bus_get in -ldbus-1... $ECHO_C" >&6; } -if test "${ac_cv_lib_dbus_1_dbus_bus_get+set}" = set; then + + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldbus-1 $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dbus_bus_get (); -int -main () -{ -return dbus_bus_get (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_dbus_1_dbus_bus_get=yes +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6; } else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dbus_1_dbus_bus_get=no + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dbus_1_dbus_bus_get" >&5 -echo "${ECHO_T}$ac_cv_lib_dbus_1_dbus_bus_get" >&6; } -if test $ac_cv_lib_dbus_1_dbus_bus_get = yes; then - HAVE_DBUS=yes -fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + HAVE_DBUS=no + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + { echo "$as_me:$LINENO: checking for dbus-1 >= 1.0" >&5 +echo $ECHO_N "checking for dbus-1 >= 1.0... $ECHO_C" >&6; } + + if $PKG_CONFIG --exists "dbus-1 >= 1.0" 2>&5; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + succeeded=yes + + { echo "$as_me:$LINENO: checking DBUS_CFLAGS" >&5 +echo $ECHO_N "checking DBUS_CFLAGS... $ECHO_C" >&6; } + DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1 >= 1.0"|sed -e 's,///*,/,g'` + { echo "$as_me:$LINENO: result: $DBUS_CFLAGS" >&5 +echo "${ECHO_T}$DBUS_CFLAGS" >&6; } + + { echo "$as_me:$LINENO: checking DBUS_LIBS" >&5 +echo $ECHO_N "checking DBUS_LIBS... $ECHO_C" >&6; } + DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1 >= 1.0"|sed -e 's,///*,/,g'` + { echo "$as_me:$LINENO: result: $DBUS_LIBS" >&5 +echo "${ECHO_T}$DBUS_LIBS" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + DBUS_CFLAGS="" + DBUS_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + DBUS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "dbus-1 >= 1.0"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + HAVE_DBUS=yes + else + HAVE_DBUS=no + fi if test "$HAVE_DBUS" = yes; then @@ -12075,10 +12106,6 @@ cat >>confdefs.h <<\_ACEOF #define HAVE_DBUS 1 _ACEOF - DBUS_CFLAGS="-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include" - - DBUS_LIBS="-ldbus-1" - fi fi @@ -18560,13 +18587,11 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include /* for off_t */ - #include +#include int main () { -int (*fp) (FILE *, off_t, int) = fseeko; - return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } @@ -18606,13 +18631,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 -#include /* for off_t */ - #include +#include int main () { -int (*fp) (FILE *, off_t, int) = fseeko; - return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } diff --git a/configure.in b/configure.in index 9ddc30fdafc..c41db750d6f 100644 --- a/configure.in +++ b/configure.in @@ -2264,13 +2264,9 @@ dnl other platforms. Support for higher D-Bus versions but 1.0 is dnl also not configured. HAVE_DBUS=no if test "${with_dbus}" = "yes"; then - AC_CHECK_LIB(dbus-1, dbus_bus_get, HAVE_DBUS=yes) + PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no) if test "$HAVE_DBUS" = yes; then AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.]) - DBUS_CFLAGS="-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include" - AC_SUBST(DBUS_CFLAGS) - DBUS_LIBS="-ldbus-1" - AC_SUBST(DBUS_LIBS) fi fi -- 2.39.2