如何告诉 Autoconf“需要符号 A 或 B"来自LIB? [英] How to tell Autoconf "require symbol A or B" from LIB?

查看:14
本文介绍了如何告诉 Autoconf“需要符号 A 或 B"来自LIB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 OpenSSL 配置 Postgres 9.5.41.1.0.因为在 OpenSSL 1.1.0 中找不到 SSL_library_init,Configure 快要死了.OpenSSL 1.1.0 提供 OPENSSL_init_ssl 而不是 SSL_library_init.所以 Autoconf 需要检查 SSL_library_initOPENSSL_init_ssl.

I'm trying to configure Postgres 9.5.4 for OpenSSL 1.1.0. Configure is dying because it can't find SSL_library_init in OpenSSL 1.1.0. OpenSSL 1.1.0 provides OPENSSL_init_ssl instead of SSL_library_init. So Autoconf needs to check for either SSL_library_init or OPENSSL_init_ssl.

Postgres 使用以下测试:

Postgres uses the following test:

AC_CHECK_LIB(ssl, SSL_library_init, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])

如何修改该[规则?] 以查找 SSL_library_initOPENSSL_init_ssl?

How do I modify that [rule?] to look for either SSL_library_init or OPENSSL_init_ssl?

天真地,我将 configure.in 更改为以下内容,但不起作用.我能说的最好的是,我的更改被忽略了(即使在运行 autoreconf 之后):

Naively, I changed configure.in to the following, which did not work. The best I can tell, my changes were ignored (even after running autoreconf):

AC_CHECK_LIB(ssl, SSL_library_init|OPENSSL_init_ssl, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])

<小时>

这是 Postgrs 配置命令:


Here is the Postgrs configure command:

$ ./configure --with-openssl --with-includes=/usr/local/ssl/include --with-libraries=/usr/local/ssl/lib

这是来自 config.log 的相关条目:

Here is the relevant entry from config.log:

configure:8732: gcc -o conftest -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv
-Wno-unused-command-line-argument -I/usr/local/ssl/include
-L/usr/local/ssl/lib   -I/usr/local/ssl/include   -L/usr/local/ssl/lib
conftest.c -lssl  -lcrypto -lz -lreadline -lm  >&5
Undefined symbols for architecture x86_64:
  "_SSL_library_init", referenced from:
      _main in conftest-c0c2a1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
configure:8732: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "PostgreSQL"
| #define PACKAGE_TARNAME "postgresql"
| #define PACKAGE_VERSION "9.5.4"
| #define PACKAGE_STRING "PostgreSQL 9.5.4"
| #define PACKAGE_BUGREPORT "pgsql-bugs(at)postgresql(dot)org"
| #define PACKAGE_URL ""
| #define PG_MAJORVERSION "9.5"
| #define PG_VERSION "9.5.4"
| #define USE_INTEGER_DATETIMES 1
| #define DEF_PGPORT 5432
| #define DEF_PGPORT_STR "5432"
| #define BLCKSZ 8192
| #define RELSEG_SIZE 131072
| #define XLOG_BLCKSZ 8192
| #define XLOG_SEG_SIZE (16 * 1024 * 1024)
| #define ENABLE_THREAD_SAFETY 1
| #define PG_KRB_SRVNAM "postgres"
| #define USE_OPENSSL 1
| #define HAVE_LIBM 1
| #define HAVE_LIBREADLINE 1
| #define HAVE_LIBZ 1
| #define HAVE_SPINLOCKS 1
| #define HAVE_ATOMICS 1
| #define HAVE_LIBCRYPTO 1
| /* end confdefs.h.  */
| 
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char SSL_library_init ();
| int
| main ()
| {
| return SSL_library_init ();
|   ;
|   return 0;
| }
configure:8741: result: no
configure:8751: error: library 'ssl' is required for OpenSSL

推荐答案

这样的事情应该适合你:

Something like this should work out for you:

ACCEPT_SSL_LIB="no"
AC_CHECK_LIB(ssl, OPENSSL_init_ssl, [ACCEPT_SSL_LIB="yes"])
AC_CHECK_LIB(ssl, SSL_library_init, [ACCEPT_SSL_LIB="yes"])
AS_IF([test "x$ACCEPT_SSL_LIB" = xno], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])

您可能需要另一个变量来告诉您要调用什么 init 函数,以设置 SSL,除非头文件中有一些宏魔法可以实际将其修复为正确的值.

You may need another variable to tell you what init function to call, to set up SSL, unless there's some macro magic in a header file that will actually fix it up to the right value.

这篇关于如何告诉 Autoconf“需要符号 A 或 B"来自LIB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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