If we're using thread pools, check for sem_init() in whatever
authoraland <aland>
Tue, 4 Apr 2000 17:54:34 +0000 (17:54 +0000)
committeraland <aland>
Tue, 4 Apr 2000 17:54:34 +0000 (17:54 +0000)
libraries were necessary to run threads.

Also updated PTHREADLIB, so '-lpthread' (or whatever) is just
dropped in as part of LIBS.  This allows the sem_init() check to
work, so I guess it's a Good Thing.

Make.inc.in
configure.in

index ca51cd9..e973331 100644 (file)
@@ -26,7 +26,6 @@ LIBPREFIX     = @LIBPREFIX@
 
 LIBTOOL                = @LIBTOOL@
 
-PTHREADLIB     = @PTHREADLIB@
 LCRYPT         = @CRYPTLIB@
 LDBM           = @DBMLIB@
 SOCKETLIB      = @SOCKETLIB@
index 5ed99f1..4617ed3 100644 (file)
@@ -312,7 +312,7 @@ if test "$WITH_THREADS" = "yes"; then
       PTHREADLIB="-lc_r"
     )
   fi
-  AC_SUBST(PTHREADLIB)
+  LIBS="$LIBS $PTHREADLIB"
 fi
 
 if test "$WITH_THREAD_POOL" = "yes"; then
@@ -326,7 +326,14 @@ if test "$WITH_THREAD_POOL" = "yes"; then
     AC_MSG_ERROR(You must have threading libraries for thread pools to work.)
   fi
 
-  AC_DEFINE(WITH_THREAD_POOL,1)
+  AC_CHECK_FUNC(sem_init,
+               HAVE_SEM_INIT=1,
+               HAVE_SEM_INIT=0)
+  if test "$HAVE_SEM_INIT" != "1"; then
+    AC_MSG_WARN(You do not have posix semaphores.  Disabling thread pools)
+  else
+    AC_DEFINE(WITH_THREAD_POOL,1)
+  fi
 fi
 
 dnl Check for -lsocket