diff --git a/NEWS b/NEWS index 394a7a78d..2adbdf099 100644 --- a/NEWS +++ b/NEWS @@ -47,6 +47,11 @@ every line in a file. * Changes to the distribution +* Build system changes + +** -Werror=array-bounds is now added to CFLAGS when available + This catches + * Bug fixes ** `basename` now checks the suffix against the base name, not the full path diff --git a/configure.ac b/configure.ac index f3a05ec70..eb2744b61 100644 --- a/configure.ac +++ b/configure.ac @@ -62,6 +62,14 @@ AC_PROG_INSTALL AC_PROG_CC gl_EARLY +AC_MSG_CHECKING([whether the compiler supports -Werror=array-bounds]) +old_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Werror=array-bounds" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo;], [])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + CFLAGS="$old_CFLAGS"]) + AC_MSG_CHECKING([whether the compiler supports -fexcess-precision=standard]) old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fexcess-precision=standard"