1*a53f50b9Schristosdnl ###################################################################### 2*a53f50b9Schristosdnl Expand the value of a CPP macro into a printable hex number. 3*a53f50b9Schristosdnl Takes: header, macro, [action-if-found, [action-if-not-found]] 4*a53f50b9Schristosdnl It runs the header through CPP looking for a match between the macro 5*a53f50b9Schristosdnl and a string pattern, and if sucessful, it prints the string value out. 6*a53f50b9SchristosAC_DEFUN([AMU_EXPAND_CPP_HEX], 7*a53f50b9Schristos[ 8*a53f50b9Schristos# we are looking for a regexp of a string 9*a53f50b9SchristosAC_EGREP_CPP(0x, 10*a53f50b9Schristos[$1] 11*a53f50b9Schristos$2, 12*a53f50b9Schristosvalue="notfound" 13*a53f50b9SchristosAC_TRY_RUN( 14*a53f50b9Schristos[ 15*a53f50b9Schristos[$1] 16*a53f50b9Schristosmain(argc) 17*a53f50b9Schristosint argc; 18*a53f50b9Schristos{ 19*a53f50b9Schristos#ifdef $2 20*a53f50b9Schristosif (argc > 1) 21*a53f50b9Schristos printf("0x%x", $2); 22*a53f50b9Schristosexit(0); 23*a53f50b9Schristos#else 24*a53f50b9Schristos# error no such option $2 25*a53f50b9Schristos#endif 26*a53f50b9Schristosexit(1); 27*a53f50b9Schristos}], value=`./conftest dummy 2>>config.log`, value="notfound", value="notfound") 28*a53f50b9Schristos, 29*a53f50b9Schristosvalue="notfound" 30*a53f50b9Schristos) 31*a53f50b9Schristosif test "$value" = notfound 32*a53f50b9Schristosthen 33*a53f50b9Schristos : 34*a53f50b9Schristos $4 35*a53f50b9Schristoselse 36*a53f50b9Schristos : 37*a53f50b9Schristos $3 38*a53f50b9Schristosfi 39*a53f50b9Schristos]) 40*a53f50b9Schristosdnl ====================================================================== 41