summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2019-10-07 23:06:26 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-10-12 06:32:18 -0400
commitc2290596f10ce732be85503d3ef0f0b50b7e925a (patch)
tree7206d141fd205c0c6fe6a0d54eb30f1171b23f06 /aclocal.m4
parent166e1c2adf73b69bfbbec81e98a78814a031ddc7 (diff)
downloadhaskell-c2290596f10ce732be85503d3ef0f0b50b7e925a.tar.gz
Simplify Configure in a few ways
- No need to distinguish between gcc-llvm and clang. First of all, gcc-llvm is quite old and surely unmaintained by now. Second of all, none of the code actually care about that distinction! Now, it does make sense to consider C multiple frontends for LLVMs in the form of clang vs clang-cl (same clang, yes, but tweaked interface). But this is better handled in terms of "gccish vs mvscish" and "is LLVM", yielding 4 combinations. Therefore, I don't think it is useful saving the existing code for that. - Get the remaining CC_LLVM_BACKEND, and also TABLES_NEXT_TO_CODE in mk/config.h the normal way, rather than hacking it post-hoc. No point keeping these special cases around for now reason. - Get rid of hand-rolled `die` function and just use `AC_MSG_ERROR`. - Abstract check + flag override for unregisterised and tables next to code. Oh, and as part of the above I also renamed/combined some variables where it felt appropriate. - GccIsClang -> CcLlvmBackend. This is for `AC_SUBST`, like the other Camal case ones. It was never about gcc-llvm, or Apple's renamed clang, to be clear. - llvm_CC_FLAVOR -> CC_LLVM_BACKEND. This is for `AC_DEFINE`, like the other all-caps snake case ones. llvm_CC_FLAVOR was just silly indirection *and* an odd name to boot.
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m465
1 files changed, 48 insertions, 17 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 2072a33b36..1218203bfc 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -842,6 +842,48 @@ AC_DEFUN([FP_CHECK_SIZEOF_AND_ALIGNMENT],
FP_CHECK_ALIGNMENT([$1])
])# FP_CHECK_SIZEOF_AND_ALIGNMENT
+# FP_DEFAULT_CHOICE_OVERRIDE_CHECK(
+# flag, name, anti name, var name, help string,
+# [var true val], [var false val], [flag true val])
+# ---------------------------------------------------
+# Helper for when there is a automatic detection and an explicit flag for the
+# user to override disable a feature, but not override enable a feature.
+#
+# $1 = flag of feature
+# $2 = name of feature
+# $3 = name of anti feature
+# $4 = name of variable
+# $5 = help string
+# $6 = when true
+# $7 = when false
+# $8 = default explicit case (yes/no). Used for handle "backwards" legacy
+# options where enabling makes fewer assumptions than disabling.
+AC_DEFUN(
+ [FP_DEFAULT_CHOICE_OVERRIDE_CHECK],
+ [AC_ARG_ENABLE(
+ [$1],
+ [AC_HELP_STRING(
+ [--enable-$1],
+ [$5])],
+ [AS_IF(
+ [test x"$enableval" = x"m4_default([$8],yes)"],
+ [AS_CASE(
+ [x"$$4Default"],
+ [x"m4_default([$6],YES)"],
+ [AC_MSG_NOTICE([user chose $2 matching default for platform])],
+ [x"m4_default([$7],NO)"],
+ [AC_MSG_ERROR([user chose $2 overriding only supported option for platform])],
+ [AC_MSG_ERROR([invalid default])])
+ $4=m4_default([$6],YES)],
+ [AS_CASE(
+ [x"$$4Default"],
+ [x"m4_default([$6],YES)"],
+ [AC_MSG_NOTICE([user chose $3 overriding for platform])],
+ [x"m4_default([$7],NO)"],
+ [AC_MSG_NOTICE([user chose $3 matching default for platform])],
+ [AC_MSG_ERROR([invalid default])])
+ $4=m4_default([$7],NO)])],
+ [$4="$$4Default"])])
# FP_LEADING_UNDERSCORE
# ---------------------
@@ -1293,30 +1335,19 @@ AC_SUBST(GccLT46)
dnl Check to see if the C compiler is clang or llvm-gcc
dnl
-GccIsClang=NO
AC_DEFUN([FP_CC_LLVM_BACKEND],
[AC_REQUIRE([AC_PROG_CC])
-AC_MSG_CHECKING([whether C compiler is clang])
+AC_MSG_CHECKING([whether C compiler has an LLVM back end])
$CC -x c /dev/null -dM -E > conftest.txt 2>&1
-if grep "__clang__" conftest.txt >/dev/null 2>&1; then
- AC_SUBST([CC_CLANG_BACKEND], [1])
- AC_SUBST([CC_LLVM_BACKEND], [1])
- GccIsClang=YES
+if grep "__llvm__" conftest.txt >/dev/null 2>&1; then
+ AC_DEFINE([CC_LLVM_BACKEND], [1], [Define (to 1) if C compiler has an LLVM back end])
+ CcLlvmBackend=YES
AC_MSG_RESULT([yes])
else
+ CcLlvmBackend=NO
AC_MSG_RESULT([no])
- AC_MSG_CHECKING([whether C compiler has an LLVM back end])
- if grep "__llvm__" conftest.txt >/dev/null 2>&1; then
- AC_SUBST([CC_CLANG_BACKEND], [0])
- AC_SUBST([CC_LLVM_BACKEND], [1])
- AC_MSG_RESULT([yes])
- else
- AC_SUBST([CC_CLANG_BACKEND], [0])
- AC_SUBST([CC_LLVM_BACKEND], [0])
- AC_MSG_RESULT([no])
- fi
fi
-AC_SUBST(GccIsClang)
+AC_SUBST(CcLlvmBackend)
rm -f conftest.txt
])