[MPlayer-dev-eng] [PATCH] configure: deal with newer head's and tail's dislike of -1
Moritz Bunkus
moritz at bunkus.org
Sat Nov 6 10:31:15 CET 2004
Hey,
> If it gets reversed please take care of the polypaudio configure checks, I
> added afterwards. Didn't notice the broken commit before.
Ah thanks for pointing it out -- I hadn't noticed your commit. Attached
is a patch against current configure.
> I also have to say that I don't like reversing commits with cvs admin
> at all.
Me neither, but it seems to be the primary way of reacting to mistakes
here...
But like Jan said: we can't revert if stuff has been committed on top of
it. So this patch should be considered, not the previous one.
Mosu
--
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds
-------------- next part --------------
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.934
diff -u -u -r1.934 configure
--- configure 5 Nov 2004 14:02:40 -0000 1.934
+++ configure 6 Nov 2004 09:31:13 -0000
@@ -539,14 +539,28 @@
_ldd="otool -L"
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'.
+if test x"`echo '' | head -1 2>&1`" != x ; then
+ _head() { head -$1 ; }
+else
+ _head() { head -n $1 ; }
+fi
+if test x"`echo '' | tail -1 2>&1`" != x ; then
+ _tail() { tail -$1 ; }
+else
+ _tail() { tail -n $1 ; }
+fi
+
# Checking CC version...
if test "$_skip_cc_check" != yes ; then
# Intel C++ Compilers (no autoselect, use CC=/some/binary ./configure)
if test "`basename $_cc`" = "icc" || test "`basename $_cc`" = "ecc"; then
echocheck "$_cc version"
cc_vendor=intel
- cc_name=`( $_cc -V ) 2>&1 | head -n 1 | cut -d ',' -f 1`
- cc_version=`( $_cc -V ) 2>&1 | head -n 1 | cut -d ',' -f 2 | cut -d ' ' -f 3`
+ cc_name=`( $_cc -V ) 2>&1 | _head 1 | cut -d ',' -f 1`
+ cc_version=`( $_cc -V ) 2>&1 | _head 1 | cut -d ',' -f 2 | cut -d ' ' -f 3`
_cc_major=`echo $cc_version | cut -d '.' -f 1`
_cc_minor=`echo $cc_version | cut -d '.' -f 2`
# TODO verify older icc/ecc compatibility
@@ -569,7 +583,7 @@
for _cc in "$_cc" gcc gcc-3.4 gcc-3.3 gcc-3.2 gcc-3.1 gcc3 gcc-3.0 cc ; do
echocheck "$_cc version"
cc_vendor=gnu
- cc_name=`( $_cc -v ) 2>&1 | tail -n 1 | cut -d ' ' -f 1`
+ cc_name=`( $_cc -v ) 2>&1 | _tail 1 | cut -d ' ' -f 1`
cc_version=`( $_cc -dumpversion ) 2>&1`
if test "$?" -gt 0; then
cc_version="not found"
@@ -684,9 +698,9 @@
x86_exts_check()
{
- pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2 | head -n 1`
+ pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2 | _head 1`
if test -z "$pparam" ; then
- pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2 | head -n 1`
+ pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2 | _head 1`
fi
_mmx=no
@@ -715,11 +729,11 @@
_def_arch="#define ARCH_X86 1"
_target_arch="TARGET_ARCH_X86 = yes"
- pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -n 1`
- pvendor=`$_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1`
- pfamily=`$_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1`
- pmodel=`$_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1`
- pstepping=`$_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1`
+ pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | _head 1`
+ pvendor=`$_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1`
+ pfamily=`$_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1`
+ pmodel=`$_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1`
+ pstepping=`$_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | _head 1`
x86_exts_check
@@ -980,7 +994,7 @@
echocheck "CPU type"
if linux && test -n "$_cpuinfo"; then
- proc=`$_cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -b 2- | head -n 1`
+ proc=`$_cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -b 2- | _head 1`
if test -n "`$_cpuinfo | grep altivec`"; then
_altivec=yes
fi
More information about the MPlayer-dev-eng
mailing list