Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit dfda21e

Browse files
committed
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.
1 parent b98ba2a commit dfda21e

File tree

8 files changed

+265
-193
lines changed

8 files changed

+265
-193
lines changed

config/c-library.m4

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Macros that test various C library quirks
2-
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.4 2000/10/02 03:58:31 momjian Exp $
2+
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.5 2000/11/03 18:43:51 petere Exp $
33

44

55
# PGAC_VAR_INT_TIMEZONE
@@ -96,3 +96,30 @@ if test x"$pgac_cv_func_posix_signals" = xyes ; then
9696
fi
9797
HAVE_POSIX_SIGNALS=$pgac_cv_func_posix_signals
9898
AC_SUBST(HAVE_POSIX_SIGNALS)])# PGAC_FUNC_POSIX_SIGNALS
99+
100+
101+
# PGAC_HEADER_STRING
102+
# ------------------
103+
# Tests whether <string.h> and <strings.h> can both be included
104+
# (without generating warnings). This is mostly useful if you need
105+
# str[n]casecmp(), since this is not in the "standard" <string.h>
106+
# on some systems.
107+
AC_DEFUN([PGAC_HEADER_STRING],
108+
[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
109+
[pgac_cv_header_strings_both],
110+
[AC_TRY_CPP(
111+
[#include <string.h>
112+
#include <strings.h>
113+
],
114+
[AC_TRY_COMPILE(
115+
[#include <string.h>
116+
#include <strings.h>
117+
],
118+
[int n = strcasecmp("a", "b");],
119+
[pgac_cv_header_strings_both=yes],
120+
[pgac_cv_header_strings_both=no])],
121+
[pgac_cv_header_strings_both=no])])
122+
if test x"$pgac_cv_header_strings_both" = x"yes"; then
123+
AC_DEFINE([STRING_H_WITH_STRINGS_H], 1,
124+
[Define if string.h and strings.h may both be included])
125+
fi])

0 commit comments

Comments
 (0)