Thread: Thread-safe questions in configure

Thread-safe questions in configure

From
Peter Eisentraut
Date:
I have two questions about the support for thread-safe clients in
configure:

configure sets NEED_REENTRANT_FUNC_NAMES=no, overwriting the template
setting.  Why?

The check for reentrant functions says:

# Include special flags if threads are enabled _and_ if required for
# threading on this platform.  Some platforms have *_r functions but
# their natively named funcs are threadsafe, and should be used instead.

But the actual check does not check if "threads are enabled", only if it's
required on the platform (which doesn't work -- see above).

Is this some kind of transition state "to be fixed later"?

-- 
Peter Eisentraut   peter_e@gmx.net


Re: Thread-safe questions in configure

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> I have two questions about the support for thread-safe clients in
> configure:
>
> configure sets NEED_REENTRANT_FUNC_NAMES=no, overwriting the template
> setting.  Why?

Forgot to remove it when I moved the stuff to templates.

> The check for reentrant functions says:
>
> # Include special flags if threads are enabled _and_ if required for
> # threading on this platform.  Some platforms have *_r functions but
> # their natively named funcs are threadsafe, and should be used instead.
>
> But the actual check does not check if "threads are enabled", only if it's
> required on the platform (which doesn't work -- see above).
>
> Is this some kind of transition state "to be fixed later"?

The only transition state is in my head.  :-)

Patch attached and applied.

--
  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.276
diff -c -c -r1.276 configure
*** configure    23 Jun 2003 23:51:57 -0000    1.276
--- configure    22 Jul 2003 16:37:15 -0000
***************
*** 12807,12813 ****
  # For each platform, we need to know about any special compile and link
  # libraries, and whether the normal C function names are thread-safe.
  #
- NEED_REENTRANT_FUNC_NAMES=no
  if test "$with_threads" = yes; then
  if test "${ac_cv_header_pthread_h+set}" = set; then
    echo "$as_me:$LINENO: checking for pthread.h" >&5
--- 12807,12812 ----
***************
*** 12924,12936 ****
  { { 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; }; }
--- 12923,12935 ----
  { { 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 all 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 all compile flags, link flags,
  functions, or libraries required for threading support.
  " >&2;}
     { (exit 1); exit 1; }; }
***************
*** 12947,12956 ****
  # threading on this platform.  Some platforms have *_r functions but
  # their natively named funcs are threadsafe, and should be used instead.
  #
! # One trick here is that if the don't call AC_CHECK_FUNCS, the
  # functions are marked "not found", which is perfect.
  #
! if test "$NEED_REENTRANT_FUNC_NAMES" = yes ; then
  _CFLAGS="$CFLAGS"
  _LIB="$LIBS"
  CFLAGS="$CFLAGS $TREAD_CFLAGS"
--- 12946,12955 ----
  # threading on this platform.  Some platforms have *_r functions but
  # their natively named funcs are threadsafe, and should be used instead.
  #
! # One trick here is that if we don't call AC_CHECK_FUNCS, the
  # functions are marked "not found", which is perfect.
  #
! if test "$with_threads" = yes -a "$NEED_REENTRANT_FUNC_NAMES" = yes ; then
  _CFLAGS="$CFLAGS"
  _LIB="$LIBS"
  CFLAGS="$CFLAGS $TREAD_CFLAGS"
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.267
diff -c -c -r1.267 configure.in
*** configure.in    23 Jun 2003 23:51:59 -0000    1.267
--- configure.in    22 Jul 2003 16:37:16 -0000
***************
*** 965,971 ****
  # For each platform, we need to know about any special compile and link
  # libraries, and whether the normal C function names are thread-safe.
  #
- 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])])

--- 965,970 ----
***************
*** 973,979 ****
  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
--- 972,978 ----
  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 all compile flags, link flags,
  functions, or libraries required for threading support.
  ])
  fi
***************
*** 989,998 ****
  # threading on this platform.  Some platforms have *_r functions but
  # their natively named funcs are threadsafe, and should be used instead.
  #
! # One trick here is that if the don't call AC_CHECK_FUNCS, the
  # functions are marked "not found", which is perfect.
  #
! if test "$NEED_REENTRANT_FUNC_NAMES" = yes ; then
  _CFLAGS="$CFLAGS"
  _LIB="$LIBS"
  CFLAGS="$CFLAGS $TREAD_CFLAGS"
--- 988,997 ----
  # threading on this platform.  Some platforms have *_r functions but
  # their natively named funcs are threadsafe, and should be used instead.
  #
! # One trick here is that if we don't call AC_CHECK_FUNCS, the
  # functions are marked "not found", which is perfect.
  #
! if test "$with_threads" = yes -a "$NEED_REENTRANT_FUNC_NAMES" = yes ; then
  _CFLAGS="$CFLAGS"
  _LIB="$LIBS"
  CFLAGS="$CFLAGS $TREAD_CFLAGS"