1dnl Process this file with autoconf to produce a configure script.
2
3dnl This is required at the start; the name is the name of a file
4dnl it should be seeing, to verify it is in the same directory.
5
6AC_INIT(dftables.c)
7
8dnl A safety precaution
9
10AC_PREREQ(2.57)
11
12dnl Arrange to build config.h from config.in. Note that pcre.h is
13dnl built differently, as it is just a "substitution" file.
14dnl Manual says this macro should come right after AC_INIT.
15AC_CONFIG_HEADER(config.h:config.in)
16
17dnl Provide the current PCRE version information. Do not use numbers
18dnl with leading zeros for the minor version, as they end up in a C
19dnl macro, and may be treated as octal constants. Stick to single
20dnl digits for minor numbers less than 10. There are unlikely to be
21dnl that many releases anyway.
22
23PCRE_MAJOR=5
24PCRE_MINOR=0
25PCRE_DATE=13-Sep-2004
26PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}
27
28dnl Default values for miscellaneous macros
29
30POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=10
31
32dnl Provide versioning information for libtool shared libraries that
33dnl are built by default on Unix systems.
34
35PCRE_LIB_VERSION=0:1:0
36PCRE_POSIXLIB_VERSION=0:0:0
37
38dnl Checks for programs.
39
40AC_PROG_CC
41
42dnl The icc compiler has the same options as gcc, so let the rest of the
43dnl configure script think it has gcc when setting up dnl options etc.
44dnl This is a nasty hack which no longer seems necessary with the update
45dnl to the latest libtool files, so I have commented it out.
46dnl
47dnl if test "$CC" = "icc" ; then GCC=yes ; fi
48
49AC_PROG_INSTALL
50AC_LIBTOOL_WIN32_DLL
51AC_PROG_LIBTOOL
52
53dnl We need to find a compiler for compiling a program to run on the local host
54dnl while building. It needs to be different from CC when cross-compiling.
55dnl There is a macro called AC_PROG_CC_FOR_BUILD in the GNU archive for
56dnl figuring this out automatically. Unfortunately, it does not work with the
57dnl latest versions of autoconf. So for the moment, we just default to the
58dnl same values as the "main" compiler. People who are corss-compiling will
59dnl just have to adjust the Makefile by hand or set these values when they
60dnl run "configure".
61
62CC_FOR_BUILD=${CC_FOR_BUILD:-'$(CC)'}
63CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CFLAGS)'}
64BUILD_EXEEXT=${BUILD_EXEEXT:-'$(EXEEXT)'}
65BUILD_OBJEXT=${BUILD_OBJEXT:-'$(OBJEXT)'}
66
67dnl Checks for header files.
68
69AC_HEADER_STDC
70AC_CHECK_HEADERS(limits.h)
71
72dnl Checks for typedefs, structures, and compiler characteristics.
73
74AC_C_CONST
75AC_TYPE_SIZE_T
76
77dnl Checks for library functions.
78
79AC_CHECK_FUNCS(bcopy memmove strerror)
80
81dnl Handle --enable-utf8
82
83AC_ARG_ENABLE(utf8,
84[  --enable-utf8           enable UTF8 support],
85if test "$enableval" = "yes"; then
86  UTF8=-DSUPPORT_UTF8
87fi
88)
89
90dnl Handle --enable-unicode-properties
91
92AC_ARG_ENABLE(unicode-properties,
93[  --enable-unicode-properties  enable Unicode properties support],
94if test "$enableval" = "yes"; then
95  UCP=-DSUPPORT_UCP
96fi
97)
98
99dnl Handle --enable-newline-is-cr
100
101AC_ARG_ENABLE(newline-is-cr,
102[  --enable-newline-is-cr  use CR as the newline character],
103if test "$enableval" = "yes"; then
104  NEWLINE=-DNEWLINE=13
105fi
106)
107
108dnl Handle --enable-newline-is-lf
109
110AC_ARG_ENABLE(newline-is-lf,
111[  --enable-newline-is-lf  use LF as the newline character],
112if test "$enableval" = "yes"; then
113  NEWLINE=-DNEWLINE=10
114fi
115)
116
117dnl Handle --enable-ebcdic
118
119AC_ARG_ENABLE(ebcdic,
120[  --enable-ebcdic         assume EBCDIC coding rather than ASCII],
121if test "$enableval" == "yes"; then
122  EBCDIC=-DEBCDIC=1
123fi
124)
125
126dnl Handle --disable-stack-for-recursion
127
128AC_ARG_ENABLE(stack-for-recursion,
129[  --disable-stack-for-recursion  disable use of stack recursion when matching],
130if test "$enableval" = "no"; then
131  NO_RECURSE=-DNO_RECURSE
132fi
133)
134
135dnl There doesn't seem to be a straightforward way of having parameters
136dnl that set values, other than fudging the --with thing. So that's what
137dnl I've done.
138
139dnl Handle --with-posix-malloc-threshold=n
140
141AC_ARG_WITH(posix-malloc-threshold,
142[  --with-posix-malloc-threshold=5  threshold for POSIX malloc usage],
143  POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval
144)
145
146dnl Handle --with-link-size=n
147
148AC_ARG_WITH(link-size,
149[  --with-link-size=2    internal link size (2, 3, or 4 allowed)],
150  LINK_SIZE=-DLINK_SIZE=$withval
151)
152
153dnl Handle --with-match_limit=n
154
155AC_ARG_WITH(match-limit,
156[  --with-match-limit=10000000      default limit on internal looping)],
157  MATCH_LIMIT=-DMATCH_LIMIT=$withval
158)
159
160dnl Now arrange to build libtool
161
162AC_PROG_LIBTOOL
163
164dnl Unicode character property support implies UTF-8 support
165
166if test "$UCP" != "" ; then
167  UTF8=-DSUPPORT_UTF8
168fi
169
170dnl "Export" these variables
171
172AC_SUBST(BUILD_EXEEXT)
173AC_SUBST(BUILD_OBJEXT)
174AC_SUBST(CC_FOR_BUILD)
175AC_SUBST(CFLAGS_FOR_BUILD)
176AC_SUBST(EBCDIC)
177AC_SUBST(HAVE_MEMMOVE)
178AC_SUBST(HAVE_STRERROR)
179AC_SUBST(LINK_SIZE)
180AC_SUBST(MATCH_LIMIT)
181AC_SUBST(NEWLINE)
182AC_SUBST(NO_RECURSE)
183AC_SUBST(PCRE_MAJOR)
184AC_SUBST(PCRE_MINOR)
185AC_SUBST(PCRE_DATE)
186AC_SUBST(PCRE_VERSION)
187AC_SUBST(PCRE_LIB_VERSION)
188AC_SUBST(PCRE_POSIXLIB_VERSION)
189AC_SUBST(POSIX_MALLOC_THRESHOLD)
190AC_SUBST(UCP)
191AC_SUBST(UTF8)
192
193dnl Stuff to make MinGW work better. Special treatment is no longer
194dnl needed for Cygwin.
195
196case $host_os in
197mingw* )
198    POSIX_OBJ=pcreposix.o
199    POSIX_LOBJ=pcreposix.lo
200    POSIX_LIB=
201    ON_WINDOWS=
202    NOT_ON_WINDOWS="#"
203    WIN_PREFIX=
204    ;;
205* )
206    ON_WINDOWS="#"
207    NOT_ON_WINDOWS=
208    POSIX_OBJ=
209    POSIX_LOBJ=
210    POSIX_LIB=libpcreposix.la
211    WIN_PREFIX=
212    ;;
213esac
214AC_SUBST(WIN_PREFIX)
215AC_SUBST(ON_WINDOWS)
216AC_SUBST(NOT_ON_WINDOWS)
217AC_SUBST(POSIX_OBJ)
218AC_SUBST(POSIX_LOBJ)
219AC_SUBST(POSIX_LIB)
220
221if test "x$enable_shared" = "xno" ; then
222    AC_DEFINE([PCRE_STATIC],[1],[to link statically])
223fi
224
225dnl This must be last; it determines what files are written as well as config.h
226AC_OUTPUT(Makefile pcre.h:pcre.in pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in RunTest:RunTest.in,[chmod a+x RunTest pcre-config])
227