The user must respond to the script configuration where the libraries are located. The user has access to many options, the most common of which are:
configure LDFLAGS=-L/p/a/t/h
There is no reason that the maintainer could modify the build scripts at all to accommodate the user at this stage, and many good reasons did not try to do anything. If you (as a user) find that your libraries are in many places, you can install LDFLAGS in your environment or in config.site. Your toolchain may have other mechanisms (for example, if you use gcc, you can simply set LIBRARY_PATH). The infrastructure provided by autoconf already provides many mechanisms to solve this problem, and it is better for the package developer not to reinvent the wheel and provide non-standard interfaces.
Now that I have argued that you should not do what you are trying to do, I will tell you how to do it. AC_CHECK_LIB will use the value in LDFLAGS for its search so you can:
LDFLAGS="$LDFLAGS $CPLEX_LIBS"
and this is wrong, because now you have the -l
flag in LDFLAGS, but the -l
arguments belong to LIBS
. Also, if you have another library, libfoo and $ FOO_LIBS pointing to a different location, there is simply no way to fix this problem: LDFLAGS will get -L / cplex and -L / foo, and the user will not know which one on the first location and cannot guarantee communication with one library over another. In short, do not use CPLEX_LIBS: train the user to use LDFLAGS. In addition, it is more convenient to enter:
configure LDFLAGS='-Lpath1 -Lpath2'
what to dial
configure --with-cplex=path1 --with-foo=path2
and the latter hides things and leads to an uneducated population. I never understood why people like to embed these --with-lib = / p / a / t / h options in their assemblies: they give nothing.
source share