Fix strerror_r by checking return type from configure.
This commit is contained in:
parent
9136613803
commit
a63d2168e9
@ -1,5 +1,5 @@
|
|||||||
# Macros that test various C library quirks
|
# Macros that test various C library quirks
|
||||||
# $PostgreSQL: pgsql/config/c-library.m4,v 1.25 2004/03/20 15:39:27 momjian Exp $
|
# $PostgreSQL: pgsql/config/c-library.m4,v 1.26 2004/06/07 22:39:44 momjian Exp $
|
||||||
|
|
||||||
|
|
||||||
# PGAC_VAR_INT_TIMEZONE
|
# PGAC_VAR_INT_TIMEZONE
|
||||||
@ -96,6 +96,23 @@ fi
|
|||||||
])# PGAC_FUNC_GETPWUID_R_5ARG
|
])# PGAC_FUNC_GETPWUID_R_5ARG
|
||||||
|
|
||||||
|
|
||||||
|
# PGAC_FUNC_STRERROR_R_INT
|
||||||
|
# ---------------------------
|
||||||
|
# Check if strerror_r() returns an int (SUSv3) rather than a char * (GNU libc)
|
||||||
|
# If so, define STRERROR_R_INT
|
||||||
|
AC_DEFUN([PGAC_FUNC_STRERROR_R_INT],
|
||||||
|
[AC_CACHE_CHECK(whether strerror_r returns int,
|
||||||
|
pgac_func_strerror_r_int,
|
||||||
|
[AC_TRY_COMPILE([#include <string.h>],
|
||||||
|
[int strerror_r(int, char *, size_t);],
|
||||||
|
[pgac_func_strerror_r_int=yes],
|
||||||
|
[pgac_func_strerror_r_int=no])])
|
||||||
|
if test x"$pgac_func_strerror_r_int" = xyes ; then
|
||||||
|
AC_DEFINE(STRERROR_R_INT,, [Define to 1 if strerror_r() returns a int.])
|
||||||
|
fi
|
||||||
|
])# PGAC_FUNC_STRERROR_R_INT
|
||||||
|
|
||||||
|
|
||||||
# PGAC_UNION_SEMUN
|
# PGAC_UNION_SEMUN
|
||||||
# ----------------
|
# ----------------
|
||||||
# Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
|
# Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
|
||||||
|
53
configure
vendored
53
configure
vendored
@ -13759,6 +13759,59 @@ _ACEOF
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$as_me:$LINENO: checking whether strerror_r returns int" >&5
|
||||||
|
echo $ECHO_N "checking whether strerror_r returns int... $ECHO_C" >&6
|
||||||
|
if test "${pgac_func_strerror_r_int+set}" = set; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
else
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
#line $LINENO "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef F77_DUMMY_MAIN
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
# endif
|
||||||
|
int F77_DUMMY_MAIN() { return 1; }
|
||||||
|
#endif
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
int strerror_r(int, char *, size_t);
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_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
|
||||||
|
pgac_func_strerror_r_int=yes
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
pgac_func_strerror_r_int=no
|
||||||
|
fi
|
||||||
|
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
echo "$as_me:$LINENO: result: $pgac_func_strerror_r_int" >&5
|
||||||
|
echo "${ECHO_T}$pgac_func_strerror_r_int" >&6
|
||||||
|
if test x"$pgac_func_strerror_r_int" = xyes ; then
|
||||||
|
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define STRERROR_R_INT
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
# do not use values from template file
|
# do not use values from template file
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl $PostgreSQL: pgsql/configure.in,v 1.360 2004/05/28 20:52:42 momjian Exp $
|
dnl $PostgreSQL: pgsql/configure.in,v 1.361 2004/06/07 22:39:43 momjian Exp $
|
||||||
dnl
|
dnl
|
||||||
dnl Developers, please strive to achieve this order:
|
dnl Developers, please strive to achieve this order:
|
||||||
dnl
|
dnl
|
||||||
@ -993,6 +993,7 @@ CFLAGS="$_CFLAGS"
|
|||||||
LIBS="$_LIBS"
|
LIBS="$_LIBS"
|
||||||
|
|
||||||
PGAC_FUNC_GETPWUID_R_5ARG
|
PGAC_FUNC_GETPWUID_R_5ARG
|
||||||
|
PGAC_FUNC_STRERROR_R_INT
|
||||||
|
|
||||||
else
|
else
|
||||||
# do not use values from template file
|
# do not use values from template file
|
||||||
|
@ -607,6 +607,9 @@
|
|||||||
/* Define to 1 if you have the ANSI C header files. */
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
#undef STDC_HEADERS
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
|
/* Define to 1 if strerror_r() returns a int. */
|
||||||
|
#undef STRERROR_R_INT
|
||||||
|
|
||||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||||
#undef TM_IN_SYS_TIME
|
#undef TM_IN_SYS_TIME
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/port/thread.c,v 1.20 2004/04/23 18:15:55 momjian Exp $
|
* $PostgreSQL: pgsql/src/port/thread.c,v 1.21 2004/06/07 22:39:45 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -70,12 +70,17 @@ pqStrerror(int errnum, char *strerrbuf, size_t buflen)
|
|||||||
{
|
{
|
||||||
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(HAVE_STRERROR_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(HAVE_STRERROR_R)
|
||||||
/* reentrant strerror_r is available */
|
/* reentrant strerror_r is available */
|
||||||
/* some early standards had strerror_r returning char * */
|
#ifdef STRERROR_R_INT
|
||||||
strerror_r(errnum, strerrbuf, buflen);
|
/* SUSv3 version */
|
||||||
|
if (strerror_r(errnum, strerrbuf, buflen) == 0)
|
||||||
return strerrbuf;
|
return strerrbuf;
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
|
/* GNU libc */
|
||||||
|
return strerror_r(errnum, strerrbuf, buflen);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* no strerror_r() available, just use strerror */
|
/* no strerror_r() available, just use strerror */
|
||||||
StrNCpy(strerrbuf, strerror(errnum), buflen);
|
StrNCpy(strerrbuf, strerror(errnum), buflen);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user