[DVDnav-discuss] r1278 - in trunk/libdvdread: configure.ac configure2

rathann subversion at mplayerhq.hu
Mon Nov 11 22:50:30 CET 2013


Author: rathann
Date: Mon Nov 11 22:50:30 2013
New Revision: 1278

Log:
Fix packed structures with mingw gcc >= 4.7

As of gcc 4.7, structures are packed in a "MS compatible" format by
default.  If you want the correct behavior, you must add
-mno-ms-bitfields to CFLAGS :-\

Original patch provided by John Stebbins
<stebbins AT jetheaddev DOT com>. This patch implemented an idea
that was put forward by Mike Frysinger <vapier AT gentoo DOT org>.

Thanks to both!

configure2 part by myself.

Modified:
   trunk/libdvdread/configure.ac
   trunk/libdvdread/configure2

Modified: trunk/libdvdread/configure.ac
==============================================================================
--- trunk/libdvdread/configure.ac	Mon Nov 11 22:47:33 2013	(r1277)
+++ trunk/libdvdread/configure.ac	Mon Nov 11 22:50:30 2013	(r1278)
@@ -19,6 +19,7 @@ m4_define([dvdread_pre],   [])
 
 AC_INIT([libdvdread], [dvdread_major.dvdread_minor.dvdread_sub[]dvdread_pre])
 AC_CONFIG_SRCDIR([src/dvdread/dvd_reader.h])
+m4_include([m4/ax_check_compile_flag.m4])
 AM_INIT_AUTOMAKE([1.6])
 
 dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
@@ -168,6 +169,11 @@ DEBUG_CFLAGS="-g -DDEBUG $CFLAGS"
 AC_SUBST(DEBUG_CFLAGS)
 
 dnl ---------------------------------------------
+dnl Check for bitfield compiler flag
+dnl ---------------------------------------------
+AX_CHECK_COMPILE_FLAG([-mno-ms-bitfields], [CFLAGS="-mno-ms-bitfields $CFLAGS"])
+
+dnl ---------------------------------------------
 dnl Check for doxygen (dynamic documentation generator)
 dnl ---------------------------------------------
 AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, no)

Modified: trunk/libdvdread/configure2
==============================================================================
--- trunk/libdvdread/configure2	Mon Nov 11 22:47:33 2013	(r1277)
+++ trunk/libdvdread/configure2	Mon Nov 11 22:50:30 2013	(r1278)
@@ -121,6 +121,18 @@ od -A n -t x1 $TMPO | grep -q '42 *49 *4
 rm -rf $TMPD
 echo "$bigendian"
 
+echo -n "Checking for -mno-ms-bitfields flag support... "
+no_ms_bitfields=no
+TMPD=`mktemp -d`
+TMPC=$TMPD/no_ms_bitfields.c
+TMPO=$TMPD/no_ms_bitfields.o
+cat > $TMPC <<EOF
+int main(void) { return 0; }
+EOF
+$cc $optimizations $cflags -mno-ms-bitfields -c -o $TMPO $TMPC && no_ms_bitfields=yes && cflags="$cflags -mno-ms-bitfields"
+rm -rf $TMPD
+echo "$no_ms_bitfields"
+
 cat > config.mak << EOF
 # Automatically generated by configure, do not edit
 PREFIX=$PREFIX


More information about the DVDnav-discuss mailing list