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
This commit is contained in:
Martin Willi 2014-01-15 17:01:24 +01:00
parent 37089963b6
commit 4161ee6678
1 changed files with 11 additions and 0 deletions

View File

@ -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])