[MPlayer-dev-eng] [PATCH] 32 bit mplayer on 64 bit system

Reimar Döffinger uvhe at rz.uni-karlsruhe.de
Sun Jan 30 14:30:56 CET 2005


Hi,
the attached patch allows to compile MPlayer as a 32 bit application on
a 64 bit system (if you have all neccessary libs as 32 bit variants).
Is it okay to apply?

Greetings,
Reimar Döffinger
-------------- next part --------------
diff -ur configure configure
--- configure	2005-01-24 22:52:49.000000000 +0100
+++ configure	2005-01-30 12:49:42.885728840 +0100
@@ -298,6 +298,7 @@
                          use --with-install instead.
 
 Advanced options:
+  --enable-32-on-64      compile a 32 bit MPlayer on x86-64
   --enable-mmx           build with MMX support [autodetect]
   --enable-mmx2          build with MMX2 support (PIII, Athlon) [autodetect]
   --enable-3dnow         build with 3DNow! support [autodetect]
@@ -364,6 +365,7 @@
 
 
 # 1st pass checking for vital options
+_32_on_64=no
 _install=install
 _ranlib=ranlib
 _cc=cc
@@ -411,6 +413,12 @@
   --disable-runtime-cpudetection)
     _runtime_cpudetection=no
     ;;
+  --enable-32-on-64)
+    _32_on_64=yes
+    ;;
+  --disable-32-on-64)
+    _32_on_64=no
+    ;;
   --install-path=*)
     _install=`echo $ac_option | cut -d '=' -f 2 | sed 's/\/$//'`"/install"
     ;;
@@ -467,11 +475,15 @@
       i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;;
       ia64) host_arch=ia64 ;;
       x86_64|amd64)
-        if [ "`$_cc -dumpmachine | grep x86_64 | cut -d- -f1`" = "x86_64" -a \
-             -z "`echo $CFLAGS | grep -- -m32`"  ]; then
+        host_arch=i386
+        if test -n "`$_cc -dumpmachine | grep x86_64`" ; then
+          if test -n "`echo $CFLAGS | grep -- -m32`" ; then
+            _32_on_64=yes
+          elif test "$_32_on_64" = "yes" ; then
+            CFLAGS="$CFLAGS -m32"
+          else
           host_arch=x86_64
-        else
-          host_arch=i386
+          fi
         fi
       ;;
       macppc|ppc) host_arch=ppc ;;
@@ -679,6 +691,9 @@
 # out which assembler is used by the $_cc compiler
 if test "$_as" = auto ; then
   _as=`$_cc -print-prog-name=as`
+  if test "$_32_on_64" = "yes" ; then
+    _as="$_as --32"
+  fi
   test -z "$_as" && _as=as
 fi
 
@@ -1411,6 +1426,8 @@
   --as=*) ;;
   --enable-gcc-checking) ;;
   --disable-gcc-checking) ;;
+  --enable-32-on-64) ;;
+  --disable-32-on-64) ;;
   --enable-static*) ;;
   --disable-static*) ;;
   --with-extraincdir=*) ;;
@@ -6415,13 +6432,13 @@
 # Checking for CFLAGS
 _stripbinaries=yes
 if test "$_profile" != "" || test "$_debug" != "" ; then
-  CFLAGS="-W -Wall -O2 $_march $_mcpu $_debug $_profile"
+  CFLAGS="-W -Wall -O2 $_march $_mcpu $CFLAGS $_debug $_profile"
   if test "$_cc_major" -ge "3" ; then
     CFLAGS=`echo "$CFLAGS" | sed -e 's/\(-Wall\)/\1 -Wno-unused-parameter/'`
   fi
   _stripbinaries=no
-elif test -z "$CFLAGS" ; then
-    CFLAGS="-O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
+elif test -z "$CFLAGS" || test x"$CFLAGS" = x" -m32" ; then
+    CFLAGS="-O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer $CFLAGS"
   # always compile with '-g' if .developer:
   if test -f ".developer" ; then
     CFLAGS="-g $CFLAGS"
diff -ur libdha/Makefile libdha/Makefile
--- libdha/Makefile	2005-01-22 01:41:45.000000000 +0100
+++ libdha/Makefile	2005-01-30 13:54:00.723248392 +0100
@@ -52,7 +52,7 @@
 	$(AR) r $(LIBNAME) $(OBJS)
 else
 	#$(CC) -shared $(SONAME_FLAGS) -o $(LIBNAME) $(OBJS) $(LIBS)
-	$(CC) -shared -Wl,-soname -Wl,$(LIBNAME) -o $(LIBNAME) $(OBJS) $(LIBS)
+	$(CC) $(CFLAGS) -shared -Wl,-soname -Wl,$(LIBNAME) -o $(LIBNAME) $(OBJS) $(LIBS)
 	ln -sf $(LIBNAME) $(SHORTNAME)
 	ln -sf $(LIBNAME) $(VSHORTNAME)
 endif
