[MPlayer-dev-eng] configure options to select flavor target type for compilation

Gianluigi Tiesi mplayer at netfarm.it
Tue Jan 24 20:06:08 CET 2006


On Mon, Jan 23, 2006 at 12:49:15PM +0100, Diego Biurrun wrote:
> On Mon, Jan 23, 2006 at 03:58:23AM +0100, Gianluigi Tiesi wrote:
> > I build 3 different versions of mplayer/mencoder in my windows
> > port, my platform is athlon so I need to patch config.h and config.mak
> > to target different cpu.
> > 
> > I was thinking about an option like:
> > --flavor=pentium4
> > --flavor=pentium3
> > etc
> > this may be applied also to non x86 versions if needed.
> > this should set the appropriate mmx/sse/3dnow flags into
> > config.h and config.mak.
> > Since the x86 platforms are not so much it should be easy
> > to add such option. I can look at it if intrested.
> 
> Let's see it.
> 
> Diego
> 
Take a look at this patch:
the syntax is --flavor=pentium4
the check will be made against:
$host_arch-$cc_vendor-$_flavor

so specifying pentium4 we have to match:
i386-gnu-pentium4

this assures that gcc is used and that the correct platform (i386/ia64
etc) is picked, really the correct entry for this should be $target_arch
but it contains other stuff.
I've noticed that gcc2.x doesn't support athlon-xp so I'm using athlon
on this compiler, I was wondering if current configure works with gcc 2.x

The flavor option is disabled when using --enable-runtime-cpudetection

I'm not sure about athlon-xp extensions so check it, also how about
mtrr?

more targets (even non x86) to come, tell me what you think about :)

Bye

-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/
-------------- next part --------------
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.1129
diff -u -r1.1129 configure
--- configure	23 Jan 2006 10:16:48 -0000	1.1129
+++ configure	24 Jan 2006 19:00:19 -0000
@@ -346,6 +346,7 @@
                          use --with-install instead.
 
 Advanced options:
+  --flavor=system        build for a specified target system [disable]
   --enable-mmx           build with MMX support [autodetect]
   --enable-mmx2          build with MMX2 support (PIII, Athlon) [autodetect]
   --enable-3dnow         build with 3DNow! support [autodetect]
@@ -1608,6 +1609,7 @@
 _musepack=auto
 _vstream=auto
 _pthreads=yes
+_flavor=none
 for ac_option do
   case "$ac_option" in
   # Skip 1st pass
@@ -1988,6 +1990,9 @@
     _sighandler=no
     ;;
 
+  --flavor=*)
+    _flavor=`echo $ac_option | cut -d '=' -f 2`
+    ;;
   --enable-sse)	_sse=yes ;;
   --disable-sse) _sse=no ;;
   --enable-sse2) _sse2=yes ;;
@@ -2242,6 +2247,75 @@
     fi
 fi
 
+if test "$_runtime_cpudetection" = no ; then
+    case "$host_arch-$cc_vendor-$_flavor" in
+        *-none) ;; # No flavor, standard build
+        i386-gnu-pentium4)
+         _mmx=yes
+         _mmx2=yes
+         _3dnow=no
+         _3dnowex=no
+         _sse=yes
+         _sse2=yes
+         _mcpu=$cpuopt=pentium4
+         _march=-march=pentium4
+         ;;
+        i386-gnu-pentium3)
+         _mmx=yes
+         _mmx2=yes
+         _3dnow=no
+         _3dnowex=no
+         _sse=yes
+         _sse2=no
+         _mcpu=$cpuopt=pentium3
+         _march=-march=pentium3
+         ;;
+        i386-gnu-pentium2)
+         _mmx=yes
+         _mmx2=no
+         _3dnow=no
+         _3dnowex=no
+         _sse=no
+         _sse2=no
+         _mcpu=$cpuopt=pentium2
+         _march=-march=pentium2
+         ;;
+        i386-gnu-athlon)
+         _mmx=yes
+         _mmx2=yes
+         _3dnow=yes
+         _3dnowex=yes
+         _sse=no
+         _sse2=no
+         _mcpu=$cpuopt=athlon
+         _march=-march=athlon
+         ;;
+        i386-gnu-athlon-xp)
+         _mmx=yes
+         _mmx2=yes
+         _3dnow=yes
+         _3dnowex=yes
+         _sse=yes
+         _sse2=yes
+         # gcc 2.x doesn't support athlon-xp
+         if test "$_cc_major" -gt 2 ; then
+             _mcpu=$cpuopt=athlon-xp
+             _march=-march=athlon-xp
+         else
+             _mcpu=$cpuopt=athlon
+             _march=-march=athlon
+         fi
+         ;;
+        *)
+         echo "Invalid/unsupported target system $host_arch-$cc_vendor-$_flavor"
+         exit 1
+         ;;
+    esac
+    if test "$_flavor" != none ; then
+        _optimizing="Custom Target $_flavor"
+    fi
+fi
+
 _def_mmx='#undef HAVE_MMX'
 test "$_mmx" = yes && _def_mmx='#define HAVE_MMX 1'
 _def_mmx2='#undef HAVE_MMX2'


More information about the MPlayer-dev-eng mailing list