Autoconf 检查程序,如果找不到则失败 [英] Autoconf check for program and fail if not found

查看:27
本文介绍了Autoconf 检查程序,如果找不到则失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个项目并使用 GNU Autoconf 工具进行配置和制作.我已经设置了所有的库检查和头文件检查,但似乎无法弄清楚如何检查系统上是否存在可执行文件,如果不存在则失败.

I'm creating a project and using GNU Autoconf tools to do the configuring and making. I've set up all my library checking and header file checking but can't seem to figure out how to check if an executable exists on the system and fail if it doesn't exist.

我试过了:

AC_CHECK_PROG(TEST,testprogram,testprogram,AC_MSG_ERROR(Cannot find testprogram.))

当我 configure 它运行并输出:

When I configure it runs and outputs:

Checking for testprogram... find: `testprogram. 15426 5 ': No such file or directory

但不会失败.

推荐答案

试试这个,这是我刚刚从我的一个项目中提取的,它在路径中寻找名为 quantlib-config 的东西:

Try this which is what I just lifted from a project of mine, it looks for something called quantlib-config in the path:

# borrowed from a check for gnome in GNU gretl: def. a check for quantlib-config
AC_DEFUN(AC_PROG_QUANTLIB, [AC_CHECK_PROG(QUANTLIB,quantlib-config,yes)])
AC_PROG_QUANTLIB
if test x"${QUANTLIB}" == x"yes" ; then
    # use quantlib-config for QL settings
    [.... more stuff omitted here ...]
else
    AC_MSG_ERROR([Please install QuantLib before trying to build RQuantLib.])
fi

这篇关于Autoconf 检查程序,如果找不到则失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