configure.ac 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  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 PCRE user writes code that uses PCRE_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 PCRE_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(pcre_major, [8])
  9. m4_define(pcre_minor, [43])
  10. m4_define(pcre_prerelease, [])
  11. m4_define(pcre_date, [2019-02-23])
  12. # NOTE: The CMakeLists.txt file searches for the above variables in the first
  13. # 50 lines of this file. Please update that if the variables above are moved.
  14. # Libtool shared library interface versions (current:revision:age)
  15. m4_define(libpcre_version, [3:11:2])
  16. m4_define(libpcre16_version, [2:11:2])
  17. m4_define(libpcre32_version, [0:11:0])
  18. m4_define(libpcreposix_version, [0:6:0])
  19. m4_define(libpcrecpp_version, [0:1:0])
  20. AC_PREREQ(2.57)
  21. AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre)
  22. AC_CONFIG_SRCDIR([pcre.h.in])
  23. AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
  24. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  25. AC_CONFIG_HEADERS(config.h)
  26. # This is a new thing required to stop a warning from automake 1.12
  27. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  28. # This was added at the suggestion of libtoolize (03-Jan-10)
  29. AC_CONFIG_MACRO_DIR([m4])
  30. # The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just
  31. # "-g" for any other compiler. There doesn't seem to be a standard way of
  32. # getting rid of the -g (which I don't think is needed for a production
  33. # library). This fudge seems to achieve the necessary. First, we remember the
  34. # externally set values of CFLAGS and CXXFLAGS. Then call the AC_PROG_CC and
  35. # AC_PROG_CXX macros to find the compilers - if CFLAGS and CXXFLAGS are not
  36. # set, they will be set to Autoconf's defaults. Afterwards, if the original
  37. # values were not set, remove the -g from the Autoconf defaults.
  38. # (PH 02-May-07)
  39. remember_set_CFLAGS="$CFLAGS"
  40. remember_set_CXXFLAGS="$CXXFLAGS"
  41. AC_PROG_CC
  42. AC_PROG_CXX
  43. AM_PROG_CC_C_O
  44. if test "x$remember_set_CFLAGS" = "x"
  45. then
  46. if test "$CFLAGS" = "-g -O2"
  47. then
  48. CFLAGS="-O2"
  49. elif test "$CFLAGS" = "-g"
  50. then
  51. CFLAGS=""
  52. fi
  53. fi
  54. if test "x$remember_set_CXXFLAGS" = "x"
  55. then
  56. if test "$CXXFLAGS" = "-g -O2"
  57. then
  58. CXXFLAGS="-O2"
  59. elif test "$CXXFLAGS" = "-g"
  60. then
  61. CXXFLAGS=""
  62. fi
  63. fi
  64. # AC_PROG_CXX will return "g++" even if no c++ compiler is installed.
  65. # Check for that case, and just disable c++ code if g++ doesn't run.
  66. AC_LANG_PUSH(C++)
  67. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],, CXX=""; CXXCP=""; CXXFLAGS="")
  68. AC_LANG_POP
  69. # Check for a 64-bit integer type
  70. AC_TYPE_INT64_T
  71. AC_PROG_INSTALL
  72. AC_LIBTOOL_WIN32_DLL
  73. LT_INIT
  74. AC_PROG_LN_S
  75. # Check for GCC visibility feature
  76. PCRE_VISIBILITY
  77. # Versioning
  78. PCRE_MAJOR="pcre_major"
  79. PCRE_MINOR="pcre_minor"
  80. PCRE_PRERELEASE="pcre_prerelease"
  81. PCRE_DATE="pcre_date"
  82. if test "$PCRE_MINOR" = "08" -o "$PCRE_MINOR" = "09"
  83. then
  84. echo "***"
  85. echo "*** Minor version number $PCRE_MINOR must not be used. ***"
  86. echo "*** Use only 01 to 07 or 10 onwards, to avoid octal issues. ***"
  87. echo "***"
  88. exit 1
  89. fi
  90. AC_SUBST(PCRE_MAJOR)
  91. AC_SUBST(PCRE_MINOR)
  92. AC_SUBST(PCRE_PRERELEASE)
  93. AC_SUBST(PCRE_DATE)
  94. # Set a more sensible default value for $(htmldir).
  95. if test "x$htmldir" = 'x${docdir}'
  96. then
  97. htmldir='${docdir}/html'
  98. fi
  99. # Handle --disable-pcre8 (enabled by default)
  100. AC_ARG_ENABLE(pcre8,
  101. AS_HELP_STRING([--disable-pcre8],
  102. [disable 8 bit character support]),
  103. , enable_pcre8=unset)
  104. AC_SUBST(enable_pcre8)
  105. # Handle --enable-pcre16 (disabled by default)
  106. AC_ARG_ENABLE(pcre16,
  107. AS_HELP_STRING([--enable-pcre16],
  108. [enable 16 bit character support]),
  109. , enable_pcre16=unset)
  110. AC_SUBST(enable_pcre16)
  111. # Handle --enable-pcre32 (disabled by default)
  112. AC_ARG_ENABLE(pcre32,
  113. AS_HELP_STRING([--enable-pcre32],
  114. [enable 32 bit character support]),
  115. , enable_pcre32=unset)
  116. AC_SUBST(enable_pcre32)
  117. # Handle --disable-cpp. The substitution of enable_cpp is needed for use in
  118. # pcre-config.
  119. AC_ARG_ENABLE(cpp,
  120. AS_HELP_STRING([--disable-cpp],
  121. [disable C++ support]),
  122. , enable_cpp=unset)
  123. AC_SUBST(enable_cpp)
  124. # Handle --enable-jit (disabled by default)
  125. AC_ARG_ENABLE(jit,
  126. AS_HELP_STRING([--enable-jit],
  127. [enable Just-In-Time compiling support]),
  128. , enable_jit=no)
  129. # This code enables JIT if the hardware supports it.
  130. if test "$enable_jit" = "auto"; then
  131. AC_LANG(C)
  132. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  133. #define SLJIT_CONFIG_AUTO 1
  134. #include "sljit/sljitConfigInternal.h"
  135. #if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
  136. #error unsupported
  137. #endif]])], enable_jit=yes, enable_jit=no)
  138. fi
  139. # Handle --disable-pcregrep-jit (enabled by default)
  140. AC_ARG_ENABLE(pcregrep-jit,
  141. AS_HELP_STRING([--disable-pcregrep-jit],
  142. [disable JIT support in pcregrep]),
  143. , enable_pcregrep_jit=yes)
  144. # Handle --enable-rebuild-chartables
  145. AC_ARG_ENABLE(rebuild-chartables,
  146. AS_HELP_STRING([--enable-rebuild-chartables],
  147. [rebuild character tables in current locale]),
  148. , enable_rebuild_chartables=no)
  149. # Handle --enable-utf8 (disabled by default)
  150. AC_ARG_ENABLE(utf8,
  151. AS_HELP_STRING([--enable-utf8],
  152. [another name for --enable-utf. Kept only for compatibility reasons]),
  153. , enable_utf8=unset)
  154. # Handle --enable-utf (disabled by default)
  155. AC_ARG_ENABLE(utf,
  156. AS_HELP_STRING([--enable-utf],
  157. [enable UTF-8/16/32 support (incompatible with --enable-ebcdic)]),
  158. , enable_utf=unset)
  159. # Handle --enable-unicode-properties
  160. AC_ARG_ENABLE(unicode-properties,
  161. AS_HELP_STRING([--enable-unicode-properties],
  162. [enable Unicode properties support (implies --enable-utf)]),
  163. , enable_unicode_properties=no)
  164. # Handle newline options
  165. ac_pcre_newline=lf
  166. AC_ARG_ENABLE(newline-is-cr,
  167. AS_HELP_STRING([--enable-newline-is-cr],
  168. [use CR as newline character]),
  169. ac_pcre_newline=cr)
  170. AC_ARG_ENABLE(newline-is-lf,
  171. AS_HELP_STRING([--enable-newline-is-lf],
  172. [use LF as newline character (default)]),
  173. ac_pcre_newline=lf)
  174. AC_ARG_ENABLE(newline-is-crlf,
  175. AS_HELP_STRING([--enable-newline-is-crlf],
  176. [use CRLF as newline sequence]),
  177. ac_pcre_newline=crlf)
  178. AC_ARG_ENABLE(newline-is-anycrlf,
  179. AS_HELP_STRING([--enable-newline-is-anycrlf],
  180. [use CR, LF, or CRLF as newline sequence]),
  181. ac_pcre_newline=anycrlf)
  182. AC_ARG_ENABLE(newline-is-any,
  183. AS_HELP_STRING([--enable-newline-is-any],
  184. [use any valid Unicode newline sequence]),
  185. ac_pcre_newline=any)
  186. enable_newline="$ac_pcre_newline"
  187. # Handle --enable-bsr-anycrlf
  188. AC_ARG_ENABLE(bsr-anycrlf,
  189. AS_HELP_STRING([--enable-bsr-anycrlf],
  190. [\R matches only CR, LF, CRLF by default]),
  191. , enable_bsr_anycrlf=no)
  192. # Handle --enable-ebcdic
  193. AC_ARG_ENABLE(ebcdic,
  194. AS_HELP_STRING([--enable-ebcdic],
  195. [assume EBCDIC coding rather than ASCII; incompatible with --enable-utf; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]),
  196. , enable_ebcdic=no)
  197. # Handle --enable-ebcdic-nl25
  198. AC_ARG_ENABLE(ebcdic-nl25,
  199. AS_HELP_STRING([--enable-ebcdic-nl25],
  200. [set EBCDIC code for NL to 0x25 instead of 0x15; it implies --enable-ebcdic]),
  201. , enable_ebcdic_nl25=no)
  202. # Handle --disable-stack-for-recursion
  203. AC_ARG_ENABLE(stack-for-recursion,
  204. AS_HELP_STRING([--disable-stack-for-recursion],
  205. [don't use stack recursion when matching]),
  206. , enable_stack_for_recursion=yes)
  207. # Handle --enable-pcregrep-libz
  208. AC_ARG_ENABLE(pcregrep-libz,
  209. AS_HELP_STRING([--enable-pcregrep-libz],
  210. [link pcregrep with libz to handle .gz files]),
  211. , enable_pcregrep_libz=no)
  212. # Handle --enable-pcregrep-libbz2
  213. AC_ARG_ENABLE(pcregrep-libbz2,
  214. AS_HELP_STRING([--enable-pcregrep-libbz2],
  215. [link pcregrep with libbz2 to handle .bz2 files]),
  216. , enable_pcregrep_libbz2=no)
  217. # Handle --with-pcregrep-bufsize=N
  218. AC_ARG_WITH(pcregrep-bufsize,
  219. AS_HELP_STRING([--with-pcregrep-bufsize=N],
  220. [pcregrep buffer size (default=20480, minimum=8192)]),
  221. , with_pcregrep_bufsize=20480)
  222. # Handle --enable-pcretest-libedit
  223. AC_ARG_ENABLE(pcretest-libedit,
  224. AS_HELP_STRING([--enable-pcretest-libedit],
  225. [link pcretest with libedit]),
  226. , enable_pcretest_libedit=no)
  227. # Handle --enable-pcretest-libreadline
  228. AC_ARG_ENABLE(pcretest-libreadline,
  229. AS_HELP_STRING([--enable-pcretest-libreadline],
  230. [link pcretest with libreadline]),
  231. , enable_pcretest_libreadline=no)
  232. # Handle --with-posix-malloc-threshold=NBYTES
  233. AC_ARG_WITH(posix-malloc-threshold,
  234. AS_HELP_STRING([--with-posix-malloc-threshold=NBYTES],
  235. [threshold for POSIX malloc usage (default=10)]),
  236. , with_posix_malloc_threshold=10)
  237. # Handle --with-link-size=N
  238. AC_ARG_WITH(link-size,
  239. AS_HELP_STRING([--with-link-size=N],
  240. [internal link size (2, 3, or 4 allowed; default=2)]),
  241. , with_link_size=2)
  242. # Handle --with-parens-nest-limit=N
  243. AC_ARG_WITH(parens-nest-limit,
  244. AS_HELP_STRING([--with-parens-nest-limit=N],
  245. [nested parentheses limit (default=250)]),
  246. , with_parens_nest_limit=250)
  247. # Handle --with-match-limit=N
  248. AC_ARG_WITH(match-limit,
  249. AS_HELP_STRING([--with-match-limit=N],
  250. [default limit on internal looping (default=10000000)]),
  251. , with_match_limit=10000000)
  252. # Handle --with-match-limit_recursion=N
  253. #
  254. # Note: In config.h, the default is to define MATCH_LIMIT_RECURSION
  255. # symbolically as MATCH_LIMIT, which in turn is defined to be some numeric
  256. # value (e.g. 10000000). MATCH_LIMIT_RECURSION can otherwise be set to some
  257. # different numeric value (or even the same numeric value as MATCH_LIMIT,
  258. # though no longer defined in terms of the latter).
  259. #
  260. AC_ARG_WITH(match-limit-recursion,
  261. AS_HELP_STRING([--with-match-limit-recursion=N],
  262. [default limit on internal recursion (default=MATCH_LIMIT)]),
  263. , with_match_limit_recursion=MATCH_LIMIT)
  264. # Handle --enable-valgrind
  265. AC_ARG_ENABLE(valgrind,
  266. AS_HELP_STRING([--enable-valgrind],
  267. [valgrind support]),
  268. , enable_valgrind=no)
  269. # Enable code coverage reports using gcov
  270. AC_ARG_ENABLE(coverage,
  271. AS_HELP_STRING([--enable-coverage],
  272. [enable code coverage reports using gcov]),
  273. , enable_coverage=no)
  274. # Copy enable_utf8 value to enable_utf for compatibility reasons
  275. if test "x$enable_utf8" != "xunset"
  276. then
  277. if test "x$enable_utf" != "xunset"
  278. then
  279. AC_MSG_ERROR([--enable/disable-utf8 is kept only for compatibility reasons and its value is copied to --enable/disable-utf. Newer code must use --enable/disable-utf alone.])
  280. fi
  281. enable_utf=$enable_utf8
  282. fi
  283. # Set the default value for pcre8
  284. if test "x$enable_pcre8" = "xunset"
  285. then
  286. enable_pcre8=yes
  287. fi
  288. # Set the default value for pcre16
  289. if test "x$enable_pcre16" = "xunset"
  290. then
  291. enable_pcre16=no
  292. fi
  293. # Set the default value for pcre32
  294. if test "x$enable_pcre32" = "xunset"
  295. then
  296. enable_pcre32=no
  297. fi
  298. # Make sure enable_pcre8 or enable_pcre16 was set
  299. if test "x$enable_pcre8$enable_pcre16$enable_pcre32" = "xnonono"
  300. then
  301. AC_MSG_ERROR([At least one of 8, 16 or 32 bit pcre library must be enabled])
  302. fi
  303. # Make sure that if enable_unicode_properties was set, that UTF support is enabled.
  304. if test "x$enable_unicode_properties" = "xyes"
  305. then
  306. if test "x$enable_utf" = "xno"
  307. then
  308. AC_MSG_ERROR([support for Unicode properties requires UTF-8/16/32 support])
  309. fi
  310. enable_utf=yes
  311. fi
  312. # enable_utf is disabled by default.
  313. if test "x$enable_utf" = "xunset"
  314. then
  315. enable_utf=no
  316. fi
  317. # enable_cpp copies the value of enable_pcre8 by default
  318. if test "x$enable_cpp" = "xunset"
  319. then
  320. enable_cpp=$enable_pcre8
  321. fi
  322. # Make sure that if enable_cpp was set, that enable_pcre8 support is enabled
  323. if test "x$enable_cpp" = "xyes"
  324. then
  325. if test "x$enable_pcre8" = "xno"
  326. then
  327. AC_MSG_ERROR([C++ library requires pcre library with 8 bit characters])
  328. fi
  329. fi
  330. # Convert the newline identifier into the appropriate integer value. The first
  331. # three are ASCII values 0x0a, 0x0d, and 0x0d0a, but if EBCDIC is enabled, they
  332. # are changed below.
  333. case "$enable_newline" in
  334. lf) ac_pcre_newline_value=10 ;;
  335. cr) ac_pcre_newline_value=13 ;;
  336. crlf) ac_pcre_newline_value=3338 ;;
  337. anycrlf) ac_pcre_newline_value=-2 ;;
  338. any) ac_pcre_newline_value=-1 ;;
  339. *)
  340. AC_MSG_ERROR([invalid argument \"$enable_newline\" to --enable-newline option])
  341. ;;
  342. esac
  343. # --enable-ebcdic-nl25 implies --enable-ebcdic
  344. if test "x$enable_ebcdic_nl25" = "xyes"; then
  345. enable_ebcdic=yes
  346. fi
  347. # Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled,
  348. # and the newline value is adjusted appropriately (CR is still 13, but LF is
  349. # 21 or 37). Also check that UTF support is not requested, because PCRE cannot
  350. # handle EBCDIC and UTF in the same build. To do so it would need to use
  351. # different character constants depending on the mode.
  352. #
  353. if test "x$enable_ebcdic" = "xyes"; then
  354. enable_rebuild_chartables=yes
  355. if test "x$enable_utf" = "xyes"; then
  356. AC_MSG_ERROR([support for EBCDIC and UTF-8/16/32 cannot be enabled at the same time])
  357. fi
  358. if test "x$enable_ebcdic_nl25" = "xno"; then
  359. case "$ac_pcre_newline_value" in
  360. 10) ac_pcre_newline_value=21 ;;
  361. 3338) ac_pcre_newline_value=3349 ;;
  362. esac
  363. else
  364. case "$ac_pcre_newline_value" in
  365. 10) ac_pcre_newline_value=37 ;;
  366. 3338) ac_pcre_newline_value=3365 ;;
  367. esac
  368. fi
  369. fi
  370. # Check argument to --with-link-size
  371. case "$with_link_size" in
  372. 2|3|4) ;;
  373. *)
  374. AC_MSG_ERROR([invalid argument \"$with_link_size\" to --with-link-size option])
  375. ;;
  376. esac
  377. AH_TOP([
  378. /* PCRE is written in Standard C, but there are a few non-standard things it
  379. can cope with, allowing it to run on SunOS4 and other "close to standard"
  380. systems.
  381. In environments that support the GNU autotools, config.h.in is converted into
  382. config.h by the "configure" script. In environments that use CMake,
  383. config-cmake.in is converted into config.h. If you are going to build PCRE "by
  384. hand" without using "configure" or CMake, you should copy the distributed
  385. config.h.generic to config.h, and edit the macro definitions to be the way you
  386. need them. You must then add -DHAVE_CONFIG_H to all of your compile commands,
  387. so that config.h is included at the start of every source.
  388. Alternatively, you can avoid editing by using -D on the compiler command line
  389. to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
  390. but if you do, default values will be taken from config.h for non-boolean
  391. macros that are not defined on the command line.
  392. Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE8 should either be defined
  393. (conventionally to 1) for TRUE, and not defined at all for FALSE. All such
  394. macros are listed as a commented #undef in config.h.generic. Macros such as
  395. MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
  396. surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
  397. PCRE uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
  398. HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make
  399. sure both macros are undefined; an emulation function will then be used. */])
  400. # Checks for header files.
  401. AC_HEADER_STDC
  402. AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h)
  403. AC_CHECK_HEADERS([windows.h], [HAVE_WINDOWS_H=1])
  404. # The files below are C++ header files.
  405. pcre_have_type_traits="0"
  406. pcre_have_bits_type_traits="0"
  407. if test "x$enable_cpp" = "xyes" -a -z "$CXX"; then
  408. AC_MSG_ERROR([Invalid C++ compiler or C++ compiler flags])
  409. fi
  410. if test "x$enable_cpp" = "xyes" -a -n "$CXX"
  411. then
  412. AC_LANG_PUSH(C++)
  413. # Older versions of pcre defined pcrecpp::no_arg, but in new versions
  414. # it's called pcrecpp::RE::no_arg. For backwards ABI compatibility,
  415. # we want to make one an alias for the other. Different systems do
  416. # this in different ways. Some systems, for instance, can do it via
  417. # a linker flag: -alias (for os x 10.5) or -i (for os x <=10.4).
  418. OLD_LDFLAGS="$LDFLAGS"
  419. for flag in "-alias,__ZN7pcrecpp2RE6no_argE,__ZN7pcrecpp6no_argE" \
  420. "-i__ZN7pcrecpp6no_argE:__ZN7pcrecpp2RE6no_argE"; do
  421. AC_MSG_CHECKING([for alias support in the linker])
  422. LDFLAGS="$OLD_LDFLAGS -Wl,$flag"
  423. # We try to run the linker with this new ld flag. If the link fails,
  424. # we give up and remove the new flag from LDFLAGS.
  425. AC_LINK_IFELSE([AC_LANG_PROGRAM([namespace pcrecpp {
  426. class RE { static int no_arg; };
  427. int RE::no_arg;
  428. }],
  429. [])],
  430. [AC_MSG_RESULT([yes]);
  431. EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS -Wl,$flag";
  432. break;],
  433. AC_MSG_RESULT([no]))
  434. done
  435. LDFLAGS="$OLD_LDFLAGS"
  436. # We could be more clever here, given we're doing AC_SUBST with this
  437. # (eg set a var to be the name of the include file we want). But we're not
  438. # so it's easy to change back to 'regular' autoconf vars if we needed to.
  439. AC_CHECK_HEADERS(string, [pcre_have_cpp_headers="1"],
  440. [pcre_have_cpp_headers="0"])
  441. AC_CHECK_HEADERS(bits/type_traits.h, [pcre_have_bits_type_traits="1"],
  442. [pcre_have_bits_type_traits="0"])
  443. AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
  444. [pcre_have_type_traits="0"])
  445. # (This isn't c++-specific, but is only used in pcrecpp.cc, so try this
  446. # in a c++ context. This matters becuase strtoimax is C99 and may not
  447. # be supported by the C++ compiler.)
  448. # Figure out how to create a longlong from a string: strtoll and
  449. # equiv. It's not enough to call AC_CHECK_FUNCS: hpux has a
  450. # strtoll, for instance, but it only takes 2 args instead of 3!
  451. # We have to call AH_TEMPLATE since AC_DEFINE_UNQUOTED below is complex.
  452. AH_TEMPLATE(HAVE_STRTOQ, [Define to 1 if you have `strtoq'.])
  453. AH_TEMPLATE(HAVE_STRTOLL, [Define to 1 if you have `strtoll'.])
  454. AH_TEMPLATE(HAVE__STRTOI64, [Define to 1 if you have `_strtoi64'.])
  455. AH_TEMPLATE(HAVE_STRTOIMAX, [Define to 1 if you have `strtoimax'.])
  456. have_strto_fn=0
  457. for fn in strtoq strtoll _strtoi64 strtoimax; do
  458. AC_MSG_CHECKING([for $fn])
  459. if test "$fn" = strtoimax; then
  460. include=stdint.h
  461. else
  462. include=stdlib.h
  463. fi
  464. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <$include>],
  465. [char* e; return $fn("100", &e, 10)])],
  466. [AC_MSG_RESULT(yes)
  467. AC_DEFINE_UNQUOTED(HAVE_`echo $fn | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`, 1,
  468. [Define to 1 if you have `$fn'.])
  469. have_strto_fn=1
  470. break],
  471. [AC_MSG_RESULT(no)])
  472. done
  473. if test "$have_strto_fn" = 1; then
  474. AC_CHECK_TYPES([long long],
  475. [pcre_have_long_long="1"],
  476. [pcre_have_long_long="0"])
  477. AC_CHECK_TYPES([unsigned long long],
  478. [pcre_have_ulong_long="1"],
  479. [pcre_have_ulong_long="0"])
  480. else
  481. pcre_have_long_long="0"
  482. pcre_have_ulong_long="0"
  483. fi
  484. AC_SUBST(pcre_have_long_long)
  485. AC_SUBST(pcre_have_ulong_long)
  486. AC_LANG_POP
  487. fi
  488. # Using AC_SUBST eliminates the need to include config.h in a public .h file
  489. AC_SUBST(pcre_have_type_traits)
  490. AC_SUBST(pcre_have_bits_type_traits)
  491. # Conditional compilation
  492. AM_CONDITIONAL(WITH_PCRE8, test "x$enable_pcre8" = "xyes")
  493. AM_CONDITIONAL(WITH_PCRE16, test "x$enable_pcre16" = "xyes")
  494. AM_CONDITIONAL(WITH_PCRE32, test "x$enable_pcre32" = "xyes")
  495. AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes")
  496. AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes")
  497. AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes")
  498. AM_CONDITIONAL(WITH_UTF, test "x$enable_utf" = "xyes")
  499. AM_CONDITIONAL(WITH_VALGRIND, test "x$enable_valgrind" = "xyes")
  500. # Checks for typedefs, structures, and compiler characteristics.
  501. AC_C_CONST
  502. AC_TYPE_SIZE_T
  503. # Checks for library functions.
  504. AC_CHECK_FUNCS(bcopy memmove strerror)
  505. # Check for the availability of libz (aka zlib)
  506. AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1])
  507. AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1])
  508. # Check for the availability of libbz2. Originally we just used AC_CHECK_LIB,
  509. # as for libz. However, this had the following problem, diagnosed and fixed by
  510. # a user:
  511. #
  512. # - libbz2 uses the Pascal calling convention (WINAPI) for the functions
  513. # under Win32.
  514. # - The standard autoconf AC_CHECK_LIB fails to include "bzlib.h",
  515. # therefore missing the function definition.
  516. # - The compiler thus generates a "C" signature for the test function.
  517. # - The linker fails to find the "C" function.
  518. # - PCRE fails to configure if asked to do so against libbz2.
  519. #
  520. # Solution:
  521. #
  522. # - Replace the AC_CHECK_LIB test with a custom test.
  523. AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1])
  524. # Original test
  525. # AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1])
  526. #
  527. # Custom test follows
  528. AC_MSG_CHECKING([for libbz2])
  529. OLD_LIBS="$LIBS"
  530. LIBS="$LIBS -lbz2"
  531. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  532. #ifdef HAVE_BZLIB_H
  533. #include <bzlib.h>
  534. #endif]],
  535. [[return (int)BZ2_bzopen("conftest", "rb");]])],
  536. [AC_MSG_RESULT([yes]);HAVE_LIBBZ2=1; break;],
  537. AC_MSG_RESULT([no]))
  538. LIBS="$OLD_LIBS"
  539. # Check for the availabiity of libreadline
  540. if test "$enable_pcretest_libreadline" = "yes"; then
  541. AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1])
  542. AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1])
  543. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lreadline"],
  544. [unset ac_cv_lib_readline_readline;
  545. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltinfo"],
  546. [unset ac_cv_lib_readline_readline;
  547. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lcurses"],
  548. [unset ac_cv_lib_readline_readline;
  549. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"],
  550. [unset ac_cv_lib_readline_readline;
  551. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"],
  552. [unset ac_cv_lib_readline_readline;
  553. AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"],
  554. [LIBREADLINE=""],
  555. [-ltermcap])],
  556. [-lncursesw])],
  557. [-lncurses])],
  558. [-lcurses])],
  559. [-ltinfo])])
  560. AC_SUBST(LIBREADLINE)
  561. if test -n "$LIBREADLINE"; then
  562. if test "$LIBREADLINE" != "-lreadline"; then
  563. echo "-lreadline needs $LIBREADLINE"
  564. LIBREADLINE="-lreadline $LIBREADLINE"
  565. fi
  566. fi
  567. fi
  568. # Check for the availability of libedit. Different distributions put its
  569. # headers in different places. Try to cover the most common ones.
  570. if test "$enable_pcretest_libedit" = "yes"; then
  571. AC_CHECK_HEADERS([editline/readline.h], [HAVE_EDITLINE_READLINE_H=1],
  572. [AC_CHECK_HEADERS([edit/readline/readline.h], [HAVE_READLINE_READLINE_H=1],
  573. [AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_READLINE_H=1])])])
  574. AC_CHECK_LIB([edit], [readline], [LIBEDIT="-ledit"])
  575. fi
  576. # This facilitates -ansi builds under Linux
  577. dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc])
  578. PCRE_STATIC_CFLAG=""
  579. if test "x$enable_shared" = "xno" ; then
  580. AC_DEFINE([PCRE_STATIC], [1], [
  581. Define to any value if linking statically (TODO: make nice with Libtool)])
  582. PCRE_STATIC_CFLAG="-DPCRE_STATIC"
  583. fi
  584. AC_SUBST(PCRE_STATIC_CFLAG)
  585. # Here is where pcre specific defines are handled
  586. if test "$enable_pcre8" = "yes"; then
  587. AC_DEFINE([SUPPORT_PCRE8], [], [
  588. Define to any value to enable the 8 bit PCRE library.])
  589. fi
  590. if test "$enable_pcre16" = "yes"; then
  591. AC_DEFINE([SUPPORT_PCRE16], [], [
  592. Define to any value to enable the 16 bit PCRE library.])
  593. fi
  594. if test "$enable_pcre32" = "yes"; then
  595. AC_DEFINE([SUPPORT_PCRE32], [], [
  596. Define to any value to enable the 32 bit PCRE library.])
  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_pcregrep_jit="no"
  610. fi
  611. if test "$enable_pcregrep_jit" = "yes"; then
  612. AC_DEFINE([SUPPORT_PCREGREP_JIT], [], [
  613. Define to any value to enable JIT support in pcregrep.])
  614. fi
  615. if test "$enable_utf" = "yes"; then
  616. AC_DEFINE([SUPPORT_UTF], [], [
  617. Define to any value to enable support for the UTF-8/16/32 Unicode encoding.
  618. This will work even in an EBCDIC environment, but it is incompatible
  619. with the EBCDIC macro. That is, PCRE can support *either* EBCDIC
  620. code *or* ASCII/UTF-8/16/32, but not both at once.])
  621. fi
  622. if test "$enable_unicode_properties" = "yes"; then
  623. AC_DEFINE([SUPPORT_UCP], [], [
  624. Define to any value to enable support for Unicode properties.])
  625. fi
  626. if test "$enable_stack_for_recursion" = "no"; then
  627. AC_DEFINE([NO_RECURSE], [], [
  628. PCRE uses recursive function calls to handle backtracking while
  629. matching. This can sometimes be a problem on systems that have
  630. stacks of limited size. Define NO_RECURSE to any value to get a
  631. version that doesn't use recursion in the match() function; instead
  632. it creates its own stack by steam using pcre_recurse_malloc() to obtain
  633. memory from the heap. For more detail, see the comments and other stuff
  634. just above the match() function.])
  635. fi
  636. if test "$enable_pcregrep_libz" = "yes"; then
  637. AC_DEFINE([SUPPORT_LIBZ], [], [
  638. Define to any value to allow pcregrep to be linked with libz, so that it is
  639. able to handle .gz files.])
  640. fi
  641. if test "$enable_pcregrep_libbz2" = "yes"; then
  642. AC_DEFINE([SUPPORT_LIBBZ2], [], [
  643. Define to any value to allow pcregrep to be linked with libbz2, so that it
  644. is able to handle .bz2 files.])
  645. fi
  646. if test $with_pcregrep_bufsize -lt 8192 ; then
  647. AC_MSG_WARN([$with_pcregrep_bufsize is too small for --with-pcregrep-bufsize; using 8192])
  648. with_pcregrep_bufsize="8192"
  649. else
  650. if test $? -gt 1 ; then
  651. AC_MSG_ERROR([Bad value for --with-pcregrep-bufsize])
  652. fi
  653. fi
  654. AC_DEFINE_UNQUOTED([PCREGREP_BUFSIZE], [$with_pcregrep_bufsize], [
  655. The value of PCREGREP_BUFSIZE determines the size of buffer used by pcregrep
  656. to hold parts of the file it is searching. This is also the minimum value.
  657. The actual amount of memory used by pcregrep is three times this number,
  658. because it allows for the buffering of "before" and "after" lines.])
  659. if test "$enable_pcretest_libedit" = "yes"; then
  660. AC_DEFINE([SUPPORT_LIBEDIT], [], [
  661. Define to any value to allow pcretest to be linked with libedit.])
  662. LIBREADLINE="$LIBEDIT"
  663. elif test "$enable_pcretest_libreadline" = "yes"; then
  664. AC_DEFINE([SUPPORT_LIBREADLINE], [], [
  665. Define to any value to allow pcretest to be linked with libreadline.])
  666. fi
  667. AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline_value], [
  668. The value of NEWLINE determines the default newline character sequence. PCRE
  669. client programs can override this by selecting other values at run time. In
  670. ASCII environments, the value can be 10 (LF), 13 (CR), or 3338 (CRLF); in
  671. EBCDIC environments the value can be 21 or 37 (LF), 13 (CR), or 3349 or 3365
  672. (CRLF) because there are two alternative codepoints (0x15 and 0x25) that are
  673. used as the NL line terminator that is equivalent to ASCII LF. In both ASCII
  674. and EBCDIC environments the value can also be -1 (ANY), or -2 (ANYCRLF).])
  675. if test "$enable_bsr_anycrlf" = "yes"; then
  676. AC_DEFINE([BSR_ANYCRLF], [], [
  677. By default, the \R escape sequence matches any Unicode line ending
  678. character or sequence of characters. If BSR_ANYCRLF is defined (to any
  679. value), this is changed so that backslash-R matches only CR, LF, or CRLF.
  680. The build-time default can be overridden by the user of PCRE at runtime.])
  681. fi
  682. AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [
  683. The value of LINK_SIZE determines the number of bytes used to store
  684. links as offsets within the compiled regex. The default is 2, which
  685. allows for compiled patterns up to 64K long. This covers the vast
  686. majority of cases. However, PCRE can also be compiled to use 3 or 4
  687. bytes instead. This allows for longer patterns in extreme cases.])
  688. AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$with_posix_malloc_threshold], [
  689. When calling PCRE via the POSIX interface, additional working storage
  690. is required for holding the pointers to capturing substrings because
  691. PCRE requires three integers per substring, whereas the POSIX
  692. interface provides only two. If the number of expected substrings is
  693. small, the wrapper function uses space on the stack, because this is
  694. faster than using malloc() for each call. The threshold above which
  695. the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD.])
  696. AC_DEFINE_UNQUOTED([PARENS_NEST_LIMIT], [$with_parens_nest_limit], [
  697. The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
  698. parentheses (of any kind) in a pattern. This limits the amount of system
  699. stack that is used while compiling a pattern.])
  700. AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [
  701. The value of MATCH_LIMIT determines the default number of times the
  702. internal match() function can be called during a single execution of
  703. pcre_exec(). There is a runtime interface for setting a different
  704. limit. The limit exists in order to catch runaway regular
  705. expressions that take for ever to determine that they do not match.
  706. The default is set very large so that it does not accidentally catch
  707. legitimate cases.])
  708. AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSION], [$with_match_limit_recursion], [
  709. The above limit applies to all calls of match(), whether or not they
  710. increase the recursion depth. In some environments it is desirable
  711. to limit the depth of recursive calls of match() more strictly, in
  712. order to restrict the maximum amount of stack (or heap, if
  713. NO_RECURSE is defined) that is used. The value of
  714. MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To
  715. have any useful effect, it must be less than the value of
  716. MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT.
  717. There is a runtime method for setting a different limit.])
  718. AC_DEFINE([MAX_NAME_SIZE], [32], [
  719. This limit is parameterized just in case anybody ever wants to
  720. change it. Care must be taken if it is increased, because it guards
  721. against integer overflow caused by enormously large patterns.])
  722. AC_DEFINE([MAX_NAME_COUNT], [10000], [
  723. This limit is parameterized just in case anybody ever wants to
  724. change it. Care must be taken if it is increased, because it guards
  725. against integer overflow caused by enormously large patterns.])
  726. AH_VERBATIM([PCRE_EXP_DEFN], [
  727. /* If you are compiling for a system other than a Unix-like system or
  728. Win32, and it needs some magic to be inserted before the definition
  729. of a function that is exported by the library, define this macro to
  730. contain the relevant magic. If you do not define this macro, a suitable
  731. __declspec value is used for Windows systems; in other environments
  732. "extern" is used for a C compiler and "extern C" for a C++ compiler.
  733. This macro apears at the start of every exported function that is part
  734. of the external API. It does not appear on functions that are "external"
  735. in the C sense, but which are internal to the library. */
  736. #undef PCRE_EXP_DEFN])
  737. if test "$enable_ebcdic" = "yes"; then
  738. AC_DEFINE_UNQUOTED([EBCDIC], [], [
  739. If you are compiling for a system that uses EBCDIC instead of ASCII
  740. character codes, define this macro to any value. You must also edit the
  741. NEWLINE macro below to set a suitable EBCDIC newline, commonly 21 (0x15).
  742. On systems that can use "configure" or CMake to set EBCDIC, NEWLINE is
  743. automatically adjusted. When EBCDIC is set, PCRE assumes that all input
  744. strings are in EBCDIC. If you do not define this macro, PCRE will assume
  745. input strings are ASCII or UTF-8/16/32 Unicode. It is not possible to build
  746. a version of PCRE that supports both EBCDIC and UTF-8/16/32.])
  747. fi
  748. if test "$enable_ebcdic_nl25" = "yes"; then
  749. AC_DEFINE_UNQUOTED([EBCDIC_NL25], [], [
  750. In an EBCDIC environment, define this macro to any value to arrange for
  751. the NL character to be 0x25 instead of the default 0x15. NL plays the role
  752. that LF does in an ASCII/Unicode environment. The value must also be set in
  753. the NEWLINE macro below. On systems that can use "configure" or CMake to
  754. set EBCDIC_NL25, the adjustment of NEWLINE is automatic.])
  755. fi
  756. if test "$enable_valgrind" = "yes"; then
  757. AC_DEFINE_UNQUOTED([SUPPORT_VALGRIND], [], [
  758. Define to any value for valgrind support to find invalid memory reads.])
  759. fi
  760. # Platform specific issues
  761. NO_UNDEFINED=
  762. EXPORT_ALL_SYMBOLS=
  763. case $host_os in
  764. cygwin* | mingw* )
  765. if test X"$enable_shared" = Xyes; then
  766. NO_UNDEFINED="-no-undefined"
  767. EXPORT_ALL_SYMBOLS="-Wl,--export-all-symbols"
  768. fi
  769. ;;
  770. esac
  771. # The extra LDFLAGS for each particular library
  772. # (Note: The libpcre*_version bits are m4 variables, assigned above)
  773. EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS \
  774. $NO_UNDEFINED -version-info libpcre_version"
  775. EXTRA_LIBPCRE16_LDFLAGS="$EXTRA_LIBPCRE16_LDFLAGS \
  776. $NO_UNDEFINED -version-info libpcre16_version"
  777. EXTRA_LIBPCRE32_LDFLAGS="$EXTRA_LIBPCRE32_LDFLAGS \
  778. $NO_UNDEFINED -version-info libpcre32_version"
  779. EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS \
  780. $NO_UNDEFINED -version-info libpcreposix_version"
  781. EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS \
  782. $NO_UNDEFINED -version-info libpcrecpp_version \
  783. $EXPORT_ALL_SYMBOLS"
  784. AC_SUBST(EXTRA_LIBPCRE_LDFLAGS)
  785. AC_SUBST(EXTRA_LIBPCRE16_LDFLAGS)
  786. AC_SUBST(EXTRA_LIBPCRE32_LDFLAGS)
  787. AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS)
  788. AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS)
  789. # When we run 'make distcheck', use these arguments. Turning off compiler
  790. # optimization makes it run faster.
  791. DISTCHECK_CONFIGURE_FLAGS="CFLAGS='' CXXFLAGS='' --enable-pcre16 --enable-pcre32 --enable-jit --enable-cpp --enable-unicode-properties"
  792. AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
  793. # Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is
  794. # specified, the relevant library is available.
  795. if test "$enable_pcregrep_libz" = "yes"; then
  796. if test "$HAVE_ZLIB_H" != "1"; then
  797. echo "** Cannot --enable-pcregrep-libz because zlib.h was not found"
  798. exit 1
  799. fi
  800. if test "$HAVE_LIBZ" != "1"; then
  801. echo "** Cannot --enable-pcregrep-libz because libz was not found"
  802. exit 1
  803. fi
  804. LIBZ="-lz"
  805. fi
  806. AC_SUBST(LIBZ)
  807. if test "$enable_pcregrep_libbz2" = "yes"; then
  808. if test "$HAVE_BZLIB_H" != "1"; then
  809. echo "** Cannot --enable-pcregrep-libbz2 because bzlib.h was not found"
  810. exit 1
  811. fi
  812. if test "$HAVE_LIBBZ2" != "1"; then
  813. echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found"
  814. exit 1
  815. fi
  816. LIBBZ2="-lbz2"
  817. fi
  818. AC_SUBST(LIBBZ2)
  819. # Similarly for --enable-pcretest-readline
  820. if test "$enable_pcretest_libedit" = "yes"; then
  821. if test "$enable_pcretest_libreadline" = "yes"; then
  822. echo "** Cannot use both --enable-pcretest-libedit and --enable-pcretest-readline"
  823. exit 1
  824. fi
  825. if test "$HAVE_EDITLINE_READLINE_H" != "1" -a \
  826. "$HAVE_READLINE_READLINE_H" != "1"; then
  827. echo "** Cannot --enable-pcretest-libedit because neither editline/readline.h"
  828. echo "** nor readline/readline.h was found."
  829. exit 1
  830. fi
  831. if test -z "$LIBEDIT"; then
  832. echo "** Cannot --enable-pcretest-libedit because libedit library was not found."
  833. exit 1
  834. fi
  835. fi
  836. if test "$enable_pcretest_libreadline" = "yes"; then
  837. if test "$HAVE_READLINE_H" != "1"; then
  838. echo "** Cannot --enable-pcretest-readline because readline/readline.h was not found."
  839. exit 1
  840. fi
  841. if test "$HAVE_HISTORY_H" != "1"; then
  842. echo "** Cannot --enable-pcretest-readline because readline/history.h was not found."
  843. exit 1
  844. fi
  845. if test -z "$LIBREADLINE"; then
  846. echo "** Cannot --enable-pcretest-readline because readline library was not found."
  847. exit 1
  848. fi
  849. fi
  850. # Handle valgrind support
  851. if test "$enable_valgrind" = "yes"; then
  852. m4_ifdef([PKG_CHECK_MODULES],
  853. [PKG_CHECK_MODULES([VALGRIND],[valgrind])],
  854. [AC_MSG_ERROR([pkg-config not supported])])
  855. fi
  856. # Handle code coverage reporting support
  857. if test "$enable_coverage" = "yes"; then
  858. if test "x$GCC" != "xyes"; then
  859. AC_MSG_ERROR([Code coverage reports can only be generated when using GCC])
  860. fi
  861. # ccache is incompatible with gcov
  862. AC_PATH_PROG([SHTOOL],[shtool],[false])
  863. case `$SHTOOL path $CC` in
  864. *ccache*) cc_ccache=yes;;
  865. *) cc_ccache=no;;
  866. esac
  867. if test "$cc_ccache" = "yes"; then
  868. if test -z "$CCACHE_DISABLE" -o "$CCACHE_DISABLE" != "1"; then
  869. AC_MSG_ERROR([must export CCACHE_DISABLE=1 to disable ccache for code coverage])
  870. fi
  871. fi
  872. AC_ARG_VAR([LCOV],[the ltp lcov program])
  873. AC_PATH_PROG([LCOV],[lcov],[false])
  874. if test "x$LCOV" = "xfalse"; then
  875. AC_MSG_ERROR([lcov not found])
  876. fi
  877. AC_ARG_VAR([GENHTML],[the ltp genhtml program])
  878. AC_PATH_PROG([GENHTML],[genhtml],[false])
  879. if test "x$GENHTML" = "xfalse"; then
  880. AC_MSG_ERROR([genhtml not found])
  881. fi
  882. # Set flags needed for gcov
  883. GCOV_CFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
  884. GCOV_CXXFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
  885. GCOV_LIBS="-lgcov"
  886. AC_SUBST([GCOV_CFLAGS])
  887. AC_SUBST([GCOV_CXXFLAGS])
  888. AC_SUBST([GCOV_LIBS])
  889. fi # enable_coverage
  890. AM_CONDITIONAL([WITH_GCOV],[test "x$enable_coverage" = "xyes"])
  891. # Produce these files, in addition to config.h.
  892. AC_CONFIG_FILES(
  893. Makefile
  894. libpcre.pc
  895. libpcre16.pc
  896. libpcre32.pc
  897. libpcreposix.pc
  898. libpcrecpp.pc
  899. pcre-config
  900. pcre.h
  901. pcre_stringpiece.h
  902. pcrecpparg.h
  903. )
  904. # Make the generated script files executable.
  905. AC_CONFIG_COMMANDS([script-chmod], [chmod a+x pcre-config])
  906. # Make sure that pcre_chartables.c is removed in case the method for
  907. # creating it was changed by reconfiguration.
  908. AC_CONFIG_COMMANDS([delete-old-chartables], [rm -f pcre_chartables.c])
  909. AC_OUTPUT
  910. # Print out a nice little message after configure is run displaying the
  911. # chosen options.
  912. ebcdic_nl_code=n/a
  913. if test "$enable_ebcdic_nl25" = "yes"; then
  914. ebcdic_nl_code=0x25
  915. elif test "$enable_ebcdic" = "yes"; then
  916. ebcdic_nl_code=0x15
  917. fi
  918. cat <<EOF
  919. $PACKAGE-$VERSION configuration summary:
  920. Install prefix .................. : ${prefix}
  921. C preprocessor .................. : ${CPP}
  922. C compiler ...................... : ${CC}
  923. C++ preprocessor ................ : ${CXXCPP}
  924. C++ compiler .................... : ${CXX}
  925. Linker .......................... : ${LD}
  926. C preprocessor flags ............ : ${CPPFLAGS}
  927. C compiler flags ................ : ${CFLAGS} ${VISIBILITY_CFLAGS}
  928. C++ compiler flags .............. : ${CXXFLAGS} ${VISIBILITY_CXXFLAGS}
  929. Linker flags .................... : ${LDFLAGS}
  930. Extra libraries ................. : ${LIBS}
  931. Build 8 bit pcre library ........ : ${enable_pcre8}
  932. Build 16 bit pcre library ....... : ${enable_pcre16}
  933. Build 32 bit pcre library ....... : ${enable_pcre32}
  934. Build C++ library ............... : ${enable_cpp}
  935. Enable JIT compiling support .... : ${enable_jit}
  936. Enable UTF-8/16/32 support ...... : ${enable_utf}
  937. Unicode properties .............. : ${enable_unicode_properties}
  938. Newline char/sequence ........... : ${enable_newline}
  939. \R matches only ANYCRLF ......... : ${enable_bsr_anycrlf}
  940. EBCDIC coding ................... : ${enable_ebcdic}
  941. EBCDIC code for NL .............. : ${ebcdic_nl_code}
  942. Rebuild char tables ............. : ${enable_rebuild_chartables}
  943. Use stack recursion ............. : ${enable_stack_for_recursion}
  944. POSIX mem threshold ............. : ${with_posix_malloc_threshold}
  945. Internal link size .............. : ${with_link_size}
  946. Nested parentheses limit ........ : ${with_parens_nest_limit}
  947. Match limit ..................... : ${with_match_limit}
  948. Match limit recursion ........... : ${with_match_limit_recursion}
  949. Build shared libs ............... : ${enable_shared}
  950. Build static libs ............... : ${enable_static}
  951. Use JIT in pcregrep ............. : ${enable_pcregrep_jit}
  952. Buffer size for pcregrep ........ : ${with_pcregrep_bufsize}
  953. Link pcregrep with libz ......... : ${enable_pcregrep_libz}
  954. Link pcregrep with libbz2 ....... : ${enable_pcregrep_libbz2}
  955. Link pcretest with libedit ...... : ${enable_pcretest_libedit}
  956. Link pcretest with libreadline .. : ${enable_pcretest_libreadline}
  957. Valgrind support ................ : ${enable_valgrind}
  958. Code coverage ................... : ${enable_coverage}
  959. EOF
  960. dnl end configure.ac