Re: Add thread.c and linkage - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Add thread.c and linkage
Date
Msg-id 200306141921.h5EJLKm02039@candle.pha.pa.us
Whole thread Raw
In response to Re: Add thread.c and linkage  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Done.

---------------------------------------------------------------------------

Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > do we make a new variable and set it to true only in the templates that
> > support it?
>
> That's what I'd suggest.
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

--
  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.272
diff -c -c -r1.272 configure
*** configure    14 Jun 2003 17:49:53 -0000    1.272
--- configure    14 Jun 2003 19:20:32 -0000
***************
*** 3903,3943 ****
  fi


! case $host_os in
!         netbsd*|bsdi*)
!             # these require no special flags or libraries
!             NEED_REENTRANT_FUNC_NAMES=no
!             ;;
!         freebsd2*|freebsd3*|freebsd4*)
!             THREAD_CFLAGS="-pthread"
!             NEED_REENTRANT_FUNC_NAMES=yes
!             ;;
!         freebsd*)
!             THREAD_LIBS="-lc_r"
!             NEED_REENTRANT_FUNC_NAMES=yes
!             ;;
!         linux*) THREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
!             THREAD_LIBS="-lpthread"
!             NEED_REENTRANT_FUNC_NAMES=yes
!             ;;
!         *)
!             # other operating systems might fail because they have pthread.h but need
!             # special libs we don't know about yet.
!             { { echo "$as_me:$LINENO: error:
  Cannot enable threads on your platform.
  Please report your platform threading info to the PostgreSQL mailing lists
! so it can be added to the next release.  Report any compile or link flags,
! or libraries required for threading support.
  " >&5
  echo "$as_me: error:
  Cannot enable threads on your platform.
  Please report your platform threading info to the PostgreSQL mailing lists
! so it can be added to the next release.  Report any compile or link flags,
! or libraries required for threading support.
  " >&2;}
     { (exit 1); exit 1; }; }
- esac
  fi



--- 3903,3926 ----
  fi


!
! if test "$SUPPORTS_THREADS" != yes; then
! { { echo "$as_me:$LINENO: error:
  Cannot enable threads on your platform.
  Please report your platform threading info to the PostgreSQL mailing lists
! so it can be added to the next release.  Report any compile flags, link flags,
! functions, or libraries required for threading support.
  " >&5
  echo "$as_me: error:
  Cannot enable threads on your platform.
  Please report your platform threading info to the PostgreSQL mailing lists
! so it can be added to the next release.  Report any compile flags, link flags,
! functions, or libraries required for threading support.
  " >&2;}
     { (exit 1); exit 1; }; }
  fi
+ fi
+



Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.263
diff -c -c -r1.263 configure.in
*** configure.in    14 Jun 2003 17:49:53 -0000    1.263
--- configure.in    14 Jun 2003 19:20:34 -0000
***************
*** 560,595 ****
  NEED_REENTRANT_FUNC_NAMES=no
  if test "$with_threads" = yes; then
  AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --with-threads])])
! case $host_os in
!         netbsd*|bsdi*)
!             # these require no special flags or libraries
!             NEED_REENTRANT_FUNC_NAMES=no
!             ;;
!         freebsd2*|freebsd3*|freebsd4*)
!             THREAD_CFLAGS="-pthread"
!             NEED_REENTRANT_FUNC_NAMES=yes
!             ;;
!         freebsd*)
!             THREAD_LIBS="-lc_r"
!             NEED_REENTRANT_FUNC_NAMES=yes
!             ;;
!         linux*) THREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
!             THREAD_LIBS="-lpthread"
!             NEED_REENTRANT_FUNC_NAMES=yes
!             ;;
!         *)
!             # other operating systems might fail because they have pthread.h but need
!             # special libs we don't know about yet.
!             AC_MSG_ERROR([
  Cannot enable threads on your platform.
  Please report your platform threading info to the PostgreSQL mailing lists
! so it can be added to the next release.  Report any compile or link flags,
! or libraries required for threading support.
  ])
! esac
  fi
  AC_SUBST(THREAD_CFLAGS)
  AC_SUBST(THREAD_LIBS)

  #
  # Assignments
--- 560,578 ----
  NEED_REENTRANT_FUNC_NAMES=no
  if test "$with_threads" = yes; then
  AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --with-threads])])
!
! if test "$SUPPORTS_THREADS" != yes; then
! AC_MSG_ERROR([
  Cannot enable threads on your platform.
  Please report your platform threading info to the PostgreSQL mailing lists
! so it can be added to the next release.  Report any compile flags, link flags,
! functions, or libraries required for threading support.
  ])
! fi
  fi
  AC_SUBST(THREAD_CFLAGS)
  AC_SUBST(THREAD_LIBS)
+

  #
  # Assignments
Index: src/template/bsdi
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/bsdi,v
retrieving revision 1.9
diff -c -c -r1.9 bsdi
*** src/template/bsdi    14 May 2001 21:45:53 -0000    1.9
--- src/template/bsdi    14 Jun 2003 19:20:37 -0000
***************
*** 9,11 ****
--- 9,15 ----
      CC=gcc2
      ;;
  esac
+
+ SUPPORTS_THREADS=yes
+ NEED_REENTRANT_FUNC_NAMES=no
+
Index: src/template/freebsd
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/freebsd,v
retrieving revision 1.17
diff -c -c -r1.17 freebsd
*** src/template/freebsd    4 Sep 2002 22:54:18 -0000    1.17
--- src/template/freebsd    14 Jun 2003 19:20:37 -0000
***************
*** 3,5 ****
--- 3,17 ----
  case $host_cpu in
    alpha*)   CFLAGS="$CFLAGS -O" ;;
  esac
+
+ SUPPORTS_THREADS=yes
+ case $host_os in
+         freebsd2*|freebsd3*|freebsd4*)
+             THREAD_CFLAGS="-pthread"
+             NEED_REENTRANT_FUNC_NAMES=yes
+             ;;
+         *)
+             THREAD_LIBS="-lc_r"
+             NEED_REENTRANT_FUNC_NAMES=yes
+             ;;
+ esac
Index: src/template/linux
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/linux,v
retrieving revision 1.10
diff -c -c -r1.10 linux
*** src/template/linux    21 Mar 2002 15:21:41 -0000    1.10
--- src/template/linux    14 Jun 2003 19:20:37 -0000
***************
*** 1 ****
--- 1,7 ----
  CFLAGS=-O2
+
+ SUPPORTS_THREADS=yes
+ THREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
+ THREAD_LIBS="-lpthread"
+ NEED_REENTRANT_FUNC_NAMES=yes
+
Index: src/template/netbsd
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/netbsd,v
retrieving revision 1.8
diff -c -c -r1.8 netbsd
*** src/template/netbsd    21 Oct 2000 22:36:14 -0000    1.8
--- src/template/netbsd    14 Jun 2003 19:20:37 -0000
***************
*** 1 ****
--- 1,5 ----
  CFLAGS='-O2 -pipe'
+
+ SUPPORTS_THREADS=yes
+ NEED_REENTRANT_FUNC_NAMES=no
+

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] PostgreSQL libraries - PThread Support, but
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] ECPG, threading and pooling