summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2017-04-07 13:34:10 +0200
committerUlf Hermann <[email protected]>2017-05-02 12:43:15 +0000
commit764dfcb97f5728cb7f4a20f38b3df5f8bd00e05f (patch)
tree30b16069a01cdb363bdccd53b6b1f73f03ea9bdd /configure.ac
parentcb951df3eaff5228d3900f38b71e550425b72670 (diff)
Make sure packed structs follow the gcc memory layout
On windows gcc by default generates code that follows the MSVC layout. We don't want that as it adds extra padding. Change-Id: I92efe5da2a2ad818783707ee96a9b8e0eb606dbd Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac13
1 files changed, 13 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index e45584ea..e4b2946d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,6 +185,19 @@ if test "$ac_cv_visibility" = "yes"; then
[Defined if __attribute__((visibility())) is supported])
fi
+AC_CACHE_CHECK([whether gcc supports __attribute__((gcc_struct))],
+ ac_cv_gcc_struct, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$save_CFLAGS -Werror"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl
+struct test { int x; } __attribute__((gcc_struct));
+])], ac_cv_gcc_struct=yes, ac_cv_gcc_struct=no)
+CFLAGS="$save_CFLAGS"])
+if test "$ac_cv_gcc_struct" = "yes"; then
+ AC_DEFINE([HAVE_GCC_STRUCT], [1],
+ [Defined if __attribute__((gcc_struct)) is supported])
+fi
+
AC_CACHE_CHECK([whether gcc supports -fPIC], ac_cv_fpic, [dnl
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -fPIC -Werror"