Skip to content

Commit 732f2fd

Browse files
committed
Add --enable-thread-safety-force to force a thread compile even if the
OS thread tests fail.
1 parent 4525418 commit 732f2fd

File tree

2 files changed

+91
-17
lines changed

2 files changed

+91
-17
lines changed

configure

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ Optional Features:
846846
--enable-depend turn on automatic dependency tracking
847847
--enable-cassert enable assertion checks (for debugging)
848848
--enable-thread-safety make client libraries thread-safe
849+
--enable-thread-safety-force force thread-safety in spite of thread test failure
849850
--disable-largefile omit support for large files
850851

851852
Optional Packages:
@@ -2937,11 +2938,7 @@ if test "${enable_thread_safety+set}" = set; then
29372938

29382939
case $enableval in
29392940
yes)
2940-
2941-
cat >>confdefs.h <<\_ACEOF
2942-
#define ENABLE_THREAD_SAFETY 1
2943-
_ACEOF
2944-
2941+
:
29452942
;;
29462943
no)
29472944
:
@@ -2958,6 +2955,40 @@ else
29582955

29592956
fi;
29602957

2958+
2959+
2960+
# Check whether --enable-thread-safety-force or --disable-thread-safety-force was given.
2961+
if test "${enable_thread_safety_force+set}" = set; then
2962+
enableval="$enable_thread_safety_force"
2963+
2964+
case $enableval in
2965+
yes)
2966+
:
2967+
;;
2968+
no)
2969+
:
2970+
;;
2971+
*)
2972+
{ { echo "$as_me:$LINENO: error: no argument expected for --enable-thread-safety-force option" >&5
2973+
echo "$as_me: error: no argument expected for --enable-thread-safety-force option" >&2;}
2974+
{ (exit 1); exit 1; }; }
2975+
;;
2976+
esac
2977+
2978+
else
2979+
enable_thread_safety_force=no
2980+
2981+
fi;
2982+
2983+
if test "$enable_thread_safety" = yes -o
2984+
test "$enable_thread_safety_force" = yes; then
2985+
enable_thread_safety="yes" # for 'force'
2986+
2987+
cat >>confdefs.h <<\_ACEOF
2988+
#define ENABLE_THREAD_SAFETY 1
2989+
_ACEOF
2990+
2991+
fi
29612992
echo "$as_me:$LINENO: result: $enable_thread_safety" >&5
29622993
echo "${ECHO_T}$enable_thread_safety" >&6
29632994

