1 dnl Process this file with autoconf to produce a configure script.
3 dnl This is required at the start; the name is the name of a file
4 dnl it should be seeing, to verify it is in the same directory.
8 dnl A safety precaution
12 dnl Arrange to build config.h from config.in. Note that pcre.h is
13 dnl built differently, as it is just a "substitution" file.
14 dnl Manual says this macro should come right after AC_INIT.
15 AC_CONFIG_HEADER(config.h:config.in)
17 dnl Provide the current PCRE version information. Do not use numbers
18 dnl with leading zeros for the minor version, as they end up in a C
19 dnl macro, and may be treated as octal constants. Stick to single
20 dnl digits for minor numbers less than 10. There are unlikely to be
21 dnl that many releases anyway.
26 PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}
28 dnl Default values for miscellaneous macros
30 POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=10
32 dnl Provide versioning information for libtool shared libraries that
33 dnl are built by default on Unix systems.
35 PCRE_LIB_VERSION=0:1:0
36 PCRE_POSIXLIB_VERSION=0:0:0
38 dnl Checks for programs.
42 dnl Checks for header files.
45 AC_CHECK_HEADERS(limits.h)
47 dnl Checks for typedefs, structures, and compiler characteristics.
52 dnl Checks for library functions.
54 AC_CHECK_FUNCS(bcopy memmove strerror)
56 dnl Handle --enable-shared-libraries
61 [ --disable-shared build PCRE as a static library],
62 if test "$enableval" = "no"; then
68 dnl Handle --enable-utf8
71 [ --enable-utf8 enable UTF8 support],
72 if test "$enableval" = "yes"; then
77 dnl Handle --enable-unicode-properties
79 AC_ARG_ENABLE(unicode-properties,
80 [ --enable-unicode-properties enable Unicode properties support],
81 if test "$enableval" = "yes"; then
86 dnl Handle --enable-newline-is-cr
88 AC_ARG_ENABLE(newline-is-cr,
89 [ --enable-newline-is-cr use CR as the newline character],
90 if test "$enableval" = "yes"; then
95 dnl Handle --enable-newline-is-lf
97 AC_ARG_ENABLE(newline-is-lf,
98 [ --enable-newline-is-lf use LF as the newline character],
99 if test "$enableval" = "yes"; then
104 dnl Handle --enable-ebcdic
106 AC_ARG_ENABLE(ebcdic,
107 [ --enable-ebcdic assume EBCDIC coding rather than ASCII],
108 if test "$enableval" == "yes"; then
113 dnl Handle --disable-stack-for-recursion
115 AC_ARG_ENABLE(stack-for-recursion,
116 [ --disable-stack-for-recursion disable use of stack recursion when matching],
117 if test "$enableval" = "no"; then
118 NO_RECURSE=-DNO_RECURSE
122 dnl There doesn't seem to be a straightforward way of having parameters
123 dnl that set values, other than fudging the --with thing. So that's what
126 dnl Handle --with-posix-malloc-threshold=n
128 AC_ARG_WITH(posix-malloc-threshold,
129 [ --with-posix-malloc-threshold=5 threshold for POSIX malloc usage],
130 POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval
133 dnl Handle --with-link-size=n
135 AC_ARG_WITH(link-size,
136 [ --with-link-size=2 internal link size (2, 3, or 4 allowed)],
137 LINK_SIZE=-DLINK_SIZE=$withval
140 dnl Handle --with-match_limit=n
142 AC_ARG_WITH(match-limit,
143 [ --with-match-limit=10000000 default limit on internal looping)],
144 MATCH_LIMIT=-DMATCH_LIMIT=$withval
147 dnl Unicode character property support implies UTF-8 support
149 if test "$UCP" != "" ; then
153 dnl "Export" these variables
155 AC_SUBST(BUILD_EXEEXT)
156 AC_SUBST(BUILD_OBJEXT)
157 AC_SUBST(CC_FOR_BUILD)
158 AC_SUBST(CFLAGS_FOR_BUILD)
160 AC_SUBST(HAVE_MEMMOVE)
161 AC_SUBST(HAVE_STRERROR)
165 AC_SUBST(MATCH_LIMIT)
171 AC_SUBST(PCRE_VERSION)
172 AC_SUBST(PCRE_LIB_VERSION)
173 AC_SUBST(PCRE_POSIXLIB_VERSION)
174 AC_SUBST(POSIX_MALLOC_THRESHOLD)
179 if test "x$enable_shared" = "xno" ; then
180 AC_DEFINE([PCRE_STATIC],[1],[to link statically])
183 dnl This must be last; it determines what files are written as well as config.h
184 AC_OUTPUT(Makefile pcre.h:pcre.in pcre-config,[chmod a+x pcre-config])