comparison gnulib-tool @ 39193:6feb46ed08f6

gnulib-tool: Make --conditional-dependencies work better. Reported by Dmitry Selyutin <ghostman.sd@gmail.com>. * gnulib-tool (Options): Don't reject the combination of --conditional-dependencies with --with-tests. (func_emit_autoconf_snippets): Add argument referenceable_modules. Don't reference $modules. (func_import, func_create_testdir): Pass it.
author Bruno Haible <bruno@clisp.org>
date Fri, 29 Dec 2017 00:29:23 +0100
parents 55dc3d465b51
children 10eb9086bea0
comparison
equal deleted inserted replaced
39192:fb1fbd01c790 39193:6feb46ed08f6
1503 fi 1503 fi
1504 ;; 1504 ;;
1505 esac 1505 esac
1506 # Now the only possible values of "$inctests" are true and false 1506 # Now the only possible values of "$inctests" are true and false
1507 # (or blank but then it is irrelevant). 1507 # (or blank but then it is irrelevant).
1508 if test "$cond_dependencies" = true && test "$inctests" = true; then
1509 echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
1510 func_exit 1
1511 fi
1512 1508
1513 # Determine the minimum supported autoconf version from the project's 1509 # Determine the minimum supported autoconf version from the project's
1514 # configure.ac. 1510 # configure.ac.
1515 DEFAULT_AUTOCONF_MINVERSION="2.59" 1511 DEFAULT_AUTOCONF_MINVERSION="2.59"
1516 autoconf_minversion= 1512 autoconf_minversion=
4229 echo 'AC_SUBST([LTALLOCA])' 4225 echo 'AC_SUBST([LTALLOCA])'
4230 fi 4226 fi
4231 fi 4227 fi
4232 } 4228 }
4233 4229
4234 # func_emit_autoconf_snippets modules verifier toplevel disable_libtool disable_gettext 4230 # func_emit_autoconf_snippets modules referenceable_modules verifier toplevel disable_libtool disable_gettext
4235 # collects and emit the autoconf snippets of a set of modules. 4231 # collects and emit the autoconf snippets of a set of modules.
4236 # Input: 4232 # Input:
4237 # - local_gnulib_path from --local-dir 4233 # - local_gnulib_path from --local-dir
4238 # - modcache true or false, from --cache-modules/--no-cache-modules 4234 # - modcache true or false, from --cache-modules/--no-cache-modules
4239 # - sed_replace_build_aux sed expression that replaces reference to build-aux 4235 # - sed_replace_build_aux sed expression that replaces reference to build-aux
4240 # - sed_replace_include_guard_prefix 4236 # - sed_replace_include_guard_prefix
4241 # sed expression for resolving ${gl_include_guard_prefix} 4237 # sed expression for resolving ${gl_include_guard_prefix}
4242 # - modules the list of modules. 4238 # - modules the list of modules.
4239 # - referenceable_modules the list of modules which may be referenced as dependencies.
4243 # - verifier one of func_verify_module, func_verify_nontests_module, 4240 # - verifier one of func_verify_module, func_verify_nontests_module,
4244 # func_verify_tests_module. It selects the subset of 4241 # func_verify_tests_module. It selects the subset of
4245 # $modules to consider. 4242 # $modules to consider.
4246 # - toplevel true or false. 'false' means a subordinate use of 4243 # - toplevel true or false. 'false' means a subordinate use of
4247 # gnulib-tool. 4244 # gnulib-tool.
4250 # command line options. 4247 # command line options.
4251 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT 4248 # - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
4252 # invocations. 4249 # invocations.
4253 func_emit_autoconf_snippets () 4250 func_emit_autoconf_snippets ()
4254 { 4251 {
4255 verifier="$2" 4252 referenceable_modules="$2"
4256 toplevel="$3" 4253 verifier="$3"
4257 disable_libtool="$4" 4254 toplevel="$4"
4258 disable_gettext="$5" 4255 disable_libtool="$5"
4256 disable_gettext="$6"
4259 if test "$cond_dependencies" = true; then 4257 if test "$cond_dependencies" = true; then
4260 for m in $modules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/modules 4258 for m in $referenceable_modules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/modules
4261 # Emit the autoconf code for the unconditional modules. 4259 # Emit the autoconf code for the unconditional modules.
4262 for module in $1; do 4260 for module in $1; do
4263 eval $verifier 4261 eval $verifier
4264 if test -n "$module"; then 4262 if test -n "$module"; then
4265 if func_cond_module_p "$module"; then 4263 if func_cond_module_p "$module"; then
5635 func_emit_initmacro_start $macro_prefix 5633 func_emit_initmacro_start $macro_prefix
5636 echo " gl_source_base='$sourcebase'" 5634 echo " gl_source_base='$sourcebase'"
5637 if test -n "$witness_c_macro"; then 5635 if test -n "$witness_c_macro"; then
5638 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])" 5636 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$witness_c_macro])"
5639 fi 5637 fi
5640 func_emit_autoconf_snippets "$main_modules" func_verify_module true false true 5638 func_emit_autoconf_snippets "$main_modules" "$main_modules" func_verify_module true false true
5641 if test -n "$witness_c_macro"; then 5639 if test -n "$witness_c_macro"; then
5642 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])" 5640 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5643 fi 5641 fi
5644 echo " # End of code from modules" 5642 echo " # End of code from modules"
5645 func_emit_initmacro_end $macro_prefix 5643 func_emit_initmacro_end $macro_prefix
5654 echo " ${macro_prefix}tests_WITNESS=IN_\`echo \"\${PACKAGE-\$PACKAGE_TARNAME}\" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'\`_GNULIB_TESTS" 5652 echo " ${macro_prefix}tests_WITNESS=IN_\`echo \"\${PACKAGE-\$PACKAGE_TARNAME}\" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'\`_GNULIB_TESTS"
5655 echo "changequote([, ])dnl" 5653 echo "changequote([, ])dnl"
5656 echo " AC_SUBST([${macro_prefix}tests_WITNESS])" 5654 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
5657 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS" 5655 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
5658 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])" 5656 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
5659 func_emit_autoconf_snippets "$testsrelated_modules" func_verify_module true true true 5657 func_emit_autoconf_snippets "$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true true true
5660 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])" 5658 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
5661 func_emit_initmacro_end ${macro_prefix}tests 5659 func_emit_initmacro_end ${macro_prefix}tests
5662 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is 5660 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
5663 # created using libtool, because libtool already handles the dependencies. 5661 # created using libtool, because libtool already handles the dependencies.
5664 if test "$libtool" != true; then 5662 if test "$libtool" != true; then
6079 func_modules_add_dummy_separately 6077 func_modules_add_dummy_separately
6080 else 6078 else
6081 func_modules_add_dummy 6079 func_modules_add_dummy
6082 fi 6080 fi
6083 6081
6082 # Note:
6083 # If $single_configure, we use the module lists $main_modules and
6084 # $testsrelated_modules; $modules is merely a temporary variable.
6085 # Whereas if ! $configure, the module list is $modules.
6086
6084 # Show banner notice of every module. 6087 # Show banner notice of every module.
6085 if $single_configure; then 6088 if $single_configure; then
6086 modules="$main_modules" 6089 modules="$main_modules"
6087 func_modules_notice 6090 func_modules_notice
6088 else 6091 else
6283 func_emit_initmacro_start $macro_prefix 6286 func_emit_initmacro_start $macro_prefix
6284 # We don't have explicit ordering constraints between the various 6287 # We don't have explicit ordering constraints between the various
6285 # autoconf snippets. It's cleanest to put those of the library before 6288 # autoconf snippets. It's cleanest to put those of the library before
6286 # those of the tests. 6289 # those of the tests.
6287 echo "gl_source_base='../$sourcebase'" 6290 echo "gl_source_base='../$sourcebase'"
6288 func_emit_autoconf_snippets "$modules" func_verify_nontests_module false false false 6291 func_emit_autoconf_snippets "$modules" "$modules" func_verify_nontests_module false false false
6289 echo "gl_source_base='.'" 6292 echo "gl_source_base='.'"
6290 func_emit_autoconf_snippets "$modules" func_verify_tests_module false false false 6293 func_emit_autoconf_snippets "$modules" "$modules" func_verify_tests_module false false false
6291 func_emit_initmacro_end $macro_prefix 6294 func_emit_initmacro_end $macro_prefix
6292 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is 6295 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6293 # created using libtool, because libtool already handles the dependencies. 6296 # created using libtool, because libtool already handles the dependencies.
6294 if test "$libtool" != true; then 6297 if test "$libtool" != true; then
6295 libname_upper=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'` 6298 libname_upper=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
6397 fi 6400 fi
6398 echo "gl_m4_base='$m4base'" 6401 echo "gl_m4_base='$m4base'"
6399 func_emit_initmacro_start $macro_prefix 6402 func_emit_initmacro_start $macro_prefix
6400 echo "gl_source_base='$sourcebase'" 6403 echo "gl_source_base='$sourcebase'"
6401 if $single_configure; then 6404 if $single_configure; then
6402 func_emit_autoconf_snippets "$main_modules" func_verify_module true false false 6405 func_emit_autoconf_snippets "$main_modules" "$main_modules" func_verify_module true false false
6403 else 6406 else
6404 func_emit_autoconf_snippets "$modules" func_verify_nontests_module true false false 6407 func_emit_autoconf_snippets "$modules" "$modules" func_verify_nontests_module true false false
6405 fi 6408 fi
6406 func_emit_initmacro_end $macro_prefix 6409 func_emit_initmacro_end $macro_prefix
6407 if $single_configure; then 6410 if $single_configure; then
6408 echo " gltests_libdeps=" 6411 echo " gltests_libdeps="
6409 echo " gltests_ltlibdeps=" 6412 echo " gltests_ltlibdeps="
6412 # Define a tests witness macro. 6415 # Define a tests witness macro.
6413 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS" 6416 echo " ${macro_prefix}tests_WITNESS=IN_GNULIB_TESTS"
6414 echo " AC_SUBST([${macro_prefix}tests_WITNESS])" 6417 echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
6415 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS" 6418 echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
6416 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])" 6419 echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
6417 func_emit_autoconf_snippets "$testsrelated_modules" func_verify_module true false false 6420 func_emit_autoconf_snippets "$testsrelated_modules" "$main_modules $testsrelated_modules" func_verify_module true false false
6418 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])" 6421 echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
6419 func_emit_initmacro_end ${macro_prefix}tests 6422 func_emit_initmacro_end ${macro_prefix}tests
6420 fi 6423 fi
6421 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is 6424 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
6422 # created using libtool, because libtool already handles the dependencies. 6425 # created using libtool, because libtool already handles the dependencies.