... |
... |
@@ -14,20 +14,24 @@ |
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,11 +87,11 @@ |
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 30
|
87
|
91
|
|
88
|
92
|
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
89
|
93
|
AC_DEFUN([AX_PTHREAD], [
|
90
|
|
-AC_REQUIRE([AC_CANONICAL_HOST])
|
|
94
|
+AC_REQUIRE([AC_CANONICAL_TARGET])
|
91
|
95
|
AC_REQUIRE([AC_PROG_CC])
|
92
|
96
|
AC_REQUIRE([AC_PROG_SED])
|
93
|
97
|
AC_LANG_PUSH([C])
|
... |
... |
@@ -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])
|
... |
... |
@@ -153,7 +158,7 @@ ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread -- |
153
|
158
|
# --thread-safe: KAI C++
|
154
|
159
|
# pthread-config: use pthread-config program (for GNU Pth library)
|
155
|
160
|
|
156
|
|
-case $host_os in
|
|
161
|
+case $target_os in
|
157
|
162
|
|
158
|
163
|
freebsd*)
|
159
|
164
|
|
... |
... |
@@ -243,7 +248,7 @@ AS_IF([test "x$ax_pthread_clang" = "xyes"], |
243
|
248
|
# definitions is, on some systems, a strong hint that pthreads support is
|
244
|
249
|
# correctly enabled
|
245
|
250
|
|
246
|
|
-case $host_os in
|
|
251
|
+case $target_os in
|
247
|
252
|
darwin* | hpux* | linux* | osf* | solaris*)
|
248
|
253
|
ax_pthread_check_macro="_REENTRANT"
|
249
|
254
|
;;
|
... |
... |
@@ -445,7 +450,7 @@ if test "x$ax_pthread_ok" = "xyes"; then |
445
|
450
|
AC_CACHE_CHECK([whether more special flags are required for pthreads],
|
446
|
451
|
[ax_cv_PTHREAD_SPECIAL_FLAGS],
|
447
|
452
|
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
|
448
|
|
- case $host_os in
|
|
453
|
+ case $target_os in
|
449
|
454
|
solaris*)
|
450
|
455
|
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
|
451
|
456
|
;;
|
... |
... |
@@ -475,25 +480,35 @@ if test "x$ax_pthread_ok" = "xyes"; then |
475
|
480
|
|
476
|
481
|
# More AIX lossage: compile with *_r variant
|
477
|
482
|
if test "x$GCC" != "xyes"; then
|
478
|
|
- case $host_os in
|
|
483
|
+ case $target_os in
|
479
|
484
|
aix*)
|
480
|
485
|
AS_CASE(["x/$CC"],
|
481
|
486
|
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
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
|