From 98b10d21551df4d038e10287f9bb447922897342 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Tue, 30 Aug 2016 12:00:00 -0400
Subject: [PATCH 05/27] Add test for -Wmissing-prototypes

This was part of the hard-coded default warnings set in C, but the
option is not valid for C++ (since prototypes are always required).
---
 configure    | 38 +++++++++++++++++++++++++++++++++++++-
 configure.in |  4 +++-
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index d74b25f..7821c2f 100755
--- a/configure
+++ b/configure
@@ -4418,7 +4418,43 @@ fi
 # but has its own.  Also check other compiler-specific flags here.
 
 if test "$GCC" = yes -a "$ICC" = no; then
-  CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith"
+  CFLAGS="-Wall -Wpointer-arith"
+  # not valid for C++
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wmissing-prototypes" >&5
+$as_echo_n "checking whether $CC supports -Wmissing-prototypes... " >&6; }
+if ${pgac_cv_prog_cc_cflags__Wmissing_prototypes+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  pgac_save_CFLAGS=$CFLAGS
+CFLAGS="$pgac_save_CFLAGS -Wmissing-prototypes"
+ac_save_c_werror_flag=$ac_c_werror_flag
+ac_c_werror_flag=yes
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  pgac_cv_prog_cc_cflags__Wmissing_prototypes=yes
+else
+  pgac_cv_prog_cc_cflags__Wmissing_prototypes=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_c_werror_flag=$ac_save_c_werror_flag
+CFLAGS="$pgac_save_CFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wmissing_prototypes" >&5
+$as_echo "$pgac_cv_prog_cc_cflags__Wmissing_prototypes" >&6; }
+if test x"$pgac_cv_prog_cc_cflags__Wmissing_prototypes" = x"yes"; then
+  CFLAGS="$CFLAGS -Wmissing-prototypes"
+fi
+
   # These work in some but not all gcc versions
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wdeclaration-after-statement" >&5
 $as_echo_n "checking whether $CC supports -Wdeclaration-after-statement... " >&6; }
diff --git a/configure.in b/configure.in
index c878b4e..011e4c4 100644
--- a/configure.in
+++ b/configure.in
@@ -440,7 +440,9 @@ fi
 # but has its own.  Also check other compiler-specific flags here.
 
 if test "$GCC" = yes -a "$ICC" = no; then
-  CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith"
+  CFLAGS="-Wall -Wpointer-arith"
+  # not valid for C++
+  PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-prototypes])
   # These work in some but not all gcc versions
   PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
   PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
-- 
2.9.3