Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check automake/autoconf version in configure script

Tags:

I'm trying to edit a configure script that will execute this piece of code if it is above Automake version x.xx, and if it isn't, it executes a different piece of code.

So, I need the version to be 1.10 or above, then when it is the case I want to do this:

m4_rename_force([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])

And, otherwise:

m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])

So I would assume it would look something like this (in configure.in):

if test GET_AUTOMAKE_VERSION >= 1.10; then
    m4_rename_force([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
else
    m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) 
fi

Also, should I check for the autoconf or automake version? Possibly both?

like image 420
Michael P. Avatar asked Jan 23 '10 00:01

Michael P.


People also ask

How do I setup a script autoconf?

To create a configure script with Autoconf, you need to write an Autoconf input file `configure.ac' (or `configure.in') and run autoconf on it. If you write your own feature tests to supplement those that come with Autoconf, you might also write files called `aclocal.

What is autoconf in Linux?

Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages. These scripts can adapt the packages to many kinds of UNIX-like systems without manual user intervention.

What is Autotools configure?

Autotools configurationThis file is used by autoconf to create the configure shell script that users run before building. The file must contain, at the very least, the AC_INIT and AC_OUTPUT M4 macros.


2 Answers

It doesn't make any sense to check for the automake version at configure time. The configure script is run long after automake, and may be running on a box on which automake is not installed at all. Write your configure.ac (not configure.in) to use modern automake. The developer who runs autoconf to generate the configure script will need to have modern automake installed. The user who invokes the configure script will not need to have any of the autotools installed at all.

like image 86
William Pursell Avatar answered Sep 30 '22 07:09

William Pursell


For testing the autoconf version I think something like this will work.

m4_version_prereq ( 1.10, 
     m4_rename_force([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]), 
     m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) 
)

I don't know how to do the same for automake.

like image 20
mctylr Avatar answered Sep 30 '22 06:09

mctylr