From 3f7e1f5002b0eec8686924b372e543ab452f9051 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Wed, 6 Mar 2013 18:20:44 +0100 Subject: [PATCH 1/3] Only warn for unknown --enable/--with options Follow the guidelines in and print a *warning* if there is an unknown --enable-* or --with-* option, error otherwise. --disable-option-checking does not turn off the errors, but silences the warnings. --- configure | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 9e057edf..16036b35 100755 --- a/configure +++ b/configure @@ -74,11 +74,17 @@ Try \`$0 --help' for more information EOF } -# exit only if option checking is enabled, otherwise ignore +# notify the user that this argument is not known +unknown_arg () { + cat < Date: Wed, 6 Mar 2013 19:08:09 +0100 Subject: [PATCH 2/3] Allow variables and options in any order Traditionally, options are put before any other command-line arguments. However, dunecontrol puts variable assignment before options, like env, and this confuses getopt. This variant (based on a suggestion by Andreas Lauser) collects the variables into an array at the same time as the options are processed. --- configure | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 16036b35..f2e7d487 100755 --- a/configure +++ b/configure @@ -104,6 +104,9 @@ option_check=yes # this variable will get feature options FEATURES= +# this array will get all variable assignments from command-line +VARS=() + # command that launches cmake; look for 2.8 if available if [ "${CMAKE_COMMAND}" = "" ]; then if which cmake28 >/dev/null 2>&1; then @@ -113,12 +116,10 @@ if [ "${CMAKE_COMMAND}" = "" ]; then fi fi -# long arguments are implemented by putting a dash character followed by -# a colon in the optspec, see trick by Arvid Requate at -# -while getopts -- ":-:" optchar; do - case "${optchar}" in - -) +for OPT in "$@"; do + case "$OPT" in + --*) + OPTARG=${OPT#--} # OPTARG now contains everything after double dashes case "${OPTARG}" in prefix=*) @@ -279,8 +280,12 @@ while getopts -- ":-:" optchar; do ;; esac ;; + [A-Za-z0-9_]*=*) + # collect for further processing later + VARS+=("$OPT") + ;; *) - invalid_arg -$OPTARG + invalid_arg $OPT exit 1 ;; esac @@ -288,8 +293,9 @@ done # remove all arguments processed by getopts shift $((OPTIND-1)) -# remove Autotools-specific variables -for a in "$@"; do +# remove Autotools-specific variables. notice the usage of a quoted +# array: each element will be returned even with spaces. +for a in "${VARS[@]}"; do a="${a/ACLOCAL_*=*/}" [ -n "$a" ] && ENVVARS="$ENVVARS \"${a/\"/\\\"}\"" done From 9bfeb1241033e2d0b318f1d75a04c937c498eff2 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Wed, 6 Mar 2013 19:13:28 +0100 Subject: [PATCH 3/3] Only make actual directory names canonical If the directory that is specified does not exist, then keep the path as entered, which makes for better error messages later. We cannot print an warning on a non-existent name, because it may be target directories that are specified, or perhaps logical options (like --with-mpi=yes) --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index f2e7d487..0080d88a 100755 --- a/configure +++ b/configure @@ -146,7 +146,7 @@ for OPT in "$@"; do eval pkgloc=$(printf "%q" "${pkgloc}") # expand to full path since CMake changes to source directory (!) # this also normalize the path name wrt. not having a trailing slash - pkgloc=$(test -d "${pkgloc}" && sh -c "cd \"${pkgloc}\"; pwd") + test -d "${pkgloc}" && pkgloc=$(sh -c "cd \"${pkgloc}\"; pwd") # special aliases case "${pkgname}" in umfpack)