[MPlayer-dev-eng] [PATCH] libc5 compatibility

Gabucino gabucino at mplayerhq.hu
Thu Nov 13 01:23:09 CET 2003


I've successfully compiled MPlayer CVS on a RedHat 4.0 libc5 box with
2.0.36 kernel.

Unrelated to MPlayer, I had to compile and install gcc 2.95.3 and newer
binutils.

Some changes were in needed in MPlayer, most of them in the VESA/osdep code.
I've added a generally useful check in configure: it checks for sys/io.h
(assuming x86 && linux) and if it's not found (this libc5 system for example),
it disables vo_vesa, and related parts in lrmi.c and vbelib.c.

I've also added a check for sys/bitypes.h (in case inttypes.h is NOT found),
see the patch for why is that so.

I'm not sure about the change in main/libdha/sysdep/pci_linux.c . It
possibly breaks dha/whatever :) That file (sys/perm.h) is not present on my
libc5 system. Please comment.

No further change was needed:

[root at localhost /]# ldd /usr/local/bin/mplayer 
        libdl.so.1 => /lib/libdl.so.1.7.14
        libm.so.5 => /lib/libm.so.5.0.6
        libc.so.5 => /lib/libc.so.5.3.12

[root at localhost /]# ldd /usr/local/bin/mencoder 
        libdl.so.1 => /lib/libdl.so.1.7.14
        libm.so.5 => /lib/libm.so.5.0.6
        libc.so.5 => /lib/libc.so.5.3.12

-- 
Gabucino
MPlayer Core Team
-------------- next part --------------
diff -Naur main.orig/configure main/configure
--- main.orig/configure	Wed Nov 12 19:01:40 2003
+++ main/configure	Thu Nov 13 00:59:38 2003
@@ -2098,7 +2098,19 @@
   # nothing to do
   :
 else
-  die "cannot find header inttypes.h (see DOCS/HTML/en/faq.html)"
+  echores "no"
+  echocheck "bitypes.h (inttypes.h predecessor)"
+  cat > $TMPC << EOF
+#include <sys/bitypes.h>
+int main(void) { return 0; }
+EOF
+  _inttypes=no
+  cc_check && _inttypes=yes
+  if test "$_inttypes" = yes ; then
+    die "you don't have inttypes.h, but sys/bitypes.h is present. Please copy etc/inttypes.h.link into the include path, and re-run configure."
+  else
+    die "cannot find header either inttypes.h or bitypes.h (see DOCS/HTML/en/faq.html)"
+  fi
 fi
 echores "$_inttypes"
 
@@ -3504,22 +3516,27 @@
 esac
 
 
-if test "$_vesa" != no ; then
 echocheck "VESA support"
+if test "$_vesa" = auto ; then
 if x86 && linux ; then
+  _vesa=no
+  cat > $TMPC << EOF
+#include <sys/io.h>
+int main(void) { return 0; }
+EOF
+  cc_check && _vesa=yes
+fi
+fi
+if test "$_vesa" = yes ; then
   _def_vesa='#define HAVE_VESA 1'
   _vosrc="$_vosrc vo_vesa.c vesa_lvo.c"
   _vomodules="vesa $_vomodules"
   echores "yes"
 else
   _def_vesa='#undef HAVE_VESA'
-  _novomodules="vesa $_novomodules"
   echores "no (not supported on this OS/architecture)"
+  _novomodules="vesa $_novomodules"
 fi
-else
-_def_vesa='#undef HAVE_VESA'
-fi
-
 
 #################
 # VIDEO + AUDIO #
@@ -5877,6 +5894,11 @@
 
 /* use GNU internationalization */
 $_def_i18n
+
+/* missing mmap function on libc5 systems */
+#ifndef MAP_FAILED
+# define MAP_FAILED     ((void *) -1)
+#endif
 
 /* use setlocale() function */
 $_def_setlocale
diff -Naur main.orig/etc/inttypes.h.link main/etc/inttypes.h.link
--- main.orig/etc/inttypes.h.link	Thu Jan  1 01:00:00 1970
+++ main/etc/inttypes.h.link	Thu Nov 13 00:28:23 2003
@@ -0,0 +1,4 @@
+
+// fallback if the user doesn't have inttypes.h (libc5 systems)
+
+#include <sys/bitypes.h>
diff -Naur main.orig/libdha/sysdep/pci_linux.c main/libdha/sysdep/pci_linux.c
--- main.orig/libdha/sysdep/pci_linux.c	Fri Dec 20 22:07:27 2002
+++ main/libdha/sysdep/pci_linux.c	Wed Nov 12 23:48:55 2003
@@ -5,7 +5,7 @@
 */
 #include <errno.h>
 #ifdef __i386__
-#include <sys/perm.h>
+// is this needed? #include <sys/perm.h>
 #else
 #if !defined(__sparc__) && !defined(__powerpc__)
 #include <sys/io.h>
diff -Naur main.orig/osdep/lrmi.c main/osdep/lrmi.c
--- main.orig/osdep/lrmi.c	Wed Nov 12 19:01:41 2003
+++ main/osdep/lrmi.c	Thu Nov 13 00:33:28 2003
@@ -11,6 +11,9 @@
 Original location: http://cvs.debian.org/lrmi/
 */
 
+#include "../config.h"
+#ifdef HAVE_VESA
+
 #include <signal.h>
 #include <stdio.h>
 #include <string.h>
@@ -918,3 +921,4 @@
 	return vret;
 	}
 
+#endif
diff -Naur main.orig/osdep/vbelib.c main/osdep/vbelib.c
--- main.orig/osdep/vbelib.c	Sat May 17 06:47:22 2003
+++ main/osdep/vbelib.c	Thu Nov 13 00:33:53 2003
@@ -7,6 +7,10 @@
    of GNU General Public licence v2.
    Written by Nick Kurshev <nickols_k at mail.ru>
 */
+
+#include <../config.h>
+#ifdef HAVE_VESA
+
 #include "vbelib.h"
 #include "lrmi.h"
 #include <stdlib.h>
@@ -728,3 +732,5 @@
   if(verbose > 1) printf("vbelib: vbeUnmapVideoBuffer(%08lX,%08lX)\n",linear_addr,size);
   munmap((void *)linear_addr,size);
 }
+
+#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20031113/20c761a7/attachment.pgp>


More information about the MPlayer-dev-eng mailing list