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

Contents of /code/trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 938 - (hide annotations) (download)
Sun Feb 26 16:08:15 2012 UTC (14 months, 3 weeks ago) by ph10
File size: 35200 byte(s)
Add /usr/include/edit/readline/ as somewhere where editline's header might be.

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