summaryrefslogtreecommitdiff
path: root/distrib
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2016-03-28 14:34:22 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2016-03-28 14:57:43 +0200
commitafc48f8939b99a1a72b43b3e342d56193ed1f34c (patch)
treea29656df4a3cf3250d1283f3c4668e126c06e83c /distrib
parentffc802e8f617d11de9ece7bed438725bde0300b8 (diff)
downloadhaskell-afc48f8939b99a1a72b43b3e342d56193ed1f34c.tar.gz
Autoconf: detect and set CFLAGS/CPPFLAGS needed for C99 mode
This is the first phase of addressing #11757 which aims to make C99 support a base-line requirement for GHC and clean up the code-base to use C99 facilities when sensible. This patch exploits the logic/heuristic used by `AC_PROG_CC_C99` to determine the flags needed in case the C compiler isn't able to compile C99 code in its current mode. We can't use `AC_PROG_CC_C99` directly though because GHC's build-system expects CC to contain a filename without any flags, while `AC_PROG_CC_C99` would e.g. result in `CC="gcc -std=gnu99"`. Morever, we support different `CC`s for stage0/1/2, so we need a version of `AC_PROG_CC_C99` for which we can specify the `CC`/`CFLAGS` variables to operate on. This is what `FP_SET_CFLAGS_C99` does. Note that Clang has been defaulting to C99+ for a long time, while GCC 5 defaults to C99+ as well. So this has mostly an affect on older GCCs versions prior to 5.0 and possibly compilers other than GCC/Clang (which are not officially supported for building GHC anyway). Reviewers: kgardas, erikd, bgamari, austin Reviewed By: erikd Differential Revision: https://phabricator.haskell.org/D2045
Diffstat (limited to 'distrib')
-rw-r--r--distrib/configure.ac.in5
1 files changed, 5 insertions, 0 deletions
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index 99b51f536b..1df58d508b 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -109,6 +109,11 @@ dnl ** Check gcc version and flags we need to pass it **
#
FP_GCC_EXTRA_FLAGS
+FP_SET_CFLAGS_C99([CC],[CFLAGS],[CPPFLAGS])
+dnl FP_SET_CFLAGS_C99([CC_STAGE0],[CONF_CC_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
+FP_SET_CFLAGS_C99([CC],[CONF_CC_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
+FP_SET_CFLAGS_C99([CC],[CONF_CC_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
+
FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])