René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

autotools: small example

The smallest possible 'autotool' project requires two manually created files: Makefile.am and configure.in.

Start

main.c

#include <stdio.h>

int main() {
  printf("small autotool example\n");
}

Makefile.am

bin_PROGRAMS=smallexample
smallexample_SOURCES=main.c
  

configure.in

#include <stdio.h>

int main() {
  printf("autotool example\n");
}
These three files are currently the only files in the current directory:
aclocal
autoconf
This creates ./configure
autoconf
configure.in: required file `./install-sh' not found
configure.in: required file `./mkinstalldirs' not found
configure.in: required file `./missing' not found
Makefile.am: required file `./COPYING' not found
Makefile.am: required file `./INSTALL' not found
Makefile.am: required file `./NEWS' not found
Makefile.am: required file `./README' not found
Makefile.am: required file `./AUTHORS' not found
Makefile.am: required file `./ChangeLog' not found
Makefile.am: required file `./depcomp' not found
So, we have to run automake with the --add-missing (or -a for short) flag.
Additionally, the INSTALL, NEWS, README, COPYING, AUTHORS and ./ChangeLog files need to be created:
touch INSTALL NEWS README AUTHORS ChangeLog
automake -a
Now, ./configure is ready be executed. The files can now be tarred and installed on another location.