[MPlayer-users] cvs snapshot: configure: use of `head -1' and `tail -1' not portable
Jim Meyering
jim at meyering.net
Mon May 26 21:02:35 CEST 2003
Hi,
Thanks for the neat tool!
I noticed that configure uses tail -1 and head -1.
Since that usage is now officially obsolete, as of POSIX 1003.1-2001,
you might want to switch to more modern equivalents.
I've included a suggested patch below.
Or just run this command:
perl -pi.bak -e 's/(head|tail) -1/$1 -n1/' configure
An ugly -- but portable even to very old systems -- alternative
would be to make these changes instead:
old new
head -1 sed q
tail -1 tac|sed q
FYI, I noticed this because I have _POSIX_VERSION=200112 set in my
environment, which makes the GNU coreutils conform to POSIX 1003.1-2001.
Then, running the configure script gave errors like this:
Checking for gcc version ... tail: `-1' option is obsolete; use `-n 1'
Try `tail --help' for more information.
3.3, ok
head: `-1' option is obsolete; use `-n 1'
Try `head --help' for more information.
--- configure.bak 2003-05-25 02:14:16.000000000 +0200
+++ configure 2003-05-26 20:38:44.000000000 +0200
@@ -469,7 +469,7 @@ fi
if test "$_skip_cc_check" != yes ; then
for _cc in "$_cc" gcc-3.1 gcc3 gcc-3.0 cc ; do
echocheck "$_cc version"
- cc_name=`( $_cc -v ) 2>&1 | tail -1 | cut -d ' ' -f 1`
+ cc_name=`( $_cc -v ) 2>&1 | tail -n1 | cut -d ' ' -f 1`
cc_version=`( $_cc -dumpversion ) 2>&1`
if test "$?" -gt 0; then
cc_version="not found"
@@ -569,15 +569,15 @@ if x86 || ppc; then
_cpuinfo="TOOLS/cpuinfo"
fi
- 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`
+ pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -n1`
+ pvendor=`$_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n1`
+ pfamily=`$_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n1`
+ pmodel=`$_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n1`
+ pstepping=`$_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n1`
- pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2 | head -1`
+ pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2 | head -n1`
if test -z "$pparam" ; then
- pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2 | head -1`
+ pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2 | head -n1`
fi
_mmx=no
More information about the MPlayer-users
mailing list