1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Don't assume that struct option is available just because we can find a

getopt_long().  This is more or less the same problem as we saw earlier
with getaddrinfo() and struct addrinfo, and for the same reason: random
user-added libraries might contain the subroutine, but there's no
guarantee we will find the matching header files.
This commit is contained in:
Tom Lane
2003-08-07 21:11:58 +00:00
parent fea2ffa7d8
commit 33ab177a56
11 changed files with 200 additions and 44 deletions

View File

@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
dnl $Header: /cvsroot/pgsql/configure.in,v 1.277 2003/08/04 22:30:30 pgsql Exp $
dnl $Header: /cvsroot/pgsql/configure.in,v 1.278 2003/08/07 21:11:57 tgl Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
@@ -780,6 +780,11 @@ AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],
#include <sys/socket.h>
#include <sys/ucred.h>])
AC_CHECK_TYPES([struct option], [], [],
[#ifdef HAVE_GETOPT_H
include <getopt.h>
#endif])
if test "$with_zlib" = yes; then
# Check that <zlib.h> defines z_streamp (versions before about 1.0.4
# did not). While we could work around the lack of z_streamp, it
@@ -875,7 +880,7 @@ else
AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
fi
AC_REPLACE_FUNCS([crypt fseeko getopt getopt_long getrusage inet_aton random rint srandom strcasecmp strdup strerror strtol strtoul])
AC_REPLACE_FUNCS([crypt fseeko getopt getrusage inet_aton random rint srandom strcasecmp strdup strerror strtol strtoul])
# system's version of getaddrinfo(), if any, may be used only if we found
# a definition for struct addrinfo; see notes in src/include/getaddrinfo.h
@@ -885,6 +890,13 @@ else
AC_LIBOBJ(getaddrinfo)
fi
# similarly, use system's getopt_long() only if system provides struct option.
if test x"$ac_cv_type_struct_option" = xyes ; then
AC_REPLACE_FUNCS([getopt_long])
else
AC_LIBOBJ(getopt_long)
fi
# BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
# We override the previous test that said fseeko/ftello didn't exist
# OS tests are also done in include/c.h and port/fseeko.c