English 中文(简体)
What s the point of aclocal?
原标题:
  • 时间:2009-12-28 18:49:23
  •  标签:
  • autotools

What s the point of the aclocal script and aclocal.m4 file, in context of using autotools to configure source files? From what I read, aclocal scans macro files for macros that are later used by automake. I don t understand this process in depth, but it seems that the scanning functionality could have just been embedded into automake.

最佳回答

See Alexandre Duret Lutz s Autotools tutorial, a must read.

It contains diagrams explaining how the different files of an autotools project interact with each other and by which tool they are used: configure, config.h, config.status, aclocal.m4 etc

EDIT: John Calcote also explains the purpose of aclocal and aclocal.m4 in the first chapter of his book about Autotools: Chapter 1: A brief introduction to the GNU Autotools:

The aclocal utility is actually documented by the GNU manuals as a temporary work-around for a certain lack of flexibility in Autoconf. Autoconf was designed and written first, and then a few years later, the idea for Automake was conceived as an add-on for Autoconf. But Autoconf was really not designed to be extensible on the scale required by Automake.

...

Essentially, aclocal’s job is to create an aclocal.m4 file by consolidating various macro files from installed Autotool packages and user-specified locations, such that Autoconf can find them all in one place.

...

However, the latest documentation from both sets of tools suggests that the entire aclocal/acinclude paradigm is now obsolete, in favor of a newer method of specifying a directory containing m4 macro files. The current recommendation is that you create a directory in your project directory called simply m4 (acinclude seems more appropriate to this author), and add macros in the form of individual .m4 files to this directory. All files in this directory will be gathered into aclocal.m4 before Autoconf processes your configure.ac file. Ultimately, aclocal will be replaced by functionality in Autoconf itself.

问题回答

In my software, aclocal.m4 collects the various non-standard Autoconf macros that I use during the builds of my software. One such set of macros deals with sub-second timing - choosing the best of the available options (according to some pre-determined criterion for what is best ); another such set of macros deals with the intricacies of the IBM Informix ESQL/C compilation system as it has evolved over the last two decades (it handles ESQL/C 5.20, where version 5.00 was released in 1990, and it also handles the latest versions of IBM Informix ClientSDK 3.50 - which, much to my chagrin, contains ESQL/C 3.50 even though it was released in 2008).

So, aclocal.m4 is for local macros that are not necessarily part of regular Autoconf but which are used by your specific software.

The link to John Calcote s article as given by http://freesoftwaremagazine.com/articles/brief_introduction_to_gnu_autotools/. I would have commented on that post but my reputation here is too low.

The essential paragraph:

Essentially, aclocal s job is to create an aclocal.m4 file by consolidating various macro files from installed Autotool packages and user-specified locations, such that Autoconf can find them all in one place.





相关问题
How to install and use libtool shared library (.lo files)?

So after I ran libtool and got out a libfoo.lo and foo.o file from my library source, how do I convert the libfoo.lo file into a normal Linux shared library, like libfoo.so.1.0.0 so I can install and ...

What s the point of aclocal?

What s the point of the aclocal script and aclocal.m4 file, in context of using autotools to configure source files? From what I read, aclocal scans macro files for macros that are later used by ...

Should config.h be made public? Conflict with Python

I am working on a C library that has SWIG bindings to Python. In my autotools configuration, I check for the gettimeofday function. I have discovered that I can t compile the Python portion of my ...

What is the proper way of including linux kernel config?

I m porting an old version of a software that is partly a linux kernel module to EL5, after doing the relevant hacks, the horrible GNU autotools mess that is used to compile the thing (no, it does ...

热门标签