1#############################################################
2# when compiling on Win32 we have to add the option
3# -fnative-struct for gcc2 or
4# --mms-bitfields for gcc3
5# parts from glib configure.in
6
7dnl AC_GCC_MSNATIVE_STRUCT
8dnl test if gcc supports option for MSnative struct
9dnl
10AC_DEFUN(AC_GCC_MSNATIVE_STRUCT,
11[dnl
12dnl Add ms native struct gcc option to CFLAGS if available
13dnl
14dnl  if test x"$glib_native_win32" = xyes; then
15 AC_CHECK_HEADERS(windows.h,
16 [
17    if test x"$GCC" = xyes; then
18      msnative_struct=''
19      AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
20      if test -z "$ac_cv_prog_CC"; then
21        our_gcc="$CC"
22      else
23        our_gcc="$ac_cv_prog_CC"
24      fi
25      case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
26        2.)
27          if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
28            msnative_struct='-fnative-struct'
29          fi
30          ;;
31        *)
32         if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
33           msnative_struct='-mms-bitfields'
34         fi
35         ;;
36      esac
37      if test x"$msnative_struct" = x ; then
38        AC_MSG_RESULT([no way])
39        AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
40      else
41        CFLAGS="$CFLAGS $msnative_struct"
42        AC_MSG_RESULT([${msnative_struct}])
43      fi
44    fi
45dnl  fi
46 ])
47])
48
49