1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add --with-threads configure option to control threaded libpq.

This commit is contained in:
Bruce Momjian
2003-06-13 23:10:08 +00:00
parent 26188e8c17
commit 02d847fe9f
5 changed files with 112 additions and 42 deletions

View File

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
dnl $Header: /cvsroot/pgsql/configure.in,v 1.260 2003/06/12 16:05:09 tgl Exp $
dnl $Header: /cvsroot/pgsql/configure.in,v 1.261 2003/06/13 23:10:07 momjian Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
@ -319,6 +319,14 @@ for dir in $LIBRARY_DIRS $SRCH_LIB; do
done
IFS=$ac_save_IFS
#
# Enable libpq to be thread-safe
#
AC_MSG_CHECKING([allow threaded libpq])
PGAC_ARG_BOOL(with, threads, no, [ --with-threads allow libpq to be thread-safe])
AC_MSG_RESULT([$with_threads])
AC_SUBST(with_threads)
#
# Tcl/Tk
#
@ -544,20 +552,25 @@ AC_SUBST(ELF_SYS)
#
# Pthreads
#
AC_CHECK_HEADER(pthread.h,
[AC_DEFINE(HAVE_THREADS, 1, [Define to 1 if you have the threads interface.])])
if test ! -z "$HAVE_THREADS"
then
case $host_os in
# BSD/OS and NetBSD require no special libraries or flags
netbsd*|bsdi*) ;;
if test "$with_threads" = yes; then
AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --with-threads])])
case $host_os in
netbsd*|bsdi*)
# these require no special flags or libraries
;;
freebsd2*|freebsd3*|freebsd4*) THREAD_CFLAGS="-pthread" ;;
freebsd*) THREAD_LIBS="-lc_r" ;;
linux*) THREAD_LIBS="-lpthread"
THREAD_CFLAGS="-D_REENTRANT" ;;
# other operating systems might fail because they have pthread.h but need
# special libs we don't know about yet.
*)
# other operating systems might fail because they have pthread.h but need
# special libs we don't know about yet.
AC_MSG_ERROR([
Cannot enable threads on your platform.
Please report your platform threading info to the PostgreSQL mailing lists
so it can be added to the next release. Report any compile or link flags,
or libraries required for threading support.
])
esac
fi
AC_SUBST(THREAD_LIBS)