How to tell Autoconf “require symbol A or B” from LIB?

后端 未结 2 788
礼貌的吻别
礼貌的吻别 2021-01-26 02:15

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

相关标签:
2条回答
  • 2021-01-26 02:30

    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])])
    

    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.

    0 讨论(0)
  • 2021-01-26 02:40

    To build upon @ldav1s' answer, here are the changes to configure.in required to get past configuration. Once configure.in is modified, autoreconf should be run.

    $ git diff configure.in > configure.in.diff
    
    $ cat configure.in.diff 
    diff --git a/configure.in b/configure.in
    index c878b4e..7ba7538 100644
    --- a/configure.in
    +++ b/configure.in
    @@ -1112,10 +1112,16 @@ if test "$with_openssl" = yes ; then
       dnl Order matters!
       if test "$PORTNAME" != "win32"; then
          AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
    -     AC_CHECK_LIB(ssl,    SSL_library_init, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
    +     FOUND_SSL_LIB="no"
    +     AC_CHECK_LIB(ssl, OPENSSL_init_ssl, [FOUND_SSL_LIB="yes"])
    +     AC_CHECK_LIB(ssl, SSL_library_init, [FOUND_SSL_LIB="yes"])
    +     AS_IF([test "x$FOUND_SSL_LIB" = xno], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
       else
          AC_SEARCH_LIBS(CRYPTO_new_ex_data, eay32 crypto, [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
    -     AC_SEARCH_LIBS(SSL_library_init, ssleay32 ssl, [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
    +     FOUND_SSL_LIB="no"
    +     AC_SEARCH_LIBS(OPENSSL_init_ssl, ssleay32 ssl, [FOUND_SSL_LIB="yes"])
    +     AC_SEARCH_LIBS(SSL_library_init, ssleay32 ssl, [FOUND_SSL_LIB="yes"])
    +     AS_IF([test "x$FOUND_SSL_LIB" = xno], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
       fi
       AC_CHECK_FUNCS([SSL_get_current_compression])
     fi
    
    0 讨论(0)
提交回复
热议问题