]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
maybe pthread functions are in -lc?
authorAlan T. DeKok <aland@freeradius.org>
Wed, 28 Aug 2024 19:41:16 +0000 (15:41 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 28 Aug 2024 19:49:19 +0000 (15:49 -0400)
configure.ac

index 34c831ee1e72a23c086cbb4299761700b663c901..b42a68edb065226adba9de22229fbb5c91068e61 100644 (file)
@@ -888,6 +888,31 @@ AC_CHECK_HEADERS(pthread.h, [],
   fail=[pthread.h]
 ])
 
+if test "x$HAVE_THREADS" != "xno"; then
+  dnl #
+  dnl #  pthread stuff is usually in -lpthread
+  dnl #  or in -lc_r, on *BSD
+  dnl #
+  dnl #  On Some systems, we need extra pre-processor flags, to get them to
+  dnl #  to do the threading properly.
+  dnl #
+  AC_CHECK_LIB(c, pthread_create,
+    [
+      HAVE_THREADS="yes"
+      CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
+
+      dnl #
+      dnl #  -pthread should add all required CPP definitions and linker
+      dnl #  arguments. But not all compilers support it, or some compilers
+      dnl #  only support it on certain platforms.
+      dnl #
+      AX_CC_PTHREAD_FLAG
+      if test "x$ax_cv_cc_pthread_flag" = 'xyes'; then
+        CFLAGS="$CFLAGS -pthread"
+      fi
+    ]
+  )
+fi
 if test "x$HAVE_THREADS" != "xno"; then
   dnl #
   dnl #  pthread stuff is usually in -lpthread