[Git][ghc/ghc][master] configure: Check C99-compat for Cmm preprocessor
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Fri May 17 05:37:33 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
28b9cee0 by Rodrigo Mesquita at 2024-05-17T01:36:05-04:00
configure: Check C99-compat for Cmm preprocessor
Fixes #24815
- - - - -
1 changed file:
- m4/fp_cmm_cpp_cmd_with_args.m4
Changes:
=====================================
m4/fp_cmm_cpp_cmd_with_args.m4
=====================================
@@ -2,8 +2,10 @@
# --------------------------
# sets CMM_CPP command and its arguments
#
-# $1 = the variable to set to Cmm CPP command
-# $2 = the variable to set to Cmm CPP command arguments
+# $1 = the path to the C compiler
+# $2 = the variable to set to Cmm CPP command
+# $3 = the variable to set to Cmm CPP command arguments
+# $4 = whether Cmm CPP command supports -g0
AC_DEFUN([FP_CMM_CPP_CMD_WITH_ARGS],[
@@ -46,14 +48,33 @@ AC_ARG_WITH(cmm-cpp-flags,
AC_MSG_CHECKING([whether the C-- preprocessor "$CMM_CPP_CMD" $CMM_CPP_ARGS supports -g0])
: > conftest.c
-if "$CMM_CPP_CMD" $CMM_CPP_ARGS conftest.c -g0 >/dev/null 2>&1; then
+if "$CMM_CPP_CMD" $CMM_CPP_ARGS conftest.c -o conftest -g0 >/dev/null 2>&1; then
$4=True
AC_MSG_RESULT([yes])
else
$4=False
AC_MSG_RESULT([no])
fi
-rm -f conftest.c
+
+AC_MSG_CHECKING([the C-- preprocessor for C99 support])
+cat > conftest.c <<EOF
+#include <stdio.h>
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
+# error "Compiler does not advertise C99 conformance"
+#endif
+EOF
+if "$CMM_CPP_CMD" $CMM_CPP_ARGS conftest.c -o conftest -g0 >/dev/null 2>&1; then
+ AC_MSG_RESULT([yes])
+else
+ # Try -std=gnu99
+ if "$CMM_CPP_CMD" -std=gnu99 $CMM_CPP_ARGS conftest.c -o conftest -g0 >/dev/null 2>&1; then
+ $3="-std=gnu99 $$3"
+ AC_MSG_RESULT([needs -std=gnu99])
+ else
+ AC_MSG_ERROR([C99-compatible compiler needed])
+ fi
+fi
+rm -f conftest.c conftest.o conftest
$2="$CMM_CPP_CMD"
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/28b9cee0025f44289b8cea62ef221e0a0230f51e
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/28b9cee0025f44289b8cea62ef221e0a0230f51e
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240517/d3f7795b/attachment-0001.html>
More information about the ghc-commits
mailing list