It is currently Tue, 17 May 2022 02:38:01 GMT



 
Author Message
 autoconf variable expansion
Hi.  I have whittled my problem down to a simple example.  If I have a
Makefile.in like this:

PREFIX   = @prefix@
BINDIR   = @bindir@
MANDIR   = @mandir@

test    :
        @echo 'PREFIX           $(PREFIX)'
        @echo 'BINDIR           $(BINDIR)'
        @echo 'MANDIR           $(MANDIR)'

... and a configure.in file like this:

AC_INIT(foo.txt)
AC_OUTPUT(Makefile)

... and I do a ./configure, then the resulting Makefile's @-variables
aren't fully expanded:

PREFIX   = /usr/local
BINDIR   = ${exec_prefix}/bin
MANDIR   = ${prefix}/man

test    :
        @echo 'PREFIX           $(PREFIX)'
        @echo 'BINDIR           $(BINDIR)'
        @echo 'MANDIR           $(MANDIR)'

... so that the wrong values are in $(BINDIR) and $(MANDIR).  They are
/bin and /man respectively when make is run.  $(PREFIX) is the only
make variable that is valid.  That doesn't seem right.  What can I do
to make them fully expanded in the resulting Makefile?

--
--Ed Cashin                     PGP public key:
  ecas...@coe.uga.edu           http://www.**-**.com/ ~ecashin/pgp/



 Wed, 28 May 2003 01:13:51 GMT   
 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.



 Thu, 29 May 2003 04:25:45 GMT   
 autoconf variable expansion

That's what I have in the variable assignment quoted above,
"@prefix@".

Hmm.  Did you notice that I assigned the value of @prefix@ to the make
variable $(PREFIX)?  I am just asking why @prefix@ doesn't expand
fully.  It doesn't expand fully whether I assign it to a non-standard
variable (as many autoconf users do) or use @prefix@ directly
throughout the "Makefile.in" file.

I just found the address for the autoconf mailing list, so I'm going
to try asking there.

--
--Ed Cashin                     integrit file-verification system:
  ecas...@coe.uga.edu           http://integrit.sourceforge.net/

    Note: If you want me to send you email, don't munge your address.



 Thu, 29 May 2003 07:27:13 GMT   
 autoconf variable expansion
Ed L Cashin <ecas...@coe.uga.edu> writes:

I didn't understand what you were suggesting.  Adding the following
lines to the top of the Makefile.in resulted in full expansion of all
the variables:

prefix        = @prefix@
exec_prefix   = @exec_prefix@

Thanks very much for the help!  :)

--
--Ed Cashin                     integrit file-verification system:
  ecas...@coe.uga.edu           http://integrit.sourceforge.net/

    Note: If you want me to send you email, don't munge your address.



 Thu, 29 May 2003 07:43:34 GMT   
 
   [ 4 post ] 

Similar Threads

1. autoconf always sets variable

2. Autoconf: How to expand/replace directory variables?

3. Variable and Pathname Expansion

4. Variable Expansion With sed

5. Expansion of variables in sh scripts

6. Variable expansion works, then doesn't

7. double quote variable expansion

8. variable expansion on the bash command line

9. Variable expansion and eval


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software