conf 5.8 KB

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