Search code examples
cportabilityautomakesystem-configuration

Portable access to sysconfdir via config.h


I'd like my application to have portable access to the configuration files installed during make install (dist_sysconf_DATA). Is it possible to access $(sysconfdir) via config.h?


Solution

  • It is, but you should not do this according to official voices (as in, I am not gonna search the manual for it now) so as to continue supporting overriding it for specific objects to be built.

    make CPPFLAGS="-USYSCONFDIR -DSYSCONFDIR=/blah" thisoneobject.o
    

    Hence, what one is supposed to do:

    AM_CPPFLAGS = -DSYSCONFDIR=\"${sysconfdir}\"