changeset 3262:4ece9a6d1f37

* configure.in: Traverse the argument list without destroying it; don't use shift. It turns out that "set - ${saved_arguments}" doesn't work portably.
author Jim Blandy <jimb@redhat.com>
date Sat, 29 May 1993 20:07:50 +0000
parents 50b8f8d5f932
children 82b564084ce6
files configure1.in
diffstat 1 files changed, 22 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/configure1.in	Sat May 29 20:02:52 1993 +0000
+++ b/configure1.in	Sat May 29 20:07:50 1993 +0000
@@ -100,8 +100,13 @@
 prefix='/usr/local'
 exec_prefix='${prefix}'
 
-while [ $# != 0 ]; do
-  arg="$1"
+### Don't use shift -- that destroys the argument list, which autoconf needs
+### to produce config.status.  It turns out that "set - ${arguments}" doesn't
+### work portably.
+index=0
+while [ $index -lt $# ]; do
+  index=`expr $index + 1`
+  arg=`eval echo '$'$index`
   case "${arg}" in
 
     ## Anything starting with a hyphen we assume is an option.
@@ -168,13 +173,14 @@
 	  ## If the value was omitted, get it from the next argument.
 	  if [ "${valomitted}" = "yes" ]; then
 	    ## Get the next argument from the argument list, if there is one.
-            if [ $# = 1 ]; then
+            if [ $index = $# ]; then
 	      (echo "${progname}: You must give a value for the \`--${optname}' option, as in
     \`--${optname}=FOO'."
 	       echo "${short_usage}") >&2
 	      exit 1
 	    fi
-	    shift; val="$1"
+            index=`expr $index + 1`
+            val=`eval echo '$'$index`
 	  fi
           srcdir="${val}"
 	;;
@@ -187,13 +193,14 @@
 	  ## If the value was omitted, get it from the next argument.
 	  if [ "${valomitted}" = "yes" ]; then
 	    ## Get the next argument from the argument list, if there is one.
-            if [ $# = 1 ]; then
+            if [ $index = $# ]; then
 	      (echo "${progname}: You must give a value for the \`--${optname}' option, as in
     \`--${optname}=FOO'."
 	       echo "${short_usage}") >&2
 	      exit 1
 	    fi
-	    shift; val="$1"
+            index=`expr $index + 1`
+            val=`eval echo '$'$index`
 	  fi
 	  x_includes="${val}"
 	  C_SWITCH_X_SITE="-I${x_includes}"
@@ -202,13 +209,14 @@
 	  ## If the value was omitted, get it from the next argument.
 	  if [ "${valomitted}" = "yes" ]; then
 	    ## Get the next argument from the argument list, if there is one.
-            if [ $# = 1 ]; then
+            if [ $index = $# ]; then
 	      (echo "${progname}: You must give a value for the \`--${optname}' option, as in
     \`--${optname}=FOO'."
 	       echo "${short_usage}") >&2
 	      exit 1
 	    fi
-	    shift; val="$1"
+            index=`expr $index + 1`
+            val=`eval echo '$'$index`
 	  fi
 	  x_libraries="${val}"
 	  LD_SWITCH_X_SITE="-L${x_libraries}"
@@ -225,13 +233,14 @@
 	  ## If the value was omitted, get it from the next argument.
 	  if [ "${valomitted}" = "yes" ]; then
 	    ## Get the next argument from the argument list, if there is one.
-            if [ $# = 1 ]; then
+            if [ $index = $# ]; then
 	      (echo "${progname}: You must give a value for the \`--${optname}' option, as in
     \`--${optname}=FOO'."
 	       echo "${short_usage}") >&2
 	      exit 1
 	    fi
-	    shift; val="$1"
+            index=`expr $index + 1`
+            val=`eval echo '$'$index`
 	  fi
 	  prefix="${val}"
         ;;
@@ -241,13 +250,14 @@
 	  ## If the value was omitted, get it from the next argument.
 	  if [ "${valomitted}" = "yes" ]; then
 	    ## Get the next argument from the argument list, if there is one.
-            if [ $# = 1 ]; then
+            if [ $index = $# ]; then
 	      (echo "${progname}: You must give a value for the \`--${optname}' option, as in
     \`--${optname}=FOO'."
 	       echo "${short_usage}") >&2
 	      exit 1
 	    fi
-	    shift; val="$1"
+            index=`expr $index + 1`
+            val=`eval echo '$'$index`
 	  fi
 	  exec_prefix="${val}"
         ;;
@@ -269,7 +279,6 @@
     ;;
 
   esac
-  shift
 done
 
 if [ "${configuration}" = "" ]; then
@@ -1148,9 +1157,5 @@
   Where do we find X Windows libraries?                   }${x_libraries}
 
 "
-
-### Restore the arguments to this script, so autoconf can record them
-### in the config.status file.
-set -- ${arguments}
 ]
 AC_OUTPUT(Makefile)