1
dnl ---------------------------------------------------------------------------
3
dnl ---------------------------------------------------------------------------
4
AC_DEFUN([LOC_MSG],[echo "$1"])
6
dnl ---------------------------------------------------------------------------
7
dnl Available from the GNU Autoconf Macro Archive at:
8
dnl http://www.gnu.org/software/ac-archive/vl_prog_cc_warnings.html
9
dnl ---------------------------------------------------------------------------
11
dnl @synopsis VL_PROG_CC_WARNINGS([ANSI])
13
dnl Enables a reasonable set of warnings for the C compiler.
14
dnl Optionally, if the first argument is nonempty, turns on flags which
15
dnl enforce and/or enable proper ANSI C if such are known with the
18
dnl Currently this macro knows about GCC, Solaris C compiler, Digital
19
dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
20
dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
21
dnl 10.0.0.8) C compiler.
24
dnl @author Ville Laurikari <vl@iki.fi>
25
dnl @version 2002-04-04
26
dnl @license AllPermissive
28
AC_DEFUN([VL_PROG_CC_WARNINGS], [
30
if test -z "$ansi"; then
31
msg="for C compiler warning flags"
33
msg="for C compiler warning and ANSI conformance flags"
35
AC_CACHE_CHECK($msg, vl_cv_prog_cc_warnings, [
36
if test -n "$CC"; then
37
cat > conftest.c <<EOF
38
int main(int argc, char **argv) { return 0; }
41
dnl GCC. -W option has been renamed in -wextra in latest gcc versions.
42
if test "$GCC" = "yes"; then
43
if test -z "$ansi"; then
44
vl_cv_prog_cc_warnings="-Wall -W"
46
vl_cv_prog_cc_warnings="-Wall -W -ansi -pedantic"
49
dnl Most compilers print some kind of a version string with some command
50
dnl line options (often "-V"). The version string should be checked
51
dnl before doing a test compilation run with compiler-specific flags.
52
dnl This is because some compilers (like the Cray compiler) only
53
dnl produce a warning message for unknown flags instead of returning
54
dnl an error, resulting in a false positive. Also, compilers may do
55
dnl erratic things when invoked with flags meant for a different
58
dnl Solaris C compiler
59
elif $CC -V 2>&1 | grep -i "WorkShop" > /dev/null 2>&1 &&
60
$CC -c -v -Xc conftest.c > /dev/null 2>&1 &&
61
test -f conftest.o; then
62
if test -z "$ansi"; then
63
vl_cv_prog_cc_warnings="-v"
65
vl_cv_prog_cc_warnings="-v -Xc"
68
dnl Digital Unix C compiler
69
elif $CC -V 2>&1 | grep -i "Digital UNIX Compiler" > /dev/null 2>&1 &&
70
$CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 &&
71
test -f conftest.o; then
72
if test -z "$ansi"; then
73
vl_cv_prog_cc_warnings="-verbose -w0 -warnprotos"
75
vl_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1"
78
dnl C for AIX Compiler
79
elif $CC 2>&1 | grep -i "C for AIX Compiler" > /dev/null 2>&1 &&
80
$CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 &&
81
test -f conftest.o; then
82
if test -z "$ansi"; then
83
vl_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd"
85
vl_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi"
89
elif $CC -version 2>&1 | grep -i "MIPSpro Compilers" > /dev/null 2>&1 &&
90
$CC -c -fullwarn -ansi -ansiE conftest.c > /dev/null 2>&1 &&
91
test -f conftest.o; then
92
if test -z "$ansi"; then
93
vl_cv_prog_cc_warnings="-fullwarn"
95
vl_cv_prog_cc_warnings="-fullwarn -ansi -ansiE"
99
elif what $CC 2>&1 | grep -i "HP C Compiler" > /dev/null 2>&1 &&
100
$CC -c -Aa +w1 conftest.c > /dev/null 2>&1 &&
101
test -f conftest.o; then
102
if test -z "$ansi"; then
103
vl_cv_prog_cc_warnings="+w1"
105
vl_cv_prog_cc_warnings="+w1 -Aa"
108
dnl The NEC SX-5 (Super-UX 10) C compiler
109
elif $CC -V 2>&1 | grep "/SX" > /dev/null 2>&1 &&
110
$CC -c -pvctl[,]fullmsg -Xc conftest.c > /dev/null 2>&1 &&
111
test -f conftest.o; then
112
if test -z "$ansi"; then
113
vl_cv_prog_cc_warnings="-pvctl[,]fullmsg"
115
vl_cv_prog_cc_warnings="-pvctl[,]fullmsg -Xc"
118
dnl The Cray C compiler (Unicos)
119
elif $CC -V 2>&1 | grep -i "Cray" > /dev/null 2>&1 &&
120
$CC -c -h msglevel 2 conftest.c > /dev/null 2>&1 &&
121
test -f conftest.o; then
122
if test -z "$ansi"; then
123
vl_cv_prog_cc_warnings="-h msglevel 2"
125
vl_cv_prog_cc_warnings="-h msglevel 2 -h conform"
131
if test -n "$vl_cv_prog_cc_warnings"; then
132
CFLAGS="$CFLAGS $vl_cv_prog_cc_warnings"
134
vl_cv_prog_cc_warnings="unknown"
139
dnl ---------------------------------------------------------------------------
140
dnl Available from the GNU Autoconf Macro Archive at:
141
dnl http://autoconf-archive.cryp.to/ax_lang_compiler_ms.html
142
dnl ---------------------------------------------------------------------------
144
dnl @synopsis AX_LANG_COMPILER_MS
146
dnl Check whether the compiler for the current language is Microsoft.
148
dnl This macro is modeled after _AC_LANG_COMPILER_GNU in the GNU
149
dnl Autoconf implementation.
151
dnl @category InstalledPackages
152
dnl @author Braden McDaniel <braden@endoframe.com>
153
dnl @version 2004-11-15
154
dnl @license AllPermissive
156
AC_DEFUN([AX_LANG_COMPILER_MS],
157
[AC_CACHE_CHECK([whether we are using the Microsoft _AC_LANG compiler],
158
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms],
159
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef _MSC_VER
163
[ax_compiler_ms=yes],
165
ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms=$ax_compiler_ms
168
dnl ---------------------------------------------------------------------------
169
dnl Available from the GNU Autoconf Macro Archive at:
170
dnl http://www.gnu.org/software/ac-archive/ax_check_gl.html
171
dnl ---------------------------------------------------------------------------
173
dnl @synopsis AX_CHECK_GL
175
dnl Check for an OpenGL implementation. If GL is found, the required
176
dnl compiler and linker flags are included in the output variables
177
dnl "GL_CFLAGS" and "GL_LIBS", respectively. This macro adds the
178
dnl configure option "--with-apple-opengl-framework", which users can
179
dnl use to indicate that Apple's OpenGL framework should be used on Mac
180
dnl OS X. If Apple's OpenGL framework is used, the symbol
181
dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GL implementation
182
dnl is found, "no_gl" is set to "yes".
184
dnl @category InstalledPackages
185
dnl @author Braden McDaniel <braden@endoframe.com>
186
dnl @version 2004-11-15
187
dnl @license AllPermissive
189
AC_DEFUN([AX_CHECK_GL],
190
[AC_REQUIRE([AC_PATH_X])dnl
191
AC_REQUIRE([ACX_PTHREAD])dnl
194
# There isn't a reliable way to know we should use the Apple OpenGL framework
195
# without a configure option. A Mac OS X user may have installed an
196
# alternative GL implementation (e.g., Mesa), which may or may not depend on X.
198
AC_ARG_WITH([apple-opengl-framework],
199
[AC_HELP_STRING([--with-apple-opengl-framework],
200
[use Apple OpenGL framework (Mac OS X only)])])
201
if test "X$with_apple_opengl_framework" = "Xyes"; then
202
AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
203
[Use the Apple OpenGL framework.])
204
GL_LIBS="-framework OpenGL"
209
if test X$ax_compiler_ms = Xno; then
210
GL_CFLAGS="${PTHREAD_CFLAGS}"
211
GL_LIBS="${PTHREAD_LIBS} -lm"
215
# Use x_includes and x_libraries if they have been set (presumably by
218
if test "X$no_x" != "Xyes"; then
219
if test -n "$x_includes"; then
220
GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
222
if test -n "$x_libraries"; then
223
GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
227
AC_CHECK_HEADERS([windows.h])
229
AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
230
[ax_cv_check_gl_libgl="no"
231
ax_save_CPPFLAGS="${CPPFLAGS}"
232
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
233
ax_save_LIBS="${LIBS}"
235
ax_check_libs="-lopengl32 -lGL"
236
for ax_lib in ${ax_check_libs}; do
237
if test X$ax_compiler_ms = Xyes; then
238
ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
240
ax_try_lib="${ax_lib}"
242
LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
245
# if HAVE_WINDOWS_H && defined(_WIN32)
246
# include <windows.h>
248
# include <GL/gl.h>]],
250
[ax_cv_check_gl_libgl="${ax_try_lib}"; break])
253
CPPFLAGS=${ax_save_CPPFLAGS}])
255
if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
260
GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"
265
AC_SUBST([GL_CFLAGS])
269
dnl ---------------------------------------------------------------------------
270
dnl Available from the GNU Autoconf Macro Archive at:
271
dnl http://www.gnu.org/software/ac-archive/ax_check_glu.html
272
dnl ---------------------------------------------------------------------------
274
dnl @synopsis AX_CHECK_GLU
276
dnl Check for GLU. If GLU is found, the required preprocessor and
277
dnl linker flags are included in the output variables "GLU_CFLAGS" and
278
dnl "GLU_LIBS", respectively. This macro adds the configure option
279
dnl "--with-apple-opengl-framework", which users can use to indicate
280
dnl that Apple's OpenGL framework should be used on Mac OS X. If
281
dnl Apple's OpenGL framework is used, the symbol
282
dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GLU implementation
283
dnl is found, "no_glu" is set to "yes".
285
dnl @category InstalledPackages
286
dnl @author Braden McDaniel <braden@endoframe.com>
287
dnl @version 2004-11-15
288
dnl @license AllPermissive
290
AC_DEFUN([AX_CHECK_GLU],
291
[AC_REQUIRE([AX_CHECK_GL])dnl
292
AC_REQUIRE([AC_PROG_CXX])dnl
293
GLU_CFLAGS="${GL_CFLAGS}"
294
if test "X${with_apple_opengl_framework}" != "Xyes"; then
295
AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu],
296
[ax_cv_check_glu_libglu="no"
297
ax_save_CPPFLAGS="${CPPFLAGS}"
298
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
299
ax_save_LIBS="${LIBS}"
301
ax_check_libs="-lglu32 -lGLU"
302
for ax_lib in ${ax_check_libs}; do
303
if test X$ax_compiler_ms = Xyes; then
304
ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
306
ax_try_lib="${ax_lib}"
308
LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
310
# libGLU typically links with libstdc++ on POSIX platforms. However,
311
# setting the language to C++ means that test program source is named
312
# "conftest.cc"; and Microsoft cl doesn't know what to do with such a
316
if test X$ax_compiler_ms = Xyes; then
321
# if HAVE_WINDOWS_H && defined(_WIN32)
322
# include <windows.h>
324
# include <GL/glu.h>]],
325
[[gluBeginCurve(0)]])],
326
[ax_cv_check_glu_libglu="${ax_try_lib}"; break])
327
if test X$ax_compiler_ms = Xyes; then
333
CPPFLAGS=${ax_save_CPPFLAGS}])
334
if test "X${ax_cv_check_glu_libglu}" = "Xno"; then
339
GLU_LIBS="${ax_cv_check_glu_libglu} ${GL_LIBS}"
342
AC_SUBST([GLU_CFLAGS])
346
dnl ---------------------------------------------------------------------------
347
dnl Available from the GNU Autoconf Macro Archive at:
348
dnl http://www.gnu.org/software/ac-archive/ax_check_glut.html
349
dnl ---------------------------------------------------------------------------
351
dnl @synopsis AX_CHECK_GLUT
353
dnl Check for GLUT. If GLUT is found, the required compiler and linker
354
dnl flags are included in the output variables "GLUT_CFLAGS" and
355
dnl "GLUT_LIBS", respectively. This macro adds the configure option
356
dnl "--with-apple-opengl-framework", which users can use to indicate
357
dnl that Apple's OpenGL framework should be used on Mac OS X. If
358
dnl Apple's OpenGL framework is used, the symbol
359
dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If GLUT is not found,
360
dnl "no_glut" is set to "yes".
362
dnl @category InstalledPackages
363
dnl @author Braden McDaniel <braden@endoframe.com>
364
dnl @version 2004-11-15
365
dnl @license AllPermissive
367
AC_DEFUN([AX_CHECK_GLUT],
368
[AC_REQUIRE([AX_CHECK_GLU])dnl
369
AC_REQUIRE([AC_PATH_XTRA])dnl
371
if test "X$with_apple_opengl_framework" = "Xyes"; then
372
GLUT_CFLAGS="${GLU_CFLAGS}"
373
GLUT_LIBS="-framework GLUT -lobjc ${GL_LIBS}"
375
GLUT_CFLAGS=${GLU_CFLAGS}
376
GLUT_LIBS=${GLU_LIBS}
379
# If X is present, assume GLUT depends on it.
381
if test "X${no_x}" != "Xyes"; then
382
GLUT_LIBS="${X_PRE_LIBS} -lXmu -lXi ${X_EXTRA_LIBS} ${GLUT_LIBS}"
387
ax_save_CPPFLAGS="${CPPFLAGS}"
388
CPPFLAGS="${GLUT_CFLAGS} ${CPPFLAGS}"
390
AC_CACHE_CHECK([for GLUT library], [ax_cv_check_glut_libglut],
391
[ax_cv_check_glut_libglut="no"
392
ax_save_LIBS="${LIBS}"
394
ax_check_libs="-lglut32 -lglut"
395
for ax_lib in ${ax_check_libs}; do
396
if test X$ax_compiler_ms = Xyes; then
397
ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
399
ax_try_lib="${ax_lib}"
401
LIBS="${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}"
404
# if HAVE_WINDOWS_H && defined(_WIN32)
405
# include <windows.h>
407
# include <GL/glut.h>]],
408
[[glutMainLoop()]])],
409
[ax_cv_check_glut_libglut="${ax_try_lib}"; break])
414
CPPFLAGS="${ax_save_CPPFLAGS}"
417
if test "X${ax_cv_check_glut_libglut}" = "Xno"; then
422
GLUT_LIBS="${ax_cv_check_glut_libglut} ${GLUT_LIBS}"
426
AC_SUBST([GLUT_CFLAGS])
427
AC_SUBST([GLUT_LIBS])
430
dnl ---------------------------------------------------------------------------
431
dnl Available from the GNU Autoconf Macro Archive at:
432
dnl http://www.gnu.org/software/ac-archive/acx_pthread.html
433
dnl ---------------------------------------------------------------------------
435
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
437
dnl This macro figures out how to build C programs using POSIX threads.
438
dnl It sets the PTHREAD_LIBS output variable to the threads library and
439
dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
440
dnl C compiler flags that are needed. (The user can also force certain
441
dnl compiler flags/libs to be tested by setting these environment
444
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
445
dnl multi-threaded programs (defaults to the value of CC otherwise).
446
dnl (This is necessary on AIX to use the special cc_r compiler alias.)
448
dnl NOTE: You are assumed to not only compile your program with these
449
dnl flags, but also link it with them as well. e.g. you should link
450
dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
453
dnl If you are only building threads programs, you may wish to use
454
dnl these variables in your default LIBS, CFLAGS, and CC:
456
dnl LIBS="$PTHREAD_LIBS $LIBS"
457
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
460
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
461
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
462
dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
464
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
465
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
466
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
467
dnl default action will define HAVE_PTHREAD.
469
dnl Please let the authors know if this macro fails on any platform, or
470
dnl if you have any other suggestions or comments. This macro was based
471
dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
472
dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
473
dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
474
dnl We are also grateful for the helpful feedback of numerous users.
476
dnl @category InstalledPackages
477
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
478
dnl @version 2005-01-14
479
dnl @license GPLWithACException
481
AC_DEFUN([ACX_PTHREAD], [
482
AC_REQUIRE([AC_CANONICAL_HOST])
487
# We used to check for pthread.h first, but this fails if pthread.h
488
# requires special compiler flags (e.g. on True64 or Sequent).
489
# It gets checked for in the link test anyway.
491
# First of all, check if the user has set any of the PTHREAD_LIBS,
492
# etcetera environment variables, and if threads linking works using
494
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
495
save_CFLAGS="$CFLAGS"
496
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
498
LIBS="$PTHREAD_LIBS $LIBS"
499
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
500
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
501
AC_MSG_RESULT($acx_pthread_ok)
502
if test x"$acx_pthread_ok" = xno; then
507
CFLAGS="$save_CFLAGS"
510
# We must check for the threads library under a number of different
511
# names; the ordering is very important because some systems
512
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
513
# libraries is broken (non-POSIX).
515
# Create a list of thread flags to try. Items starting with a "-" are
516
# C compiler flags, and other items are library names, except for "none"
517
# which indicates that we try without any flags at all, and "pthread-config"
518
# which is a program returning the flags for the Pth emulation library.
520
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
522
# The ordering *is* (sometimes) important. Some notes on the
523
# individual items follow:
525
# pthreads: AIX (must check this before -lpthread)
526
# none: in case threads are in libc; should be tried before -Kthread and
527
# other compiler flags to prevent continual compiler warnings
528
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
529
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
530
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
531
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
532
# -pthreads: Solaris/gcc
533
# -mthreads: Mingw32/gcc, Lynx/gcc
534
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
535
# doesn't hurt to check since this sometimes defines pthreads too;
536
# also defines -D_REENTRANT)
537
# pthread: Linux, etcetera
538
# --thread-safe: KAI C++
539
# pthread-config: use pthread-config program (for GNU Pth library)
541
case "${host_cpu}-${host_os}" in
544
# On Solaris (at least, for some versions), libc contains stubbed
545
# (non-functional) versions of the pthreads routines, so link-based
546
# tests will erroneously succeed. (We need to link with -pthread or
547
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
548
# a function called by this macro, so we could check for that, but
549
# who knows whether they'll stub that too in a future libc.) So,
550
# we'll just look for -pthreads and -lpthread first:
552
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
556
if test x"$acx_pthread_ok" = xno; then
557
for flag in $acx_pthread_flags; do
561
AC_MSG_CHECKING([whether pthreads work without any flags])
565
AC_MSG_CHECKING([whether pthreads work with $flag])
566
PTHREAD_CFLAGS="$flag"
570
AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
571
if test x"$acx_pthread_config" = xno; then continue; fi
572
PTHREAD_CFLAGS="`pthread-config --cflags`"
573
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
577
AC_MSG_CHECKING([for the pthreads library -l$flag])
578
PTHREAD_LIBS="-l$flag"
583
save_CFLAGS="$CFLAGS"
584
LIBS="$PTHREAD_LIBS $LIBS"
585
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
587
# Check for various functions. We must include pthread.h,
588
# since some functions may be macros. (On the Sequent, we
589
# need a special flag -Kthread to make this header compile.)
590
# We check for pthread_join because it is in -lpthread on IRIX
591
# while pthread_create is in libc. We check for pthread_attr_init
592
# due to DEC craziness with -lpthreads. We check for
593
# pthread_cleanup_push because it is one of the few pthread
594
# functions on Solaris that doesn't have a non-functional libc stub.
595
# We try pthread_create on general principles.
596
AC_TRY_LINK([#include <pthread.h>],
597
[pthread_t th; pthread_join(th, 0);
598
pthread_attr_init(0); pthread_cleanup_push(0, 0);
599
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
600
[acx_pthread_ok=yes])
603
CFLAGS="$save_CFLAGS"
605
AC_MSG_RESULT($acx_pthread_ok)
606
if test "x$acx_pthread_ok" = xyes; then
615
# Various other checks:
616
if test "x$acx_pthread_ok" = xyes; then
618
LIBS="$PTHREAD_LIBS $LIBS"
619
save_CFLAGS="$CFLAGS"
620
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
622
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
623
AC_MSG_CHECKING([for joinable pthread attribute])
625
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
626
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
627
[attr_name=$attr; break])
629
AC_MSG_RESULT($attr_name)
630
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
631
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
632
[Define to necessary symbol if this constant
633
uses a non-standard name on your system.])
636
AC_MSG_CHECKING([if more special flags are required for pthreads])
638
case "${host_cpu}-${host_os}" in
639
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
640
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
642
AC_MSG_RESULT(${flag})
643
if test "x$flag" != xno; then
644
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
648
CFLAGS="$save_CFLAGS"
650
# More AIX lossage: must compile with cc_r
651
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
656
AC_SUBST(PTHREAD_LIBS)
657
AC_SUBST(PTHREAD_CFLAGS)
660
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
661
if test x"$acx_pthread_ok" = xyes; then
662
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])