# HG changeset patch # User Gaƫl PORTAY # Date 1430566414 -7200 # Node ID f2a3570b511090e2e1ca5864bd98c5f66dde12c4 # Parent 3cb73e8d6122ba87c5afec34cbcf5bd6c079d7f5 Test struct existance against sizeof() operator Instead of declaring an "unused-variable" or "unused-but-set-variable" structure. This avoid unexpected broken configurations when using something like: $ ./configure CFLAGS="-Wall -Wextra -Werror" It causes AC_COMPILE_IFELSE to fail and thus leading to a mismatch configuration (because the CFLAGS are passed to the macro). diff -r 3cb73e8d6122 -r f2a3570b5110 configure.ac --- a/configure.ac Sat May 02 22:59:55 2015 +0800 +++ b/configure.ac Sat May 02 13:33:34 2015 +0200 @@ -265,7 +265,7 @@ #include #include ]], - [[ struct sockaddr_storage s; ]])], + [[ if (sizeof(struct sockaddr_storage)) return 0 ]])], [ ac_cv_have_struct_sockaddr_storage="yes" ], [ ac_cv_have_struct_sockaddr_storage="no" ] ) @@ -279,7 +279,7 @@ #include #include ]], - [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])], + [[ if (sizeof(struct sockaddr_in6)) return 0 ]])], [ ac_cv_have_struct_sockaddr_in6="yes" ], [ ac_cv_have_struct_sockaddr_in6="no" ] ) @@ -293,7 +293,7 @@ #include #include ]], - [[ struct in6_addr s; s.s6_addr[0] = 0; ]])], + [[ if (sizeof(struct in6_addr)) return 0 ]])], [ ac_cv_have_struct_in6_addr="yes" ], [ ac_cv_have_struct_in6_addr="no" ] ) @@ -308,7 +308,7 @@ #include #include ]], - [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])], + [[ if (sizeof(struct addrinfo)) return 0 ]])], [ ac_cv_have_struct_addrinfo="yes" ], [ ac_cv_have_struct_addrinfo="no" ] )