11
# This macro figures out how to build C programs using POSIX threads. It
12
# sets the PTHREAD_LIBS output variable to the threads library and linker
13
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
14
# flags that are needed. (The user can also force certain compiler
15
# flags/libs to be tested by setting these environment variables.)
9
# This macro figures out how to build C programs using POSIX threads.
10
# It sets the PTHREAD_LIBS output variable to the threads library and
11
# linker flags, and the PTHREAD_CFLAGS output variable to any special
12
# C compiler flags that are needed. (The user can also force certain
13
# compiler flags/libs to be tested by setting these environment
17
16
# Also sets PTHREAD_CC to any special C compiler that is needed for
18
# multi-threaded programs (defaults to the value of CC otherwise). (This
19
# is necessary on AIX to use the special cc_r compiler alias.)
21
# NOTE: You are assumed to not only compile your program with these flags,
22
# but also link it with them as well. e.g. you should link with
23
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
25
# If you are only building threads programs, you may wish to use these
26
# variables in your default LIBS, CFLAGS, and CC:
17
# multi-threaded programs (defaults to the value of CC otherwise).
18
# (This is necessary on AIX to use the special cc_r compiler alias.)
20
# NOTE: You are assumed to not only compile your program with these
21
# flags, but also link it with them as well. e.g. you should link
22
# with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
25
# If you are only building threads programs, you may wish to use
26
# these variables in your default LIBS, CFLAGS, and CC:
28
28
# LIBS="$PTHREAD_LIBS $LIBS"
29
29
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
32
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
33
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
34
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
36
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
37
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
38
# is not found. If ACTION-IF-FOUND is not specified, the default action
39
# will define HAVE_PTHREAD.
41
# Please let the authors know if this macro fails on any platform, or if
42
# you have any other suggestions or comments. This macro was based on work
43
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
44
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
45
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
46
# grateful for the helpful feedback of numerous users.
50
# Copyright (C) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
52
# This program is free software: you can redistribute it and/or modify it
53
# under the terms of the GNU General Public License as published by the
54
# Free Software Foundation, either version 3 of the License, or (at your
55
# option) any later version.
32
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
33
# constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
34
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
36
# ACTION-IF-FOUND is a list of shell commands to run if a threads
37
# library is found, and ACTION-IF-NOT-FOUND is a list of commands to
38
# run it if it is not found. If ACTION-IF-FOUND is not specified, the
39
# default action will define HAVE_PTHREAD.
41
# Please let the authors know if this macro fails on any platform, or
42
# if you have any other suggestions or comments. This macro was based
43
# on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
44
# (with help from M. Frigo), as well as ac_pthread and hb_pthread
45
# macros posted by Alejandro Forero Cuervo to the autoconf macro
46
# repository. We are also grateful for the helpful feedback of
55
# Copyright (c) 2006 Steven G. Johnson <stevenj@alum.mit.edu>
57
# This program is free software; you can redistribute it and/or
58
# modify it under the terms of the GNU General Public License as
59
# published by the Free Software Foundation; either version 2 of the
60
# License, or (at your option) any later version.
57
62
# This program is distributed in the hope that it will be useful, but
58
63
# WITHOUT ANY WARRANTY; without even the implied warranty of
59
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
60
# Public License for more details.
62
# You should have received a copy of the GNU General Public License along
63
# with this program. If not, see <http://www.gnu.org/licenses/>.
65
# As a special exception, the respective Autoconf Macro's copyright owner
66
# gives unlimited permission to copy, distribute and modify the configure
67
# scripts that are the output of Autoconf when processing the Macro. You
68
# need not follow the terms of the GNU General Public License when using
69
# or distributing such scripts, even though portions of the text of the
70
# Macro appear in them. The GNU General Public License (GPL) does govern
71
# all other use of the material that constitutes the Autoconf Macro.
73
# This special exception to the GPL applies to versions of the Autoconf
74
# Macro released by the Autoconf Archive. When you make and distribute a
75
# modified version of the Autoconf Macro, you may extend this special
76
# exception to the GPL to apply to your modified version as well.
64
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
65
# General Public License for more details.
67
# You should have received a copy of the GNU General Public License
68
# along with this program; if not, write to the Free Software
69
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
72
# As a special exception, the respective Autoconf Macro's copyright
73
# owner gives unlimited permission to copy, distribute and modify the
74
# configure scripts that are the output of Autoconf when processing
75
# the Macro. You need not follow the terms of the GNU General Public
76
# License when using or distributing such scripts, even though
77
# portions of the text of the Macro appear in them. The GNU General
78
# Public License (GPL) does govern all other use of the material that
79
# constitutes the Autoconf Macro.
81
# This special exception to the GPL applies to versions of the
82
# Autoconf Macro released by the Autoconf Macro Archive. When you
83
# make and distribute a modified version of the Autoconf Macro, you
84
# may extend this special exception to the GPL to apply to your
85
# modified version as well.
78
87
AC_DEFUN([ACX_PTHREAD], [
79
88
AC_REQUIRE([AC_CANONICAL_HOST])
84
92
# We used to check for pthread.h first, but this fails if pthread.h