The equivalent of AM_LDADD is just LDADD . eg.
LDADD = -llibrary test1_SOURCES = ... ... test20_SOURCES = ...
If you need to override LDADD for a specific program: prog , then prog_LDADD will always take precedence.
I always assumed that since the standard LDADD environment variable passed to configure does not exist, as you can see with configure --help , there is no real reason for AM_LDADD . This type makes sense since configure script, and any parameters, for example --with-foo=<path> , should (ideally) work with library dependencies.
On the other hand, passing CFLAGS through configure may still need AM_CFLAGS , which combines CFLAGS with other compiler flags defined by configure script; or even overriding foo_CFLAGS . Because configure should be informed about your custom CFLAGS .
Also, I donโt know, only test<n> programs take only one C ++ source file, but if so, you can simplify Makefile.am with
LDADD = -llibrary check_PROGRAMS = test1 test2 ... test20 AM_DEFAULT_SOURCE_EXT = .cc
as described here .
As for your comment, you can use the convenience library for this purpose, which is especially useful for the general code used by test programs:
noinst_LIBRARIES = libfoo.a # or noinst_LTLIBRARIES = libfoo.la libfoo_a_SOURCES = MyClass.hh MyClass.cc # or libfoo_la_SOURCES LDADD = ./libfoo.a -llibrary # or libfoo.la if using libtool. ... etc ...
source share