如何使配置脚本检查依赖项 [英] How to make configure script check the dependencies

查看:224
本文介绍了如何使配置脚本检查依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



它工作正常,除非我没有安装一些需要的库。缺少某些文件时返回错误,但实际上应该由配置脚本检查?



所以我的问题是:如何修改autoconf生成的脚本来寻找对于依赖关系,告诉用户哪些库缺少?

解决方案

取决于依赖,没有通用的解决方案。 >

<$如果库和标题安装在标准位置,则可能适用于您的c $ c> AC_CHECK_LIB 和 AC_SEARCH_LIBS 宏* p>

许多包现在支持 pkg-config 或类似的东西可以让你检查是否存在库,还可以为您提供所需的编译器和链接器标志。



使用不兼容的软件包AC宏并且不支持 pkg-config 或类似的内容,您可能必须自己编写大量脚本,以确定依赖关系是否可用以及编译器和链接器它需要的选项。即使这样,很难使其便携。


I generated a configure script with autoconf to build my project.

It works fine unless I don't have some needed library installed. Make returns error when lacking some files, but it should be actually checked by the configure script i think?

So my question is: How to modify an autoconf generated script to seek for dependencies and tell the user which libraries it lacks?

解决方案

Depends on the dependency, there is no generic solution.

There are AC_CHECK_LIB and AC_SEARCH_LIBS macros that may work for you if the libraries and headers are installed in standard locations.

Many packages nowadays support pkg-config or something similar which allows you to check for existence of libraries, and also can supply you the compiler and linker flags required.

With packages that do not work with AC macros and do not support pkg-config or similar, you'll probably have to write a ton of scripts yourself to find out whether the dependency is available and what compiler and linker options it requires. And even then it is hard to make it portable.

这篇关于如何使配置脚本检查依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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