diff --git a/config/acx_pthread.m4 b/config/acx_pthread.m4
index 27079def74b8dd02c2bb611e221de984b1e92b96..11c62b3f77316c592f10ceb0b5028fbbbda0b9ec 100644
--- a/config/acx_pthread.m4
+++ b/config/acx_pthread.m4
@@ -1,3 +1,6 @@
+dnl PGSGL:  When updating, comment out port-specific part below;
+dnl see the comment below with the word "PostgreSQL".
+dnl
 dnl Available from the GNU Autoconf Macro Archive at:
 dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
 dnl
@@ -165,10 +168,11 @@ if test "x$acx_pthread_ok" = xyes; then
 
         AC_MSG_CHECKING([if more special flags are required for pthreads])
         flag=no
-        case "${host_cpu}-${host_os}" in
-                *-aix* | *-freebsd*)     flag="-D_THREAD_SAFE";;
-                *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
-        esac
+# We handle this ourselves in PostgreSQL
+#        case "${host_cpu}-${host_os}" in
+#                *-aix* | *-freebsd*)     flag="-D_THREAD_SAFE";;
+#                *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+#        esac
         AC_MSG_RESULT(${flag})
         if test "x$flag" != xno; then
                 PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
diff --git a/configure b/configure
index 2026f68104a9185293bb13012b8f6d060883997b..4f6927491ad9979c44d48318fe122dbae141825e 100755
--- a/configure
+++ b/configure
@@ -13387,10 +13387,11 @@ echo "$as_me: WARNING: we do not know how to create joinable pthreads" >&2;}
         echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
 echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6
         flag=no
-        case "${host_cpu}-${host_os}" in
-                *-aix* | *-freebsd*)     flag="-D_THREAD_SAFE";;
-                *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
-        esac
+# We handle this ourselves in PostgreSQL
+#        case "${host_cpu}-${host_os}" in
+#                *-aix* | *-freebsd*)     flag="-D_THREAD_SAFE";;
+#                *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+#        esac
         echo "$as_me:$LINENO: result: ${flag}" >&5
 echo "${ECHO_T}${flag}" >&6
         if test "x$flag" != xno; then
@@ -13465,6 +13466,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 	# set thread flags
 
+# Some platforms use these, so just defineed them.  They can't hurt if they
+# are not supported.
+PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
+
+
 # At this point, we don't want to muck with the compiler name for threading.
 # Let's see who fails, perhaps AIX.  2004-04-23
 if test "$PTHREAD_CC" != "$CC"; then
diff --git a/configure.in b/configure.in
index dd4e410662519930733383be0b0638aefd5d09f7..fd7fc371a5223b7902344548689dd7bd41b2bc1d 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.333 2004/04/26 00:44:39 momjian Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.334 2004/04/26 04:04:42 momjian Exp $
 dnl
 dnl Developers, please strive to achieve this order:
 dnl
@@ -959,6 +959,11 @@ AC_FUNC_FSEEKO
 if test "$enable_thread_safety" = yes; then
 ACX_PTHREAD	# set thread flags
 
+# Some platforms use these, so just defineed them.  They can't hurt if they
+# are not supported.
+PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
+
+
 # At this point, we don't want to muck with the compiler name for threading.
 # Let's see who fails, perhaps AIX.  2004-04-23
 if test "$PTHREAD_CC" != "$CC"; then
diff --git a/src/template/darwin b/src/template/darwin
index bffb0d4ea039bf34b583f395f97122c7e61a7489..baf462baf629e77860bbd068214fee4b5557856e 100644
--- a/src/template/darwin
+++ b/src/template/darwin
@@ -4,6 +4,3 @@ CC="$CC -no-cpp-precomp"
 
 # Select appropriate semaphore support
 USE_NAMED_POSIX_SEMAPHORES=1
-
-# verified Mac OS X 10.3.3, Darwin Kernel Version 7.3.0, 2004-04-07
-PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
diff --git a/src/template/freebsd b/src/template/freebsd
index f4a16103189b27be4daddbabe8719c489cdf1ca3..718359e07c66d9f450745d9fb505ed4544c8f90e 100644
--- a/src/template/freebsd
+++ b/src/template/freebsd
@@ -1,8 +1,3 @@
 case $host_cpu in
   alpha*)   CFLAGS="-O";;  # alpha has problems with -O2
 esac
-
-case $host_os in
-	freebsd2*|freebsd3*|freebsd4*) ;;
-	*) PTHREAD_LIBS="c_r";;	 # do we need this?  2004-04-23
-esac
diff --git a/src/template/linux b/src/template/linux
index 95c1b182fe511928e981735813dd6f82a7828ed9..dfb391ea54279f8476b82cf907a7f19d845fc0d6 100644
--- a/src/template/linux
+++ b/src/template/linux
@@ -1,5 +1,2 @@
 # Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
 CPPFLAGS="-D_GNU_SOURCE"
-
-# tools/thread/thread_test must be run
-PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
diff --git a/src/template/solaris b/src/template/solaris
index d6d9fbc794adda6c406bdc03063648ef76d5d43d..f2e7aaa0470a530fd9571bb51ebcb6d00a379cca 100644
--- a/src/template/solaris
+++ b/src/template/solaris
@@ -10,4 +10,3 @@ case $host in
 esac
 
 # -D_POSIX_PTHREAD_SEMANTICS enables 5-arg getpwuid_r, among other things
-PTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
diff --git a/src/template/unixware b/src/template/unixware
index e7e63f65daa1a40e3560299bffb3d87ed92279ab..9dd9d88a6ed5647349054266383193be34d94b22 100644
--- a/src/template/unixware
+++ b/src/template/unixware
@@ -24,8 +24,5 @@ __EOF__
   PTHREAD_CFLAGS="-Kpthread"
 fi
 
-# tools/thread/thread_test must be run
-PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT"
-
 # Disabled because flags are required for all apps using libpq.
 # Waiting to see if other platforms need this too.  2004-03-22