我正在创建一个 android.m4 文件以轻松查找 android SDK/NDK 中程序的路径。
android.m4 文件包含一个名为的辅助函数_android_path_found_notfound
:
# _android_path_found_notfound(variable, program, path, found, notfound)
#
# search for a program in path. If found, 'variable' is set to the absolute path,
# then executes 'found', otherwise, 'variable' is set to '' and 'notfound' is run
m4_define([_android_path_found_notfound],
[AC_PATH_PROG([_android_temp_],[$2],[_android_notfound],[$3])
AS_IF( [test x"$_android_temp_" = x"_android_notfound"],
[$1=""
AC_SUBST([$1],[])
$5],
[$1="$_android_temp_"
AC_SUBST([$1],[$_android_temp_])
$4] )])
以及许多使用该辅助函数的函数:
AC_DEFUN([AC_PROG_ANDROID],
[_android_path_found_notfound([ANDROID],[android],[$ANDROID_HOME:$PATH],[$1],[$2])]
)
AC_DEFUN([AC_PROG_DX],
[_android_path_found_notfound([DX],[dx],[$ANDROID_HOME:$PATH],[$1],[$2])]
)
...
但是,当我运行一个调用AC_PROG_ANDROID
then的配置脚本时AC_PROG_DX
,我得到了这个:
checking for android... /opt/android-sdk-update-manager/tools/android
checking for dx... (cached) /opt/android-sdk-update-manager/tools/android
第二行指向与第一行相同的程序,并读取(cached)。为什么会缓存结果?