[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: style: m4_toupper
From: |
Thien-Thi Nguyen |
Subject: |
Re: style: m4_toupper |
Date: |
Sat, 15 Sep 2007 14:55:17 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) |
() Ralf Wildenhues <address@hidden>
() Sat, 15 Sep 2007 13:15:33 +0200
AC_DEFUN([FOO],
[
m4_pushdef([COND], [AS_TR_SH([HAVE_]$1)])
m4_pushdef([ENABLE], [$enable_]$1)
AM_CONDITIONAL(COND, [test x[]ENABLE = xyes])
if test x[]ENABLE = xyes; then
COND=1
AC_SUBST(COND)
fi
m4_popdef([COND])
m4_popdef([ENABLE])
])
nice, very concise. thanks for the tip!
I do wonder a bit why you need both a substituted value HAVE_$1 and an
automake conditional of the same name. Do you generate a header file
with AC_CONFIG_FILES (rather than AC_CONFIG_HEADERS) that contains
#define HAVE_... @HAVE_...@
?
not really. i use the automake conditional to avoid building targets (by
surrounding their rules in Makefile.am w/ the conditional), and the AC_SUBST
vars in unconditionally-built code, and uncondiontally-run tests so that they
degrade gracefully in the absence of those features.
Well, M4sh certainly isn't perfect yet, sometimes changes to it are
necessary (and almost any change of it will break some usage pattern).
AS_TR_CPP isn't appropriate here if you want to generate a shell
variable name rather than a preprocessor define.
ok, i'll tread carefully.
thi