C++ 自动工具将第三方库添加到tarball中

C++ 自动工具将第三方库添加到tarball中,c++,makefile,autotools,gnutls,C++,Makefile,Autotools,Gnutls,我的问题与以下类似: 我必须将GnuTLS库添加到我们的项目tarball中。 我的目录结构是: program/ | +--src/ | | | +-- *.cpp; *.hpp | +--lib/ | | | +--gnutls | | | +--Makefile.am | +--configure.ac | +--*.cpp; *.hpp; etc. | +--Makefile.am +--configure.ac 我的问

我的问题与以下类似:

我必须将GnuTLS库添加到我们的项目tarball中。 我的目录结构是:

program/
|
+--src/
|   |
|   +-- *.cpp; *.hpp
|
+--lib/
|   |
|   +--gnutls
|       |
|       +--Makefile.am
|       +--configure.ac
|       +--*.cpp; *.hpp; etc.
|
+--Makefile.am
+--configure.ac
我的问题是gnutls的configure.ac。我想在configure.ac或Makefile.am或类似文件中包含

我尝试在configure.ac中包含gnutls的makefile:

AC_CONFIG_FILES([lib/gnutls/Makefile lib/gnutls/lib/Makefile lib/gnutls/src/Makefile])
然后它给了我很多错误:

lib/gnutls/lib/Makefile.am:98: error: ENABLE_PKCS11 does not appear in AM_CONDITIONAL
lib/gnutls/lib/Makefile.am:122: error: ENABLE_PKCS11 does not appear in AM_CONDITIONAL
lib/gnutls/lib/Makefile.am:142: error: HAVE_LIBIDN does not appear in AM_CONDITIONAL
lib/gnutls/lib/Makefile.am:154: error: NEEDS_LIBRT does not appear in AM_CONDITIONAL
lib/gnutls/lib/Makefile.am:158: error: ENABLE_FIPS140 does not appear in AM_CONDITIONAL
lib/gnutls/lib/Makefile.am:167: error: HAVE_LD_VERSION_SCRIPT does not appear in AM_CONDITIONAL
lib/gnutls/lib/Makefile.am:184: error: HAVE_LD_OUTPUT_DEF does not appear in AM_CONDITIONAL
lib/gnutls/lib/Makefile.am:200: error: ENABLE_CXX does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:29: error: ENABLE_CRYWRAP does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:33: error: NEED_LIBOPTS does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:53: error: ENABLE_SRP does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:57: error: ENABLE_OCSP does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:59: error: ENABLE_ANON does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:64: error: ENABLE_DANE does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:68: error: ENABLE_TROUSERS does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:74: error: ENABLE_PKCS11 does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:81: error: ENABLE_SRP does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:96: error: ENABLE_OCSP does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:118: error: ENABLE_ANON does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:126: error: ENABLE_DANE does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:163: error: ENABLE_DANE does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:177: error: ENABLE_PKCS11 does not appear in AM_CONDITIONAL
lib/gnutls/src/Makefile.am:193: error: ENABLE_TROUSERS does not appear in AM_CONDITIONAL
我认为这些条件应该来自gnutls的configure.ac。 我的问题是:

  • 如何将此configure.ac包含在configure.ac中
  • 有没有更好的方法将GNUTL包括在我们的构建过程中

我发现有一个宏名为“AC\u CONFIG\u SUBDIRS”。但仍然有一个问题:这是最好的方式吗?仅供参考:不,你不必将库添加到你的tarball中。如果您需要生成一个tarball,其中包含一些包含项目和库的打包,那么就这样做。但是autotool不是打包工具,使用autotool元文件试图将多个包捆绑到一个tarball中是一个错误。(也就是说,不要用“tarball”这个词来表示“make distcheck”生成的对象”,而是用它来表示“我们发布的包含我们项目的自动工具生成的文件以及GnuTLS生成的文件的对象”)谢谢您的帮助!我的问题不是它的打包方式,所以忘记了它将打包到包含GnuTLS的包中。问题和我的问题是关于我的库与嵌套库的构建过程。我想我之前发布的链接回答了我的问题。但我仍然不知道这是“官方”的做法。但是我必须在我们的交付包中包含GnuTLS。是的,我建议您不要尝试使用嵌套库。如果所依赖的库是正确的库,则要求用户安装它。如果它是一个“复制粘贴”库,那么直接将其源代码合并到包中,不要尝试使用递归配置。这是脆弱的,脆弱的,和痛苦的维持。