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 9174973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:50:23+00:00 2026-06-17T16:50:23+00:00

Using autoconf in configure.ac I need to append to an output variable. Specifically I

  • 0

Using autoconf in configure.ac I need to append to an output variable.

Specifically I want to append to the LIBS variable differently for each of my programs (myprogram1 and myprogram2 in the Makefile.am). Lets imagine myprogram1 requires a -lboost_python and myprogram2 requires -losg.

Essentially some programs require certain libs while others do not. Here is an example of what I am doing. Of course AC_SUBST does an assignment (= vs +=) from what I understand so that doesn’t work.

AC_CHECK_LIB([boost_python], [main], [AC_SUBST([myprogram1_LIBS], ["-lboost_python"])                      
  AC_DEFINE([HAVE_LIBBOOST_PYTHON], [1], [Define if you have libboost_python])],                  
  [AC_MSG_FAILURE([boost_python library not found])])  
AC_CHECK_LIB([osg], [main], [AC_SUBST([myprogram2_LIBS], ["-losg"])                      
  AC_DEFINE([HAVE_LIBOSG], [1], [Define if you have libosg])],                  
  [AC_MSG_FAILURE([osg library not found])])  

What I need is for the myprogram1_SOURCES to be built with the first lib and the myprogram2_SOURCES to be built with the second lib.

Is there an AC_APPEND_SUBST type macro I can use? And/or is there a better way for me to do what I need to do to build different programs with different libraries being linked?

  • 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-17T16:50:24+00:00Added an answer on June 17, 2026 at 4:50 pm

    I assume that your AC_CHECK_LIB calls and such do the right thing (if they don’t, have you tried using the macros from the autoconf archive (specifically AX_BOOST_PYTHON))? I can’t believe that both boost python and osg provide main.

    Anyway, to answer the question as asked, you don’t have to provide the contents of an AC_SUBST‘d variable all at once, so you can do stuff like this:

    myprogram1_LIBS=""
    AX_BOOST_PYTHON
    myprogram1_LIBS="$myprogram1_LIBS $BOOST_PYTHON_LIB"
    # ...
    AC_SUBST([myprogram1_LIBS])
    

    P.S. the variable to add libraries to a program is LDADD or myprogram1_LDADD.

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

Sidebar

Related Questions

I'm using autoconf for a build. I'd like my configure script to check for
My configure.in file has LT_VERSION=1.1 . I am using the latest version of autoconf
I have a project configured via Autoconf, and I want to start using C++11
I perform some checks during configure, which i set up with autoconf using the
I am using autoconf to detect boost libraries, with the support of the autoconf-archive
I am using autoconf. Right now I have an intermediate .cpp file that is
Using a populated Table Type as the source for a TSQL-Merge. I want to
What are the best practices for using autoconf in conjunction with shared_ptr and other
We are using SCons for all our build need, and we would like to
Is there a autoconf macro to configure generic library that can: generates --with configure

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.