Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5c15cb4

Browse files
committed
Fix thread handling in configure.
1 parent 963c1fa commit 5c15cb4

File tree

3 files changed

+25
-29
lines changed

3 files changed

+25
-29
lines changed

configure

+16-18
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ Optional Features:
844844
--enable-debug build with debugging symbols (-g)
845845
--enable-depend turn on automatic dependency tracking
846846
--enable-cassert enable assertion checks (for debugging)
847+
--enable-thread-safety allow libpq and ecpg to be thread-safe
847848
--disable-largefile omit support for large files
848849

849850
Optional Packages:
@@ -854,7 +855,6 @@ Optional Packages:
854855
--with-libraries=DIRS look for additional libraries in DIRS
855856
--with-libs=DIRS alternative spelling of --with-libraries
856857
--with-pgport=PORTNUM change default port number 5432
857-
--enable-thread-safety allow libpq and ecpg to be thread-safe
858858
--with-tcl build Tcl and Tk interfaces
859859
--without-tk do not build Tk interfaces if Tcl is enabled
860860
--with-tclconfig=DIR tclConfig.sh and tkConfig.sh are in DIR
@@ -2779,35 +2779,29 @@ echo "$as_me:$LINENO: checking allow thread-safe libpq and ecpg" >&5
27792779
echo $ECHO_N "checking allow thread-safe libpq and ecpg... $ECHO_C" >&6
27802780

27812781

2782+
# Check whether --enable-thread-safety or --disable-thread-safety was given.
2783+
if test "${enable_thread_safety+set}" = set; then
2784+
enableval="$enable_thread_safety"
27822785

2783-
# Check whether --with-threads or --without-threads was given.
2784-
if test "${with_threads+set}" = set; then
2785-
withval="$with_threads"
2786-
2787-
case $withval in
2786+
case $enableval in
27882787
yes)
2789-
2790-
cat >>confdefs.h <<\_ACEOF
2791-
#define USE_THREADS 1
2792-
_ACEOF
2793-
2788+
:
27942789
;;
27952790
no)
27962791
:
27972792
;;
27982793
*)
2799-
{ { echo "$as_me:$LINENO: error: no argument expected for --with-threads option" >&5
2800-
echo "$as_me: error: no argument expected for --with-threads option" >&2;}
2794+
{ { echo "$as_me:$LINENO: error: no argument expected for --enable-thread-safety option" >&5
2795+
echo "$as_me: error: no argument expected for --enable-thread-safety option" >&2;}
28012796
{ (exit 1); exit 1; }; }
28022797
;;
28032798
esac
28042799

28052800
else
2806-
with_threads=no
2801+
enable_thread_safety=no
28072802

28082803
fi;
28092804

2810-
28112805
echo "$as_me:$LINENO: result: $enable_thread_safety" >&5
28122806
echo "${ECHO_T}$enable_thread_safety" >&6
28132807

@@ -13079,6 +13073,10 @@ functions, or libraries required for threading support.
1307913073
" >&2;}
1308013074
{ (exit 1); exit 1; }; }
1308113075
fi
13076+
else
13077+
# do not use values from template file
13078+
THREAD_CFLAGS=
13079+
THREAD_LIBS=
1308213080
fi
1308313081

1308413082

@@ -13096,8 +13094,8 @@ fi
1309613094
#
1309713095
if test "$enable_thread_safety" = yes -a "$NEED_REENTRANT_FUNC_NAMES" = yes ; then
1309813096
_CFLAGS="$CFLAGS"
13099-
_LIB="$LIBS"
13100-
CFLAGS="$CFLAGS $TREAD_CFLAGS"
13097+
_LIBS="$LIBS"
13098+
CFLAGS="$CFLAGS $THREAD_CFLAGS"
1310113099
LIBS="$LIBS $THREAD_LIBS"
1310213100

1310313101

@@ -13178,7 +13176,7 @@ fi
1317813176
done
1317913177

1318013178
CFLAGS="$_CFLAGS"
13181-
LIB="$_LIBS"
13179+
LIBS="$_LIBS"
1318213180
fi
1318313181

1318413182

configure.in

+9-7
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 $Header: /cvsroot/pgsql/configure.in,v 1.274 2003/08/04 04:03:03 tgl Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.275 2003/08/04 16:48:03 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -314,9 +314,7 @@ IFS=$ac_save_IFS
314314
# Enable libpq to be thread-safety
315315
#
316316
AC_MSG_CHECKING([allow thread-safe libpq and ecpg])
317-
PGAC_ARG_BOOL(with, threads, no, [ --enable-thread-safety allow libpq and ecpg to be thread-safe],
318-
[AC_DEFINE([USE_THREADS], 1, [Define to 1 to build libpq and ecpg to be thread-safe. (--enable-thread-safety)])])
319-
317+
PGAC_ARG_BOOL(enable, thread-safety, no, [ --enable-thread-safety allow libpq and ecpg to be thread-safe])
320318
AC_MSG_RESULT([$enable_thread_safety])
321319
AC_SUBST(enable_thread_safety)
322320

@@ -970,6 +968,10 @@ so it can be added to the next release. Report all compile flags, link flags,
970968
functions, or libraries required for threading support.
971969
])
972970
fi
971+
else
972+
# do not use values from template file
973+
THREAD_CFLAGS=
974+
THREAD_LIBS=
973975
fi
974976
AC_SUBST(THREAD_CFLAGS)
975977
AC_SUBST(THREAD_LIBS)
@@ -987,12 +989,12 @@ AC_SUBST(THREAD_LIBS)
987989
#
988990
if test "$enable_thread_safety" = yes -a "$NEED_REENTRANT_FUNC_NAMES" = yes ; then
989991
_CFLAGS="$CFLAGS"
990-
_LIB="$LIBS"
991-
CFLAGS="$CFLAGS $TREAD_CFLAGS"
992+
_LIBS="$LIBS"
993+
CFLAGS="$CFLAGS $THREAD_CFLAGS"
992994
LIBS="$LIBS $THREAD_LIBS"
993995
AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
994996
CFLAGS="$_CFLAGS"
995-
LIB="$_LIBS"
997+
LIBS="$_LIBS"
996998
fi
997999

9981000

src/include/pg_config.h.in

-4
Original file line numberDiff line numberDiff line change
@@ -600,10 +600,6 @@
600600
/* Define to select SysV-style shared memory. */
601601
#undef USE_SYSV_SHARED_MEMORY
602602

603-
/* Define to 1 to build libpq and ecpg to be thread-safe.
604-
(--enable-thread-safety) */
605-
#undef USE_THREADS
606-
607603
/* Define to select unnamed POSIX semaphores. */
608604
#undef USE_UNNAMED_POSIX_SEMAPHORES
609605

0 commit comments

Comments
 (0)