File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1035,7 +1035,17 @@ if test -n "$USER_NOPTHREAD"; then
1035
1035
# -D_REENTRANT' or some such.
1036
1036
elif test -z "$PTHREAD_CFLAGS"; then
1037
1037
threads_found=no
1038
- for opt in -mt -pthread -lpthread; do
1038
+ # Attempt to compile and link some code using pthreads to determine
1039
+ # required linker flags. The order is somewhat important here: We
1040
+ # first try it without any extra flags, to catch systems where
1041
+ # pthreads are part of the C library, then go on testing various other
1042
+ # flags. We do so to avoid false positives. For example, on Mac OS X
1043
+ # pthreads are part of the C library; moreover, the compiler allows us
1044
+ # to add "-mt" to the CFLAGS (although it will do nothing except
1045
+ # trigger a warning about an unused flag). Hence if we checked for
1046
+ # "-mt" before "" we would end up picking it. But unfortunately this
1047
+ # would then trigger compiler warnings on every single file we compile.
1048
+ for opt in "" -mt -pthread -lpthread; do
1039
1049
old_CFLAGS="$CFLAGS"
1040
1050
CFLAGS="$opt $CFLAGS"
1041
1051
AC_MSG_CHECKING ( [ for POSIX Threads with '$opt'] )
You can’t perform that action at this time.
0 commit comments