# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
-# are also available at http://curl.haxx.se/docs/copyright.html.
+# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 66
+# serial 67
dnl CURL_CHECK_COMPILER
***
*** Whatever settings are present in CFLAGS will be used for this run.
***
-*** If you wish to help the cURL project to better support your compiler
+*** If you wish to help the curl project to better support your compiler
*** you can report this and the required info on the libcurl development
-*** mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
+*** mailing list: https://cool.haxx.se/mailman/listinfo/curl-library/
***
_EOF
fi
if test "$curl_cv_have_def___clang__" = "yes"; then
AC_MSG_RESULT([yes])
compiler_id="CLANG"
- clangver=`$CC -dumpversion`
+ fullclangver=`$CC -v 2>&1 | grep version`
+ clangver=`echo $fullclangver | grep "based on LLVM " | "$SED" 's/.*(based on LLVM \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*)/\1/'`
+ if test -z "$clangver"; then
+ if echo $fullclangver | grep "Apple LLVM version " >/dev/null; then
+ dnl Starting with XCode 7 / clang 3.7, Apple clang won't tell its upstream version
+ clangver="3.7"
+ else
+ clangver=`echo $fullclangver | "$SED" 's/.*version \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'`
+ fi
+ fi
clangvhi=`echo $clangver | cut -d . -f1`
clangvlo=`echo $clangver | cut -d . -f2`
compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
flags_dbg_all="$flags_dbg_all -gvms"
flags_dbg_yes="-g"
flags_dbg_off=""
- flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
+ flags_opt_all="-O -O0 -O1 -O2 -O3 -Os -Og -Ofast"
flags_opt_yes="-O2"
flags_opt_off="-O0"
CURL_CHECK_DEF([_WIN32], [], [silent])
#
GNU_C)
#
- dnl Placeholder
- tmp_CFLAGS="$tmp_CFLAGS"
+ dnl turn implicit-function-declaration warning into error,
+ dnl at least gcc 2.95 and later support this
+ if test "$compiler_num" -ge "295"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Werror-implicit-function-declaration"
+ fi
;;
#
HP_UX_C)
dnl #147: declaration is incompatible with 'previous one'
dnl #165: too few arguments in function call
dnl #266: function declared implicitly
- tmp_CPPFLAGS="$tmp_CPPFLAGS -we 140,147,165,266"
+ tmp_CPPFLAGS="$tmp_CPPFLAGS -we140,147,165,266"
dnl Disable some remarks
dnl #279: controlling expression is constant
dnl #981: operands are evaluated in unspecified order
dnl #1469: "cc" clobber ignored
- tmp_CPPFLAGS="$tmp_CPPFLAGS -wd 279,981,1469"
+ tmp_CPPFLAGS="$tmp_CPPFLAGS -wd279,981,1469"
;;
#
INTEL_WINDOWS_C)
if test "$compiler_num" -ge "101"; then
tmp_CFLAGS="$tmp_CFLAGS -Wunused"
fi
+ #
+ dnl Only clang 2.8 or later
+ if test "$compiler_num" -ge "208"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wvla"
+ fi
+ #
+ dnl Only clang 2.9 or later
+ if test "$compiler_num" -ge "209"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wshift-sign-overflow"
+ fi
+ #
+ dnl Only clang 3.2 or later
+ if test "$compiler_num" -ge "302"; then
+ case $host_os in
+ cygwin* | mingw*)
+ dnl skip missing-variable-declarations warnings for cygwin and
+ dnl mingw because the libtool wrapper executable causes them
+ ;;
+ *)
+ tmp_CFLAGS="$tmp_CFLAGS -Wmissing-variable-declarations"
+ ;;
+ esac
+ fi
+ #
+ dnl Only clang 3.6 or later
+ if test "$compiler_num" -ge "306"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion"
+ fi
+ #
+ dnl Only clang 3.9 or later
+ if test "$compiler_num" -ge "309"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wcomma"
+ # avoid the varargs warning, fixed in 4.0
+ # https://bugs.llvm.org/show_bug.cgi?id=29140
+ if test "$compiler_num" -lt "400"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wno-varargs"
+ fi
+ fi
fi
;;
#
fi
fi
#
+ dnl Only gcc 4.6 or later
+ if test "$compiler_num" -ge "406"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion"
+ fi
+ #
fi
#
dnl Do not issue warnings for code in system include paths.
GNU_C)
dnl Only gcc 3.4 or later
if test "$compiler_num" -ge "304"; then
- if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
+ if $CC --help --verbose 2>/dev/null | grep fvisibility= >/dev/null ; then
tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
tmp_CFLAGS="-fvisibility=hidden"
supports_symbol_hiding="yes"
return n;
}
]],[[
- int i[2];
+ int i[2]={0,0};
int j = rand(i[0]);
if(j)
return j;