mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
Make an attempt at fixing our current Solaris 11 breakage: add a configure
probe for opterr (exactly like the one for optreset) and have getopt.c define the variables only if configure doesn't find them in libc.
This commit is contained in:
parent
090173a3f9
commit
1d26226d95
59
configure
vendored
59
configure
vendored
@ -18655,6 +18655,65 @@ fi
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
{ echo "$as_me:$LINENO: checking for opterr" >&5
|
||||||
|
echo $ECHO_N "checking for opterr... $ECHO_C" >&6; }
|
||||||
|
if test "${pgac_cv_var_int_opterr+set}" = set; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
else
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <unistd.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
extern int opterr; opterr = 1;
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||||
|
if { (ac_try="$ac_link"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||||
|
(eval "$ac_link") 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } && {
|
||||||
|
test -z "$ac_c_werror_flag" ||
|
||||||
|
test ! -s conftest.err
|
||||||
|
} && test -s conftest$ac_exeext &&
|
||||||
|
$as_test_x conftest$ac_exeext; then
|
||||||
|
pgac_cv_var_int_opterr=yes
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
pgac_cv_var_int_opterr=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
{ echo "$as_me:$LINENO: result: $pgac_cv_var_int_opterr" >&5
|
||||||
|
echo "${ECHO_T}$pgac_cv_var_int_opterr" >&6; }
|
||||||
|
if test x"$pgac_cv_var_int_opterr" = x"yes"; then
|
||||||
|
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define HAVE_INT_OPTERR 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
{ echo "$as_me:$LINENO: checking for optreset" >&5
|
{ echo "$as_me:$LINENO: checking for optreset" >&5
|
||||||
echo $ECHO_N "checking for optreset... $ECHO_C" >&6; }
|
echo $ECHO_N "checking for optreset... $ECHO_C" >&6; }
|
||||||
if test "${pgac_cv_var_int_optreset+set}" = set; then
|
if test "${pgac_cv_var_int_optreset+set}" = set; then
|
||||||
|
11
configure.in
11
configure.in
@ -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.592 2009/03/27 19:58:11 tgl Exp $
|
dnl $PostgreSQL: pgsql/configure.in,v 1.593 2009/04/04 21:55:50 tgl Exp $
|
||||||
dnl
|
dnl
|
||||||
dnl Developers, please strive to achieve this order:
|
dnl Developers, please strive to achieve this order:
|
||||||
dnl
|
dnl
|
||||||
@ -1317,6 +1317,15 @@ AC_CHECK_FUNC(syslog,
|
|||||||
[AC_CHECK_HEADER(syslog.h,
|
[AC_CHECK_HEADER(syslog.h,
|
||||||
[AC_DEFINE(HAVE_SYSLOG, 1, [Define to 1 if you have the syslog interface.])])])
|
[AC_DEFINE(HAVE_SYSLOG, 1, [Define to 1 if you have the syslog interface.])])])
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for opterr], pgac_cv_var_int_opterr,
|
||||||
|
[AC_TRY_LINK([#include <unistd.h>],
|
||||||
|
[extern int opterr; opterr = 1;],
|
||||||
|
[pgac_cv_var_int_opterr=yes],
|
||||||
|
[pgac_cv_var_int_opterr=no])])
|
||||||
|
if test x"$pgac_cv_var_int_opterr" = x"yes"; then
|
||||||
|
AC_DEFINE(HAVE_INT_OPTERR, 1, [Define to 1 if you have the global variable 'int opterr'.])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
|
AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
|
||||||
[AC_TRY_LINK([#include <unistd.h>],
|
[AC_TRY_LINK([#include <unistd.h>],
|
||||||
[extern int optreset; optreset = 1;],
|
[extern int optreset; optreset = 1;],
|
||||||
|
@ -221,6 +221,9 @@
|
|||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#undef HAVE_INTTYPES_H
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the global variable 'int opterr'. */
|
||||||
|
#undef HAVE_INT_OPTERR
|
||||||
|
|
||||||
/* Define to 1 if you have the global variable 'int optreset'. */
|
/* Define to 1 if you have the global variable 'int optreset'. */
|
||||||
#undef HAVE_INT_OPTRESET
|
#undef HAVE_INT_OPTRESET
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/port/getopt.c,v 1.11 2007/03/26 21:44:11 momjian Exp $ */
|
/* $PostgreSQL: pgsql/src/port/getopt.c,v 1.12 2009/04/04 21:55:50 tgl Exp $ */
|
||||||
|
|
||||||
/* This is used by psql under Win32 */
|
/* This is used by psql under Win32 */
|
||||||
|
|
||||||
@ -37,12 +37,25 @@ static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
|
|||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On some versions of Solaris, opterr and friends are defined in core libc
|
||||||
|
* rather than in a separate getopt module. Define these variables only
|
||||||
|
* if configure found they aren't there by default. (We assume that testing
|
||||||
|
* opterr is sufficient for all of these except optreset.)
|
||||||
|
*/
|
||||||
|
#ifndef HAVE_INT_OPTERR
|
||||||
|
|
||||||
int opterr = 1, /* if error message should be printed */
|
int opterr = 1, /* if error message should be printed */
|
||||||
optind = 1, /* index into parent argv vector */
|
optind = 1, /* index into parent argv vector */
|
||||||
optopt, /* character checked for validity */
|
optopt; /* character checked for validity */
|
||||||
optreset; /* reset getopt */
|
|
||||||
char *optarg; /* argument associated with option */
|
char *optarg; /* argument associated with option */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_INT_OPTRESET
|
||||||
|
int optreset; /* reset getopt */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BADCH (int)'?'
|
#define BADCH (int)'?'
|
||||||
#define BADARG (int)':'
|
#define BADARG (int)':'
|
||||||
#define EMSG ""
|
#define EMSG ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user