Thursday, February 09, 2006

AC_CONFIG_HEADERS vs AM_CONFIG_HEADERS

I'm using autoconf and automake to deal with building issues in my software, CEP. The move was not by choice, but by necessity for interaction with other tools. It has been nothing but a pain.

Autoconf and automake have a config file which is built out of macros. Two of those macros are AC_CONFIG_HEADERS and AM_CONFIG_HEADERS. Now, here's the fun part. To use autoconf, you need to use the former. To use automake, you need to use the later. Either tool will barf processing the config file if the other is present (with error messages like `automake requires `AM_CONFIG_HEADER', not `AC_CONFIG_HEADER', which tell you how to fix the problem but not the root cause). This means that you'd need to edit the config file every time you built the software. Unfortunately, even that workaround eventually failed: the "configure" script installed an automatic dependency check into the makefile, which would try to do an automake and autoconf run to verify changes (read: any time CVS touched files). So the software would not build. Google found zero help for this problem.

Turns out, it was due to a version inconsistency between autoconf and automake. Debian keeps multiple simultaneous versions of these tools around because they have different behavior and certain code will only work with one version. My problem was that while I had installed the
newer version (automake1.9) it hadn't replaced version 1.4, and nothing had changed. As soon as I got rid of automake version 1.4, suddenly everything worked.

Lessons learned: (1) when google can't find a solution, it's something very strange. (2) You should blog it so people can find it in google later (3) Automake, autoconf, and debian are really annoying sometimes.

3 comments:

-m said...

Hi there. Your blog helped! I was attempting to build a glade C++ project with automake 1.4 on ubuntu. The same issue was happening - a simple 'apt-get install automake1.9' and 'apt-get remove automake1.4' solved the issue.

Many thanks,

-m

X said...

Your blog helped me too! I was getting crazy!

I had automake1.4 and automake1.7

Unknown said...

I had the same problem with OSX / XCode. Thanks for blogging about this -- Google now comes up with something useful!