Commit e962a914fdee0e442c3a3da8650edf0c04f1dae4

Werner Lemberg 2014-03-01T21:00:02

Avoid `long long' warnings with older gcc compilers. Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>. * builds/unix/configure.raw: Don't use gcc's `-pedantic' flag for versions < 4.6. This is especially needed for Max OS X since this OS runs a gcc variant (or emulation) based on version 4.2.1.

diff --git a/ChangeLog b/ChangeLog
index f2b68a2..a6554f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2014-03-01  Werner Lemberg  <wl@gnu.org>
 
+	Avoid `long long' warnings with older gcc compilers.
+	Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>.
+
+	* builds/unix/configure.raw: Don't use gcc's `-pedantic' flag for
+	versions < 4.6.  This is especially needed for Max OS X since this
+	OS runs a gcc variant (or emulation) based on version 4.2.1.
+
+2014-03-01  Werner Lemberg  <wl@gnu.org>
+
 	* docs/INSTALL.CROSS: Revised and updated.
 
 2014-03-01  Werner Lemberg  <wl@gnu.org>
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index ca0048c..b13f671 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -216,6 +216,12 @@ AC_CHECK_FUNCS([memcpy memmove])
 #
 #   Due to bugs in mingwrt 4.0.3 we don't use `-ansi' for MinGW.
 #
+#   To avoid zillions of
+#
+#     ISO C90 does not support 'long long'
+#
+#   warnings, we disable `-pedantic' for gcc version < 4.6.
+#
 if test "x$GCC" = xyes; then
   XX_CFLAGS="-Wall"
   case "$host" in
@@ -223,8 +229,21 @@ if test "x$GCC" = xyes; then
     XX_ANSIFLAGS="-pedantic"
     ;;
   *)
+    GCC_VERSION=`$CC -dumpversion`
+    GCC_MAJOR=`echo "$GCC_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
+    GCC_MINOR=`echo "$GCC_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
+
+    XX_PEDANTIC=-pedantic
+    if test $GCC_MAJOR -lt 4; then
+      XX_PEDANTIC=
+    else
+      if test $GCC_MAJOR -eq 4 -a $GCC_MINOR -lt 6; then
+        XX_PEDANTIC=
+      fi
+    fi
+
     XX_ANSIFLAGS=""
-    for a in -pedantic -ansi
+    for a in $XX_PEDANTIC -ansi
     do
       AC_MSG_CHECKING([gcc compiler flag ${a} to assure ANSI C works correctly])
       orig_CFLAGS="${CFLAGS}"