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