
autoconf variable expansion
Ed> Hi. I have whittled my problem down to a simple example. If I
Ed> have a Makefile.in like this:
Ed> PREFIX = @prefix@
Ed> BINDIR = @bindir@
Ed> MANDIR = @mandir@
Ed> test :
Ed> @echo 'PREFIX $(PREFIX)'
Ed> @echo 'BINDIR $(BINDIR)'
Ed> @echo 'MANDIR $(MANDIR)'
Ed> ... and a configure.in file like this:
Ed> AC_INIT(foo.txt)
Ed> AC_OUTPUT(Makefile)
Ed> ... and I do a ./configure, then the resulting Makefile's
Ed> @-variables aren't fully expanded:
Ed> PREFIX = /usr/local
Ed> BINDIR = ${exec_prefix}/bin
Ed> MANDIR = ${prefix}/man
Ed> test :
Ed> @echo 'PREFIX $(PREFIX)'
Ed> @echo 'BINDIR $(BINDIR)'
Ed> @echo 'MANDIR $(MANDIR)'
Ed> ... so that the wrong values are in $(BINDIR) and $(MANDIR). They
Ed> are /bin and /man respectively when make is run. $(PREFIX) is the
Ed> only make variable that is valid. That doesn't seem right. What
Ed> can I do to make them fully expanded in the resulting Makefile?
To use autoconf you must adhere to the GNU makefile conventions.
Quoting standards.info:
standards> These two variables set the root for the installation.
standards> All the other installation directories should be
standards> subdirectories of one of these two, and nothing should be
standards> directly installed into these two directories.
standards> `prefix' A prefix used in constructing the default values
standards> of the variables listed below. The default value of
standards> `prefix' should be `/usr/local'. When building the
standards> complete GNU system, the prefix will be empty and
standards> `/usr' will be a symbolic link to `/'. (If you are
standards> using Autoconf, write it as `@prefix@'.)
standards> Running `make install' with a different value of
standards> `prefix' from the one used to build the program should
standards> _not_ recompile the program.
standards> `exec_prefix' A prefix used in constructing the default
standards> values of some of the variables listed below. The
standards> default value of `exec_prefix' should be `$(prefix)'.
standards> (If you are using Autoconf, write it as
standards> `@exec_prefix@'.)
standards> Generally, `$(exec_prefix)' is used for directories
standards> that contain machine-specific files (such as
standards> executables and subroutine libraries), while
standards> `$(prefix)' is used directly for other directories.
standards> Running `make install' with a different value of
standards> `exec_prefix' from the one used to build the program
standards> should _not_ recompile the program.
(Note the spelling of `prefix' i.e. lowercase.)
--
Ian Zimmerman, Oakland, California, U.S.A.
EngSoc adopts market economy: cheap is wasteful, efficient is expensive.