diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-04-04 21:55:50 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-04-04 21:55:50 +0000 |
commit | 1d26226d9583ad7bee290ca9bba1aa3794e98a53 (patch) | |
tree | c9912aaa9ff6ea6dec0920cc4fc491bf2f1cc1cc /src | |
parent | 090173a3f937952b2a5c6d92a3ab139e79ca3033 (diff) | |
download | postgresql-1d26226d9583ad7bee290ca9bba1aa3794e98a53.tar.gz postgresql-1d26226d9583ad7bee290ca9bba1aa3794e98a53.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/include/pg_config.h.in | 3 | ||||
-rw-r--r-- | src/port/getopt.c | 19 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 3cc7c7ce6a8..34732278277 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -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 diff --git a/src/port/getopt.c b/src/port/getopt.c index 796a009dfa7..2cc2519116f 100644 --- a/src/port/getopt.c +++ b/src/port/getopt.c @@ -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 "" |