[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFH] zsh shell function portability issue
From: |
Paolo Bonzini |
Subject: |
[RFH] zsh shell function portability issue |
Date: |
Mon, 13 Oct 2008 11:59:22 +0200 |
User-agent: |
Thunderbird 2.0.0.17 (Macintosh/20080914) |
You will remember the shell function portability issue in zsh...
Do you think that these functions:
ac_func_c_try_compile() {
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
rm -f core conftest.err conftest.$ac_objext
return $ac_retval
}
and
ac_func_c_try_run() {
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_retval=0
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext
conftest.$ac_objext conftest$ac_exeext
return $ac_retval
}
are portable? (Yeah, the code is totally unreadable).
IMO the first should be okay because it only uses (exit ...) to drive an
&& construct. In the second instead, I am worried about this:
(eval "$ac_try") 2>&5
ac_status=$?
but do we need that eval at all? Maybe it can be replaced with a {...}
instead?
Thanks,
Paolo
- [RFH] zsh shell function portability issue,
Paolo Bonzini <=