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

Contents of /code/trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 885 - (show annotations) (download)
Tue Jan 17 14:12:47 2012 UTC (2 years, 8 months ago) by ph10
File size: 32355 byte(s)
Make AM_SILENT_RULES conditional.

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

Properties

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12