In my project that uses autoconf and automake, I have two executables, say “foo” and “bar”. Suppose “foo.c” looks like
int main()
{
exec ("bar");
return 0;
}
I.e., “foo” uses “bar”. This works fine once I do./configure && make && make install. However, the autoconf provides an option to transform program names. For example, I could do ./configure --program-suffix=-2.0. Then “foo” and “bar” will be installed instead as
/usr/bin/foo-2.0
/usr/bin/bar-2.0
In that case, the reference to “bar” inside “foo” would be incorrect, because there will be no bar in the system (should be bar-2.0). Is there any way I can let autoconf/automake adjust this reference automatically?
In your
Makefileyou may run the$(program_transform_name)sed script to create a header file with the final names.For instance, assuming your program names are
fooandbar, create anames.h.infile containing:Then equip your
Makefile.amto have rules to generatenames.hfromnames.h.in:and finally include
names.hand useFOO_NAMEandBAR_NAMEin your source code.