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

Contents of /code/trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


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