Commit 391dceb4 authored by Bruce Momjian's avatar Bruce Momjian

Finalize configuration of thread_test program.

parent a6790ce8
...@@ -13273,7 +13273,7 @@ fi ...@@ -13273,7 +13273,7 @@ fi
if test "$SUPPORTS_THREADS" != yes; then if test "$THREAD_SUPPORT" != yes; then
{ { echo "$as_me:$LINENO: error: { { echo "$as_me:$LINENO: error:
Cannot enable threads on your platform. Cannot enable threads on your platform.
Please report your platform threading info to the PostgreSQL mailing lists Please report your platform threading info to the PostgreSQL mailing lists
...@@ -13299,6 +13299,7 @@ fi ...@@ -13299,6 +13299,7 @@ fi
# #
# Check for re-entrant versions of certain functions # Check for re-entrant versions of certain functions
# #
...@@ -18211,6 +18212,7 @@ s,@python_includespec@,$python_includespec,;t t ...@@ -18211,6 +18212,7 @@ s,@python_includespec@,$python_includespec,;t t
s,@python_libspec@,$python_libspec,;t t s,@python_libspec@,$python_libspec,;t t
s,@LIBOBJS@,$LIBOBJS,;t t s,@LIBOBJS@,$LIBOBJS,;t t
s,@HAVE_IPV6@,$HAVE_IPV6,;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_CPPFLAGS@,$THREAD_CPPFLAGS,;t t
s,@THREAD_LIBS@,$THREAD_LIBS,;t t s,@THREAD_LIBS@,$THREAD_LIBS,;t t
s,@HAVE_POSIX_SIGNALS@,$HAVE_POSIX_SIGNALS,;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: /cvsroot/pgsql/configure.in,v 1.291 2003/09/27 15:32:47 momjian Exp $ dnl $Header: /cvsroot/pgsql/configure.in,v 1.292 2003/09/27 16:24:44 momjian Exp $
dnl dnl
dnl Developers, please strive to achieve this order: dnl Developers, please strive to achieve this order:
dnl dnl
...@@ -1002,7 +1002,7 @@ AC_FUNC_FSEEKO ...@@ -1002,7 +1002,7 @@ AC_FUNC_FSEEKO
if test "$enable_thread_safety" = yes; then 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-safetys])])
if test "$SUPPORTS_THREADS" != yes; then if test "$THREAD_SUPPORT" != yes; then
AC_MSG_ERROR([ AC_MSG_ERROR([
Cannot enable threads on your platform. Cannot enable threads on your platform.
Please report your platform threading info to the PostgreSQL mailing lists Please report your platform threading info to the PostgreSQL mailing lists
...@@ -1016,6 +1016,7 @@ else ...@@ -1016,6 +1016,7 @@ else
THREAD_CPPFLAGS= THREAD_CPPFLAGS=
THREAD_LIBS= THREAD_LIBS=
fi fi
AC_SUBST(THREAD_SUPPORT)
AC_SUBST(THREAD_CPPFLAGS) AC_SUBST(THREAD_CPPFLAGS)
AC_SUBST(THREAD_LIBS) AC_SUBST(THREAD_LIBS)
......
# -*-makefile-*- # -*-makefile-*-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.169 2003/09/27 15:32:47 momjian Exp $ # $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.170 2003/09/27 16:24:44 momjian Exp $
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets, # All PostgreSQL makefiles include this file and use the variables it sets,
...@@ -150,6 +150,7 @@ TK_LIBS = @TK_LIBS@ ...@@ -150,6 +150,7 @@ TK_LIBS = @TK_LIBS@
TK_LIB_SPEC = @TK_LIB_SPEC@ TK_LIB_SPEC = @TK_LIB_SPEC@
TK_XINCLUDES = @TK_XINCLUDES@ TK_XINCLUDES = @TK_XINCLUDES@
THREAD_SUPPORT = @THREAD_SUPPORT@
THREAD_CPPFLAGS = @THREAD_CPPFLAGS@ THREAD_CPPFLAGS = @THREAD_CPPFLAGS@
THREAD_LIBS = @THREAD_LIBS@ THREAD_LIBS = @THREAD_LIBS@
......
...@@ -10,5 +10,5 @@ case $host_os in ...@@ -10,5 +10,5 @@ case $host_os in
;; ;;
esac esac
SUPPORTS_THREADS=yes THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=no # verified 4.3 2003-09-26 NEED_REENTRANT_FUNCS=no # verified 4.3 2003-09-26
...@@ -4,9 +4,8 @@ case $host_cpu in ...@@ -4,9 +4,8 @@ case $host_cpu in
alpha*) CFLAGS="$CFLAGS -O" ;; alpha*) CFLAGS="$CFLAGS -O" ;;
esac esac
SUPPORTS_THREADS=yes THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes # 4.8, 5.1 2003-09-12 NEED_REENTRANT_FUNCS=yes
THREAD_CPPFLAGS="-D_THREAD_SAFE" THREAD_CPPFLAGS="-D_THREAD_SAFE"
case $host_os in case $host_os in
freebsd2*|freebsd3*|freebsd4*) freebsd2*|freebsd3*|freebsd4*)
......
...@@ -2,8 +2,8 @@ CFLAGS=-O2 ...@@ -2,8 +2,8 @@ CFLAGS=-O2
# Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise # Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
CPPFLAGS="-D_GNU_SOURCE" CPPFLAGS="-D_GNU_SOURCE"
SUPPORTS_THREADS=yes THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes # verified glibc 2.1 2003-09-03 NEED_REENTRANT_FUNCS=yes
THREAD_CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS" THREAD_CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
THREAD_LIBS="-lpthread" THREAD_LIBS="-lpthread"
CFLAGS='-O2 -pipe' CFLAGS='-O2 -pipe'
SUPPORTS_THREADS=yes THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes # 1.6 2003-09-14 NEED_REENTRANT_FUNCS=yes # 1.6 2003-09-14
...@@ -5,6 +5,6 @@ else ...@@ -5,6 +5,6 @@ else
CFLAGS='-O4 -Olimit 2000' CFLAGS='-O4 -Olimit 2000'
fi fi
SUPPORTS_THREADS=yes THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=no # 4.0 2003-09-13 NEED_REENTRANT_FUNCS=no # 4.0 2003-09-13
THREAD_LIBS="-pthread" THREAD_LIBS="-pthread"
...@@ -5,7 +5,7 @@ else ...@@ -5,7 +5,7 @@ else
CFLAGS=-v # -v is like gcc -Wall CFLAGS=-v # -v is like gcc -Wall
fi fi
SUPPORTS_THREADS=yes THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes # 5.6 2003-09-13 NEED_REENTRANT_FUNCS=yes # 5.6 2003-09-13
THREAD_LIBS="-pthread" THREAD_LIBS="-pthread"
...@@ -9,6 +9,6 @@ else ...@@ -9,6 +9,6 @@ else
THREAD_CPPFLAGS="-K pthread" THREAD_CPPFLAGS="-K pthread"
fi fi
SUPPORTS_THREADS=yes THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=no # verified 7.1.3 2003-09-03 NEED_REENTRANT_FUNCS=no # verified 7.1.3 2003-09-03
THREAD_CPPFLAGS="$THREAD_CPPFLAGS -D_REENTRANT" THREAD_CPPFLAGS="$THREAD_CPPFLAGS -D_REENTRANT"
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (C) 2003 by PostgreSQL Global Development Team # Copyright (C) 2003 by PostgreSQL Global Development Team
# #
# $Header: /cvsroot/pgsql/src/tools/thread/Attic/Makefile,v 1.1 2003/09/27 15:32:48 momjian Exp $ # $Header: /cvsroot/pgsql/src/tools/thread/Attic/Makefile,v 1.2 2003/09/27 16:24:45 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -12,6 +12,13 @@ subdir = tools/thread ...@@ -12,6 +12,13 @@ subdir = tools/thread
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global 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) override CFLAGS += $(THREAD_CPPFLAGS)
LDFLAGS += $(THREAD_LIBS) LDFLAGS += $(THREAD_LIBS)
......
...@@ -4,5 +4,10 @@ new platforms. ...@@ -4,5 +4,10 @@ new platforms.
Run thread_test program to determine if your native libc functions are Run thread_test program to determine if your native libc functions are
thread-safe, or if we should use *_r functions or thread locking. thread-safe, or if we should use *_r functions or thread locking.
Make sure you have added any needed 'THREAD_CPPFLAGS' and 'THREAD_LIBS' To use this program, you must:
defines to your template/${port} file before compiling this program.
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
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/tools/thread/Attic/thread_test.c,v 1.1 2003/09/27 15:32:48 momjian Exp $ * $Header: /cvsroot/pgsql/src/tools/thread/Attic/thread_test.c,v 1.2 2003/09/27 16:24:45 momjian Exp $
* *
* This program tests to see if your standard libc functions use * This program tests to see if your standard libc functions use
* pthread_setspecific()/pthread_getspecific() to be thread-safe. * pthread_setspecific()/pthread_getspecific() to be thread-safe.
...@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) ...@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
printf("\ printf("\
Make sure you have added any needed 'THREAD_CPPFLAGS' and 'THREAD_LIBS'\n\ 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(&thread1, NULL, (void * (*)(void *)) func_call_1, NULL);
pthread_create(&thread2, NULL, (void * (*)(void *)) func_call_2, NULL); pthread_create(&thread2, NULL, (void * (*)(void *)) func_call_2, NULL);
...@@ -82,20 +82,14 @@ defines to your template/${port} file before compiling this program.\n\n" ...@@ -82,20 +82,14 @@ defines to your template/${port} file before compiling this program.\n\n"
strerror_p1 != strerror_p2) strerror_p1 != strerror_p2)
{ {
printf("All your non-*_r functions are thread-safe.\n"); printf("All your non-*_r functions are thread-safe.\n");
printf("Add this to your template/${port} file:\n\n"); printf("Add this to your template/$port file:\n\n");
printf("\ printf("NEED_REENTRANT_FUNCS=no\n");
SUPPORTS_THREADS=yes\n\
NEED_REENTRANT_FUNCS=no\n"
);
} }
else else
{ {
printf("Not all non-*_r functions are thread-safe.\n"); printf("Not all non-*_r functions are thread-safe.\n");
printf("Add this to your template/${port} file:\n\n"); printf("Add this to your template/$port file:\n\n");
printf("\ printf("NEED_REENTRANT_FUNCS=yes\n");
SUPPORTS_THREADS=yes\n\
NEED_REENTRANT_FUNCS=yes\n"
);
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment