1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01: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:
Tom Lane
2009-04-04 21:55:50 +00:00
parent 090173a3f9
commit 1d26226d95
4 changed files with 88 additions and 4 deletions

View File

@ -221,6 +221,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#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'. */
#undef HAVE_INT_OPTRESET

View File

@ -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 */
@ -37,12 +37,25 @@ static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
#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 */
optind = 1, /* index into parent argv vector */
optopt, /* character checked for validity */
optreset; /* reset getopt */
optopt; /* character checked for validity */
char *optarg; /* argument associated with option */
#endif
#ifndef HAVE_INT_OPTRESET
int optreset; /* reset getopt */
#endif
#define BADCH (int)'?'
#define BADARG (int)':'
#define EMSG ""