xref: /unit/auto/ssltls (revision 1942:296628096d6c)
10Sigor@sysoev.ru
20Sigor@sysoev.ru# Copyright (C) Igor Sysoev
30Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
40Sigor@sysoev.ru
50Sigor@sysoev.ru
60Sigor@sysoev.ruNXT_OPENSSL_CFLAGS=
70Sigor@sysoev.ruNXT_OPENSSL_LIBS=
80Sigor@sysoev.ruNXT_GNUTLS_CFLAGS=
90Sigor@sysoev.ruNXT_GNUTLS_LIBS=
100Sigor@sysoev.ruNXT_OPENSSL_LIBS=
110Sigor@sysoev.ruNXT_CYASSL_CFLAGS=
120Sigor@sysoev.ruNXT_CYASSL_LIBS=
130Sigor@sysoev.ruNXT_POLARSSL_CFLAGS=
140Sigor@sysoev.ruNXT_POLARSSL_LIBS=
150Sigor@sysoev.ru
160Sigor@sysoev.ru
170Sigor@sysoev.ruif [ $NXT_OPENSSL = YES ]; then
180Sigor@sysoev.ru
190Sigor@sysoev.ru    nxt_feature="OpenSSL library"
200Sigor@sysoev.ru    nxt_feature_name=NXT_HAVE_OPENSSL
210Sigor@sysoev.ru    nxt_feature_run=yes
220Sigor@sysoev.ru    nxt_feature_incs=
230Sigor@sysoev.ru    nxt_feature_libs="-lssl -lcrypto"
240Sigor@sysoev.ru    nxt_feature_test="#include <openssl/ssl.h>
250Sigor@sysoev.ru
260Sigor@sysoev.ru                      int main() {
270Sigor@sysoev.ru                          SSL_library_init();
280Sigor@sysoev.ru                          return 0;
290Sigor@sysoev.ru                      }"
300Sigor@sysoev.ru    . auto/feature
310Sigor@sysoev.ru
320Sigor@sysoev.ru
330Sigor@sysoev.ru    if [ $nxt_found = yes ]; then
34771Sigor@sysoev.ru        NXT_TLS=YES
350Sigor@sysoev.ru        NXT_OPENSSL_LIBS="$nxt_feature_libs"
360Sigor@sysoev.ru
370Sigor@sysoev.ru        nxt_feature="OpenSSL version"
380Sigor@sysoev.ru        nxt_feature_name=NXT_HAVE_OPENSSL_VERSION
390Sigor@sysoev.ru        nxt_feature_run=value
400Sigor@sysoev.ru        nxt_feature_test="#include <openssl/ssl.h>
410Sigor@sysoev.ru
420Sigor@sysoev.ru                          int main() {
430Sigor@sysoev.ru                              printf(\"\\\"%s\\\"\",
440Sigor@sysoev.ru                                     SSLeay_version(SSLEAY_VERSION));
450Sigor@sysoev.ru                              return 0;
460Sigor@sysoev.ru                          }"
470Sigor@sysoev.ru        . auto/feature
480Sigor@sysoev.ru
490Sigor@sysoev.ru    else
500Sigor@sysoev.ru        $echo
510Sigor@sysoev.ru        $echo $0: error: no OpenSSL library found.
520Sigor@sysoev.ru        $echo
530Sigor@sysoev.ru        exit 1;
540Sigor@sysoev.ru    fi
551885Sa.suvorov@f5.com
561885Sa.suvorov@f5.com
571885Sa.suvorov@f5.com    nxt_feature="OpenSSL SSL_CONF_cmd()"
581885Sa.suvorov@f5.com    nxt_feature_name=NXT_HAVE_OPENSSL_CONF_CMD
591885Sa.suvorov@f5.com    nxt_feature_run=
601885Sa.suvorov@f5.com    nxt_feature_incs=
611885Sa.suvorov@f5.com    nxt_feature_libs="$NXT_OPENSSL_LIBS"
621885Sa.suvorov@f5.com    nxt_feature_test="#include <openssl/ssl.h>
631885Sa.suvorov@f5.com
641885Sa.suvorov@f5.com                      int main() {
651885Sa.suvorov@f5.com                          SSL_CONF_cmd(NULL, NULL, NULL);
661885Sa.suvorov@f5.com                          return 0;
671885Sa.suvorov@f5.com                      }"
681885Sa.suvorov@f5.com    . auto/feature
69*1942Sa.suvorov@f5.com
70*1942Sa.suvorov@f5.com
71*1942Sa.suvorov@f5.com    nxt_feature="OpenSSL tlsext support"
72*1942Sa.suvorov@f5.com    nxt_feature_name=NXT_HAVE_OPENSSL_TLSEXT
73*1942Sa.suvorov@f5.com    nxt_feature_run=
74*1942Sa.suvorov@f5.com    nxt_feature_incs=
75*1942Sa.suvorov@f5.com    nxt_feature_libs="$NXT_OPENSSL_LIBS"
76*1942Sa.suvorov@f5.com    nxt_feature_test="#include <openssl/ssl.h>
77*1942Sa.suvorov@f5.com
78*1942Sa.suvorov@f5.com                      int main() {
79*1942Sa.suvorov@f5.com                          #if (OPENSSL_NO_TLSEXT)
80*1942Sa.suvorov@f5.com                          #error OpenSSL: no tlsext support.
81*1942Sa.suvorov@f5.com                          #else
82*1942Sa.suvorov@f5.com                          return 0;
83*1942Sa.suvorov@f5.com                          #endif
84*1942Sa.suvorov@f5.com                      }"
85*1942Sa.suvorov@f5.com    . auto/feature
860Sigor@sysoev.rufi
870Sigor@sysoev.ru
880Sigor@sysoev.ru
890Sigor@sysoev.ruif [ $NXT_GNUTLS = YES ]; then
900Sigor@sysoev.ru
910Sigor@sysoev.ru    if /bin/sh -c "(pkg-config gnutls --exists)" >> $NXT_AUTOCONF_ERR 2>&1;
920Sigor@sysoev.ru    then
930Sigor@sysoev.ru        NXT_GNUTLS_CFLAGS=`pkg-config gnutls --cflags`
940Sigor@sysoev.ru        NXT_GNUTLS_LIBS=`pkg-config gnutls --libs`
950Sigor@sysoev.ru
960Sigor@sysoev.ru        nxt_feature="GnuTLS library"
970Sigor@sysoev.ru        nxt_feature_name=NXT_HAVE_GNUTLS
980Sigor@sysoev.ru        nxt_feature_run=yes
990Sigor@sysoev.ru        nxt_feature_incs=$NXT_GNUTLS_CFLAGS
1000Sigor@sysoev.ru        nxt_feature_libs=$NXT_GNUTLS_LIBS
1010Sigor@sysoev.ru        nxt_feature_test="#include <gnutls/gnutls.h>
1020Sigor@sysoev.ru
1030Sigor@sysoev.ru                          int main() {
1040Sigor@sysoev.ru                              gnutls_global_init();
1050Sigor@sysoev.ru                              gnutls_global_deinit();
1060Sigor@sysoev.ru                              return 0;
1070Sigor@sysoev.ru                          }"
1080Sigor@sysoev.ru        . auto/feature
1090Sigor@sysoev.ru
1100Sigor@sysoev.ru
1110Sigor@sysoev.ru        if [ $nxt_found = yes ]; then
112771Sigor@sysoev.ru            NXT_TLS=YES
1130Sigor@sysoev.ru
1140Sigor@sysoev.ru            $echo " + GnuTLS version: `pkg-config gnutls --modversion`"
1150Sigor@sysoev.ru
1160Sigor@sysoev.ru
1170Sigor@sysoev.ru            nxt_feature="gnutls_transport_set_vec_push_function"
1180Sigor@sysoev.ru            nxt_feature_name=NXT_HAVE_GNUTLS_VEC_PUSH
1190Sigor@sysoev.ru            nxt_feature_run=no
1200Sigor@sysoev.ru            nxt_feature_incs=$NXT_GNUTLS_CFLAGS
1210Sigor@sysoev.ru            nxt_feature_libs=$NXT_GNUTLS_LIBS
1220Sigor@sysoev.ru            nxt_feature_test="#include <gnutls/gnutls.h>
1230Sigor@sysoev.ru
1240Sigor@sysoev.ru                      int main() {
1250Sigor@sysoev.ru                          gnutls_transport_set_vec_push_function(NULL, NULL);
1260Sigor@sysoev.ru                          return 0;
1270Sigor@sysoev.ru                      }"
1280Sigor@sysoev.ru            . auto/feature
1290Sigor@sysoev.ru
1300Sigor@sysoev.ru
1310Sigor@sysoev.ru            nxt_feature="gnutls_global_set_time_function"
1320Sigor@sysoev.ru            nxt_feature_name=NXT_HAVE_GNUTLS_SET_TIME
1330Sigor@sysoev.ru            nxt_feature_run=no
1340Sigor@sysoev.ru            nxt_feature_incs=$NXT_GNUTLS_CFLAGS
1350Sigor@sysoev.ru            nxt_feature_libs=$NXT_GNUTLS_LIBS
1360Sigor@sysoev.ru            nxt_feature_test="#include <gnutls/gnutls.h>
1370Sigor@sysoev.ru
1380Sigor@sysoev.ru                      int main() {
1390Sigor@sysoev.ru                          gnutls_global_set_time_function(NULL);
1400Sigor@sysoev.ru                          return 0;
1410Sigor@sysoev.ru                      }"
1420Sigor@sysoev.ru            . auto/feature
1430Sigor@sysoev.ru
1440Sigor@sysoev.ru        else
1450Sigor@sysoev.ru            $echo
1460Sigor@sysoev.ru            $echo $0: error: no GnuTLS library found.
1470Sigor@sysoev.ru            $echo
1480Sigor@sysoev.ru            exit 1;
1490Sigor@sysoev.ru        fi
1500Sigor@sysoev.ru    fi
1510Sigor@sysoev.rufi
1520Sigor@sysoev.ru
1530Sigor@sysoev.ru
1540Sigor@sysoev.ruif [ $NXT_CYASSL = YES ]; then
1550Sigor@sysoev.ru
1560Sigor@sysoev.ru    nxt_feature="CyaSSL library"
1570Sigor@sysoev.ru    nxt_feature_name=NXT_HAVE_CYASSL
1580Sigor@sysoev.ru    nxt_feature_run=yes
1590Sigor@sysoev.ru    nxt_feature_incs=
1600Sigor@sysoev.ru    nxt_feature_libs="-lcyassl"
1610Sigor@sysoev.ru    nxt_feature_test="#include <cyassl/ssl.h>
1620Sigor@sysoev.ru
1630Sigor@sysoev.ru                      int main() {
1640Sigor@sysoev.ru                          CyaSSL_Init();
1650Sigor@sysoev.ru                          CyaSSL_Cleanup();
1660Sigor@sysoev.ru                          return 0;
1670Sigor@sysoev.ru                      }"
1680Sigor@sysoev.ru    . auto/feature
1690Sigor@sysoev.ru
1700Sigor@sysoev.ru
1710Sigor@sysoev.ru    if [ $nxt_found = yes ]; then
172771Sigor@sysoev.ru        NXT_TLS=YES
1730Sigor@sysoev.ru        NXT_CYASSL_CFLAGS="$nxt_feature_incs"
1740Sigor@sysoev.ru        NXT_CYASSL_LIBS="$nxt_feature_libs"
1750Sigor@sysoev.ru
1760Sigor@sysoev.ru    else
1770Sigor@sysoev.ru        $echo
1780Sigor@sysoev.ru        $echo $0: error: no CyaSSL library found.
1790Sigor@sysoev.ru        $echo
1800Sigor@sysoev.ru        exit 1;
1810Sigor@sysoev.ru    fi
1820Sigor@sysoev.rufi
1830Sigor@sysoev.ru
1840Sigor@sysoev.ru
1850Sigor@sysoev.ruif [ $NXT_POLARSSL = YES ]; then
1860Sigor@sysoev.ru
1870Sigor@sysoev.ru    nxt_feature="PolarSSL library"
1880Sigor@sysoev.ru    nxt_feature_name=NXT_HAVE_POLARSSL
1890Sigor@sysoev.ru    nxt_feature_run=yes
1900Sigor@sysoev.ru    nxt_feature_incs=
1910Sigor@sysoev.ru    nxt_feature_libs="-lpolarssl"
1920Sigor@sysoev.ru    nxt_feature_test="#include <polarssl/ssl.h>
1930Sigor@sysoev.ru
1940Sigor@sysoev.ru                      int main() {
1950Sigor@sysoev.ru                          ssl_context  ssl;
1960Sigor@sysoev.ru                          memset(&ssl, '\0', sizeof(ssl));
1970Sigor@sysoev.ru                          ssl_init(&ssl);
1980Sigor@sysoev.ru                          ssl_free(&ssl);
1990Sigor@sysoev.ru                          return 0;
2000Sigor@sysoev.ru                      }"
2010Sigor@sysoev.ru    . auto/feature
2020Sigor@sysoev.ru
2030Sigor@sysoev.ru
2040Sigor@sysoev.ru    if [ $nxt_found = yes ]; then
205771Sigor@sysoev.ru        NXT_TLS=YES
2060Sigor@sysoev.ru        NXT_POLARSSL_CFLAGS="$nxt_feature_incs"
2070Sigor@sysoev.ru        NXT_POLARSSL_LIBS="$nxt_feature_libs"
2080Sigor@sysoev.ru
2090Sigor@sysoev.ru    else
2100Sigor@sysoev.ru        $echo
2110Sigor@sysoev.ru        $echo $0: error: no PolarSSL library found.
2120Sigor@sysoev.ru        $echo
2130Sigor@sysoev.ru        exit 1;
2140Sigor@sysoev.ru    fi
2150Sigor@sysoev.rufi
216