Re: style: m4_toupper

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

 



() Ralf Wildenhues <Ralf.Wildenhues@xxxxxx>
() 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


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux