autoconf
[Top][All Lists]
Advanced

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

Re: Sane way of making installation paths available to C ?


From: Schleicher Ralph (LLI)
Subject: Re: Sane way of making installation paths available to C ?
Date: Fri, 28 Feb 2003 10:36:33 +0100

John Levon wrote:

> Is there some relatively sane way of making stuff like $bindir path
> available to C programs (via config.h preferably) ? I'm entirely sure
> I'm not the only one who's had to solve this problem a number of times.
[...]
> OP_DATADIR=`eval echo "$datadir/$PACKAGE/"`
> OP_BINDIR=`eval echo "$bindir/"`
> AC_SUBST(OP_BINDIR)
> AC_SUBST(OP_DATADIR)

Hi John,

the following procedure works fine for me (in configure.ac):

# Define makefile variables.
foodir="\$(datadir)/\$(PACKAGE_NAME)/\$(PACKAGE_VERSION)/foo"
AC_SUBST([foodir])

# Define config.h symbols.
# Recursively expand value of shell variables (must use double
# brackets due to M4 quoting).
rs_foodir="$foodir"
while echo "$rs_foodir" | grep '\$[[({]]' > /dev/null 2>&1 ; do
    rs_tem=`echo "$rs_foodir" | tr '()' '{}'`
    eval "rs_foodir=\"$rs_tem\""
done
AC_DEFINE_UNQUOTED([FOODIR], ["$rs_foodir"],
[Define to the default value of the foo directory.])

-- 
Ralph





reply via email to

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