-if test "$SUPPORTS_THREADS" != yes; then
+if test "$THREAD_SUPPORT" != yes; then
{ { echo "$as_me:$LINENO: error:
Cannot enable threads on your platform.
Please report your platform threading info to the PostgreSQL mailing lists
+
#
# Check for re-entrant versions of certain functions
#
s,@python_libspec@,$python_libspec,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@HAVE_IPV6@,$HAVE_IPV6,;t t
+s,@THREAD_SUPPORT@,$THREAD_SUPPORT,;t t
s,@THREAD_CPPFLAGS@,$THREAD_CPPFLAGS,;t t
s,@THREAD_LIBS@,$THREAD_LIBS,;t t
s,@HAVE_POSIX_SIGNALS@,$HAVE_POSIX_SIGNALS,;t t
-\dnl Process this file with autoconf to produce a configure script.
+dnl Process this file with autoconf to produce a configure script.
dnl $Header$
dnl
dnl Developers, please strive to achieve this order:
if test "$enable_thread_safety" = yes; then
AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --enable-thread-safetys])])
-if test "$SUPPORTS_THREADS" != yes; then
+if test "$THREAD_SUPPORT" != yes; then
AC_MSG_ERROR([
Cannot enable threads on your platform.
Please report your platform threading info to the PostgreSQL mailing lists
THREAD_CPPFLAGS=
THREAD_LIBS=
fi
+AC_SUBST(THREAD_SUPPORT)
AC_SUBST(THREAD_CPPFLAGS)
AC_SUBST(THREAD_LIBS)
TK_LIB_SPEC = @TK_LIB_SPEC@
TK_XINCLUDES = @TK_XINCLUDES@
+THREAD_SUPPORT = @THREAD_SUPPORT@
THREAD_CPPFLAGS = @THREAD_CPPFLAGS@
THREAD_LIBS = @THREAD_LIBS@
;;
esac
-SUPPORTS_THREADS=yes
+THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=no # verified 4.3 2003-09-26
alpha*) CFLAGS="$CFLAGS -O" ;;
esac
-SUPPORTS_THREADS=yes
-NEED_REENTRANT_FUNCS=yes # 4.8, 5.1 2003-09-12
-
+THREAD_SUPPORT=yes
+NEED_REENTRANT_FUNCS=yes
THREAD_CPPFLAGS="-D_THREAD_SAFE"
case $host_os in
freebsd2*|freebsd3*|freebsd4*)
# Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
CPPFLAGS="-D_GNU_SOURCE"
-SUPPORTS_THREADS=yes
-NEED_REENTRANT_FUNCS=yes # verified glibc 2.1 2003-09-03
+THREAD_SUPPORT=yes
+NEED_REENTRANT_FUNCS=yes
THREAD_CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
THREAD_LIBS="-lpthread"
CFLAGS='-O2 -pipe'
-SUPPORTS_THREADS=yes
+THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes # 1.6 2003-09-14
CFLAGS='-O4 -Olimit 2000'
fi
-SUPPORTS_THREADS=yes
+THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=no # 4.0 2003-09-13
THREAD_LIBS="-pthread"
CFLAGS=-v # -v is like gcc -Wall
fi
-SUPPORTS_THREADS=yes
+THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes # 5.6 2003-09-13
THREAD_LIBS="-pthread"
THREAD_CPPFLAGS="-K pthread"
fi
-SUPPORTS_THREADS=yes
+THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=no # verified 7.1.3 2003-09-03
THREAD_CPPFLAGS="$THREAD_CPPFLAGS -D_REENTRANT"
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
+ifeq ($(THREAD_SUPPORT), no)
+$(error Your platform does not support threads)
+endif
+ifeq ($(THREAD_SUPPORT), )
+$(error You have not configured your template/$$port file. See the README)
+endif
+
override CFLAGS += $(THREAD_CPPFLAGS)
LDFLAGS += $(THREAD_LIBS)
Run thread_test program to determine if your native libc functions are
thread-safe, or if we should use *_r functions or thread locking.
-Make sure you have added any needed 'THREAD_CPPFLAGS' and 'THREAD_LIBS'
-defines to your template/${port} file before compiling this program.
+To use this program, you must:
+
+ o add "THREAD_SUPPORT=yes" to your template/${port} file
+ o add any THREAD_CPPFLAGS and THREAD_LIBS defines to your
+ template/${port} file
+ o run "configure --enable-thread-safety"
+ o compile and run this program
printf("\
Make sure you have added any needed 'THREAD_CPPFLAGS' and 'THREAD_LIBS'\n\
-defines to your template/${port} file before compiling this program.\n\n"
+defines to your template/$port file before compiling this program.\n\n"
);
pthread_create(&thread1, NULL, (void * (*)(void *)) func_call_1, NULL);
pthread_create(&thread2, NULL, (void * (*)(void *)) func_call_2, NULL);
strerror_p1 != strerror_p2)
{
printf("All your non-*_r functions are thread-safe.\n");
- printf("Add this to your template/${port} file:\n\n");
- printf("\
-SUPPORTS_THREADS=yes\n\
-NEED_REENTRANT_FUNCS=no\n"
- );
+ printf("Add this to your template/$port file:\n\n");
+ printf("NEED_REENTRANT_FUNCS=no\n");
}
else
{
printf("Not all non-*_r functions are thread-safe.\n");
- printf("Add this to your template/${port} file:\n\n");
- printf("\
-SUPPORTS_THREADS=yes\n\
-NEED_REENTRANT_FUNCS=yes\n"
- );
+ printf("Add this to your template/$port file:\n\n");
+ printf("NEED_REENTRANT_FUNCS=yes\n");
}
return 0;