From: Martin Willi Date: Wed, 15 Jan 2014 16:01:24 +0000 (+0100) Subject: configure: Check if __attribute__((packed)) works as expected X-Git-Tag: 5.2.0dr6~24^2~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4161ee66783b665e2a6222373cc13305dd3f8019;p=thirdparty%2Fstrongswan.git configure: Check if __attribute__((packed)) works as expected This is really hard to detect if not, and is not unlikely. If -mms-bitfields is given, the attribute does not work. Even worse, that switch is by default on with GCC/MinGW 4.7+ for Windows targets. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 --- diff --git a/configure.ac b/configure.ac index ca5c636683..4e714237cf 100644 --- a/configure.ac +++ b/configure.ac @@ -755,6 +755,17 @@ AC_COMPILE_IFELSE( AC_SUBST(OPENSSL_LIB, [-l$openssl_lib]) AM_CONDITIONAL(USE_WINDOWS, [test "x$windows" = xtrue]) +AC_MSG_CHECKING([for working __attribute__((packed))]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], [[ + struct test { char a; short b; } __attribute__((packed)); + char x[sizeof(struct test) == sizeof(char) + sizeof(short) ? 1 : -1]; + return 0; + ]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]); AC_MSG_ERROR([__attribute__((packed)) does not work])] +) + if test x$printf_hooks = xvstr; then AC_CHECK_LIB([vstr],[main],[LIBS="$LIBS"],[AC_MSG_ERROR([Vstr string library not found])],[]) AC_DEFINE([USE_VSTR], [], [use Vstr string library for printf hooks])