diff options
author | Yang Tse <yangsita@gmail.com> | 2011-06-09 00:45:38 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2011-06-09 00:45:38 +0200 |
commit | 7530a288780694055587b45901e65e0a27d97512 (patch) | |
tree | 4066e14559c60b696f5ed8d262556414d13d6903 | |
parent | e8d73c9c2d6094874755e457012c1773ecccca20 (diff) |
configure: get API info for a couple of OpenSSL functions (followup 1)
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | m4/curl-openssl.m4 | 320 |
2 files changed, 258 insertions, 68 deletions
diff --git a/configure.ac b/configure.ac index c37ab3d35..f1977443f 100644 --- a/configure.ac +++ b/configure.ac @@ -1531,8 +1531,10 @@ if test X"$OPT_SSL" != Xno; then export LD_LIBRARY_PATH AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH]) fi - CURL_CHECK_OPENSSL_ADD_ALL_API - CURL_CHECK_OPENSSL_DESRANDKEY_API + CURL_CHECK_OPENSSL_ADD_ALL_ALGORITHMS_API + CURL_CHECK_OPENSSL_DES_RANDOM_KEY_API + CURL_CHECK_OPENSSL_HEADERS_VERSION + CURL_CHECK_OPENSSL_LIBRARY_VERSION fi fi diff --git a/m4/curl-openssl.m4 b/m4/curl-openssl.m4 index f32bfd103..3cbff46ae 100644 --- a/m4/curl-openssl.m4 +++ b/m4/curl-openssl.m4 @@ -21,91 +21,91 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 1 +# serial 2 -dnl CURL_CHECK_OPENSSL_ADD_ALL_API +dnl CURL_CHECK_OPENSSL_ADD_ALL_ALGORITHMS_API dnl ------------------------------------------------- dnl Link time verification check of which API is -dnl used for for the *_add_all_algorithms function. +dnl used for OpenSSL_add_all_algorithms function. +dnl HAVE_OPENSSL_ADD_ALL_ALGORITHMS_API gets defined as +dnl apprpriate only for systems which actually run the +dnl configure script. Config files generated manually +dnl or in any other way shall not define this. -AC_DEFUN([CURL_CHECK_OPENSSL_ADD_ALL_API], [ +AC_DEFUN([CURL_CHECK_OPENSSL_ADD_ALL_ALGORITHMS_API], [ # - tst_links_add_all_api_091="unknown" - tst_links_add_all_api_095="unknown" - tst_links_add_all_api_097="unknown" + tst_openssl_add_all_algorithms_api="unknown" # - AC_MSG_CHECKING([if OpenSSL *_add_all_algorithms API is 0.9.1]) + AC_MSG_CHECKING([for OpenSSL_add_all_algorithms API]) AC_LINK_IFELSE([ AC_LANG_PROGRAM([[ ]],[[ - SSLeay_add_all_algorithms(); + OPENSSL_add_all_algorithms_conf(); + OPENSSL_add_all_algorithms_noconf(); ]]) ],[ - AC_MSG_RESULT([yes]) - tst_links_add_all_api_091="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_add_all_api_091="no" + tst_openssl_add_all_algorithms_api="0x097" ]) - if test "$tst_links_add_all_api_091" != "yes"; then - AC_MSG_CHECKING([if OpenSSL *_add_all_algorithms API is 0.9.5]) + if test "$tst_openssl_add_all_algorithms_api" = "unknown"; then AC_LINK_IFELSE([ AC_LANG_PROGRAM([[ ]],[[ OpenSSL_add_all_algorithms(); ]]) ],[ - AC_MSG_RESULT([yes]) - tst_links_add_all_api_095="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_add_all_api_095="no" + tst_openssl_add_all_algorithms_api="0x095" ]) fi - if test "$tst_links_add_all_api_091" != "yes" && - test "$tst_links_add_all_api_095" != "yes"; then - AC_MSG_CHECKING([if OpenSSL *_add_all_algorithms API is 0.9.7]) + if test "$tst_openssl_add_all_algorithms_api" = "unknown"; then AC_LINK_IFELSE([ AC_LANG_PROGRAM([[ ]],[[ - OPENSSL_add_all_algorithms_conf(); - OPENSSL_add_all_algorithms_noconf(); + SSLeay_add_all_algorithms(); ]]) ],[ - AC_MSG_RESULT([yes]) - tst_links_add_all_api_097="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_add_all_api_097="no" + tst_openssl_add_all_algorithms_api="0x091" ]) fi + case "$tst_openssl_add_all_algorithms_api" in + 0x097) + tst_show="0.9.7" + ;; + 0x095) + tst_show="0.9.5" + ;; + 0x091) + tst_show="0.9.1" + ;; + *) + tst_show="unknown" + ;; + esac + AC_MSG_RESULT([$tst_show]) # - if test "$tst_links_add_all_api_091" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_OPENSSL_ADD_ALL_API_091, 1, - [Define to 1 if OpenSSL *_add_all_algorithms API is 0.9.1]) - elif test "$tst_links_add_all_api_095" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_OPENSSL_ADD_ALL_API_095, 1, - [Define to 1 if OpenSSL *_add_all_algorithms API is 0.9.5]) - elif test "$tst_links_add_all_api_097" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_OPENSSL_ADD_ALL_API_097, 1, - [Define to 1 if OpenSSL *_add_all_algorithms API is 0.9.7]) + if test "$tst_openssl_add_all_algorithms_api" != "unknown"; then + AC_DEFINE_UNQUOTED(HAVE_OPENSSL_ADD_ALL_ALGORITHMS_API, + $tst_openssl_add_all_algorithms_api, + [OpenSSL link time API for OpenSSL_add_all_algorithms function. Configure + script only definition. No matter what, do not ever define yourself.]) fi ]) -dnl CURL_CHECK_OPENSSL_DESRANDKEY_API +dnl CURL_CHECK_OPENSSL_DES_RANDOM_KEY_API dnl ------------------------------------------------- -dnl Verify if DES_random_key or des_random_key can be -dnl linked. When true, define HAVE_DES_RANDOM_KEY_097 -dnl or HAVE_DES_RANDOM_KEY_LOWER. +dnl Link time verification check of which API is +dnl used for OpenSSL DES_random_key function. +dnl HAVE_OPENSSL_DES_RANDOM_KEY_API gets defined as +dnl apprpriate only for systems which actually run the +dnl configure script. Config files generated manually +dnl or in any other way shall not define this. -AC_DEFUN([CURL_CHECK_OPENSSL_DESRANDKEY_API], [ +AC_DEFUN([CURL_CHECK_OPENSSL_DES_RANDOM_KEY_API], [ # - tst_links_des_random_key_api_097="unknown" - tst_links_des_random_key_api_095="unknown" + tst_openssl_des_random_key_api="unknown" # - AC_MSG_CHECKING([if OpenSSL des_random_key API is 0.9.7]) + AC_MSG_CHECKING([for OpenSSL DES_random_key API]) AC_LINK_IFELSE([ AC_LANG_PROGRAM([[ ]],[[ @@ -113,14 +113,9 @@ AC_DEFUN([CURL_CHECK_OPENSSL_DESRANDKEY_API], [ return 1; ]]) ],[ - AC_MSG_RESULT([yes]) - tst_links_des_random_key_api_097="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_des_random_key_api_097="no" + tst_openssl_des_random_key_api="0x097" ]) - if test "$tst_links_des_random_key_api_097" != "yes"; then - AC_MSG_CHECKING([if OpenSSL des_random_key API is 0.9.5]) + if test "$tst_openssl_des_random_key_api" = "unknown"; then AC_LINK_IFELSE([ AC_LANG_PROGRAM([[ ]],[[ @@ -128,19 +123,212 @@ AC_DEFUN([CURL_CHECK_OPENSSL_DESRANDKEY_API], [ return 1; ]]) ],[ - AC_MSG_RESULT([yes]) - tst_links_des_random_key_api_095="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_des_random_key_api_095="no" + tst_openssl_des_random_key_api="0x095" ]) fi + case "$tst_openssl_des_random_key_api" in + 0x097) + tst_show="0.9.7" + ;; + 0x095) + tst_show="0.9.5" + ;; + *) + tst_show="unknown" + ;; + esac + AC_MSG_RESULT([$tst_show]) + # + if test "$tst_openssl_des_random_key_api" != "unknown"; then + AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DES_RANDOM_KEY_API, + $tst_openssl_des_random_key_api, + [OpenSSL link time API for OpenSSL DES_random_key function. Configure + script only definition. No matter what, do not ever define yourself.]) + fi +]) + + +dnl CURL_CHECK_OPENSSL_HEADERS_VERSION +dnl ------------------------------------------------- +dnl Find out OpenSSL headers API version, as reported +dnl by OPENSSL_VERSION_NUMBER. No runtime checks +dnl allowed here for cross-compilation sake. + +AC_DEFUN([CURL_CHECK_OPENSSL_HEADERS_VERSION], [ + # + AC_MSG_CHECKING([for OpenSSL headers version]) + # + tst_openssl_headers_api="unknown" + # + CURL_CHECK_DEF([OPENSSL_VERSION_NUMBER], [ +# ifdef USE_OPENSSL +# include <openssl/crypto.h> +# else +# include <crypto.h> +# endif + ], [silent]) + if test "$curl_cv_have_def_OPENSSL_VERSION_NUMBER" = "yes"; then + tst_openssl_headers_api=$curl_cv_def_OPENSSL_VERSION_NUMBER + fi + AC_MSG_RESULT([$tst_openssl_headers_api]) + # +]) + + +dnl CURL_CHECK_OPENSSL_LIBRARY_VERSION +dnl ------------------------------------------------- +dnl Find out OpenSSL library API version, performing +dnl only link tests in order to avoid getting fooled +dnl by mismatched OpenSSL headers. No runtime checks +dnl allowed here for cross-compilation sake. + +AC_DEFUN([CURL_CHECK_OPENSSL_LIBRARY_VERSION], [ + # + AC_MSG_CHECKING([for OpenSSL library version]) + # + tst_openssl_library_api="unknown" # - if test "$tst_links_des_random_key_api_097" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DESRANDKEY_API_097, 1, - [Define to 1 if OpenSSL des_random_key API is 0.9.7]) - elif test "$tst_links_des_random_key_api_095" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DESRANDKEY_API_095, 1, - [Define to 1 if OpenSSL des_random_key API is 0.9.5]) + if test "$tst_openssl_library_api" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + if(0 != OBJ_add_sigid(0, 0, 0)) + return 1; + ]]) + ],[ + dnl 1.0.0 or newer + tst_openssl_library_api="0x100" + ]) + fi + if test "$tst_openssl_library_api" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + if(0 != ERR_set_mark()) + return 1; + ]]) + ],[ + dnl 0.9.8 or newer + tst_openssl_library_api="0x098" + ]) + fi + if test "$tst_openssl_library_api" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + if(0 != ERR_peek_last_error()) + return 1; + ]]) + ],[ + dnl 0.9.7 or newer + tst_openssl_library_api="0x097" + ]) + fi + if test "$tst_openssl_library_api" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + if(0 != c2i_ASN1_OBJECT(0, 0, 0)) + return 1; + ]]) + ],[ + dnl 0.9.6 or newer + tst_openssl_library_api="0x096" + ]) fi + if test "$tst_openssl_library_api" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + if(0 != SSL_CTX_set_purpose(0, 0)) + return 1; + ]]) + ],[ + dnl 0.9.5 or newer + tst_openssl_library_api="0x095" + ]) + fi + if test "$tst_openssl_library_api" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + if(0 != OBJ_obj2txt(0, 0, 0, 0)) + return 1; + ]]) + ],[ + dnl 0.9.4 or newer + tst_openssl_library_api="0x094" + ]) + fi + if test "$tst_openssl_library_api" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + if(0 != SSL_get_verify_depth(0)) + return 1; + ]]) + ],[ + dnl 0.9.3 or newer + tst_openssl_library_api="0x093" + ]) + fi + if test "$tst_openssl_library_api" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + if(0 != SSL_library_init()) + return 1; + ]]) + ],[ + dnl 0.9.2 or newer + tst_openssl_library_api="0x092" + ]) + fi + if test "$tst_openssl_library_api" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + if(0 != SSL_CTX_set_cipher_list(0, 0)) + return 1; + ]]) + ],[ + dnl 0.9.1 or newer + tst_openssl_library_api="0x091" + ]) + fi + # + case "$tst_openssl_library_api" in + 0x100) + tst_show="1.0.0" + ;; + 0x098) + tst_show="0.9.8" + ;; + 0x097) + tst_show="0.9.7" + ;; + 0x096) + tst_show="0.9.6" + ;; + 0x095) + tst_show="0.9.5" + ;; + 0x094) + tst_show="0.9.4" + ;; + 0x093) + tst_show="0.9.3" + ;; + 0x092) + tst_show="0.9.2" + ;; + 0x091) + tst_show="0.9.1" + ;; + *) + tst_show="unknown" + ;; + esac + AC_MSG_RESULT([$tst_show]) + # ]) |