changeset 1825:52c291b05738

Fix compilation when using Clang on OS X; it doesn't like -pthread
author Austin Seipp <mad.one@gmail.com>
date Sun, 23 Sep 2012 20:47:20 -0500
parents 216e92b39fc1
children 6a621a625b04
files configure.ac
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Wed Sep 19 18:01:22 2012 -0400
+++ b/configure.ac	Sun Sep 23 20:47:20 2012 -0500
@@ -94,6 +94,24 @@
    VERSION="$VERSION + `hg identify || (cat .hg_archival.txt | grep 'node\:') || echo ?`"
 fi
 
+# Clang does not like being passed -pthread, since it's implicit on OS X.
+# So let's get rid of that! Here's to hoping it doesn't break Clang
+# on other platforms.
+AC_MSG_CHECKING([if compiling with clang])
+AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([], [[
+#ifndef __clang__
+       not clang
+#endif
+]])],
+[CLANG=yes], [CLANG=no])
+AC_MSG_RESULT([$CLANG])
+
+if test [$CLANG = "yes"]; then
+   PTHREAD_CFLAGS=""
+   PTHREAD_LIBS=""
+fi
+
 AC_SUBST(CC)
 AC_SUBST(BIN)
 AC_SUBST(LIB)
@@ -130,6 +148,8 @@
   MySQL C header:      MSHEADER       $MSHEADER
   SQLite C header:     SQHEADER       $SQHEADER
   OpenSSL:             OPENSSL_LIBS   $OPENSSL_LIBS
+  pthreads:            PTHREAD_CFLAGS $PTHREAD_CFLAGS
+                       PTHREAD_LIBS   $PTHREAD_LIBS
 
   Version:             $VERSION
 EOF