1 2# Copyright (C) Igor Sysoev 3# Copyright (C) Nginx, Inc. 4 5 6if [ $OPENSSL != NONE ]; then 7 8 case "$CC" in 9 10 cl | bcc32) 11 have=NGX_OPENSSL . auto/have 12 have=NGX_SSL . auto/have 13 14 CFLAGS="$CFLAGS -DNO_SYS_TYPES_H" 15 16 CORE_INCS="$CORE_INCS $OPENSSL/openssl/include" 17 CORE_DEPS="$CORE_DEPS $OPENSSL/openssl/include/openssl/ssl.h" 18 19 if [ -f $OPENSSL/ms/do_ms.bat ]; then 20 # before OpenSSL 1.1.0 21 CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/ssleay32.lib" 22 CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libeay32.lib" 23 else 24 # OpenSSL 1.1.0+ 25 CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libssl.lib" 26 CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libcrypto.lib" 27 fi 28 29 # libeay32.lib requires gdi32.lib 30 CORE_LIBS="$CORE_LIBS gdi32.lib" 31 # OpenSSL 1.0.0 requires crypt32.lib 32 CORE_LIBS="$CORE_LIBS crypt32.lib" 33 ;; 34 35 *) 36 have=NGX_OPENSSL . auto/have 37 have=NGX_SSL . auto/have 38 39 CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include" 40 CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h" 41 CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a" 42 CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a" 43 CORE_LIBS="$CORE_LIBS $NGX_LIBDL" 44 CORE_LIBS="$CORE_LIBS $NGX_LIBPTHREAD" 45 46 if [ "$NGX_PLATFORM" = win32 ]; then 47 CORE_LIBS="$CORE_LIBS -lgdi32 -lcrypt32 -lws2_32" 48 fi 49 ;; 50 esac 51 52else 53 54 if [ "$NGX_PLATFORM" != win32 ]; then 55 56 OPENSSL=NO 57 58 ngx_feature="OpenSSL library" 59 ngx_feature_name="NGX_OPENSSL" 60 ngx_feature_run=no 61 ngx_feature_incs="#include <openssl/ssl.h>" 62 ngx_feature_path= 63 ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL $NGX_LIBPTHREAD" 64 ngx_feature_test="SSL_CTX_set_options(NULL, 0)" 65 . auto/feature 66 67 if [ $ngx_found = no ]; then 68 69 # FreeBSD port 70 71 ngx_feature="OpenSSL library in /usr/local/" 72 ngx_feature_path="/usr/local/include" 73 74 if [ $NGX_RPATH = YES ]; then 75 ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto" 76 else 77 ngx_feature_libs="-L/usr/local/lib -lssl -lcrypto" 78 fi 79 80 ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD" 81 82 . auto/feature 83 fi 84 85 if [ $ngx_found = no ]; then 86 87 # NetBSD port 88 89 ngx_feature="OpenSSL library in /usr/pkg/" 90 ngx_feature_path="/usr/pkg/include" 91 92 if [ $NGX_RPATH = YES ]; then 93 ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto" 94 else 95 ngx_feature_libs="-L/usr/pkg/lib -lssl -lcrypto" 96 fi 97 98 ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD" 99 100 . auto/feature 101 fi 102 103 if [ $ngx_found = no ]; then 104 105 # MacPorts 106 107 ngx_feature="OpenSSL library in /opt/local/" 108 ngx_feature_path="/opt/local/include" 109 110 if [ $NGX_RPATH = YES ]; then 111 ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lssl -lcrypto" 112 else 113 ngx_feature_libs="-L/opt/local/lib -lssl -lcrypto" 114 fi 115 116 ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD" 117 118 . auto/feature 119 fi 120 121 if [ $ngx_found = yes ]; then 122 have=NGX_SSL . auto/have 123 CORE_INCS="$CORE_INCS $ngx_feature_path" 124 CORE_LIBS="$CORE_LIBS $ngx_feature_libs" 125 OPENSSL=YES 126 fi 127 fi 128 129 if [ $OPENSSL != YES ]; then 130 131cat << END 132 133$0: error: SSL modules require the OpenSSL library. 134You can either do not enable the modules, or install the OpenSSL library 135into the system, or build the OpenSSL library statically from the source 136with nginx by using --with-openssl=<path> option. 137 138END 139 exit 1 140 fi 141 142fi 143