A testdir built like this: ./gnulib-tool --create-testdir --dir=../testdir --without-tests --conditional-dependencies setlocale
fails to build on macOS: ... rm -f libgnu.a ar cr libgnu.a ar: no archive members specified usage: ar -d [-TLsv] archive file ... ar -m [-TLsv] archive file ... ar -m [-abiTLsv] position archive file ... ar -p [-TLsv] archive [file ...] ar -q [-cTLsv] archive file ... ar -r [-cuTLsv] archive file ... ar -r [-abciuTLsv] position archive file ... ar -t [-TLsv] archive [file ...] ar -x [-ouTLsv] archive [file ...] make[4]: *** [libgnu.a] Error 1 make[3]: *** [all-recursive] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 This patch fixes it. 2019-11-18 Bruno Haible <br...@clisp.org> gnulib-tool: Fix build error on macOS with --conditional-dependencies. * gnulib-tool (func_modules_add_dummy): Ignore modules that are conditionally enabled. diff --git a/gnulib-tool b/gnulib-tool index a41522b..28b5bcb 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -3283,18 +3283,24 @@ func_modules_add_dummy () for module in $modules; do func_verify_nontests_module if test -n "$module"; then - # Extract the value of "lib_SOURCES += ...". - for file in `func_get_automake_snippet "$module" | combine_lines | - sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do - # Ignore .h files since they are not compiled. - case "$file" in - *.h) ;; - *) - have_lib_SOURCES=yes - break 2 - ;; - esac - done + if test "$cond_dependencies" = true && func_cond_module_p $module; then + # Ignore conditional modules, since they are not guaranteed to + # contribute to lib_SOURCES. + : + else + # Extract the value of "lib_SOURCES += ...". + for file in `func_get_automake_snippet "$module" | combine_lines | + sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do + # Ignore .h files since they are not compiled. + case "$file" in + *.h) ;; + *) + have_lib_SOURCES=yes + break 2 + ;; + esac + done + fi fi done # Add the dummy module, to make sure the library will be non-empty.