conf 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. # Copyright (C) Igor Sysoev
  2. # Copyright (C) Nginx, Inc.
  3. if [ $PCRE != NONE ]; then
  4. CORE_INCS="$CORE_INCS $PCRE"
  5. case "$NGX_CC_NAME" in
  6. msvc | owc | bcc)
  7. have=NGX_PCRE . auto/have
  8. have=PCRE_STATIC . auto/have
  9. CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
  10. LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib"
  11. CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib"
  12. ;;
  13. icc)
  14. have=NGX_PCRE . auto/have
  15. CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
  16. LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
  17. echo $ngx_n "checking for PCRE library ...$ngx_c"
  18. if [ -f $PCRE/pcre.h ]; then
  19. ngx_pcre_ver=`grep PCRE_MAJOR $PCRE/pcre.h \
  20. | sed -e 's/^.*PCRE_MAJOR.* \(.*\)$/\1/'`
  21. else if [ -f $PCRE/configure.in ]; then
  22. ngx_pcre_ver=`grep PCRE_MAJOR= $PCRE/configure.in \
  23. | sed -e 's/^.*=\(.*\)$/\1/'`
  24. else
  25. ngx_pcre_ver=`grep pcre_major, $PCRE/configure.ac \
  26. | sed -e 's/^.*pcre_major,.*\[\(.*\)\].*$/\1/'`
  27. fi
  28. fi
  29. echo " $ngx_pcre_ver major version found"
  30. # to allow -ipo optimization we link with the *.o but not library
  31. case "$ngx_pcre_ver" in
  32. 4|5)
  33. CORE_LIBS="$CORE_LIBS $PCRE/pcre.o"
  34. ;;
  35. 6)
  36. CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o"
  37. CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o"
  38. CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o"
  39. CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o"
  40. CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o"
  41. CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o"
  42. CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o"
  43. ;;
  44. *)
  45. CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o"
  46. CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o"
  47. CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o"
  48. CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o"
  49. CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o"
  50. CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o"
  51. CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o"
  52. CORE_LIBS="$CORE_LIBS $PCRE/pcre_newline.o"
  53. ;;
  54. esac
  55. ;;
  56. *)
  57. have=NGX_PCRE . auto/have
  58. if [ "$NGX_PLATFORM" = win32 ]; then
  59. have=PCRE_STATIC . auto/have
  60. fi
  61. CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
  62. LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
  63. CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a"
  64. ;;
  65. esac
  66. if [ $PCRE_JIT = YES ]; then
  67. have=NGX_HAVE_PCRE_JIT . auto/have
  68. PCRE_CONF_OPT="$PCRE_CONF_OPT --enable-jit"
  69. fi
  70. else
  71. if [ "$NGX_PLATFORM" != win32 ]; then
  72. PCRE=NO
  73. ngx_feature="PCRE library"
  74. ngx_feature_name="NGX_PCRE"
  75. ngx_feature_run=no
  76. ngx_feature_incs="#include <pcre.h>"
  77. ngx_feature_path=
  78. ngx_feature_libs="-lpcre"
  79. ngx_feature_test="pcre *re;
  80. re = pcre_compile(NULL, 0, NULL, 0, NULL);
  81. if (re == NULL) return 1"
  82. . auto/feature
  83. if [ $ngx_found = no ]; then
  84. # FreeBSD port
  85. ngx_feature="PCRE library in /usr/local/"
  86. ngx_feature_path="/usr/local/include"
  87. if [ $NGX_RPATH = YES ]; then
  88. ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lpcre"
  89. else
  90. ngx_feature_libs="-L/usr/local/lib -lpcre"
  91. fi
  92. . auto/feature
  93. fi
  94. if [ $ngx_found = no ]; then
  95. # RedHat RPM, Solaris package
  96. ngx_feature="PCRE library in /usr/include/pcre/"
  97. ngx_feature_path="/usr/include/pcre"
  98. ngx_feature_libs="-lpcre"
  99. . auto/feature
  100. fi
  101. if [ $ngx_found = no ]; then
  102. # NetBSD port
  103. ngx_feature="PCRE library in /usr/pkg/"
  104. ngx_feature_path="/usr/pkg/include"
  105. if [ $NGX_RPATH = YES ]; then
  106. ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lpcre"
  107. else
  108. ngx_feature_libs="-L/usr/pkg/lib -lpcre"
  109. fi
  110. . auto/feature
  111. fi
  112. if [ $ngx_found = no ]; then
  113. # MacPorts
  114. ngx_feature="PCRE library in /opt/local/"
  115. ngx_feature_path="/opt/local/include"
  116. if [ $NGX_RPATH = YES ]; then
  117. ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lpcre"
  118. else
  119. ngx_feature_libs="-L/opt/local/lib -lpcre"
  120. fi
  121. . auto/feature
  122. fi
  123. if [ $ngx_found = yes ]; then
  124. CORE_INCS="$CORE_INCS $ngx_feature_path"
  125. CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
  126. PCRE=YES
  127. fi
  128. if [ $PCRE = YES ]; then
  129. ngx_feature="PCRE JIT support"
  130. ngx_feature_name="NGX_HAVE_PCRE_JIT"
  131. ngx_feature_test="int jit = 0;
  132. pcre_free_study(NULL);
  133. pcre_config(PCRE_CONFIG_JIT, &jit);
  134. if (jit != 1) return 1;"
  135. . auto/feature
  136. if [ $ngx_found = yes ]; then
  137. PCRE_JIT=YES
  138. fi
  139. fi
  140. fi
  141. if [ $PCRE != YES ]; then
  142. cat << END
  143. $0: error: the HTTP rewrite module requires the PCRE library.
  144. You can either disable the module by using --without-http_rewrite_module
  145. option, or install the PCRE library into the system, or build the PCRE library
  146. statically from the source with nginx by using --with-pcre=<path> option.
  147. END
  148. exit 1
  149. fi
  150. fi