xref: /netbsd-src/external/bsd/am-utils/dist/m4/macros/expand_run_string.m4 (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1*a53f50b9Schristosdnl ######################################################################
2*a53f50b9Schristosdnl Run a program and print its output as a string
3*a53f50b9Schristosdnl Takes: (header, code-to-run, [action-if-found, [action-if-not-found]])
4*a53f50b9SchristosAC_DEFUN([AMU_EXPAND_RUN_STRING],
5*a53f50b9Schristos[
6*a53f50b9Schristosvalue="notfound"
7*a53f50b9SchristosAC_TRY_RUN(
8*a53f50b9Schristos[
9*a53f50b9Schristos$1
10*a53f50b9Schristosmain(argc)
11*a53f50b9Schristosint argc;
12*a53f50b9Schristos{
13*a53f50b9Schristos$2
14*a53f50b9Schristosexit(0);
15*a53f50b9Schristos}],
16*a53f50b9Schristos[
17*a53f50b9Schristosvalue=`./conftest dummy 2>>config.log`
18*a53f50b9Schristostest -z "$value" && value="notfound"
19*a53f50b9Schristos], value="notfound", value="notfound")
20*a53f50b9Schristosif test "$value" = notfound
21*a53f50b9Schristosthen
22*a53f50b9Schristos  :
23*a53f50b9Schristos  $4
24*a53f50b9Schristoselse
25*a53f50b9Schristos  :
26*a53f50b9Schristos  $3
27*a53f50b9Schristosfi
28*a53f50b9Schristos])
29*a53f50b9Schristosdnl ======================================================================
30