diff -ur loader/Makefile loader/Makefile
--- loader/Makefile	2005-01-22 01:41:48.000000000 +0100
+++ loader/Makefile	2005-01-30 12:58:14.000000000 +0100
@@ -34,8 +34,11 @@
 .c.o:
 	$(CC) $(CFLAGS) $(DEFINES) -c $<
 
+.S.o:
+	$(CC) $(CFLAGS) $(DEFINES) -c $<
+
 libloader.a:  $(LIB_OBJECTS) stubs.s
-	$(CC) -c ./stubs.s -o stubs.o
+	$(CC) $(CFLAGS) -c ./stubs.s -o stubs.o
 ifeq ($(TARGET_OS),OpenBSD)
 	./loader_objfix.sh
 endif
diff -ur mplconf mplconf
--- mplconf	2005-01-22 01:41:36.000000000 +0100
+++ mplconf	2005-01-30 13:21:02.907922024 +0100
@@ -1 +1 @@
-./configure --confdir=/etc/mplayer --prefix=/usr --mandir=/usr/share/man --disable-xinerama --disable-esd --enable-freetype --enable-gui --disable-dga --disable-mad --disable-lirc --disable-lircc --disable-tv --disable-gif
+./configure --confdir=/etc/mplayer --prefix=/usr --mandir=/usr/share/man --disable-xinerama --disable-esd --disable-dga --disable-mad --disable-lirc --disable-lircc --disable-tv --disable-gif --enable-32-on-64 --enable-gui --enable-freetype
diff -ur vidix/drivers/Makefile vidix/drivers/Makefile
--- vidix/drivers/Makefile	2005-01-22 01:41:29.000000000 +0100
+++ vidix/drivers/Makefile	2005-01-30 14:02:22.906904872 +0100
@@ -81,73 +81,73 @@
 	$(CC) -c $(CYBERBLADE_CFLAGS) -o $@ $<
 
 $(CYBERBLADE_VID):     $(CYBERBLADE_OBJS)
-	$(CC) -shared $(CYBERBLADE_OBJS) $(CYBERBLADE_LIBS) -Wl,-soname,$(CYBERBLADE_VID) -o $(CYBERBLADE_VID)
+	$(CC) $(CYBERBLADE_CFLAGS) -shared $(CYBERBLADE_OBJS) $(CYBERBLADE_LIBS) -Wl,-soname,$(CYBERBLADE_VID) -o $(CYBERBLADE_VID)
 
 $(PM3_OBJS):    $(PM3_SRCS)
 	$(CC) -c $(PM3_CFLAGS) -o $@ $<
 
 $(PM3_VID):     $(PM3_OBJS)
-	$(CC) -shared $(PM3_OBJS) $(PM3_LIBS) -Wl,-soname,$(PM3_VID) -o $(PM3_VID)
+	$(CC) $(PM3_CFLAGS) -shared $(PM3_OBJS) $(PM3_LIBS) -Wl,-soname,$(PM3_VID) -o $(PM3_VID)
 
 $(RADEON_OBJS):    $(RADEON_SRCS)
 	$(CC) -c $(RADEON_CFLAGS) -o $@ $<
 
 $(RADEON_VID):     $(RADEON_OBJS)
-	$(CC) -shared $(RADEON_OBJS) $(RADEON_LIBS) -Wl,-soname,$(RADEON_VID) -o $(RADEON_VID)
+	$(CC) $(RADEON_CFLAGS) -shared $(RADEON_OBJS) $(RADEON_LIBS) -Wl,-soname,$(RADEON_VID) -o $(RADEON_VID)
 
 $(RAGE128_OBJS):    $(RAGE128_SRCS)
 	$(CC) -c $(RAGE128_CFLAGS) -o $@ $<
 
 $(RAGE128_VID):     $(RAGE128_OBJS)
-	$(CC) -shared $(RAGE128_OBJS) $(RAGE128_LIBS) -Wl,-soname,$(RAGE128_VID) -o $(RAGE128_VID)
+	$(CC) $(RAGE128_CFLAGS) -shared $(RAGE128_OBJS) $(RAGE128_LIBS) -Wl,-soname,$(RAGE128_VID) -o $(RAGE128_VID)
 
 $(MACH64_OBJS):    $(MACH64_SRCS)
 	$(CC) -c $(MACH64_CFLAGS) -o $@ $<
 
 $(MACH64_VID):     $(MACH64_OBJS)
