How do I create a configure script?

godzilla picture godzilla · Jun 12, 2012 · Viewed 54.4k times · Source

This may sound like a very generic question but here it goes.

I have a requirement to create a configure script for my application, the result of this configure would be a generated makefile (basic configure, make, make install). My question is, where do I start in building this? Is there an example I can follow?

Answer

dAm2K picture dAm2K · Jun 17, 2012

To create the standard "configure" script you need GNU autoconf. You may need GNU automake and libtool too.

There are tons of documentation and howtos. Google for something like "autoconf automake howto". The good documentation is in the official manual pages:

Autoconf will create your configure script starting from the "configure.ac" file. The "Makefile.am" file will instruct automake on how to create your makefile by the configure string. Libtool is needed to simplify libraries handling around your code.

You can start creating a configure.ac file by hand or you may use the "autoscan" helper that may help you to create something semi-automatic for you.

Then, when you are ready, this one will do the magic:

autoreconf -i