summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in38
1 files changed, 33 insertions, 5 deletions
diff --git a/configure.in b/configure.in
index e92cf4e870..d7fba08f53 100644
--- a/configure.in
+++ b/configure.in
@@ -257,15 +257,43 @@ if test "x$GCC" = "xyes"; then
*) CFLAGS="$CFLAGS -pedantic" ;;
esac
fi
+fi
+changequote([,])dnl
- if test "$os_win32" = "yes"; then
- case "$CC $CFLAGS " in
- *[[\ \ ]]-fnative-struct[[\ \ ]]*) ;;
- *) CFLAGS="$CFLAGS -fnative-struct" ;;
+# Ensure MSVC-compatible struct packing convention is used when
+# compiling for Win32 with gcc.
+# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
+# gcc2 uses "-fnative-struct".
+if test x"$os_win32" = xyes; then
+ if test x"$GCC" = xyes; then
+ msnative_struct=''
+ AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
+ if test -z "$ac_cv_prog_CC"; then
+ our_gcc="$CC"
+ else
+ our_gcc="$ac_cv_prog_CC"
+ fi
+ case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
+ 2.)
+ if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
+ msnative_struct='-fnative-struct'
+ fi
+ ;;
+ *)
+ if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
+ msnative_struct='-mms-bitfields'
+ fi
+ ;;
esac
+ if test x"$msnative_struct" = x ; then
+ AC_MSG_RESULT([no way])
+ AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
+ else
+ CFLAGS="$CFLAGS $msnative_struct"
+ AC_MSG_RESULT([${msnative_struct}])
+ fi
fi
fi
-changequote([,])dnl
# Honor aclocal flags
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"