Index: config/acx_pthread.m4
===================================================================
RCS file: /cvsroot/pgsql-server/config/acx_pthread.m4,v
retrieving revision 1.2
retrieving revision 1.4
diff -c -c -r1.2 -r1.4
*** config/acx_pthread.m4	26 Apr 2004 04:04:42 -0000	1.2
--- config/acx_pthread.m4	12 Aug 2004 16:39:50 -0000	1.4
***************
*** 89,114 ****
  
                  -*)
                  AC_MSG_CHECKING([whether pthreads work with $flag])
!                 PTHREAD_CFLAGS="$flag"
                  ;;
  
! 		pthread-config)
! 		AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
! 		if test x"$acx_pthread_config" = xno; then continue; fi
! 		PTHREAD_CFLAGS="`pthread-config --cflags`"
! 		PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
! 		;;
  
                  *)
                  AC_MSG_CHECKING([for the pthreads library -l$flag])
!                 PTHREAD_LIBS="-l$flag"
                  ;;
          esac
  
          save_LIBS="$LIBS"
          save_CFLAGS="$CFLAGS"
!         LIBS="$PTHREAD_LIBS $LIBS"
!         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  
          # Check for various functions.  We must include pthread.h,
          # since some functions may be macros.  (On the Sequent, we
--- 89,117 ----
  
                  -*)
                  AC_MSG_CHECKING([whether pthreads work with $flag])
!                 tryPTHREAD_CFLAGS="$flag"
                  ;;
  
!                 pthread-config)
!                 # skip this if we already have flags defined, for PostgreSQL
!                 if test x"$PTHREAD_CFLAGS" != x -o x"$PTHREAD_LIBS" != x; then continue; fi
!                 AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
!                 if test x"$acx_pthread_config" = xno; then continue; fi
!                 tryPTHREAD_CFLAGS="`pthread-config --cflags`"
!                 tryPTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
!                 fi
!                 ;;
  
                  *)
                  AC_MSG_CHECKING([for the pthreads library -l$flag])
!                 tryPTHREAD_LIBS="-l$flag"
                  ;;
          esac
  
          save_LIBS="$LIBS"
          save_CFLAGS="$CFLAGS"
!         LIBS="$tryPTHREAD_LIBS $PTHREAD_LIBS $LIBS"
!         CFLAGS="$CFLAGS $PTHREAD_CFLAGS $tryPTHREAD_CFLAGS"
  
          # Check for various functions.  We must include pthread.h,
          # since some functions may be macros.  (On the Sequent, we
***************
*** 130,140 ****
  
          AC_MSG_RESULT($acx_pthread_ok)
          if test "x$acx_pthread_ok" = xyes; then
!                 break;
          fi
  
-         PTHREAD_LIBS=""
-         PTHREAD_CFLAGS=""
  done
  fi
  
--- 133,145 ----
  
          AC_MSG_RESULT($acx_pthread_ok)
          if test "x$acx_pthread_ok" = xyes; then
!             # we continue with more flags because Linux needs -lpthread
!             # for libpq builds on PostgreSQL.  The test above only
!             # tests for building binaries, not shared libraries.
!             PTHREAD_LIBS=" $tryPTHREAD_LIBS $PTHREAD_LIBS"
!             PTHREAD_CFLAGS="$PTHREAD_CFLAGS $tryPTHREAD_CFLAGS"
          fi
  
  done
  fi
  
***************
*** 168,178 ****
  
          AC_MSG_CHECKING([if more special flags are required for pthreads])
          flag=no
! # 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"
--- 173,183 ----
  
          AC_MSG_CHECKING([if more special flags are required for pthreads])
          flag=no
! # We always add these in PostgreSQL
! #       case "${host_cpu}-${host_os}" in
! #               *-aix* | *-freebsd* | *-darwin*) 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"
