Is it possible to use Autotools on LIBS subproject?

I have an autoconf + automake recursive project that is structured like this:

+
|- configure.ac
|- Makefile.am
|- Makefile.in
|- ...
|-- (subdir1) --+
|               |- Makefile.am
|               |- source.c
|               |- ...
|
|-- (subdir2) --+
|               |- Makefile.am
                |- source.c
                |- ...

      

The top-level config / Makefile checks to see if various libraries are available (AC_CHECK_LIB) and then builds the libraries in the subdirectors (if selected).

The problem is that the LIBS variable passed on each subdir type contains the concatenation of all the required libraries, that is:

# each subdir sees:
LIBS = -lfoo -lbar -lbaz -lbif

      

But I want:

# subdir1 gets
LIBS = -lfoo -lbar

# subdir2 gets
    LIBS = -lbaz -lbif

      

Is there a mechanism for pointing to the LIBS subproject?

+3


source to share


1 answer


In your toplevel Makefile.am use the variable name for the library

LIBFOO = -lfoo



LIBBAR = -lbar

in subdirectories related to $ (LIBFOO) and $ (LIBBAR)

+2


source







All Articles