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