I've always struggled with auto{conf,make} in the past, but decided that my next project really needs to have some chance of portability.
I'm aware of the famous "Recursive Make Considered Harmful" paper. (see http://www.pcug.org.au/~millerp/rmch/recu-make-cons-harm.html) Searching back through the automake archives hasn't thrown too much light on the subject, nor has the cryptic section in the automake manual entitled "An Alternative approach to subdirectories" that explicitly mentions the "Recursive Make Considered Harmful" paper: (see http://sources.redhat.com/automake/automake.html#Alternative) As far as I can see from extensive searching on Google, all of the examples of setting up non-recursive make systems appear to rely on using GNU make in isolation, without auto{conf,make} The first one that really caught my attention was: http://lists.gnu.org/archive/html/autoconf/2001-08/msg00011.html but does not provide source examples to test and verify how it works. The second one is an almost automatic system which requires only boilerplate sub-Makefiles and minimal editing at the top level, but include resolution and library linking are handled implicitly: http://www.mindcontrol.org/~hplus/makesample.html In makesample, here are two apps, app1 and app2, in two separate directories. app1 needs a header file from the lib1 directory, and app2 needs to link against a library on lib2. I'm wondering whether it is possible to autoconfisticate this *and* retain the non-recursive make side, but so far I can't even get a "standard" autoconfistication to work. So I have 3 questions that I hope someone will be kind enough to help me with: 1. How do I set up the lib2/lib2.a so that app2 can link with it? 2. How do I set up the include of lib1/lib1.h in app1 so that I can configure and make in a directory outside the source tree? 3. How can I set up a non-recursive auto{conf,make} configuration? [The automake "Alternate approach to subdirectories" is unclear, but it seems to me that automake is designed around recursion] Below you will find the results of what I have come up with so far after working through the tutorials at: http://vindaci.members.sonic.net/cbreak/projects/autotools/ http://www.seul.org/docs/autotut/ http://www-src.lip6.fr/homepages/Alexandre.Duret-Lutz/autotools.html Cheers Duncan ################################################################## ## autoconf.ac # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) AM_INIT_AUTOMAKE(makesample, 1.0) AC_CONFIG_SRCDIR([config.h.in]) # AC_CONFIG_HEADER([config.h]) AM_CONFIG_HEADER(config.h) # Checks for programs. AC_PROG_CXX AC_PROG_CC AC_PROG_RANLIB # Checks for libraries. # Checks for header files. # Checks for typedefs, structures, and compiler characteristics. # Checks for library functions. AC_CONFIG_FILES([Makefile app1/Makefile app2/Makefile lib1/Makefile lib2/Makefile]) AC_OUTPUT ################################################################## ## Makefile.am SUBDIRS = lib1 lib2 app1 app2 ################################################################## ## app1/Makefile.am bin_PROGRAMS = app1 app1_SOURCES = app1.cpp ################################################################## ## app2/Makefile.am bin_PROGRAMS = app2 app2_SOURCES = main.cpp app2_LDADD = ../lib2/lib2.a ################################################################## ## lib1/Makefile.am lib_LIBRARIES = lib1.a lib1_a_SOURCES = lib1file.cpp ################################################################## ## lib2/Makefile.am lib_LIBRARIES = lib2.a lib2_a_SOURCES = file-in-lib2.cpp