From 4161ee66783b665e2a6222373cc13305dd3f8019 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Wed, 15 Jan 2014 17:01:24 +0100 Subject: [PATCH] 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 --- configure.ac | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index ca5c63668..4e714237c 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])