14
14
# flags that are needed. (The user can also force certain compiler
15
15
# flags/libs to be tested by setting these environment variables.)
16
16
#
17
- # 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.)
17
+ # Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
18
+ # needed for multi-threaded programs (defaults to the value of CC
19
+ # respectively CXX otherwise). (This is necessary on e.g. AIX to use the
20
+ # special cc_r/CC_r compiler alias.)
20
21
#
21
22
# NOTE: You are assumed to not only compile your program with these flags,
22
23
# but also to link with them as well. For example, you might link with
23
24
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
25
+ # $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
24
26
#
25
27
# If you are only building threaded programs, you may wish to use these
26
28
# variables in your default LIBS, CFLAGS, and CC:
27
29
#
28
30
# LIBS="$PTHREAD_LIBS $LIBS"
29
31
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
32
+ # CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
30
33
# CC="$PTHREAD_CC"
34
+ # CXX="$PTHREAD_CXX"
31
35
#
32
36
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
33
37
# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
83
87
# modified version of the Autoconf Macro, you may extend this special
84
88
# exception to the GPL to apply to your modified version as well.
85
89
86
- # serial 27
90
+ # serial 31
87
91
88
92
AU_ALIAS ( [ ACX_PTHREAD] , [ AX_PTHREAD ] )
89
93
AC_DEFUN ( [ AX_PTHREAD ] , [
@@ -105,6 +109,7 @@ if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
105
109
ax_pthread_save_CFLAGS="$CFLAGS"
106
110
ax_pthread_save_LIBS="$LIBS"
107
111
AS_IF ( [ test "x$PTHREAD_CC" != "x"] , [ CC="$PTHREAD_CC"] )
112
+ AS_IF ( [ test "x$PTHREAD_CXX" != "x"] , [ CXX="$PTHREAD_CXX"] )
108
113
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
109
114
LIBS="$PTHREAD_LIBS $LIBS"
110
115
AC_MSG_CHECKING ( [ for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS] )
@@ -386,7 +391,7 @@ if test "x$ax_pthread_clang" = "xyes"; then
386
391
# step
387
392
ax_pthread_save_ac_link="$ac_link"
388
393
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
389
- ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
394
+ ax_pthread_link_step=`AS_ECHO ( [ "$ac_link"] ) | sed "$ax_pthread_sed"`
390
395
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
391
396
ax_pthread_save_CFLAGS="$CFLAGS"
392
397
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
@@ -482,18 +487,28 @@ if test "x$ax_pthread_ok" = "xyes"; then
482
487
[ #handle absolute path differently from PATH based program lookup
483
488
AS_CASE ( [ "x$CC"] ,
484
489
[ x/*] ,
485
- [ AS_IF ( [ AS_EXECUTABLE_P([ ${CC}_r] )] ,[ PTHREAD_CC="${CC}_r"] ) ] ,
486
- [ AC_CHECK_PROGS ( [ PTHREAD_CC] ,[ ${CC}_r] ,[ $CC] ) ] ) ] )
490
+ [
491
+ AS_IF ( [ AS_EXECUTABLE_P([ ${CC}_r] )] ,[ PTHREAD_CC="${CC}_r"] )
492
+ AS_IF ( [ test "x${CXX}" != "x"] , [ AS_IF ( [ AS_EXECUTABLE_P([ ${CXX}_r] )] ,[ PTHREAD_CXX="${CXX}_r"] ) ] )
493
+ ] ,
494
+ [
495
+ AC_CHECK_PROGS ( [ PTHREAD_CC] ,[ ${CC}_r] ,[ $CC] )
496
+ AS_IF ( [ test "x${CXX}" != "x"] , [ AC_CHECK_PROGS ( [ PTHREAD_CXX] ,[ ${CXX}_r] ,[ $CXX] ) ] )
497
+ ]
498
+ )
499
+ ] )
487
500
;;
488
501
esac
489
502
fi
490
503
fi
491
504
492
505
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
506
+ test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
493
507
494
508
AC_SUBST ( [ PTHREAD_LIBS] )
495
509
AC_SUBST ( [ PTHREAD_CFLAGS] )
496
510
AC_SUBST ( [ PTHREAD_CC] )
511
+ AC_SUBST ( [ PTHREAD_CXX] )
497
512
498
513
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
499
514
if test "x$ax_pthread_ok" = "xyes"; then
0 commit comments