aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libcilkrts/configure.ac
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-04-22 13:33:12 -0700
committerBen Cheng <bccheng@google.com>2014-04-22 13:33:12 -0700
commite3cc64dec20832769406aa38cde83c7dd4194bf4 (patch)
treeef8e39be37cfe0cb69d850043b7924389ff17164 /gcc-4.9/libcilkrts/configure.ac
parentf33c7b3122b1d7950efa88067c9a156229ba647b (diff)
downloadtoolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.gz
toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.bz2
toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.zip
[4.9] GCC 4.9.0 official release refresh
Change-Id: Ic99a7da8b44b789a48aeec93b33e93944d6e6767
Diffstat (limited to 'gcc-4.9/libcilkrts/configure.ac')
-rw-r--r--gcc-4.9/libcilkrts/configure.ac28
1 files changed, 27 insertions, 1 deletions
diff --git a/gcc-4.9/libcilkrts/configure.ac b/gcc-4.9/libcilkrts/configure.ac
index 61b45b007..fb215052d 100644
--- a/gcc-4.9/libcilkrts/configure.ac
+++ b/gcc-4.9/libcilkrts/configure.ac
@@ -49,7 +49,7 @@ AC_PROG_CC
AC_PROG_CXX
# AC_PROG_LIBTOOL
# AC_CONFIG_MACRO_DIR([..])
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile libcilkrts.spec])
AM_ENABLE_MULTILIB(, ..)
AC_FUNC_ALLOCA
@@ -183,6 +183,32 @@ AC_LINK_IFELSE(
AC_DEFINE(HAVE_PTHREAD_AFFINITY_NP, 1,
[ Define if pthread_{,attr_}{g,s}etaffinity_np is supported.]))
+# Check to see if -pthread or -lpthread is needed. Prefer the former.
+# Note that the CILK_SELF_SPEC in gcc.c may force -pthread.
+# In case the pthread.h system header is not found, this test will fail.
+CFLAGS="$CFLAGS -pthread"
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <pthread.h>
+ void *g(void *d) { return NULL; }],
+ [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
+ [],
+ [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <pthread.h>
+ void *g(void *d) { return NULL; }],
+ [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
+ [],
+ [AC_MSG_ERROR([Pthreads are required to build libcilkrts])])])
+
+if test $enable_shared = yes; then
+ link_cilkrts="-lcilkrts %{static: $LIBS}"
+else
+ link_cilkrts="-lcilkrts $LIBS"
+fi
+AC_SUBST(link_cilkrts)
+
# Must be last
AC_OUTPUT