configure will also warn on 'strict compiler warning' rejected options
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
#***************************************************************************
|
#***************************************************************************
|
||||||
|
|
||||||
# File version for 'aclocal' use. Keep it a single number.
|
# File version for 'aclocal' use. Keep it a single number.
|
||||||
# serial 14
|
# serial 15
|
||||||
|
|
||||||
|
|
||||||
dnl CARES_CHECK_COMPILER
|
dnl CARES_CHECK_COMPILER
|
||||||
@@ -269,6 +269,46 @@ AC_DEFUN([CARES_CHECK_COMPILER_SUN], [
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
dnl CARES_CONVERT_INCLUDE_TO_ISYSTEM
|
||||||
|
dnl -------------------------------------------------
|
||||||
|
dnl Changes standard include paths present in CFLAGS
|
||||||
|
dnl and CPPFLAGS into isystem include paths. This is
|
||||||
|
dnl done to prevent GNUC from generating warnings on
|
||||||
|
dnl headers from these locations, even though this is
|
||||||
|
dnl not reliable on ancient GNUC versions.
|
||||||
|
|
||||||
|
AC_DEFUN([CARES_CONVERT_INCLUDE_TO_ISYSTEM], [
|
||||||
|
tmp_has_include="no"
|
||||||
|
tmp_chg_FLAGS=$CFLAGS
|
||||||
|
for word1 in $tmp_chg_FLAGS; do
|
||||||
|
case "$word" in
|
||||||
|
-I*)
|
||||||
|
tmp_has_include="yes"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
if test "$tmp_has_include" = "yes"; then
|
||||||
|
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/^-I/ -isystem /g'`
|
||||||
|
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/ -I/ -isystem /g'`
|
||||||
|
CFLAGS=`eval echo $tmp_chg_FLAGS`
|
||||||
|
fi
|
||||||
|
tmp_has_include="no"
|
||||||
|
tmp_chg_FLAGS=$CPPFLAGS
|
||||||
|
for word1 in $tmp_chg_FLAGS; do
|
||||||
|
case "$word" in
|
||||||
|
-I*)
|
||||||
|
tmp_has_include="yes"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
if test "$tmp_has_include" = "yes"; then
|
||||||
|
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/^-I/ -isystem /g'`
|
||||||
|
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/ -I/ -isystem /g'`
|
||||||
|
CPPFLAGS=`eval echo $tmp_chg_FLAGS`
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl CARES_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
|
dnl CARES_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
|
||||||
dnl -------------------------------------------------
|
dnl -------------------------------------------------
|
||||||
dnl Verify if the C compiler seems to work with the
|
dnl Verify if the C compiler seems to work with the
|
||||||
@@ -308,6 +348,9 @@ AC_DEFUN([CARES_COMPILER_WORKS_IFELSE], [
|
|||||||
test "$tmp_compiler_works" = "yes"; then
|
test "$tmp_compiler_works" = "yes"; then
|
||||||
AC_RUN_IFELSE([
|
AC_RUN_IFELSE([
|
||||||
AC_LANG_PROGRAM([[
|
AC_LANG_PROGRAM([[
|
||||||
|
# ifdef __STDC__
|
||||||
|
# include <stdlib.h>
|
||||||
|
# endif
|
||||||
]],[[
|
]],[[
|
||||||
int i = 0;
|
int i = 0;
|
||||||
exit(i);
|
exit(i);
|
||||||
@@ -337,6 +380,10 @@ AC_DEFUN([CARES_SET_COMPILER_BASIC_OPTS], [
|
|||||||
AC_REQUIRE([CARES_CHECK_COMPILER])dnl
|
AC_REQUIRE([CARES_CHECK_COMPILER])dnl
|
||||||
#
|
#
|
||||||
if test "$compiler_id" != "unknown"; then
|
if test "$compiler_id" != "unknown"; then
|
||||||
|
#
|
||||||
|
if test "$compiler_id" = "GNUC"; then
|
||||||
|
CARES_CONVERT_INCLUDE_TO_ISYSTEM
|
||||||
|
fi
|
||||||
#
|
#
|
||||||
tmp_save_CPPFLAGS="$CPPFLAGS"
|
tmp_save_CPPFLAGS="$CPPFLAGS"
|
||||||
tmp_save_CFLAGS="$CFLAGS"
|
tmp_save_CFLAGS="$CFLAGS"
|
||||||
@@ -581,100 +628,135 @@ AC_DEFUN([CARES_SET_COMPILER_WARNING_OPTS], [
|
|||||||
AC_REQUIRE([CARES_CHECK_OPTION_WARNINGS])dnl
|
AC_REQUIRE([CARES_CHECK_OPTION_WARNINGS])dnl
|
||||||
AC_REQUIRE([CARES_CHECK_COMPILER])dnl
|
AC_REQUIRE([CARES_CHECK_COMPILER])dnl
|
||||||
#
|
#
|
||||||
if test "$compiler_id" = "DECC"; then
|
if test "$compiler_id" != "unknown"; then
|
||||||
if test "$want_warnings" = "yes"; then
|
|
||||||
dnl Select a higher warning level than default level2
|
|
||||||
CFLAGS="$CFLAGS -msg_enable level3"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
if test "$compiler_id" = "GNUC"; then
|
|
||||||
#
|
#
|
||||||
# FIXME: Some of these warnings should be changed into errors
|
tmp_save_CPPFLAGS="$CPPFLAGS"
|
||||||
# and moved to CARES-SET-COMPILER-BASIC-OPTS
|
tmp_save_CFLAGS="$CFLAGS"
|
||||||
|
tmp_CPPFLAGS=""
|
||||||
|
tmp_CFLAGS=""
|
||||||
#
|
#
|
||||||
if test "$want_warnings" = "yes"; then
|
case "$compiler_id" in
|
||||||
dnl this is a set of options we believe *ALL* gcc versions support:
|
#
|
||||||
WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
|
DECC)
|
||||||
dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
|
#
|
||||||
if test "$compiler_num" -ge "207"; then
|
if test "$want_warnings" = "yes"; then
|
||||||
dnl gcc 2.7 or later
|
dnl Select a higher warning level than default level2
|
||||||
WARN="$WARN -Wmissing-declarations"
|
tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3"
|
||||||
fi
|
fi
|
||||||
if test "$compiler_num" -gt "295"; then
|
;;
|
||||||
dnl only if the compiler is newer than 2.95 since we got lots of
|
#
|
||||||
dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
|
GNUC)
|
||||||
dnl gcc 2.95.4 on FreeBSD 4.9!
|
#
|
||||||
WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
|
if test "$want_warnings" = "yes"; then
|
||||||
fi
|
dnl Set of options we believe *ALL* gcc versions support:
|
||||||
if test "$compiler_num" -ge "296"; then
|
tmp_CFLAGS="$tmp_CFLAGS -pedantic -Wall -W -Winline -Wnested-externs"
|
||||||
dnl gcc 2.96 or later
|
tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes -Wpointer-arith"
|
||||||
WARN="$WARN -Wfloat-equal"
|
tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings"
|
||||||
fi
|
dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
|
||||||
if test "$compiler_num" -gt "296"; then
|
if test "$compiler_num" -ge "207"; then
|
||||||
dnl this option does not exist in 2.96
|
dnl gcc 2.7 or later
|
||||||
WARN="$WARN -Wno-format-nonliteral"
|
tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
|
||||||
fi
|
fi
|
||||||
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
|
if test "$compiler_num" -gt "295"; then
|
||||||
dnl on i686-Linux as it gives us heaps with false positives.
|
dnl only if the compiler is newer than 2.95 since we got lots of
|
||||||
dnl Also, on gcc 4.0.X it is totally unbearable and complains all
|
dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
|
||||||
dnl over making it unusable for generic purposes. Let's not use it.
|
dnl gcc 2.95.4 on FreeBSD 4.9!
|
||||||
if test "$compiler_num" -ge "303"; then
|
tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long -Wno-multichar -Wshadow"
|
||||||
dnl gcc 3.3 and later
|
tmp_CFLAGS="$tmp_CFLAGS -Wsign-compare -Wundef"
|
||||||
WARN="$WARN -Wendif-labels -Wstrict-prototypes"
|
fi
|
||||||
fi
|
if test "$compiler_num" -ge "296"; then
|
||||||
if test "$compiler_num" -ge "304"; then
|
dnl gcc 2.96 or later
|
||||||
# try these on gcc 3.4
|
tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
|
||||||
WARN="$WARN -Wdeclaration-after-statement"
|
fi
|
||||||
fi
|
if test "$compiler_num" -gt "296"; then
|
||||||
for flag in $CPPFLAGS; do
|
dnl this option does not exist in 2.96
|
||||||
case "$flag" in
|
tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
|
||||||
-I*)
|
fi
|
||||||
dnl Include path, provide a -isystem option for the same dir
|
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
|
||||||
dnl to prevent warnings in those dirs. The -isystem was not very
|
dnl on i686-Linux as it gives us heaps with false positives.
|
||||||
dnl reliable on earlier gcc versions.
|
dnl Also, on gcc 4.0.X it is totally unbearable and complains all
|
||||||
add=`echo $flag | sed 's/^-I/-isystem /g'`
|
dnl over making it unusable for generic purposes. Let's not use it.
|
||||||
WARN="$WARN $add"
|
if test "$compiler_num" -ge "303"; then
|
||||||
;;
|
dnl gcc 3.3 and later
|
||||||
esac
|
tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
|
||||||
done
|
fi
|
||||||
CFLAGS="$CFLAGS $WARN"
|
if test "$compiler_num" -ge "304"; then
|
||||||
AC_MSG_NOTICE([Added this set of compiler options: $WARN])
|
dnl gcc 3.4 and later
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
HPUXC)
|
||||||
|
#
|
||||||
|
if test "$want_warnings" = "yes"; then
|
||||||
|
dnl Issue all warnings
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS +w1"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
IBMC)
|
||||||
|
#
|
||||||
|
dnl Placeholder
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS"
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
ICC_unix)
|
||||||
|
#
|
||||||
|
if test "$want_warnings" = "yes"; then
|
||||||
|
if test "$compiler_num" -gt "600"; then
|
||||||
|
dnl Show errors, warnings, and remarks
|
||||||
|
tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall"
|
||||||
|
dnl Perform extra compile-time code checking
|
||||||
|
tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
ICC_windows)
|
||||||
|
#
|
||||||
|
dnl Placeholder
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS"
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
SGIC)
|
||||||
|
#
|
||||||
|
if test "$want_warnings" = "yes"; then
|
||||||
|
dnl Perform stricter semantic and lint-like checks
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
SUNC)
|
||||||
|
#
|
||||||
|
if test "$want_warnings" = "yes"; then
|
||||||
|
dnl Perform stricter semantic and lint-like checks
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS -v"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
esac
|
||||||
|
#
|
||||||
|
tmp_CPPFLAGS=`eval echo $tmp_CPPFLAGS`
|
||||||
|
tmp_CFLAGS=`eval echo $tmp_CFLAGS`
|
||||||
|
#
|
||||||
|
if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
|
||||||
|
AC_MSG_CHECKING([if compiler accepts strict warning options])
|
||||||
|
CPPFLAGS=`eval echo $tmp_save_CPPFLAGS $tmp_CPPFLAGS`
|
||||||
|
CFLAGS=`eval echo $tmp_save_CFLAGS $tmp_CFLAGS`
|
||||||
|
CARES_COMPILER_WORKS_IFELSE([
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
|
||||||
|
dnl restore initial settings
|
||||||
|
CPPFLAGS="$tmp_save_CPPFLAGS"
|
||||||
|
CFLAGS="$tmp_save_CFLAGS"
|
||||||
|
])
|
||||||
fi
|
fi
|
||||||
|
#
|
||||||
fi
|
fi
|
||||||
#
|
|
||||||
if test "$compiler_id" = "HPUXC"; then
|
|
||||||
if test "$want_warnings" = "yes"; then
|
|
||||||
dnl Issue all warnings
|
|
||||||
CFLAGS="$CFLAGS +w1"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
if test "$compiler_id" = "ICC_unix"; then
|
|
||||||
if test "$want_warnings" = "yes"; then
|
|
||||||
if test "$compiler_num" -gt "600"; then
|
|
||||||
dnl Show errors, warnings, and remarks
|
|
||||||
CPPFLAGS="$CPPFLAGS -Wall"
|
|
||||||
dnl Perform extra compile-time code checking
|
|
||||||
CPPFLAGS="$CPPFLAGS -Wcheck"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
if test "$compiler_id" = "SGIC"; then
|
|
||||||
if test "$want_warnings" = "yes"; then
|
|
||||||
dnl Perform stricter semantic and lint-like checks
|
|
||||||
CFLAGS="$CFLAGS -fullwarn"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
if test "$compiler_id" = "SUNC"; then
|
|
||||||
if test "$want_warnings" = "yes"; then
|
|
||||||
dnl Perform stricter semantic and lint-like checks
|
|
||||||
CFLAGS="$CFLAGS -v"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -733,8 +815,8 @@ dnl is considered positive, otherwise false.
|
|||||||
|
|
||||||
AC_DEFUN([CARES_VAR_MATCH], [
|
AC_DEFUN([CARES_VAR_MATCH], [
|
||||||
ac_var_match_word="no"
|
ac_var_match_word="no"
|
||||||
for word1 in "$[$1]"; do
|
for word1 in $[$1]; do
|
||||||
for word2 in "[$2]"; do
|
for word2 in [$2]; do
|
||||||
if test "$word1" = "$word2"; then
|
if test "$word1" = "$word2"; then
|
||||||
ac_var_match_word="yes"
|
ac_var_match_word="yes"
|
||||||
fi
|
fi
|
||||||
@@ -768,9 +850,9 @@ dnl from VALUE is removed from VARNAME when present.
|
|||||||
|
|
||||||
AC_DEFUN([CARES_VAR_STRIP], [
|
AC_DEFUN([CARES_VAR_STRIP], [
|
||||||
ac_var_stripped=""
|
ac_var_stripped=""
|
||||||
for word1 in "$[$1]"; do
|
for word1 in $[$1]; do
|
||||||
ac_var_strip_word="no"
|
ac_var_strip_word="no"
|
||||||
for word2 in "[$2]"; do
|
for word2 in [$2]; do
|
||||||
if test "$word1" = "$word2"; then
|
if test "$word1" = "$word2"; then
|
||||||
ac_var_strip_word="yes"
|
ac_var_strip_word="yes"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#***************************************************************************
|
#***************************************************************************
|
||||||
|
|
||||||
# File version for 'aclocal' use. Keep it a single number.
|
# File version for 'aclocal' use. Keep it a single number.
|
||||||
# serial 13
|
# serial 14
|
||||||
|
|
||||||
|
|
||||||
dnl CURL_CHECK_COMPILER
|
dnl CURL_CHECK_COMPILER
|
||||||
@@ -275,6 +275,46 @@ AC_DEFUN([CURL_CHECK_COMPILER_SUN], [
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
dnl CURL_CONVERT_INCLUDE_TO_ISYSTEM
|
||||||
|
dnl -------------------------------------------------
|
||||||
|
dnl Changes standard include paths present in CFLAGS
|
||||||
|
dnl and CPPFLAGS into isystem include paths. This is
|
||||||
|
dnl done to prevent GNUC from generating warnings on
|
||||||
|
dnl headers from these locations, even though this is
|
||||||
|
dnl not reliable on ancient GNUC versions.
|
||||||
|
|
||||||
|
AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
|
||||||
|
tmp_has_include="no"
|
||||||
|
tmp_chg_FLAGS=$CFLAGS
|
||||||
|
for word1 in $tmp_chg_FLAGS; do
|
||||||
|
case "$word" in
|
||||||
|
-I*)
|
||||||
|
tmp_has_include="yes"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
if test "$tmp_has_include" = "yes"; then
|
||||||
|
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/^-I/ -isystem /g'`
|
||||||
|
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/ -I/ -isystem /g'`
|
||||||
|
CFLAGS=`eval echo $tmp_chg_FLAGS`
|
||||||
|
fi
|
||||||
|
tmp_has_include="no"
|
||||||
|
tmp_chg_FLAGS=$CPPFLAGS
|
||||||
|
for word1 in $tmp_chg_FLAGS; do
|
||||||
|
case "$word" in
|
||||||
|
-I*)
|
||||||
|
tmp_has_include="yes"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
if test "$tmp_has_include" = "yes"; then
|
||||||
|
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/^-I/ -isystem /g'`
|
||||||
|
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/ -I/ -isystem /g'`
|
||||||
|
CPPFLAGS=`eval echo $tmp_chg_FLAGS`
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
|
dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
|
||||||
dnl -------------------------------------------------
|
dnl -------------------------------------------------
|
||||||
dnl Verify if the C compiler seems to work with the
|
dnl Verify if the C compiler seems to work with the
|
||||||
@@ -314,6 +354,9 @@ AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [
|
|||||||
test "$tmp_compiler_works" = "yes"; then
|
test "$tmp_compiler_works" = "yes"; then
|
||||||
AC_RUN_IFELSE([
|
AC_RUN_IFELSE([
|
||||||
AC_LANG_PROGRAM([[
|
AC_LANG_PROGRAM([[
|
||||||
|
# ifdef __STDC__
|
||||||
|
# include <stdlib.h>
|
||||||
|
# endif
|
||||||
]],[[
|
]],[[
|
||||||
int i = 0;
|
int i = 0;
|
||||||
exit(i);
|
exit(i);
|
||||||
@@ -343,6 +386,10 @@ AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
|
|||||||
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
|
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
|
||||||
#
|
#
|
||||||
if test "$compiler_id" != "unknown"; then
|
if test "$compiler_id" != "unknown"; then
|
||||||
|
#
|
||||||
|
if test "$compiler_id" = "GNUC"; then
|
||||||
|
CURL_CONVERT_INCLUDE_TO_ISYSTEM
|
||||||
|
fi
|
||||||
#
|
#
|
||||||
tmp_save_CPPFLAGS="$CPPFLAGS"
|
tmp_save_CPPFLAGS="$CPPFLAGS"
|
||||||
tmp_save_CFLAGS="$CFLAGS"
|
tmp_save_CFLAGS="$CFLAGS"
|
||||||
@@ -587,100 +634,135 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
|
|||||||
AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
|
AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
|
||||||
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
|
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
|
||||||
#
|
#
|
||||||
if test "$compiler_id" = "DECC"; then
|
if test "$compiler_id" != "unknown"; then
|
||||||
if test "$want_warnings" = "yes"; then
|
|
||||||
dnl Select a higher warning level than default level2
|
|
||||||
CFLAGS="$CFLAGS -msg_enable level3"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
if test "$compiler_id" = "GNUC"; then
|
|
||||||
#
|
#
|
||||||
# FIXME: Some of these warnings should be changed into errors
|
tmp_save_CPPFLAGS="$CPPFLAGS"
|
||||||
# and moved to CURL-SET-COMPILER-BASIC-OPTS
|
tmp_save_CFLAGS="$CFLAGS"
|
||||||
|
tmp_CPPFLAGS=""
|
||||||
|
tmp_CFLAGS=""
|
||||||
#
|
#
|
||||||
if test "$want_warnings" = "yes"; then
|
case "$compiler_id" in
|
||||||
dnl this is a set of options we believe *ALL* gcc versions support:
|
#
|
||||||
WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
|
DECC)
|
||||||
dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
|
#
|
||||||
if test "$compiler_num" -ge "207"; then
|
if test "$want_warnings" = "yes"; then
|
||||||
dnl gcc 2.7 or later
|
dnl Select a higher warning level than default level2
|
||||||
WARN="$WARN -Wmissing-declarations"
|
tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3"
|
||||||
fi
|
fi
|
||||||
if test "$compiler_num" -gt "295"; then
|
;;
|
||||||
dnl only if the compiler is newer than 2.95 since we got lots of
|
#
|
||||||
dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
|
GNUC)
|
||||||
dnl gcc 2.95.4 on FreeBSD 4.9!
|
#
|
||||||
WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
|
if test "$want_warnings" = "yes"; then
|
||||||
fi
|
dnl Set of options we believe *ALL* gcc versions support:
|
||||||
if test "$compiler_num" -ge "296"; then
|
tmp_CFLAGS="$tmp_CFLAGS -pedantic -Wall -W -Winline -Wnested-externs"
|
||||||
dnl gcc 2.96 or later
|
tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes -Wpointer-arith"
|
||||||
WARN="$WARN -Wfloat-equal"
|
tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings"
|
||||||
fi
|
dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
|
||||||
if test "$compiler_num" -gt "296"; then
|
if test "$compiler_num" -ge "207"; then
|
||||||
dnl this option does not exist in 2.96
|
dnl gcc 2.7 or later
|
||||||
WARN="$WARN -Wno-format-nonliteral"
|
tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
|
||||||
fi
|
fi
|
||||||
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
|
if test "$compiler_num" -gt "295"; then
|
||||||
dnl on i686-Linux as it gives us heaps with false positives.
|
dnl only if the compiler is newer than 2.95 since we got lots of
|
||||||
dnl Also, on gcc 4.0.X it is totally unbearable and complains all
|
dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
|
||||||
dnl over making it unusable for generic purposes. Let's not use it.
|
dnl gcc 2.95.4 on FreeBSD 4.9!
|
||||||
if test "$compiler_num" -ge "303"; then
|
tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long -Wno-multichar -Wshadow"
|
||||||
dnl gcc 3.3 and later
|
tmp_CFLAGS="$tmp_CFLAGS -Wsign-compare -Wundef"
|
||||||
WARN="$WARN -Wendif-labels -Wstrict-prototypes"
|
fi
|
||||||
fi
|
if test "$compiler_num" -ge "296"; then
|
||||||
if test "$compiler_num" -ge "304"; then
|
dnl gcc 2.96 or later
|
||||||
# try these on gcc 3.4
|
tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
|
||||||
WARN="$WARN -Wdeclaration-after-statement"
|
fi
|
||||||
fi
|
if test "$compiler_num" -gt "296"; then
|
||||||
for flag in $CPPFLAGS; do
|
dnl this option does not exist in 2.96
|
||||||
case "$flag" in
|
tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
|
||||||
-I*)
|
fi
|
||||||
dnl Include path, provide a -isystem option for the same dir
|
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
|
||||||
dnl to prevent warnings in those dirs. The -isystem was not very
|
dnl on i686-Linux as it gives us heaps with false positives.
|
||||||
dnl reliable on earlier gcc versions.
|
dnl Also, on gcc 4.0.X it is totally unbearable and complains all
|
||||||
add=`echo $flag | sed 's/^-I/-isystem /g'`
|
dnl over making it unusable for generic purposes. Let's not use it.
|
||||||
WARN="$WARN $add"
|
if test "$compiler_num" -ge "303"; then
|
||||||
;;
|
dnl gcc 3.3 and later
|
||||||
esac
|
tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
|
||||||
done
|
fi
|
||||||
CFLAGS="$CFLAGS $WARN"
|
if test "$compiler_num" -ge "304"; then
|
||||||
AC_MSG_NOTICE([Added this set of compiler options: $WARN])
|
dnl gcc 3.4 and later
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
HPUXC)
|
||||||
|
#
|
||||||
|
if test "$want_warnings" = "yes"; then
|
||||||
|
dnl Issue all warnings
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS +w1"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
IBMC)
|
||||||
|
#
|
||||||
|
dnl Placeholder
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS"
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
ICC_unix)
|
||||||
|
#
|
||||||
|
if test "$want_warnings" = "yes"; then
|
||||||
|
if test "$compiler_num" -gt "600"; then
|
||||||
|
dnl Show errors, warnings, and remarks
|
||||||
|
tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall"
|
||||||
|
dnl Perform extra compile-time code checking
|
||||||
|
tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
ICC_windows)
|
||||||
|
#
|
||||||
|
dnl Placeholder
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS"
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
SGIC)
|
||||||
|
#
|
||||||
|
if test "$want_warnings" = "yes"; then
|
||||||
|
dnl Perform stricter semantic and lint-like checks
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
SUNC)
|
||||||
|
#
|
||||||
|
if test "$want_warnings" = "yes"; then
|
||||||
|
dnl Perform stricter semantic and lint-like checks
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS -v"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
#
|
||||||
|
esac
|
||||||
|
#
|
||||||
|
tmp_CPPFLAGS=`eval echo $tmp_CPPFLAGS`
|
||||||
|
tmp_CFLAGS=`eval echo $tmp_CFLAGS`
|
||||||
|
#
|
||||||
|
if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
|
||||||
|
AC_MSG_CHECKING([if compiler accepts strict warning options])
|
||||||
|
CPPFLAGS=`eval echo $tmp_save_CPPFLAGS $tmp_CPPFLAGS`
|
||||||
|
CFLAGS=`eval echo $tmp_save_CFLAGS $tmp_CFLAGS`
|
||||||
|
CURL_COMPILER_WORKS_IFELSE([
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
|
||||||
|
dnl restore initial settings
|
||||||
|
CPPFLAGS="$tmp_save_CPPFLAGS"
|
||||||
|
CFLAGS="$tmp_save_CFLAGS"
|
||||||
|
])
|
||||||
fi
|
fi
|
||||||
|
#
|
||||||
fi
|
fi
|
||||||
#
|
|
||||||
if test "$compiler_id" = "HPUXC"; then
|
|
||||||
if test "$want_warnings" = "yes"; then
|
|
||||||
dnl Issue all warnings
|
|
||||||
CFLAGS="$CFLAGS +w1"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
if test "$compiler_id" = "ICC_unix"; then
|
|
||||||
if test "$want_warnings" = "yes"; then
|
|
||||||
if test "$compiler_num" -gt "600"; then
|
|
||||||
dnl Show errors, warnings, and remarks
|
|
||||||
CPPFLAGS="$CPPFLAGS -Wall"
|
|
||||||
dnl Perform extra compile-time code checking
|
|
||||||
CPPFLAGS="$CPPFLAGS -Wcheck"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
if test "$compiler_id" = "SGIC"; then
|
|
||||||
if test "$want_warnings" = "yes"; then
|
|
||||||
dnl Perform stricter semantic and lint-like checks
|
|
||||||
CFLAGS="$CFLAGS -fullwarn"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
if test "$compiler_id" = "SUNC"; then
|
|
||||||
if test "$want_warnings" = "yes"; then
|
|
||||||
dnl Perform stricter semantic and lint-like checks
|
|
||||||
CFLAGS="$CFLAGS -v"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -725,8 +807,8 @@ dnl is considered positive, otherwise false.
|
|||||||
|
|
||||||
AC_DEFUN([CURL_VAR_MATCH], [
|
AC_DEFUN([CURL_VAR_MATCH], [
|
||||||
ac_var_match_word="no"
|
ac_var_match_word="no"
|
||||||
for word1 in "$[$1]"; do
|
for word1 in $[$1]; do
|
||||||
for word2 in "[$2]"; do
|
for word2 in [$2]; do
|
||||||
if test "$word1" = "$word2"; then
|
if test "$word1" = "$word2"; then
|
||||||
ac_var_match_word="yes"
|
ac_var_match_word="yes"
|
||||||
fi
|
fi
|
||||||
@@ -760,9 +842,9 @@ dnl from VALUE is removed from VARNAME when present.
|
|||||||
|
|
||||||
AC_DEFUN([CURL_VAR_STRIP], [
|
AC_DEFUN([CURL_VAR_STRIP], [
|
||||||
ac_var_stripped=""
|
ac_var_stripped=""
|
||||||
for word1 in "$[$1]"; do
|
for word1 in $[$1]; do
|
||||||
ac_var_strip_word="no"
|
ac_var_strip_word="no"
|
||||||
for word2 in "[$2]"; do
|
for word2 in [$2]; do
|
||||||
if test "$word1" = "$word2"; then
|
if test "$word1" = "$word2"; then
|
||||||
ac_var_strip_word="yes"
|
ac_var_strip_word="yes"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user