How to disable dependency tracking in configure script

I am trying to create a library with a different build system, but the files in the library require the config.h header file, which is created after running the configure scripts generated by autoconf.

This is the sequence of steps that I follow to try to generate the required config.h file

 autoreconf -ivf ./configure --disable-dependency-tracking 

The build system ensures that the gflags library is linked and the headers will be available during preprocessing. But configure script exits with the following error

 configure: error: Please install google-gflags library 

Is there a way to get a list of required libraries (e.g. gflags) and then pass arguments to a configure script that tells it to assume that this library exists on the system? I went through the help output for both autoreconf and ./configure and could not figure it out.

Sorry for the detailed explanations and problems. I am very new to autoconf etc.

+5
source share
2 answers

The answer to your question: no, it is not possible to get a list of dependencies on autotools.

Why?

Well, autotools does not track dependencies at all. Instead, it checks for specific functions in the system (for example, a given header file or a given library file). Now a particular header file can come from many sources, for example. depending on your distribution, the header foo.h can be set via

  • libfoo-dev (Debian and derivatives)
  • foo-devel (Fedora)
  • foo (upstream)
  • ...

In your particular case, the developers of your project will display a good error message telling you to install this package by name.

The drafters of your project also decided to abandon the fatal error if this dependency is not available. The reason may be that the project simply will not work without this dependency, and this is impossible without compiling the program.

Example

Your project can be written in C++ and, therefore, you need a C++ compiler. Obviously, when transmitting some flags it is not enough to use. / configure, therefore, assumes that there is a C ++ compiler if it really isn’t.

There is hope

However, not everything is bad. Your configure script may be able to disable certain functions (apparently these are strict default requirements).

Just check ./configure --help and find flags like

  • --enable-FOO
  • --disable-FOO
  • --with-BAR
  • --without-BAR

automation?

One thing that autotools needs to know is that configure really is a program ( configure.ac source code) written in some secret programming language (involving bash and m4 ), which means that it can practically have any behavior, and there’s no single standard way to achieve dependency tracking.

+5
source

What you are trying to do will not work, as the umlaut has already said. On the other hand, depending on the package you are trying to build, you might say ./configure that this library exists, even if it is not.

For example, if the script uses pkg-config to check for the presence of the library, you can use FOO_CFLAGS and FOO_LIBS to override the presence check and say “yes, these packages are there, you just don’t know how to find them”, but they are very specific to the package. therefore, you may need to provide additional information if this is what you are looking for.

+2
source

Source: https://habr.com/ru/post/1262124/


All Articles