1*a53f50b9Schristosdnl ###################################################################### 2*a53f50b9Schristosdnl Expand the value of a CPP macro into a printable integer 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_INT], 7*a53f50b9Schristos[ 8*a53f50b9Schristos# we are looking for a regexp of an integer (must not start with 0 --- those 9*a53f50b9Schristos# are octals). 10*a53f50b9SchristosAC_EGREP_CPP( 11*a53f50b9Schristos[[1-9]][[0-9]]*, 12*a53f50b9Schristos[$1] 13*a53f50b9Schristos$2, 14*a53f50b9Schristosvalue="notfound" 15*a53f50b9SchristosAC_TRY_RUN( 16*a53f50b9Schristos[ 17*a53f50b9Schristos[$1] 18*a53f50b9Schristosmain(argc) 19*a53f50b9Schristosint argc; 20*a53f50b9Schristos{ 21*a53f50b9Schristos#ifdef $2 22*a53f50b9Schristosif (argc > 1) 23*a53f50b9Schristos printf("%d", $2); 24*a53f50b9Schristosexit(0); 25*a53f50b9Schristos#else 26*a53f50b9Schristos# error no such option $2 27*a53f50b9Schristos#endif 28*a53f50b9Schristosexit(1); 29*a53f50b9Schristos}], value=`./conftest dummy 2>>config.log`, value="notfound", value="notfound") 30*a53f50b9Schristos, 31*a53f50b9Schristosvalue="notfound" 32*a53f50b9Schristos) 33*a53f50b9Schristosif test "$value" = notfound 34*a53f50b9Schristosthen 35*a53f50b9Schristos : 36*a53f50b9Schristos $4 37*a53f50b9Schristoselse 38*a53f50b9Schristos : 39*a53f50b9Schristos $3 40*a53f50b9Schristosfi 41*a53f50b9Schristos]) 42*a53f50b9Schristosdnl ====================================================================== 43