How to get a configure script to look for a library

我的梦境 提交于 2019-12-04 18:34:33

The best way to figure this out is to look at other autoconf macros that do something similar. Autoconf macros are an amalgam of Bourne shell script and M4 code, so they can literally solve any computable problem.

Here's a link to a macro I wrote for MySQL++ that does this: mysql++.m4.

It's not the job of configure to search where libraries are installed. it should only make sure they are available to the linker. If the user installed them in a different location, he knows how to call ./configure CPPFLAGS=-I/the/location/include LDFLAGS=-L/the/location/lib so that the tools will find the library (this is explained in the --help output of configure and in the standard INSTALL file).

Also --with-package and --enable-package macros are not supposed to be used to specify paths, contrary to what many third-party macros will do. The GNU Coding Standards explicitly prohibit this usage:

Do not use a --with option to specify the file name to use to find certain files. That is outside the scope of what --with options are for.

CPPFLAGS and LDFLAGS are already here to address the problem, so why redevelop and maintain another mechanism?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!