I am trying to learn GNU autotools, and I am following some tutorials, I tried doing step by step from:
http://kern-81.homepage.t-online.de/autotools_tutorial.pdf
but I have one question, at page 8 there is manually written Makefile.in and one line:
BINDIR=@bindir@
after
autoconf
./configure
in my generated makefile I get
BINDIR=${exec_prefix}/bin
but when I do
@echo $(exec_prefix)
it seems that this variable is empty, so everything I would
make install
would go to /bin, which is a bit strange, why it isn’t set as /usr/bin, should I issue some arguments to autoconf?
Also in this .pdf file it is written that:
bindir is an output variable of AC INIT which also detects includedir, srcdir, libdir, and others.
is is true? Because in this example of autoconf.am it is:
AC_INIT(helloworld, 0.0.1, dev@helloworld.org)
so this simple macro does all of this? If yes, how?
Yes,
AC_INITdoes all of that 😉 You can tell how it does that by looking in/usr/share/autoconf/autoconf/general.m4to see howAC_INITand its subroutines are defined. Or, just make aconfigure.acthat is empty except for theAC_INITcall, and then look at the generated configure script to see what it expands to.I think that if
exec_prefixis unset, it defaults toprefix, so the binaries would still go into/usr/local/bin. Of course you can verify this by simply runningmake installand checking where the binaries went.