/[pcre]/code/trunk/configure.ac
ViewVC logotype

Contents of /code/trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:eol-style native
svn:keywords "Author Date Id Revision Url"

  ViewVC Help
Powered by ViewVC 1.1.5