patch to scripts/Configure in 2.0.3[01]

Larry M. Augustin (lma@varesearch.com)
Wed, 4 Jun 1997 13:42:12 -0700


GNU expr changed in 1.15. The new Configure script (kernel 2.0.30 and
up) fails with older expr versions. The older (in 2.0.27 kernels and
older) Configure script fails with GNU expr 1.15 and newer. Here's a
patch to make Configure work with both new and old expr.

Larry

--- /user/kernel/linux2.0.30-gcc2.7.2/linux-2.0.30/scripts/Configure Tue Apr 8 08:47:48 1997
+++ Configure Wed Jun 4 13:32:27 1997
@@ -46,6 +46,9 @@
# 090397 Axel Boldt (boldt@math.ucsb.edu) - avoid ? and + in regular
# expressions for GNU expr since version 1.15 and up use \? and \+.

+# 040697 Larry Augustin (lma@varesearch.com) - integer expr test
+# fails with GNU expr 1.12. Re-write to work with new and old expr.
+
#
# Make sure we're really running bash.
#
@@ -285,13 +288,20 @@
# int processes an integer argument
#
# int question define default
-#
+# GNU expr changed handling of ?. In older versions you need ?,
+# in newer you need \?
+OLD_EXPR=`expr "0" : '0\?'`
+if [ $OLD_EXPR -eq 1 ]; then
+ INT_EXPR='0$\|-\?[1-9][0-9]*$'
+else
+ INT_EXPR='0$\|-?[1-9][0-9]*$'
+fi
function int () {
old=$(eval echo "\${$2}")
def=${old:-$3}
while :; do
readln "$1 ($2) [$def] " "$def" "$old"
- if expr "$ans" : '0$\|\(-[1-9]\|[1-9]\)[0-9]*$' > /dev/null; then
+ if expr "$ans" : $INT_EXPR > /dev/null; then
define_int "$2" "$ans"
break
else