Thread: how to pass ./configure parameters to header files

  1. #1
    Registered User
    Join Date
    Aug 2007

    how to pass ./configure parameters to header files

    Hello, everyone
    I'm stuck with autoconf. When user executes, for example ./configure --sysconf=/home/usr, I get a construct @sysconfdir@ replaced by /home/usr in the Makefile. Fine until then. Now, how could I let my program know about that '/home/usr' path (so, it knows where to look for its config file)?

    Currently I'm doing it with this target defined in a Makefile:

            echo "#define CONFIG_FILE \"${sysconfdir}/myproject.conf\"" >> config.h
    I'm wondering if there is a cleaner way to do it.
    Thanks in advance

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    And what is wrong with your current solution? [Although I personally prefer when the application has a default locatin (or set thereof, including $home), and then an environment variable that, if present, takes precedence over other rules]


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help using Header Files
    By d34n in forum C Programming
    Replies: 8
    Last Post: 04-21-2008, 11:06 PM
  2. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  3. Replies: 4
    Last Post: 12-14-2005, 02:21 PM
  4. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Missing header files and libraries with Borland
    By quagsire in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2003, 06:19 AM