使用 gnu make 安装软件时如何检查已安装的库(例如 libpcap)?
我正在开发一个依赖于 libpcap 的应用程序,并且想知道如何编写 gnu makefile,以便我可以在继续安装应用程序之前检查机器上是否安装了 libpcap。
I am developing an application which depends on libpcap and want to know how to write the gnu makefile such that i can check for installation of libpcap on a machine before proceeding with the installation of my application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果 libpcap 支持,您可以尝试使用 pkg-config。 (我知道 libpcap++ 支持它,但不确定 libpcap)。也就是说,如果您还没有已建立的构建系统,那么我建议您尝试使用 CMake使这种事情以及创建 C++ 项目的所有其他方面变得更加简单。有关示例或快速开始使用 CMake,请参阅 C++ 项目模板。
If libpcap supports it, you might try using pkg-config. (I know that libpcap++ supports it, but not sure about libpcap). That said, if you don't already have an established build system, then I suggest you try using CMake which makes this kind of thing and all other aspects of creating a C++ project significantly simpler. For an example or getting started quickly using CMake, see the C++ Project Template.
如果我要正确回答你的问题,我会看看当我安装 GNUPlot(或其他)等软件包时 autoconf 如何检查组件是否存在并找出答案。不过我会把工作留给你。
If I were going to answer your question properly I'd look at how autoconf checks for the existence of components when I install a package such as GNUPlot (or whatever) and figure it out. I'll leave the work to you though.