summaryrefslogtreecommitdiff
path: root/m4/msnative-struct.m4
diff options
context:
space:
mode:
authorAurelien Jarno <aurel32@debian.org>2005-02-03 16:24:20 +0100
committerMattia Rizzolo <mattia@mapreri.org>2014-10-03 14:05:06 +0000
commit825ef604db05e42ea267a86187bf62d54670c98c (patch)
treec41b8addd68e573fcf6ef599ec777e251a130b8e /m4/msnative-struct.m4
parentac8459519a9ef2a1ee635509b52a653da1bfe9d5 (diff)
parent817e6294b42b3e4435f1b99728afc1dca84a6445 (diff)
Imported Debian patch 0.97-3debian/0.97-3
Diffstat (limited to 'm4/msnative-struct.m4')
-rw-r--r--m4/msnative-struct.m448
1 files changed, 48 insertions, 0 deletions
diff --git a/m4/msnative-struct.m4 b/m4/msnative-struct.m4
new file mode 100644
index 0000000..84d773e
--- /dev/null
+++ b/m4/msnative-struct.m4
@@ -0,0 +1,48 @@
+#############################################################
+# when compiling on Win32 we have to add the option
+# -fnative-struct for gcc2 or
+# --mms-bitfields for gcc3
+# parts from glib configure.in
+
+dnl AC_GCC_MSNATIVE_STRUCT
+dnl test if gcc supports option for MSnative struct
+dnl
+AC_DEFUN(AC_GCC_MSNATIVE_STRUCT,
+[dnl
+dnl Add ms native struct gcc option to CFLAGS if available
+dnl
+dnl if test x"$glib_native_win32" = xyes; then
+ AC_CHECK_HEADERS(windows.h,
+ [
+ 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
+dnl fi
+ ])
+])
+