Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7809055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:18:37+00:00 2026-06-02T03:18:37+00:00

I have the following problem with configure.ac: I would like to add a library

  • 0

I have the following problem with configure.ac:

I would like to add a library search path because the libraries I have to use are in some crazy folders. My idea is to do this with an option:

AC_ARG_WITH([cplex-lib-path],
  [AS_HELP_STRING([--with-cplex-libs], [location of the CPLEX library])],
  [CPLEX_LIBS="-L$withval --lcplex"],
  [])

If someone specifies the library path I would of course like to see if the library can be found:

AC_CHECK_LIB([cplex], [CPXcreateprob], [],
[
  AC_MSG_ERROR([Could  not find CPLEX library])
])

However, I would like to add the CPLEX_LIBS to the library search path of AC_CHECK_LIB. Is this somehow possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:18:39+00:00Added an answer on June 2, 2026 at 3:18 am

    It is the user’s responsibilty to tell the configure script where the libraries are. There are many options available to the user, with the most common being:

    configure LDFLAGS=-L/p/a/t/h
    

    There is absolutely no reason for the maintainer to modify the build scripts at all to accomodate a user on this point, and many good reasons for not trying to do anything. If you (as a user) find that your libraries are in many locations, you can set LDFLAGS in your environment, or in a config.site. Your toolchain probably has other mechanisms ( eg, if you are using gcc you can simply set LIBRARY_PATH). The infrastructure provided by autoconf already provides plenty of mechanisms for dealing with this issue, and the package maintainer is better off not reinventing the wheel and providing non-standard interfaces.

    Now that I’ve argued that you should not do what you are trying to do, I’ll tell you how to do it. AC_CHECK_LIB will use the value in LDFLAGS for its search, so you can do:

    LDFLAGS="$LDFLAGS $CPLEX_LIBS"     # this is a bug
    

    and this is wrong because you now have a -l flag in LDFLAGS, but -l arguments belong in LIBS. Also, if you are going to have another library, libfoo, and $FOO_LIBS pointing to a different location, there is simply no way to disambiguate: LDFLAGS will get -L/cplex and -L/foo and the user will not know which one comes first and will not be able to guarantee linkage against one library over the other. In short, do not use CPLEX_LIBS: educate your user to use LDFLAGS. Also, it is more convenient to type:

    configure LDFLAGS='-Lpath1 -Lpath2' 
    

    than it is to type

    configure --with-cplex=path1 --with-foo=path2
    

    and the latter obfuscates things and leads to an uneducated populace. I’ve never understood why people like putting in these –with-lib=/p/a/t/h options in their builds: they provide nothing useful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i have following Problem. I write a Mediawiki Extension where i need some
I would like to use Gwt-Validation with Gwt 2.4.0. I have in my gwt.xml
I have the following problem trying to use a custom config section in my
I would like to use Beyond Compare inside Eclipse. The problem at hand is,
I have following problem: I have to make a ASP.NET Webapplication with a two-row
I have following problem: I have built a tabbar application with 4 tabs. I
I have following problem, Code: String a=Yeahh, I have no a idea what's happening
I am using GWT/JAVA for development. I have following problem: I want to remove
I have the following problem. I have embedded a map using Google Maps' API.
I have the following problem in Cakephp: I maded a CMS to edit the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.