Add configure check to see whether <string.h> and <strings.h> may both be

included, and then include <strings.h> if so.  Several systems already
needed <strings.h> anyway.  Some new systems that claim to conform to the
Unix 9x "standard" do not declare str[n]casemp() in string.h, and C99
compilers will not like that.
This commit is contained in:
Peter Eisentraut 2000-11-03 18:43:52 +00:00
parent b98ba2a04c
commit dfda21e7a6
8 changed files with 265 additions and 193 deletions

View File

@ -1,5 +1,5 @@
# Macros that test various C library quirks
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.4 2000/10/02 03:58:31 momjian Exp $
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.5 2000/11/03 18:43:51 petere Exp $
# PGAC_VAR_INT_TIMEZONE
@ -96,3 +96,30 @@ if test x"$pgac_cv_func_posix_signals" = xyes ; then
fi
HAVE_POSIX_SIGNALS=$pgac_cv_func_posix_signals
AC_SUBST(HAVE_POSIX_SIGNALS)])# PGAC_FUNC_POSIX_SIGNALS
# PGAC_HEADER_STRING
# ------------------
# Tests whether <string.h> and <strings.h> can both be included
# (without generating warnings). This is mostly useful if you need
# str[n]casecmp(), since this is not in the "standard" <string.h>
# on some systems.
AC_DEFUN([PGAC_HEADER_STRING],
[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
[pgac_cv_header_strings_both],
[AC_TRY_CPP(
[#include <string.h>
#include <strings.h>
],
[AC_TRY_COMPILE(
[#include <string.h>
#include <strings.h>
],
[int n = strcasecmp("a", "b");],
[pgac_cv_header_strings_both=yes],
[pgac_cv_header_strings_both=no])],
[pgac_cv_header_strings_both=no])])
if test x"$pgac_cv_header_strings_both" = x"yes"; then
AC_DEFINE([STRING_H_WITH_STRINGS_H], 1,
[Define if string.h and strings.h may both be included])
fi])

399
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -694,6 +694,8 @@ AC_TRY_CPP([
], [AC_DEFINE(HAVE_NETINET_TCP_H) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
PGAC_HEADER_STRING
AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
AC_CHECK_HEADERS([readline/history.h history.h], [break])

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.84 2000/10/03 03:11:22 momjian Exp $
* $Id: c.h,v 1.85 2000/11/03 18:43:52 petere Exp $
*
*-------------------------------------------------------------------------
*/
@ -51,6 +51,9 @@
#include <string.h>
#include <stddef.h>
#include <stdarg.h>
#ifdef STRING_H_WITH_STRINGS_H
#include <strings.h>
#endif
#ifdef __CYGWIN__
#include <errno.h>

View File

@ -8,7 +8,7 @@
* or in config.h afterwards. Of course, if you edit config.h, then your
* changes will be overwritten the next time you run configure.
*
* $Id: config.h.in,v 1.145 2000/10/30 07:17:31 ishii Exp $
* $Id: config.h.in,v 1.146 2000/11/03 18:43:52 petere Exp $
*/
#ifndef CONFIG_H
@ -374,6 +374,9 @@
/* Set to 1 if you have <sys/pstat.h> */
#undef HAVE_SYS_PSTAT_H
/* Define if string.h and strings.h may both be included */
#undef STRING_H_WITH_STRINGS_H
/* Define if you have the setproctitle function. */
#undef HAVE_SETPROCTITLE

View File

@ -11,12 +11,6 @@
typedef unsigned char slock_t;
/***************************************************************
* The following include will get the needed prototype for the
* strcasecmp() function.
***************************************************************/
#include <strings.h>
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif

View File

@ -11,12 +11,6 @@ typedef unsigned char slock_t;
#define DISABLE_COMPLEX_MACRO
/***************************************************************
* strcasecmp() is in c89.a. The following include will get the
* needed prototype.
***************************************************************/
#include <strings.h>
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif

View File

@ -14,12 +14,6 @@ typedef unsigned char slock_t;
#define DISABLE_COMPLEX_MACRO
/***************************************************************
* The following include will get the needed prototype for the
* strcasecmp() function.
***************************************************************/
#include <strings.h>
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif