Andna
Andna

Reputation: 6689

Autoconf and makefile

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, [email protected])

so this simple macro does all of this? If yes, how?

Upvotes: 2

Views: 920

Answers (1)

ptomato
ptomato

Reputation: 57870

Yes, AC_INIT does all of that ;-) You can tell how it does that by looking in /usr/share/autoconf/autoconf/general.m4 to see how AC_INIT and its subroutines are defined. Or, just make a configure.ac that is empty except for the AC_INIT call, and then look at the generated configure script to see what it expands to.

I think that if exec_prefix is unset, it defaults to prefix, so the binaries would still go into /usr/local/bin. Of course you can verify this by simply running make install and checking where the binaries went.

Upvotes: 5

Related Questions