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

  • SEARCH
  • Home
  • 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 8365585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:41:42+00:00 2026-06-09T12:41:42+00:00

I have one project that can generate two diferent applications based on one define.

  • 0

I have one project that can generate two diferent applications based on one define.

libfoo_la_CXXFLAGS = -DMYDEFINE

I have to modify the Makefile.am to set this define, so it is not automatic.

Can I set this define somehow through the configure command?
Is there any other way to set one define using autotools?

  • 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-09T12:41:44+00:00Added an answer on June 9, 2026 at 12:41 pm

    You have to edit the file configure.ac, and before AC_OUTPUT (which is the last thing in the file) add a call to AC_DEFINE.

    In a simple case like yours, it should be enough with:

    AC_DEFINE(MYDEFINE)
    

    If you want to set a value, you use:

    AC_DEFINE(MYDEFINE, 123)
    

    This last will add -DMYDEFINE=123 to the flags (DEFS = in Makefile), and #define MYDEFINE 123 in the generated autoconf header if you use that.

    I recommend you read the documentation from the beginning, and work through their examples and tutorials. Also check other projects’ configure files to see how they use different features.

    Edit: If you want to pass flags on the command line to the make command, then you do something like this:

    libfoo_la_CXXFLAGS = $(MYFLAGS)
    

    Then you call make like this:

    $ make MYFLAGS="-DMYDEFINE"
    

    If you don’t set MYFLAGS on the command line, it will be undefined and empty in the makefile.

    You can also set target-specific CPPFLAGS in Makefile.am, in which case the source files will be recompiled, once for each set of flags:

    lib_LTLIBRARIES = libfoo.la libbar.la
    libfoo_la_SOURCES = foo.c
    libfoo_la_CPPFLAGS = -DFOO
    libbar_la_SOURCES = foo.c
    libbar_la_CPPFLAGS = -DBAR
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project that generates applications for two targets. One of the targets
i have done some learning on struts based on one project that i got.Now
In one of my iPhone projects, I have three views that you can move
I currently have one project that currently contains multiple packages. These packages make up
I have one project inside that I have SqlServerFunctions in test.cs file. code: [Microsoft.SqlServer.Server.SqlFunction]
I have one project which has RIAService with entity framework that is referenced to
We have a project that uses HP Quality Center and one of the regular
I have a large-ish project that contains one class that reads from a file
i have a project that links with ICSharpCode.SharpZipLib.dll (the dll itself doesn't matter). one
I have accumulated an ASP.NET project that was running everything off of one page

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.