getopt-hack

text/plain

Filename: getopt-hack
Type: text/plain
Part: 0
Message: Re: Complier warnings on mingw gcc 4.5.0
diff --git a/configure b/configure
index 08fd1c8..0cfcb9a 100755
--- a/configure
+++ b/configure
@@ -20758,6 +20758,11 @@ esac
 
 fi
 
+if test "$PORTNAME" = "win32" -a x"$pgac_cv_var_int_optreset" != x"yes"; then 
+  LIBOBJS="$LIBOBJS getopt.$ac_objext getopt_long.$ac_objext"
+fi
+
+
 # Cygwin's erand48() is broken (always returns zero) in some releases,
 # so force use of ours.
 if test "$PORTNAME" = "cygwin"; then
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 90854f4..c2f0436 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -313,9 +313,7 @@ extern char *optarg;
 extern int	optind,
 			opterr;
 
-#ifdef HAVE_INT_OPTRESET
 extern int	optreset;			/* might not be declared by system headers */
-#endif
 
 #ifdef USE_BONJOUR
 static DNSServiceRef bonjour_sdref = NULL;
@@ -751,9 +749,7 @@ PostmasterMain(int argc, char *argv[])
 	 * getopt(3) library so that it will work correctly in subprocesses.
 	 */
 	optind = 1;
-#ifdef HAVE_INT_OPTRESET
 	optreset = 1;				/* some systems need this too */
-#endif
 
 	/* For debugging: display postmaster environment */
 	{
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index ff2e9bd..da7db16 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -78,9 +78,7 @@
 extern char *optarg;
 extern int	optind;
 
-#ifdef HAVE_INT_OPTRESET
 extern int	optreset;			/* might not be declared by system headers */
-#endif
 
 
 /* ----------------
@@ -3442,9 +3440,7 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx)
 	 * or when this function is called a second time with another array.
 	 */
 	optind = 1;
-#ifdef HAVE_INT_OPTRESET
 	optreset = 1;				/* some systems need this too */
-#endif
 
 	return dbname;
 }