1*663afb9bSAndroid Build Coastguard Worker##### http://autoconf-archive.cryp.to/acx_pthread.html 2*663afb9bSAndroid Build Coastguard Worker# 3*663afb9bSAndroid Build Coastguard Worker# SYNOPSIS 4*663afb9bSAndroid Build Coastguard Worker# 5*663afb9bSAndroid Build Coastguard Worker# ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 6*663afb9bSAndroid Build Coastguard Worker# 7*663afb9bSAndroid Build Coastguard Worker# DESCRIPTION 8*663afb9bSAndroid Build Coastguard Worker# 9*663afb9bSAndroid Build Coastguard Worker# This macro figures out how to build C programs using POSIX threads. 10*663afb9bSAndroid Build Coastguard Worker# It sets the PTHREAD_LIBS output variable to the threads library and 11*663afb9bSAndroid Build Coastguard Worker# linker flags, and the PTHREAD_CFLAGS output variable to any special 12*663afb9bSAndroid Build Coastguard Worker# C compiler flags that are needed. (The user can also force certain 13*663afb9bSAndroid Build Coastguard Worker# compiler flags/libs to be tested by setting these environment 14*663afb9bSAndroid Build Coastguard Worker# variables.) 15*663afb9bSAndroid Build Coastguard Worker# 16*663afb9bSAndroid Build Coastguard Worker# Also sets PTHREAD_CC to any special C compiler that is needed for 17*663afb9bSAndroid Build Coastguard Worker# multi-threaded programs (defaults to the value of CC otherwise). 18*663afb9bSAndroid Build Coastguard Worker# (This is necessary on AIX to use the special cc_r compiler alias.) 19*663afb9bSAndroid Build Coastguard Worker# 20*663afb9bSAndroid Build Coastguard Worker# NOTE: You are assumed to not only compile your program with these 21*663afb9bSAndroid Build Coastguard Worker# flags, but also link it with them as well. e.g. you should link 22*663afb9bSAndroid Build Coastguard Worker# with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS 23*663afb9bSAndroid Build Coastguard Worker# $LIBS 24*663afb9bSAndroid Build Coastguard Worker# 25*663afb9bSAndroid Build Coastguard Worker# If you are only building threads programs, you may wish to use 26*663afb9bSAndroid Build Coastguard Worker# these variables in your default LIBS, CFLAGS, and CC: 27*663afb9bSAndroid Build Coastguard Worker# 28*663afb9bSAndroid Build Coastguard Worker# LIBS="$PTHREAD_LIBS $LIBS" 29*663afb9bSAndroid Build Coastguard Worker# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 30*663afb9bSAndroid Build Coastguard Worker# CC="$PTHREAD_CC" 31*663afb9bSAndroid Build Coastguard Worker# 32*663afb9bSAndroid Build Coastguard Worker# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute 33*663afb9bSAndroid Build Coastguard Worker# constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to 34*663afb9bSAndroid Build Coastguard Worker# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). 35*663afb9bSAndroid Build Coastguard Worker# 36*663afb9bSAndroid Build Coastguard Worker# ACTION-IF-FOUND is a list of shell commands to run if a threads 37*663afb9bSAndroid Build Coastguard Worker# library is found, and ACTION-IF-NOT-FOUND is a list of commands to 38*663afb9bSAndroid Build Coastguard Worker# run it if it is not found. If ACTION-IF-FOUND is not specified, the 39*663afb9bSAndroid Build Coastguard Worker# default action will define HAVE_PTHREAD. 40*663afb9bSAndroid Build Coastguard Worker# 41*663afb9bSAndroid Build Coastguard Worker# Please let the authors know if this macro fails on any platform, or 42*663afb9bSAndroid Build Coastguard Worker# if you have any other suggestions or comments. This macro was based 43*663afb9bSAndroid Build Coastguard Worker# on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) 44*663afb9bSAndroid Build Coastguard Worker# (with help from M. Frigo), as well as ac_pthread and hb_pthread 45*663afb9bSAndroid Build Coastguard Worker# macros posted by Alejandro Forero Cuervo to the autoconf macro 46*663afb9bSAndroid Build Coastguard Worker# repository. We are also grateful for the helpful feedback of 47*663afb9bSAndroid Build Coastguard Worker# numerous users. 48*663afb9bSAndroid Build Coastguard Worker# 49*663afb9bSAndroid Build Coastguard Worker# LAST MODIFICATION 50*663afb9bSAndroid Build Coastguard Worker# 51*663afb9bSAndroid Build Coastguard Worker# 2007-07-29 52*663afb9bSAndroid Build Coastguard Worker# 53*663afb9bSAndroid Build Coastguard Worker# COPYLEFT 54*663afb9bSAndroid Build Coastguard Worker# 55*663afb9bSAndroid Build Coastguard Worker# Copyright (c) 2007 Steven G. Johnson <[email protected]> 56*663afb9bSAndroid Build Coastguard Worker# 57*663afb9bSAndroid Build Coastguard Worker# This program is free software: you can redistribute it and/or 58*663afb9bSAndroid Build Coastguard Worker# modify it under the terms of the GNU General Public License as 59*663afb9bSAndroid Build Coastguard Worker# published by the Free Software Foundation, either version 3 of the 60*663afb9bSAndroid Build Coastguard Worker# License, or (at your option) any later version. 61*663afb9bSAndroid Build Coastguard Worker# 62*663afb9bSAndroid Build Coastguard Worker# This program is distributed in the hope that it will be useful, but 63*663afb9bSAndroid Build Coastguard Worker# WITHOUT ANY WARRANTY; without even the implied warranty of 64*663afb9bSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 65*663afb9bSAndroid Build Coastguard Worker# General Public License for more details. 66*663afb9bSAndroid Build Coastguard Worker# 67*663afb9bSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License 68*663afb9bSAndroid Build Coastguard Worker# along with this program. If not, see 69*663afb9bSAndroid Build Coastguard Worker# <http://www.gnu.org/licenses/>. 70*663afb9bSAndroid Build Coastguard Worker# 71*663afb9bSAndroid Build Coastguard Worker# As a special exception, the respective Autoconf Macro's copyright 72*663afb9bSAndroid Build Coastguard Worker# owner gives unlimited permission to copy, distribute and modify the 73*663afb9bSAndroid Build Coastguard Worker# configure scripts that are the output of Autoconf when processing 74*663afb9bSAndroid Build Coastguard Worker# the Macro. You need not follow the terms of the GNU General Public 75*663afb9bSAndroid Build Coastguard Worker# License when using or distributing such scripts, even though 76*663afb9bSAndroid Build Coastguard Worker# portions of the text of the Macro appear in them. The GNU General 77*663afb9bSAndroid Build Coastguard Worker# Public License (GPL) does govern all other use of the material that 78*663afb9bSAndroid Build Coastguard Worker# constitutes the Autoconf Macro. 79*663afb9bSAndroid Build Coastguard Worker# 80*663afb9bSAndroid Build Coastguard Worker# This special exception to the GPL applies to versions of the 81*663afb9bSAndroid Build Coastguard Worker# Autoconf Macro released by the Autoconf Macro Archive. When you 82*663afb9bSAndroid Build Coastguard Worker# make and distribute a modified version of the Autoconf Macro, you 83*663afb9bSAndroid Build Coastguard Worker# may extend this special exception to the GPL to apply to your 84*663afb9bSAndroid Build Coastguard Worker# modified version as well. 85*663afb9bSAndroid Build Coastguard Worker 86*663afb9bSAndroid Build Coastguard WorkerAC_DEFUN([ACX_PTHREAD], [ 87*663afb9bSAndroid Build Coastguard WorkerAC_REQUIRE([AC_CANONICAL_HOST]) 88*663afb9bSAndroid Build Coastguard WorkerAC_LANG_SAVE 89*663afb9bSAndroid Build Coastguard WorkerAC_LANG_C 90*663afb9bSAndroid Build Coastguard Workeracx_pthread_ok=no 91*663afb9bSAndroid Build Coastguard Worker 92*663afb9bSAndroid Build Coastguard Worker# We used to check for pthread.h first, but this fails if pthread.h 93*663afb9bSAndroid Build Coastguard Worker# requires special compiler flags (e.g. on True64 or Sequent). 94*663afb9bSAndroid Build Coastguard Worker# It gets checked for in the link test anyway. 95*663afb9bSAndroid Build Coastguard Worker 96*663afb9bSAndroid Build Coastguard Worker# First of all, check if the user has set any of the PTHREAD_LIBS, 97*663afb9bSAndroid Build Coastguard Worker# etcetera environment variables, and if threads linking works using 98*663afb9bSAndroid Build Coastguard Worker# them: 99*663afb9bSAndroid Build Coastguard Workerif test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then 100*663afb9bSAndroid Build Coastguard Worker save_CFLAGS="$CFLAGS" 101*663afb9bSAndroid Build Coastguard Worker CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 102*663afb9bSAndroid Build Coastguard Worker save_LIBS="$LIBS" 103*663afb9bSAndroid Build Coastguard Worker LIBS="$PTHREAD_LIBS $LIBS" 104*663afb9bSAndroid Build Coastguard Worker AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) 105*663afb9bSAndroid Build Coastguard Worker AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) 106*663afb9bSAndroid Build Coastguard Worker AC_MSG_RESULT($acx_pthread_ok) 107*663afb9bSAndroid Build Coastguard Worker if test x"$acx_pthread_ok" = xno; then 108*663afb9bSAndroid Build Coastguard Worker PTHREAD_LIBS="" 109*663afb9bSAndroid Build Coastguard Worker PTHREAD_CFLAGS="" 110*663afb9bSAndroid Build Coastguard Worker fi 111*663afb9bSAndroid Build Coastguard Worker LIBS="$save_LIBS" 112*663afb9bSAndroid Build Coastguard Worker CFLAGS="$save_CFLAGS" 113*663afb9bSAndroid Build Coastguard Workerfi 114*663afb9bSAndroid Build Coastguard Worker 115*663afb9bSAndroid Build Coastguard Worker# We must check for the threads library under a number of different 116*663afb9bSAndroid Build Coastguard Worker# names; the ordering is very important because some systems 117*663afb9bSAndroid Build Coastguard Worker# (e.g. DEC) have both -lpthread and -lpthreads, where one of the 118*663afb9bSAndroid Build Coastguard Worker# libraries is broken (non-POSIX). 119*663afb9bSAndroid Build Coastguard Worker 120*663afb9bSAndroid Build Coastguard Worker# Create a list of thread flags to try. Items starting with a "-" are 121*663afb9bSAndroid Build Coastguard Worker# C compiler flags, and other items are library names, except for "none" 122*663afb9bSAndroid Build Coastguard Worker# which indicates that we try without any flags at all, and "pthread-config" 123*663afb9bSAndroid Build Coastguard Worker# which is a program returning the flags for the Pth emulation library. 124*663afb9bSAndroid Build Coastguard Worker 125*663afb9bSAndroid Build Coastguard Workeracx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" 126*663afb9bSAndroid Build Coastguard Worker 127*663afb9bSAndroid Build Coastguard Worker# The ordering *is* (sometimes) important. Some notes on the 128*663afb9bSAndroid Build Coastguard Worker# individual items follow: 129*663afb9bSAndroid Build Coastguard Worker 130*663afb9bSAndroid Build Coastguard Worker# pthreads: AIX (must check this before -lpthread) 131*663afb9bSAndroid Build Coastguard Worker# none: in case threads are in libc; should be tried before -Kthread and 132*663afb9bSAndroid Build Coastguard Worker# other compiler flags to prevent continual compiler warnings 133*663afb9bSAndroid Build Coastguard Worker# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) 134*663afb9bSAndroid Build Coastguard Worker# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) 135*663afb9bSAndroid Build Coastguard Worker# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) 136*663afb9bSAndroid Build Coastguard Worker# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) 137*663afb9bSAndroid Build Coastguard Worker# -pthreads: Solaris/gcc 138*663afb9bSAndroid Build Coastguard Worker# -mthreads: Mingw32/gcc, Lynx/gcc 139*663afb9bSAndroid Build Coastguard Worker# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it 140*663afb9bSAndroid Build Coastguard Worker# doesn't hurt to check since this sometimes defines pthreads too; 141*663afb9bSAndroid Build Coastguard Worker# also defines -D_REENTRANT) 142*663afb9bSAndroid Build Coastguard Worker# ... -mt is also the pthreads flag for HP/aCC 143*663afb9bSAndroid Build Coastguard Worker# pthread: Linux, etcetera 144*663afb9bSAndroid Build Coastguard Worker# --thread-safe: KAI C++ 145*663afb9bSAndroid Build Coastguard Worker# pthread-config: use pthread-config program (for GNU Pth library) 146*663afb9bSAndroid Build Coastguard Worker 147*663afb9bSAndroid Build Coastguard Workercase "${host_cpu}-${host_os}" in 148*663afb9bSAndroid Build Coastguard Worker *solaris*) 149*663afb9bSAndroid Build Coastguard Worker 150*663afb9bSAndroid Build Coastguard Worker # On Solaris (at least, for some versions), libc contains stubbed 151*663afb9bSAndroid Build Coastguard Worker # (non-functional) versions of the pthreads routines, so link-based 152*663afb9bSAndroid Build Coastguard Worker # tests will erroneously succeed. (We need to link with -pthreads/-mt/ 153*663afb9bSAndroid Build Coastguard Worker # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather 154*663afb9bSAndroid Build Coastguard Worker # a function called by this macro, so we could check for that, but 155*663afb9bSAndroid Build Coastguard Worker # who knows whether they'll stub that too in a future libc.) So, 156*663afb9bSAndroid Build Coastguard Worker # we'll just look for -pthreads and -lpthread first: 157*663afb9bSAndroid Build Coastguard Worker 158*663afb9bSAndroid Build Coastguard Worker acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" 159*663afb9bSAndroid Build Coastguard Worker ;; 160*663afb9bSAndroid Build Coastguard Workeresac 161*663afb9bSAndroid Build Coastguard Worker 162*663afb9bSAndroid Build Coastguard Workerif test x"$acx_pthread_ok" = xno; then 163*663afb9bSAndroid Build Coastguard Workerfor flag in $acx_pthread_flags; do 164*663afb9bSAndroid Build Coastguard Worker 165*663afb9bSAndroid Build Coastguard Worker case $flag in 166*663afb9bSAndroid Build Coastguard Worker none) 167*663afb9bSAndroid Build Coastguard Worker AC_MSG_CHECKING([whether pthreads work without any flags]) 168*663afb9bSAndroid Build Coastguard Worker ;; 169*663afb9bSAndroid Build Coastguard Worker 170*663afb9bSAndroid Build Coastguard Worker -*) 171*663afb9bSAndroid Build Coastguard Worker AC_MSG_CHECKING([whether pthreads work with $flag]) 172*663afb9bSAndroid Build Coastguard Worker PTHREAD_CFLAGS="$flag" 173*663afb9bSAndroid Build Coastguard Worker ;; 174*663afb9bSAndroid Build Coastguard Worker 175*663afb9bSAndroid Build Coastguard Worker pthread-config) 176*663afb9bSAndroid Build Coastguard Worker AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) 177*663afb9bSAndroid Build Coastguard Worker if test x"$acx_pthread_config" = xno; then continue; fi 178*663afb9bSAndroid Build Coastguard Worker PTHREAD_CFLAGS="`pthread-config --cflags`" 179*663afb9bSAndroid Build Coastguard Worker PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" 180*663afb9bSAndroid Build Coastguard Worker ;; 181*663afb9bSAndroid Build Coastguard Worker 182*663afb9bSAndroid Build Coastguard Worker *) 183*663afb9bSAndroid Build Coastguard Worker AC_MSG_CHECKING([for the pthreads library -l$flag]) 184*663afb9bSAndroid Build Coastguard Worker PTHREAD_LIBS="-l$flag" 185*663afb9bSAndroid Build Coastguard Worker ;; 186*663afb9bSAndroid Build Coastguard Worker esac 187*663afb9bSAndroid Build Coastguard Worker 188*663afb9bSAndroid Build Coastguard Worker save_LIBS="$LIBS" 189*663afb9bSAndroid Build Coastguard Worker save_CFLAGS="$CFLAGS" 190*663afb9bSAndroid Build Coastguard Worker LIBS="$PTHREAD_LIBS $LIBS" 191*663afb9bSAndroid Build Coastguard Worker CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 192*663afb9bSAndroid Build Coastguard Worker 193*663afb9bSAndroid Build Coastguard Worker # Check for various functions. We must include pthread.h, 194*663afb9bSAndroid Build Coastguard Worker # since some functions may be macros. (On the Sequent, we 195*663afb9bSAndroid Build Coastguard Worker # need a special flag -Kthread to make this header compile.) 196*663afb9bSAndroid Build Coastguard Worker # We check for pthread_join because it is in -lpthread on IRIX 197*663afb9bSAndroid Build Coastguard Worker # while pthread_create is in libc. We check for pthread_attr_init 198*663afb9bSAndroid Build Coastguard Worker # due to DEC craziness with -lpthreads. We check for 199*663afb9bSAndroid Build Coastguard Worker # pthread_cleanup_push because it is one of the few pthread 200*663afb9bSAndroid Build Coastguard Worker # functions on Solaris that doesn't have a non-functional libc stub. 201*663afb9bSAndroid Build Coastguard Worker # We try pthread_create on general principles. 202*663afb9bSAndroid Build Coastguard Worker AC_TRY_LINK([#include <pthread.h>], 203*663afb9bSAndroid Build Coastguard Worker [pthread_t th; pthread_join(th, 0); 204*663afb9bSAndroid Build Coastguard Worker pthread_attr_init(0); pthread_cleanup_push(0, 0); 205*663afb9bSAndroid Build Coastguard Worker pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], 206*663afb9bSAndroid Build Coastguard Worker [acx_pthread_ok=yes]) 207*663afb9bSAndroid Build Coastguard Worker 208*663afb9bSAndroid Build Coastguard Worker LIBS="$save_LIBS" 209*663afb9bSAndroid Build Coastguard Worker CFLAGS="$save_CFLAGS" 210*663afb9bSAndroid Build Coastguard Worker 211*663afb9bSAndroid Build Coastguard Worker AC_MSG_RESULT($acx_pthread_ok) 212*663afb9bSAndroid Build Coastguard Worker if test "x$acx_pthread_ok" = xyes; then 213*663afb9bSAndroid Build Coastguard Worker break; 214*663afb9bSAndroid Build Coastguard Worker fi 215*663afb9bSAndroid Build Coastguard Worker 216*663afb9bSAndroid Build Coastguard Worker PTHREAD_LIBS="" 217*663afb9bSAndroid Build Coastguard Worker PTHREAD_CFLAGS="" 218*663afb9bSAndroid Build Coastguard Workerdone 219*663afb9bSAndroid Build Coastguard Workerfi 220*663afb9bSAndroid Build Coastguard Worker 221*663afb9bSAndroid Build Coastguard Worker# Various other checks: 222*663afb9bSAndroid Build Coastguard Workerif test "x$acx_pthread_ok" = xyes; then 223*663afb9bSAndroid Build Coastguard Worker save_LIBS="$LIBS" 224*663afb9bSAndroid Build Coastguard Worker LIBS="$PTHREAD_LIBS $LIBS" 225*663afb9bSAndroid Build Coastguard Worker save_CFLAGS="$CFLAGS" 226*663afb9bSAndroid Build Coastguard Worker CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 227*663afb9bSAndroid Build Coastguard Worker 228*663afb9bSAndroid Build Coastguard Worker # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. 229*663afb9bSAndroid Build Coastguard Worker AC_MSG_CHECKING([for joinable pthread attribute]) 230*663afb9bSAndroid Build Coastguard Worker attr_name=unknown 231*663afb9bSAndroid Build Coastguard Worker for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do 232*663afb9bSAndroid Build Coastguard Worker AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;], 233*663afb9bSAndroid Build Coastguard Worker [attr_name=$attr; break]) 234*663afb9bSAndroid Build Coastguard Worker done 235*663afb9bSAndroid Build Coastguard Worker AC_MSG_RESULT($attr_name) 236*663afb9bSAndroid Build Coastguard Worker if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then 237*663afb9bSAndroid Build Coastguard Worker AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, 238*663afb9bSAndroid Build Coastguard Worker [Define to necessary symbol if this constant 239*663afb9bSAndroid Build Coastguard Worker uses a non-standard name on your system.]) 240*663afb9bSAndroid Build Coastguard Worker fi 241*663afb9bSAndroid Build Coastguard Worker 242*663afb9bSAndroid Build Coastguard Worker AC_MSG_CHECKING([if more special flags are required for pthreads]) 243*663afb9bSAndroid Build Coastguard Worker flag=no 244*663afb9bSAndroid Build Coastguard Worker case "${host_cpu}-${host_os}" in 245*663afb9bSAndroid Build Coastguard Worker *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; 246*663afb9bSAndroid Build Coastguard Worker *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; 247*663afb9bSAndroid Build Coastguard Worker esac 248*663afb9bSAndroid Build Coastguard Worker AC_MSG_RESULT(${flag}) 249*663afb9bSAndroid Build Coastguard Worker if test "x$flag" != xno; then 250*663afb9bSAndroid Build Coastguard Worker PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" 251*663afb9bSAndroid Build Coastguard Worker fi 252*663afb9bSAndroid Build Coastguard Worker 253*663afb9bSAndroid Build Coastguard Worker LIBS="$save_LIBS" 254*663afb9bSAndroid Build Coastguard Worker CFLAGS="$save_CFLAGS" 255*663afb9bSAndroid Build Coastguard Worker 256*663afb9bSAndroid Build Coastguard Worker # More AIX lossage: must compile with xlc_r or cc_r 257*663afb9bSAndroid Build Coastguard Worker if test x"$GCC" != xyes; then 258*663afb9bSAndroid Build Coastguard Worker AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) 259*663afb9bSAndroid Build Coastguard Worker else 260*663afb9bSAndroid Build Coastguard Worker PTHREAD_CC=$CC 261*663afb9bSAndroid Build Coastguard Worker fi 262*663afb9bSAndroid Build Coastguard Workerelse 263*663afb9bSAndroid Build Coastguard Worker PTHREAD_CC="$CC" 264*663afb9bSAndroid Build Coastguard Workerfi 265*663afb9bSAndroid Build Coastguard Worker 266*663afb9bSAndroid Build Coastguard WorkerAC_SUBST(PTHREAD_LIBS) 267*663afb9bSAndroid Build Coastguard WorkerAC_SUBST(PTHREAD_CFLAGS) 268*663afb9bSAndroid Build Coastguard WorkerAC_SUBST(PTHREAD_CC) 269*663afb9bSAndroid Build Coastguard Worker 270*663afb9bSAndroid Build Coastguard Worker# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: 271*663afb9bSAndroid Build Coastguard Workerif test x"$acx_pthread_ok" = xyes; then 272*663afb9bSAndroid Build Coastguard Worker ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) 273*663afb9bSAndroid Build Coastguard Worker : 274*663afb9bSAndroid Build Coastguard Workerelse 275*663afb9bSAndroid Build Coastguard Worker acx_pthread_ok=no 276*663afb9bSAndroid Build Coastguard Worker $2 277*663afb9bSAndroid Build Coastguard Workerfi 278*663afb9bSAndroid Build Coastguard WorkerAC_LANG_RESTORE 279*663afb9bSAndroid Build Coastguard Worker])dnl ACX_PTHREAD 280