summaryrefslogtreecommitdiff
path: root/distrib
diff options
context:
space:
mode:
authorCarter Tazio Schonwald <carter.schonwald@gmail.com>2014-07-02 08:52:53 -0500
committerAustin Seipp <austin@well-typed.com>2014-07-02 08:52:53 -0500
commit34f7e9a3c99850859901ca74370f55f1d4e2279a (patch)
treee2aa7573d85337837c911f0a815c60570ed945df /distrib
parent8afe616d52c652db249c4d00b24c82a35ca75068 (diff)
downloadhaskell-34f7e9a3c99850859901ca74370f55f1d4e2279a.tar.gz
Control CPP through settings file (#8683)
Summary: Allow the CPP program and flag choices for GHC be configured via the the ghc settings file Test Plan: ran validate yesterday Reviewers: hvr, austin, mzero, simonmar Reviewed By: austin, mzero, simonmar Subscribers: mzero, simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D26
Diffstat (limited to 'distrib')
-rw-r--r--distrib/configure.ac.in59
1 files changed, 59 insertions, 0 deletions
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index ed91244d88..c7a8ead9b0 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -63,6 +63,65 @@ FIND_GCC([WhatGccIsCalled], [gcc], [gcc])
CC="$WhatGccIsCalled"
export CC
+
+dnl ** what cpp to use?
+dnl --------------------------------------------------------------
+AC_ARG_WITH(hs-cpp,
+[AC_HELP_STRING([--with-hs-cpp=ARG],
+ [Use ARG as the path to cpp [default=autodetect]])],
+[
+ if test "$HostOS" = "mingw32"
+ then
+ AC_MSG_WARN([Request to use $withval will be ignored])
+ else
+ HaskellCPPCmd=$withval
+ fi
+],
+[
+ if test "$HostOS" != "mingw32"
+ then
+ HaskellCPPCmd=$WhatGccIsCalled
+ fi
+]
+)
+
+
+
+dnl ** what cpp flags to use?
+dnl -----------------------------------------------------------
+AC_ARG_WITH(hs-cpp-flags,
+ [AC_HELP_STRING([--with-hs-cpp-flags=ARG],
+ [Use ARG as the path to hs cpp [default=autodetect]])],
+ [
+ if test "$HostOS" = "mingw32"
+ then
+ AC_MSG_WARN([Request to use $withval will be ignored])
+ else
+ HaskellCPPArgs=$withval
+ fi
+ ],
+[
+ $HaskellCPPCmd -x c /dev/null -dM -E > conftest.txt 2>&1
+ if grep "__clang__" conftest.txt >/dev/null 2>&1; then
+ HaskellCPPArgs="-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs "
+ else
+ $HaskellCPPCmd -v > conftest.txt 2>&1
+ if grep "gcc" conftest.txt >/dev/null 2>&1; then
+ HaskellCPPArgs="-E -undef -traditional "
+ else
+ $HaskellCPPCmd --version > conftest.txt 2>&1
+ if grep "cpphs" conftest.txt >/dev/null 2>&1; then
+ HaskellCPPArgs="--cpp -traditional"
+ else
+ AC_MSG_WARN([configure can't recognize your CPP program, you may need to set --with-hs-cpp-flags=FLAGS explicitly])
+ HaskellCPPArgs=""
+ fi
+ fi
+ fi
+ ]
+)
+
+
dnl ** Which ld to use?
dnl --------------------------------------------------------------
FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld])