2004-02-25 09:32:39 -05:00
|
|
|
|
|
|
|
dnl We create a function for detecting which compiler we use and then set as
|
|
|
|
dnl pendantic compiler options as possible for that particular compiler. The
|
|
|
|
dnl options are only used for debug-builds.
|
|
|
|
|
|
|
|
dnl This is a copy of the original found in curl's configure script. Don't
|
|
|
|
dnl modify this one, edit the one in curl and copy it back here when that one
|
|
|
|
dnl is changed.
|
|
|
|
|
|
|
|
AC_DEFUN([CURL_CC_DEBUG_OPTS],
|
|
|
|
[
|
|
|
|
if test "$GCC" = "yes"; then
|
|
|
|
|
|
|
|
dnl figure out gcc version!
|
|
|
|
AC_MSG_CHECKING([gcc version])
|
|
|
|
gccver=`$CC -dumpversion`
|
|
|
|
num1=`echo $gccver | cut -d . -f1`
|
|
|
|
num2=`echo $gccver | cut -d . -f2`
|
|
|
|
gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
|
|
|
|
AC_MSG_RESULT($gccver)
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if this is icc in disguise])
|
2004-02-27 06:29:36 -05:00
|
|
|
AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
|
2004-02-25 09:32:39 -05:00
|
|
|
dnl action if the text is found, this it has not been replaced by the
|
|
|
|
dnl cpp
|
2004-02-27 06:29:36 -05:00
|
|
|
ICC="no"
|
2004-02-25 09:32:39 -05:00
|
|
|
AC_MSG_RESULT([no]),
|
|
|
|
dnl the text was not found, it was replaced by the cpp
|
2004-02-27 06:29:36 -05:00
|
|
|
ICC="yes"
|
2004-02-25 09:32:39 -05:00
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
)
|
|
|
|
|
|
|
|
if test "$ICC" = "yes"; then
|
|
|
|
dnl this is icc, not gcc.
|
|
|
|
|
2004-02-27 06:29:36 -05:00
|
|
|
dnl ICC warnings we ignore:
|
|
|
|
dnl * 279 warns on static conditions in while expressions
|
|
|
|
dnl * 269 warns on our "%Od" printf formatters for curl_off_t output:
|
|
|
|
dnl "invalid format string conversion"
|
2004-02-25 09:32:39 -05:00
|
|
|
|
2004-02-27 06:29:36 -05:00
|
|
|
WARN="-wd279,269"
|
2004-02-25 09:32:39 -05:00
|
|
|
|
|
|
|
if test "$gccnum" -gt "600"; then
|
2004-02-27 06:29:36 -05:00
|
|
|
dnl icc 6.0 and older doesn't have the -Wall flag
|
2004-02-25 09:32:39 -05:00
|
|
|
WARN="-Wall $WARN"
|
|
|
|
fi
|
|
|
|
else dnl $ICC = yes
|
|
|
|
dnl
|
|
|
|
WARN="-W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wundef -Wpointer-arith -Wnested-externs -Winline -Wmissing-declarations -Wmissing-prototypes -Wsign-compare"
|
|
|
|
|
|
|
|
dnl -Wcast-align is a bit too annoying ;-)
|
|
|
|
|
|
|
|
if test "$gccnum" -ge "296"; then
|
|
|
|
dnl gcc 2.96 or later
|
|
|
|
WARN="$WARN -Wfloat-equal"
|
|
|
|
|
|
|
|
if test "$gccnum" -gt "296"; then
|
|
|
|
dnl this option does not exist in 2.96
|
|
|
|
WARN="$WARN -Wno-format-nonliteral"
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
|
|
|
|
dnl on i686-Linux as it gives us heaps with false positives
|
|
|
|
if test "$gccnum" -ge "303"; then
|
|
|
|
dnl gcc 3.3 and later
|
|
|
|
WARN="$WARN -Wendif-labels -Wstrict-prototypes"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
for flag in $CPPFLAGS; do
|
|
|
|
case "$flag" in
|
|
|
|
-I*)
|
|
|
|
dnl include path
|
|
|
|
add=`echo $flag | sed 's/^-I/-isystem /g'`
|
|
|
|
WARN="$WARN $add"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
fi dnl $ICC = no
|
|
|
|
|
|
|
|
CFLAGS="$CFLAGS $WARN"
|
|
|
|
|
|
|
|
fi dnl $GCC = yes
|
|
|
|
|
|
|
|
dnl strip off optimizer flags
|
|
|
|
NEWFLAGS=""
|
|
|
|
for flag in $CFLAGS; do
|
|
|
|
case "$flag" in
|
|
|
|
-O*)
|
|
|
|
dnl echo "cut off $flag"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
NEWFLAGS="$NEWFLAGS $flag"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
CFLAGS=$NEWFLAGS
|
|
|
|
|
|
|
|
]) dnl end of AC_DEFUN()
|
|
|
|
|