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

Contents of /code/trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 96 - (hide annotations) (download)
Fri Mar 2 13:10:43 2007 UTC (7 years, 4 months ago) by nigel
File size: 9262 byte(s)
 r6896@hex:  nm | 2007-03-02 13:09:14 +0000
 Added EOL and keywork properties throughout

1 nigel 87 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 nigel 89 AC_CONFIG_SRCDIR([pcre.h])
14 nigel 87
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 nigel 89 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 nigel 87 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 nigel 91 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 nigel 93 dnl Handle --enable-newline-is-any
189    
190     AC_ARG_ENABLE(newline-is-any,
191     [ --enable-newline-is-any use any Unicode newline sequence],
192     if test "$enableval" = "yes"; then
193     NEWLINE=-DNEWLINE=-1
194     fi
195     )
196    
197 nigel 87 dnl Handle --enable-ebcdic
198    
199     AC_ARG_ENABLE(ebcdic,
200     [ --enable-ebcdic assume EBCDIC coding rather than ASCII],
201 nigel 93 if test "$enableval" = "yes"; then
202 nigel 87 EBCDIC=-DEBCDIC=1
203     fi
204     )
205    
206     dnl Handle --disable-stack-for-recursion
207    
208     AC_ARG_ENABLE(stack-for-recursion,
209     [ --disable-stack-for-recursion disable use of stack recursion when matching],
210     if test "$enableval" = "no"; then
211     NO_RECURSE=-DNO_RECURSE
212     fi
213     )
214    
215     dnl There doesn't seem to be a straightforward way of having parameters
216     dnl that set values, other than fudging the --with thing. So that's what
217     dnl I've done.
218    
219     dnl Handle --with-posix-malloc-threshold=n
220    
221     AC_ARG_WITH(posix-malloc-threshold,
222     [ --with-posix-malloc-threshold=10 threshold for POSIX malloc usage],
223     POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval
224     )
225    
226     dnl Handle --with-link-size=n
227    
228     AC_ARG_WITH(link-size,
229     [ --with-link-size=2 internal link size (2, 3, or 4 allowed)],
230     LINK_SIZE=-DLINK_SIZE=$withval
231     )
232    
233     dnl Handle --with-match-limit=n
234    
235     AC_ARG_WITH(match-limit,
236     [ --with-match-limit=10000000 default limit on internal looping],
237     MATCH_LIMIT=-DMATCH_LIMIT=$withval
238     )
239    
240     dnl Handle --with-match-limit_recursion=n
241    
242     AC_ARG_WITH(match-limit-recursion,
243     [ --with-match-limit-recursion=10000000 default limit on internal recursion],
244     MATCH_LIMIT_RECURSION=-DMATCH_LIMIT_RECURSION=$withval
245     )
246    
247     dnl Unicode character property support implies UTF-8 support
248    
249     if test "$UCP" != "" ; then
250     UTF8=-DSUPPORT_UTF8
251     fi
252    
253     dnl "Export" these variables
254    
255     AC_SUBST(BUILD_EXEEXT)
256     AC_SUBST(BUILD_OBJEXT)
257     AC_SUBST(CC_FOR_BUILD)
258     AC_SUBST(CXX_FOR_BUILD)
259     AC_SUBST(CFLAGS_FOR_BUILD)
260     AC_SUBST(CXXFLAGS_FOR_BUILD)
261     AC_SUBST(CXXLDFLAGS)
262     AC_SUBST(EBCDIC)
263     AC_SUBST(HAVE_MEMMOVE)
264     AC_SUBST(HAVE_STRERROR)
265     AC_SUBST(LINK_SIZE)
266     AC_SUBST(MATCH_LIMIT)
267     AC_SUBST(MATCH_LIMIT_RECURSION)
268     AC_SUBST(NEWLINE)
269     AC_SUBST(NO_RECURSE)
270     AC_SUBST(PCRE_LIB_VERSION)
271     AC_SUBST(PCRE_POSIXLIB_VERSION)
272     AC_SUBST(PCRE_CPPLIB_VERSION)
273     AC_SUBST(PCRE_VERSION)
274     AC_SUBST(POSIX_MALLOC_THRESHOLD)
275     AC_SUBST(UCP)
276     AC_SUBST(UTF8)
277    
278     dnl Stuff to make MinGW work better. Special treatment is no longer
279     dnl needed for Cygwin.
280    
281     case $host_os in
282     mingw* )
283     POSIX_OBJ=pcreposix.o
284     POSIX_LOBJ=pcreposix.lo
285     POSIX_LIB=
286     ON_WINDOWS=
287     NOT_ON_WINDOWS="#"
288     WIN_PREFIX=
289     ;;
290     * )
291     ON_WINDOWS="#"
292     NOT_ON_WINDOWS=
293     POSIX_OBJ=
294     POSIX_LOBJ=
295     POSIX_LIB=libpcreposix.la
296     WIN_PREFIX=
297     ;;
298     esac
299     AC_SUBST(WIN_PREFIX)
300     AC_SUBST(ON_WINDOWS)
301     AC_SUBST(NOT_ON_WINDOWS)
302     AC_SUBST(POSIX_OBJ)
303     AC_SUBST(POSIX_LOBJ)
304     AC_SUBST(POSIX_LIB)
305    
306     if test "x$enable_shared" = "xno" ; then
307     AC_DEFINE([PCRE_STATIC],[1],[to link statically])
308     fi
309    
310     dnl This must be last; it determines what files are written as well as config.h
311 nigel 93 AC_OUTPUT(Makefile pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in libpcrecpp.pc:libpcrecpp.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])

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