Mercurial > dropbear
comparison configure.ac @ 1088:f2a3570b5110
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).
author | Gaël PORTAY <gael.portay@gmail.com> |
---|---|
date | Sat, 02 May 2015 13:33:34 +0200 |
parents | ca71904cf3ee |
children | ef67b57fe438 |
comparison
equal
deleted
inserted
replaced
1082:3cb73e8d6122 | 1088:f2a3570b5110 |
---|---|
263 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [ | 263 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [ |
264 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 264 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
265 #include <sys/types.h> | 265 #include <sys/types.h> |
266 #include <sys/socket.h> | 266 #include <sys/socket.h> |
267 ]], | 267 ]], |
268 [[ struct sockaddr_storage s; ]])], | 268 [[ if (sizeof(struct sockaddr_storage)) return 0 ]])], |
269 [ ac_cv_have_struct_sockaddr_storage="yes" ], | 269 [ ac_cv_have_struct_sockaddr_storage="yes" ], |
270 [ ac_cv_have_struct_sockaddr_storage="no" ] | 270 [ ac_cv_have_struct_sockaddr_storage="no" ] |
271 ) | 271 ) |
272 ]) | 272 ]) |
273 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then | 273 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then |
277 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [ | 277 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [ |
278 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 278 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
279 #include <sys/types.h> | 279 #include <sys/types.h> |
280 #include <netinet/in.h> | 280 #include <netinet/in.h> |
281 ]], | 281 ]], |
282 [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])], | 282 [[ if (sizeof(struct sockaddr_in6)) return 0 ]])], |
283 [ ac_cv_have_struct_sockaddr_in6="yes" ], | 283 [ ac_cv_have_struct_sockaddr_in6="yes" ], |
284 [ ac_cv_have_struct_sockaddr_in6="no" ] | 284 [ ac_cv_have_struct_sockaddr_in6="no" ] |
285 ) | 285 ) |
286 ]) | 286 ]) |
287 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then | 287 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then |
291 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [ | 291 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [ |
292 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 292 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
293 #include <sys/types.h> | 293 #include <sys/types.h> |
294 #include <netinet/in.h> | 294 #include <netinet/in.h> |
295 ]], | 295 ]], |
296 [[ struct in6_addr s; s.s6_addr[0] = 0; ]])], | 296 [[ if (sizeof(struct in6_addr)) return 0 ]])], |
297 [ ac_cv_have_struct_in6_addr="yes" ], | 297 [ ac_cv_have_struct_in6_addr="yes" ], |
298 [ ac_cv_have_struct_in6_addr="no" ] | 298 [ ac_cv_have_struct_in6_addr="no" ] |
299 ) | 299 ) |
300 ]) | 300 ]) |
301 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then | 301 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then |
306 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 306 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
307 #include <sys/types.h> | 307 #include <sys/types.h> |
308 #include <sys/socket.h> | 308 #include <sys/socket.h> |
309 #include <netdb.h> | 309 #include <netdb.h> |
310 ]], | 310 ]], |
311 [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])], | 311 [[ if (sizeof(struct addrinfo)) return 0 ]])], |
312 [ ac_cv_have_struct_addrinfo="yes" ], | 312 [ ac_cv_have_struct_addrinfo="yes" ], |
313 [ ac_cv_have_struct_addrinfo="no" ] | 313 [ ac_cv_have_struct_addrinfo="no" ] |
314 ) | 314 ) |
315 ]) | 315 ]) |
316 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then | 316 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then |