1 # FP_CMM_CPP_CMD_WITH_ARGS()
2 # --------------------------
3 # sets CMM_CPP command and its arguments
5 # $1 = the path to the C compiler
6 # $2 = the variable to set to Cmm CPP command
7 # $3 = the variable to set to Cmm CPP command arguments
8 # $4 = whether Cmm CPP command supports -g0
10 AC_DEFUN([FP_CMM_CPP_CMD_WITH_ARGS],[
13 [AS_HELP_STRING([--with-cmm-cpp=ARG],
14 [Path to the Cmm (C) preprocessor [default=autodetect].
15 If you set --with-cmm-cpp=CC, ensure -E is included in --with-cmm-cpp-flags])],
17 if test "$HostOS" = "mingw32"
19 AC_MSG_WARN([Request to use $withval will be ignored])
21 CMM_CPP_CMD="$withval"
25 # We can't use the CPP var here, since CPP_CMD is expected to be a single
26 # command (no flags), and autoconf defines CPP as "/usr/bin/gcc -E".
27 # So we use CC with -E by default
32 AC_ARG_WITH(cmm-cpp-flags,
33 [AS_HELP_STRING([--with-cmm-cpp-flags=ARG],
34 [Flags to the Cmm (C) preprocessor [default=autodetect]])],
36 if test "$HostOS" = "mingw32"
38 AC_MSG_WARN([Request to use $withval will be ignored])
40 # Use whatever flags were manually set, ignoring previously configured
41 # flags; and add CPP_ARGS (which will be -E if CPP_CMD was not specified)
42 CMM_CPP_ARGS="$withval"
49 AC_MSG_CHECKING([whether the C-- preprocessor "$CMM_CPP_CMD" $CMM_CPP_ARGS supports -g0])
51 if "$CMM_CPP_CMD" $CMM_CPP_ARGS conftest.c -o conftest -g0 >/dev/null 2>&1; then
59 AC_MSG_CHECKING([the C-- preprocessor for C99 support])
60 cat > conftest.c <<EOF
62 #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
63 # error "Compiler does not advertise C99 conformance"
66 if "$CMM_CPP_CMD" $CMM_CPP_ARGS conftest.c -o conftest -g0 >/dev/null 2>&1; then
70 if "$CMM_CPP_CMD" -std=gnu99 $CMM_CPP_ARGS conftest.c -o conftest -g0 >/dev/null 2>&1; then
72 AC_MSG_RESULT([needs -std=gnu99])
74 AC_MSG_ERROR([C99-compatible compiler needed])
77 rm -f conftest.c conftest.o conftest
81 $3="$$3 $CMM_CPP_ARGS"
83 # Clear CMM_CPP_CMD and CMM_CPP_ARGS