I have a macro that will test whether compilers like a given option. You might
be better to probe for compiler options at configure time, which should take
fewer updates and compiler specific knowledge.
Use is moderately simple, an example is
dps_CC_OPTION(warn,enable warnings, -Wall -full-warn)
checks whether the compiler says
Checking how ot enable warnings... -Wall
on my machine. It should be easy enough to check for -fno-rtti and
-fno-exception using a similar macro. Enough said.
The macro, for you aclocal.m4 file is:
AC_DEFUN(dps_CC_OPTION,
[AC_MSG_CHECKING([how to $2])
AC_CACHE_VAL(dps_cv_cc_opt_$1,
[ cat > conftest.c <<EOF
#include <stdio.h>
int main(int argc, char **argv)
{
argc=argc; argv=argv; return 0;
}
EOF
dps_cv_cc_opt_$1=""
for opt in $3; do
if test -z "${dps_cv_cc_opt_$1}"; then
if ${CC-cc} ${opt} -o conftest conftest.c 2>conftest2 1>&5; then
if test -f conftest2; then
msg=`cat conftest2`
if test -z "${msg}"; then
dps_cv_cc_opt_$1=${opt}
fi
else
dps_cv_cc_opt_$1=${opt}
fi
fi
fi
done
if test -z "${dps_cv_cc_opt_$1}"; then
dps_cv_cc_opt_$1="unknown"
fi
rm -f conftest conftest2])
if test "${dps_cv_cc_opt_$1}" = "unknown"; then
AC_MSG_RESULT("unknown")
$1=""
else
AC_MSG_RESULT(${dps_cv_cc_opt_$1})
$1=${dps_cv_cc_opt_$1}
fi])
--
Duncan (-:
"software industry, the: unique industry where selling substandard goods is
legal and you can charge extra for fixing the problems."