[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Conditionally overriding variables set by Autoconf
From: |
Marius Bakke |
Subject: |
Re: Conditionally overriding variables set by Autoconf |
Date: |
Wed, 15 Jul 2020 16:48:53 +0200 |
Hi Karl,
Karl Berry <karl@freefriends.org> writes:
> Hi Marius,
>
> Makefile.am:86: warning: pkglibdir was already defined in condition
> TRUE, which includes condition USE_VERSION_LINKS ...
>
> All I can think of to do is introduce a new variable in each branch, and
> define the "built-in" variables outside the conditional. Unfortunately
> this means reproducing Automake's defaults, as far as I can see. As in
> this for Makefile.am (and minimal configure.ac below):
>
> if USE_VERSION_LINKS
> mypkglibdir = $(versiondir)$(libdir)/ganeti
> else
> mypkglibdir = $(libdir)/@PACKAGE@
> endif
> pkglibdir = $(mypkglibdir)
>
> I suspect there is a cleaner way, but I don't have the brains to see
> what it is. I hope someone else here does ... --best, karl.
>
> --- configure.ac ---
> AC_INIT([amin], [0.0], [nowhere@example.net])
> AM_INIT_AUTOMAKE([foreign])
> AM_CONDITIONAL([USE_VERSION_LINKS], [false])
> AC_CONFIG_FILES([Makefile])
> AC_OUTPUT
Thanks a lot for the feedback and minimal reproducer. Ludovic Courtès
came up with a slightly cleaner workaround in a different thread[0]:
pkglibdir =
if USE_VERSION_LINKS
pkglibdir += foo
else
pkglibdir += bar
endif
...which almost works, but when doing:
bindir =
bindir += $(BINDIR)
The $(bindir) variable contains a stray whitespace before the actual
path, resolving to ' /usr/local/bin', which in turn breaks
install-binSCRIPTS because it quotes the installation variables.
Tricky stuff! :-)
[0] https://bugs.gnu.org/42261#38
signature.asc
Description: PGP signature