m4-discuss
[Top][All Lists]
Advanced

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

Re: newbie question: conditional inclusion


From: Eric Blake
Subject: Re: newbie question: conditional inclusion
Date: Wed, 24 Jan 2007 06:07:04 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to sundeep singh on 1/23/2007 11:38 PM:
> Hi,
> I have a file in which I want to conditionally include text, something like
> #ifdef DEBUG
>     print" abc....";
>     do something;
> #else
>     print" 123....";
>     do something else; 
> #endif
> How do I achieve this functionality with m4?

The ifelse and ifdef builtins:

ifdef(`DEBUG',
`   print" abc....";
   do something;',
`   print" 123....";
   do something else;')

See also
http://www.gnu.org/software/m4/manual/html_node/Conditionals.html#Conditionals,
(also available as 'info m4 conditionals' if you installed the
documentation properly), and let us know if there is anything we can do to
improve the manual.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFt1n384KuGfSFAYARAnB9AKDS1Czn/lyvPIVUmD2BGP39e/UzWwCaA6Ly
jsFssKp2cKNQUVTSRZMjAOM=
=aYQ7
-----END PGP SIGNATURE-----




reply via email to

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