diff options
author | Peter Simons <simons@cryp.to> | 2017-08-01 15:39:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-01 15:39:17 +0200 |
commit | 2dc6131285f45339c2627f0ba152367e561f197e (patch) | |
tree | b264c89e4fb2f2e6436ce89a45773750e4384e82 | |
parent | 55f6f9a88add2010a5ab7bcbd5f715a2801cf272 (diff) | |
parent | 7b3377a72e874a8a38329b5555bb791c48eda5be (diff) | |
download | autoconf-archive-2dc6131285f45339c2627f0ba152367e561f197e.tar.gz |
Merge pull request #126 from harenome/ax_subdirs_configure
AX_SUBDIRS_CONFIGURE: fix empty argument handling
-rw-r--r-- | m4/ax_subdirs_configure.m4 | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/m4/ax_subdirs_configure.m4 b/m4/ax_subdirs_configure.m4 index 43d04fd..55e16c6 100644 --- a/m4/ax_subdirs_configure.m4 +++ b/m4/ax_subdirs_configure.m4 @@ -147,7 +147,7 @@ # You should have received a copy of the GNU General Public License along # with this program. If not, see <https://www.gnu.org/licenses/>. -#serial 2 +#serial 3 AC_DEFUN([AX_SUBDIRS_CONFIGURE], [ @@ -222,33 +222,37 @@ AC_DEFUN([AX_SUBDIRS_CONFIGURE], # different subdirs can have different --enable and --with options. ax_args="--disable-option-checking $ax_args" # Options that must be added as they are provided. - m4_foreach(opt, [$2], [AS_VAR_APPEND(ax_args, " 'opt'") - ]) + m4_ifnblank([$2], [m4_foreach(opt, [$2], [AS_VAR_APPEND(ax_args, " 'opt'") + ])]) # New options that may need to be merged with existing options. - m4_foreach(opt, [$3], + m4_ifnblank([$3], [m4_foreach(opt, [$3], [ax_candidate="opt" ax_candidate_flag="${ax_candidate%%=*}" ax_candidate_content="${ax_candidate#*=}" - if echo "$ax_args" | grep -- "${ax_candidate_flag}=" >/dev/null 2>&1; then - [ax_args=$(echo $ax_args | sed "s,\(${ax_candidate_flag}=[^']*\),\1 ${ax_candidate_content},")] - else - AS_VAR_APPEND(ax_args, " 'opt'") + if test "x$ax_candidate" != "x" -a "x$ax_candidate_flag" != "x"; then + if echo "$ax_args" | grep -- "${ax_candidate_flag}=" >/dev/null 2>&1; then + [ax_args=$(echo $ax_args | sed "s,\(${ax_candidate_flag}=[^']*\),\1 ${ax_candidate_content},")] + else + AS_VAR_APPEND(ax_args, " 'opt'") + fi fi - ]) + ])]) # New options that must replace existing options. - m4_foreach(opt, [$4], + m4_ifnblank([$4], [m4_foreach(opt, [$4], [ax_candidate="opt" ax_candidate_flag="${ax_candidate%%=*}" ax_candidate_content="${ax_candidate#*=}" - if echo "$ax_args" | grep -- "${ax_candidate_flag}=" >/dev/null 2>&1; then - [ax_args=$(echo $ax_args | sed "s,${ax_candidate_flag}=[^']*,${ax_candidate},")] - else - AS_VAR_APPEND(ax_args, " 'opt'") + if test "x$ax_candidate" != "x" -a "x$ax_candidate_flag" != "x"; then + if echo "$ax_args" | grep -- "${ax_candidate_flag}=" >/dev/null 2>&1; then + [ax_args=$(echo $ax_args | sed "s,${ax_candidate_flag}=[^']*,${ax_candidate},")] + else + AS_VAR_APPEND(ax_args, " 'opt'") + fi fi - ]) + ])]) # Options that must be removed. - m4_foreach(opt, [$5], [ax_args=$(echo $ax_args | sed "s,'opt',,") - ]) + m4_ifnblank([$5], [m4_foreach(opt, [$5], [ax_args=$(echo $ax_args | sed "s,'opt',,") + ])]) AS_VAR_APPEND([ax_args], [" '--srcdir=$ac_srcdir'"]) # Add the subdirectory to the list of target subdirectories. |