* configure.in, dbus-1.pc.in: Check to see if thread methods
authorJohn (J5) Palmieri <johnp@redhat.com>
Thu, 26 Oct 2006 18:06:07 +0000 (18:06 +0000)
committerJohn (J5) Palmieri <johnp@redhat.com>
Thu, 26 Oct 2006 18:06:07 +0000 (18:06 +0000)
  are in glibc or libpthread and add -lpthread to the link stage
  if it is the latter

ChangeLog
configure.in
dbus-1.pc.in
dbus/Makefile.am
test/name-test/Makefile.am
tools/Makefile.am

index 09e0ca3..3fba2ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-10-26  John (J5) Palmieri  <johnp@redhat.com>
+
+       * configure.in, dbus-1.pc.in: Check to see if thread methods 
+       are in glibc or libpthread and add -lpthread to the link stage 
+       if it is the latter
+
 2006-10-26  Thiago Macieira  <thiago@kde.org>
 
        * dbus/dbus-connection.c (_dbus_connection_open_internal): Fix
index 9efd817..2d5c713 100644 (file)
@@ -526,6 +526,8 @@ AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
 
 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist fpathconf)
 
+
+
 AC_MSG_CHECKING(for dirfd)
 AC_TRY_COMPILE([
 #include <sys/types.h>
@@ -776,6 +778,10 @@ if $dbus_use_libxml; then
    XML_CFLAGS=$LIBXML_CFLAGS
 fi
 
+# Thread lib detection
+AC_CHECK_FUNC(pthread_cond_timedwait,,[AC_CHECK_LIB(pthread,pthread_cond_timedwait,
+                                                    [THREAD_LIBS="-lpthread"])])
+
 # SELinux detection
 if test x$enable_selinux = xno ; then
     have_selinux=no;
@@ -810,7 +816,12 @@ fi
 AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
 
 if test x$have_selinux = xyes ; then
-    SELINUX_LIBS="-lselinux -lpthread"
+    # the selinux code creates threads
+    # which requires libpthread even on linux
+    AC_CHECK_FUNC(pthread_create,,[AC_CHECK_LIB(pthread,pthread_create,
+                                                [SELINUX_THREAD_LIBS="-lpthread"])])
+
+    SELINUX_LIBS="-lselinux $SELINUX_THREAD_LIBS"
     AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
 else
     SELINUX_LIBS=
@@ -872,17 +883,17 @@ AM_CONDITIONAL(HAVE_CONSOLE_OWNER_FILE, test x$have_console_owner_file = xyes)
 
 #### Set up final flags
 DBUS_CLIENT_CFLAGS=
-DBUS_CLIENT_LIBS=
+DBUS_CLIENT_LIBS="$THREAD_LIBS"
 AC_SUBST(DBUS_CLIENT_CFLAGS)
 AC_SUBST(DBUS_CLIENT_LIBS)
 
 DBUS_BUS_CFLAGS=$XML_CFLAGS
-DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS $INTLLIBS"
+DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS $INTLLIBS $THREAD_LIBS"
 AC_SUBST(DBUS_BUS_CFLAGS)
 AC_SUBST(DBUS_BUS_LIBS)
 
 DBUS_TEST_CFLAGS=
-DBUS_TEST_LIBS=
+DBUS_TEST_LIBS="$THREAD_LIBS"
 AC_SUBST(DBUS_TEST_CFLAGS)
 AC_SUBST(DBUS_TEST_LIBS)
 
index 174d87d..889f72d 100644 (file)
@@ -9,6 +9,6 @@ session_bus_services_dir=@EXPANDED_DATADIR@/dbus-1/services
 Name: dbus
 Description: Free desktop message bus
 Version: @VERSION@
-Libs: -L${libdir} -ldbus-1
+Libs: -L${libdir} -ldbus-1 @DBUS_CLIENT_LIBS@ 
 Cflags: -I${includedir}/dbus-1.0 -I${libdir}/dbus-1.0/include
 
index c1d7bc2..b8d9778 100644 (file)
@@ -185,7 +185,7 @@ noinst_PROGRAMS=$(TESTS)
 dbus_test_SOURCES=                             \
        dbus-test-main.c
 
-dbus_test_LDADD=libdbus-convenience.la
+dbus_test_LDADD=libdbus-convenience.la $(DBUS_TEST_LIBS)
 dbus_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 ## mop up the gcov files
index ea35bc7..eec358a 100644 (file)
@@ -21,19 +21,19 @@ noinst_PROGRAMS=test-names test-pending-call-dispatch test-threads-init
 test_names_SOURCES=                            \
        test-names.c
 
-test_names_LDADD=$(top_builddir)/dbus/libdbus-convenience.la
+test_names_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS)
 test_names_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 test_pending_call_dispatch_SOURCES =           \
        test-pending-call-dispatch.c
 
-test_pending_call_dispatch_LDADD=$(top_builddir)/dbus/libdbus-convenience.la
+test_pending_call_dispatch_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS)
 test_pending_call_dispatch_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 test_threads_init_SOURCES =            \
        test-threads-init.c
 
-test_threads_init_LDADD=$(top_builddir)/dbus/libdbus-convenience.la
+test_threads_init_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS)
 test_threads_init_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 endif
index 015354d..c6814e9 100644 (file)
@@ -25,16 +25,16 @@ dbus_cleanup_sockets_SOURCES=                       \
 dbus_uuidgen_SOURCES=                          \
        dbus-uuidgen.c
 
-dbus_send_LDADD= $(top_builddir)/dbus/libdbus-1.la
+dbus_send_LDADD= $(top_builddir)/dbus/libdbus-1.la $(DBUS_CLIENT_LIBS)
 dbus_send_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
-dbus_monitor_LDADD= $(top_builddir)/dbus/libdbus-1.la
+dbus_monitor_LDADD= $(top_builddir)/dbus/libdbus-1.la $(DBUS_CLIENT_LIBS)
 dbus_monitor_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
-dbus_uuidgen_LDADD= $(top_builddir)/dbus/libdbus-1.la
+dbus_uuidgen_LDADD= $(top_builddir)/dbus/libdbus-1.la $(DBUS_CLIENT_LIBS)
 dbus_uuidgen_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
-dbus_launch_LDADD= $(DBUS_X_LIBS)
+dbus_launch_LDADD= $(DBUS_X_LIBS) $(DBUS_CLIENT_LIBS)
 dbus_launch_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 man_MANS = dbus-send.1 dbus-monitor.1 dbus-launch.1 dbus-cleanup-sockets.1 dbus-uuidgen.1