bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21106: AC_SUBST([FOO_LIB], ['libfoo.la']) breaks dependency checker


From: Gavin Smith
Subject: bug#21106: AC_SUBST([FOO_LIB], ['libfoo.la']) breaks dependency checker
Date: Tue, 21 Jul 2015 23:01:03 +0100

On 21 July 2015 at 21:17, Stanislav Brabec <address@hidden> wrote:
> I just wanted to make an option to link the program either against
> in-package instance or external instance.
>
> To make things as easy as possible, I wanted to define FOO_LIB in
> configure.ac either as 'libfoo.la' or '-lfoo' using e. g.:
>
> AC_SUBST([FOO_LIB], ['libfoo.la'])
>
> and then in Makefile.am use just:
>
> myprogram_LDADD = $(FOO_LIB)
>
> Everything works well except parallel build. It seems that dependency
> checker is not able to see such dependency, and if I try to compile the
> project with "make -j7", it fails:
>
> libtool:   error: cannot find the library 'libfoo.la' or unhandled argument 
> 'libfoo.la'
>
> Plain "make" works.
>
> Is it a bug or expected behavior?
>
> Is there any better way how to do such things than use
>
> if USE_BUILTIN_LIBFOO
> myprogram_LDADD = libfoo.la
> else
> myprogram_LDADD = -lfoo
> endif
>
> everywhere I need to link with libfoo?

It seems similar to the questions of conditional sources, which is
covered in the Automake manual. It suggests two approaches, one with
Automake conditionals, which you imply you don't like; the other
similar to the approach you've been trying with a *.la file in the
place of a *.o file, with the exception that the Automake manual uses
an EXTRA_myprogram_SOURCES variable.

I don't know if adding "EXTRA_myprogram_SOURCES = libfoo.c" (or
"EXTRA_myprogram_SOURCES = $(libfoo_la_SOURCES)") is the right
solution?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]