-	$(CC) -shared $(MACH64_OBJS) $(MACH64_LIBS) -Wl,-soname,$(MACH64_VID) -o $(MACH64_VID)
+	$(CC) $(MACH64_CFLAGS) -shared $(MACH64_OBJS) $(MACH64_LIBS) -Wl,-soname,$(MACH64_VID) -o $(MACH64_VID)
 
 $(NVIDIA_OBJS):    $(NVIDIA_SRCS)
 	$(CC) -c $(NVIDIA_CFLAGS) -o $@ $<
 
 $(NVIDIA_VID):     $(NVIDIA_OBJS)
-	$(CC) -shared $(NVIDIA_OBJS) $(NVIDIA_LIBS) -Wl,-soname,$(NVIDIA_VID) -o $(NVIDIA_VID)
+	$(CC) $(NVIDIA_CFLAGS) -shared $(NVIDIA_OBJS) $(NVIDIA_LIBS) -Wl,-soname,$(NVIDIA_VID) -o $(NVIDIA_VID)
 
 $(GENFB_OBJS):    $(GENFB_SRCS)
 	$(CC) -c $(GENFB_CFLAGS) -o $@ $<
 
 $(GENFB_VID):     $(GENFB_OBJS)
-	$(CC) -shared $(GENFB_OBJS) $(GENFB_LIBS) -Wl,-soname,$(GENFB_VID) -o $(GENFB_VID)
+	$(CC) $(GENFB_CFLAGS) -shared $(GENFB_OBJS) $(GENFB_LIBS) -Wl,-soname,$(GENFB_VID) -o $(GENFB_VID)
 
 $(MGA_OBJS):    $(MGA_SRCS)
 	$(CC) -c $(MGA_CFLAGS) -o $@ $<
 
 $(MGA_VID):     $(MGA_OBJS)
-	$(CC) -shared $(MGA_OBJS) $(MGA_LIBS) -Wl,-soname,$(MGA_VID) -o $(MGA_VID)
+	$(CC) $(MGA_CFLAGS) -shared $(MGA_OBJS) $(MGA_LIBS) -Wl,-soname,$(MGA_VID) -o $(MGA_VID)
 
 $(MGA_CRTC2_OBJS):    $(MGA_CRTC2_SRCS)
 	$(CC) -c $(MGA_CRTC2_CFLAGS) -o $@ $<
 
 $(MGA_CRTC2_VID):     $(MGA_CRTC2_OBJS)
-	$(CC) -shared $(MGA_CRTC2_OBJS) $(MGA_CRTC2_LIBS) -Wl,-soname,$(MGA_CRTC2_VID) -o $(MGA_CRTC2_VID)
+	$(CC) $(MGA_CRTC2_CFLAGS) -shared $(MGA_CRTC2_OBJS) $(MGA_CRTC2_LIBS) -Wl,-soname,$(MGA_CRTC2_VID) -o $(MGA_CRTC2_VID)
 
 $(SIS_OBJS):    $(SIS_SRCS)
 	$(CC) -c $(SIS_CFLAGS) -o $@ $(basename $@).c
 
 $(SIS_VID):     $(SIS_OBJS)
-	$(CC) -shared $(SIS_OBJS) $(SIS_LIBS) -Wl,-soname,$(SIS_VID) -o $(SIS_VID) 
+	$(CC) $(SIS_CFLAGS) -shared $(SIS_OBJS) $(SIS_LIBS) -Wl,-soname,$(SIS_VID) -o $(SIS_VID) 
 
 $(UNICHROME_OBJS):    $(UNICHROME_SRCS)
 	$(CC) -c $(UNICHROME_CFLAGS) -o $@ $<
 
 $(UNICHROME_VID):     $(UNICHROME_OBJS)
-	$(CC) -shared $(UNICHROME_OBJS) $(UNICHROME_LIBS) -Wl,-soname,$(UNICHROME_VID) -o $(UNICHROME_VID)
+	$(CC) $(UNICHROME_CFLAGS) -shared $(UNICHROME_OBJS) $(UNICHROME_LIBS) -Wl,-soname,$(UNICHROME_VID) -o $(UNICHROME_VID)
 
 $(SAVAGE_OBJS):    $(SAVAGE_SRCS)
 	$(CC) -c $(SAVAGE_CFLAGS) -o $@ $<
 
 $(SAVAGE_VID):     $(SAVAGE_OBJS)
-	$(CC) -shared $(SAVAGE_OBJS) $(SAVAGE_LIBS) -Wl,-soname,$(SAVAGE_VID) -o $(SAVAGE_VID)
+	$(CC) $(SAVAGE_CFLAGS) -shared $(SAVAGE_OBJS) $(SAVAGE_LIBS) -Wl,-soname,$(SAVAGE_VID) -o $(SAVAGE_VID)
 
 clean:
 	rm -f *.o *.so *~


More information about the MPlayer-dev-eng mailing list