My apologies for the novice nature of my question, but I'm quite unfamiliar
with autotools, and I'm failing a bit at filling the gap in documentation
between "hello world" and the full gnu manuals.
I'm trying to get an autobuild system working for a fairly large codebase,
and the recursion and targets are giving me trouble. There are several
subdirectories for library sources of varying depth. Simplified, I have
something like:
+topdir
--+libsrcdir
--+libsrcsubdir1
--+libsrcsubdir2
Each libsrcsubdir has several sources that get compiled to 1 library each.
I'd like these to end up in +topdir/lib/ with no depth (e.g. topdir/lib/
lib1.la, topdir/lib/lib2.la, etc).
My current files look like so (everything is in C++):
topdir/configure.ac:
AC_INIT([amtest], [1.0])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AM_CONFIG_HEADER(config.h)
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_CONFIG_SUBDIRS(libsrcdir)
AC_OUTPUT(Makefile)
topdir/Makefile.am:
SUBDIRS = libsrcdir
topdir/libsrcdir/configure.ac:
AC_INIT([amtest],[1.0])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AM_CONFIG_HEADER(config.h)
topdir/libsrcdir/Makefile.am:
AUTOMAKE_OPTIONS = foreign
SUBDIRS = libsrcsubdir1 libsrcsubdir2
topdir/libsrcdir/libsrcsubdir1/configure.ac:
AC_INIT([amtest],[1.0])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AM_CONFIG_HEADER(config.h)
AC_PROG_LIBTOOL
AC_OUTPUT(Makefile)
topdir/libsrcdir/libsrcsubdir1/Makefile.am:
AUTOMAKE_OPTIONS = foreign
lib_LTLIBRARIES = libsubdir1.la
libsubdir1_la_SOURCES = (list of source files)
Q1: Every time I run ./configure from the topdir, the system checks
(checking for BSD-compatible....) are re-run every time it gets to a new
subdirectory, making the configure take a long time. How do I remove these
checks when going to a new subdirectory (these are clearly redundant)?
Q2: I'd like all *.h files to end up in /topdir/include/, with depth (e.g.
topdir/libsrcdir/libsrcsubdir1/header1.h -->
topdir/include/libsrcsubdir1/header1.h). How do I accomplish this? I've
tried some things using top_srcdir, but I think I have the recursion messed
up such that the local makefiles think that top_srcdir is whatever directory
it's presently in, if that makes sense.
Q3: I'd like all *.la libraries to end up in /topdir/lib/, without depth
(e.g. topdir/lib/lib1.la).
I'd like to accomplish this by default, without using --prefix ~/topdir/,
but either way is acceptable.
Thanks in advance for helping a novice.
--Mark