Annotation of embedaddon/curl/m4/curl-openssl.m4, revision 1.1

1.1     ! misho       1: #***************************************************************************
        !             2: #                                  _   _ ____  _
        !             3: #  Project                     ___| | | |  _ \| |
        !             4: #                             / __| | | | |_) | |
        !             5: #                            | (__| |_| |  _ <| |___
        !             6: #                             \___|\___/|_| \_\_____|
        !             7: #
        !             8: # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
        !             9: #
        !            10: # This software is licensed as described in the file COPYING, which
        !            11: # you should have received as part of this distribution. The terms
        !            12: # are also available at https://curl.haxx.se/docs/copyright.html.
        !            13: #
        !            14: # You may opt to use, copy, modify, merge, publish, distribute and/or sell
        !            15: # copies of the Software, and permit persons to whom the Software is
        !            16: # furnished to do so, under the terms of the COPYING file.
        !            17: #
        !            18: # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
        !            19: # KIND, either express or implied.
        !            20: #
        !            21: #***************************************************************************
        !            22: 
        !            23: # File version for 'aclocal' use. Keep it a single number.
        !            24: # serial 5
        !            25: 
        !            26: 
        !            27: dnl CURL_CHECK_OPENSSL_API_HEADERS
        !            28: dnl -------------------------------------------------
        !            29: dnl Find out OpenSSL headers API version, as reported
        !            30: dnl by OPENSSL_VERSION_NUMBER. No runtime checks
        !            31: dnl allowed here for cross-compilation support.
        !            32: dnl HAVE_OPENSSL_API_HEADERS is defined as appropriate
        !            33: dnl only for systems which actually run the configure
        !            34: dnl script. Config files generated manually or in any
        !            35: dnl other way shall not define this.
        !            36: 
        !            37: AC_DEFUN([CURL_CHECK_OPENSSL_API_HEADERS], [
        !            38:   #
        !            39:   tst_api="unknown"
        !            40:   #
        !            41:   AC_MSG_CHECKING([for OpenSSL headers version])
        !            42:   CURL_CHECK_DEF([OPENSSL_VERSION_NUMBER], [
        !            43: #   ifdef USE_OPENSSL
        !            44: #     include <openssl/crypto.h>
        !            45: #   else
        !            46: #     include <crypto.h>
        !            47: #   endif
        !            48:     ], [silent])
        !            49:   if test "$curl_cv_have_def_OPENSSL_VERSION_NUMBER" = "yes"; then
        !            50:     tst_verlen=`expr "$curl_cv_def_OPENSSL_VERSION_NUMBER" : '.*'`
        !            51:     case "x$tst_verlen" in
        !            52:       x6)
        !            53:         tst_vermaj=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 3`
        !            54:         tst_vermin=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 4`
        !            55:         tst_verfix=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 5`
        !            56:         tst_api=0x$tst_vermaj$tst_vermin$tst_verfix
        !            57:         ;;
        !            58:       x11|x10)
        !            59:         tst_vermaj=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 3`
        !            60:         tst_vermin=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 5`
        !            61:         tst_verfix=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 7`
        !            62:         tst_api=0x$tst_vermaj$tst_vermin$tst_verfix
        !            63:         ;;
        !            64:       *)
        !            65:         tst_api="unknown"
        !            66:         ;;
        !            67:     esac
        !            68:     case $tst_api in
        !            69:       0x111) tst_show="1.1.1" ;;
        !            70:       0x110) tst_show="1.1.0" ;;
        !            71:       0x102) tst_show="1.0.2" ;;
        !            72:       0x101) tst_show="1.0.1" ;;
        !            73:       0x100) tst_show="1.0.0" ;;
        !            74:       0x099) tst_show="0.9.9" ;;
        !            75:       0x098) tst_show="0.9.8" ;;
        !            76:       0x097) tst_show="0.9.7" ;;
        !            77:       0x096) tst_show="0.9.6" ;;
        !            78:       0x095) tst_show="0.9.5" ;;
        !            79:       0x094) tst_show="0.9.4" ;;
        !            80:       0x093) tst_show="0.9.3" ;;
        !            81:       0x092) tst_show="0.9.2" ;;
        !            82:       0x091) tst_show="0.9.1" ;;
        !            83:       *)     tst_show="unknown" ;;
        !            84:     esac
        !            85:     tst_show="$tst_show - $curl_cv_def_OPENSSL_VERSION_NUMBER"
        !            86:   else
        !            87:     tst_show="unknown"
        !            88:   fi
        !            89:   AC_MSG_RESULT([$tst_show])
        !            90:   #
        !            91: dnl if test "$tst_api" != "unknown"; then
        !            92: dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_HEADERS, $tst_api,
        !            93: dnl   [OpenSSL headers configure time API. Defined only by configure script.
        !            94: dnl    No matter what, do not ever define this manually or by any other means.])
        !            95: dnl fi
        !            96:   curl_openssl_api_headers=$tst_api
        !            97: ])
        !            98: 
        !            99: 
        !           100: dnl CURL_CHECK_OPENSSL_API_LIBRARY
        !           101: dnl -------------------------------------------------
        !           102: dnl Find out OpenSSL library API version, performing
        !           103: dnl only link tests in order to avoid getting fooled
        !           104: dnl by mismatched OpenSSL headers. No runtime checks
        !           105: dnl allowed here for cross-compilation support.
        !           106: dnl HAVE_OPENSSL_API_LIBRARY is defined as appropriate
        !           107: dnl only for systems which actually run the configure
        !           108: dnl script. Config files generated manually or in any
        !           109: dnl other way shall not define this.
        !           110: dnl
        !           111: dnl Most probably we should not bother attempting to
        !           112: dnl detect OpenSSL library development API versions
        !           113: dnl 0.9.9 and 1.1.0. For our intended use, detecting
        !           114: dnl released versions should be good enough.
        !           115: dnl
        !           116: dnl Given that currently we are not using the result
        !           117: dnl of this check, except for informative purposes,
        !           118: dnl lets try to figure out everything.
        !           119: 
        !           120: AC_DEFUN([CURL_CHECK_OPENSSL_API_LIBRARY], [
        !           121:   #
        !           122:   tst_api="unknown"
        !           123:   #
        !           124:   AC_MSG_CHECKING([for OpenSSL library version])
        !           125:   if test "$tst_api" = "unknown"; then
        !           126:     AC_LINK_IFELSE([
        !           127:       AC_LANG_FUNC_LINK_TRY([ERR_clear_last_mark])
        !           128:     ],[
        !           129:       tst_api="0x111"
        !           130:     ])
        !           131:   fi
        !           132:   if test "$tst_api" = "unknown"; then
        !           133:     case $host in
        !           134:       *-*-vms*)
        !           135:         AC_LINK_IFELSE([
        !           136:           AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumbl_sess_cb])
        !           137:         ],[
        !           138:           tst_api="0x110"
        !           139:         ])
        !           140:         ;;
        !           141:       *)
        !           142:         AC_LINK_IFELSE([
        !           143:           AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumable_session_callback])
        !           144:         ],[
        !           145:           tst_api="0x110"
        !           146:         ])
        !           147:         ;;
        !           148:     esac
        !           149:   fi
        !           150:   if test "$tst_api" = "unknown"; then
        !           151:     AC_LINK_IFELSE([
        !           152:       AC_LANG_FUNC_LINK_TRY([SSL_CONF_CTX_new])
        !           153:     ],[
        !           154:       tst_api="0x102"
        !           155:     ])
        !           156:   fi
        !           157:   if test "$tst_api" = "unknown"; then
        !           158:     AC_LINK_IFELSE([
        !           159:       AC_LANG_FUNC_LINK_TRY([SSL_renegotiate_abbreviated])
        !           160:     ],[
        !           161:       tst_api="0x101"
        !           162:     ])
        !           163:   fi
        !           164:   if test "$tst_api" = "unknown"; then
        !           165:     AC_LINK_IFELSE([
        !           166:       AC_LANG_FUNC_LINK_TRY([OBJ_add_sigid])
        !           167:     ],[
        !           168:       tst_api="0x100"
        !           169:     ])
        !           170:   fi
        !           171:   if test "$tst_api" = "unknown"; then
        !           172:     AC_LINK_IFELSE([
        !           173:       AC_LANG_FUNC_LINK_TRY([ERR_set_mark])
        !           174:     ],[
        !           175:       tst_api="0x098"
        !           176:     ])
        !           177:   fi
        !           178:   if test "$tst_api" = "unknown"; then
        !           179:     AC_LINK_IFELSE([
        !           180:       AC_LANG_FUNC_LINK_TRY([ERR_peek_last_error])
        !           181:     ],[
        !           182:       tst_api="0x097"
        !           183:     ])
        !           184:   fi
        !           185:   if test "$tst_api" = "unknown"; then
        !           186:     AC_LINK_IFELSE([
        !           187:       AC_LANG_FUNC_LINK_TRY([c2i_ASN1_OBJECT])
        !           188:     ],[
        !           189:       tst_api="0x096"
        !           190:     ])
        !           191:   fi
        !           192:   if test "$tst_api" = "unknown"; then
        !           193:     AC_LINK_IFELSE([
        !           194:       AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_purpose])
        !           195:     ],[
        !           196:       tst_api="0x095"
        !           197:     ])
        !           198:   fi
        !           199:   if test "$tst_api" = "unknown"; then
        !           200:     AC_LINK_IFELSE([
        !           201:       AC_LANG_FUNC_LINK_TRY([OBJ_obj2txt])
        !           202:     ],[
        !           203:       tst_api="0x094"
        !           204:     ])
        !           205:   fi
        !           206:   if test "$tst_api" = "unknown"; then
        !           207:     AC_LINK_IFELSE([
        !           208:       AC_LANG_FUNC_LINK_TRY([SSL_get_verify_depth])
        !           209:     ],[
        !           210:       tst_api="0x093"
        !           211:     ])
        !           212:   fi
        !           213:   if test "$tst_api" = "unknown"; then
        !           214:     AC_LINK_IFELSE([
        !           215:       AC_LANG_FUNC_LINK_TRY([SSL_library_init])
        !           216:     ],[
        !           217:       tst_api="0x092"
        !           218:     ])
        !           219:   fi
        !           220:   if test "$tst_api" = "unknown"; then
        !           221:     AC_LINK_IFELSE([
        !           222:       AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_cipher_list])
        !           223:     ],[
        !           224:       tst_api="0x091"
        !           225:     ])
        !           226:   fi
        !           227:   case $tst_api in
        !           228:     0x111) tst_show="1.1.1" ;;
        !           229:     0x110) tst_show="1.1.0" ;;
        !           230:     0x102) tst_show="1.0.2" ;;
        !           231:     0x101) tst_show="1.0.1" ;;
        !           232:     0x100) tst_show="1.0.0" ;;
        !           233:     0x099) tst_show="0.9.9" ;;
        !           234:     0x098) tst_show="0.9.8" ;;
        !           235:     0x097) tst_show="0.9.7" ;;
        !           236:     0x096) tst_show="0.9.6" ;;
        !           237:     0x095) tst_show="0.9.5" ;;
        !           238:     0x094) tst_show="0.9.4" ;;
        !           239:     0x093) tst_show="0.9.3" ;;
        !           240:     0x092) tst_show="0.9.2" ;;
        !           241:     0x091) tst_show="0.9.1" ;;
        !           242:     *)     tst_show="unknown" ;;
        !           243:   esac
        !           244:   AC_MSG_RESULT([$tst_show])
        !           245:   #
        !           246: dnl if test "$tst_api" != "unknown"; then
        !           247: dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_LIBRARY, $tst_api,
        !           248: dnl   [OpenSSL library link time API. Defined only by configure script.
        !           249: dnl    No matter what, do not ever define this manually or by any other means.])
        !           250: dnl fi
        !           251:   curl_openssl_api_library=$tst_api
        !           252: ])
        !           253: 
        !           254: 
        !           255: dnl CURL_CHECK_OPENSSL_API
        !           256: dnl -------------------------------------------------
        !           257: 
        !           258: AC_DEFUN([CURL_CHECK_OPENSSL_API], [
        !           259:   #
        !           260:   CURL_CHECK_OPENSSL_API_HEADERS
        !           261:   CURL_CHECK_OPENSSL_API_LIBRARY
        !           262:   #
        !           263:   tst_match="yes"
        !           264:   #
        !           265:   AC_MSG_CHECKING([for OpenSSL headers and library versions matching])
        !           266:   if test "$curl_openssl_api_headers" = "unknown" ||
        !           267:     test "$curl_openssl_api_library" = "unknown"; then
        !           268:     tst_match="fail"
        !           269:     tst_warns="Can not compare OpenSSL headers and library versions."
        !           270:   elif test "$curl_openssl_api_headers" != "$curl_openssl_api_library"; then
        !           271:     tst_match="no"
        !           272:     tst_warns="OpenSSL headers and library versions do not match."
        !           273:   fi
        !           274:   AC_MSG_RESULT([$tst_match])
        !           275:   if test "$tst_match" != "yes"; then
        !           276:     AC_MSG_WARN([$tst_warns])
        !           277:   fi
        !           278: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>