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

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

问题描述

我使用autoconf生成了一个配置脚本来构建我的项目。



它可以正常工作,除非我没有安装一些需要的库。



所以我的问题是:如何修改一个autoconf生成的脚本来寻找

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



AC_CHECK_LIB AC_SEARCH_LIBS ,如果库和标头安装在标准位置,则可能适用。



许多软件包现在支持 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.

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

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