m4: Improved fatal_error

1 
1 17.8 Solution for 'fatal_error'
1 ===============================
1 
1 The 'fatal_error' macro (⇒M4exit) is not robust to versions of
1 GNU M4 earlier than 1.4.8, where invoking '__file__' (⇒Location)
1 inside 'm4wrap' would result in an empty string, and '__line__' resulted
1 in '0' even though all files start at line 1.  Furthermore, versions
1 earlier than 1.4.6 did not support the '__program__' macro.  If you want
1 'fatal_error' to work across the entire 1.4.x release series, a better
1 implementation would be:
1 
1      define(`fatal_error',
1        `errprint(ifdef(`__program__', `__program__', ``m4'')'dnl
1      `:ifelse(__line__, `0', `',
1          `__file__:__line__:')` fatal error: $*
1      ')m4exit(`1')')
1      =>
1      m4wrap(`divnum(`demo of internal message')
1      fatal_error(`inside wrapped text')')
1      =>
1      ^D
1      error->m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored
1      =>0
1      error->m4:stdin:6: fatal error: inside wrapped text
1