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

Contents of /code/trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 97 - (hide annotations) (download)
Mon Mar 5 12:36:47 2007 UTC (7 years, 5 months ago) by ph10
File size: 16027 byte(s)
Applied Bob and Daniel's patches to convert the build system to automake. Added 
the maintain directory, containing files that are used for maintenance, but are 
not distributed. This is an intermediate step.

1 nigel 87 dnl Process this file with autoconf to produce a configure script.
2    
3 ph10 97 m4_define(pcre_major, [7])
4     m4_define(pcre_minor, [1])
5     m4_define(pcre_prerelease, [-RC0])
6     m4_define(pcre_date, [2006-12-18])
7 nigel 87
8 ph10 97 # Libtool shared library interface versions (current:revision:age)
9     m4_define(libpcre_version, [0:1:0])
10     m4_define(libpcreposix_version, [0:0:0])
11     m4_define(libpcrecpp_version, [0:0:0])
12 nigel 87
13 ph10 97 AC_PREREQ(2.57)
14     AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre)
15     AC_CONFIG_SRCDIR([pcre.h.in])
16     AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
17     AC_CONFIG_HEADERS(config.h)
18     AC_PROG_CC
19     AC_PROG_CXX
20     AC_PROG_INSTALL
21     AC_LIBTOOL_WIN32_DLL
22     AC_PROG_LIBTOOL
23 nigel 87
24 ph10 97 PCRE_MAJOR="pcre_major"
25     PCRE_MINOR="pcre_minor"
26     PCRE_PRERELEASE="pcre_prerelease"
27     PCRE_DATE="pcre_date"
28 nigel 87
29 ph10 97 AC_SUBST(PCRE_MAJOR)
30     AC_SUBST(PCRE_MINOR)
31     AC_SUBST(PCRE_PRERELEASE)
32     AC_SUBST(PCRE_DATE)
33 nigel 87
34 ph10 97 # Set a more sensible default value for $(htmldir).
35     if test "x$htmldir" = 'x${docdir}'
36     then
37     htmldir='${docdir}/html'
38     fi
39 nigel 87
40 ph10 97 # Handle --disable-cpp
41     AC_ARG_ENABLE(cpp,
42     AS_HELP_STRING([--disable-cpp],
43     [disable C++ support]),
44     , enable_cpp=yes)
45 nigel 87
46 ph10 97 # Handle --enable-utf8 (disabled by default)
47     AC_ARG_ENABLE(utf8,
48     AS_HELP_STRING([--enable-utf8],
49     [enable UTF-8 support]),
50     , enable_utf8=unset)
51 nigel 87
52 ph10 97 # Handle --enable-unicode-properties
53     AC_ARG_ENABLE(unicode-properties,
54     AS_HELP_STRING([--enable-unicode-properties],
55     [enable Unicode properties support (implies --enable-utf8)]),
56     , enable_unicode_properties=no)
57 nigel 87
58 ph10 97 # Handle --enable-newline=NL
59     dnl AC_ARG_ENABLE(newline,
60     dnl AS_HELP_STRING([--enable-newline=NL],
61     dnl [use NL as newline (lf, cr, crlf, any; default=lf)]),
62     dnl , enable_newline=lf)
63 nigel 87
64 ph10 97 # Separate newline options
65     ac_pcre_newline=lf
66     AC_ARG_ENABLE(newline-is-cr,
67     AS_HELP_STRING([--enable-newline-is-cr],
68     [use CR as newline character]),
69     ac_pcre_newline=cr)
70     AC_ARG_ENABLE(newline-is-lf,
71     AS_HELP_STRING([--enable-newline-is-lf],
72     [use LF as newline character (default)]),
73     ac_pcre_newline=lf)
74     AC_ARG_ENABLE(newline-is-crlf,
75     AS_HELP_STRING([--enable-newline-is-crlf],
76     [use CRLF as newline sequence]),
77     ac_pcre_newline=crlf)
78     AC_ARG_ENABLE(newline-is-any,
79     AS_HELP_STRING([--enable-newline-is-any],
80     [use any valid Unicode newline sequence]),
81     ac_pcre_newline=any)
82     enable_newline="$ac_pcre_newline"
83 nigel 87
84 ph10 97 # Handle --enable-ebcdic
85     AC_ARG_ENABLE(ebcdic,
86     AS_HELP_STRING([--enable-ebcdic],
87     [assume EBCDIC coding rather than ASCII]),
88     , enable_ebcdic=no)
89 nigel 87
90 ph10 97 # Handle --disable-stack-for-recursion
91     AC_ARG_ENABLE(stack-for-recursion,
92     AS_HELP_STRING([--disable-stack-for-recursion],
93     [don't use stack recursion when matching]),
94     , enable_stack_for_recursion=yes)
95 nigel 87
96 ph10 97 # Handle --with-posix-malloc-threshold=NBYTES
97     AC_ARG_WITH(posix-malloc-threshold,
98     AS_HELP_STRING([--with-posix-malloc-threshold=NBYTES],
99     [threshold for POSIX malloc usage (default=10)]),
100     , with_posix_malloc_threshold=10)
101 nigel 87
102 ph10 97 # Handle --with-link-size=N
103     AC_ARG_WITH(link-size,
104     AS_HELP_STRING([--with-link-size=N],
105     [internal link size (2, 3, or 4 allowed; default=2)]),
106     , with_link_size=2)
107 nigel 87
108 ph10 97 # Handle --with-match-limit=N
109     AC_ARG_WITH(match-limit,
110     AS_HELP_STRING([--with-match-limit=N],
111     [default limit on internal looping (default=10000000)]),
112     , with_match_limit=10000000)
113 nigel 87
114 ph10 97 # Handle --with-match-limit_recursion=N
115     #
116     # Note: In config.h, the default is to define MATCH_LIMIT_RECURSION
117     # symbolically as MATCH_LIMIT, which in turn is defined to be some numeric
118     # value (e.g. 10000000). MATCH_LIMIT_RECURSION can otherwise be set to some
119     # different numeric value (or even the same numeric value as MATCH_LIMIT,
120     # though no longer defined in terms of the latter).
121     #
122     AC_ARG_WITH(match-limit-recursion,
123     AS_HELP_STRING([--with-match-limit-recursion=N],
124     [default limit on internal recursion (default=MATCH_LIMIT)]),
125     , with_match_limit_recursion=MATCH_LIMIT)
126 nigel 87
127 ph10 97 # Make sure that if enable_unicode_properties was set, that UTF-8 support
128     # is enabled.
129     #
130     if test "x$enable_unicode_properties" = "xyes"
131     then
132     if test "x$enable_utf8" = "xno"
133     then
134     AC_MSG_ERROR([support for Unicode properties requires UTF-8 support])
135     fi
136     enable_utf8=yes
137     fi
138 nigel 87
139 ph10 97 if test "x$enable_utf8" = "xunset"
140     then
141     enable_utf8=no
142     fi
143 nigel 87
144 ph10 97 # Convert the newline identifier into the appropriate integer value.
145     case "$enable_newline" in
146     lf) ac_pcre_newline_value=10 ;;
147     cr) ac_pcre_newline_value=13 ;;
148     crlf) ac_pcre_newline_value=3338 ;;
149     any) ac_pcre_newline_value=-1 ;;
150     *)
151     AC_MSG_ERROR([invalid argument \"$enable_newline\" to --enable-newline option])
152     ;;
153     esac
154 nigel 87
155 ph10 97 # Check argument to --with-link-size
156     case "$with_link_size" in
157     2|3|4) ;;
158     *)
159     AC_MSG_ERROR([invalid argument \"$with_link_size\" to --with-link-size option])
160     ;;
161     esac
162 nigel 87
163 ph10 97 AH_TOP([
164     /* On Unix-like systems config.in is converted by "configure" into
165     config.h. Some other environments also support the use of "configure".
166     PCRE is written in Standard C, but there are a few non-standard things
167     it can cope with, allowing it to run on SunOS4 and other "close to
168     standard" systems.
169 nigel 87
170 ph10 97 On a non-Unix-like system you should just copy this file into config.h,
171     and set up the macros the way you need them. You should normally change
172     the definitions of HAVE_STRERROR and HAVE_MEMMOVE to 1. Unfortunately,
173     because of the way autoconf works, these cannot be made the defaults.
174     If your system has bcopy() and not memmove(), change the definition of
175     HAVE_BCOPY instead of HAVE_MEMMOVE. If your system has neither bcopy()
176     nor memmove(), leave them both as 0; an emulation function will be
177     used. */])
178 nigel 87
179 ph10 97 # Checks for header files.
180 nigel 87 AC_HEADER_STDC
181 ph10 97 AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h windows.h)
182 nigel 87
183 ph10 97 # The files below are C++ header files.
184     pcre_have_type_traits="0"
185     pcre_have_bits_type_traits="0"
186     if test "x$enable_cpp" = "xyes" -a -n "$CXX"
187 nigel 87 then
188 ph10 97 AC_LANG_PUSH(C++)
189 nigel 87
190 ph10 97 # We could be more clever here, given we're doing AC_SUBST with this
191     # (eg set a var to be the name of the include file we want). But we're not
192     # so it's easy to change back to 'regular' autoconf vars if we needed to.
193 nigel 87 AC_CHECK_HEADERS(string, [pcre_have_cpp_headers="1"],
194     [pcre_have_cpp_headers="0"])
195     AC_CHECK_HEADERS(bits/type_traits.h, [pcre_have_bits_type_traits="1"],
196     [pcre_have_bits_type_traits="0"])
197     AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
198     [pcre_have_type_traits="0"])
199 ph10 97 AC_LANG_POP
200     fi
201     # Using AC_SUBST eliminates the need to include config.h in a public .h file
202     AC_SUBST(pcre_have_type_traits)
203 nigel 87 AC_SUBST(pcre_have_bits_type_traits)
204    
205 ph10 97 # Conditional compilation
206     AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes")
207 nigel 87
208 ph10 97 # Checks for typedefs, structures, and compiler characteristics.
209 nigel 87
210     AC_C_CONST
211     AC_TYPE_SIZE_T
212    
213 ph10 97 AC_CHECK_TYPES([long long],
214     [pcre_have_long_long="1"],
215     [pcre_have_long_long="0"])
216     AC_CHECK_TYPES([unsigned long long],
217     [pcre_have_ulong_long="1"],
218     [pcre_have_ulong_long="0"])
219 nigel 87 AC_SUBST(pcre_have_long_long)
220     AC_SUBST(pcre_have_ulong_long)
221    
222 ph10 97 # Checks for library functions.
223 nigel 87
224     AC_CHECK_FUNCS(bcopy memmove strerror strtoq strtoll)
225    
226 ph10 97 # This facilitates -ansi builds under Linux
227     dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc])
228 nigel 87
229 ph10 97 if test "x$enable_shared" = "xno" ; then
230     AC_DEFINE([PCRE_STATIC], [1], [
231     Define if linking statically (TODO: make nice with Libtool)])
232 nigel 87 fi
233    
234 ph10 97 # Here is where pcre specific defines are handled
235 nigel 87
236 ph10 97 if test "$enable_utf8" = "yes"; then
237     AC_DEFINE([SUPPORT_UTF8], [], [
238     Define to enable support for the UTF-8 Unicode encoding.])
239 nigel 87 fi
240    
241 ph10 97 if test "$enable_unicode_properties" = "yes"; then
242     AC_DEFINE([SUPPORT_UCP], [], [
243     Define to enable support for Unicode properties])
244     fi
245 nigel 87
246 ph10 97 if test "$enable_stack_for_recursion" = "no"; then
247     AC_DEFINE([NO_RECURSE], [], [
248     PCRE uses recursive function calls to handle backtracking while
249     matching. This can sometimes be a problem on systems that have
250     stacks of limited size. Define NO_RECURSE to get a version that
251     doesn't use recursion in the match() function; instead it creates
252     its own stack by steam using pcre_recurse_malloc() to obtain memory
253     from the heap. For more detail, see the comments and other stuff
254     just above the match() function. On systems that support it,
255     "configure" can be used to set this in the Makefile
256     (use --disable-stack-for-recursion).])
257 nigel 87 fi
258    
259 ph10 97 AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline_value], [
260     The value of NEWLINE determines the newline character. The default is
261     to leave it up to the compiler, but some sites want to force a
262     particular value. On Unix-like systems, "configure" can be used to
263     override this default.])
264 nigel 87
265 ph10 97 AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [
266     The value of LINK_SIZE determines the number of bytes used to store
267     links as offsets within the compiled regex. The default is 2, which
268     allows for compiled patterns up to 64K long. This covers the vast
269     majority of cases. However, PCRE can also be compiled to use 3 or 4
270     bytes instead. This allows for longer patterns in extreme cases. On
271     systems that support it, "configure" can be used to override this default.])
272 nigel 87
273 ph10 97 AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$with_posix_malloc_threshold], [
274     When calling PCRE via the POSIX interface, additional working storage
275     is required for holding the pointers to capturing substrings because
276     PCRE requires three integers per substring, whereas the POSIX
277     interface provides only two. If the number of expected substrings is
278     small, the wrapper function uses space on the stack, because this is
279     faster than using malloc() for each call. The threshold above which
280     the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD. On
281     systems that support it, "configure" can be used to override this
282     default.])
283 nigel 91
284 ph10 97 AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [
285     The value of MATCH_LIMIT determines the default number of times the
286     internal match() function can be called during a single execution of
287     pcre_exec(). There is a runtime interface for setting a different
288     limit. The limit exists in order to catch runaway regular
289     expressions that take for ever to determine that they do not match.
290     The default is set very large so that it does not accidentally catch
291     legitimate cases. On systems that support it, "configure" can be
292     used to override this default default.])
293 nigel 91
294 ph10 97 AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSION], [$with_match_limit_recursion], [
295     The above limit applies to all calls of match(), whether or not they
296     increase the recursion depth. In some environments it is desirable
297     to limit the depth of recursive calls of match() more strictly, in
298     order to restrict the maximum amount of stack (or heap, if
299     NO_RECURSE is defined) that is used. The value of
300     MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To
301     have any useful effect, it must be less than the value of
302     MATCH_LIMIT. There is a runtime method for setting a different
303     limit. On systems that support it, "configure" can be used to
304     override this default default.])
305 nigel 93
306 ph10 97 AC_DEFINE([MAX_NAME_SIZE], [32], [
307     This limit is parameterized just in case anybody ever wants to
308     change it. Care must be taken if it is increased, because it guards
309     against integer overflow caused by enormously large patterns.])
310 nigel 93
311 ph10 97 AC_DEFINE([MAX_NAME_COUNT], [10000], [
312     This limit is parameterized just in case anybody ever wants to
313     change it. Care must be taken if it is increased, because it guards
314     against integer overflow caused by enormously large patterns.])
315 nigel 87
316 ph10 97 AC_DEFINE([MAX_DUPLENGTH], [30000], [
317     This limit is parameterized just in case anybody ever wants to
318     change it. Care must be taken if it is increased, because it guards
319     against integer overflow caused by enormously large patterns.])
320 nigel 87
321 ph10 97 AH_VERBATIM([PCRE_DATA_SCOPE], [
322     /* If you are compiling for a system other than a Unix-like system or
323     Win32, and it needs some magic to be inserted before the definition
324     of a function that is exported by the library, define this macro to
325     contain the relevant magic. If you do not define this macro, it
326     defaults to "extern" for a C compiler and "extern C" for a C++
327     compiler on non-Win32 systems. This macro apears at the start of
328     every exported function that is part of the external API. It does
329     not appear on functions that are "external" in the C sense, but
330     which are internal to the library. */
331     #undef PCRE_DATA_SCOPE])
332 nigel 87
333 ph10 97 if test "$enable_ebcdic" = "yes"; then
334     AC_DEFINE_UNQUOTED([EBCDIC], [], [
335     If you are compiling for a system that uses EBCDIC instead of ASCII
336     character codes, define this macro as 1. On systems that can use
337     "configure", this can be done via --enable-ebcdic.])
338 nigel 87 fi
339    
340 ph10 97 # Here is where pcre specific substs are handled
341     # These 3 are only used by RunTest.in.
342     # TODO: remove once RunTest uses pcretest -C instead.
343     AC_SUBST(LINK_SIZE, $with_link_size)
344     AC_SUBST(UTF8, $enable_utf8)
345     AC_SUBST(UCP, $enable_unicode_properties)
346 nigel 87
347 ph10 97 # Platform specific issues
348     NO_UNDEFINED=
349     EXPORT_ALL_SYMBOLS=
350     case $host_os in
351     cygwin* | mingw* )
352     if test X"$enable_shared" = Xyes; then
353     NO_UNDEFINED="-no-undefined"
354     EXPORT_ALL_SYMBOLS="-Wl,--export-all-symbols"
355     fi
356     ;;
357     esac
358 nigel 87
359 ph10 97 # The extra LDFLAGS for each particular library
360     # (Note: The libpcre*_version bits are m4 variables, assigned above)
361 nigel 87
362 ph10 97 EXTRA_LIBPCRE_LDFLAGS="$NO_UNDEFINED -version-info libpcre_version"
363 nigel 87
364 ph10 97 EXTRA_LIBPCREPOSIX_LDFLAGS="$NO_UNDEFINED -version-info libpcreposix_version"
365 nigel 87
366 ph10 97 EXTRA_LIBPCRECPP_LDFLAGS="$NO_UNDEFINED $EXPORT_ALL_SYMBOLS -version-info libpcrecpp_version"
367 nigel 87
368 ph10 97 AC_SUBST(EXTRA_LIBPCRE_LDFLAGS)
369     AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS)
370     AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS)
371 nigel 87
372 ph10 97 # When we run 'make distcheck', use these arguments.
373     DISTCHECK_CONFIGURE_FLAGS="--enable-cpp --enable-unicode-properties"
374     AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
375 nigel 87
376 ph10 97 # Produce these files, in addition to config.h.
377     AC_CONFIG_FILES(
378     Makefile
379     RunGrepTest
380     RunTest
381     libpcre.pc
382     libpcrecpp.pc
383     pcre-config
384     pcre.h
385     pcre_stringpiece.h
386     pcrecpparg.h
387 nigel 87 )
388    
389 ph10 97 # Make the generated script files executable.
390     AC_CONFIG_COMMANDS([script-chmod], [chmod a+x RunTest RunGrepTest pcre-config])
391 nigel 87
392 ph10 97 AC_OUTPUT
393 nigel 87
394 ph10 97 # Print out a nice little message after configure is run displaying your
395     # chosen options.
396     #
397     cat <<EOF
398 nigel 87
399 ph10 97 $PACKAGE-$VERSION configuration summary:
400 nigel 87
401 ph10 97 Install prefix ......... : ${prefix}
402     C preprocessor ......... : ${CPP}
403     C compiler ............. : ${CC}
404     C++ preprocessor ....... : ${CXXCPP}
405     C++ compiler ........... : ${CXX}
406     Linker ................. : ${LD}
407     C preprocessor flags ... : ${CPPFLAGS}
408     C compiler flags ....... : ${CFLAGS}
409     C++ compiler flags ..... : ${CXXFLAGS}
410     Linker flags ........... : ${LDFLAGS}
411     Extra libraries ........ : ${LIBS}
412 nigel 87
413 ph10 97 Build C++ library ...... : ${enable_cpp}
414     Enable UTF-8 support ... : ${enable_utf8}
415     Unicode properties ..... : ${enable_unicode_properties}
416     Newline char/sequence .. : ${enable_newline}
417     EBCDIC coding .......... : ${enable_ebcdic}
418     Use stack recursion .... : ${enable_stack_for_recursion}
419     POSIX mem threshold .... : ${with_posix_malloc_threshold}
420     Internal link size ..... : ${with_link_size}
421     Match limit ............ : ${with_match_limit}
422     Match limit recursion .. : ${with_match_limit_recursion}
423     Build shared libs ...... : ${enable_shared}
424     Build static libs ...... : ${enable_static}
425 nigel 87
426 ph10 97 EOF
427 nigel 87
428 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