Commit c3f93719 authored by Peter Eisentraut's avatar Peter Eisentraut

Add configure check for sys_nerr, to end all discussions.

parent af26d6a4
# Macros that test various C library quirks # Macros that test various C library quirks
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.5 2000/11/03 18:43:51 petere Exp $ # $Header: /cvsroot/pgsql/config/c-library.m4,v 1.6 2001/01/09 18:40:13 petere Exp $
# PGAC_VAR_INT_TIMEZONE # PGAC_VAR_INT_TIMEZONE
...@@ -123,3 +123,18 @@ if test x"$pgac_cv_header_strings_both" = x"yes"; then ...@@ -123,3 +123,18 @@ if test x"$pgac_cv_header_strings_both" = x"yes"; then
AC_DEFINE([STRING_H_WITH_STRINGS_H], 1, AC_DEFINE([STRING_H_WITH_STRINGS_H], 1,
[Define if string.h and strings.h may both be included]) [Define if string.h and strings.h may both be included])
fi]) fi])
# PGAC_VAR_SYS_NERR
# -----------------
# Check if the global variable 'sys_nerr' exists. If so, define
# HAVE_SYS_NERR.
AC_DEFUN([PGAC_VAR_SYS_NERR],
[AC_CACHE_CHECK([for sys_nerr], pgac_cv_var_sys_nerr,
[AC_TRY_LINK([extern int sys_nerr;],
[int x = sys_nerr;],
[pgac_cv_var_sys_nerr=yes],
[pgac_cv_var_sys_nerr=no])])
if test x"$pgac_cv_var_sys_nerr" = xyes ; then
AC_DEFINE(HAVE_SYS_NERR,, [Set to 1 if you have the global variable sys_nerr])
fi])# PGAC_VAR_SYS_NERR
This diff is collapsed.
...@@ -945,6 +945,7 @@ if test x"$pgac_cv_var_int_optreset" = x"yes"; then ...@@ -945,6 +945,7 @@ if test x"$pgac_cv_var_int_optreset" = x"yes"; then
AC_DEFINE(HAVE_INT_OPTRESET, 1) AC_DEFINE(HAVE_INT_OPTRESET, 1)
fi fi
PGAC_VAR_SYS_NERR
dnl Check to see if we have a working 64-bit integer type. dnl Check to see if we have a working 64-bit integer type.
dnl This breaks down into two steps: dnl This breaks down into two steps:
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.74 2000/12/18 00:44:47 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.75 2001/01/09 18:40:14 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -44,11 +44,6 @@ ...@@ -44,11 +44,6 @@
extern int errno; extern int errno;
#ifdef __CYGWIN__
# define sys_nerr _sys_nerr
#endif
extern int sys_nerr;
extern CommandDest whereToSendOutput; extern CommandDest whereToSendOutput;
#ifdef ENABLE_SYSLOG #ifdef ENABLE_SYSLOG
...@@ -140,8 +135,7 @@ elog(int lev, const char *fmt, ...) ...@@ -140,8 +135,7 @@ elog(int lev, const char *fmt, ...)
if (lev <= DEBUG && Debugfile < 0) if (lev <= DEBUG && Debugfile < 0)
return; /* ignore debug msgs if noplace to send */ return; /* ignore debug msgs if noplace to send */
/* BeOS doesn't have sys_nerr and should be able to use strerror()... */ #ifdef HAVE_SYS_NERR
#ifndef __BEOS__
/* save errno string for %m */ /* save errno string for %m */
if (errno < sys_nerr && errno >= 0) if (errno < sys_nerr && errno >= 0)
errorstr = strerror(errno); errorstr = strerror(errno);
...@@ -152,7 +146,7 @@ elog(int lev, const char *fmt, ...) ...@@ -152,7 +146,7 @@ elog(int lev, const char *fmt, ...)
} }
#else #else
errorstr = strerror(errno); errorstr = strerror(errno);
#endif /* __BEOS__ */ #endif
if (lev == ERROR || lev == FATAL) if (lev == ERROR || lev == FATAL)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.32 2000/10/28 23:53:00 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.33 2001/01/09 18:40:14 petere Exp $
* *
* NOTE * NOTE
* XXX this code needs improvement--check for state violations and * XXX this code needs improvement--check for state violations and
...@@ -96,10 +96,6 @@ EnableExceptionHandling(bool on) ...@@ -96,10 +96,6 @@ EnableExceptionHandling(bool on)
extern int errno; extern int errno;
#ifdef __CYGWIN__
# define sys_nerr _sys_nerr
#endif
extern int sys_nerr;
static void static void
ExcPrint(Exception *excP, ExcPrint(Exception *excP,
...@@ -131,7 +127,7 @@ ExcPrint(Exception *excP, ...@@ -131,7 +127,7 @@ ExcPrint(Exception *excP,
fprintf(stderr, " (%ld)", detail); fprintf(stderr, " (%ld)", detail);
#ifndef __BEOS__ #ifdef HAVE_SYS_NERR
if (errno > 0 && errno < sys_nerr) if (errno > 0 && errno < sys_nerr)
#else #else
if (errno > 0) if (errno > 0)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: c.h,v 1.86 2001/01/09 16:07:14 momjian Exp $ * $Id: c.h,v 1.87 2001/01/09 18:40:15 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -993,6 +993,10 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args); ...@@ -993,6 +993,10 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
#include <regex/utils.h> #include <regex/utils.h>
#endif #endif
#ifdef HAVE_SYS_NERR
extern int sys_nerr;
#endif
/* ---------------- /* ----------------
* end of c.h * end of c.h
* ---------------- * ----------------
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* or in config.h afterwards. Of course, if you edit config.h, then your * or in config.h afterwards. Of course, if you edit config.h, then your
* changes will be overwritten the next time you run configure. * changes will be overwritten the next time you run configure.
* *
* $Id: config.h.in,v 1.154 2000/12/27 23:59:14 tgl Exp $ * $Id: config.h.in,v 1.155 2001/01/09 18:40:15 petere Exp $
*/ */
#ifndef CONFIG_H #ifndef CONFIG_H
...@@ -617,6 +617,9 @@ extern void srandom(unsigned int seed); ...@@ -617,6 +617,9 @@ extern void srandom(unsigned int seed);
/* Define if you have the optreset variable */ /* Define if you have the optreset variable */
#undef HAVE_INT_OPTRESET #undef HAVE_INT_OPTRESET
/* Define if you have the sys_nerr global variable */
#undef HAVE_SYS_NERR
/* Define if you have strtoll() */ /* Define if you have strtoll() */
#undef HAVE_STRTOLL #undef HAVE_STRTOLL
......
...@@ -7,9 +7,6 @@ typedef unsigned char slock_t; ...@@ -7,9 +7,6 @@ typedef unsigned char slock_t;
#define AF_UNIX 10 /* no domain sockets on BeOS */ #define AF_UNIX 10 /* no domain sockets on BeOS */
/* Beos doesn't have sysnerr but strerror should works on every error */
extern int sys_nerr;
/* Beos doesn't have all the required getrusage fields */ /* Beos doesn't have all the required getrusage fields */
#undef HAVE_GETRUSAGE #undef HAVE_GETRUSAGE
......
...@@ -9,6 +9,3 @@ typedef unsigned char slock_t; ...@@ -9,6 +9,3 @@ typedef unsigned char slock_t;
#define HAVE_INT_TIMEZONE /* has int _timezone */ #define HAVE_INT_TIMEZONE /* has int _timezone */
#include <cygwin/version.h> #include <cygwin/version.h>
#if (CYGWIN_VERSION_API_MAJOR >= 0) && (CYGWIN_VERSION_API_MINOR >= 8)
#define sys_nerr _sys_nerr
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment