Next: Syscmd, Up: Shell commands [Contents][Index]
Sometimes it is desirable for an input file to know which platform
m4
is running on. GNU m4
provides several
macros that are predefined to expand to the empty string; checking for
their existence will confirm platform details.
Each of these macros is conditionally defined as needed to describe the
environment of m4
. If defined, each macro expands to the empty
string. For now, these macros silently ignore all arguments, but in a
future release of M4, they might warn if arguments are present.
When GNU extensions are in effect (that is, when you did not
use the -G option, see Invoking m4),
GNU m4
will define the macro __gnu__
to
expand to the empty string.
$ m4 __gnu__ ⇒ __gnu__(`ignored') ⇒ Extensions are ifdef(`__gnu__', `active', `inactive') ⇒Extensions are active
$ m4 -G __gnu__ ⇒__gnu__ __gnu__(`ignored') ⇒__gnu__(ignored) Extensions are ifdef(`__gnu__', `active', `inactive') ⇒Extensions are inactive
On UNIX systems, GNU m4
will define __unix__
by default, or unix
when the -G option is specified.
On native Windows systems, GNU m4
will define
__windows__
by default, or windows
when the
-G option is specified.
On OS/2 systems, GNU m4
will define __os2__
by default, or os2
when the -G option is specified.
If GNU m4
does not provide a platform macro for your system,
please report that as a bug.
define(`provided', `0') ⇒ ifdef(`__unix__', `define(`provided', incr(provided))') ⇒ ifdef(`__windows__', `define(`provided', incr(provided))') ⇒ ifdef(`__os2__', `define(`provided', incr(provided))') ⇒ provided ⇒1
Next: Syscmd, Up: Shell commands [Contents][Index]