Subject: bug#25371: sed-4.3: Build fails when build in a separate directory and --disable-dependency-tracking is used.

From: Jim Meyering <[email-masked]>
Date: Sun, 8 Jan 2017 19:02:55 +0100

On Sat, Jan 7, 2017 at 6:24 AM, Assaf Gordon <[email-masked]> wrote:
> Hi,
>
>> On Jan 6, 2017, at 10:16, Assaf Gordon <[email-masked]> wrote:
>>
>> On 01/05/2017 08:34 PM, Juan Manuel Guerrero wrote:
>>> I have tried to build sed in a separate build directory using the option
>>> --disable-dependency-tracking.
>>
>> Creating the directories manually is sufficient to work-around this, e.g.:
>> [...]
>>    mkdir lib sed
>> [...]
>> So we can easily add similar commands for 'sed' and 'lib' directories
>> (I'm just looking for the optimal place to add this).
>
> I came up with this (creating the subdirs from 'configure').
> This works in and out of tree, and with --disable-dependency-tracking.
>
> Jim,
> What do you think?
> I couldn't find a simple target in the makefile that would create the subdirectories before anything else, yet not force a rebuild of everything every time.
> For comparison, in 'coreutils' there is
>    $(AM_V_at)${MKDIR_P} src
> repeated several times in src/local.mk.

Hi Assaf,

That sounds fine. However, please apply this touch-up patch to add
"[]" quotes around each argument and to adjust the comment. Also, I
prefer to run these commands before the AC_OUTPUT, so that if any of
them fails, we do not create a Makefile.

Thank you for working on this.
diff --git a/configure.ac b/configure.ac
index 60a21d6..9974e53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -294,16 +294,16 @@ if test "$gl_gcc_warnings" = yes; then
   AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
 fi

+# This is needed when building outside the source dir
+# with --disable-dependency-tracking, see https://bugs.gnu.org/25371
+AS_MKDIR_P([lib])
+AS_MKDIR_P([sed])
+AS_MKDIR_P([doc])
+AS_MKDIR_P([testsuite])
+
 AC_CONFIG_FILES([
   Makefile
   po/Makefile.in
   gnulib-tests/Makefile
 ])
 AC_OUTPUT
-
-# This is needed when building outside the source dir
-# with -disable-dependency-tracking , see https://bugs.gnu.org/25371
-AS_MKDIR_P(lib)
-AS_MKDIR_P(sed)
-AS_MKDIR_P(doc)
-AS_MKDIR_P(testsuite)