configureThe script will generate the necessary Makefileone that will use the C compiler functionality -DMACRO=contentto essentially inject the C preprocessor statements #define MACRO contentinto compilation units. Thus, sysconfdirit can be used with Make rules:
foo.o: foo.c
$(CC) -DCONFDIR=$(sysconfdir) -o $@ $<
(This suggests that to create an object file foo.owhen updating foo.cto create it, use the variable $(CC)to start the C compiler, define CONFDIRwith the contents $(sysconfdir)(complete via a ./configurescript) put the output in the target file ( $@) and specify the source file ( $<) as a single input to the compiler .))
Then C's code foo.ccan use it as follows:
FILE *conf;
if (conf = fopen(CONFDIR "/foo", "r")) {
} else {
}
Note that concatenation of <is performed before compiling the program .
: http://www.gnu.org/software/hello/manual/autoconf/Installation-Directory-Variables.html#Installation-Directory-Variables