Re: followup: ECPG thread-safety test-case - Mailing list pgsql-interfaces
From | Bruce Momjian |
---|---|
Subject | Re: followup: ECPG thread-safety test-case |
Date | |
Msg-id | 200305271636.h4RGaTu16781@candle.pha.pa.us Whole thread Raw |
In response to | followup: ECPG thread-safety test-case (Philip Yarra <philipNOSPAM@utiba.com>) |
List | pgsql-interfaces |
Here are the configure tests for threaded use, applied to CVS. We will initially be using threads only in ecpg and libpq. --------------------------------------------------------------------------- Philip Yarra wrote: > Hi, I have heard nothing since I posted my ECPG thread-safety test case on 8th > May - has anyone had a chance to test this against Lee's thread-safety patch? > I would welcome some feedback. Test app attached. > > Regards, Philip. > > > [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: configure =================================================================== RCS file: /cvsroot/pgsql-server/configure,v retrieving revision 1.262 diff -c -c -r1.262 configure *** configure 22 May 2003 16:39:27 -0000 1.262 --- configure 27 May 2003 16:35:23 -0000 *************** *** 3472,3477 **** --- 3472,3480 ---- + # + # Elf + # # Assume system is ELF if it predefines __ELF__ as 1, # otherwise believe host_os based default. *************** *** 3503,3509 **** --- 3506,3841 ---- + # + # Pthreads + # + + echo "$as_me:$LINENO: checking for ANSI C header files" >&5 + echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 + if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + #include <stdlib.h> + #include <stdarg.h> + #include <string.h> + #include <float.h> + + _ACEOF + if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi + else + ac_cpp_err=yes + fi + if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no + fi + rm -f conftest.err conftest.$ac_ext + + if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + #include <string.h> + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : + else + ac_cv_header_stdc=no + fi + rm -f conftest* + + fi + + if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + #include <stdlib.h> + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : + else + ac_cv_header_stdc=no + fi + rm -f conftest* + fi + + if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : + else + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + #include <ctype.h> + #if ((' ' & 0x0FF) == 0x020) + # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') + # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) + #else + # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) + # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) + #endif + + #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) + int + main () + { + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); + } + _ACEOF + rm -f conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : + else + echo "$as_me: program exited with status $ac_status" >&5 + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ( exit $ac_status ) + ac_cv_header_stdc=no + fi + rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + fi + fi + fi + echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 + echo "${ECHO_T}$ac_cv_header_stdc" >&6 + if test $ac_cv_header_stdc = yes; then + + cat >>confdefs.h <<\_ACEOF + #define STDC_HEADERS 1 + _ACEOF + + fi + + # On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + + for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h + do + as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` + echo "$as_me:$LINENO: checking for $ac_header" >&5 + echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 + if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + $ac_includes_default + + #include <$ac_header> + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" + fi + rm -f conftest.$ac_objext conftest.$ac_ext + fi + echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 + echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF + #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 + _ACEOF + + fi + + done + + + if test "${ac_cv_header_pthread_h+set}" = set; then + echo "$as_me:$LINENO: checking for pthread.h" >&5 + echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6 + if test "${ac_cv_header_pthread_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + fi + echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 + echo "${ECHO_T}$ac_cv_header_pthread_h" >&6 + else + # Is the header compilable? + echo "$as_me:$LINENO: checking pthread.h usability" >&5 + echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + $ac_includes_default + #include <pthread.h> + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_compiler=no + fi + rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 + echo "${ECHO_T}$ac_header_compiler" >&6 + + # Is the header present? + echo "$as_me:$LINENO: checking pthread.h presence" >&5 + echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + #include <pthread.h> + _ACEOF + if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi + else + ac_cpp_err=yes + fi + if test -z "$ac_cpp_err"; then + ac_header_preproc=yes + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no + fi + rm -f conftest.err conftest.$ac_ext + echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 + echo "${ECHO_T}$ac_header_preproc" >&6 + + # So? What about this header? + case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5 + echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5 + echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5 + echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5 + echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5 + echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;};; + esac + echo "$as_me:$LINENO: checking for pthread.h" >&5 + echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6 + if test "${ac_cv_header_pthread_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_cv_header_pthread_h=$ac_header_preproc + fi + echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 + echo "${ECHO_T}$ac_cv_header_pthread_h" >&6 + + fi + if test $ac_cv_header_pthread_h = yes; then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_THREADS 1 + _ACEOF + + fi + + + if test ! -z "$HAVE_THREADS" + then + case $host_os in + # BSD/OS and NetBSD require no special libraries or flags + netbsd*|bsdi*) ;; + 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. + esac + fi + + + + # + # Assignments + # CPPFLAGS="$CPPFLAGS $INCLUDES" LDFLAGS="$LDFLAGS $LIBDIRS" *************** *** 6768,6970 **** ## Header files ## - echo "$as_me:$LINENO: checking for ANSI C header files" >&5 - echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 - if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF - #line $LINENO "configure" - #include "confdefs.h" - #include <stdlib.h> - #include <stdarg.h> - #include <string.h> - #include <float.h> - - _ACEOF - if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi - else - ac_cpp_err=yes - fi - if test -z "$ac_cpp_err"; then - ac_cv_header_stdc=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_header_stdc=no - fi - rm -f conftest.err conftest.$ac_ext - - if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF - #line $LINENO "configure" - #include "confdefs.h" - #include <string.h> - - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : - else - ac_cv_header_stdc=no - fi - rm -f conftest* - - fi - - if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF - #line $LINENO "configure" - #include "confdefs.h" - #include <stdlib.h> - - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : - else - ac_cv_header_stdc=no - fi - rm -f conftest* - - fi - - if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : - else - cat >conftest.$ac_ext <<_ACEOF - #line $LINENO "configure" - #include "confdefs.h" - #include <ctype.h> - #if ((' ' & 0x0FF) == 0x020) - # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') - # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) - #else - # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) - # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) - #endif - - #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) - int - main () - { - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); - } - _ACEOF - rm -f conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : - else - echo "$as_me: program exited with status $ac_status" >&5 - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ( exit $ac_status ) - ac_cv_header_stdc=no - fi - rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - fi - fi - echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 - echo "${ECHO_T}$ac_cv_header_stdc" >&6 - if test $ac_cv_header_stdc = yes; then - - cat >>confdefs.h <<\_ACEOF - #define STDC_HEADERS 1 - _ACEOF - - fi - - # On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - - for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h - do - as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` - echo "$as_me:$LINENO: checking for $ac_header" >&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF - #line $LINENO "configure" - #include "confdefs.h" - $ac_includes_default - - #include <$ac_header> - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - eval "$as_ac_Header=no" - fi - rm -f conftest.$ac_objext conftest.$ac_ext - fi - echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF - #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 - _ACEOF - - fi - - done - - --- 7100,7105 ---- *************** *** 17182,17187 **** --- 17317,17324 ---- s,@with_pam@,$with_pam,;t t s,@with_openssl@,$with_openssl,;t t s,@ELF_SYS@,$ELF_SYS,;t t + s,@THREAD_LIBS@,$THREAD_LIBS,;t t + s,@THREAD_CFLAGS@,$THREAD_CFLAGS,;t t s,@AWK@,$AWK,;t t s,@FLEX@,$FLEX,;t t s,@FLEXFLAGS@,$FLEXFLAGS,;t t Index: configure.in =================================================================== RCS file: /cvsroot/pgsql-server/configure.in,v retrieving revision 1.253 diff -c -c -r1.253 configure.in *** configure.in 22 May 2003 16:39:28 -0000 1.253 --- configure.in 27 May 2003 16:35:25 -0000 *************** *** 506,511 **** --- 506,514 ---- [ --without-zlib do not use Zlib]) + # + # Elf + # # Assume system is ELF if it predefines __ELF__ as 1, # otherwise believe host_os based default. *************** *** 527,533 **** --- 530,560 ---- fi]) 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*) ;; + 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. + esac + fi + AC_SUBST(THREAD_LIBS) + AC_SUBST(THREAD_CFLAGS) + + # + # Assignments + # CPPFLAGS="$CPPFLAGS $INCLUDES" LDFLAGS="$LDFLAGS $LIBDIRS" Index: src/Makefile.global.in =================================================================== RCS file: /cvsroot/pgsql-server/src/Makefile.global.in,v retrieving revision 1.162 diff -c -c -r1.162 Makefile.global.in *** src/Makefile.global.in 11 May 2003 20:50:53 -0000 1.162 --- src/Makefile.global.in 27 May 2003 16:35:29 -0000 *************** *** 152,157 **** --- 152,160 ---- TK_LIB_SPEC = @TK_LIB_SPEC@ TK_XINCLUDES = @TK_XINCLUDES@ + THREAD_CFLAGS = @THREAD_CFLAGS@ + THREAD_LIBS = @THREAD_LIBS@ + have_docbook = @have_docbook@ DOCBOOKSTYLE = @DOCBOOKSTYLE@ COLLATEINDEX = @COLLATEINDEX@ Index: src/include/pg_config.h.in =================================================================== RCS file: /cvsroot/pgsql-server/src/include/pg_config.h.in,v retrieving revision 1.47 diff -c -c -r1.47 pg_config.h.in *** src/include/pg_config.h.in 22 May 2003 16:39:30 -0000 1.47 --- src/include/pg_config.h.in 27 May 2003 16:35:30 -0000 *************** *** 465,470 **** --- 465,473 ---- /* Define to 1 if you have the <termios.h> header file. */ #undef HAVE_TERMIOS_H + /* Define to 1 if you have the threads interface. */ + #undef HAVE_THREADS + /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead. */ #undef HAVE_TM_ZONE
pgsql-interfaces by date: