When bootstrap invokes gnulib-tool, it sets aux-dir, doc-base, m4-base, source-base and tests-base to equivalent directories under a temporary directory, ._bootmp. It later moves these files back under the top level hierarchy. However, gnulib-tool also uses these paths to calculate relative paths when writing Makefile.am for tests. The change in path results in these relative paths being incorrect.
gnulib-tool already includes a --dir option, which causes it to create files under an alternate hierarchy. However, it assumes that the alternate hierarchy contains configure.{ac,in}. This patch causes gnulib-tool to search --dir and the current directory (in that order) for configure.{ac,in}. This allows bootstrap to pass ._bootmp to gnulib-tool as an argument to --dir, and pass the correct paths for other directories. This results in relative paths being calculated correctly, and makes bootstrap marginally less kludgy. * gnulib-tool: Search current directory after destdir for configure.{ac,in} * build-aux/bootstrap: Use gnulib-tool --dir to write to .bootmp --- build-aux/bootstrap | 11 ++++++----- gnulib-tool | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/build-aux/bootstrap b/build-aux/bootstrap index e9ec11e..55147d7 100755 --- a/build-aux/bootstrap +++ b/build-aux/bootstrap @@ -817,12 +817,13 @@ mkdir $bt $bt2 || exit gnulib_tool_options="\ --import\ --no-changelog\ - --aux-dir $bt/$build_aux\ - --doc-base $bt/$doc_base\ + --dir $bt\ + --aux-dir $build_aux\ + --doc-base $doc_base\ --lib $gnulib_name\ - --m4-base $bt/$m4_base/\ - --source-base $bt/$source_base/\ - --tests-base $bt/$tests_base\ + --m4-base $m4_base/\ + --source-base $source_base/\ + --tests-base $tests_base\ --local-dir $local_gl_dir\ $gnulib_tool_option_extras\ " diff --git a/gnulib-tool b/gnulib-tool index 9461027..bdfef63 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -1313,7 +1313,8 @@ fi configure_ac="$destdir/configure.in" fi fi - else + fi + if test -z "$configure_ac"; then if test -f configure.ac; then configure_ac="configure.ac" else @@ -5573,16 +5574,28 @@ s/\([.*$]\)/[\1]/g' test -d "$destdir" \ || func_fatal_error "destination directory does not exist: $destdir" + configure_ac= # Prefer configure.ac to configure.in. + # Prefer a version in $destdir to a version in the current directory if test -f "$destdir"/configure.ac; then configure_ac="$destdir/configure.ac" else if test -f "$destdir"/configure.in; then configure_ac="$destdir/configure.in" + fi + fi + if test -z "$configure_ac"; then + if test -f configure.ac; then + configure_ac="configure.ac" else - func_fatal_error "cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory" + if test -f configure.in; then + configure_ac="configure.in" + fi fi fi + if test -z "$configure_ac"; then + func_fatal_error "cannot find $destdir/configure.ac - make sure you run gnulib-tool from within your package's directory" + fi # Analyze configure.ac. guessed_auxdir="." -- 1.7.4