automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

interpolating automake variables?


From: Rusty Ballinger
Subject: interpolating automake variables?
Date: Sun, 3 Jun 2001 20:16:41 -0700

Hey, I have a question about the interpolation of automake variables like
pkglibdir, pkgdatadir, etc.  Suppose your package installs programs and
scripts which need to know where to find your package's data files, and you
want your documentation to have the full paths of your program, etc.

The way I've done this sort of thing in the past is to have my man pages,
perl scripts, a shared header file, etc., all in AC_OUTPUT.  In order to
get this to work, though, you have to manually interpolate libdir etc. in
your configure.in, because "${prefix}/lib" isn't going to work in a perl
script, man page, C file, etc.  This "works", but is nasty and Wrong:

    test "x$prefix" = xNONE && prefix=$ac_default_prefix
    test "x$exec_prefix" = xNONE && exec_prefix=$prefix
    list='bindir sbindir ...'; for var in $list; do
        val=`eval echo \\${$var}`
        export $var=`eval echo $val`
        val=`eval echo \\${$var}`
    done

And to do automake's pkg...dir variables, you have to pretend you know
what automake is going to set them to, which is even worse:

    pkgdatadir=$datadir/$PACKAGE
    pkglibdir=$libdir/$PACKAGE
    pkgincludedir=$includedir/$PACKAGE
    AC_SUBST(pkgdatadir)
    AC_SUBST(pkglibdir)
    AC_SUBST(pkgincludedir)

What's the right way to do this?  Say in the simple case of a perl script
which wants to operate on files installed in $pkgdatadir.

--Rusty



reply via email to

[Prev in Thread] Current Thread [Next in Thread]