summaryrefslogtreecommitdiff
path: root/m4/curl-compilers.m4
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2012-12-16 18:51:51 +0100
committerYang Tse <yangsita@gmail.com>2012-12-16 18:51:51 +0100
commit57fa576a35e45a729939d5ef6bced81f3facbf63 (patch)
tree6070a6c323e40c039191f50de39f038e30a10c4d /m4/curl-compilers.m4
parentf6af9d9886ae49963bec0fda7dc6ea8720bbc20c (diff)
downloadcurl-57fa576a35e45a729939d5ef6bced81f3facbf63.tar.gz
configure: check if compiler halts on function prototype mismatch
Diffstat (limited to 'm4/curl-compilers.m4')
-rw-r--r--m4/curl-compilers.m438
1 files changed, 37 insertions, 1 deletions
diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4
index 819bbd9c8..0879a48e0 100644
--- a/m4/curl-compilers.m4
+++ b/m4/curl-compilers.m4
@@ -21,7 +21,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 63
+# serial 64
dnl CURL_CHECK_COMPILER
@@ -1495,6 +1495,42 @@ AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
])
+dnl CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
+dnl -------------------------------------------------
+dnl Verifies if the compiler actually halts after the
+dnl compilation phase without generating any object
+dnl code file, when the source code tries to redefine
+dnl a prototype which does not match previous one.
+
+AC_DEFUN([CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH], [
+ AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl
+ AC_MSG_CHECKING([if compiler halts on function prototype mismatch])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+# include <stdlib.h>
+ int rand(int n);
+ int rand(int n)
+ {
+ if(n)
+ return ++n;
+ else
+ return n;
+ }
+ ]],[[
+ int i[2];
+ int j = rand(i[0]);
+ if(j)
+ return j;
+ ]])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([compiler does not halt on function prototype mismatch.])
+ ],[
+ AC_MSG_RESULT([yes])
+ ])
+])
+
+
dnl CURL_VAR_MATCH (VARNAME, VALUE)
dnl -------------------------------------------------
dnl Verifies if shell variable VARNAME contains VALUE.