From fb96a4650e82f79eb0afb26e45c0ff77f1013228 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 08 Oct 2012 22:22:52 -0400 Subject: Improve non-option argument handling in configure. --- 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 } -- cgit v0.9.1