configure.ac 41 KB

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