Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable tracking of a dependency in configure script

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

This is the sequence of steps I am following to try and generate the config.h file that is needed

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

The build system guarantees that the library gflags will be linked and the headers will be available at preprocessing time. But the configure script exits with the following error

configure: error: Please install google-gflags library

Is there some way I can get the list of required libraries (such as gflags) and then pass arguments to the 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 wasn't able to figure this out.

Sorry for the long explanation and problem. I am very new to autoconf, etc.

like image 235
Curious Avatar asked Dec 31 '16 14:12

Curious


2 Answers

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

Why?

Well, autotools doesn't track dependencies at all. Instead, it checks whether specific features are present on the system (e.g. a given header-file; or a given library file). Now a specific header file can come from a variety of sources, e.g. depending on your distribution the foo.h header can be installed via

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

In your specific case, the maintainers of your project output a nice error message telling you to install a given package by name.

The maintainers of your project also chose to abort with a fatal error if a given dependency is not available. The reason might well be, that the project simply won't work without that dependency, and that is impossible to compile the program without it.

Example

Your project might be written in C++ and thus require a C++-compiler. Obviously there is little use in passing some flags to ./configure so it assumes that there is a C++-compiler available if in reality there is none.

There is hope

However, not all is bad. Your configure script might will have the ability to disable certain features (that appear to be hard requirements by default).

Just check ./configure --help and look for flags like

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

automation?

One thing to know about autotools, is that configure really is a program (the source-code being configure.ac) written in some arcane programming language (involving bash and m4), This means that it can practically have any behavior, and there is no single standard way to achieve "dependecy tracking".

like image 190
umläute Avatar answered Oct 05 '22 15:10

umläute


What you're trying to do will not work as umläute already said. On the other hand, depending on the package you're trying to build, you may be able to tell ./configure that a given library is there even if it isn't.

For instance if the script uses pkg-config to check for the presence of a library, you can use FOO_CFLAGS and FOO_LIBS to override the presence checking and telling it "yes those packages are there, you just don't know how to find them", but these are very package-specific so you may have to provide more information if that's what you're looking for.

like image 31
Diego Elio Pettenò Avatar answered Oct 05 '22 16:10

Diego Elio Pettenò