1
votes

I have been tooling around with autotools for the past couple of days, and finally have made significant progress. One problem I am having is that I have two libraries that need to be compiled before the main application code. I'm not quite sure how to do this. My directory structure is below and a snippet from my configure.ac as well.

AC_CONFIG_FILES([Makefile
         src/Makefile
         gtkworkbook/Makefile
         csv/Makefile])
AC_OUTPUT

I need the csv/Makefile and gtkworkbook/Makefile to both be compiled before src/Makefile; is there any way to specify this? Right now I am getting an error about the library (csv) not existing during the application compile process.

1

1 Answers

4
votes

The order of items in AC_CONFIG_FILES() does not affect the build order. If you're using automake, which I assume you are, it will traverse your directory tree in the order that you list directories in each Makefile.am's SUBDIRS list.

That being said, you should have the order of items in AC_CONFIG_FILES() mirror the build order, for consistency/maintainability.

Example of how your toplevel Makefile.am's SUBDIRS to build in the desired order:

SUBDIRS = csv gtkworkbook src

Also, for this simple case you don't need both AC_CONFIG_FILES() and AC_OUTPUT(). You can pass your list directory to AC_OUTPUT():

AC_OUTPUT([
    Makefile
    src/Makefile
    gtkworkbook/Makefile
    csv/Makefile
])