Remove the -pthread patching and properly fix the autoconf test for the

pthread functions.

from Brad
This commit is contained in:
ajacoutot 2012-09-04 06:32:52 +00:00
parent f8749a2c60
commit 73faab8d51
4 changed files with 119 additions and 99 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.85 2012/08/15 08:03:43 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.86 2012/09/04 06:32:52 ajacoutot Exp $
COMMENT= message bus system
DISTNAME= dbus-1.6.4
REVISION= 0
EPOCH= 0
SHARED_LIBS += dbus-1 10.2 # 10.2
@ -28,9 +29,10 @@ SEPARATE_BUILD= Yes
USE_GMAKE= Yes
USE_LIBTOOL= Yes
CONFIGURE_STYLE= gnu
CONFIGURE_STYLE= autoconf
AUTOCONF_VERSION= 2.69
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib -pthread"
LDFLAGS="-L${LOCALBASE}/lib"
CONFIGURE_ARGS= --with-dbus-user=_dbus \
--with-xml=expat \
--with-x \

View File

@ -1,82 +0,0 @@
$OpenBSD: patch-configure,v 1.21 2012/08/15 08:03:43 ajacoutot Exp $
--- configure.orig Wed Jul 18 19:22:20 2012
+++ configure Wed Aug 15 09:51:07 2012
@@ -19040,7 +19040,8 @@ fi
done
-ac_fn_c_check_decl "$LINENO" "MSG_NOSIGNAL" "ac_cv_have_decl_MSG_NOSIGNAL" " #include <sys/socket.h>
+ac_fn_c_check_decl "$LINENO" "MSG_NOSIGNAL" "ac_cv_have_decl_MSG_NOSIGNAL" " #include <sys/types.h>
+#include <sys/socket.h>
"
if test "x$ac_cv_have_decl_MSG_NOSIGNAL" = xyes; then :
ac_have_decl=1
@@ -19595,13 +19596,13 @@ fi
# Thread lib detection
ac_fn_c_check_func "$LINENO" "pthread_cond_timedwait" "ac_cv_func_pthread_cond_timedwait"
if test "x$ac_cv_func_pthread_cond_timedwait" = xyes; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_cond_timedwait in -lpthread" >&5
-$as_echo_n "checking for pthread_cond_timedwait in -lpthread... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_cond_timedwait in -pthread" >&5
+$as_echo_n "checking for pthread_cond_timedwait in -pthread... " >&6; }
if ${ac_cv_lib_pthread_pthread_cond_timedwait+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+LIBS="-pthread $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -19632,7 +19633,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_cond_timedwait" >&5
$as_echo "$ac_cv_lib_pthread_pthread_cond_timedwait" >&6; }
if test "x$ac_cv_lib_pthread_pthread_cond_timedwait" = xyes; then :
- THREAD_LIBS="-lpthread"
+ THREAD_LIBS="-pthread"
fi
fi
@@ -19700,7 +19701,7 @@ $as_echo "$ac_cv_search_clock_getres" >&6; }
ac_res=$ac_cv_search_clock_getres
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
- THREAD_LIBS="$THREAD_LIBS -lrt"
+ THREAD_LIBS="$THREAD_LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOCK_MONOTONIC" >&5
@@ -19849,13 +19850,13 @@ if test x$have_selinux = xyes ; then
if test "x$ac_cv_func_pthread_create" = xyes; then :
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -pthread" >&5
+$as_echo_n "checking for pthread_create in -pthread... " >&6; }
if ${ac_cv_lib_pthread_pthread_create+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+LIBS="-pthread $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -19886,7 +19887,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
- SELINUX_THREAD_LIBS="-lpthread"
+ SELINUX_THREAD_LIBS="-pthread"
fi
fi
@@ -20419,6 +20420,7 @@ $as_echo_n "checking for SCM_RIGHTS... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
static int x = SCM_RIGHTS;

View File

@ -0,0 +1,114 @@
$OpenBSD: patch-configure_ac,v 1.1 2012/09/04 06:32:52 ajacoutot Exp $
pthread_* chunk is from:
https://bugs.freedesktop.org/show_bug.cgi?id=47239
--- configure.ac.orig Wed Jul 18 13:05:04 2012
+++ configure.ac Mon Sep 3 13:25:41 2012
@@ -766,7 +766,8 @@ dnl needed on darwin for NAME_MAX
AC_CHECK_HEADERS(sys/syslimits.h)
dnl Make it easy to check if we have MSG_NOSIGNAL without actually having to include sys/socket.h
-AC_CHECK_DECLS([MSG_NOSIGNAL], [], [], [[ #include <sys/socket.h> ]])
+AC_CHECK_DECLS([MSG_NOSIGNAL], [], [], [[ #include <sys/types.h>
+#include <sys/socket.h> ]])
dnl check for flavours of varargs macros (test from GLib)
AC_MSG_CHECKING(for ISO C99 varargs macros in C)
@@ -952,15 +953,53 @@ AC_SUBST([XML_CFLAGS])
AC_SUBST([XML_LIBS])
# Thread lib detection
-AC_CHECK_FUNC(pthread_cond_timedwait,[AC_CHECK_LIB(pthread,pthread_cond_timedwait,
- [THREAD_LIBS="-lpthread"])])
+AC_ARG_VAR([THREAD_LIBS])
save_libs="$LIBS"
LIBS="$LIBS $THREAD_LIBS"
-AC_CHECK_FUNC(pthread_condattr_setclock,have_pthread_condattr_setclock=true,have_pthread_condattr_setclock=false)
-if test x$have_pthread_condattr_setclock = xtrue; then
- AC_SEARCH_LIBS([clock_getres],[rt],[THREAD_LIBS="$THREAD_LIBS -lrt"])
- AC_MSG_CHECKING([for CLOCK_MONOTONIC])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
+
+is_missing_pthread_function="is required when compiling D-Bus on Unix platforms, but is not in your libc or libpthread. Please open a bug on https://bugs.freedesktop.org/enter_bug.cgi?product=dbus with details of your platform."
+
+# Don't do these automatic checks if the user set THREAD_LIBS on the
+# configure command-line. If they did, we assume they're right.
+#
+# We also don't do these checks on Windows, because you don't need magical
+# linker flags to have threading support there.
+AS_IF([test "x$dbus_unix" = xyes && test "x$THREAD_LIBS" = x],
+ [
+ # Mandatory pthread functions. In principle, some of these could be made
+ # optional if there are platforms that don't have them.
+ #
+ # Currently, we only look in -lpthread.
+ # In principle we might need to look in -lpthreads, -lthreads, ...
+ # as well - please file a bug if your platform needs this.
+ AC_SEARCH_LIBS([pthread_cond_timedwait],
+ [pthread],
+ [THREAD_LIBS="$LIBS"],
+ [AC_MSG_ERROR([pthread_cond_timedwait $is_missing_pthread_function])],
+ [])
+ AC_SEARCH_LIBS([pthread_mutexattr_init],
+ [pthread],
+ [THREAD_LIBS="$LIBS"],
+ [AC_MSG_ERROR([pthread_mutexattr_init $is_missing_pthread_function])],
+ [])
+ AC_SEARCH_LIBS([pthread_mutexattr_settype],
+ [pthread],
+ [THREAD_LIBS="$LIBS"],
+ [AC_MSG_ERROR([pthread_mutexattr_settype $is_missing_pthread_function])],
+ [])
+
+ # Optional, for monotonic clocks. Because it's optional, this check
+ # is non-fatal if we don't find it.
+ AC_SEARCH_LIBS([pthread_condattr_setclock],
+ [pthread],
+ [THREAD_LIBS="$LIBS"])
+
+ AS_IF([test "x$ac_cv_search_pthread_condattr_setclock" != xno],
+ [
+ AC_SEARCH_LIBS([clock_getres], [rt], [THREAD_LIBS="$LIBS"])
+ AC_MSG_CHECKING([for CLOCK_MONOTONIC])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#include <time.h>
#include <pthread.h>
]], [[
struct timespec monotonic_timer;
@@ -969,15 +1008,18 @@ pthread_condattr_init (&attr);
pthread_condattr_setclock (&attr, CLOCK_MONOTONIC);
clock_getres (CLOCK_MONOTONIC,&monotonic_timer);
]])],
-[have_clock_monotonic=true],
-[have_clock_monotonic=false])
-if test x$have_clock_monotonic = xtrue; then
- AC_MSG_RESULT([found])
- AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1, [Define if we have CLOCK_MONOTONIC])
-else
- AC_MSG_RESULT([not found])
-fi
-fi
+
+ [have_clock_monotonic=true],
+ [have_clock_monotonic=false])
+ AS_IF([test x$have_clock_monotonic = xtrue],
+ [
+ AC_MSG_RESULT([found])
+ AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1, [Define if we have CLOCK_MONOTONIC])
+ ],
+ [AC_MSG_RESULT([not found])])
+ ]) dnl have pthread_condattr_setclock
+ ]) dnl on Unix
+
LIBS="$save_libs"
AC_SUBST([THREAD_LIBS])
@@ -1220,6 +1262,7 @@ AC_SUBST([ADT_LIBS])
# Check for SCM_RIGHTS
AC_MSG_CHECKING([for SCM_RIGHTS])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
static int x = SCM_RIGHTS;

View File

@ -1,14 +0,0 @@
$OpenBSD: patch-dbus-1_pc_in,v 1.8 2012/07/06 16:28:21 ajacoutot Exp $
pthreads(3) is needed to link with libdbus-1.
--- dbus-1.pc.in.orig Fri Jul 6 18:11:44 2012
+++ dbus-1.pc.in Fri Jul 6 18:12:27 2012
@@ -12,6 +12,6 @@ daemondir=@DBUS_DAEMONDIR@
Name: dbus
Description: Free desktop message bus
Version: @VERSION@
-Libs: -L${libdir} -ldbus-1
+Libs: -pthread -L${libdir} -ldbus-1
Libs.private: @LIBDBUS_LIBS@
Cflags: -I${includedir}/dbus-1.0 -I${libdir}/dbus-1.0/include @DBUS_STATIC_BUILD_CPPFLAGS@