diff --git a/configure b/configure --- a/configure +++ b/configure @@ -790,6 +790,7 @@ enable_shared enable_profiling with_pydebug +with_stdc89 with_libs with_system_expat with_system_ffi @@ -1461,6 +1462,7 @@ compiler --with-suffix=.exe set executable suffix --with-pydebug build with Py_DEBUG defined + --with-stdc89 enforce C89 compatible compiler --with-libs='lib1 ...' link against additional libs --with-system-expat build pyexpat module using an installed expat library @@ -6195,6 +6197,29 @@ fi +# Check for --with-stdc89 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-stdc89" >&5 +$as_echo_n "checking for --with-stdc89... " >&6; } + +# Check whether --with-stdc89 was given. +if test "${with_stdc89+set}" = set; then : + withval=$with_stdc89; +if test "$withval" != no +then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; + with_stdc89='true' +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; + with_stdc89='false' +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be # merged with this chunk of code? @@ -6334,6 +6359,11 @@ BASECFLAGS="$BASECFLAGS -fno-strict-aliasing" fi + # --with-stdc89 option + if test "$with_stdc89" = 'true' ; then + BASECFLAGS="-std=c89 $BASECFLAGS" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn off $CC unused result warning" >&5 $as_echo_n "checking if we can turn off $CC unused result warning... " >&6; } ac_save_cc="$CC" diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1058,6 +1058,21 @@ fi], [AC_MSG_RESULT(no)]) +# Check for --with-stdc89 +AC_MSG_CHECKING(for --with-stdc89) +AC_ARG_WITH(stdc89, + AC_HELP_STRING(--with-stdc89, enforce C89 compatible compiler), +[ +if test "$withval" != no +then + AC_MSG_RESULT(yes); + with_stdc89='true' +else + AC_MSG_RESULT(no); + with_stdc89='false' +fi], +[AC_MSG_RESULT(no)]) + # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be # merged with this chunk of code? @@ -1162,6 +1177,11 @@ BASECFLAGS="$BASECFLAGS -fno-strict-aliasing" fi + # --with-stdc89 option + if test "$with_stdc89" = 'true' ; then + BASECFLAGS="-std=c89 $BASECFLAGS" + fi + AC_MSG_CHECKING(if we can turn off $CC unused result warning) ac_save_cc="$CC" CC="$CC -Wunused-result -Werror"