@@ -13213,11 +13213,13 @@ echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6
13213
13213
-*)
13214
13214
echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5
13215
13215
echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6
13216
- PTHREAD_CFLAGS ="$flag"
13216
+ tryPTHREAD_CFLAGS ="$flag"
13217
13217
;;
13218
13218
13219
- pthread-config)
13220
- # Extract the first word of "pthread-config", so it can be a program name with args.
13219
+ pthread-config)
13220
+ # skip this if we already have flags defined, for PostgreSQL
13221
+ if test x"$PTHREAD_CFLAGS" != x -o x"$PTHREAD_LIBS" != x; then continue; fi
13222
+ # Extract the first word of "pthread-config", so it can be a program name with args.
13221
13223
set dummy pthread-config; ac_word=$2
13222
13224
echo "$as_me:$LINENO: checking for $ac_word" >&5
13223
13225
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
@@ -13253,22 +13255,23 @@ else
13253
13255
echo "${ECHO_T}no" >&6
13254
13256
fi
13255
13257
13256
- if test x"$acx_pthread_config" = xno; then continue; fi
13257
- PTHREAD_CFLAGS="`pthread-config --cflags`"
13258
- PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
13259
- ;;
13258
+ if test x"$acx_pthread_config" = xno; then continue; fi
13259
+ tryPTHREAD_CFLAGS="`pthread-config --cflags`"
13260
+ tryPTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
13261
+ fi
13262
+ ;;
13260
13263
13261
13264
*)
13262
13265
echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5
13263
13266
echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6
13264
- PTHREAD_LIBS ="-l$flag"
13267
+ tryPTHREAD_LIBS ="-l$flag"
13265
13268
;;
13266
13269
esac
13267
13270
13268
13271
save_LIBS="$LIBS"
13269
13272
save_CFLAGS="$CFLAGS"
13270
- LIBS="$PTHREAD_LIBS $LIBS"
13271
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
13273
+ LIBS="$tryPTHREAD_LIBS $ PTHREAD_LIBS $LIBS"
13274
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS $tryPTHREAD_CFLAGS "
13272
13275
13273
13276
# Check for various functions. We must include pthread.h,
13274
13277
# since some functions may be macros. (On the Sequent, we
@@ -13324,11 +13327,13 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
13324
13327
echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
13325
13328
echo "${ECHO_T}$acx_pthread_ok" >&6
13326
13329
if test "x$acx_pthread_ok" = xyes; then
13327
- break;
13330
+ # we continue with more flags because Linux needs -lpthread
13331
+ # for libpq builds on PostgreSQL. The test above only
13332
+ # tests for building binaries, not shared libraries.
13333
+ PTHREAD_LIBS=" $tryPTHREAD_LIBS $PTHREAD_LIBS"
13334
+ PTHREAD_CFLAGS="$PTHREAD_CFLAGS $tryPTHREAD_CFLAGS"
13328
13335
fi
13329
13336
13330
- PTHREAD_LIBS=""
13331
- PTHREAD_CFLAGS=""
13332
13337
done
13333
13338
fi
13334
13339
@@ -13436,11 +13441,11 @@ echo "$as_me: WARNING: we do not know how to create joinable pthreads" >&2;}
13436
13441
echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
13437
13442
echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6
13438
13443
flag=no
13439
- # We handle this ourselves in PostgreSQL
13440
- # case "${host_cpu}-${host_os}" in
13441
- # *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
13442
- # *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
13443
- # esac
13444
+ # We always add these in PostgreSQL
13445
+ # case "${host_cpu}-${host_os}" in
13446
+ # *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
13447
+ # *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
13448
+ # esac
13444
13449
echo "$as_me:$LINENO: result: ${flag}" >&5
13445
13450
echo "${ECHO_T}${flag}" >&6
13446
13451
if test "x$flag" != xno; then
0 commit comments