xref: /netbsd-src/external/bsd/am-utils/dist/m4/macros/cache_check_dynamic.m4 (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1dnl ######################################################################
2dnl New versions of the cache functions which also dynamically evaluate the
3dnl cache-id field, so that it may contain shell variables to expand
4dnl dynamically for the creation of $ac_cv_* variables on the fly.
5dnl In addition, this function allows you to call COMMANDS which generate
6dnl output on the command line, because it prints its own AC_MSG_CHECKING
7dnl after COMMANDS are run.
8dnl
9dnl ======================================================================
10dnl AMU_CACHE_CHECK_DYNAMIC(MESSAGE, CACHE-ID, COMMANDS)
11define(AMU_CACHE_CHECK_DYNAMIC,
12[
13ac_tmp=`echo $2`
14if eval "test \"`echo '$''{'$ac_tmp'+set}'`\" = set"; then
15  AC_MSG_CHECKING([$1])
16  echo $ECHO_N "(cached) $ECHO_C" 1>&AS_MESSAGE_FD([])
17dnl XXX: for older autoconf versions
18dnl  echo $ac_n "(cached) $ac_c" 1>&AS_MESSAGE_FD([])
19else
20  $3
21  AC_MSG_CHECKING([$1])
22fi
23ac_tmp_val=`eval eval "echo '$''{'$ac_tmp'}'"`
24AC_MSG_RESULT($ac_tmp_val)
25])
26dnl ======================================================================
27