[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Detect --disable-dependency-tracking in Makefile.am
From: |
Nick Bowler |
Subject: |
Re: Detect --disable-dependency-tracking in Makefile.am |
Date: |
Sat, 30 Sep 2023 20:59:36 -0400 |
On 2023-09-29, Dave Hart <davehart@gmail.com> wrote:
> I'm guessing someone has trod this ground before. I'd appreciate
> pointers to examples of how others have detected
> --disable-dependency-tracking to change their build behavior.
Two suggestions, one relying on Automake internals and one not:
Suggestion 1) It is technically undocumented, but longstanding Automake
behaviour is that dependency tracking is internally implemented using an
Automake conditional called AMDEP. So you can literally just write in
Makefile.am:
if AMDEP
# stuff to do when dependency tracking is available
else
# stuff to do when dependency tracking is unavailable or disabled
endif
Suggestion 2) All explicit --enable-foo/--disable-foo arguments to
a configure script are available in shell variables; in the case of
--disable-dependency-tracking you can do something like this in
configure.ac:
AM_CONDITIONAL([NO_DEPS], [test x"$enable_dependency_tracking" = x"no"])
then in Makefile.am:
if NO_DEPS
# stuff to do when dependency tracking is disabled
else
# stuff to do otherwise
endif
Note that these approaches are different in the case where dependency
tracking is disabled because it is not supported by the user's tools,
rather than by explicit request. This may or may not matter for your
use case.
Hope that helps,
Nick