1

OpenSync 0.4 (実際には 0.3.9) に依存するアプリケーションを構築しようとしています。

プロジェクトの configure.ac では、opensync ライブラリは次のように記述されていlibopensync1ます。ただし、これは私の Gentoo システムではビルドできません。に変更libopensync1するとlibopensync、問題が解決します。

Google で検索したところlibopensync1、一部のディストリビューションで使用されているものとlibopensync、他のディストリビューションで使用されているものがあることがわかりました。では、この問題をどのように解決しconfigure.acますか?

ありがとう。

4

2 に答える 2

4

The macro AC_SEARCH_LIBS does what you need. (There is much heated debate about whether or not pkg-config should ever be used. If you choose to rely on it, ptomato gives a reasonable approach.) Simply add this to your configure.ac:

AC_SEARCH_LIBS([osync_mapping_new],[opensync1 opensync],[],
  [AC_MSG_ERROR([can't find opensync])])

This will first look for a library named opensync1; if it doesn't find that, it will look for opensync.

The primary drawback of using pkg-config is that most projects that rely on it do not actually check if the data provided by the .pc file is reliable, so configure may succeed but a subsequent build will fail. It is always possible for a user to set PKG_CONFIG=true when running configure and completely eliminate all of the data provided by any associated .pc files, setting LIBS, CFLAGS, etc by hand the 'old-fashioned' way.

The primary drawback of not using pkg-config is that the user has to set LIBS, CFLAGS, etc. the old-fashioned way. In practice, this is pretty trivial, and all pkg-config has done is move the data from a single CONFIG_SITE file to separately maintained .pc files for each package.

If you do use PKG_MODULE_CHECK, follow it up with a call to AC_CHECK_LIB or AC_SEARCH_LIBS to validate the data in whatever .pc file was located by PKG_CHECK_MODULES

于 2010-12-08T13:33:21.950 に答える
2

これがあなたのconfigure.ac中で発生する場所は、PKG_CHECK_MODULES通話の中であると想定しています。

libopensync のソースを見ると、それlibopensync1が新しい名前でlibopensync、古い名前のようです。そのため、pkg-config マクロを使用して、存在しない場合を除き、新しい名前を探します。

これをあなたの中に入れてくださいconfigure.ac

# Check if libopensync1 is known to pkg-config, and if not, look for libopensync instead
PKG_CHECK_EXISTS([libopensync1], [OPENSYNC=libopensync1], [OPENSYNC=libopensync])

その後、PKG_CHECK_MODULES通話の後半で、 に置き換えlibopensync1ます$OPENSYNC

于 2010-12-06T22:57:01.733 に答える