a newbie question about autoconf&automake

Posted on 2003-02-27
Medium Priority
Last Modified: 2010-04-21

   How to setup configure.in so that compiler compile only files that have been updated?

Question by:zollen
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

blytkerchan earned 200 total points
ID: 8079604
autoconf is not the one that checks which files are updated and which aren't - that's Make's job.

Once you've set up a configure.ac (or configure.in) file for your project, (and, if you want to use automake, a Makefile.am file) you can run the following to "bootstrap"

$ aclocal
(which sets up aclocal.m4 which autoconf will use)

$ autoheader
(if you use a config.h file, this will generate config.h.in for you)

$ autoconf
(this will generate the configure script for you)

$ automake --add-missing --foreign --copy
(this will generate the Makefile.in from the Makefile.am)

If you don't want to use automake, you'll have to make a Makefile.in file yourself. The --add-missing option will copy any needed & missing files (the --copy makes it copy, without it there will be symlinks, which will work too); the --foreign supresses the need of strictly adhering to the GNU coding standards.

Once you've done that, you can run ./configure to configure your compilation - which means a Makefile will be generated and, if you've chosen to have one generated, a config.h file will be generated as well. After that, (and this is the answer you were apparently looking for) you run
$ make
any time you want to re-compile. You don't do the whole bootstrap & configure again because that will outdate all your source files - you only do that if you need to (and, if you use automake, it will be done automagically). Make will look which files are out of date and re-build whatever they depend on.

Now, for the contents of your configure.in file, you don't really need much. You might want to use
$ autoscan
to get the skeleton of a configure.in file with most of the checks you will beed.

As for your Makefile.am file, you can do something like this:

foo_SOURCES=foo.c bar.c
foo_HEADERS=foo.c bar.h

which will (after bootstrapping) make a Makefile that you can use to build foo out of foo.c and bar.c.

"bootstrapping" is the term we generally use for the aclocal && autoheader && autoconf && automake stuff - which you would normally put in a script file called "bootstrap".

If you need more info than this, just let me know.


Expert Comment

ID: 14216302
Hello everyone,

I am just getting into programing for linux, coming from a Visual Studio / Windows world.  First off, I am using kdevelop.  I selected the wizard that gives you a hello world c++ command line program.  I have left it alone, and tried to build it.  No go.  I get this error:

/bin/sh /home/johng/helloworld/admin/missing --run automake --gnu helloworld/Makefile
aclocal.m4:3009: your implementation of AM_INIT_AUTOMAKE comes from an
aclocal.m4:3009: old Automake version. You should recreate aclocal.m4
aclocal.m4:3009: with aclocal and run automake again.

Also, anyone know of any good books or good sources of info for using the kdevelop enviroment?

Thank you,
John Gjonola

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question