aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acinclude.m453
-rw-r--r--ares/configure.ac1
-rw-r--r--ares/m4/cares-compilers.m464
-rw-r--r--configure.ac3
-rw-r--r--m4/curl-compilers.m464
5 files changed, 128 insertions, 57 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index c259e8936..436adb605 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2361,59 +2361,6 @@ AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [
])
-dnl CURL_A_COUPLE_OF_EXPERIMENTAL_COMPILER_TESTS
-dnl -------------------------------------------------
-dnl Use autobuilds to verify if these two tests pass.
-dnl To be removed in 24 or 48 hours.
-
-AC_DEFUN([CURL_A_COUPLE_OF_EXPERIMENTAL_COMPILER_TESTS], [
- AC_MSG_CHECKING([compiler test 01])
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
- struct mystruct {
- int member1;
- char *member2;
- struct mystruct *next;
- };
- typedef struct mystruct mystruct;
- struct mystruct myfunc();
- typedef char __my_arr_01__
- [sizeof(myfunc().member1) == sizeof(int) ? 1 : -1];
- ]],[[
- /* this should compile ok to pass test 01 */
- struct mystruct dummy;
- ]])
- ],[
- AC_MSG_RESULT([pass])
- ],[
- AC_MSG_RESULT([FAIL])
- sed 's/^/cc-src: /' conftest.$ac_ext >&6
- sed 's/^/cc-err: /' conftest.err >&6
- ])
- AC_MSG_CHECKING([compiler test 02])
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
- struct mystruct {
- int member1;
- char *member2;
- struct mystruct *next;
- };
- typedef struct mystruct mystruct;
- struct mystruct myfunc();
- typedef char __my_arr_02__
- [sizeof(myfunc().member1) == sizeof(char) ? 1 : -1];
- ]],[[
- /* this should fail compilation to pass test 02 */
- struct mystruct dummy;
- ]])
- ],[
- AC_MSG_RESULT([FAIL])
- ],[
- AC_MSG_RESULT([pass])
- ])
-])
-
-
dnl CURL_CHECK_FUNC_SELECT
dnl -------------------------------------------------
dnl Test if the socket select() function is available,
diff --git a/ares/configure.ac b/ares/configure.ac
index 14f580c1f..b779c2f76 100644
--- a/ares/configure.ac
+++ b/ares/configure.ac
@@ -160,6 +160,7 @@ esac
CARES_CHECK_COMPILER_HALT_ON_ERROR
CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
+CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE
dnl **********************************************************************
dnl Compilation based checks should not be done before this point.
diff --git a/ares/m4/cares-compilers.m4 b/ares/m4/cares-compilers.m4
index 80f4d1b49..2bfe85664 100644
--- a/ares/m4/cares-compilers.m4
+++ b/ares/m4/cares-compilers.m4
@@ -16,7 +16,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 49
+# serial 50
dnl CARES_CHECK_COMPILER
@@ -1168,6 +1168,68 @@ AC_DEFUN([CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
])
+dnl CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE
+dnl -------------------------------------------------
+dnl Verifies if the compiler is capable of handling the
+dnl size of a struct member, struct which is a function
+dnl result, as a compilation-time condition inside the
+dnl type definition of a constant array.
+
+AC_DEFUN([CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [
+ AC_REQUIRE([CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])dnl
+ AC_MSG_CHECKING([if compiler struct member size checking works])
+ tst_compiler_check_one_works="unknown"
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ struct mystruct {
+ int mi;
+ char mc;
+ struct mystruct *next;
+ };
+ struct mystruct myfunc();
+ typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1 ];
+ typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ];
+ ]],[[
+ good_t1 dummy1;
+ good_t2 dummy2;
+ ]])
+ ],[
+ tst_compiler_check_one_works="yes"
+ ],[
+ tst_compiler_check_one_works="no"
+ sed 's/^/cc-src: /' conftest.$ac_ext >&6
+ sed 's/^/cc-err: /' conftest.err >&6
+ ])
+ tst_compiler_check_two_works="unknown"
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ struct mystruct {
+ int mi;
+ char mc;
+ struct mystruct *next;
+ };
+ struct mystruct myfunc();
+ typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1 ];
+ typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ];
+ ]],[[
+ bad_t1 dummy1;
+ bad_t2 dummy2;
+ ]])
+ ],[
+ tst_compiler_check_two_works="no"
+ ],[
+ tst_compiler_check_two_works="yes"
+ ])
+ if test "$tst_compiler_check_one_works" = "yes" &&
+ test "$tst_compiler_check_two_works" = "yes"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([compiler fails struct member size checking.])
+ fi
+])
+
+
dnl CARES_VAR_MATCH (VARNAME, VALUE)
dnl -------------------------------------------------
dnl Verifies if shell variable VARNAME contains VALUE.
diff --git a/configure.ac b/configure.ac
index 0e0a1bf6e..391d7380b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -269,6 +269,7 @@ esac
CURL_CHECK_COMPILER_HALT_ON_ERROR
CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
+CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE
dnl **********************************************************************
dnl Compilation based checks should not be done before this point.
@@ -1999,8 +2000,6 @@ AC_CHECK_TYPE([bool],[
#endif
])
-CURL_A_COUPLE_OF_EXPERIMENTAL_COMPILER_TESTS
-
CURL_CONFIGURE_CURL_SOCKLEN_T
TYPE_IN_ADDR_T
diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4
index adff294ad..e1337d961 100644
--- a/m4/curl-compilers.m4
+++ b/m4/curl-compilers.m4
@@ -22,7 +22,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 49
+# serial 50
dnl CURL_CHECK_COMPILER
@@ -1160,6 +1160,68 @@ AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
])
+dnl CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE
+dnl -------------------------------------------------
+dnl Verifies if the compiler is capable of handling the
+dnl size of a struct member, struct which is a function
+dnl result, as a compilation-time condition inside the
+dnl type definition of a constant array.
+
+AC_DEFUN([CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [
+ AC_REQUIRE([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])dnl
+ AC_MSG_CHECKING([if compiler struct member size checking works])
+ tst_compiler_check_one_works="unknown"
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ struct mystruct {
+ int mi;
+ char mc;
+ struct mystruct *next;
+ };
+ struct mystruct myfunc();
+ typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1 ];
+ typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ];
+ ]],[[
+ good_t1 dummy1;
+ good_t2 dummy2;
+ ]])
+ ],[
+ tst_compiler_check_one_works="yes"
+ ],[
+ tst_compiler_check_one_works="no"
+ sed 's/^/cc-src: /' conftest.$ac_ext >&6
+ sed 's/^/cc-err: /' conftest.err >&6
+ ])
+ tst_compiler_check_two_works="unknown"
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ struct mystruct {
+ int mi;
+ char mc;
+ struct mystruct *next;
+ };
+ struct mystruct myfunc();
+ typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1 ];
+ typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ];
+ ]],[[
+ bad_t1 dummy1;
+ bad_t2 dummy2;
+ ]])
+ ],[
+ tst_compiler_check_two_works="no"
+ ],[
+ tst_compiler_check_two_works="yes"
+ ])
+ if test "$tst_compiler_check_one_works" = "yes" &&
+ test "$tst_compiler_check_two_works" = "yes"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([compiler fails struct member size checking.])
+ fi
+])
+
+
dnl CURL_VAR_MATCH (VARNAME, VALUE)
dnl -------------------------------------------------
dnl Verifies if shell variable VARNAME contains VALUE.