| 1 |
dnl Process this file with autoconf to produce a configure script. |
dnl Process this file with autoconf to produce a configure script. |
| 2 |
|
|
| 3 |
dnl NOTE FOR MAINTAINERS: Do not use major or minor version numbers with |
dnl NOTE FOR MAINTAINERS: Do not use minor version numbers 08 or 09 because |
| 4 |
dnl leading zeros, because they may be treated as octal constants. The |
dnl the leading zeros may cause them to be treated as invalid octal constants |
| 5 |
dnl PCRE_PRERELEASE feature is for identifying release candidates. It might |
dnl if a PCRE user writes code that uses PCRE_MINOR as a number. There is now |
| 6 |
dnl be defined as -RC2, for example. For real releases, it should be defined |
dnl a check further down that throws an error if 08 or 09 are used. |
| 7 |
dnl empty. |
|
| 8 |
|
dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might |
| 9 |
m4_define(pcre_major, [7]) |
dnl be defined as -RC2, for example. For real releases, it should be empty. |
| 10 |
m4_define(pcre_minor, [7]) |
|
| 11 |
m4_define(pcre_prerelease, []) |
m4_define(pcre_major, [8]) |
| 12 |
m4_define(pcre_date, [2008-05-07]) |
m4_define(pcre_minor, [31]) |
| 13 |
|
m4_define(pcre_prerelease, [-RC1]) |
| 14 |
|
m4_define(pcre_date, [2012-02-012]) |
| 15 |
|
|
| 16 |
|
# NOTE: The CMakeLists.txt file searches for the above variables in the first |
| 17 |
|
# 50 lines of this file. Please update that if the variables above are moved. |
| 18 |
|
|
| 19 |
# Libtool shared library interface versions (current:revision:age) |
# Libtool shared library interface versions (current:revision:age) |
| 20 |
m4_define(libpcre_version, [0:1:0]) |
m4_define(libpcre_version, [1:0:0]) |
| 21 |
|
m4_define(libpcre16_version, [0:0:0]) |
| 22 |
m4_define(libpcreposix_version, [0:0:0]) |
m4_define(libpcreposix_version, [0:0:0]) |
| 23 |
m4_define(libpcrecpp_version, [0:0:0]) |
m4_define(libpcrecpp_version, [0:0:0]) |
| 24 |
|
|
| 26 |
AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre) |
AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre) |
| 27 |
AC_CONFIG_SRCDIR([pcre.h.in]) |
AC_CONFIG_SRCDIR([pcre.h.in]) |
| 28 |
AM_INIT_AUTOMAKE([dist-bzip2 dist-zip]) |
AM_INIT_AUTOMAKE([dist-bzip2 dist-zip]) |
| 29 |
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 30 |
AC_CONFIG_HEADERS(config.h) |
AC_CONFIG_HEADERS(config.h) |
| 31 |
|
|
| 32 |
|
# This was added at the suggestion of libtoolize (03-Jan-10) |
| 33 |
|
AC_CONFIG_MACRO_DIR([m4]) |
| 34 |
|
|
| 35 |
# The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just |
# The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just |
| 36 |
# "-g" for any other compiler. There doesn't seem to be a standard way of |
# "-g" for any other compiler. There doesn't seem to be a standard way of |
| 37 |
# getting rid of the -g (which I don't think is needed for a production |
# getting rid of the -g (which I don't think is needed for a production |
| 73 |
# AC_PROG_CXX will return "g++" even if no c++ compiler is installed. |
# AC_PROG_CXX will return "g++" even if no c++ compiler is installed. |
| 74 |
# Check for that case, and just disable c++ code if g++ doesn't run. |
# Check for that case, and just disable c++ code if g++ doesn't run. |
| 75 |
AC_LANG_PUSH(C++) |
AC_LANG_PUSH(C++) |
| 76 |
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[]),, CXX=""; CXXCP=""; CXXFLAGS="") |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],, CXX=""; CXXCP=""; CXXFLAGS="") |
| 77 |
AC_LANG_POP |
AC_LANG_POP |
| 78 |
|
|
| 79 |
|
# Check for a 64-bit integer type |
| 80 |
|
AC_TYPE_INT64_T |
| 81 |
|
|
| 82 |
AC_PROG_INSTALL |
AC_PROG_INSTALL |
| 83 |
AC_LIBTOOL_WIN32_DLL |
AC_LIBTOOL_WIN32_DLL |
| 84 |
AC_PROG_LIBTOOL |
LT_INIT |
| 85 |
AC_PROG_LN_S |
AC_PROG_LN_S |
| 86 |
|
|
| 87 |
PCRE_MAJOR="pcre_major" |
PCRE_MAJOR="pcre_major" |
| 89 |
PCRE_PRERELEASE="pcre_prerelease" |
PCRE_PRERELEASE="pcre_prerelease" |
| 90 |
PCRE_DATE="pcre_date" |
PCRE_DATE="pcre_date" |
| 91 |
|
|
| 92 |
|
if test "$PCRE_MINOR" = "08" -o "$PCRE_MINOR" = "09" |
| 93 |
|
then |
| 94 |
|
echo "***" |
| 95 |
|
echo "*** Minor version number $PCRE_MINOR must not be used. ***" |
| 96 |
|
echo "*** Use only 01 to 07 or 10 onwards, to avoid octal issues. ***" |
| 97 |
|
echo "***" |
| 98 |
|
exit 1 |
| 99 |
|
fi |
| 100 |
|
|
| 101 |
AC_SUBST(PCRE_MAJOR) |
AC_SUBST(PCRE_MAJOR) |
| 102 |
AC_SUBST(PCRE_MINOR) |
AC_SUBST(PCRE_MINOR) |
| 103 |
AC_SUBST(PCRE_PRERELEASE) |
AC_SUBST(PCRE_PRERELEASE) |
| 109 |
htmldir='${docdir}/html' |
htmldir='${docdir}/html' |
| 110 |
fi |
fi |
| 111 |
|
|
| 112 |
# Handle --disable-cpp |
# Handle --disable-pcre8 (enabled by default) |
| 113 |
|
AC_ARG_ENABLE(pcre8, |
| 114 |
|
AS_HELP_STRING([--disable-pcre8], |
| 115 |
|
[disable 8 bit character support]), |
| 116 |
|
, enable_pcre8=unset) |
| 117 |
|
AC_SUBST(enable_pcre8) |
| 118 |
|
|
| 119 |
|
# Handle --enable-pcre16 (disabled by default) |
| 120 |
|
AC_ARG_ENABLE(pcre16, |
| 121 |
|
AS_HELP_STRING([--enable-pcre16], |
| 122 |
|
[enable 16 bit character support]), |
| 123 |
|
, enable_pcre16=unset) |
| 124 |
|
AC_SUBST(enable_pcre16) |
| 125 |
|
|
| 126 |
|
# Handle --disable-cpp. The substitution of enable_cpp is needed for use in |
| 127 |
|
# pcre-config. |
| 128 |
AC_ARG_ENABLE(cpp, |
AC_ARG_ENABLE(cpp, |
| 129 |
AS_HELP_STRING([--disable-cpp], |
AS_HELP_STRING([--disable-cpp], |
| 130 |
[disable C++ support]), |
[disable C++ support]), |
| 131 |
, enable_cpp=yes) |
, enable_cpp=unset) |
| 132 |
|
AC_SUBST(enable_cpp) |
| 133 |
|
|
| 134 |
|
# Handle --enable-jit (disabled by default) |
| 135 |
|
AC_ARG_ENABLE(jit, |
| 136 |
|
AS_HELP_STRING([--enable-jit], |
| 137 |
|
[enable Just-In-Time compiling support]), |
| 138 |
|
, enable_jit=no) |
| 139 |
|
|
| 140 |
|
# Handle --disable-pcregrep-jit (enabled by default) |
| 141 |
|
AC_ARG_ENABLE(pcregrep-jit, |
| 142 |
|
AS_HELP_STRING([--disable-pcregrep-jit], |
| 143 |
|
[disable JIT support in pcregrep]), |
| 144 |
|
, enable_pcregrep_jit=yes) |
| 145 |
|
|
| 146 |
# Handle --enable-rebuild-chartables |
# Handle --enable-rebuild-chartables |
| 147 |
AC_ARG_ENABLE(rebuild-chartables, |
AC_ARG_ENABLE(rebuild-chartables, |
| 152 |
# Handle --enable-utf8 (disabled by default) |
# Handle --enable-utf8 (disabled by default) |
| 153 |
AC_ARG_ENABLE(utf8, |
AC_ARG_ENABLE(utf8, |
| 154 |
AS_HELP_STRING([--enable-utf8], |
AS_HELP_STRING([--enable-utf8], |
| 155 |
[enable UTF-8 support]), |
[another name for --enable-utf. Kept only for compatibility reasons]), |
| 156 |
, enable_utf8=unset) |
, enable_utf8=unset) |
| 157 |
|
|
| 158 |
|
# Handle --enable-utf (disabled by default) |
| 159 |
|
AC_ARG_ENABLE(utf, |
| 160 |
|
AS_HELP_STRING([--enable-utf], |
| 161 |
|
[enable UTF-8/16 support (incompatible with --enable-ebcdic)]), |
| 162 |
|
, enable_utf=unset) |
| 163 |
|
|
| 164 |
# Handle --enable-unicode-properties |
# Handle --enable-unicode-properties |
| 165 |
AC_ARG_ENABLE(unicode-properties, |
AC_ARG_ENABLE(unicode-properties, |
| 166 |
AS_HELP_STRING([--enable-unicode-properties], |
AS_HELP_STRING([--enable-unicode-properties], |
| 167 |
[enable Unicode properties support (implies --enable-utf8)]), |
[enable Unicode properties support (implies --enable-utf)]), |
| 168 |
, enable_unicode_properties=no) |
, enable_unicode_properties=no) |
| 169 |
|
|
| 170 |
# Handle --enable-newline=NL |
# Handle --enable-newline=NL |
| 206 |
# Handle --enable-ebcdic |
# Handle --enable-ebcdic |
| 207 |
AC_ARG_ENABLE(ebcdic, |
AC_ARG_ENABLE(ebcdic, |
| 208 |
AS_HELP_STRING([--enable-ebcdic], |
AS_HELP_STRING([--enable-ebcdic], |
| 209 |
[assume EBCDIC coding rather than ASCII; use this only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]), |
[assume EBCDIC coding rather than ASCII; incompatible with --enable-utf; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]), |
| 210 |
, enable_ebcdic=no) |
, enable_ebcdic=no) |
| 211 |
|
|
| 212 |
# Handle --disable-stack-for-recursion |
# Handle --disable-stack-for-recursion |
| 227 |
[link pcregrep with libbz2 to handle .bz2 files]), |
[link pcregrep with libbz2 to handle .bz2 files]), |
| 228 |
, enable_pcregrep_libbz2=no) |
, enable_pcregrep_libbz2=no) |
| 229 |
|
|
| 230 |
|
# Handle --with-pcregrep-bufsize=N |
| 231 |
|
AC_ARG_WITH(pcregrep-bufsize, |
| 232 |
|
AS_HELP_STRING([--with-pcregrep-bufsize=N], |
| 233 |
|
[pcregrep buffer size (default=20480)]), |
| 234 |
|
, with_pcregrep_bufsize=20480) |
| 235 |
|
|
| 236 |
# Handle --enable-pcretest-libreadline |
# Handle --enable-pcretest-libreadline |
| 237 |
AC_ARG_ENABLE(pcretest-libreadline, |
AC_ARG_ENABLE(pcretest-libreadline, |
| 238 |
AS_HELP_STRING([--enable-pcretest-libreadline], |
AS_HELP_STRING([--enable-pcretest-libreadline], |
| 270 |
[default limit on internal recursion (default=MATCH_LIMIT)]), |
[default limit on internal recursion (default=MATCH_LIMIT)]), |
| 271 |
, with_match_limit_recursion=MATCH_LIMIT) |
, with_match_limit_recursion=MATCH_LIMIT) |
| 272 |
|
|
| 273 |
# Make sure that if enable_unicode_properties was set, that UTF-8 support |
# Copy enable_utf8 value to enable_utf for compatibility reasons |
| 274 |
# is enabled. |
if test "x$enable_utf8" != "xunset" |
| 275 |
# |
then |
| 276 |
|
if test "x$enable_utf" != "xunset" |
| 277 |
|
then |
| 278 |
|
AC_MSG_ERROR([--enable/disable-utf8 is kept only for compatibility reasons and its value is copied to --enable/disable-utf. Newer code must use --enable/disable-utf alone.]) |
| 279 |
|
fi |
| 280 |
|
enable_utf=$enable_utf8 |
| 281 |
|
fi |
| 282 |
|
|
| 283 |
|
# Set the default value for pcre8 |
| 284 |
|
if test "x$enable_pcre8" = "xunset" |
| 285 |
|
then |
| 286 |
|
enable_pcre8=yes |
| 287 |
|
fi |
| 288 |
|
|
| 289 |
|
# Set the default value for pcre16 |
| 290 |
|
if test "x$enable_pcre16" = "xunset" |
| 291 |
|
then |
| 292 |
|
enable_pcre16=no |
| 293 |
|
fi |
| 294 |
|
|
| 295 |
|
# Make sure enable_pcre8 or enable_pcre16 was set |
| 296 |
|
if test "x$enable_pcre8$enable_pcre16" = "xnono" |
| 297 |
|
then |
| 298 |
|
AC_MSG_ERROR([Either 8 or 16 bit (or both) pcre library must be enabled]) |
| 299 |
|
fi |
| 300 |
|
|
| 301 |
|
# Make sure that if enable_unicode_properties was set, that UTF support is enabled. |
| 302 |
if test "x$enable_unicode_properties" = "xyes" |
if test "x$enable_unicode_properties" = "xyes" |
| 303 |
then |
then |
| 304 |
if test "x$enable_utf8" = "xno" |
if test "x$enable_utf" = "xno" |
| 305 |
then |
then |
| 306 |
AC_MSG_ERROR([support for Unicode properties requires UTF-8 support]) |
AC_MSG_ERROR([support for Unicode properties requires UTF-8/16 support]) |
| 307 |
fi |
fi |
| 308 |
enable_utf8=yes |
enable_utf=yes |
| 309 |
|
fi |
| 310 |
|
|
| 311 |
|
# enable_utf is disabled by default. |
| 312 |
|
if test "x$enable_utf" = "xunset" |
| 313 |
|
then |
| 314 |
|
enable_utf=no |
| 315 |
|
fi |
| 316 |
|
|
| 317 |
|
# enable_cpp copies the value of enable_pcre8 by default |
| 318 |
|
if test "x$enable_cpp" = "xunset" |
| 319 |
|
then |
| 320 |
|
enable_cpp=$enable_pcre8 |
| 321 |
fi |
fi |
| 322 |
|
|
| 323 |
if test "x$enable_utf8" = "xunset" |
# Make sure that if enable_cpp was set, that enable_pcre8 support is enabled |
| 324 |
|
if test "x$enable_cpp" = "xyes" |
| 325 |
then |
then |
| 326 |
enable_utf8=no |
if test "x$enable_pcre8" = "xno" |
| 327 |
|
then |
| 328 |
|
AC_MSG_ERROR([C++ library requires pcre library with 8 bit characters]) |
| 329 |
|
fi |
| 330 |
fi |
fi |
| 331 |
|
|
| 332 |
# Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled. |
# Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled. |
| 333 |
|
# Also check that UTF support is not requested, because PCRE cannot handle |
| 334 |
|
# EBCDIC and UTF in the same build. To do so it would need to use different |
| 335 |
|
# character constants depending on the mode. |
| 336 |
# |
# |
| 337 |
if test "x$enable_ebcdic" = "xyes" |
if test "x$enable_ebcdic" = "xyes" |
| 338 |
then |
then |
| 339 |
enable_rebuild_chartables=yes |
enable_rebuild_chartables=yes |
| 340 |
|
if test "x$enable_utf" = "xyes" |
| 341 |
|
then |
| 342 |
|
AC_MSG_ERROR([support for EBCDIC and UTF-8/16 cannot be enabled at the same time]) |
| 343 |
|
fi |
| 344 |
fi |
fi |
| 345 |
|
|
| 346 |
# Convert the newline identifier into the appropriate integer value. |
# Convert the newline identifier into the appropriate integer value. |
| 405 |
LDFLAGS="$OLD_LDFLAGS -Wl,$flag" |
LDFLAGS="$OLD_LDFLAGS -Wl,$flag" |
| 406 |
# We try to run the linker with this new ld flag. If the link fails, |
# We try to run the linker with this new ld flag. If the link fails, |
| 407 |
# we give up and remove the new flag from LDFLAGS. |
# we give up and remove the new flag from LDFLAGS. |
| 408 |
AC_LINK_IFELSE(AC_LANG_PROGRAM([namespace pcrecpp { |
AC_LINK_IFELSE([AC_LANG_PROGRAM([namespace pcrecpp { |
| 409 |
class RE { static int no_arg; }; |
class RE { static int no_arg; }; |
| 410 |
int RE::no_arg; |
int RE::no_arg; |
| 411 |
}], |
}], |
| 412 |
[]), |
[])], |
| 413 |
[AC_MSG_RESULT([yes]); |
[AC_MSG_RESULT([yes]); |
| 414 |
EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS -Wl,$flag"; |
EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS -Wl,$flag"; |
| 415 |
break;], |
break;], |
| 427 |
AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"], |
AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"], |
| 428 |
[pcre_have_type_traits="0"]) |
[pcre_have_type_traits="0"]) |
| 429 |
|
|
| 430 |
|
# (This isn't c++-specific, but is only used in pcrecpp.cc, so try this |
| 431 |
|
# in a c++ context. This matters becuase strtoimax is C99 and may not |
| 432 |
|
# be supported by the C++ compiler.) |
| 433 |
|
# Figure out how to create a longlong from a string: strtoll and |
| 434 |
|
# equiv. It's not enough to call AC_CHECK_FUNCS: hpux has a |
| 435 |
|
# strtoll, for instance, but it only takes 2 args instead of 3! |
| 436 |
|
# We have to call AH_TEMPLATE since AC_DEFINE_UNQUOTED below is complex. |
| 437 |
|
AH_TEMPLATE(HAVE_STRTOQ, [Define to 1 if you have `strtoq'.]) |
| 438 |
|
AH_TEMPLATE(HAVE_STRTOLL, [Define to 1 if you have `strtoll'.]) |
| 439 |
|
AH_TEMPLATE(HAVE__STRTOI64, [Define to 1 if you have `_strtoi64'.]) |
| 440 |
|
AH_TEMPLATE(HAVE_STRTOIMAX, [Define to 1 if you have `strtoimax'.]) |
| 441 |
|
have_strto_fn=0 |
| 442 |
|
for fn in strtoq strtoll _strtoi64 strtoimax; do |
| 443 |
|
AC_MSG_CHECKING([for $fn]) |
| 444 |
|
if test "$fn" = strtoimax; then |
| 445 |
|
include=stdint.h |
| 446 |
|
else |
| 447 |
|
include=stdlib.h |
| 448 |
|
fi |
| 449 |
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <$include>], |
| 450 |
|
[char* e; return $fn("100", &e, 10)])], |
| 451 |
|
[AC_MSG_RESULT(yes) |
| 452 |
|
AC_DEFINE_UNQUOTED(HAVE_`echo $fn | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`, 1, |
| 453 |
|
[Define to 1 if you have `$fn'.]) |
| 454 |
|
have_strto_fn=1 |
| 455 |
|
break], |
| 456 |
|
[AC_MSG_RESULT(no)]) |
| 457 |
|
done |
| 458 |
|
|
| 459 |
|
if test "$have_strto_fn" = 1; then |
| 460 |
|
AC_CHECK_TYPES([long long], |
| 461 |
|
[pcre_have_long_long="1"], |
| 462 |
|
[pcre_have_long_long="0"]) |
| 463 |
|
AC_CHECK_TYPES([unsigned long long], |
| 464 |
|
[pcre_have_ulong_long="1"], |
| 465 |
|
[pcre_have_ulong_long="0"]) |
| 466 |
|
else |
| 467 |
|
pcre_have_long_long="0" |
| 468 |
|
pcre_have_ulong_long="0" |
| 469 |
|
fi |
| 470 |
|
AC_SUBST(pcre_have_long_long) |
| 471 |
|
AC_SUBST(pcre_have_ulong_long) |
| 472 |
|
|
| 473 |
AC_LANG_POP |
AC_LANG_POP |
| 474 |
fi |
fi |
| 475 |
# Using AC_SUBST eliminates the need to include config.h in a public .h file |
# Using AC_SUBST eliminates the need to include config.h in a public .h file |
| 477 |
AC_SUBST(pcre_have_bits_type_traits) |
AC_SUBST(pcre_have_bits_type_traits) |
| 478 |
|
|
| 479 |
# Conditional compilation |
# Conditional compilation |
| 480 |
|
AM_CONDITIONAL(WITH_PCRE8, test "x$enable_pcre8" = "xyes") |
| 481 |
|
AM_CONDITIONAL(WITH_PCRE16, test "x$enable_pcre16" = "xyes") |
| 482 |
AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes") |
AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes") |
| 483 |
AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes") |
AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes") |
| 484 |
|
AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes") |
| 485 |
|
AM_CONDITIONAL(WITH_UTF, test "x$enable_utf" = "xyes") |
| 486 |
|
|
| 487 |
# Checks for typedefs, structures, and compiler characteristics. |
# Checks for typedefs, structures, and compiler characteristics. |
| 488 |
|
|
| 489 |
AC_C_CONST |
AC_C_CONST |
| 490 |
AC_TYPE_SIZE_T |
AC_TYPE_SIZE_T |
| 491 |
|
|
|
pcre_have_strotolonglong=0 |
|
|
AC_CHECK_FUNCS(strtoq strtoll _strtoi64, [pcre_have_strotolonglong="1"; break]) |
|
|
# If we can't convert a string to a long long, pretend we don't even |
|
|
# have a long long. |
|
|
if test $pcre_have_strotolonglong = "0"; then |
|
|
pcre_have_long_long="0" |
|
|
pcre_have_ulong_long="0" |
|
|
else |
|
|
AC_CHECK_TYPES([long long], |
|
|
[pcre_have_long_long="1"], |
|
|
[pcre_have_long_long="0"]) |
|
|
AC_CHECK_TYPES([unsigned long long], |
|
|
[pcre_have_ulong_long="1"], |
|
|
[pcre_have_ulong_long="0"]) |
|
|
fi |
|
|
AC_SUBST(pcre_have_long_long) |
|
|
AC_SUBST(pcre_have_ulong_long) |
|
|
|
|
| 492 |
# Checks for library functions. |
# Checks for library functions. |
| 493 |
|
|
| 494 |
AC_CHECK_FUNCS(bcopy memmove strerror) |
AC_CHECK_FUNCS(bcopy memmove strerror) |
| 498 |
AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1]) |
AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1]) |
| 499 |
AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1]) |
AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1]) |
| 500 |
|
|
| 501 |
# Check for the availability of libbz2 |
# Check for the availability of libbz2. Originally we just used AC_CHECK_LIB, |
| 502 |
|
# as for libz. However, this had the following problem, diagnosed and fixed by |
| 503 |
|
# a user: |
| 504 |
|
# |
| 505 |
|
# - libbz2 uses the Pascal calling convention (WINAPI) for the functions |
| 506 |
|
# under Win32. |
| 507 |
|
# - The standard autoconf AC_CHECK_LIB fails to include "bzlib.h", |
| 508 |
|
# therefore missing the function definition. |
| 509 |
|
# - The compiler thus generates a "C" signature for the test function. |
| 510 |
|
# - The linker fails to find the "C" function. |
| 511 |
|
# - PCRE fails to configure if asked to do so against libbz2. |
| 512 |
|
# |
| 513 |
|
# Solution: |
| 514 |
|
# |
| 515 |
|
# - Replace the AC_CHECK_LIB test with a custom test. |
| 516 |
|
|
| 517 |
AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1]) |
AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1]) |
| 518 |
AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1]) |
# Original test |
| 519 |
|
# AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1]) |
| 520 |
|
# |
| 521 |
|
# Custom test follows |
| 522 |
|
|
| 523 |
|
AC_MSG_CHECKING([for libbz2]) |
| 524 |
|
OLD_LIBS="$LIBS" |
| 525 |
|
LIBS="$LIBS -lbz2" |
| 526 |
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 527 |
|
#ifdef HAVE_BZLIB_H |
| 528 |
|
#include <bzlib.h> |
| 529 |
|
#endif]], |
| 530 |
|
[[return (int)BZ2_bzopen("conftest", "rb");]])], |
| 531 |
|
[AC_MSG_RESULT([yes]);HAVE_LIBBZ2=1; break;], |
| 532 |
|
AC_MSG_RESULT([no])) |
| 533 |
|
LIBS="$OLD_LIBS" |
| 534 |
|
|
| 535 |
# Check for the availabiity of libreadline |
# Check for the availabiity of libreadline |
| 536 |
|
|
| 537 |
AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1]) |
AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1]) |
| 538 |
AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1]) |
AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1]) |
| 539 |
AC_CHECK_LIB([readline], [readline], [HAVE_LIB_READLINE=1]) |
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lreadline"], |
| 540 |
|
[unset ac_cv_lib_readline_readline; |
| 541 |
|
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltinfo"], |
| 542 |
|
[unset ac_cv_lib_readline_readline; |
| 543 |
|
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lcurses"], |
| 544 |
|
[unset ac_cv_lib_readline_readline; |
| 545 |
|
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"], |
| 546 |
|
[unset ac_cv_lib_readline_readline; |
| 547 |
|
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"], |
| 548 |
|
[unset ac_cv_lib_readline_readline; |
| 549 |
|
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"], |
| 550 |
|
[LIBREADLINE=""], |
| 551 |
|
[-ltermcap])], |
| 552 |
|
[-lncursesw])], |
| 553 |
|
[-lncurses])], |
| 554 |
|
[-lcurses])], |
| 555 |
|
[-ltinfo])]) |
| 556 |
|
AC_SUBST(LIBREADLINE) |
| 557 |
|
if test -n "$LIBREADLINE"; then |
| 558 |
|
if test "$LIBREADLINE" != "-lreadline"; then |
| 559 |
|
echo "-lreadline needs $LIBREADLINE" |
| 560 |
|
LIBREADLINE="-lreadline $LIBREADLINE" |
| 561 |
|
fi |
| 562 |
|
fi |
| 563 |
|
|
| 564 |
# This facilitates -ansi builds under Linux |
# This facilitates -ansi builds under Linux |
| 565 |
dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc]) |
dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc]) |
| 566 |
|
|
| 567 |
|
PCRE_STATIC_CFLAG="" |
| 568 |
if test "x$enable_shared" = "xno" ; then |
if test "x$enable_shared" = "xno" ; then |
| 569 |
AC_DEFINE([PCRE_STATIC], [1], [ |
AC_DEFINE([PCRE_STATIC], [1], [ |
| 570 |
Define if linking statically (TODO: make nice with Libtool)]) |
Define if linking statically (TODO: make nice with Libtool)]) |
| 571 |
|
PCRE_STATIC_CFLAG="-DPCRE_STATIC" |
| 572 |
fi |
fi |
| 573 |
|
AC_SUBST(PCRE_STATIC_CFLAG) |
| 574 |
|
|
| 575 |
# Here is where pcre specific defines are handled |
# Here is where pcre specific defines are handled |
| 576 |
|
|
| 577 |
if test "$enable_utf8" = "yes"; then |
if test "$enable_pcre8" = "yes"; then |
| 578 |
AC_DEFINE([SUPPORT_UTF8], [], [ |
AC_DEFINE([SUPPORT_PCRE8], [], [ |
| 579 |
Define to enable support for the UTF-8 Unicode encoding.]) |
Define to enable the 8 bit PCRE library.]) |
| 580 |
|
fi |
| 581 |
|
|
| 582 |
|
if test "$enable_pcre16" = "yes"; then |
| 583 |
|
AC_DEFINE([SUPPORT_PCRE16], [], [ |
| 584 |
|
Define to enable the 16 bit PCRE library.]) |
| 585 |
|
fi |
| 586 |
|
|
| 587 |
|
if test "$enable_jit" = "yes"; then |
| 588 |
|
AC_DEFINE([SUPPORT_JIT], [], [ |
| 589 |
|
Define to enable support for Just-In-Time compiling.]) |
| 590 |
|
else |
| 591 |
|
enable_pcregrep_jit="no" |
| 592 |
|
fi |
| 593 |
|
|
| 594 |
|
if test "$enable_pcregrep_jit" = "yes"; then |
| 595 |
|
AC_DEFINE([SUPPORT_PCREGREP_JIT], [], [ |
| 596 |
|
Define to enable JIT support in pcregrep.]) |
| 597 |
|
fi |
| 598 |
|
|
| 599 |
|
if test "$enable_utf" = "yes"; then |
| 600 |
|
AC_DEFINE([SUPPORT_UTF], [], [ |
| 601 |
|
Define to enable support for the UTF-8/16 Unicode encoding. This |
| 602 |
|
will work even in an EBCDIC environment, but it is incompatible |
| 603 |
|
with the EBCDIC macro. That is, PCRE can support *either* EBCDIC |
| 604 |
|
code *or* ASCII/UTF-8/16, but not both at once.]) |
| 605 |
fi |
fi |
| 606 |
|
|
| 607 |
if test "$enable_unicode_properties" = "yes"; then |
if test "$enable_unicode_properties" = "yes"; then |
| 608 |
AC_DEFINE([SUPPORT_UCP], [], [ |
AC_DEFINE([SUPPORT_UCP], [], [ |
| 609 |
Define to enable support for Unicode properties]) |
Define to enable support for Unicode properties.]) |
| 610 |
fi |
fi |
| 611 |
|
|
| 612 |
if test "$enable_stack_for_recursion" = "no"; then |
if test "$enable_stack_for_recursion" = "no"; then |
| 634 |
able to handle .bz2 files.]) |
able to handle .bz2 files.]) |
| 635 |
fi |
fi |
| 636 |
|
|
| 637 |
|
if test $with_pcregrep_bufsize -lt 8192 ; then |
| 638 |
|
with_pcregrep_bufsize="8192" |
| 639 |
|
fi |
| 640 |
|
|
| 641 |
|
AC_DEFINE_UNQUOTED([PCREGREP_BUFSIZE], [$with_pcregrep_bufsize], [ |
| 642 |
|
The value of PCREGREP_BUFSIZE determines the size of buffer used by |
| 643 |
|
pcregrep to hold parts of the file it is searching. On systems that |
| 644 |
|
support it, "configure" can be used to override the default, which is |
| 645 |
|
8192. This is also the minimum value. The actual amount of memory used by |
| 646 |
|
pcregrep is three times this number, because it allows for the buffering of |
| 647 |
|
"before" and "after" lines.]) |
| 648 |
|
|
| 649 |
if test "$enable_pcretest_libreadline" = "yes"; then |
if test "$enable_pcretest_libreadline" = "yes"; then |
| 650 |
AC_DEFINE([SUPPORT_LIBREADLINE], [], [ |
AC_DEFINE([SUPPORT_LIBREADLINE], [], [ |
| 651 |
Define to allow pcretest to be linked with libreadline.]) |
Define to allow pcretest to be linked with libreadline.]) |
| 734 |
AC_DEFINE_UNQUOTED([EBCDIC], [], [ |
AC_DEFINE_UNQUOTED([EBCDIC], [], [ |
| 735 |
If you are compiling for a system that uses EBCDIC instead of ASCII |
If you are compiling for a system that uses EBCDIC instead of ASCII |
| 736 |
character codes, define this macro as 1. On systems that can use |
character codes, define this macro as 1. On systems that can use |
| 737 |
"configure", this can be done via --enable-ebcdic.]) |
"configure", this can be done via --enable-ebcdic. PCRE will then |
| 738 |
|
assume that all input strings are in EBCDIC. If you do not define |
| 739 |
|
this macro, PCRE will assume input strings are ASCII or UTF-8/16 |
| 740 |
|
Unicode. It is not possible to build a version of PCRE that |
| 741 |
|
supports both EBCDIC and UTF-8/16.]) |
| 742 |
fi |
fi |
| 743 |
|
|
| 744 |
# Platform specific issues |
# Platform specific issues |
| 759 |
EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS \ |
EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS \ |
| 760 |
$NO_UNDEFINED -version-info libpcre_version" |
$NO_UNDEFINED -version-info libpcre_version" |
| 761 |
|
|
| 762 |
|
EXTRA_LIBPCRE16_LDFLAGS="$EXTRA_LIBPCRE16_LDFLAGS \ |
| 763 |
|
$NO_UNDEFINED -version-info libpcre16_version" |
| 764 |
|
|
| 765 |
EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS \ |
EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS \ |
| 766 |
$NO_UNDEFINED -version-info libpcreposix_version" |
$NO_UNDEFINED -version-info libpcreposix_version" |
| 767 |
|
|
| 770 |
$EXPORT_ALL_SYMBOLS" |
$EXPORT_ALL_SYMBOLS" |
| 771 |
|
|
| 772 |
AC_SUBST(EXTRA_LIBPCRE_LDFLAGS) |
AC_SUBST(EXTRA_LIBPCRE_LDFLAGS) |
| 773 |
|
AC_SUBST(EXTRA_LIBPCRE16_LDFLAGS) |
| 774 |
AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS) |
AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS) |
| 775 |
AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS) |
AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS) |
| 776 |
|
|
| 777 |
# When we run 'make distcheck', use these arguments. |
# When we run 'make distcheck', use these arguments. Turning off compiler |
| 778 |
DISTCHECK_CONFIGURE_FLAGS="--enable-cpp --enable-unicode-properties" |
# optimization makes it run faster. |
| 779 |
|
DISTCHECK_CONFIGURE_FLAGS="CFLAGS='' CXXFLAGS='' --enable-pcre16 --enable-jit --enable-cpp --enable-unicode-properties" |
| 780 |
AC_SUBST(DISTCHECK_CONFIGURE_FLAGS) |
AC_SUBST(DISTCHECK_CONFIGURE_FLAGS) |
| 781 |
|
|
| 782 |
# Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is |
# Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is |
| 783 |
# specified, the relevant library is available. If so, add it to LIBS. |
# specified, the relevant library is available. |
| 784 |
|
|
| 785 |
if test "$enable_pcregrep_libz" = "yes"; then |
if test "$enable_pcregrep_libz" = "yes"; then |
| 786 |
if test "$HAVE_ZLIB_H" != "1"; then |
if test "$HAVE_ZLIB_H" != "1"; then |
| 791 |
echo "** Cannot --enable-pcregrep-libz because libz was not found" |
echo "** Cannot --enable-pcregrep-libz because libz was not found" |
| 792 |
exit 1 |
exit 1 |
| 793 |
fi |
fi |
| 794 |
if test "$LIBS" = ""; then LIBS=-lz; else LIBS="$LIBS -lz"; fi |
LIBZ="-lz" |
| 795 |
fi |
fi |
| 796 |
|
AC_SUBST(LIBZ) |
| 797 |
|
|
| 798 |
if test "$enable_pcregrep_libbz2" = "yes"; then |
if test "$enable_pcregrep_libbz2" = "yes"; then |
| 799 |
if test "$HAVE_BZLIB_H" != "1"; then |
if test "$HAVE_BZLIB_H" != "1"; then |
| 804 |
echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found" |
echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found" |
| 805 |
exit 1 |
exit 1 |
| 806 |
fi |
fi |
| 807 |
if test "$LIBS" = ""; then LIBS=-lbz2; else LIBS="$LIBS -lbz2"; fi |
LIBBZ2="-lbz2" |
| 808 |
fi |
fi |
| 809 |
|
AC_SUBST(LIBBZ2) |
| 810 |
|
|
| 811 |
# Similarly for --enable-pcretest-readline |
# Similarly for --enable-pcretest-readline |
| 812 |
|
|
| 819 |
echo "** Cannot --enable-pcretest-readline because readline/history.h was not found." |
echo "** Cannot --enable-pcretest-readline because readline/history.h was not found." |
| 820 |
exit 1 |
exit 1 |
| 821 |
fi |
fi |
| 822 |
if test "$LIBS" = ""; then LIBS=-lreadline; else LIBS="$LIBS -lreadline"; fi |
if test -z "$LIBREADLINE"; then |
| 823 |
|
echo "** Cannot --enable-pcretest-readline because readline library was not found." |
| 824 |
|
exit 1 |
| 825 |
|
fi |
| 826 |
fi |
fi |
| 827 |
|
|
| 828 |
# Produce these files, in addition to config.h. |
# Produce these files, in addition to config.h. |
| 829 |
AC_CONFIG_FILES( |
AC_CONFIG_FILES( |
| 830 |
Makefile |
Makefile |
| 831 |
libpcre.pc |
libpcre.pc |
| 832 |
|
libpcre16.pc |
| 833 |
|
libpcreposix.pc |
| 834 |
libpcrecpp.pc |
libpcrecpp.pc |
| 835 |
pcre-config |
pcre-config |
| 836 |
pcre.h |
pcre.h |
| 866 |
Linker flags .................... : ${LDFLAGS} |
Linker flags .................... : ${LDFLAGS} |
| 867 |
Extra libraries ................. : ${LIBS} |
Extra libraries ................. : ${LIBS} |
| 868 |
|
|
| 869 |
|
Build 8 bit pcre library ........ : ${enable_pcre8} |
| 870 |
|
Build 16 bit pcre library ....... : ${enable_pcre16} |
| 871 |
Build C++ library ............... : ${enable_cpp} |
Build C++ library ............... : ${enable_cpp} |
| 872 |
Enable UTF-8 support ............ : ${enable_utf8} |
Enable JIT compiling support .... : ${enable_jit} |
| 873 |
|
Enable UTF-8/16 support ......... : ${enable_utf} |
| 874 |
Unicode properties .............. : ${enable_unicode_properties} |
Unicode properties .............. : ${enable_unicode_properties} |
| 875 |
Newline char/sequence ........... : ${enable_newline} |
Newline char/sequence ........... : ${enable_newline} |
| 876 |
\R matches only ANYCRLF ......... : ${enable_bsr_anycrlf} |
\R matches only ANYCRLF ......... : ${enable_bsr_anycrlf} |
| 883 |
Match limit recursion ........... : ${with_match_limit_recursion} |
Match limit recursion ........... : ${with_match_limit_recursion} |
| 884 |
Build shared libs ............... : ${enable_shared} |
Build shared libs ............... : ${enable_shared} |
| 885 |
Build static libs ............... : ${enable_static} |
Build static libs ............... : ${enable_static} |
| 886 |
|
Use JIT in pcregrep ............. : ${enable_pcregrep_jit} |
| 887 |
|
Buffer size for pcregrep ........ : ${with_pcregrep_bufsize} |
| 888 |
Link pcregrep with libz ......... : ${enable_pcregrep_libz} |
Link pcregrep with libz ......... : ${enable_pcregrep_libz} |
| 889 |
Link pcregrep with libbz2 ....... : ${enable_pcregrep_libbz2} |
Link pcregrep with libbz2 ....... : ${enable_pcregrep_libbz2} |
| 890 |
Link pcretest with libreadline .. : ${enable_pcretest_libreadline} |
Link pcretest with libreadline .. : ${enable_pcretest_libreadline} |