Search code examples
configureautotools

Adding an option to the configure


ALL,

I want to try and add an option to my configure script in my project.

For an example I'm looking at the library I'm using for development - wxWidgets.

wxWidgets have their options set and parsed inside configure.in file.

My project doesn't have this file instead it has configure.ac file which AFAIU, I should modify.

And then it just a matter of using proper syntax for parsing the arguments, which I can pick up from the sample.

Is this correct?

My project generates configure and Makefile by Anjuta.

TIA!!


Solution

  • configure.in is an old name for the primary input file to Autoconf. The preferred name for the same file is now configure.ac. You do not need or want both. Whichever you have, yes, is the one you would want to modify to add arguments to the generated configure script.

    The Autoconf macros you would want to use are AC_ARG_WITH for a --with-foo argument or AC_ARG_ENABLE for an --enable-foo argument.

    Of course, adding the argument is the easy part. For it to be useful, you will need also to write the code that gives the option its desired effect. Perhaps the example code you are looking at will be a sufficient resource for that, but I am skeptical. At least, this is probably not a cut & paste kind of situation.