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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:37:16+00:00 2026-05-20T06:37:16+00:00

I know when I install a Linux app from source ,I execute ./configure –sysconfdir=/etc

  • 0

I know when I install a Linux app from source ,I execute ./configure --sysconfdir=/etc, then this app’s conf file(such as httpd.conf) will goto /etc.

But from the view of source code, how do source code know the conf file is under /etc when parse it. I mean the code like fopen("/../../app.conf", "r"); is determined before we install it, will the configure file change source code or some other mechanism exist ?

  • 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-05-20T06:37:17+00:00Added an answer on May 20, 2026 at 6:37 am

    The configure script will generate the necessary Makefile that will use the C compiler’s -DMACRO=content functionality to essentially inject C preprocessor #define MACRO content statements into the compilation units. So, sysconfdir could be used via Make rules:

    foo.o: foo.c
            $(CC) -DCONFDIR=$(sysconfdir) -o $@ $<
    

    (That says to build the foo.o object file when foo.c is updated; to build it, use the $(CC) variable to run the C compiler, define CONFDIR with the contents of $(sysconfdir) (supplied via the ./configure script), put output into the target file ($@) and give the source file ($<) as the lone input to the compiler.))

    Then the C code in foo.c could use it like this:

     FILE *conf;
     if (conf = fopen(CONFDIR "/foo", "r")) {
         /* read config file */
     } else {
         /* unable to open config, either error and die or supply defaults */
     }
    

    Note the C string concatenation is performed before compiling the program — super convenient for exactly this kind of use.

    More details here: http://www.gnu.org/software/hello/manual/autoconf/Installation-Directory-Variables.html#Installation-Directory-Variables

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

Sidebar

Related Questions

Does anyone know where is the .htaccess file located after I install in linux
I would like to know how to install TBB from source and make it
How do I know where to install my .pc file? These files are put
I am trying to install hmatrix on my Ubuntu Linux machine (don't know if
I wanted to know how would I be able to transfer files from linux
I'm following this article to install qt for embedded linux on my host machine
Hi there thanks for looking into this. after a clean install of Linux ubuntu
I am completely new to Linux and am having trouble installing rvm. From https://rvm.io/rvm/install/
Does anyone know how to install MonoGame on Mac. I have been looking around
So I know that to install a PHP librabry usually you install it in

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.