/[pcre]/code/tags/pcre-6.7/configure.ac
ViewVC logotype

Contents of /code/tags/pcre-6.7/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 92 - (show annotations) (download)
Sat Feb 24 21:41:36 2007 UTC (7 years, 6 months ago) by nigel
File size: 9039 byte(s)
Tag code/trunk as code/tags/pcre-6.7.

1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl This configure.in file has been hacked around quite a lot as a result of
4 dnl patches that various people have sent to me (PH). Sometimes the information
5 dnl I get is contradictory. I've tried to put in comments that explain things,
6 dnl but in some cases the information is second-hand and I have no way of
7 dnl verifying it. I am not an autoconf or libtool expert!
8
9 dnl This is required at the start; the name is the name of a file
10 dnl it should be seeing, to verify it is in the same directory.
11
12 AC_INIT(dftables.c)
13 AC_CONFIG_SRCDIR([pcre.h])
14
15 dnl A safety precaution
16
17 AC_PREREQ(2.57)
18
19 dnl Arrange to build config.h from config.h.in.
20 dnl Manual says this macro should come right after AC_INIT.
21 AC_CONFIG_HEADER(config.h)
22
23 dnl Default values for miscellaneous macros
24
25 POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=10
26
27 dnl Provide versioning information for libtool shared libraries that
28 dnl are built by default on Unix systems.
29
30 PCRE_LIB_VERSION=0:1:0
31 PCRE_POSIXLIB_VERSION=0:0:0
32 PCRE_CPPLIB_VERSION=0:0:0
33
34 dnl Find the PCRE version from the pcre.h file. The PCRE_VERSION variable is
35 dnl substituted in pcre-config.in.
36
37 PCRE_MAJOR=`grep '#define PCRE_MAJOR' ${srcdir}/pcre.h | cut -c 29-`
38 PCRE_MINOR=`grep '#define PCRE_MINOR' ${srcdir}/pcre.h | cut -c 29-`
39 PCRE_PRERELEASE=`grep '#define PCRE_PRERELEASE' ${srcdir}/pcre.h | cut -c 29-`
40 PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}${PCRE_PRERELEASE}
41
42 dnl Handle --disable-cpp
43
44 AC_ARG_ENABLE(cpp,
45 [ --disable-cpp disable C++ support],
46 want_cpp="$enableval", want_cpp=yes)
47
48 dnl Checks for programs.
49
50 AC_PROG_CC
51
52 dnl Test for C++ for the C++ wrapper libpcrecpp. It seems, however, that
53 dnl AC_PROC_CXX will set $CXX to "g++" when no C++ compiler is installed, even
54 dnl though that is completely bogus. (This may happen only on certain systems
55 dnl with certain versions of autoconf, of course.) An attempt to include this
56 dnl test inside a check for want_cpp was criticized by a libtool expert, who
57 dnl tells me that it isn't allowed.
58
59 AC_PROG_CXX
60
61 dnl The icc compiler has the same options as gcc, so let the rest of the
62 dnl configure script think it has gcc when setting up dnl options etc.
63 dnl This is a nasty hack which no longer seems necessary with the update
64 dnl to the latest libtool files, so I have commented it out.
65 dnl
66 dnl if test "$CC" = "icc" ; then GCC=yes ; fi
67
68 AC_PROG_INSTALL
69 AC_LIBTOOL_WIN32_DLL
70 AC_PROG_LIBTOOL
71
72 dnl We need to find a compiler for compiling a program to run on the local host
73 dnl while building. It needs to be different from CC when cross-compiling.
74 dnl There is a macro called AC_PROG_CC_FOR_BUILD in the GNU archive for
75 dnl figuring this out automatically. Unfortunately, it does not work with the
76 dnl latest versions of autoconf. So for the moment, we just default to the
77 dnl same values as the "main" compiler. People who are cross-compiling will
78 dnl just have to adjust the Makefile by hand or set these values when they
79 dnl run "configure".
80
81 CC_FOR_BUILD=${CC_FOR_BUILD:-'$(CC)'}
82 CXX_FOR_BUILD=${CXX_FOR_BUILD:-'$(CXX)'}
83 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CFLAGS)'}
84 CPPFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CPPFLAGS)'}
85 CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD:-'$(CXXFLAGS)'}
86 BUILD_EXEEXT=${BUILD_EXEEXT:-'$(EXEEXT)'}
87 BUILD_OBJEXT=${BUILD_OBJEXT:-'$(OBJEXT)'}
88
89 dnl Checks for header files.
90
91 AC_HEADER_STDC
92 AC_CHECK_HEADERS(limits.h)
93
94 dnl The files below are C++ header files. One person told me (PH) that
95 dnl AC_LANG_CPLUSPLUS unsets CXX if it was explicitly set to something which
96 dnl doesn't work. However, this doesn't always seem to be the case.
97
98 if test "x$want_cpp" = "xyes" -a -n "$CXX"
99 then
100 AC_LANG_SAVE
101 AC_LANG_CPLUSPLUS
102
103 dnl We could be more clever here, given we're doing AC_SUBST with this
104 dnl (eg set a var to be the name of the include file we want). But we're not
105 dnl so it's easy to change back to 'regular' autoconf vars if we needed to.
106 AC_CHECK_HEADERS(string, [pcre_have_cpp_headers="1"],
107 [pcre_have_cpp_headers="0"])
108 AC_CHECK_HEADERS(bits/type_traits.h, [pcre_have_bits_type_traits="1"],
109 [pcre_have_bits_type_traits="0"])
110 AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
111 [pcre_have_type_traits="0"])
112 dnl Using AC_SUBST eliminates the need to include config.h in a public .h file
113 AC_SUBST(pcre_have_bits_type_traits)
114 AC_SUBST(pcre_have_type_traits)
115 AC_LANG_RESTORE
116 fi
117
118 dnl From the above, we now have enough info to know if C++ is fully installed
119 if test "x$want_cpp" = "xyes" -a -n "$CXX" -a "$pcre_have_cpp_headers" = 1; then
120 MAYBE_CPP_TARGETS='$(CPP_TARGETS)'
121 HAVE_CPP=
122 else
123 MAYBE_CPP_TARGETS=
124 HAVE_CPP="#"
125 fi
126 AC_SUBST(MAYBE_CPP_TARGETS)
127 AC_SUBST(HAVE_CPP)
128
129 dnl Checks for typedefs, structures, and compiler characteristics.
130
131 AC_C_CONST
132 AC_TYPE_SIZE_T
133
134 AC_CHECK_TYPES([long long], [pcre_have_long_long="1"], [pcre_have_long_long="0"])
135 AC_CHECK_TYPES([unsigned long long], [pcre_have_ulong_long="1"], [pcre_have_ulong_long="0"])
136 AC_SUBST(pcre_have_long_long)
137 AC_SUBST(pcre_have_ulong_long)
138
139 dnl Checks for library functions.
140
141 AC_CHECK_FUNCS(bcopy memmove strerror strtoq strtoll)
142
143 dnl Handle --enable-utf8
144
145 AC_ARG_ENABLE(utf8,
146 [ --enable-utf8 enable UTF8 support],
147 if test "$enableval" = "yes"; then
148 UTF8=-DSUPPORT_UTF8
149 fi
150 )
151
152 dnl Handle --enable-unicode-properties
153
154 AC_ARG_ENABLE(unicode-properties,
155 [ --enable-unicode-properties enable Unicode properties support],
156 if test "$enableval" = "yes"; then
157 UCP=-DSUPPORT_UCP
158 fi
159 )
160
161 dnl Handle --enable-newline-is-cr
162
163 AC_ARG_ENABLE(newline-is-cr,
164 [ --enable-newline-is-cr use CR as the newline character],
165 if test "$enableval" = "yes"; then
166 NEWLINE=-DNEWLINE=13
167 fi
168 )
169
170 dnl Handle --enable-newline-is-lf
171
172 AC_ARG_ENABLE(newline-is-lf,
173 [ --enable-newline-is-lf use LF as the newline character],
174 if test "$enableval" = "yes"; then
175 NEWLINE=-DNEWLINE=10
176 fi
177 )
178
179 dnl Handle --enable-newline-is-crlf
180
181 AC_ARG_ENABLE(newline-is-crlf,
182 [ --enable-newline-is-crlf use CRLF as the newline sequence],
183 if test "$enableval" = "yes"; then
184 NEWLINE=-DNEWLINE=3338
185 fi
186 )
187
188 dnl Handle --enable-ebcdic
189
190 AC_ARG_ENABLE(ebcdic,
191 [ --enable-ebcdic assume EBCDIC coding rather than ASCII],
192 if test "$enableval" == "yes"; then
193 EBCDIC=-DEBCDIC=1
194 fi
195 )
196
197 dnl Handle --disable-stack-for-recursion
198
199 AC_ARG_ENABLE(stack-for-recursion,
200 [ --disable-stack-for-recursion disable use of stack recursion when matching],
201 if test "$enableval" = "no"; then
202 NO_RECURSE=-DNO_RECURSE
203 fi
204 )
205
206 dnl There doesn't seem to be a straightforward way of having parameters
207 dnl that set values, other than fudging the --with thing. So that's what
208 dnl I've done.
209
210 dnl Handle --with-posix-malloc-threshold=n
211
212 AC_ARG_WITH(posix-malloc-threshold,
213 [ --with-posix-malloc-threshold=10 threshold for POSIX malloc usage],
214 POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval
215 )
216
217 dnl Handle --with-link-size=n
218
219 AC_ARG_WITH(link-size,
220 [ --with-link-size=2 internal link size (2, 3, or 4 allowed)],
221 LINK_SIZE=-DLINK_SIZE=$withval
222 )
223
224 dnl Handle --with-match-limit=n
225
226 AC_ARG_WITH(match-limit,
227 [ --with-match-limit=10000000 default limit on internal looping],
228 MATCH_LIMIT=-DMATCH_LIMIT=$withval
229 )
230
231 dnl Handle --with-match-limit_recursion=n
232
233 AC_ARG_WITH(match-limit-recursion,
234 [ --with-match-limit-recursion=10000000 default limit on internal recursion],
235 MATCH_LIMIT_RECURSION=-DMATCH_LIMIT_RECURSION=$withval
236 )
237
238 dnl Unicode character property support implies UTF-8 support
239
240 if test "$UCP" != "" ; then
241 UTF8=-DSUPPORT_UTF8
242 fi
243
244 dnl "Export" these variables
245
246 AC_SUBST(BUILD_EXEEXT)
247 AC_SUBST(BUILD_OBJEXT)
248 AC_SUBST(CC_FOR_BUILD)
249 AC_SUBST(CXX_FOR_BUILD)
250 AC_SUBST(CFLAGS_FOR_BUILD)
251 AC_SUBST(CXXFLAGS_FOR_BUILD)
252 AC_SUBST(CXXLDFLAGS)
253 AC_SUBST(EBCDIC)
254 AC_SUBST(HAVE_MEMMOVE)
255 AC_SUBST(HAVE_STRERROR)
256 AC_SUBST(LINK_SIZE)
257 AC_SUBST(MATCH_LIMIT)
258 AC_SUBST(MATCH_LIMIT_RECURSION)
259 AC_SUBST(NEWLINE)
260 AC_SUBST(NO_RECURSE)
261 AC_SUBST(PCRE_LIB_VERSION)
262 AC_SUBST(PCRE_POSIXLIB_VERSION)
263 AC_SUBST(PCRE_CPPLIB_VERSION)
264 AC_SUBST(PCRE_VERSION)
265 AC_SUBST(POSIX_MALLOC_THRESHOLD)
266 AC_SUBST(UCP)
267 AC_SUBST(UTF8)
268
269 dnl Stuff to make MinGW work better. Special treatment is no longer
270 dnl needed for Cygwin.
271
272 case $host_os in
273 mingw* )
274 POSIX_OBJ=pcreposix.o
275 POSIX_LOBJ=pcreposix.lo
276 POSIX_LIB=
277 ON_WINDOWS=
278 NOT_ON_WINDOWS="#"
279 WIN_PREFIX=
280 ;;
281 * )
282 ON_WINDOWS="#"
283 NOT_ON_WINDOWS=
284 POSIX_OBJ=
285 POSIX_LOBJ=
286 POSIX_LIB=libpcreposix.la
287 WIN_PREFIX=
288 ;;
289 esac
290 AC_SUBST(WIN_PREFIX)
291 AC_SUBST(ON_WINDOWS)
292 AC_SUBST(NOT_ON_WINDOWS)
293 AC_SUBST(POSIX_OBJ)
294 AC_SUBST(POSIX_LOBJ)
295 AC_SUBST(POSIX_LIB)
296
297 if test "x$enable_shared" = "xno" ; then
298 AC_DEFINE([PCRE_STATIC],[1],[to link statically])
299 fi
300
301 dnl This must be last; it determines what files are written as well as config.h
302 AC_OUTPUT(Makefile pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in pcrecpparg.h:pcrecpparg.h.in pcre_stringpiece.h:pcre_stringpiece.h.in RunGrepTest:RunGrepTest.in RunTest:RunTest.in,[chmod a+x RunTest RunGrepTest pcre-config])

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12