@@ -855,6 +855,7 @@ Optional Packages:
855855 --with-libraries=DIRS look for additional libraries in DIRS
856856 --with-libs=DIRS alternative spelling of --with-libraries
857857 --with-pgport=PORTNUM change default port number 5432
858+ --with-threads allow libpq to be thread-safe
858859 --with-tcl build Tcl and Tk interfaces
859860 --without-tk do not build Tk interfaces if Tcl is enabled
860861 --with-tclconfig=DIR tclConfig.sh and tkConfig.sh are in DIR
@@ -2809,6 +2810,41 @@ echo "$as_me: WARNING: *** Library directory $dir does not exist." >&2;}
28092810done
28102811IFS=$ac_save_IFS
28112812
2813+ #
2814+ # Enable libpq to be thread-safe
2815+ #
2816+ echo " $as_me :$LINENO : checking allow threaded libpq" >&5
2817+ echo $ECHO_N " checking allow threaded libpq... $ECHO_C " >&6
2818+
2819+
2820+
2821+ # Check whether --with-threads or --without-threads was given.
2822+ if test " ${with_threads+set} " = set ; then
2823+ withval=" $with_threads "
2824+
2825+ case $withval in
2826+ yes)
2827+ :
2828+ ;;
2829+ no)
2830+ :
2831+ ;;
2832+ * )
2833+ { { echo " $as_me :$LINENO : error: no argument expected for --with-threads option" >&5
2834+ echo " $as_me : error: no argument expected for --with-threads option" >&2 ; }
2835+ { (exit 1); exit 1; }; }
2836+ ;;
2837+ esac
2838+
2839+ else
2840+ with_threads=no
2841+
2842+ fi ;
2843+
2844+ echo " $as_me :$LINENO : result: $with_threads " >&5
2845+ echo " ${ECHO_T} $with_threads " >&6
2846+
2847+
28122848#
28132849# Tcl/Tk
28142850#
@@ -3550,7 +3586,7 @@ rm -f conftest*
35503586#
35513587# Pthreads
35523588#
3553-
3589+ if test " $with_threads " = yes ; then
35543590echo " $as_me :$LINENO : checking for ANSI C header files" >&5
35553591echo $ECHO_N " checking for ANSI C header files... $ECHO_C " >&6
35563592if test " ${ac_cv_header_stdc+set} " = set ; then
@@ -3850,25 +3886,38 @@ echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
38503886
38513887fi
38523888if test $ac_cv_header_pthread_h = yes; then
3853-
3854- cat >> confdefs.h << \ _ACEOF
3855- #define HAVE_THREADS 1
3856- _ACEOF
3857-
3889+ :
3890+ else
3891+ { { echo " $as_me : $LINENO : error: pthread.h not found, required for --with-threads " >&5
3892+ echo " $as_me : error: pthread.h not found, required for --with-threads " >&2 ; }
3893+ { (exit 1) ; exit 1 ; } ; }
38583894fi
38593895
38603896
3861- if test ! -z " $HAVE_THREADS "
3862- then
3863- case $host_os in
3864- # BSD/OS and NetBSD require no special libraries or flags
3865- netbsd* |bsdi* ) ;;
3897+ case $host_os in
3898+ netbsd* |bsdi* )
3899+ # these require no special flags or libraries
3900+ ;;
38663901 freebsd2* |freebsd3* |freebsd4* ) THREAD_CFLAGS=" -pthread" ;;
38673902 freebsd* ) THREAD_LIBS=" -lc_r" ;;
38683903 linux* ) THREAD_LIBS=" -lpthread"
38693904 THREAD_CFLAGS=" -D_REENTRANT" ;;
3870- # other operating systems might fail because they have pthread.h but need
3871- # special libs we don't know about yet.
3905+ * )
3906+ # other operating systems might fail because they have pthread.h but need
3907+ # special libs we don't know about yet.
3908+ { { echo " $as_me :$LINENO : error:
3909+ Cannot enable threads on your platform.
3910+ Please report your platform threading info to the PostgreSQL mailing lists
3911+ so it can be added to the next release. Report any compile or link flags,
3912+ or libraries required for threading support.
3913+ " >&5
3914+ echo " $as_me : error:
3915+ Cannot enable threads on your platform.
3916+ Please report your platform threading info to the PostgreSQL mailing lists
3917+ so it can be added to the next release. Report any compile or link flags,
3918+ or libraries required for threading support.
3919+ " >&2 ; }
3920+ { (exit 1); exit 1; }; }
38723921 esac
38733922fi
38743923
@@ -17540,6 +17589,7 @@ s,@CPP@,$CPP,;t t
1754017589s,@GCC@,$GCC ,;t t
1754117590s,@autodepend@,$autodepend ,;t t
1754217591s,@INCLUDES@,$INCLUDES ,;t t
17592+ s,@with_threads@,$with_threads ,;t t
1754317593s,@with_tcl@,$with_tcl ,;t t
1754417594s,@with_tk@,$with_tk ,;t t
1754517595s,@with_perl@,$with_perl ,;t t
0 commit comments