diff options
author | mbr <mbr@FreeBSD.org> | 2003-09-02 15:27:38 +0000 |
---|---|---|
committer | mbr <mbr@FreeBSD.org> | 2003-09-02 15:27:38 +0000 |
commit | 7d0df748b4c59651751f156e408f856a02073b69 (patch) | |
tree | 4674a9f108ae4334ed6a61634f703f67f6533f4d /contrib/amd/m4/macros/expand_cpp_hex.m4 | |
parent | 532be24b7ef077cdfe0129dee60ab1f934c24181 (diff) | |
download | FreeBSD-src-7d0df748b4c59651751f156e408f856a02073b69.zip FreeBSD-src-7d0df748b4c59651751f156e408f856a02073b69.tar.gz |
Virgin import of AMD (am-utils) 20030828 (6.0.9)
Diffstat (limited to 'contrib/amd/m4/macros/expand_cpp_hex.m4')
-rw-r--r-- | contrib/amd/m4/macros/expand_cpp_hex.m4 | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/amd/m4/macros/expand_cpp_hex.m4 b/contrib/amd/m4/macros/expand_cpp_hex.m4 new file mode 100644 index 0000000..cd8b598 --- /dev/null +++ b/contrib/amd/m4/macros/expand_cpp_hex.m4 @@ -0,0 +1,40 @@ +dnl ###################################################################### +dnl Expand the value of a CPP macro into a printable hex number. +dnl Takes: header, macro, [action-if-found, [action-if-not-found]] +dnl It runs the header through CPP looking for a match between the macro +dnl and a string pattern, and if sucessful, it prints the string value out. +AC_DEFUN(AMU_EXPAND_CPP_HEX, +[ +# we are looking for a regexp of a string +AC_EGREP_CPP(0x, +[$1] +$2, +value="notfound" +AC_TRY_RUN( +[ +[$1] +main(argc) +int argc; +{ +#ifdef $2 +if (argc > 1) + printf("0x%x", $2); +exit(0); +#else +# error no such option $2 +#endif +exit(1); +}], value=`./conftest dummy 2>>config.log`, value="notfound", value="notfound") +, +value="notfound" +) +if test "$value" = notfound +then + : + $4 +else + : + $3 +fi +]) +dnl ====================================================================== |