[configure] fix Savannah bug #35644. * builds/unix/configure.raw: Check `-ansi' flag works even if gcc is used. Bionic libc headers for Android lose the consistency when they are parsed with __STDC_VERSION__ older than 199901L or __STRICT_ANSI__.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
diff --git a/ChangeLog b/ChangeLog
index 3cfb2f8..0e2996b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-03-20 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
+ [configure] fix Savannah bug #35644.
+
+ * builds/unix/configure.raw: Check `-ansi' flag works even if gcc
+ is used. Bionic libc headers for Android lose the consistency
+ when they are parsed with __STDC_VERSION__ older than 199901L or
+ __STRICT_ANSI__.
+
2012-03-20 Werner Lemberg <wl@gnu.org>
[bdf] Improvement to Savannah bug #35656.
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 111dbab..0d19240 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -67,28 +67,6 @@ AC_SUBST(EXEEXT_BUILD)
-# get compiler flags right
-
-if test "x$GCC" = xyes; then
- XX_CFLAGS="-Wall"
- XX_ANSIFLAGS="-pedantic -ansi"
-else
- case "$host" in
- *-dec-osf*)
- CFLAGS=
- XX_CFLAGS="-std1 -g3"
- XX_ANSIFLAGS=
- ;;
- *)
- XX_CFLAGS=
- XX_ANSIFLAGS=
- ;;
- esac
-fi
-AC_SUBST([XX_CFLAGS])
-AC_SUBST([XX_ANSIFLAGS])
-
-
# auxiliary programs
AC_CHECK_PROG([RMF], [rm], [rm -f])
@@ -222,6 +200,48 @@ AC_SUBST([FTSYS_SRC])
AC_CHECK_FUNCS([memcpy memmove])
+# get compiler flags right
+# we try to make the compiler work for C89-strict source.
+# even if C compiler is GCC and C89 flags are available,
+# some system headers (e.g. Android Bionic libc) is broken
+# in C89 mode. we have to check the compilation finishes
+# successfully.
+#
+if test "x$GCC" = xyes; then
+ XX_CFLAGS="-Wall"
+ XX_ANSIFLAGS=""
+ for a in -pedantic -ansi
+ do
+ AC_MSG_CHECKING([gcc compiler flag ${a} to assure ANSI C works correctly])
+ orig_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} ${XX_ANSIFLAGS} ${a}"
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([#include <stdio.h>],[{puts("");return 0;}])
+ ],[
+ AC_MSG_RESULT([ok, add it to XX_ANSIFLAGS])
+ XX_ANSIFLAGS="${XX_ANSIFLAGS} ${a}"
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+ CFLAGS="${orig_CFLAGS}"
+ done
+else
+ case "$host" in
+ *-dec-osf*)
+ CFLAGS=
+ XX_CFLAGS="-std1 -g3"
+ XX_ANSIFLAGS=
+ ;;
+ *)
+ XX_CFLAGS=
+ XX_ANSIFLAGS=
+ ;;
+ esac
+fi
+AC_SUBST([XX_CFLAGS])
+AC_SUBST([XX_ANSIFLAGS])
+
+
# check for system zlib
# don't quote AS_HELP_STRING!