@@ -17941,7 +17972,20 @@ done
1794117972
# We have to run the thread test near the end so we have all our symbols
1794217973
# defined. Cross compiling throws a warning.
1794317974
#
17944-
if test "$enable_thread_safety" = yes; then
17975+
if test "$enable_thread_safety_force" = yes; then
17976+
{ echo "$as_me:$LINENO: WARNING:
17977+
*** Skipping thread test program. --enable-thread-safety-force was used.
17978+
*** Run the program in src/tools/thread on the your machine and add
17979+
proper locking function calls to your applications to guarantee thread
17980+
safety.
17981+
" >&5
17982+
echo "$as_me: WARNING:
17983+
*** Skipping thread test program. --enable-thread-safety-force was used.
17984+
*** Run the program in src/tools/thread on the your machine and add
17985+
proper locking function calls to your applications to guarantee thread
17986+
safety.
17987+
" >&2;}
17988+
elif test "$enable_thread_safety" = yes; then
1794517989
echo "$as_me:$LINENO: checking thread safety of required library functions" >&5
1794617990
echo $ECHO_N "checking thread safety of required library functions... $ECHO_C" >&6
1794717991

@@ -17954,11 +17998,11 @@ if test "$cross_compiling" = yes; then
1795417998
echo "${ECHO_T}maybe" >&6
1795517999
{ echo "$as_me:$LINENO: WARNING:
1795618000
*** Skipping thread test program because of cross-compile build.
17957-
*** Run the program in src/tools/thread on the target matchine.
18001+
*** Run the program in src/tools/thread on the target machine.
1795818002
" >&5
1795918003
echo "$as_me: WARNING:
1796018004
*** Skipping thread test program because of cross-compile build.
17961-
*** Run the program in src/tools/thread on the target matchine.
18005+
*** Run the program in src/tools/thread on the target machine.
1796218006
" >&2;}
1796318007
else
1796418008
cat >conftest.$ac_ext <<_ACEOF
@@ -17988,10 +18032,22 @@ echo "$as_me:$LINENO: result: no" >&5
1798818032
echo "${ECHO_T}no" >&6
1798918033
{ { echo "$as_me:$LINENO: error:
1799018034
*** Thread test program failed. Your platform is not thread-safe.
17991-
*** Check the file 'config.log'for the exact reason." >&5
18035+
*** Check the file 'config.log'for the exact reason.
18036+
***
18037+
*** You can use the configure option --enable-thread-safety-force
18038+
*** to force threads to be enabled. However, you must then run
18039+
*** the program in src/tools/thread and add locking function calls
18040+
*** to your applications to guarantee thread safety.
18041+
" >&5
1799218042
echo "$as_me: error:
1799318043
*** Thread test program failed. Your platform is not thread-safe.
17994-
*** Check the file 'config.log'for the exact reason." >&2;}
18044+
*** Check the file 'config.log'for the exact reason.
18045+
***
18046+
*** You can use the configure option --enable-thread-safety-force
18047+
*** to force threads to be enabled. However, you must then run
18048+
*** the program in src/tools/thread and add locking function calls
18049+
*** to your applications to guarantee thread safety.
18050+
" >&2;}
1799518051
{ (exit 1); exit 1; }; }
1799618052
fi
1799718053
rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext

configure.in

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.365 2004/06/24 18:55:18 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.366 2004/07/10 01:24:29 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -358,9 +358,14 @@ IFS=$ac_save_IFS
358358
# Enable thread-safe client libraries
359359
#
360360
AC_MSG_CHECKING([allow thread-safe client libraries])
361-
PGAC_ARG_BOOL(enable, thread-safety, no, [ --enable-thread-safety make client libraries thread-safe],
362-
[AC_DEFINE([ENABLE_THREAD_SAFETY], 1,
363-
[Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety)])])
361+
PGAC_ARG_BOOL(enable, thread-safety, no, [ --enable-thread-safety make client libraries thread-safe])
362+
PGAC_ARG_BOOL(enable, thread-safety-force, no, [ --enable-thread-safety-force force thread-safety in spite of thread test failure])
363+
if test "$enable_thread_safety" = yes -o
364+
test "$enable_thread_safety_force" = yes; then
365+
enable_thread_safety="yes" # for 'force'
366+
AC_DEFINE([ENABLE_THREAD_SAFETY], 1,
367+
[Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety)])
368+
fi
364369
AC_MSG_RESULT([$enable_thread_safety])
365370
AC_SUBST(enable_thread_safety)
366371

@@ -1184,7 +1189,14 @@ AC_CHECK_PROGS(SGMLSPL, sgmlspl)
11841189
# We have to run the thread test near the end so we have all our symbols
11851190
# defined. Cross compiling throws a warning.
11861191
#
1187-
if test "$enable_thread_safety" = yes; then
1192+
if test "$enable_thread_safety_force" = yes; then
1193+
AC_MSG_WARN([
1194+
*** Skipping thread test program. --enable-thread-safety-force was used.
1195+
*** Run the program in src/tools/thread on the your machine and add
1196+
proper locking function calls to your applications to guarantee thread
1197+
safety.
1198+
])
1199+
elif test "$enable_thread_safety" = yes; then
11881200
AC_MSG_CHECKING([thread safety of required library functions])
11891201

11901202
_CFLAGS="$CFLAGS"
@@ -1196,11 +1208,17 @@ AC_TRY_RUN([#include "$srcdir/src/tools/thread/thread_test.c"],
11961208
[AC_MSG_RESULT(no)
11971209
AC_MSG_ERROR([
11981210
*** Thread test program failed. Your platform is not thread-safe.
1199-
*** Check the file 'config.log'for the exact reason.])],
1211+
*** Check the file 'config.log'for the exact reason.
1212+
***
1213+
*** You can use the configure option --enable-thread-safety-force
1214+
*** to force threads to be enabled. However, you must then run
1215+
*** the program in src/tools/thread and add locking function calls
1216+
*** to your applications to guarantee thread safety.
1217+
])],
12001218
[AC_MSG_RESULT(maybe)
12011219
AC_MSG_WARN([
12021220
*** Skipping thread test program because of cross-compile build.
1203-
*** Run the program in src/tools/thread on the target matchine.
1221+
*** Run the program in src/tools/thread on the target machine.
12041222
])])
12051223
CFLAGS="$_CFLAGS"
12061224
LIBS="$_LIBS"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy