Resolve messages from configure in VPATH build (!103)

Even though this is fixed the execution of configure as part of make
distcheck outputs this:
    checking whether po/Makefile.in.in deletes intltool cache lock file... /usr/bin/grep: po/Makefile.in.in: No such file or directory
    /usr/bin/sed: can't read po/Makefile.in.in: No such file or directory
    /usr/bin/grep: po/Makefile.in.in: No such file or directory
    no

make distcheck [1] performs a VPATH build with a read-only srcdir and
a separate writable build directory with files split between the two.
The relevant layout looks like:
    ./gparted-1.4.0-git/configure
    ./gparted-1.4.0-git/po/Makefile.in.in
    ./gparted-1.4.0-git/_build/sub/

And make distcheck runs configure like this:
    cd ./gparted-1.4.0-git/_build/sub
    ../../configure --srcdir=../..

The file is ../../po/Makefile.in.in in this case, so not found by the
existing check.  A simple investigation technique is to run make
distcheck, kill it shortly after configure completes and examine the
build tree.  Definitely before make distcheck completes successfully and
deletes everything.

Fix by using $srcdir prefix to access the file.  Also handle the case of
po/Makefile.in.in not existing, although this doesn't now occur in the
scenario fixed by this commit.  And only patch the file if it's
writable, another case that doesn't occur in this scenario.

Relevant output line from configure run by make distcheck now looks
like:
    checking whether po/Makefile.in.in deletes intltool cache lock file... yes

[1] GNU Automake, 14.4 Checking the Distribution
    https://www.gnu.org/software/automake/manual/html_node/Checking-the-Distribution.html

Closes !103 - Fix make distcheck failure found in GitLab CI job
              unbuntu_test
This commit is contained in:
Mike Fleetwood 2022-05-31 12:21:04 +01:00 committed by Curtis Gedak
parent 0bd636a34b
commit 053691378c
1 changed files with 6 additions and 3 deletions

View File

@ -64,11 +64,14 @@ dnl needed with intltool >= 0.51.0-5.1, but just always fix as that is
dnl simpler and safe.
AC_MSG_CHECKING([whether po/Makefile.in.in deletes intltool cache lock file])
file='po/Makefile.in.in'
if $FGREP -q '.intltool-merge-cache.lock' "$file"; then
if test ! -f "$srcdir/$file"; then
AC_MSG_RESULT([not applicable])
elif $FGREP -q '.intltool-merge-cache.lock' "$srcdir/$file" 2> /dev/null; then
AC_MSG_RESULT([yes])
else
$SED -i '/rm -f .intltool-merge-cache/s/$/ .intltool-merge-cache.lock/' "$file"
if $FGREP -q '.intltool-merge-cache.lock' "$file"; then
test -w "$srcdir/$file" && \
$SED -i '/rm -f .intltool-merge-cache/s/$/ .intltool-merge-cache.lock/' "$srcdir/$file" 2> /dev/null
if $FGREP -q '.intltool-merge-cache.lock' "$srcdir/$file" 2> /dev/null; then
AC_MSG_RESULT([fixed])
else
AC_MSG_RESULT([no])