autoconf: modernize and modularize
[tftp-hpa.git] / autoconf / m4 / pa_sym.m4
blobd3a8965dfcbc758b704a616918425f5088725645
1 dnl --------------------------------------------------------------------------
2 dnl PA_SYM(prefix, string)
3 dnl
4 dnl Convert a (semi-) arbitrary string to a CPP symbol
5 dnl Compact underscores and convert non-C characters to underscore,
6 dnl except + which is converted to X (so C++ -> CXX).
7 dnl --------------------------------------------------------------------------
8 AC_DEFUN([PA_SYM],
9 [m4_bpatsubsts(m4_quote(m4_toupper([$*])),
10  [,],[],[\+],[X],[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]+],[_],dnl
11 [^._?\(.*\)_.$],[[\1]])])