summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-10-08 22:22:52 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-10-08 22:22:52 (EDT)
commitfb96a4650e82f79eb0afb26e45c0ff77f1013228 (patch)
treec37db1719b010320bc694a61a315bd3602198ed6
parentfbc574413b2bbc7417d2baca1b9878916a19ed6c (diff)
Improve non-option argument handling in configure.
-rwxr-xr-xconfigure12
1 files changed, 10 insertions, 2 deletions
diff --git a/configure b/configure
index b9ddeb9..4e8d03a 100755
--- a/configure
+++ b/configure
@@ -71,6 +71,11 @@ ${features}"
main()
{
parse_options "${@}"
+ shift ${optind}
+ if [ ${#} -ne 0 ]; then
+ print_usage
+ exit
+ fi
for dep in ${dep_cmds}; do
dep_name="$(printf '%s' "${dep}" | tr -c '[a-z0-9]' '_')"
@@ -181,6 +186,8 @@ EOF
parse_options()
{
+ optind=0
+
for _opt; do
# Handle arguments of "--opt arg" options.
@@ -234,8 +241,7 @@ parse_options()
_type='option'
;;
*)
- printf 'unrecognized option: %s\n' "${_opt}" >&2
- exit 1
+ break
;;
esac
@@ -253,6 +259,8 @@ EOF
_prev="${_opt}"
fi
+ optind=$(($optind + 1))
+
done
}