[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bzflag-commits
Subject:    SF.net SVN: bzflag: [16626] trunk/bzflag/configure.ac
From:       dtremenak () users ! sourceforge ! net
Date:       2008-02-20 8:40:33
Message-ID: E1JRkVF-0003GL-KK () sc8-pr-svn2 ! sourceforge ! net
[Download RAW message or body]

Revision: 16626
          http://bzflag.svn.sourceforge.net/bzflag/?rev=16626&view=rev
Author:   dtremenak
Date:     2008-02-20 00:40:33 -0800 (Wed, 20 Feb 2008)

Log Message:
-----------
try to come up with a reasonably robust configure test for pthreads.  warning: \
completely untested (maybe I'll get around to it tomorrow).

Modified Paths:
--------------
    trunk/bzflag/configure.ac

Modified: trunk/bzflag/configure.ac
===================================================================
--- trunk/bzflag/configure.ac	2008-02-20 08:38:44 UTC (rev 16625)
+++ trunk/bzflag/configure.ac	2008-02-20 08:40:33 UTC (rev 16626)
@@ -129,12 +129,7 @@
 AM_CONDITIONAL(BUILD_PLUGINS, test "x$enable_plugins" != "xno")
 
 # check whether threads are desired
-AC_ARG_ENABLE(threads, [  --enable-threads        build with thread])
-if test x$enable_threads = xyes; then
-    AC_DEFINE(USE_THREADS, 1, [Use threads])
-    CONF_CPPFLAGS="$CONF_CPPFLAGS -D_REENTRANT"
-    LDFLAGS="$LDFLAGS -lpthread"
-fi
+AC_ARG_ENABLE(threads, [  --disable-threads        build without threading])
 
 # do we want bzadmin?
 AC_ARG_ENABLE(bzadmin, [  --disable-bzadmin       do not build text client])
@@ -504,6 +499,25 @@
 LIBS=$ac_func_search_save_LIBS
 AC_SUBST(GLIBS)
 
+# try out pthreads if it's enabled, disable it if we don't have it
+AC_MSG_CHECKING([for working pthreads])
+if test "x$enable_threads" != "xno" ; then
+    tmpLIBS=$LIBS
+    LIBS="-lpthread"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
+				    [[pthread_t thread;
+				      pthread_create(&thread, NULL, NULL, NULL);]])],
+		   [pthread_check="yes"], [pthread_check="no"])
+    if test $pthread_check = "yes"; then
+	AC_DEFINE(HAVE_PTHREADS, 1, [posix-compliant threading is available])
+	LIBS="$tmpLIBS $LIBS"
+	CONF_CXXFLAGS="$CONF_CPPFLAGS -D_REENTRANT"
+	CONF_CFLAGS="$CONF_CFLAGS -D_REENTRANT"
+    else
+	LIBS=tmpLIBS
+    fi
+fi
+
 # Check for the GLEW library (GL Extension Wrangler)
 AC_MSG_CHECKING([for GLEW library])
 tmpLIBS=$LIBS


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
BZFlag-commits mailing list
BZFlag-commits@lists.SourceForge.net
https://lists.SourceForge.net/lists/listinfo/bzflag-commits
irc: #BZFlag @ irc.freenode.net


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic