llvm.org GIT mirror llvm / 27fcfe1
Add a configure test for pthread_getspecific, and use it when building ThreadLocal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74222 91177308-0d34-0410-b5e6-96231b3b80d8 Owen Anderson 11 years ago
4 changed file(s) with 110 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
828828 AC_SEARCH_LIBS(pthread_rwlock_init,pthread,
829829 AC_DEFINE([HAVE_PTHREAD_RWLOCK_INIT],[1],
830830 [Have pthread_rwlock_init]))
831 AC_SEARCH_LIBS(pthread_getspecific,pthread,
832 AC_DEFINE([HAVE_PTHREAD_GETSPECIFIC],[1],
833 [Have pthread_getspecific]))
831834 fi
832835
833836 dnl Allow extra x86-disassembler library
2803328033
2803428034 fi
2803528035
28036 { echo "$as_me:$LINENO: checking for library containing pthread_getspecific" >&5
28037 echo $ECHO_N "checking for library containing pthread_getspecific... $ECHO_C" >&6; }
28038 if test "${ac_cv_search_pthread_getspecific+set}" = set; then
28039 echo $ECHO_N "(cached) $ECHO_C" >&6
28040 else
28041 ac_func_search_save_LIBS=$LIBS
28042 cat >conftest.$ac_ext <<_ACEOF
28043 /* confdefs.h. */
28044 _ACEOF
28045 cat confdefs.h >>conftest.$ac_ext
28046 cat >>conftest.$ac_ext <<_ACEOF
28047 /* end confdefs.h. */
28048
28049 /* Override any GCC internal prototype to avoid an error.
28050 Use char because int might match the return type of a GCC
28051 builtin and then its argument prototype would still apply. */
28052 #ifdef __cplusplus
28053 extern "C"
28054 #endif
28055 char pthread_getspecific ();
28056 int
28057 main ()
28058 {
28059 return pthread_getspecific ();
28060 ;
28061 return 0;
28062 }
28063 _ACEOF
28064 for ac_lib in '' pthread; do
28065 if test -z "$ac_lib"; then
28066 ac_res="none required"
28067 else
28068 ac_res=-l$ac_lib
28069 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
28070 fi
28071 rm -f conftest.$ac_objext conftest$ac_exeext
28072 if { (ac_try="$ac_link"
28073 case "(($ac_try" in
28074 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
28075 *) ac_try_echo=$ac_try;;
28076 esac
28077 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
28078 (eval "$ac_link") 2>conftest.er1
28079 ac_status=$?
28080 grep -v '^ *+' conftest.er1 >conftest.err
28081 rm -f conftest.er1
28082 cat conftest.err >&5
28083 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28084 (exit $ac_status); } &&
28085 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
28086 { (case "(($ac_try" in
28087 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
28088 *) ac_try_echo=$ac_try;;
28089 esac
28090 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
28091 (eval "$ac_try") 2>&5
28092 ac_status=$?
28093 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28094 (exit $ac_status); }; } &&
28095 { ac_try='test -s conftest$ac_exeext'
28096 { (case "(($ac_try" in
28097 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
28098 *) ac_try_echo=$ac_try;;
28099 esac
28100 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
28101 (eval "$ac_try") 2>&5
28102 ac_status=$?
28103 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28104 (exit $ac_status); }; }; then
28105 ac_cv_search_pthread_getspecific=$ac_res
28106 else
28107 echo "$as_me: failed program was:" >&5
28108 sed 's/^/| /' conftest.$ac_ext >&5
28109
28110
28111 fi
28112
28113 rm -f core conftest.err conftest.$ac_objext \
28114 conftest$ac_exeext
28115 if test "${ac_cv_search_pthread_getspecific+set}" = set; then
28116 break
28117 fi
28118 done
28119 if test "${ac_cv_search_pthread_getspecific+set}" = set; then
28120 :
28121 else
28122 ac_cv_search_pthread_getspecific=no
28123 fi
28124 rm conftest.$ac_ext
28125 LIBS=$ac_func_search_save_LIBS
28126 fi
28127 { echo "$as_me:$LINENO: result: $ac_cv_search_pthread_getspecific" >&5
28128 echo "${ECHO_T}$ac_cv_search_pthread_getspecific" >&6; }
28129 ac_res=$ac_cv_search_pthread_getspecific
28130 if test "$ac_res" != no; then
28131 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
28132
28133 cat >>confdefs.h <<\_ACEOF
28134 #define HAVE_PTHREAD_GETSPECIFIC 1
28135 _ACEOF
28136
28137 fi
28138
2803628139 fi
2803728140
2803828141
277277
278278 /* Define to have the %a format string */
279279 #undef HAVE_PRINTF_A
280
281 /* Have pthread_getspecific */
282 #undef HAVE_PTHREAD_GETSPECIFIC
280283
281284 /* Define to 1 if you have the header file. */
282285 #undef HAVE_PTHREAD_H
2929 }
3030 #else
3131
32 #if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_MUTEX_LOCK)
32 #if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_GETSPECIFIC)
3333
3434 #include
3535 #include