Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

8.3.1 Redefined M4 Macros

With a few exceptions, all the M4 native macros are moved in the ‘m4_’ pseudo-namespace, e.g., M4sugar renames define as m4_define etc.

Some M4 macros are redefined, and are slightly incompatible with their native equivalent.

— Macro: dnl

This macro kept its original name: no m4_dnl is defined.

— Macro: m4_defn (macro)

Unlike the M4 builtin, this macro fails if macro is not defined. See m4_undefine.

— Macro: m4_exit (exit-status)

This macro corresponds to m4exit.

— Macro: m4_if (comment)
— Macro: m4_if (string-1, string-2, equal, [not-equal])
— Macro: m4_if (string-1, string-2, equal, ...)

This macro corresponds to ifelse.

— Macro: m4_include (file)
— Macro: m4_sinclude (file)

Like the M4 builtins, but warn against multiple inclusions of file.

— Macro: m4_bpatsubst (string, regexp, [replacement])

This macro corresponds to patsubst. The name m4_patsubst is kept for future versions of M4sh, on top of GNU M4 which will provide extended regular expression syntax via epatsubst.

— Macro: m4_popdef (macro)

Unlike the M4 builtin, this macro fails if macro is not defined. See m4_undefine.

— Macro: m4_bregexp (string, regexp, [replacement])

This macro corresponds to regexp. The name m4_regexp is kept for future versions of M4sh, on top of GNU M4 which will provide extended regular expression syntax via eregexp.

— Macro: m4_wrap (text)

This macro corresponds to m4wrap.

Posix requires arguments of multiple m4wrap calls to be reprocessed at EOF in the same order as the original calls. GNU M4 versions through 1.4.x, however, reprocess them in reverse order. Your code should not depend on the order.

Also, Posix requires m4wrap to ignore its second and succeeding arguments, but GNU M4 versions through 1.4.x concatenate the arguments with intervening spaces. Your code should not pass more than one argument.

You are encouraged to end text with ‘[]’, to avoid unexpected token pasting between consecutive invocations of m4_wrap, as in:

          m4_define([foo], [bar])
          m4_define([foofoo], [OUCH])
          m4_wrap([foo])
          m4_wrap([foo])
          =>OUCH
     
— Macro: m4_undefine (macro)

Unlike the M4 builtin, this macro fails if macro is not defined. Use

          m4_ifdef([macro], [m4_undefine([macro])])
     

to recover the behavior of the builtin.


 
 
  Published under the terms of the GNU General Public License Design by Interspire