Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (6.1k points)
edited by

I do not get it when everything is specified in a makefile then why does ./configure exist?

1 Answer

0 votes
by (11.7k points)

Actually in Linux, whenever the configure script runs:

  • It checks few details of the system on which the software is going to be installed. Almost every required dependency is checked by a script on the system. For the required software to work properly, it may be requiring a lot of stuff to be installed on your machine already. But in case, If any of the major requirements are not present on your system, then configure script would exit and you cannot proceed with the installation until you get those required things.

  • Create the Makefile to be used in the next step.

We can take an instance where AC_CHECK_HEADER([myheader.h], ...) might generate a small C program like:

#include "myheader.h" int main(int argc, char** argv) { return 0; }

When the program compiles, the check is considered "passing" or it "fails". Such checks often get reflected in the config.h file as status. On a passing check, you might find a line in config.h that looks like:

#define HAVE_MYHEADER_H 1

And when the test fails, it can be as follows:

#define HAVE_MYHEADER_H 0

The moment it is configured to work with autoconf in AM_INIT_AUTOMAKE macro, the 

If the result variable is exported, Makefile can also reference the results of the tests. 

Therefore if we need a library that is located a few different typical locations, or the syntax of "what works" with one of your standard tools (like tar, ar, etc) is not the same, or the required tool is unavailable, the Makefile can still build the project properly using the different library locations, the different tool syntax, or tools.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 28, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer
asked Feb 26, 2021 in Linux by sheela_singh (9.5k points)
0 votes
1 answer
asked Dec 17, 2020 in Linux by blackindya (18.4k points)

Browse Categories

...