From dd373b48310b9cb7dd9702aea3803eb0cb0de197 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 28 Sep 2002 23:52:52 +0000 Subject: [PATCH] Instead of forcing -fnative-struct into CFLAGS when using gcc for Win32, 2002-09-29 Tor Lillqvist * configure.in: Instead of forcing -fnative-struct into CFLAGS when using gcc for Win32, check for gcc version 3.x which uses -mms-bitfields instead. Also check if either of these switches is actually available at all, and warn if not. Thanks to Soren Andersen for the inspiration. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-12 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ configure.in | 37 +++++++++++++++++++++++++++++++------ 8 files changed, 73 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9496b01a6..25b33d451 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2002-09-29 Tor Lillqvist + * configure.in: Instead of forcing -fnative-struct into CFLAGS + when using gcc for Win32, check for gcc version 3.x which uses + -mms-bitfields instead. Also check if either of these switches is + actually available at all, and warn if not. Thanks to Soren + Andersen for the inspiration. + * HACKING: Say we require autoconf 2.52 as that is what configure.in does. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 9496b01a6..25b33d451 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,11 @@ 2002-09-29 Tor Lillqvist + * configure.in: Instead of forcing -fnative-struct into CFLAGS + when using gcc for Win32, check for gcc version 3.x which uses + -mms-bitfields instead. Also check if either of these switches is + actually available at all, and warn if not. Thanks to Soren + Andersen for the inspiration. + * HACKING: Say we require autoconf 2.52 as that is what configure.in does. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 9496b01a6..25b33d451 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,5 +1,11 @@ 2002-09-29 Tor Lillqvist + * configure.in: Instead of forcing -fnative-struct into CFLAGS + when using gcc for Win32, check for gcc version 3.x which uses + -mms-bitfields instead. Also check if either of these switches is + actually available at all, and warn if not. Thanks to Soren + Andersen for the inspiration. + * HACKING: Say we require autoconf 2.52 as that is what configure.in does. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 9496b01a6..25b33d451 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,5 +1,11 @@ 2002-09-29 Tor Lillqvist + * configure.in: Instead of forcing -fnative-struct into CFLAGS + when using gcc for Win32, check for gcc version 3.x which uses + -mms-bitfields instead. Also check if either of these switches is + actually available at all, and warn if not. Thanks to Soren + Andersen for the inspiration. + * HACKING: Say we require autoconf 2.52 as that is what configure.in does. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 9496b01a6..25b33d451 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,5 +1,11 @@ 2002-09-29 Tor Lillqvist + * configure.in: Instead of forcing -fnative-struct into CFLAGS + when using gcc for Win32, check for gcc version 3.x which uses + -mms-bitfields instead. Also check if either of these switches is + actually available at all, and warn if not. Thanks to Soren + Andersen for the inspiration. + * HACKING: Say we require autoconf 2.52 as that is what configure.in does. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 9496b01a6..25b33d451 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,11 @@ 2002-09-29 Tor Lillqvist + * configure.in: Instead of forcing -fnative-struct into CFLAGS + when using gcc for Win32, check for gcc version 3.x which uses + -mms-bitfields instead. Also check if either of these switches is + actually available at all, and warn if not. Thanks to Soren + Andersen for the inspiration. + * HACKING: Say we require autoconf 2.52 as that is what configure.in does. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 9496b01a6..25b33d451 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,11 @@ 2002-09-29 Tor Lillqvist + * configure.in: Instead of forcing -fnative-struct into CFLAGS + when using gcc for Win32, check for gcc version 3.x which uses + -mms-bitfields instead. Also check if either of these switches is + actually available at all, and warn if not. Thanks to Soren + Andersen for the inspiration. + * HACKING: Say we require autoconf 2.52 as that is what configure.in does. diff --git a/configure.in b/configure.in index 1ed8d1ed8..85941848b 100644 --- a/configure.in +++ b/configure.in @@ -227,13 +227,38 @@ else fi fi -# Ensure -fnative-struct is used when compiling for Win32 -if test "x$glib_native_win32" = "xyes"; then - if test "x$GCC" = "xyes"; then - case " $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"$glib_native_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