autoconf
[Top][All Lists]
Advanced

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

AC_DEFINE_UNQUOTED with unresolved shell variables


From: Roland Illig
Subject: AC_DEFINE_UNQUOTED with unresolved shell variables
Date: Thu, 09 Nov 2006 11:19:54 +0100
User-agent: Mozilla/5.0 (X11; U; NetBSD i386; en-US; rv:1.7.12) Gecko/20051220

Dear autoconf developers,

in a software package I have found code like this:

FOO_DIR="${bindir}"
AC_SUBST(FOO_DIR)
AC_DEFINE_UNQUOTED(FOO_DIR, "$FOO_DIR",
                   [Directory where foo files are installed])

The problem with that is that the value of bindir is usually '${prefix}/bin', so the above code leads to the following line in config.h:

    #define FOO_DIR "${prefix}/bin"

Since the C preprocessor does not know about variable expansion, this reference will never be resolved, and as a result, the programs will not find the files.

What is the most elegant way of solving this? One way I could imagine is to drop the AC_DEFINE_UNQUOTED line and reintroduce the line via

    AM_CPPFLAGS = -DFOO_DIR="@FOO_DIR@"

Is that the preferred solution?

Thanks,

Roland

--
PS: Please CC me




reply via email to

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