github的一些开源项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1190 lines
43 KiB

  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl NOTE FOR MAINTAINERS: Do not use minor version numbers 08 or 09 because
  3. dnl the leading zeros may cause them to be treated as invalid octal constants
  4. dnl if a PCRE2 user writes code that uses PCRE2_MINOR as a number. There is now
  5. dnl a check further down that throws an error if 08 or 09 are used.
  6. dnl The PCRE2_PRERELEASE feature is for identifying release candidates. It might
  7. dnl be defined as -RC2, for example. For real releases, it should be empty.
  8. m4_define(pcre2_major, [10])
  9. m4_define(pcre2_minor, [44])
  10. m4_define(pcre2_prerelease, [])
  11. m4_define(pcre2_date, [2024-06-07])
  12. # Libtool shared library interface versions (current:revision:age)
  13. m4_define(libpcre2_8_version, [13:0:13])
  14. m4_define(libpcre2_16_version, [13:0:13])
  15. m4_define(libpcre2_32_version, [13:0:13])
  16. m4_define(libpcre2_posix_version, [3:5:0])
  17. # NOTE: The CMakeLists.txt file searches for the above variables in the first
  18. # 50 lines of this file. Please update that if the variables above are moved.
  19. AC_PREREQ([2.62])
  20. AC_INIT([PCRE2],pcre2_major.pcre2_minor[]pcre2_prerelease,[],[pcre2])
  21. AC_CONFIG_SRCDIR([src/pcre2.h.in])
  22. AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
  23. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  24. AC_CONFIG_HEADERS(src/config.h)
  25. # This was added at the suggestion of libtoolize (03-Jan-10)
  26. AC_CONFIG_MACRO_DIR([m4])
  27. # The default CFLAGS in Autoconf are "-g -O2" for gcc and just "-g" for any
  28. # other compiler. There doesn't seem to be a standard way of getting rid of the
  29. # -g (which I don't think is needed for a production library). This fudge seems
  30. # to achieve the necessary. First, we remember the externally set values of
  31. # CFLAGS. Then call the AC_PROG_CC macro to find the compiler - if CFLAGS is
  32. # not set, it will be set to Autoconf's defaults. Afterwards, if the original
  33. # values were not set, remove the -g from the Autoconf defaults.
  34. remember_set_CFLAGS="$CFLAGS"
  35. m4_version_prereq(2.70, [AC_PROG_CC], [AC_PROG_CC_C99])
  36. AM_PROG_CC_C_O
  37. AC_USE_SYSTEM_EXTENSIONS
  38. if test "x$remember_set_CFLAGS" = "x"
  39. then
  40. if test "$CFLAGS" = "-g -O2"
  41. then
  42. CFLAGS="-O2"
  43. elif test "$CFLAGS" = "-g"
  44. then
  45. CFLAGS=""
  46. fi
  47. fi
  48. # This is a new thing required to stop a warning from automake 1.12
  49. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  50. # Check for a 64-bit integer type
  51. AC_TYPE_INT64_T
  52. AC_PROG_INSTALL
  53. LT_INIT([win32-dll])
  54. AC_PROG_LN_S
  55. AC_SYS_LARGEFILE
  56. # Check for GCC visibility feature
  57. PCRE2_VISIBILITY
  58. # Check for the mul_overflow() builtin
  59. AC_MSG_CHECKING([for __builtin_mul_overflow()])
  60. AC_LANG_PUSH([C])
  61. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  62. #ifdef HAVE_SYS_TYPES_H
  63. #include <sys/types.h>
  64. #endif
  65. #include <stddef.h>
  66. int a, b;
  67. size_t m;
  68. ]], [[__builtin_mul_overflow(a, b, &m)]])],
  69. [pcre2_cc_cv_builtin_mul_overflow=yes],
  70. [pcre2_cc_cv_builtin_mul_overflow=no])
  71. AC_MSG_RESULT([$pcre2_cc_cv_builtin_mul_overflow])
  72. if test "$pcre2_cc_cv_builtin_mul_overflow" = yes; then
  73. AC_DEFINE([HAVE_BUILTIN_MUL_OVERFLOW], 1,
  74. [Define this if your compiler provides __builtin_mul_overflow()])
  75. fi
  76. AC_LANG_POP([C])
  77. # Check for Clang __attribute__((uninitialized)) feature
  78. AC_MSG_CHECKING([for __attribute__((uninitialized))])
  79. AC_LANG_PUSH([C])
  80. tmp_CFLAGS=$CFLAGS
  81. CFLAGS="$CFLAGS -Werror"
  82. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,
  83. [[char buf[128] __attribute__((uninitialized));(void)buf]])],
  84. [pcre2_cc_cv_attribute_uninitialized=yes],
  85. [pcre2_cc_cv_attribute_uninitialized=no])
  86. AC_MSG_RESULT([$pcre2_cc_cv_attribute_uninitialized])
  87. if test "$pcre2_cc_cv_attribute_uninitialized" = yes; then
  88. AC_DEFINE([HAVE_ATTRIBUTE_UNINITIALIZED], 1, [Define this if your compiler
  89. supports __attribute__((uninitialized))])
  90. fi
  91. CFLAGS=$tmp_CFLAGS
  92. AC_LANG_POP([C])
  93. # Versioning
  94. PCRE2_MAJOR="pcre2_major"
  95. PCRE2_MINOR="pcre2_minor"
  96. PCRE2_PRERELEASE="pcre2_prerelease"
  97. PCRE2_DATE="pcre2_date"
  98. if test "$PCRE2_MINOR" = "08" -o "$PCRE2_MINOR" = "09"
  99. then
  100. echo "***"
  101. echo "*** Minor version number $PCRE2_MINOR must not be used. ***"
  102. echo "*** Use only 00 to 07 or 10 onwards, to avoid octal issues. ***"
  103. echo "***"
  104. exit 1
  105. fi
  106. AC_SUBST(PCRE2_MAJOR)
  107. AC_SUBST(PCRE2_MINOR)
  108. AC_SUBST(PCRE2_PRERELEASE)
  109. AC_SUBST(PCRE2_DATE)
  110. # Set a more sensible default value for $(htmldir).
  111. if test "x$htmldir" = 'x${docdir}'
  112. then
  113. htmldir='${docdir}/html'
  114. fi
  115. # Force an error for PCRE1 size options
  116. AC_ARG_ENABLE(pcre8,,,enable_pcre8=no)
  117. AC_ARG_ENABLE(pcre16,,,enable_pcre16=no)
  118. AC_ARG_ENABLE(pcre32,,,enable_pcre32=no)
  119. if test "$enable_pcre8$enable_pcre16$enable_pcre32" != "nonono"
  120. then
  121. echo "** ERROR: Use --[[en|dis]]able-pcre2-[[8|16|32]], not --[[en|dis]]able-pcre[[8|16|32]]"
  122. exit 1
  123. fi
  124. # Handle --disable-pcre2-8 (enabled by default)
  125. AC_ARG_ENABLE(pcre2-8,
  126. AS_HELP_STRING([--disable-pcre2-8],
  127. [disable 8 bit character support]),
  128. , enable_pcre2_8=unset)
  129. AC_SUBST(enable_pcre2_8)
  130. # Handle --enable-pcre2-16 (disabled by default)
  131. AC_ARG_ENABLE(pcre2-16,
  132. AS_HELP_STRING([--enable-pcre2-16],
  133. [enable 16 bit character support]),
  134. , enable_pcre2_16=unset)
  135. AC_SUBST(enable_pcre2_16)
  136. # Handle --enable-pcre2-32 (disabled by default)
  137. AC_ARG_ENABLE(pcre2-32,
  138. AS_HELP_STRING([--enable-pcre2-32],
  139. [enable 32 bit character support]),
  140. , enable_pcre2_32=unset)
  141. AC_SUBST(enable_pcre2_32)
  142. # Handle --enable-debug (disabled by default)
  143. AC_ARG_ENABLE(debug,
  144. AS_HELP_STRING([--enable-debug],
  145. [enable debugging code]),
  146. , enable_debug=no)
  147. # Handle --enable-jit (disabled by default)
  148. AC_ARG_ENABLE(jit,
  149. AS_HELP_STRING([--enable-jit],
  150. [enable Just-In-Time compiling support]),
  151. , enable_jit=no)
  152. # This code enables JIT if the hardware supports it.
  153. if test "$enable_jit" = "auto"; then
  154. AC_LANG(C)
  155. SAVE_CPPFLAGS=$CPPFLAGS
  156. CPPFLAGS=-I$srcdir
  157. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  158. #define SLJIT_CONFIG_AUTO 1
  159. #include "src/sljit/sljitConfigCPU.h"
  160. #if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
  161. #error unsupported
  162. #endif]])], enable_jit=yes, enable_jit=no)
  163. CPPFLAGS=$SAVE_CPPFLAGS
  164. echo checking for JIT support on this hardware... $enable_jit
  165. fi
  166. # Handle --enable-jit-sealloc (disabled by default and only experimental)
  167. case $host_os in
  168. linux* | netbsd*)
  169. AC_ARG_ENABLE(jit-sealloc,
  170. AS_HELP_STRING([--enable-jit-sealloc],
  171. [enable SELinux compatible execmem allocator in JIT (experimental)]),
  172. ,enable_jit_sealloc=no)
  173. ;;
  174. *)
  175. enable_jit_sealloc=unsupported
  176. ;;
  177. esac
  178. # Handle --disable-pcre2grep-jit (enabled by default)
  179. AC_ARG_ENABLE(pcre2grep-jit,
  180. AS_HELP_STRING([--disable-pcre2grep-jit],
  181. [disable JIT support in pcre2grep]),
  182. , enable_pcre2grep_jit=yes)
  183. # Handle --disable-pcre2grep-callout (enabled by default)
  184. AC_ARG_ENABLE(pcre2grep-callout,
  185. AS_HELP_STRING([--disable-pcre2grep-callout],
  186. [disable callout script support in pcre2grep]),
  187. , enable_pcre2grep_callout=yes)
  188. # Handle --disable-pcre2grep-callout-fork (enabled by default)
  189. AC_ARG_ENABLE(pcre2grep-callout-fork,
  190. AS_HELP_STRING([--disable-pcre2grep-callout-fork],
  191. [disable callout script fork support in pcre2grep]),
  192. , enable_pcre2grep_callout_fork=yes)
  193. # Handle --enable-rebuild-chartables
  194. AC_ARG_ENABLE(rebuild-chartables,
  195. AS_HELP_STRING([--enable-rebuild-chartables],
  196. [rebuild character tables in current locale]),
  197. , enable_rebuild_chartables=no)
  198. # Handle --disable-unicode (enabled by default)
  199. AC_ARG_ENABLE(unicode,
  200. AS_HELP_STRING([--disable-unicode],
  201. [disable Unicode support]),
  202. , enable_unicode=unset)
  203. # Handle newline options
  204. ac_pcre2_newline=lf
  205. AC_ARG_ENABLE(newline-is-cr,
  206. AS_HELP_STRING([--enable-newline-is-cr],
  207. [use CR as newline character]),
  208. ac_pcre2_newline=cr)
  209. AC_ARG_ENABLE(newline-is-lf,
  210. AS_HELP_STRING([--enable-newline-is-lf],
  211. [use LF as newline character (default)]),
  212. ac_pcre2_newline=lf)
  213. AC_ARG_ENABLE(newline-is-crlf,
  214. AS_HELP_STRING([--enable-newline-is-crlf],
  215. [use CRLF as newline sequence]),
  216. ac_pcre2_newline=crlf)
  217. AC_ARG_ENABLE(newline-is-anycrlf,
  218. AS_HELP_STRING([--enable-newline-is-anycrlf],
  219. [use CR, LF, or CRLF as newline sequence]),
  220. ac_pcre2_newline=anycrlf)
  221. AC_ARG_ENABLE(newline-is-any,
  222. AS_HELP_STRING([--enable-newline-is-any],
  223. [use any valid Unicode newline sequence]),
  224. ac_pcre2_newline=any)
  225. AC_ARG_ENABLE(newline-is-nul,
  226. AS_HELP_STRING([--enable-newline-is-nul],
  227. [use NUL (binary zero) as newline character]),
  228. ac_pcre2_newline=nul)
  229. enable_newline="$ac_pcre2_newline"
  230. # Handle --enable-bsr-anycrlf
  231. AC_ARG_ENABLE(bsr-anycrlf,
  232. AS_HELP_STRING([--enable-bsr-anycrlf],
  233. [\R matches only CR, LF, CRLF by default]),
  234. , enable_bsr_anycrlf=no)
  235. # Handle --enable-never-backslash-C
  236. AC_ARG_ENABLE(never-backslash-C,
  237. AS_HELP_STRING([--enable-never-backslash-C],
  238. [use of \C causes an error]),
  239. , enable_never_backslash_C=no)
  240. # Handle --enable-ebcdic
  241. AC_ARG_ENABLE(ebcdic,
  242. AS_HELP_STRING([--enable-ebcdic],
  243. [assume EBCDIC coding rather than ASCII; incompatible with --enable-utf; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]),
  244. , enable_ebcdic=no)
  245. # Handle --enable-ebcdic-nl25
  246. AC_ARG_ENABLE(ebcdic-nl25,
  247. AS_HELP_STRING([--enable-ebcdic-nl25],
  248. [set EBCDIC code for NL to 0x25 instead of 0x15; it implies --enable-ebcdic]),
  249. , enable_ebcdic_nl25=no)
  250. # Handle --enable-pcre2grep-libz
  251. AC_ARG_ENABLE(pcre2grep-libz,
  252. AS_HELP_STRING([--enable-pcre2grep-libz],
  253. [link pcre2grep with libz to handle .gz files]),
  254. , enable_pcre2grep_libz=no)
  255. # Handle --enable-pcre2grep-libbz2
  256. AC_ARG_ENABLE(pcre2grep-libbz2,
  257. AS_HELP_STRING([--enable-pcre2grep-libbz2],
  258. [link pcre2grep with libbz2 to handle .bz2 files]),
  259. , enable_pcre2grep_libbz2=no)
  260. # Handle --with-pcre2grep-bufsize=N
  261. AC_ARG_WITH(pcre2grep-bufsize,
  262. AS_HELP_STRING([--with-pcre2grep-bufsize=N],
  263. [pcre2grep initial buffer size (default=20480, minimum=8192)]),
  264. , with_pcre2grep_bufsize=20480)
  265. # Handle --with-pcre2grep-max-bufsize=N
  266. AC_ARG_WITH(pcre2grep-max-bufsize,
  267. AS_HELP_STRING([--with-pcre2grep-max-bufsize=N],
  268. [pcre2grep maximum buffer size (default=1048576, minimum=8192)]),
  269. , with_pcre2grep_max_bufsize=1048576)
  270. # Handle --enable-pcre2test-libedit
  271. AC_ARG_ENABLE(pcre2test-libedit,
  272. AS_HELP_STRING([--enable-pcre2test-libedit],
  273. [link pcre2test with libedit]),
  274. , enable_pcre2test_libedit=no)
  275. # Handle --enable-pcre2test-libreadline
  276. AC_ARG_ENABLE(pcre2test-libreadline,
  277. AS_HELP_STRING([--enable-pcre2test-libreadline],
  278. [link pcre2test with libreadline]),
  279. , enable_pcre2test_libreadline=no)
  280. # Handle --with-link-size=N
  281. AC_ARG_WITH(link-size,
  282. AS_HELP_STRING([--with-link-size=N],
  283. [internal link size (2, 3, or 4 allowed; default=2)]),
  284. , with_link_size=2)
  285. # Handle --with-max-varlookbehind=N
  286. AC_ARG_WITH(max-varlookbehind,
  287. AS_HELP_STRING([--with-max-varlookbehind=N],
  288. [maximum length of variable lookbehind (default=255)]),
  289. , with_max_varlookbehind=255)
  290. # Handle --with-parens-nest-limit=N
  291. AC_ARG_WITH(parens-nest-limit,
  292. AS_HELP_STRING([--with-parens-nest-limit=N],
  293. [nested parentheses limit (default=250)]),
  294. , with_parens_nest_limit=250)
  295. # Handle --with-heap-limit
  296. AC_ARG_WITH(heap-limit,
  297. AS_HELP_STRING([--with-heap-limit=N],
  298. [default limit on heap memory (kibibytes, default=20000000)]),
  299. , with_heap_limit=20000000)
  300. # Handle --with-match-limit=N
  301. AC_ARG_WITH(match-limit,
  302. AS_HELP_STRING([--with-match-limit=N],
  303. [default limit on internal looping (default=10000000)]),
  304. , with_match_limit=10000000)
  305. # Handle --with-match-limit-depth=N
  306. # Recognize old synonym --with-match-limit-recursion
  307. #
  308. # Note: In config.h, the default is to define MATCH_LIMIT_DEPTH symbolically as
  309. # MATCH_LIMIT, which in turn is defined to be some numeric value (e.g.
  310. # 10000000). MATCH_LIMIT_DEPTH can otherwise be set to some different numeric
  311. # value (or even the same numeric value as MATCH_LIMIT, though no longer
  312. # defined in terms of the latter).
  313. #
  314. AC_ARG_WITH(match-limit-depth,
  315. AS_HELP_STRING([--with-match-limit-depth=N],
  316. [default limit on match tree depth (default=MATCH_LIMIT)]),
  317. , with_match_limit_depth=MATCH_LIMIT)
  318. AC_ARG_WITH(match-limit-recursion,,
  319. , with_match_limit_recursion=UNSET)
  320. # Handle --enable-valgrind
  321. AC_ARG_ENABLE(valgrind,
  322. AS_HELP_STRING([--enable-valgrind],
  323. [enable valgrind support]),
  324. , enable_valgrind=no)
  325. # Enable code coverage reports using gcov
  326. AC_ARG_ENABLE(coverage,
  327. AS_HELP_STRING([--enable-coverage],
  328. [enable code coverage reports using gcov]),
  329. , enable_coverage=no)
  330. # Handle --enable-fuzz-support
  331. AC_ARG_ENABLE(fuzz_support,
  332. AS_HELP_STRING([--enable-fuzz-support],
  333. [enable fuzzer support]),
  334. , enable_fuzz_support=no)
  335. # Handle --enable-diff-fuzz-support
  336. AC_ARG_ENABLE(diff_fuzz_support,
  337. AS_HELP_STRING([--enable-diff-fuzz-support],
  338. [enable differential fuzzer support]),
  339. , enable_diff_fuzz_support=no)
  340. # Handle --disable-stack-for-recursion
  341. # This option became obsolete at release 10.30.
  342. AC_ARG_ENABLE(stack-for-recursion,,
  343. , enable_stack_for_recursion=yes)
  344. # Original code
  345. # AC_ARG_ENABLE(stack-for-recursion,
  346. # AS_HELP_STRING([--disable-stack-for-recursion],
  347. # [don't use stack recursion when matching]),
  348. # , enable_stack_for_recursion=yes)
  349. # Handle --disable-percent_zt (set as "auto" by default)
  350. AC_ARG_ENABLE(percent-zt,
  351. AS_HELP_STRING([--disable-percent-zt],
  352. [disable the use of z and t formatting modifiers]),
  353. , enable_percent_zt=auto)
  354. # Set the default value for pcre2-8
  355. if test "x$enable_pcre2_8" = "xunset"
  356. then
  357. enable_pcre2_8=yes
  358. fi
  359. # Set the default value for pcre2-16
  360. if test "x$enable_pcre2_16" = "xunset"
  361. then
  362. enable_pcre2_16=no
  363. fi
  364. # Set the default value for pcre2-32
  365. if test "x$enable_pcre2_32" = "xunset"
  366. then
  367. enable_pcre2_32=no
  368. fi
  369. # Make sure at least one library is selected
  370. if test "x$enable_pcre2_8$enable_pcre2_16$enable_pcre2_32" = "xnonono"
  371. then
  372. AC_MSG_ERROR([At least one of the 8, 16 or 32 bit libraries must be enabled])
  373. fi
  374. # Unicode is enabled by default.
  375. if test "x$enable_unicode" = "xunset"
  376. then
  377. enable_unicode=yes
  378. fi
  379. # Convert the newline identifier into the appropriate integer value. These must
  380. # agree with the PCRE2_NEWLINE_xxx values in pcre2.h.
  381. case "$enable_newline" in
  382. cr) ac_pcre2_newline_value=1 ;;
  383. lf) ac_pcre2_newline_value=2 ;;
  384. crlf) ac_pcre2_newline_value=3 ;;
  385. any) ac_pcre2_newline_value=4 ;;
  386. anycrlf) ac_pcre2_newline_value=5 ;;
  387. nul) ac_pcre2_newline_value=6 ;;
  388. *)
  389. AC_MSG_ERROR([invalid argument "$enable_newline" to --enable-newline option])
  390. ;;
  391. esac
  392. # --enable-ebcdic-nl25 implies --enable-ebcdic
  393. if test "x$enable_ebcdic_nl25" = "xyes"; then
  394. enable_ebcdic=yes
  395. fi
  396. # Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled.
  397. # Also check that UTF support is not requested, because PCRE2 cannot handle
  398. # EBCDIC and UTF in the same build. To do so it would need to use different
  399. # character constants depending on the mode. Also, EBCDIC cannot be used with
  400. # 16-bit and 32-bit libraries.
  401. #
  402. if test "x$enable_ebcdic" = "xyes"; then
  403. enable_rebuild_chartables=yes
  404. if test "x$enable_unicode" = "xyes"; then
  405. AC_MSG_ERROR([support for EBCDIC and Unicode cannot be enabled at the same time])
  406. fi
  407. if test "x$enable_pcre2_16" = "xyes" -o "x$enable_pcre2_32" = "xyes"; then
  408. AC_MSG_ERROR([EBCDIC support is available only for the 8-bit library])
  409. fi
  410. fi
  411. # Check argument to --with-link-size
  412. case "$with_link_size" in
  413. 2|3|4) ;;
  414. *)
  415. AC_MSG_ERROR([invalid argument "$with_link_size" to --with-link-size option])
  416. ;;
  417. esac
  418. AH_TOP([
  419. /* PCRE2 is written in Standard C, but there are a few non-standard things it
  420. can cope with, allowing it to run on SunOS4 and other "close to standard"
  421. systems.
  422. In environments that support the GNU autotools, config.h.in is converted into
  423. config.h by the "configure" script. In environments that use CMake,
  424. config-cmake.in is converted into config.h. If you are going to build PCRE2 "by
  425. hand" without using "configure" or CMake, you should copy the distributed
  426. config.h.generic to config.h, and edit the macro definitions to be the way you
  427. need them. You must then add -DHAVE_CONFIG_H to all of your compile commands,
  428. so that config.h is included at the start of every source.
  429. Alternatively, you can avoid editing by using -D on the compiler command line
  430. to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
  431. but if you do, default values will be taken from config.h for non-boolean
  432. macros that are not defined on the command line.
  433. Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be
  434. defined (conventionally to 1) for TRUE, and not defined at all for FALSE. All
  435. such macros are listed as a commented #undef in config.h.generic. Macros such
  436. as MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
  437. surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
  438. PCRE2 uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
  439. HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make
  440. sure both macros are undefined; an emulation function will then be used. */])
  441. # Checks for header files.
  442. AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h)
  443. AC_CHECK_HEADERS([windows.h], [HAVE_WINDOWS_H=1])
  444. AC_CHECK_HEADERS([sys/wait.h], [HAVE_SYS_WAIT_H=1])
  445. # Conditional compilation
  446. AM_CONDITIONAL(WITH_PCRE2_8, test "x$enable_pcre2_8" = "xyes")
  447. AM_CONDITIONAL(WITH_PCRE2_16, test "x$enable_pcre2_16" = "xyes")
  448. AM_CONDITIONAL(WITH_PCRE2_32, test "x$enable_pcre2_32" = "xyes")
  449. AM_CONDITIONAL(WITH_DEBUG, test "x$enable_debug" = "xyes")
  450. AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes")
  451. AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes")
  452. AM_CONDITIONAL(WITH_UNICODE, test "x$enable_unicode" = "xyes")
  453. AM_CONDITIONAL(WITH_VALGRIND, test "x$enable_valgrind" = "xyes")
  454. AM_CONDITIONAL(WITH_FUZZ_SUPPORT, test "x$enable_fuzz_support" = "xyes")
  455. AM_CONDITIONAL(WITH_DIFF_FUZZ_SUPPORT, test "x$enable_diff_fuzz_support" = "xyes")
  456. if test "$enable_fuzz_support" = "yes" -a "$enable_pcre2_8" = "no"; then
  457. echo "** ERROR: Fuzzer support requires the 8-bit library"
  458. exit 1
  459. fi
  460. if test "$enable_diff_fuzz_support" = "yes"; then
  461. if test "$enable_fuzz_support" = "no"; then
  462. echo "** ERROR: Differential fuzzing support requires fuzzing support"
  463. exit 1
  464. fi
  465. if test "$enable_jit" = "no"; then
  466. echo "** ERROR: Differential fuzzing support requires Just-in-Time compilation support"
  467. exit 1
  468. fi
  469. AC_DEFINE([SUPPORT_DIFF_FUZZ], [], [
  470. Define to any value to enable differential fuzzing support.])
  471. fi
  472. # Checks for typedefs, structures, and compiler characteristics.
  473. AC_C_CONST
  474. AC_TYPE_SIZE_T
  475. # Checks for library functions.
  476. AC_CHECK_FUNCS(bcopy memfd_create memmove mkostemp secure_getenv strerror)
  477. AC_MSG_CHECKING([for realpath])
  478. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  479. #include <stdlib.h>
  480. #include <limits.h>
  481. ]],[[
  482. char buffer[PATH_MAX];
  483. realpath(".", buffer);
  484. ]])],
  485. [AC_MSG_RESULT([yes])
  486. AC_DEFINE([HAVE_REALPATH], 1,
  487. [Define to 1 if you have the `realpath' function.])
  488. ],
  489. AC_MSG_RESULT([no]))
  490. # Check for the availability of libz (aka zlib)
  491. AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1])
  492. AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1])
  493. # Check for the availability of libbz2. Originally we just used AC_CHECK_LIB,
  494. # as for libz. However, this had the following problem, diagnosed and fixed by
  495. # a user:
  496. #
  497. # - libbz2 uses the Pascal calling convention (WINAPI) for the functions
  498. # under Win32.
  499. # - The standard autoconf AC_CHECK_LIB fails to include "bzlib.h",
  500. # therefore missing the function definition.
  501. # - The compiler thus generates a "C" signature for the test function.
  502. # - The linker fails to find the "C" function.
  503. # - PCRE2 fails to configure if asked to do so against libbz2.
  504. #
  505. # Solution:
  506. #
  507. # - Replace the AC_CHECK_LIB test with a custom test.
  508. AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1])
  509. # Original test
  510. # AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1])
  511. #
  512. # Custom test follows
  513. AC_MSG_CHECKING([for libbz2])
  514. OLD_LIBS="$LIBS"
  515. LIBS="$LIBS -lbz2"
  516. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  517. #ifdef HAVE_BZLIB_H
  518. #include <bzlib.h>
  519. #endif]],
  520. [[return (int)BZ2_bzopen("conftest", "rb");]])],
  521. [AC_MSG_RESULT([yes]);HAVE_LIBBZ2=1; break;],
  522. AC_MSG_RESULT([no]))
  523. LIBS="$OLD_LIBS"
  524. # Check for the availabiity of libreadline
  525. if test "$enable_pcre2test_libreadline" = "yes"; then
  526. AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1])
  527. AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1])
  528. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lreadline"],
  529. [unset ac_cv_lib_readline_readline;
  530. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltinfo"],
  531. [unset ac_cv_lib_readline_readline;
  532. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lcurses"],
  533. [unset ac_cv_lib_readline_readline;
  534. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"],
  535. [unset ac_cv_lib_readline_readline;
  536. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"],
  537. [unset ac_cv_lib_readline_readline;
  538. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"],
  539. [LIBREADLINE=""],
  540. [-ltermcap])],
  541. [-lncursesw])],
  542. [-lncurses])],
  543. [-lcurses])],
  544. [-ltinfo])])
  545. AC_SUBST(LIBREADLINE)
  546. if test -n "$LIBREADLINE"; then
  547. if test "$LIBREADLINE" != "-lreadline"; then
  548. echo "-lreadline needs $LIBREADLINE"
  549. LIBREADLINE="-lreadline $LIBREADLINE"
  550. fi
  551. fi
  552. fi
  553. # Check for the availability of libedit. Different distributions put its
  554. # headers in different places. Try to cover the most common ones.
  555. if test "$enable_pcre2test_libedit" = "yes"; then
  556. AC_CHECK_HEADERS([editline/readline.h edit/readline/readline.h readline.h], [
  557. HAVE_LIBEDIT_HEADER=1
  558. break
  559. ])
  560. AC_CHECK_LIB([edit], [readline], [LIBEDIT="-ledit"])
  561. fi
  562. PCRE2_STATIC_CFLAG=""
  563. if test "x$enable_shared" = "xno" ; then
  564. AC_DEFINE([PCRE2_STATIC], [1], [
  565. Define to any value if linking statically (TODO: make nice with Libtool)])
  566. PCRE2_STATIC_CFLAG="-DPCRE2_STATIC"
  567. fi
  568. AC_SUBST(PCRE2_STATIC_CFLAG)
  569. PCRE2POSIX_CFLAG=""
  570. if test "x$enable_shared" = "xyes" ; then
  571. PCRE2POSIX_CFLAG="-DPCRE2POSIX_SHARED"
  572. fi
  573. AC_SUBST(PCRE2POSIX_CFLAG)
  574. # Here is where PCRE2-specific defines are handled
  575. if test "$enable_pcre2_8" = "yes"; then
  576. AC_DEFINE([SUPPORT_PCRE2_8], [], [
  577. Define to any value to enable the 8 bit PCRE2 library.])
  578. fi
  579. if test "$enable_pcre2_16" = "yes"; then
  580. AC_DEFINE([SUPPORT_PCRE2_16], [], [
  581. Define to any value to enable the 16 bit PCRE2 library.])
  582. fi
  583. if test "$enable_pcre2_32" = "yes"; then
  584. AC_DEFINE([SUPPORT_PCRE2_32], [], [
  585. Define to any value to enable the 32 bit PCRE2 library.])
  586. fi
  587. if test "$enable_debug" = "yes"; then
  588. AC_DEFINE([PCRE2_DEBUG], [], [
  589. Define to any value to include debugging code.])
  590. fi
  591. if test "$enable_percent_zt" = "no"; then
  592. AC_DEFINE([DISABLE_PERCENT_ZT], [], [
  593. Define to any value to disable the use of the z and t modifiers in
  594. formatting settings such as %zu or %td (this is rarely needed).])
  595. else
  596. enable_percent_zt=auto
  597. fi
  598. # Unless running under Windows, JIT support requires pthreads.
  599. if test "$enable_jit" = "yes"; then
  600. if test "$HAVE_WINDOWS_H" != "1"; then
  601. AX_PTHREAD([], [AC_MSG_ERROR([JIT support requires pthreads])])
  602. CC="$PTHREAD_CC"
  603. CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
  604. LIBS="$PTHREAD_LIBS $LIBS"
  605. fi
  606. AC_DEFINE([SUPPORT_JIT], [], [
  607. Define to any value to enable support for Just-In-Time compiling.])
  608. else
  609. enable_pcre2grep_jit="no"
  610. fi
  611. if test "$enable_jit_sealloc" = "yes"; then
  612. AC_DEFINE([SLJIT_PROT_EXECUTABLE_ALLOCATOR], [1], [
  613. Define to any non-zero number to enable support for SELinux
  614. compatible executable memory allocator in JIT. Note that this
  615. will have no effect unless SUPPORT_JIT is also defined.])
  616. fi
  617. if test "$enable_pcre2grep_jit" = "yes"; then
  618. AC_DEFINE([SUPPORT_PCRE2GREP_JIT], [], [
  619. Define to any value to enable JIT support in pcre2grep. Note that this will
  620. have no effect unless SUPPORT_JIT is also defined.])
  621. fi
  622. if test "$enable_pcre2grep_callout" = "yes"; then
  623. if test "$enable_pcre2grep_callout_fork" = "yes"; then
  624. if test "$HAVE_WINDOWS_H" != "1"; then
  625. if test "$HAVE_SYS_WAIT_H" != "1"; then
  626. AC_MSG_ERROR([Callout script support needs sys/wait.h.])
  627. fi
  628. fi
  629. AC_DEFINE([SUPPORT_PCRE2GREP_CALLOUT_FORK], [], [
  630. Define to any value to enable fork support in pcre2grep callout scripts.
  631. This will have no effect unless SUPPORT_PCRE2GREP_CALLOUT is also
  632. defined.])
  633. fi
  634. AC_DEFINE([SUPPORT_PCRE2GREP_CALLOUT], [], [
  635. Define to any value to enable callout script support in pcre2grep.])
  636. else
  637. enable_pcre2grep_callout_fork="no"
  638. fi
  639. if test "$enable_unicode" = "yes"; then
  640. AC_DEFINE([SUPPORT_UNICODE], [], [
  641. Define to any value to enable support for Unicode and UTF encoding.
  642. This will work even in an EBCDIC environment, but it is incompatible
  643. with the EBCDIC macro. That is, PCRE2 can support *either* EBCDIC
  644. code *or* ASCII/Unicode, but not both at once.])
  645. fi
  646. if test "$enable_pcre2grep_libz" = "yes"; then
  647. AC_DEFINE([SUPPORT_LIBZ], [], [
  648. Define to any value to allow pcre2grep to be linked with libz, so that it is
  649. able to handle .gz files.])
  650. fi
  651. if test "$enable_pcre2grep_libbz2" = "yes"; then
  652. AC_DEFINE([SUPPORT_LIBBZ2], [], [
  653. Define to any value to allow pcre2grep to be linked with libbz2, so that it
  654. is able to handle .bz2 files.])
  655. fi
  656. if test $with_pcre2grep_bufsize -lt 8192 ; then
  657. AC_MSG_WARN([$with_pcre2grep_bufsize is too small for --with-pcre2grep-bufsize; using 8192])
  658. with_pcre2grep_bufsize="8192"
  659. else
  660. if test $? -gt 1 ; then
  661. AC_MSG_ERROR([Bad value for --with-pcre2grep-bufsize])
  662. fi
  663. fi
  664. if test $with_pcre2grep_max_bufsize -lt $with_pcre2grep_bufsize ; then
  665. with_pcre2grep_max_bufsize="$with_pcre2grep_bufsize"
  666. else
  667. if test $? -gt 1 ; then
  668. AC_MSG_ERROR([Bad value for --with-pcre2grep-max-bufsize])
  669. fi
  670. fi
  671. AC_DEFINE_UNQUOTED([PCRE2GREP_BUFSIZE], [$with_pcre2grep_bufsize], [
  672. The value of PCRE2GREP_BUFSIZE is the starting size of the buffer used by
  673. pcre2grep to hold parts of the file it is searching. The buffer will be
  674. expanded up to PCRE2GREP_MAX_BUFSIZE if necessary, for files containing very
  675. long lines. The actual amount of memory used by pcre2grep is three times this
  676. number, because it allows for the buffering of "before" and "after" lines.])
  677. AC_DEFINE_UNQUOTED([PCRE2GREP_MAX_BUFSIZE], [$with_pcre2grep_max_bufsize], [
  678. The value of PCRE2GREP_MAX_BUFSIZE specifies the maximum size of the buffer
  679. used by pcre2grep to hold parts of the file it is searching. The actual
  680. amount of memory used by pcre2grep is three times this number, because it
  681. allows for the buffering of "before" and "after" lines.])
  682. if test "$enable_pcre2test_libedit" = "yes"; then
  683. AC_DEFINE([SUPPORT_LIBEDIT], [], [
  684. Define to any value to allow pcre2test to be linked with libedit.])
  685. LIBREADLINE="$LIBEDIT"
  686. elif test "$enable_pcre2test_libreadline" = "yes"; then
  687. AC_DEFINE([SUPPORT_LIBREADLINE], [], [
  688. Define to any value to allow pcre2test to be linked with libreadline.])
  689. fi
  690. AC_DEFINE_UNQUOTED([NEWLINE_DEFAULT], [$ac_pcre2_newline_value], [
  691. The value of NEWLINE_DEFAULT determines the default newline character
  692. sequence. PCRE2 client programs can override this by selecting other values
  693. at run time. The valid values are 1 (CR), 2 (LF), 3 (CRLF), 4 (ANY),
  694. 5 (ANYCRLF), and 6 (NUL).])
  695. if test "$enable_bsr_anycrlf" = "yes"; then
  696. AC_DEFINE([BSR_ANYCRLF], [], [
  697. By default, the \R escape sequence matches any Unicode line ending
  698. character or sequence of characters. If BSR_ANYCRLF is defined (to any
  699. value), this is changed so that backslash-R matches only CR, LF, or CRLF.
  700. The build-time default can be overridden by the user of PCRE2 at runtime.])
  701. fi
  702. if test "$enable_never_backslash_C" = "yes"; then
  703. AC_DEFINE([NEVER_BACKSLASH_C], [], [
  704. Defining NEVER_BACKSLASH_C locks out the use of \C in all patterns.])
  705. fi
  706. AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [
  707. The value of LINK_SIZE determines the number of bytes used to store
  708. links as offsets within the compiled regex. The default is 2, which
  709. allows for compiled patterns up to 65535 code units long. This covers the
  710. vast majority of cases. However, PCRE2 can also be compiled to use 3 or 4
  711. bytes instead. This allows for longer patterns in extreme cases.])
  712. AC_DEFINE_UNQUOTED([MAX_VARLOOKBEHIND], [$with_max_varlookbehind], [
  713. The value of MAX_VARLOOKBEHIND specifies the default maximum length, in
  714. characters, for a variable-length lookbehind assertion.])
  715. AC_DEFINE_UNQUOTED([PARENS_NEST_LIMIT], [$with_parens_nest_limit], [
  716. The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
  717. parentheses (of any kind) in a pattern. This limits the amount of system
  718. stack that is used while compiling a pattern.])
  719. AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [
  720. The value of MATCH_LIMIT determines the default number of times the
  721. pcre2_match() function can record a backtrack position during a single
  722. matching attempt. The value is also used to limit a loop counter in
  723. pcre2_dfa_match(). There is a runtime interface for setting a different
  724. limit. The limit exists in order to catch runaway regular expressions that
  725. take forever to determine that they do not match. The default is set very
  726. large so that it does not accidentally catch legitimate cases.])
  727. # --with-match-limit-recursion is an obsolete synonym for --with-match-limit-depth
  728. if test "$with_match_limit_recursion" != "UNSET"; then
  729. cat <<EOF
  730. WARNING: --with-match-limit-recursion is an obsolete option. Please use
  731. --with-match-limit-depth in future. If both are set, --with-match-limit-depth
  732. will be used. See also --with-heap-limit.
  733. EOF
  734. if test "$with_match_limit_depth" = "MATCH_LIMIT"; then
  735. with_match_limit_depth=$with_match_limit_recursion
  736. fi
  737. fi
  738. AC_DEFINE_UNQUOTED([MATCH_LIMIT_DEPTH], [$with_match_limit_depth], [
  739. The above limit applies to all backtracks, whether or not they are nested. In
  740. some environments it is desirable to limit the nesting of backtracking (that
  741. is, the depth of tree that is searched) more strictly, in order to restrict
  742. the maximum amount of heap memory that is used. The value of
  743. MATCH_LIMIT_DEPTH provides this facility. To have any useful effect, it must
  744. be less than the value of MATCH_LIMIT. The default is to use the same value
  745. as MATCH_LIMIT. There is a runtime method for setting a different limit. In
  746. the case of pcre2_dfa_match(), this limit controls the depth of the internal
  747. nested function calls that are used for pattern recursions, lookarounds, and
  748. atomic groups.])
  749. AC_DEFINE_UNQUOTED([HEAP_LIMIT], [$with_heap_limit], [
  750. This limits the amount of memory that may be used while matching
  751. a pattern. It applies to both pcre2_match() and pcre2_dfa_match(). It does
  752. not apply to JIT matching. The value is in kibibytes (units of 1024 bytes).])
  753. AC_DEFINE([MAX_NAME_SIZE], [128], [
  754. This limit is parameterized just in case anybody ever wants to
  755. change it. Care must be taken if it is increased, because it guards
  756. against integer overflow caused by enormously large patterns.])
  757. AC_DEFINE([MAX_NAME_COUNT], [10000], [
  758. This limit is parameterized just in case anybody ever wants to
  759. change it. Care must be taken if it is increased, because it guards
  760. against integer overflow caused by enormously large patterns.])
  761. AH_VERBATIM([PCRE2_EXP_DEFN], [
  762. /* If you are compiling for a system other than a Unix-like system or
  763. Win32, and it needs some magic to be inserted before the definition
  764. of a function that is exported by the library, define this macro to
  765. contain the relevant magic. If you do not define this macro, a suitable
  766. __declspec value is used for Windows systems; in other environments
  767. a compiler relevant "extern" is used with any "visibility" related
  768. attributes from PCRE2_EXPORT included.
  769. This macro apears at the start of every exported function that is part
  770. of the external API. It does not appear on functions that are "external"
  771. in the C sense, but which are internal to the library. */
  772. #undef PCRE2_EXP_DEFN])
  773. if test "$enable_ebcdic" = "yes"; then
  774. AC_DEFINE_UNQUOTED([EBCDIC], [], [
  775. If you are compiling for a system that uses EBCDIC instead of ASCII
  776. character codes, define this macro to any value. When EBCDIC is set, PCRE2
  777. assumes that all input strings are in EBCDIC. If you do not define this
  778. macro, PCRE2 will assume input strings are ASCII or UTF-8/16/32 Unicode. It
  779. is not possible to build a version of PCRE2 that supports both EBCDIC and
  780. UTF-8/16/32.])
  781. fi
  782. if test "$enable_ebcdic_nl25" = "yes"; then
  783. AC_DEFINE_UNQUOTED([EBCDIC_NL25], [], [
  784. In an EBCDIC environment, define this macro to any value to arrange for
  785. the NL character to be 0x25 instead of the default 0x15. NL plays the role
  786. that LF does in an ASCII/Unicode environment.])
  787. fi
  788. if test "$enable_valgrind" = "yes"; then
  789. AC_DEFINE_UNQUOTED([SUPPORT_VALGRIND], [], [
  790. Define to any value for valgrind support to find invalid memory reads.])
  791. fi
  792. # Platform specific issues
  793. NO_UNDEFINED=
  794. EXPORT_ALL_SYMBOLS=
  795. case $host_os in
  796. cygwin* | mingw* )
  797. if test X"$enable_shared" = Xyes; then
  798. NO_UNDEFINED="-no-undefined"
  799. EXPORT_ALL_SYMBOLS="-Wl,--export-all-symbols"
  800. fi
  801. ;;
  802. esac
  803. # The extra LDFLAGS for each particular library. The libpcre2*_version values
  804. # are m4 variables, assigned above.
  805. EXTRA_LIBPCRE2_8_LDFLAGS="$EXTRA_LIBPCRE2_8_LDFLAGS \
  806. $NO_UNDEFINED -version-info libpcre2_8_version"
  807. EXTRA_LIBPCRE2_16_LDFLAGS="$EXTRA_LIBPCRE2_16_LDFLAGS \
  808. $NO_UNDEFINED -version-info libpcre2_16_version"
  809. EXTRA_LIBPCRE2_32_LDFLAGS="$EXTRA_LIBPCRE2_32_LDFLAGS \
  810. $NO_UNDEFINED -version-info libpcre2_32_version"
  811. EXTRA_LIBPCRE2_POSIX_LDFLAGS="$EXTRA_LIBPCRE2_POSIX_LDFLAGS \
  812. $NO_UNDEFINED -version-info libpcre2_posix_version"
  813. AC_SUBST(EXTRA_LIBPCRE2_8_LDFLAGS)
  814. AC_SUBST(EXTRA_LIBPCRE2_16_LDFLAGS)
  815. AC_SUBST(EXTRA_LIBPCRE2_32_LDFLAGS)
  816. AC_SUBST(EXTRA_LIBPCRE2_POSIX_LDFLAGS)
  817. # When we run 'make distcheck', use these arguments. Turning off compiler
  818. # optimization makes it run faster.
  819. DISTCHECK_CONFIGURE_FLAGS="CFLAGS='' CXXFLAGS='' --enable-pcre2-16 --enable-pcre2-32 --enable-jit"
  820. AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
  821. # Check that, if --enable-pcre2grep-libz or --enable-pcre2grep-libbz2 is
  822. # specified, the relevant library is available.
  823. if test "$enable_pcre2grep_libz" = "yes"; then
  824. if test "$HAVE_ZLIB_H" != "1"; then
  825. echo "** Cannot --enable-pcre2grep-libz because zlib.h was not found"
  826. exit 1
  827. fi
  828. if test "$HAVE_LIBZ" != "1"; then
  829. echo "** Cannot --enable-pcre2grep-libz because libz was not found"
  830. exit 1
  831. fi
  832. LIBZ="-lz"
  833. fi
  834. AC_SUBST(LIBZ)
  835. if test "$enable_pcre2grep_libbz2" = "yes"; then
  836. if test "$HAVE_BZLIB_H" != "1"; then
  837. echo "** Cannot --enable-pcre2grep-libbz2 because bzlib.h was not found"
  838. exit 1
  839. fi
  840. if test "$HAVE_LIBBZ2" != "1"; then
  841. echo "** Cannot --enable-pcre2grep-libbz2 because libbz2 was not found"
  842. exit 1
  843. fi
  844. LIBBZ2="-lbz2"
  845. fi
  846. AC_SUBST(LIBBZ2)
  847. # Similarly for --enable-pcre2test-readline
  848. if test "$enable_pcre2test_libedit" = "yes"; then
  849. if test "$enable_pcre2test_libreadline" = "yes"; then
  850. echo "** Cannot use both --enable-pcre2test-libedit and --enable-pcre2test-readline"
  851. exit 1
  852. fi
  853. if test -z "$HAVE_LIBEDIT_HEADER"; then
  854. echo "** Cannot --enable-pcre2test-libedit because neither editline/readline.h,"
  855. echo "** edit/readline/readline.h nor a compatible header was found."
  856. exit 1
  857. fi
  858. if test -z "$LIBEDIT"; then
  859. echo "** Cannot --enable-pcre2test-libedit because libedit library was not found."
  860. exit 1
  861. fi
  862. fi
  863. if test "$enable_pcre2test_libreadline" = "yes"; then
  864. if test "$HAVE_READLINE_H" != "1"; then
  865. echo "** Cannot --enable-pcre2test-readline because readline/readline.h was not found."
  866. exit 1
  867. fi
  868. if test "$HAVE_HISTORY_H" != "1"; then
  869. echo "** Cannot --enable-pcre2test-readline because readline/history.h was not found."
  870. exit 1
  871. fi
  872. if test -z "$LIBREADLINE"; then
  873. echo "** Cannot --enable-pcre2test-readline because readline library was not found."
  874. exit 1
  875. fi
  876. fi
  877. # Handle valgrind support
  878. if test "$enable_valgrind" = "yes"; then
  879. m4_ifdef([PKG_CHECK_MODULES],
  880. [PKG_CHECK_MODULES([VALGRIND],[valgrind])],
  881. [AC_MSG_ERROR([pkg-config not supported])])
  882. fi
  883. # Handle code coverage reporting support
  884. if test "$enable_coverage" = "yes"; then
  885. if test "x$GCC" != "xyes"; then
  886. AC_MSG_ERROR([Code coverage reports can only be generated when using GCC])
  887. fi
  888. # ccache is incompatible with gcov
  889. AC_PATH_PROG([SHTOOL],[shtool],[false])
  890. case `$SHTOOL path $CC` in
  891. *ccache*) cc_ccache=yes;;
  892. *) cc_ccache=no;;
  893. esac
  894. if test "$cc_ccache" = "yes"; then
  895. if test -z "$CCACHE_DISABLE" -o "$CCACHE_DISABLE" != "1"; then
  896. AC_MSG_ERROR([must export CCACHE_DISABLE=1 to disable ccache for code coverage])
  897. fi
  898. fi
  899. AC_ARG_VAR([LCOV],[the ltp lcov program])
  900. AC_PATH_PROG([LCOV],[lcov],[false])
  901. if test "x$LCOV" = "xfalse"; then
  902. AC_MSG_ERROR([lcov not found])
  903. fi
  904. AC_ARG_VAR([GENHTML],[the ltp genhtml program])
  905. AC_PATH_PROG([GENHTML],[genhtml],[false])
  906. if test "x$GENHTML" = "xfalse"; then
  907. AC_MSG_ERROR([genhtml not found])
  908. fi
  909. # Set flags needed for gcov
  910. GCOV_CFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
  911. GCOV_CXXFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
  912. GCOV_LIBS="-lgcov"
  913. AC_SUBST([GCOV_CFLAGS])
  914. AC_SUBST([GCOV_CXXFLAGS])
  915. AC_SUBST([GCOV_LIBS])
  916. fi # enable_coverage
  917. AM_CONDITIONAL([WITH_GCOV],[test "x$enable_coverage" = "xyes"])
  918. AC_MSG_CHECKING([whether Intel CET is enabled])
  919. AC_LANG_PUSH([C])
  920. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,
  921. [[#ifndef __CET__
  922. # error CET is not enabled
  923. #endif]])],
  924. [pcre2_cc_cv_intel_cet_enabled=yes],
  925. [pcre2_cc_cv_intel_cet_enabled=no])
  926. AC_MSG_RESULT([$pcre2_cc_cv_intel_cet_enabled])
  927. if test "$pcre2_cc_cv_intel_cet_enabled" = yes; then
  928. CET_CFLAGS="-mshstk"
  929. AC_SUBST([CET_CFLAGS])
  930. fi
  931. AC_LANG_POP([C])
  932. # LIB_POSTFIX is used by CMakeLists.txt for Windows debug builds.
  933. # Pass empty LIB_POSTFIX to *.pc files and pcre2-config here.
  934. AC_SUBST(LIB_POSTFIX)
  935. # Produce these files, in addition to config.h.
  936. AC_CONFIG_FILES(
  937. Makefile
  938. libpcre2-8.pc
  939. libpcre2-16.pc
  940. libpcre2-32.pc
  941. libpcre2-posix.pc
  942. pcre2-config
  943. src/pcre2.h
  944. )
  945. # Make the generated script files executable.
  946. AC_CONFIG_COMMANDS([script-chmod], [chmod a+x pcre2-config])
  947. # Make sure that pcre2_chartables.c is removed in case the method for
  948. # creating it was changed by reconfiguration.
  949. AC_CONFIG_COMMANDS([delete-old-chartables], [rm -f pcre2_chartables.c])
  950. AC_OUTPUT
  951. # --disable-stack-for-recursion is obsolete and has no effect.
  952. if test "$enable_stack_for_recursion" = "no"; then
  953. cat <<EOF
  954. WARNING: --disable-stack-for-recursion is obsolete and has no effect.
  955. EOF
  956. fi
  957. # Print out a nice little message after configure is run displaying the
  958. # chosen options.
  959. ebcdic_nl_code=n/a
  960. if test "$enable_ebcdic_nl25" = "yes"; then
  961. ebcdic_nl_code=0x25
  962. elif test "$enable_ebcdic" = "yes"; then
  963. ebcdic_nl_code=0x15
  964. fi
  965. cat <<EOF
  966. $PACKAGE-$VERSION configuration summary:
  967. Install prefix ..................... : ${prefix}
  968. C preprocessor ..................... : ${CPP}
  969. C compiler ......................... : ${CC}
  970. Linker ............................. : ${LD}
  971. C preprocessor flags ............... : ${CPPFLAGS}
  972. C compiler flags ................... : ${CFLAGS} ${VISIBILITY_CFLAGS}
  973. Linker flags ....................... : ${LDFLAGS}
  974. Extra libraries .................... : ${LIBS}
  975. Build 8-bit pcre2 library .......... : ${enable_pcre2_8}
  976. Build 16-bit pcre2 library ......... : ${enable_pcre2_16}
  977. Build 32-bit pcre2 library ......... : ${enable_pcre2_32}
  978. Include debugging code ............. : ${enable_debug}
  979. Enable JIT compiling support ....... : ${enable_jit}
  980. Use SELinux allocator in JIT ....... : ${enable_jit_sealloc}
  981. Enable Unicode support ............. : ${enable_unicode}
  982. Newline char/sequence .............. : ${enable_newline}
  983. \R matches only ANYCRLF ............ : ${enable_bsr_anycrlf}
  984. \C is disabled ..................... : ${enable_never_backslash_C}
  985. EBCDIC coding ...................... : ${enable_ebcdic}
  986. EBCDIC code for NL ................. : ${ebcdic_nl_code}
  987. Rebuild char tables ................ : ${enable_rebuild_chartables}
  988. Internal link size ................. : ${with_link_size}
  989. Maximum variable lookbehind ........ : ${with_max_varlookbehind}
  990. Nested parentheses limit ........... : ${with_parens_nest_limit}
  991. Heap limit ......................... : ${with_heap_limit} kibibytes
  992. Match limit ........................ : ${with_match_limit}
  993. Match depth limit .................. : ${with_match_limit_depth}
  994. Build shared libs .................. : ${enable_shared}
  995. Build static libs .................. : ${enable_static}
  996. Use JIT in pcre2grep ............... : ${enable_pcre2grep_jit}
  997. Enable callouts in pcre2grep ....... : ${enable_pcre2grep_callout}
  998. Enable fork in pcre2grep callouts .. : ${enable_pcre2grep_callout_fork}
  999. Initial buffer size for pcre2grep .. : ${with_pcre2grep_bufsize}
  1000. Maximum buffer size for pcre2grep .. : ${with_pcre2grep_max_bufsize}
  1001. Link pcre2grep with libz ........... : ${enable_pcre2grep_libz}
  1002. Link pcre2grep with libbz2 ......... : ${enable_pcre2grep_libbz2}
  1003. Link pcre2test with libedit ........ : ${enable_pcre2test_libedit}
  1004. Link pcre2test with libreadline .... : ${enable_pcre2test_libreadline}
  1005. Valgrind support ................... : ${enable_valgrind}
  1006. Code coverage ...................... : ${enable_coverage}
  1007. Fuzzer support ..................... : ${enable_fuzz_support}
  1008. Differential fuzzer support ........ : ${enable_diff_fuzz_support}
  1009. Use %zu and %td .................... : ${enable_percent_zt}
  1010. EOF
  1011. dnl end configure.ac