Skip to content
Snippets Groups Projects
Commit 28b9cee0 authored by Rodrigo Mesquita's avatar Rodrigo Mesquita :seedling: Committed by Marge Bot
Browse files

configure: Check C99-compat for Cmm preprocessor

Fixes #24815
parent 710665bd
No related branches found
No related tags found
No related merge requests found
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment