Search code examples
projects-and-solutionsautotoolsautoconfautomake

Can I have multiple configure.ac files and what to do with AC_OUTPUT then?


I have this directory structure:

  • foo
  • foo/libfoo - libfoo project
  • foo/libfoo/src - sources
  • foo/foo - foo project
  • foo/foo/src - sources

There are two separate things that have to be build here, a libtool library (libfoo) and an executable (foo) using that library.

I could just place a configure.ac file into each foo/libfoo and foo/foo and everything would be fine.

However I would like to be able to build both projects at once, so I thought about placing an additional configure.ac into the top level foo directory.

Is this a good idea?

If yes, how would the AC_OUTPUT makro be used in such a case?

Does the top level configure.ac file generate all the Makefiles in the whole tree or are there separate AC_OUTPUT makros in the sub directories that each output there Makefiles?

Since both projects have different dependencies I would think the subdir ac files do the output of their makefiles?

Can the two projects in the sub dirs still be build separately in this case?


Solution

  • There is a AC_CONFIG_SUBDIRS macro that does what I want, it recurses into subdirs and executes the configure.ac files there.

    The sub dir projects can still be build independently.

    My Makefile.am only contains SUBDIRS = libfoo foo now.

    The configure.ac file contains AC_CONFIG_SUBDIRS=([libfoo foo]).