conf 4.0 KB

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