1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Check and set thread-safe functions separately, rather than as a single

variable.

Remove thread locking for non-thread-safe functions, instead throw a
compile error.

Platforms will have to re-run tools/thread to record their thread
safety.
This commit is contained in:
Bruce Momjian
2004-02-11 21:44:06 +00:00
parent 15b330b648
commit c6f0559371
12 changed files with 134 additions and 241 deletions

View File

@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.315 2004/02/11 17:29:01 momjian Exp $
dnl $PostgreSQL: pgsql/configure.in,v 1.316 2004/02/11 21:44:04 momjian Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
@@ -971,7 +971,7 @@ AC_FUNC_FSEEKO
# See the comment at the top of src/port/thread.c for more information.
#
if test "$enable_thread_safety" = yes; then
AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --enable-thread-safetys])])
AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --enable-thread-safety])])
if test "$THREAD_SUPPORT" != yes; then
AC_MSG_ERROR([
@@ -982,28 +982,28 @@ functions, or libraries required for threading support.
See the comment at the top of src/port/thread.c for more information.
])
fi
else
# do not use values from template file
THREAD_CPPFLAGS=
THREAD_LIBS=
fi
AC_SUBST(THREAD_SUPPORT)
AC_SUBST(THREAD_CPPFLAGS)
AC_SUBST(THREAD_LIBS)
#
# Check for re-entrant versions of certain functions
#
# Include special flags if threads are enabled _and_ if required for
# threading on this platform. Some platforms have *_r functions but
# their natively named funcs are threadsafe, and should be used instead.
# their natively named funcs are thread-safe too.
#
# One trick here is that if we don't call AC_CHECK_FUNCS, the
# One trick here is that if we don't call AC_CHECK_FUNCS; the
# functions are marked "not found", which is perfect.
#
if test "$enable_thread_safety" = yes -a "$NEED_REENTRANT_FUNCS" = yes ; then
AC_DEFINE(NEED_REENTRANT_FUNCS, 1, [Define if non *_r libc functions are not thread safe])
if test "$enable_thread_safety" = yes -a "$STRERROR_THREADSAFE" = yes ; then
AC_DEFINE(STRERROR_THREADSAFE, 1, [Define if strerror is not thread safe])
fi
if test "$enable_thread_safety" = yes -a "$GETPWUID_THREADSAFE" = yes ; then
AC_DEFINE(GETPWUID_THREADSAFE, 1, [Define if getpwuid is not thread safe])
fi
if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
AC_DEFINE(GETHOSTBYNAME_THREADSAFE, 1, [Define if gethostbyname is not thread safe])
fi
# Check for *_r functions
_CFLAGS="$CFLAGS"
_LIBS="$LIBS"
CFLAGS="$CFLAGS $THREAD_CPPFLAGS"
@@ -1011,8 +1011,17 @@ LIBS="$LIBS $THREAD_LIBS"
AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
CFLAGS="$_CFLAGS"
LIBS="$_LIBS"
else
# do not use values from template file
THREAD_CPPFLAGS=
THREAD_LIBS=
fi
AC_SUBST(THREAD_SUPPORT)
AC_SUBST(THREAD_CPPFLAGS)
AC_SUBST(THREAD_LIBS)
# This test makes sure that run tests work at all. Sometimes a shared
# library is found by the linker, but the runtime linker can't find it.