NetBSD/dist/am-utils/m4/macros/expand_run_string.m4

30 lines
564 B
Plaintext

dnl ######################################################################
dnl Run a program and print its output as a string
dnl Takes: (header, code-to-run, [action-if-found, [action-if-not-found]])
AC_DEFUN([AMU_EXPAND_RUN_STRING],
[
value="notfound"
AC_TRY_RUN(
[
$1
main(argc)
int argc;
{
$2
exit(0);
}],
[
value=`./conftest dummy 2>>config.log`
test -z "$value" && value="notfound"
], value="notfound", value="notfound")
if test "$value" = notfound
then
:
$4
else
:
$3
fi
])
dnl ======================================================================