changeset 87016:178e4648e5d6

* configure.in: Use PKG_CHECK_MODULES to check for D-Bus. * configure: Regenerate.
author Magnus Henoch <mange@freemail.hu>
date Mon, 03 Dec 2007 22:04:25 +0000
parents eb85998bbcf9
children 9b896bc40fa2
files configure configure.in
diffstat 2 files changed, 106 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Mon Dec 03 21:37:30 2007 +0000
+++ b/configure	Mon Dec 03 22:04:25 2007 +0000
@@ -12004,70 +12004,101 @@
 
 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
-  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.  */
-
-/* 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;;
-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
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dbus_1_dbus_bus_get=no
-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
+
+  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
+  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
+
+  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+  ;;
+esac
+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:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+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 @@
 #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 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
-int
-main ()
-{
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+#include <stdio.h>
+int
+main ()
+{
+return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
   ;
   return 0;
 }
@@ -18606,13 +18631,11 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #define _LARGEFILE_SOURCE 1
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
-int
-main ()
-{
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+#include <stdio.h>
+int
+main ()
+{
+return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
   ;
   return 0;
 }
--- a/configure.in	Mon Dec 03 21:37:30 2007 +0000
+++ b/configure.in	Mon Dec 03 22:04:25 2007 +0000
@@ -2264,13 +2264,9 @@
 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