[MPlayer-dev-eng] [PATCH] AIX PPC mplayer port

Derek E. Lewis dlewis at solnetworks.net
Thu Dec 29 02:12:50 CET 2005


On Wed, 28 Dec 2005, Diego Biurrun wrote:

> Better, but I would prefer if you could just add it to the
> system-specific settings around line 580, you should also add AIX to the
> system name section around line 480.

Fixed, and I had already added an 'AIX' condition on around line 480.

> Maybe you'll wish to add a short chapter to the ports section of our
> documentation, depending on what else has to be taken into account.

I'll definitely write up a document that can be included in the 'ports' 
section; however, I'd like to finish up the port a bit more (as lots of 
issues are still works in progress, and I'd hate to annoy a user with 
constantly changing documentation).

In the patch that I've enclosed, I added the libC condition on line 580 as 
suggested, and I've started work on the CPU determination and optimization 
routines. Some of you might notice that 970 support was added in gcc-3.2, 
and I've required gcc-3.3 for the POWER4 (the 970 and POWER4 are identical 
almost -- the POWER4 lacks Altivec). The gcc changelogs say that POWER4 
support was added in gcc-3.3, despite how similar the POWER4 and 970 are. 
I've also held off with a POWER5 condition until I can find whenever 
POWER5 support was added (guessing gcc-3.4), as the gcc changelogs don't 
say exactly. The same goes for POWER3, although I've went ahead and 
included it under the 'generic, no-test condition' along with the 604e and 
friends, as more users are going to have POWER3's than POWER5's.

Whenever I find some time (probably this weekend), I'll build a few gcc 
versions and figure out which versions support what POWER revisions, so 
we can be certain, and not trouble the user with a non-valid -mcpu 
argument.
-------------- next part --------------
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.1114
diff -u -r1.1114 configure
--- configure	26 Dec 2005 03:16:47 -0000	1.1114
+++ configure	29 Dec 2005 00:58:21 -0000
@@ -75,6 +75,7 @@
 sunos()   { issystem "SunOS"   ; return "$?" ; }
 hpux()    { issystem "HP-UX"   ; return "$?" ; }
 irix()    { issystem "IRIX"    ; return "$?" ; }
+aix()     { issystem "AIX"     ; return "$?" ; }
 cygwin()  { issystem "CYGWIN"  ; return "$?" ; }
 freebsd() { issystem "FreeBSD" ; return "$?" ; }
 netbsd()  { issystem "NetBSD"  ; return "$?" ; }
@@ -479,7 +480,7 @@
   # OS name
   system_name=`uname -s 2>&1`
   case "$system_name" in
-  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS)
+  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS|AIX)
     ;;
   IRIX*)
     system_name=IRIX
@@ -597,6 +598,12 @@
   _ldd="otool -L"
 fi
 
+if aix ; then
+  _ld_libC="-lC"
+else
+  _ld_libC=""
+fi
+
 # Check how to call 'head' and 'tail'. Newer versions spit out warnings
 # if used as 'head -1' instead of 'head -n 1', but older versions don't
 # know about '-n'.
@@ -760,6 +767,9 @@
 elif darwin ; then
   # use hostinfo on Darwin
   _cpuinfo="hostinfo"
+elif aix; then
+  # use 'lsattr' on AIX
+  _cpuinfo="lsattr -E -l proc0"
 elif x86; then
   # all other OSes try to extract CPU information from a small helper
   # program TOOLS/cpuinfo instead
@@ -1181,6 +1191,9 @@
 		;;
 	esac
         ;;
+      AIX)
+	proc=`$_cpuinfo | grep 'type' | cut -f 7 -d ' ' | sed 's/PowerPC_//'` 
+	;;
     esac
     if test "$_altivec" = yes; then
         echores "$proc altivec"
@@ -1198,6 +1211,9 @@
 	    604|604e|604r|604ev) _march='-mcpu=604' _mcpu='-mtune=604' ;;
 	    740|740/750|745/755) _march='-mcpu=740' _mcpu='-mtune=740' ;;
 	    750|750CX) _march='-mcpu=750' _mcpu='-mtune=750' ;;
+	    POWER) _march='-mcpu=power' _mcpu='-mtune=power' ;;
+	    POWER2) _march='-mcpu=power2' _mcpu='-mtune=power2' ;;
+	    POWER3) _march='-mcpu=power3' _mcpu='-mtune=power3' ;;
     	    *) ;;
         esac
 	# gcc 3.1(.1) and up supports 7400 and 7450
@@ -1216,6 +1232,14 @@
     		*) ;;
     	    esac
 	fi
+	# gcc 3.3 and up supports POWER4 
+	if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then
+	    case "$proc" in
+		POWER4) _march='-mcpu=power4' _mcpu='-mtune=power4'
+			_def_dcbzl='#undef NO_DCBZL' ;;
+		*) ;;
+	    esac
+	fi
     fi
 
     if test -n "$_mcpu"; then
@@ -7095,6 +7119,7 @@
 ENCA_LIB = $_ld_enca
 HAVE_PTHREADS = $_pthreads
 MATH_LIB = $_ld_lm
+LIBC_LIB = $_ld_libC
 
 X11_INC = $_inc_x11
 X11DIR = $_ld_x11
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/Makefile,v
retrieving revision 1.333
diff -u -r1.333 Makefile
--- Makefile	16 Nov 2005 10:38:23 -0000	1.333
+++ Makefile	29 Dec 2005 00:58:58 -0000
@@ -395,6 +395,7 @@
                $(ARCH_LIB) \
                $(I18NLIBS) \
                $(MATH_LIB) \
+               $(LIBC_LIB) \
 
 $(PRG):	$(MPLAYER_DEP)
     ifeq ($(TARGET_WIN32),yes)
@@ -424,6 +425,7 @@
                 $(ARCH_LIB) \
                 $(I18NLIBS) \
                 $(MATH_LIB) \
+                $(LIBC_LIB) \
 
 $(PRG_MENCODER): $(MENCODER_DEP)
 	$(CC) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) $(LIBS_MENCODER)
Index: osdep/getch2.c
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/getch2.c,v
retrieving revision 1.21
diff -u -r1.21 getch2.c
--- osdep/getch2.c	25 Dec 2005 18:26:35 -0000	1.21
+++ osdep/getch2.c	29 Dec 2005 00:59:47 -0000
@@ -221,7 +221,7 @@
 void getch2_enable(){
 #ifdef HAVE_TERMIOS
 struct termios tio_new;
-#if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__)
+#if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__) || defined(_AIX)
     tcgetattr(0,&tio_orig);
 #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__)
     ioctl(0,TIOCGETA,&tio_orig);
@@ -232,7 +232,7 @@
     tio_new.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */
     tio_new.c_cc[VMIN] = 1;
     tio_new.c_cc[VTIME] = 0;
-#if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__)
+#if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__) || defined(_AIX)
     tcsetattr(0,TCSANOW,&tio_new);
 #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__)
     ioctl(0,TIOCSETA,&tio_new);
@@ -246,7 +246,7 @@
 void getch2_disable(){
     if(!getch2_status) return; // already disabled / never enabled
 #ifdef HAVE_TERMIOS
-#if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__)
+#if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__) || defined(_AIX)
     tcsetattr(0,TCSANOW,&tio_orig);
 #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__)
     ioctl(0,TIOCSETA,&tio_orig);


More information about the MPlayer-dev-eng mailing list