Re: [gtkmm] Re: [sigc] Building libsigc++ under Win32 for use with Intel C++ Compiler 6.0



At Wed, 06 Nov 2002 08:23:10 +0100,
Cedric Gustin wrote:
> 
> At 07:47 AM 11/6/2002 +0000, Dirk Gerrits wrote:
> 
> >Someone replied to my gtkmm-list post privately (not sure if he wants to 
> >remain anonymous) saying that the libraries should be compatible with MSVC 
> >and Intel if they are compiled using -mms-bitfields with GCC/MinGW.
> 
> -mms-bitfields (the old -fnative-struct) makes the gtk+-2.0 library 

Cedric, I would suggest that you should submit a patch for the latest
mingw (gcc 3.2).

For example, the following patch against gtkmm-2.0.0 is based on the
latest gtk's configure.in. It is not tested yet, but I think it works
with mingw 2.0.

Regards,
--Naofumi

ms-struct-packing.patch:
==============================================================================
--- gtkmm-2.0.0.orig/configure.in	2002-10-31 23:35:51.000000000 +0900
+++ gtkmm-2.0.0/configure.in	2002-11-06 16:47:10.000000000 +0900
@@ -154,16 +154,40 @@
 #########################################################################
 AC_PROG_CXX
 
-changequote(,)dnl
-if test "x$GXX" = "xyes"; then
-  if test "x$os_win32" = "xyes"; then
-    case "$CXX $CXXFLAGS " in
-    *[[\ \	]]-fnative-struct[[\ \	]]*) ;;
-    *) CXXFLAGS="$CXXFLAGS -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
+      CXXFLAGS="$CXXFLAGS $msnative_struct"
+      AC_MSG_RESULT([${msnative_struct}])
+    fi
   fi
 fi
-changequote([,])dnl
 
 AC_LANG_CPLUSPLUS
 
==============================================================================



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]