s3: get pthread detection also on HP-UX right
authorBjörn Jacke <bj@sernet.de>
Wed, 27 Jan 2010 17:54:55 +0000 (18:54 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 15 Feb 2010 15:38:46 +0000 (16:38 +0100)
(cherry picked from commit 6bade10a1eb21689613770f9a54e0a080663029c)

source3/configure.in

index fa03260a02a48447ed99901fa2fc190c5e93fe20..2750053c4ab3646c70cc218d472f78b167f875c9 100644 (file)
@@ -6314,17 +6314,28 @@ if test "x$PTHREAD_LDFLAGS" = xerror; then
                 PTHREAD_LDFLAGS="-lpthread" ])
 fi
 
+# especially for HP-UX, where the AC_CHECK_FUNC macro fails to test for
+# pthread_attr_init. On pthread_mutex_lock it works there...
+if test "x$PTHREAD_LDFLAGS" = xerror; then
+   AC_CHECK_LIB(pthread, pthread_mutex_lock, [
+               PTHREAD_CFLAGS=="-D_REENTRANT"
+               PTHREAD_LDFLAGS="-lpthread" ])
+fi
+
 AC_SUBST(PTHREAD_CFLAGS)
 AC_SUBST(PTHREAD_LDFLAGS)
 
 samba_cv_HAVE_PTHREAD=no
 if test x"$PTHREAD_CFLAGS" != xerror -a x"$PTHREAD_LDFLAGS" != xerror; then
        samba_cv_HAVE_PTHREAD=yes
-       # now check for pthread.h with pthread-correct CFLAGS:
+       # now check for pthread.h with pthread-correct CFLAGS and LDFLAGS:
        ac_save_CFLAGS=$CFLAGS
        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+       ac_save_LDFLAGS=$LDFLAGS
+       LDFLAGS="$LDFLAGS $PTHREAD_LDFLAGS"
        AC_CHECK_HEADERS(pthread.h)
        CFLAGS=$ac_save_CFLAGS
+       LDFLAGS=$ac_save_LDFLAGS
 fi
 
 #################################################