If we're using thread pools, check for sem_init() in whatever
[freeradius.git] / configure.in
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