Blame configure.ac

Packit 78a954
dnl Process this file with autoconf to produce a configure script.
Packit 78a954
Packit 78a954
dnl NOTE FOR MAINTAINERS: Do not use minor version numbers 08 or 09 because
Packit 78a954
dnl the leading zeros may cause them to be treated as invalid octal constants
Packit 78a954
dnl if a PCRE user writes code that uses PCRE_MINOR as a number. There is now
Packit 78a954
dnl a check further down that throws an error if 08 or 09 are used.
Packit 78a954
Packit 78a954
dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might
Packit 78a954
dnl be defined as -RC2, for example. For real releases, it should be empty.
Packit 78a954
Packit 78a954
m4_define(pcre_major, [8])
Packit 78a954
m4_define(pcre_minor, [38])
Packit 78a954
m4_define(pcre_prerelease, [])
Packit 78a954
m4_define(pcre_date, [2015-11-23])
Packit 78a954
Packit 78a954
# NOTE: The CMakeLists.txt file searches for the above variables in the first
Packit 78a954
# 50 lines of this file. Please update that if the variables above are moved.
Packit 78a954
Packit 78a954
# Libtool shared library interface versions (current:revision:age)
Packit 78a954
m4_define(libpcre_version, [3:6:2])
Packit 78a954
m4_define(libpcre16_version, [2:6:2])
Packit 78a954
m4_define(libpcre32_version, [0:6:0])
Packit 78a954
m4_define(libpcreposix_version, [0:3:0])
Packit 78a954
m4_define(libpcrecpp_version, [0:1:0])
Packit 78a954
Packit 78a954
AC_PREREQ(2.57)
Packit 78a954
AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre)
Packit 78a954
AC_CONFIG_SRCDIR([pcre.h.in])
Packit 78a954
AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
Packit 78a954
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Packit 78a954
AC_CONFIG_HEADERS(config.h)
Packit 78a954
Packit 78a954
# This is a new thing required to stop a warning from automake 1.12
Packit 78a954
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Packit 78a954
Packit 78a954
# This was added at the suggestion of libtoolize (03-Jan-10)
Packit 78a954
AC_CONFIG_MACRO_DIR([m4])
Packit 78a954
Packit 78a954
# The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just
Packit 78a954
# "-g" for any other compiler. There doesn't seem to be a standard way of
Packit 78a954
# getting rid of the -g (which I don't think is needed for a production
Packit 78a954
# library). This fudge seems to achieve the necessary. First, we remember the
Packit 78a954
# externally set values of CFLAGS and CXXFLAGS. Then call the AC_PROG_CC and
Packit 78a954
# AC_PROG_CXX macros to find the compilers - if CFLAGS and CXXFLAGS are not
Packit 78a954
# set, they will be set to Autoconf's defaults. Afterwards, if the original
Packit 78a954
# values were not set, remove the -g from the Autoconf defaults.
Packit 78a954
# (PH 02-May-07)
Packit 78a954
Packit 78a954
remember_set_CFLAGS="$CFLAGS"
Packit 78a954
remember_set_CXXFLAGS="$CXXFLAGS"
Packit 78a954
Packit 78a954
AC_PROG_CC
Packit 78a954
AC_PROG_CXX
Packit 78a954
AM_PROG_CC_C_O
Packit 78a954
Packit 78a954
if test "x$remember_set_CFLAGS" = "x"
Packit 78a954
then
Packit 78a954
  if test "$CFLAGS" = "-g -O2"
Packit 78a954
  then
Packit 78a954
    CFLAGS="-O2"
Packit 78a954
  elif test "$CFLAGS" = "-g"
Packit 78a954
  then
Packit 78a954
    CFLAGS=""
Packit 78a954
  fi
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "x$remember_set_CXXFLAGS" = "x"
Packit 78a954
then
Packit 78a954
  if test "$CXXFLAGS" = "-g -O2"
Packit 78a954
  then
Packit 78a954
    CXXFLAGS="-O2"
Packit 78a954
  elif test "$CXXFLAGS" = "-g"
Packit 78a954
  then
Packit 78a954
    CXXFLAGS=""
Packit 78a954
  fi
Packit 78a954
fi
Packit 78a954
Packit 78a954
# AC_PROG_CXX will return "g++" even if no c++ compiler is installed.
Packit 78a954
# Check for that case, and just disable c++ code if g++ doesn't run.
Packit 78a954
AC_LANG_PUSH(C++)
Packit 78a954
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],, CXX=""; CXXCP=""; CXXFLAGS="")
Packit 78a954
AC_LANG_POP
Packit 78a954
Packit 78a954
# Check for a 64-bit integer type
Packit 78a954
AC_TYPE_INT64_T
Packit 78a954
Packit 78a954
AC_PROG_INSTALL
Packit 78a954
AC_LIBTOOL_WIN32_DLL
Packit 78a954
LT_INIT
Packit 78a954
AC_PROG_LN_S
Packit 78a954
Packit 78a954
# Check for GCC visibility feature
Packit 78a954
Packit 78a954
PCRE_VISIBILITY
Packit 78a954
Packit 78a954
# Versioning
Packit 78a954
Packit 78a954
PCRE_MAJOR="pcre_major"
Packit 78a954
PCRE_MINOR="pcre_minor"
Packit 78a954
PCRE_PRERELEASE="pcre_prerelease"
Packit 78a954
PCRE_DATE="pcre_date"
Packit 78a954
Packit 78a954
if test "$PCRE_MINOR" = "08" -o "$PCRE_MINOR" = "09"
Packit 78a954
then
Packit 78a954
  echo "***"
Packit 78a954
  echo "*** Minor version number $PCRE_MINOR must not be used. ***"
Packit 78a954
  echo "*** Use only 01 to 07 or 10 onwards, to avoid octal issues. ***"
Packit 78a954
  echo "***"
Packit 78a954
  exit 1
Packit 78a954
fi
Packit 78a954
Packit 78a954
AC_SUBST(PCRE_MAJOR)
Packit 78a954
AC_SUBST(PCRE_MINOR)
Packit 78a954
AC_SUBST(PCRE_PRERELEASE)
Packit 78a954
AC_SUBST(PCRE_DATE)
Packit 78a954
Packit 78a954
# Set a more sensible default value for $(htmldir).
Packit 78a954
if test "x$htmldir" = 'x${docdir}'
Packit 78a954
then
Packit 78a954
  htmldir='${docdir}/html'
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Handle --disable-pcre8 (enabled by default)
Packit 78a954
AC_ARG_ENABLE(pcre8,
Packit 78a954
              AS_HELP_STRING([--disable-pcre8],
Packit 78a954
                             [disable 8 bit character support]),
Packit 78a954
              , enable_pcre8=unset)
Packit 78a954
AC_SUBST(enable_pcre8)
Packit 78a954
Packit 78a954
# Handle --enable-pcre16 (disabled by default)
Packit 78a954
AC_ARG_ENABLE(pcre16,
Packit 78a954
              AS_HELP_STRING([--enable-pcre16],
Packit 78a954
                             [enable 16 bit character support]),
Packit 78a954
              , enable_pcre16=unset)
Packit 78a954
AC_SUBST(enable_pcre16)
Packit 78a954
Packit 78a954
# Handle --enable-pcre32 (disabled by default)
Packit 78a954
AC_ARG_ENABLE(pcre32,
Packit 78a954
              AS_HELP_STRING([--enable-pcre32],
Packit 78a954
                             [enable 32 bit character support]),
Packit 78a954
              , enable_pcre32=unset)
Packit 78a954
AC_SUBST(enable_pcre32)
Packit 78a954
Packit 78a954
# Handle --disable-cpp. The substitution of enable_cpp is needed for use in
Packit 78a954
# pcre-config.
Packit 78a954
AC_ARG_ENABLE(cpp,
Packit 78a954
              AS_HELP_STRING([--disable-cpp],
Packit 78a954
                             [disable C++ support]),
Packit 78a954
              , enable_cpp=unset)
Packit 78a954
AC_SUBST(enable_cpp)
Packit 78a954
Packit 78a954
# Handle --enable-jit (disabled by default)
Packit 78a954
AC_ARG_ENABLE(jit,
Packit 78a954
              AS_HELP_STRING([--enable-jit],
Packit 78a954
                             [enable Just-In-Time compiling support]),
Packit 78a954
              , enable_jit=no)
Packit 78a954
Packit 78a954
# Handle --disable-pcregrep-jit (enabled by default)
Packit 78a954
AC_ARG_ENABLE(pcregrep-jit,
Packit 78a954
              AS_HELP_STRING([--disable-pcregrep-jit],
Packit 78a954
                             [disable JIT support in pcregrep]),
Packit 78a954
              , enable_pcregrep_jit=yes)
Packit 78a954
Packit 78a954
# Handle --enable-rebuild-chartables
Packit 78a954
AC_ARG_ENABLE(rebuild-chartables,
Packit 78a954
              AS_HELP_STRING([--enable-rebuild-chartables],
Packit 78a954
                             [rebuild character tables in current locale]),
Packit 78a954
              , enable_rebuild_chartables=no)
Packit 78a954
Packit 78a954
# Handle --enable-utf8 (disabled by default)
Packit 78a954
AC_ARG_ENABLE(utf8,
Packit 78a954
              AS_HELP_STRING([--enable-utf8],
Packit 78a954
                             [another name for --enable-utf. Kept only for compatibility reasons]),
Packit 78a954
              , enable_utf8=unset)
Packit 78a954
Packit 78a954
# Handle --enable-utf (disabled by default)
Packit 78a954
AC_ARG_ENABLE(utf,
Packit 78a954
              AS_HELP_STRING([--enable-utf],
Packit 78a954
                             [enable UTF-8/16/32 support (incompatible with --enable-ebcdic)]),
Packit 78a954
              , enable_utf=unset)
Packit 78a954
Packit 78a954
# Handle --enable-unicode-properties
Packit 78a954
AC_ARG_ENABLE(unicode-properties,
Packit 78a954
              AS_HELP_STRING([--enable-unicode-properties],
Packit 78a954
                             [enable Unicode properties support (implies --enable-utf)]),
Packit 78a954
              , enable_unicode_properties=no)
Packit 78a954
Packit 78a954
# Handle newline options
Packit 78a954
ac_pcre_newline=lf
Packit 78a954
AC_ARG_ENABLE(newline-is-cr,
Packit 78a954
              AS_HELP_STRING([--enable-newline-is-cr],
Packit 78a954
                             [use CR as newline character]),
Packit 78a954
              ac_pcre_newline=cr)
Packit 78a954
AC_ARG_ENABLE(newline-is-lf,
Packit 78a954
              AS_HELP_STRING([--enable-newline-is-lf],
Packit 78a954
                             [use LF as newline character (default)]),
Packit 78a954
              ac_pcre_newline=lf)
Packit 78a954
AC_ARG_ENABLE(newline-is-crlf,
Packit 78a954
              AS_HELP_STRING([--enable-newline-is-crlf],
Packit 78a954
                             [use CRLF as newline sequence]),
Packit 78a954
              ac_pcre_newline=crlf)
Packit 78a954
AC_ARG_ENABLE(newline-is-anycrlf,
Packit 78a954
              AS_HELP_STRING([--enable-newline-is-anycrlf],
Packit 78a954
                             [use CR, LF, or CRLF as newline sequence]),
Packit 78a954
              ac_pcre_newline=anycrlf)
Packit 78a954
AC_ARG_ENABLE(newline-is-any,
Packit 78a954
              AS_HELP_STRING([--enable-newline-is-any],
Packit 78a954
                             [use any valid Unicode newline sequence]),
Packit 78a954
              ac_pcre_newline=any)
Packit 78a954
enable_newline="$ac_pcre_newline"
Packit 78a954
Packit 78a954
# Handle --enable-bsr-anycrlf
Packit 78a954
AC_ARG_ENABLE(bsr-anycrlf,
Packit 78a954
              AS_HELP_STRING([--enable-bsr-anycrlf],
Packit 78a954
                             [\R matches only CR, LF, CRLF by default]),
Packit 78a954
              , enable_bsr_anycrlf=no)
Packit 78a954
Packit 78a954
# Handle --enable-ebcdic
Packit 78a954
AC_ARG_ENABLE(ebcdic,
Packit 78a954
              AS_HELP_STRING([--enable-ebcdic],
Packit 78a954
                             [assume EBCDIC coding rather than ASCII; incompatible with --enable-utf; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]),
Packit 78a954
              , enable_ebcdic=no)
Packit 78a954
Packit 78a954
# Handle --enable-ebcdic-nl25
Packit 78a954
AC_ARG_ENABLE(ebcdic-nl25,
Packit 78a954
              AS_HELP_STRING([--enable-ebcdic-nl25],
Packit 78a954
                             [set EBCDIC code for NL to 0x25 instead of 0x15; it implies --enable-ebcdic]),
Packit 78a954
              , enable_ebcdic_nl25=no)
Packit 78a954
Packit 78a954
# Handle --disable-stack-for-recursion
Packit 78a954
AC_ARG_ENABLE(stack-for-recursion,
Packit 78a954
              AS_HELP_STRING([--disable-stack-for-recursion],
Packit 78a954
                             [don't use stack recursion when matching]),
Packit 78a954
              , enable_stack_for_recursion=yes)
Packit 78a954
Packit 78a954
# Handle --enable-pcregrep-libz
Packit 78a954
AC_ARG_ENABLE(pcregrep-libz,
Packit 78a954
              AS_HELP_STRING([--enable-pcregrep-libz],
Packit 78a954
                             [link pcregrep with libz to handle .gz files]),
Packit 78a954
              , enable_pcregrep_libz=no)
Packit 78a954
Packit 78a954
# Handle --enable-pcregrep-libbz2
Packit 78a954
AC_ARG_ENABLE(pcregrep-libbz2,
Packit 78a954
              AS_HELP_STRING([--enable-pcregrep-libbz2],
Packit 78a954
                             [link pcregrep with libbz2 to handle .bz2 files]),
Packit 78a954
              , enable_pcregrep_libbz2=no)
Packit 78a954
Packit 78a954
# Handle --with-pcregrep-bufsize=N
Packit 78a954
AC_ARG_WITH(pcregrep-bufsize,
Packit 78a954
              AS_HELP_STRING([--with-pcregrep-bufsize=N],
Packit 78a954
                             [pcregrep buffer size (default=20480, minimum=8192)]),
Packit 78a954
              , with_pcregrep_bufsize=20480)
Packit 78a954
Packit 78a954
# Handle --enable-pcretest-libedit
Packit 78a954
AC_ARG_ENABLE(pcretest-libedit,
Packit 78a954
              AS_HELP_STRING([--enable-pcretest-libedit],
Packit 78a954
                             [link pcretest with libedit]),
Packit 78a954
              , enable_pcretest_libedit=no)
Packit 78a954
Packit 78a954
# Handle --enable-pcretest-libreadline
Packit 78a954
AC_ARG_ENABLE(pcretest-libreadline,
Packit 78a954
              AS_HELP_STRING([--enable-pcretest-libreadline],
Packit 78a954
                             [link pcretest with libreadline]),
Packit 78a954
              , enable_pcretest_libreadline=no)
Packit 78a954
Packit 78a954
# Handle --with-posix-malloc-threshold=NBYTES
Packit 78a954
AC_ARG_WITH(posix-malloc-threshold,
Packit 78a954
            AS_HELP_STRING([--with-posix-malloc-threshold=NBYTES],
Packit 78a954
                           [threshold for POSIX malloc usage (default=10)]),
Packit 78a954
            , with_posix_malloc_threshold=10)
Packit 78a954
Packit 78a954
# Handle --with-link-size=N
Packit 78a954
AC_ARG_WITH(link-size,
Packit 78a954
            AS_HELP_STRING([--with-link-size=N],
Packit 78a954
                           [internal link size (2, 3, or 4 allowed; default=2)]),
Packit 78a954
            , with_link_size=2)
Packit 78a954
Packit 78a954
# Handle --with-parens-nest-limit=N
Packit 78a954
AC_ARG_WITH(parens-nest-limit,
Packit 78a954
            AS_HELP_STRING([--with-parens-nest-limit=N],
Packit 78a954
                           [nested parentheses limit (default=250)]),
Packit 78a954
            , with_parens_nest_limit=250)
Packit 78a954
Packit 78a954
# Handle --with-match-limit=N
Packit 78a954
AC_ARG_WITH(match-limit,
Packit 78a954
            AS_HELP_STRING([--with-match-limit=N],
Packit 78a954
                           [default limit on internal looping (default=10000000)]),
Packit 78a954
            , with_match_limit=10000000)
Packit 78a954
Packit 78a954
# Handle --with-match-limit_recursion=N
Packit 78a954
#
Packit 78a954
# Note: In config.h, the default is to define MATCH_LIMIT_RECURSION
Packit 78a954
# symbolically as MATCH_LIMIT, which in turn is defined to be some numeric
Packit 78a954
# value (e.g. 10000000). MATCH_LIMIT_RECURSION can otherwise be set to some
Packit 78a954
# different numeric value (or even the same numeric value as MATCH_LIMIT,
Packit 78a954
# though no longer defined in terms of the latter).
Packit 78a954
#
Packit 78a954
AC_ARG_WITH(match-limit-recursion,
Packit 78a954
            AS_HELP_STRING([--with-match-limit-recursion=N],
Packit 78a954
                           [default limit on internal recursion (default=MATCH_LIMIT)]),
Packit 78a954
            , with_match_limit_recursion=MATCH_LIMIT)
Packit 78a954
Packit 78a954
# Handle --enable-valgrind
Packit 78a954
AC_ARG_ENABLE(valgrind,
Packit 78a954
              AS_HELP_STRING([--enable-valgrind],
Packit 78a954
                             [valgrind support]),
Packit 78a954
              , enable_valgrind=no)
Packit 78a954
Packit 78a954
# Enable code coverage reports using gcov
Packit 78a954
AC_ARG_ENABLE(coverage,
Packit 78a954
              AS_HELP_STRING([--enable-coverage],
Packit 78a954
                             [enable code coverage reports using gcov]),
Packit 78a954
              , enable_coverage=no)
Packit 78a954
Packit 78a954
# Copy enable_utf8 value to enable_utf for compatibility reasons
Packit 78a954
if test "x$enable_utf8" != "xunset"
Packit 78a954
then
Packit 78a954
  if test "x$enable_utf" != "xunset"
Packit 78a954
  then
Packit 78a954
    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.])
Packit 78a954
  fi
Packit 78a954
  enable_utf=$enable_utf8
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Set the default value for pcre8
Packit 78a954
if test "x$enable_pcre8" = "xunset"
Packit 78a954
then
Packit 78a954
  enable_pcre8=yes
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Set the default value for pcre16
Packit 78a954
if test "x$enable_pcre16" = "xunset"
Packit 78a954
then
Packit 78a954
  enable_pcre16=no
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Set the default value for pcre32
Packit 78a954
if test "x$enable_pcre32" = "xunset"
Packit 78a954
then
Packit 78a954
  enable_pcre32=no
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Make sure enable_pcre8 or enable_pcre16 was set
Packit 78a954
if test "x$enable_pcre8$enable_pcre16$enable_pcre32" = "xnonono"
Packit 78a954
then
Packit 78a954
  AC_MSG_ERROR([At least one of 8, 16 or 32 bit pcre library must be enabled])
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Make sure that if enable_unicode_properties was set, that UTF support is enabled.
Packit 78a954
if test "x$enable_unicode_properties" = "xyes"
Packit 78a954
then
Packit 78a954
  if test "x$enable_utf" = "xno"
Packit 78a954
  then
Packit 78a954
    AC_MSG_ERROR([support for Unicode properties requires UTF-8/16/32 support])
Packit 78a954
  fi
Packit 78a954
  enable_utf=yes
Packit 78a954
fi
Packit 78a954
Packit 78a954
# enable_utf is disabled by default.
Packit 78a954
if test "x$enable_utf" = "xunset"
Packit 78a954
then
Packit 78a954
  enable_utf=no
Packit 78a954
fi
Packit 78a954
Packit 78a954
# enable_cpp copies the value of enable_pcre8 by default
Packit 78a954
if test "x$enable_cpp" = "xunset"
Packit 78a954
then
Packit 78a954
  enable_cpp=$enable_pcre8
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Make sure that if enable_cpp was set, that enable_pcre8 support is enabled
Packit 78a954
if test "x$enable_cpp" = "xyes"
Packit 78a954
then
Packit 78a954
  if test "x$enable_pcre8" = "xno"
Packit 78a954
  then
Packit 78a954
    AC_MSG_ERROR([C++ library requires pcre library with 8 bit characters])
Packit 78a954
  fi
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Convert the newline identifier into the appropriate integer value. The first
Packit 78a954
# three are ASCII values 0x0a, 0x0d, and 0x0d0a, but if EBCDIC is enabled, they
Packit 78a954
# are changed below.
Packit 78a954
Packit 78a954
case "$enable_newline" in
Packit 78a954
  lf)      ac_pcre_newline_value=10   ;;
Packit 78a954
  cr)      ac_pcre_newline_value=13   ;;
Packit 78a954
  crlf)    ac_pcre_newline_value=3338 ;;
Packit 78a954
  anycrlf) ac_pcre_newline_value=-2   ;;
Packit 78a954
  any)     ac_pcre_newline_value=-1   ;;
Packit 78a954
  *)
Packit 78a954
  AC_MSG_ERROR([invalid argument \"$enable_newline\" to --enable-newline option])
Packit 78a954
  ;;
Packit 78a954
esac
Packit 78a954
Packit 78a954
# --enable-ebcdic-nl25 implies --enable-ebcdic
Packit 78a954
if test "x$enable_ebcdic_nl25" = "xyes"; then
Packit 78a954
  enable_ebcdic=yes
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled,
Packit 78a954
# and the newline value is adjusted appropriately (CR is still 13, but LF is
Packit 78a954
# 21 or 37). Also check that UTF support is not requested, because PCRE cannot
Packit 78a954
# handle EBCDIC and UTF in the same build. To do so it would need to use
Packit 78a954
# different character constants depending on the mode.
Packit 78a954
#
Packit 78a954
if test "x$enable_ebcdic" = "xyes"; then
Packit 78a954
  enable_rebuild_chartables=yes
Packit 78a954
Packit 78a954
  if test "x$enable_utf" = "xyes"; then
Packit 78a954
    AC_MSG_ERROR([support for EBCDIC and UTF-8/16/32 cannot be enabled at the same time])
Packit 78a954
  fi
Packit 78a954
Packit 78a954
  if test "x$enable_ebcdic_nl25" = "xno"; then
Packit 78a954
    case "$ac_pcre_newline_value" in
Packit 78a954
      10)   ac_pcre_newline_value=21 ;;
Packit 78a954
      3338) ac_pcre_newline_value=3349 ;;
Packit 78a954
    esac
Packit 78a954
  else
Packit 78a954
    case "$ac_pcre_newline_value" in
Packit 78a954
      10)   ac_pcre_newline_value=37 ;;
Packit 78a954
      3338) ac_pcre_newline_value=3365 ;;
Packit 78a954
    esac
Packit 78a954
  fi
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Check argument to --with-link-size
Packit 78a954
case "$with_link_size" in
Packit 78a954
  2|3|4) ;;
Packit 78a954
  *)
Packit 78a954
  AC_MSG_ERROR([invalid argument \"$with_link_size\" to --with-link-size option])
Packit 78a954
  ;;
Packit 78a954
esac
Packit 78a954
Packit 78a954
AH_TOP([
Packit 78a954
/* PCRE is written in Standard C, but there are a few non-standard things it
Packit 78a954
can cope with, allowing it to run on SunOS4 and other "close to standard"
Packit 78a954
systems.
Packit 78a954
Packit 78a954
In environments that support the GNU autotools, config.h.in is converted into
Packit 78a954
config.h by the "configure" script. In environments that use CMake,
Packit 78a954
config-cmake.in is converted into config.h. If you are going to build PCRE "by
Packit 78a954
hand" without using "configure" or CMake, you should copy the distributed
Packit 78a954
config.h.generic to config.h, and edit the macro definitions to be the way you
Packit 78a954
need them. You must then add -DHAVE_CONFIG_H to all of your compile commands,
Packit 78a954
so that config.h is included at the start of every source.
Packit 78a954
Packit 78a954
Alternatively, you can avoid editing by using -D on the compiler command line
Packit 78a954
to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
Packit 78a954
but if you do, default values will be taken from config.h for non-boolean
Packit 78a954
macros that are not defined on the command line.
Packit 78a954
Packit 78a954
Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE8 should either be defined
Packit 78a954
(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
Packit 78a954
macros are listed as a commented #undef in config.h.generic. Macros such as
Packit 78a954
MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
Packit 78a954
surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
Packit 78a954
Packit 78a954
PCRE uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
Packit 78a954
HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make
Packit 78a954
sure both macros are undefined; an emulation function will then be used. */])
Packit 78a954
Packit 78a954
# Checks for header files.
Packit 78a954
AC_HEADER_STDC
Packit 78a954
AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h)
Packit 78a954
AC_CHECK_HEADERS([windows.h], [HAVE_WINDOWS_H=1])
Packit 78a954
Packit 78a954
# The files below are C++ header files.
Packit 78a954
pcre_have_type_traits="0"
Packit 78a954
pcre_have_bits_type_traits="0"
Packit 78a954
Packit 78a954
if test "x$enable_cpp" = "xyes" -a -z "$CXX"; then
Packit 78a954
   AC_MSG_ERROR([You need a C++ compiler for C++ support.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "x$enable_cpp" = "xyes" -a -n "$CXX"
Packit 78a954
then
Packit 78a954
AC_LANG_PUSH(C++)
Packit 78a954
Packit 78a954
# Older versions of pcre defined pcrecpp::no_arg, but in new versions
Packit 78a954
# it's called pcrecpp::RE::no_arg.  For backwards ABI compatibility,
Packit 78a954
# we want to make one an alias for the other.  Different systems do
Packit 78a954
# this in different ways.  Some systems, for instance, can do it via
Packit 78a954
# a linker flag: -alias (for os x 10.5) or -i (for os x <=10.4).
Packit 78a954
OLD_LDFLAGS="$LDFLAGS"
Packit 78a954
for flag in "-alias,__ZN7pcrecpp2RE6no_argE,__ZN7pcrecpp6no_argE" \
Packit 78a954
            "-i__ZN7pcrecpp6no_argE:__ZN7pcrecpp2RE6no_argE"; do
Packit 78a954
  AC_MSG_CHECKING([for alias support in the linker])
Packit 78a954
  LDFLAGS="$OLD_LDFLAGS -Wl,$flag"
Packit 78a954
  # We try to run the linker with this new ld flag.  If the link fails,
Packit 78a954
  # we give up and remove the new flag from LDFLAGS.
Packit 78a954
  AC_LINK_IFELSE([AC_LANG_PROGRAM([namespace pcrecpp {
Packit 78a954
                                    class RE { static int no_arg; };
Packit 78a954
                                    int RE::no_arg;
Packit 78a954
                                  }],
Packit 78a954
                                 [])],
Packit 78a954
                 [AC_MSG_RESULT([yes]);
Packit 78a954
                  EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS -Wl,$flag";
Packit 78a954
                  break;],
Packit 78a954
                 AC_MSG_RESULT([no]))
Packit 78a954
done
Packit 78a954
LDFLAGS="$OLD_LDFLAGS"
Packit 78a954
Packit 78a954
# We could be more clever here, given we're doing AC_SUBST with this
Packit 78a954
# (eg set a var to be the name of the include file we want). But we're not
Packit 78a954
# so it's easy to change back to 'regular' autoconf vars if we needed to.
Packit 78a954
AC_CHECK_HEADERS(string, [pcre_have_cpp_headers="1"],
Packit 78a954
                         [pcre_have_cpp_headers="0"])
Packit 78a954
AC_CHECK_HEADERS(bits/type_traits.h, [pcre_have_bits_type_traits="1"],
Packit 78a954
                                     [pcre_have_bits_type_traits="0"])
Packit 78a954
AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
Packit 78a954
                                [pcre_have_type_traits="0"])
Packit 78a954
Packit 78a954
# (This isn't c++-specific, but is only used in pcrecpp.cc, so try this
Packit 78a954
# in a c++ context.  This matters becuase strtoimax is C99 and may not
Packit 78a954
# be supported by the C++ compiler.)
Packit 78a954
# Figure out how to create a longlong from a string: strtoll and
Packit 78a954
# equiv.  It's not enough to call AC_CHECK_FUNCS: hpux has a
Packit 78a954
# strtoll, for instance, but it only takes 2 args instead of 3!
Packit 78a954
# We have to call AH_TEMPLATE since AC_DEFINE_UNQUOTED below is complex.
Packit 78a954
AH_TEMPLATE(HAVE_STRTOQ, [Define to 1 if you have `strtoq'.])
Packit 78a954
AH_TEMPLATE(HAVE_STRTOLL, [Define to 1 if you have `strtoll'.])
Packit 78a954
AH_TEMPLATE(HAVE__STRTOI64, [Define to 1 if you have `_strtoi64'.])
Packit 78a954
AH_TEMPLATE(HAVE_STRTOIMAX, [Define to 1 if you have `strtoimax'.])
Packit 78a954
have_strto_fn=0
Packit 78a954
for fn in strtoq strtoll _strtoi64 strtoimax; do
Packit 78a954
  AC_MSG_CHECKING([for $fn])
Packit 78a954
  if test "$fn" = strtoimax; then
Packit 78a954
    include=stdint.h
Packit 78a954
  else
Packit 78a954
    include=stdlib.h
Packit 78a954
  fi
Packit 78a954
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <$include>],
Packit 78a954
                                    [char* e; return $fn("100", &e, 10)])],
Packit 78a954
                    [AC_MSG_RESULT(yes)
Packit 78a954
                     AC_DEFINE_UNQUOTED(HAVE_`echo $fn | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`, 1,
Packit 78a954
                                        [Define to 1 if you have `$fn'.])
Packit 78a954
                     have_strto_fn=1
Packit 78a954
                     break],
Packit 78a954
                    [AC_MSG_RESULT(no)])
Packit 78a954
done
Packit 78a954
Packit 78a954
if test "$have_strto_fn" = 1; then
Packit 78a954
  AC_CHECK_TYPES([long long],
Packit 78a954
                 [pcre_have_long_long="1"],
Packit 78a954
                 [pcre_have_long_long="0"])
Packit 78a954
  AC_CHECK_TYPES([unsigned long long],
Packit 78a954
                 [pcre_have_ulong_long="1"],
Packit 78a954
                 [pcre_have_ulong_long="0"])
Packit 78a954
else
Packit 78a954
  pcre_have_long_long="0"
Packit 78a954
  pcre_have_ulong_long="0"
Packit 78a954
fi
Packit 78a954
AC_SUBST(pcre_have_long_long)
Packit 78a954
AC_SUBST(pcre_have_ulong_long)
Packit 78a954
Packit 78a954
AC_LANG_POP
Packit 78a954
fi
Packit 78a954
# Using AC_SUBST eliminates the need to include config.h in a public .h file
Packit 78a954
AC_SUBST(pcre_have_type_traits)
Packit 78a954
AC_SUBST(pcre_have_bits_type_traits)
Packit 78a954
Packit 78a954
# Conditional compilation
Packit 78a954
AM_CONDITIONAL(WITH_PCRE8, test "x$enable_pcre8" = "xyes")
Packit 78a954
AM_CONDITIONAL(WITH_PCRE16, test "x$enable_pcre16" = "xyes")
Packit 78a954
AM_CONDITIONAL(WITH_PCRE32, test "x$enable_pcre32" = "xyes")
Packit 78a954
AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes")
Packit 78a954
AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes")
Packit 78a954
AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes")
Packit 78a954
AM_CONDITIONAL(WITH_UTF, test "x$enable_utf" = "xyes")
Packit 78a954
AM_CONDITIONAL(WITH_VALGRIND, test "x$enable_valgrind" = "xyes")
Packit 78a954
Packit 78a954
# Checks for typedefs, structures, and compiler characteristics.
Packit 78a954
Packit 78a954
AC_C_CONST
Packit 78a954
AC_TYPE_SIZE_T
Packit 78a954
Packit 78a954
# Checks for library functions.
Packit 78a954
Packit 78a954
AC_CHECK_FUNCS(bcopy memmove strerror)
Packit 78a954
Packit 78a954
# Check for the availability of libz (aka zlib)
Packit 78a954
Packit 78a954
AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1])
Packit 78a954
AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1])
Packit 78a954
Packit 78a954
# Check for the availability of libbz2. Originally we just used AC_CHECK_LIB,
Packit 78a954
# as for libz. However, this had the following problem, diagnosed and fixed by
Packit 78a954
# a user:
Packit 78a954
#
Packit 78a954
#   - libbz2 uses the Pascal calling convention (WINAPI) for the functions
Packit 78a954
#     under Win32.
Packit 78a954
#   - The standard autoconf AC_CHECK_LIB fails to include "bzlib.h",
Packit 78a954
#     therefore missing the function definition.
Packit 78a954
#   - The compiler thus generates a "C" signature for the test function.
Packit 78a954
#   - The linker fails to find the "C" function.
Packit 78a954
#   - PCRE fails to configure if asked to do so against libbz2.
Packit 78a954
#
Packit 78a954
# Solution:
Packit 78a954
#
Packit 78a954
#   - Replace the AC_CHECK_LIB test with a custom test.
Packit 78a954
Packit 78a954
AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1])
Packit 78a954
# Original test
Packit 78a954
# AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1])
Packit 78a954
#
Packit 78a954
# Custom test follows
Packit 78a954
Packit 78a954
AC_MSG_CHECKING([for libbz2])
Packit 78a954
OLD_LIBS="$LIBS"
Packit 78a954
LIBS="$LIBS -lbz2"
Packit 78a954
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Packit 78a954
#ifdef HAVE_BZLIB_H
Packit 78a954
#include <bzlib.h>
Packit 78a954
#endif]],
Packit 78a954
[[return (int)BZ2_bzopen("conftest", "rb");]])],
Packit 78a954
[AC_MSG_RESULT([yes]);HAVE_LIBBZ2=1; break;],
Packit 78a954
AC_MSG_RESULT([no]))
Packit 78a954
LIBS="$OLD_LIBS"
Packit 78a954
Packit 78a954
# Check for the availabiity of libreadline
Packit 78a954
Packit 78a954
if test "$enable_pcretest_libreadline" = "yes"; then
Packit 78a954
 AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1])
Packit 78a954
 AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1])
Packit 78a954
 AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lreadline"],
Packit 78a954
   [unset ac_cv_lib_readline_readline;
Packit 78a954
    AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltinfo"],
Packit 78a954
     [unset ac_cv_lib_readline_readline;
Packit 78a954
      AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lcurses"],
Packit 78a954
       [unset ac_cv_lib_readline_readline;
Packit 78a954
        AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"],
Packit 78a954
         [unset ac_cv_lib_readline_readline;
Packit 78a954
	  AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"],
Packit 78a954
           [unset ac_cv_lib_readline_readline;
Packit 78a954
	    AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"],
Packit 78a954
             [LIBREADLINE=""],
Packit 78a954
             [-ltermcap])],
Packit 78a954
           [-lncursesw])],
Packit 78a954
         [-lncurses])],
Packit 78a954
       [-lcurses])],
Packit 78a954
     [-ltinfo])])
Packit 78a954
 AC_SUBST(LIBREADLINE)
Packit 78a954
 if test -n "$LIBREADLINE"; then
Packit 78a954
   if test "$LIBREADLINE" != "-lreadline"; then
Packit 78a954
     echo "-lreadline needs $LIBREADLINE"
Packit 78a954
     LIBREADLINE="-lreadline $LIBREADLINE"
Packit 78a954
   fi
Packit 78a954
 fi
Packit 78a954
fi
Packit 78a954
Packit 78a954
Packit 78a954
# Check for the availability of libedit. Different distributions put its
Packit 78a954
# headers in different places. Try to cover the most common ones.
Packit 78a954
Packit 78a954
if test "$enable_pcretest_libedit" = "yes"; then
Packit 78a954
  AC_CHECK_HEADERS([editline/readline.h], [HAVE_EDITLINE_READLINE_H=1],
Packit 78a954
    [AC_CHECK_HEADERS([edit/readline/readline.h], [HAVE_READLINE_READLINE_H=1],
Packit 78a954
      [AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_READLINE_H=1])])])
Packit 78a954
  AC_CHECK_LIB([edit], [readline], [LIBEDIT="-ledit"])
Packit 78a954
fi
Packit 78a954
Packit 78a954
# This facilitates -ansi builds under Linux
Packit 78a954
dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc])
Packit 78a954
Packit 78a954
PCRE_STATIC_CFLAG=""
Packit 78a954
if test "x$enable_shared" = "xno" ; then
Packit 78a954
  AC_DEFINE([PCRE_STATIC], [1], [
Packit 78a954
    Define to any value if linking statically (TODO: make nice with Libtool)])
Packit 78a954
  PCRE_STATIC_CFLAG="-DPCRE_STATIC"
Packit 78a954
fi
Packit 78a954
AC_SUBST(PCRE_STATIC_CFLAG)
Packit 78a954
Packit 78a954
# Here is where pcre specific defines are handled
Packit 78a954
Packit 78a954
if test "$enable_pcre8" = "yes"; then
Packit 78a954
  AC_DEFINE([SUPPORT_PCRE8], [], [
Packit 78a954
    Define to any value to enable the 8 bit PCRE library.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_pcre16" = "yes"; then
Packit 78a954
  AC_DEFINE([SUPPORT_PCRE16], [], [
Packit 78a954
    Define to any value to enable the 16 bit PCRE library.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_pcre32" = "yes"; then
Packit 78a954
  AC_DEFINE([SUPPORT_PCRE32], [], [
Packit 78a954
    Define to any value to enable the 32 bit PCRE library.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Unless running under Windows, JIT support requires pthreads.
Packit 78a954
Packit 78a954
if test "$enable_jit" = "yes"; then
Packit 78a954
  if test "$HAVE_WINDOWS_H" != "1"; then
Packit 78a954
    AX_PTHREAD([], [AC_MSG_ERROR([JIT support requires pthreads])])
Packit 78a954
    CC="$PTHREAD_CC"
Packit 78a954
    CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
Packit 78a954
    LIBS="$PTHREAD_LIBS $LIBS"
Packit 78a954
  fi
Packit 78a954
  AC_DEFINE([SUPPORT_JIT], [], [
Packit 78a954
    Define to any value to enable support for Just-In-Time compiling.])
Packit 78a954
else
Packit 78a954
  enable_pcregrep_jit="no"
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_pcregrep_jit" = "yes"; then
Packit 78a954
  AC_DEFINE([SUPPORT_PCREGREP_JIT], [], [
Packit 78a954
    Define to any value to enable JIT support in pcregrep.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_utf" = "yes"; then
Packit 78a954
  AC_DEFINE([SUPPORT_UTF], [], [
Packit 78a954
    Define to any value to enable support for the UTF-8/16/32 Unicode encoding.
Packit 78a954
    This will work even in an EBCDIC environment, but it is incompatible
Packit 78a954
    with the EBCDIC macro. That is, PCRE can support *either* EBCDIC
Packit 78a954
    code *or* ASCII/UTF-8/16/32, but not both at once.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_unicode_properties" = "yes"; then
Packit 78a954
  AC_DEFINE([SUPPORT_UCP], [], [
Packit 78a954
    Define to any value to enable support for Unicode properties.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_stack_for_recursion" = "no"; then
Packit 78a954
  AC_DEFINE([NO_RECURSE], [], [
Packit 78a954
    PCRE uses recursive function calls to handle backtracking while
Packit 78a954
    matching. This can sometimes be a problem on systems that have
Packit 78a954
    stacks of limited size. Define NO_RECURSE to any value to get a
Packit 78a954
    version that doesn't use recursion in the match() function; instead
Packit 78a954
    it creates its own stack by steam using pcre_recurse_malloc() to obtain
Packit 78a954
    memory from the heap. For more detail, see the comments and other stuff
Packit 78a954
    just above the match() function.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_pcregrep_libz" = "yes"; then
Packit 78a954
  AC_DEFINE([SUPPORT_LIBZ], [], [
Packit 78a954
    Define to any value to allow pcregrep to be linked with libz, so that it is
Packit 78a954
    able to handle .gz files.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_pcregrep_libbz2" = "yes"; then
Packit 78a954
  AC_DEFINE([SUPPORT_LIBBZ2], [], [
Packit 78a954
    Define to any value to allow pcregrep to be linked with libbz2, so that it
Packit 78a954
    is able to handle .bz2 files.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test $with_pcregrep_bufsize -lt 8192 ; then
Packit 78a954
  AC_MSG_WARN([$with_pcregrep_bufsize is too small for --with-pcregrep-bufsize; using 8192])
Packit 78a954
  with_pcregrep_bufsize="8192"
Packit 78a954
else
Packit 78a954
  if test $? -gt 1 ; then
Packit 78a954
  AC_MSG_ERROR([Bad value for  --with-pcregrep-bufsize])
Packit 78a954
  fi
Packit 78a954
fi
Packit 78a954
Packit 78a954
AC_DEFINE_UNQUOTED([PCREGREP_BUFSIZE], [$with_pcregrep_bufsize], [
Packit 78a954
  The value of PCREGREP_BUFSIZE determines the size of buffer used by pcregrep
Packit 78a954
  to hold parts of the file it is searching. This is also the minimum value.
Packit 78a954
  The actual amount of memory used by pcregrep is three times this number,
Packit 78a954
  because it allows for the buffering of "before" and "after" lines.])
Packit 78a954
Packit 78a954
if test "$enable_pcretest_libedit" = "yes"; then
Packit 78a954
  AC_DEFINE([SUPPORT_LIBEDIT], [], [
Packit 78a954
    Define to any value to allow pcretest to be linked with libedit.])
Packit 78a954
  LIBREADLINE="$LIBEDIT"
Packit 78a954
elif test "$enable_pcretest_libreadline" = "yes"; then
Packit 78a954
  AC_DEFINE([SUPPORT_LIBREADLINE], [], [
Packit 78a954
    Define to any value to allow pcretest to be linked with libreadline.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline_value], [
Packit 78a954
  The value of NEWLINE determines the default newline character sequence. PCRE
Packit 78a954
  client programs can override this by selecting other values at run time. In
Packit 78a954
  ASCII environments, the value can be 10 (LF), 13 (CR), or 3338 (CRLF); in
Packit 78a954
  EBCDIC environments the value can be 21 or 37 (LF), 13 (CR), or 3349 or 3365
Packit 78a954
  (CRLF) because there are two alternative codepoints (0x15 and 0x25) that are
Packit 78a954
  used as the NL line terminator that is equivalent to ASCII LF. In both ASCII
Packit 78a954
  and EBCDIC environments the value can also be -1 (ANY), or -2 (ANYCRLF).])
Packit 78a954
Packit 78a954
if test "$enable_bsr_anycrlf" = "yes"; then
Packit 78a954
  AC_DEFINE([BSR_ANYCRLF], [], [
Packit 78a954
    By default, the \R escape sequence matches any Unicode line ending
Packit 78a954
    character or sequence of characters. If BSR_ANYCRLF is defined (to any
Packit 78a954
    value), this is changed so that backslash-R matches only CR, LF, or CRLF.
Packit 78a954
    The build-time default can be overridden by the user of PCRE at runtime.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [
Packit 78a954
  The value of LINK_SIZE determines the number of bytes used to store
Packit 78a954
  links as offsets within the compiled regex. The default is 2, which
Packit 78a954
  allows for compiled patterns up to 64K long. This covers the vast
Packit 78a954
  majority of cases. However, PCRE can also be compiled to use 3 or 4
Packit 78a954
  bytes instead. This allows for longer patterns in extreme cases.])
Packit 78a954
Packit 78a954
AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$with_posix_malloc_threshold], [
Packit 78a954
  When calling PCRE via the POSIX interface, additional working storage
Packit 78a954
  is required for holding the pointers to capturing substrings because
Packit 78a954
  PCRE requires three integers per substring, whereas the POSIX
Packit 78a954
  interface provides only two. If the number of expected substrings is
Packit 78a954
  small, the wrapper function uses space on the stack, because this is
Packit 78a954
  faster than using malloc() for each call. The threshold above which
Packit 78a954
  the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD.])
Packit 78a954
Packit 78a954
AC_DEFINE_UNQUOTED([PARENS_NEST_LIMIT], [$with_parens_nest_limit], [
Packit 78a954
  The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
Packit 78a954
  parentheses (of any kind) in a pattern. This limits the amount of system
Packit 78a954
  stack that is used while compiling a pattern.])
Packit 78a954
Packit 78a954
AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [
Packit 78a954
  The value of MATCH_LIMIT determines the default number of times the
Packit 78a954
  internal match() function can be called during a single execution of
Packit 78a954
  pcre_exec(). There is a runtime interface for setting a different
Packit 78a954
  limit. The limit exists in order to catch runaway regular
Packit 78a954
  expressions that take for ever to determine that they do not match.
Packit 78a954
  The default is set very large so that it does not accidentally catch
Packit 78a954
  legitimate cases.])
Packit 78a954
Packit 78a954
AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSION], [$with_match_limit_recursion], [
Packit 78a954
  The above limit applies to all calls of match(), whether or not they
Packit 78a954
  increase the recursion depth. In some environments it is desirable
Packit 78a954
  to limit the depth of recursive calls of match() more strictly, in
Packit 78a954
  order to restrict the maximum amount of stack (or heap, if
Packit 78a954
  NO_RECURSE is defined) that is used. The value of
Packit 78a954
  MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To
Packit 78a954
  have any useful effect, it must be less than the value of
Packit 78a954
  MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT.
Packit 78a954
  There is a runtime method for setting a different limit.])
Packit 78a954
Packit 78a954
AC_DEFINE([MAX_NAME_SIZE], [32], [
Packit 78a954
  This limit is parameterized just in case anybody ever wants to
Packit 78a954
  change it. Care must be taken if it is increased, because it guards
Packit 78a954
  against integer overflow caused by enormously large patterns.])
Packit 78a954
Packit 78a954
AC_DEFINE([MAX_NAME_COUNT], [10000], [
Packit 78a954
  This limit is parameterized just in case anybody ever wants to
Packit 78a954
  change it. Care must be taken if it is increased, because it guards
Packit 78a954
  against integer overflow caused by enormously large patterns.])
Packit 78a954
Packit 78a954
AH_VERBATIM([PCRE_EXP_DEFN], [
Packit 78a954
/* If you are compiling for a system other than a Unix-like system or
Packit 78a954
   Win32, and it needs some magic to be inserted before the definition
Packit 78a954
   of a function that is exported by the library, define this macro to
Packit 78a954
   contain the relevant magic. If you do not define this macro, a suitable
Packit 78a954
    __declspec value is used for Windows systems; in other environments
Packit 78a954
   "extern" is used for a C compiler and "extern C" for a C++ compiler.
Packit 78a954
   This macro apears at the start of every exported function that is part
Packit 78a954
   of the external API. It does not appear on functions that are "external"
Packit 78a954
   in the C sense, but which are internal to the library. */
Packit 78a954
#undef PCRE_EXP_DEFN])
Packit 78a954
Packit 78a954
if test "$enable_ebcdic" = "yes"; then
Packit 78a954
  AC_DEFINE_UNQUOTED([EBCDIC], [], [
Packit 78a954
    If you are compiling for a system that uses EBCDIC instead of ASCII
Packit 78a954
    character codes, define this macro to any value. You must also edit the
Packit 78a954
    NEWLINE macro below to set a suitable EBCDIC newline, commonly 21 (0x15).
Packit 78a954
    On systems that can use "configure" or CMake to set EBCDIC, NEWLINE is
Packit 78a954
    automatically adjusted. When EBCDIC is set, PCRE assumes that all input
Packit 78a954
    strings are in EBCDIC. If you do not define this macro, PCRE will assume
Packit 78a954
    input strings are ASCII or UTF-8/16/32 Unicode. It is not possible to build
Packit 78a954
    a version of PCRE that supports both EBCDIC and UTF-8/16/32.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_ebcdic_nl25" = "yes"; then
Packit 78a954
  AC_DEFINE_UNQUOTED([EBCDIC_NL25], [], [
Packit 78a954
    In an EBCDIC environment, define this macro to any value to arrange for
Packit 78a954
    the NL character to be 0x25 instead of the default 0x15. NL plays the role
Packit 78a954
    that LF does in an ASCII/Unicode environment. The value must also be set in
Packit 78a954
    the NEWLINE macro below. On systems that can use "configure" or CMake to
Packit 78a954
    set EBCDIC_NL25, the adjustment of NEWLINE is automatic.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_valgrind" = "yes"; then
Packit 78a954
  AC_DEFINE_UNQUOTED([SUPPORT_VALGRIND], [], [
Packit 78a954
     Define to any value for valgrind support to find invalid memory reads.])
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Platform specific issues
Packit 78a954
NO_UNDEFINED=
Packit 78a954
EXPORT_ALL_SYMBOLS=
Packit 78a954
case $host_os in
Packit 78a954
  cygwin* | mingw* )
Packit 78a954
    if test X"$enable_shared" = Xyes; then
Packit 78a954
      NO_UNDEFINED="-no-undefined"
Packit 78a954
      EXPORT_ALL_SYMBOLS="-Wl,--export-all-symbols"
Packit 78a954
    fi
Packit 78a954
    ;;
Packit 78a954
esac
Packit 78a954
Packit 78a954
# The extra LDFLAGS for each particular library
Packit 78a954
# (Note: The libpcre*_version bits are m4 variables, assigned above)
Packit 78a954
Packit 78a954
EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS \
Packit 78a954
                       $NO_UNDEFINED -version-info libpcre_version"
Packit 78a954
Packit 78a954
EXTRA_LIBPCRE16_LDFLAGS="$EXTRA_LIBPCRE16_LDFLAGS \
Packit 78a954
                       $NO_UNDEFINED -version-info libpcre16_version"
Packit 78a954
Packit 78a954
EXTRA_LIBPCRE32_LDFLAGS="$EXTRA_LIBPCRE32_LDFLAGS \
Packit 78a954
                       $NO_UNDEFINED -version-info libpcre32_version"
Packit 78a954
Packit 78a954
EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS \
Packit 78a954
                            $NO_UNDEFINED -version-info libpcreposix_version"
Packit 78a954
Packit 78a954
EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS \
Packit 78a954
                          $NO_UNDEFINED -version-info libpcrecpp_version \
Packit 78a954
                          $EXPORT_ALL_SYMBOLS"
Packit 78a954
Packit 78a954
AC_SUBST(EXTRA_LIBPCRE_LDFLAGS)
Packit 78a954
AC_SUBST(EXTRA_LIBPCRE16_LDFLAGS)
Packit 78a954
AC_SUBST(EXTRA_LIBPCRE32_LDFLAGS)
Packit 78a954
AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS)
Packit 78a954
AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS)
Packit 78a954
Packit 78a954
# When we run 'make distcheck', use these arguments. Turning off compiler
Packit 78a954
# optimization makes it run faster.
Packit 78a954
DISTCHECK_CONFIGURE_FLAGS="CFLAGS='' CXXFLAGS='' --enable-pcre16 --enable-pcre32 --enable-jit --enable-cpp --enable-unicode-properties"
Packit 78a954
AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
Packit 78a954
Packit 78a954
# Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is
Packit 78a954
# specified, the relevant library is available.
Packit 78a954
Packit 78a954
if test "$enable_pcregrep_libz" = "yes"; then
Packit 78a954
  if test "$HAVE_ZLIB_H" != "1"; then
Packit 78a954
    echo "** Cannot --enable-pcregrep-libz because zlib.h was not found"
Packit 78a954
    exit 1
Packit 78a954
  fi
Packit 78a954
  if test "$HAVE_LIBZ" != "1"; then
Packit 78a954
    echo "** Cannot --enable-pcregrep-libz because libz was not found"
Packit 78a954
    exit 1
Packit 78a954
  fi
Packit 78a954
  LIBZ="-lz"
Packit 78a954
fi
Packit 78a954
AC_SUBST(LIBZ)
Packit 78a954
Packit 78a954
if test "$enable_pcregrep_libbz2" = "yes"; then
Packit 78a954
  if test "$HAVE_BZLIB_H" != "1"; then
Packit 78a954
    echo "** Cannot --enable-pcregrep-libbz2 because bzlib.h was not found"
Packit 78a954
    exit 1
Packit 78a954
  fi
Packit 78a954
  if test "$HAVE_LIBBZ2" != "1"; then
Packit 78a954
    echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found"
Packit 78a954
    exit 1
Packit 78a954
  fi
Packit 78a954
  LIBBZ2="-lbz2"
Packit 78a954
fi
Packit 78a954
AC_SUBST(LIBBZ2)
Packit 78a954
Packit 78a954
# Similarly for --enable-pcretest-readline
Packit 78a954
Packit 78a954
if test "$enable_pcretest_libedit" = "yes"; then
Packit 78a954
  if test "$enable_pcretest_libreadline" = "yes"; then
Packit 78a954
    echo "** Cannot use both --enable-pcretest-libedit and --enable-pcretest-readline"
Packit 78a954
    exit 1
Packit 78a954
  fi
Packit 78a954
  if test "$HAVE_EDITLINE_READLINE_H" != "1" -a \
Packit 78a954
          "$HAVE_READLINE_READLINE_H" != "1"; then
Packit 78a954
    echo "** Cannot --enable-pcretest-libedit because neither editline/readline.h"
Packit 78a954
    echo "** nor readline/readline.h was found."
Packit 78a954
    exit 1
Packit 78a954
  fi
Packit 78a954
  if test -z "$LIBEDIT"; then
Packit 78a954
    echo "** Cannot --enable-pcretest-libedit because libedit library was not found."
Packit 78a954
    exit 1
Packit 78a954
  fi
Packit 78a954
fi
Packit 78a954
Packit 78a954
if test "$enable_pcretest_libreadline" = "yes"; then
Packit 78a954
  if test "$HAVE_READLINE_H" != "1"; then
Packit 78a954
    echo "** Cannot --enable-pcretest-readline because readline/readline.h was not found."
Packit 78a954
    exit 1
Packit 78a954
  fi
Packit 78a954
  if test "$HAVE_HISTORY_H" != "1"; then
Packit 78a954
    echo "** Cannot --enable-pcretest-readline because readline/history.h was not found."
Packit 78a954
    exit 1
Packit 78a954
  fi
Packit 78a954
  if test -z "$LIBREADLINE"; then
Packit 78a954
    echo "** Cannot --enable-pcretest-readline because readline library was not found."
Packit 78a954
    exit 1
Packit 78a954
  fi
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Handle valgrind support
Packit 78a954
Packit 78a954
if test "$enable_valgrind" = "yes"; then
Packit 78a954
  m4_ifdef([PKG_CHECK_MODULES],
Packit 78a954
           [PKG_CHECK_MODULES([VALGRIND],[valgrind])],
Packit 78a954
           [AC_MSG_ERROR([pkg-config not supported])])
Packit 78a954
fi
Packit 78a954
Packit 78a954
# Handle code coverage reporting support
Packit 78a954
if test "$enable_coverage" = "yes"; then
Packit 78a954
  if test "x$GCC" != "xyes"; then
Packit 78a954
    AC_MSG_ERROR([Code coverage reports can only be generated when using GCC])
Packit 78a954
  fi
Packit 78a954
Packit 78a954
  # ccache is incompatible with gcov
Packit 78a954
  AC_PATH_PROG([SHTOOL],[shtool],[false])
Packit 78a954
  case `$SHTOOL path $CC` in
Packit 78a954
    *ccache*) cc_ccache=yes;;
Packit 78a954
    *) cc_ccache=no;;
Packit 78a954
  esac
Packit 78a954
Packit 78a954
  if test "$cc_ccache" = "yes"; then
Packit 78a954
    if test -z "$CCACHE_DISABLE" -o "$CCACHE_DISABLE" != "1"; then
Packit 78a954
      AC_MSG_ERROR([must export CCACHE_DISABLE=1 to disable ccache for code coverage])
Packit 78a954
    fi
Packit 78a954
  fi
Packit 78a954
Packit 78a954
  AC_ARG_VAR([LCOV],[the ltp lcov program])
Packit 78a954
  AC_PATH_PROG([LCOV],[lcov],[false])
Packit 78a954
  if test "x$LCOV" = "xfalse"; then
Packit 78a954
    AC_MSG_ERROR([lcov not found])
Packit 78a954
  fi
Packit 78a954
Packit 78a954
  AC_ARG_VAR([GENHTML],[the ltp genhtml program])
Packit 78a954
  AC_PATH_PROG([GENHTML],[genhtml],[false])
Packit 78a954
  if test "x$GENHTML" = "xfalse"; then
Packit 78a954
    AC_MSG_ERROR([genhtml not found])
Packit 78a954
  fi
Packit 78a954
Packit 78a954
  # Set flags needed for gcov
Packit 78a954
  GCOV_CFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
Packit 78a954
  GCOV_CXXFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
Packit 78a954
  GCOV_LIBS="-lgcov"
Packit 78a954
  AC_SUBST([GCOV_CFLAGS])
Packit 78a954
  AC_SUBST([GCOV_CXXFLAGS])
Packit 78a954
  AC_SUBST([GCOV_LIBS])
Packit 78a954
fi # enable_coverage
Packit 78a954
Packit 78a954
AM_CONDITIONAL([WITH_GCOV],[test "x$enable_coverage" = "xyes"])
Packit 78a954
Packit 78a954
# Produce these files, in addition to config.h.
Packit 78a954
AC_CONFIG_FILES(
Packit 78a954
	Makefile
Packit 78a954
	libpcre.pc
Packit 78a954
	libpcre16.pc
Packit 78a954
	libpcre32.pc
Packit 78a954
	libpcreposix.pc
Packit 78a954
	libpcrecpp.pc
Packit 78a954
	pcre-config
Packit 78a954
	pcre.h
Packit 78a954
	pcre_stringpiece.h
Packit 78a954
	pcrecpparg.h
Packit 78a954
)
Packit 78a954
Packit 78a954
# Make the generated script files executable.
Packit 78a954
AC_CONFIG_COMMANDS([script-chmod], [chmod a+x pcre-config])
Packit 78a954
Packit 78a954
# Make sure that pcre_chartables.c is removed in case the method for
Packit 78a954
# creating it was changed by reconfiguration.
Packit 78a954
AC_CONFIG_COMMANDS([delete-old-chartables], [rm -f pcre_chartables.c])
Packit 78a954
Packit 78a954
AC_OUTPUT
Packit 78a954
Packit 78a954
# Print out a nice little message after configure is run displaying the
Packit 78a954
# chosen options.
Packit 78a954
Packit 78a954
ebcdic_nl_code=n/a
Packit 78a954
if test "$enable_ebcdic_nl25" = "yes"; then
Packit 78a954
  ebcdic_nl_code=0x25
Packit 78a954
elif test "$enable_ebcdic" = "yes"; then
Packit 78a954
  ebcdic_nl_code=0x15
Packit 78a954
fi
Packit 78a954
Packit 78a954
cat <
Packit 78a954
Packit 78a954
$PACKAGE-$VERSION configuration summary:
Packit 78a954
Packit 78a954
    Install prefix .................. : ${prefix}
Packit 78a954
    C preprocessor .................. : ${CPP}
Packit 78a954
    C compiler ...................... : ${CC}
Packit 78a954
    C++ preprocessor ................ : ${CXXCPP}
Packit 78a954
    C++ compiler .................... : ${CXX}
Packit 78a954
    Linker .......................... : ${LD}
Packit 78a954
    C preprocessor flags ............ : ${CPPFLAGS}
Packit 78a954
    C compiler flags ................ : ${CFLAGS} ${VISIBILITY_CFLAGS}
Packit 78a954
    C++ compiler flags .............. : ${CXXFLAGS} ${VISIBILITY_CXXFLAGS}
Packit 78a954
    Linker flags .................... : ${LDFLAGS}
Packit 78a954
    Extra libraries ................. : ${LIBS}
Packit 78a954
Packit 78a954
    Build 8 bit pcre library ........ : ${enable_pcre8}
Packit 78a954
    Build 16 bit pcre library ....... : ${enable_pcre16}
Packit 78a954
    Build 32 bit pcre library ....... : ${enable_pcre32}
Packit 78a954
    Build C++ library ............... : ${enable_cpp}
Packit 78a954
    Enable JIT compiling support .... : ${enable_jit}
Packit 78a954
    Enable UTF-8/16/32 support ...... : ${enable_utf}
Packit 78a954
    Unicode properties .............. : ${enable_unicode_properties}
Packit 78a954
    Newline char/sequence ........... : ${enable_newline}
Packit 78a954
    \R matches only ANYCRLF ......... : ${enable_bsr_anycrlf}
Packit 78a954
    EBCDIC coding ................... : ${enable_ebcdic}
Packit 78a954
    EBCDIC code for NL .............. : ${ebcdic_nl_code}
Packit 78a954
    Rebuild char tables ............. : ${enable_rebuild_chartables}
Packit 78a954
    Use stack recursion ............. : ${enable_stack_for_recursion}
Packit 78a954
    POSIX mem threshold ............. : ${with_posix_malloc_threshold}
Packit 78a954
    Internal link size .............. : ${with_link_size}
Packit 78a954
    Nested parentheses limit ........ : ${with_parens_nest_limit}
Packit 78a954
    Match limit ..................... : ${with_match_limit}
Packit 78a954
    Match limit recursion ........... : ${with_match_limit_recursion}
Packit 78a954
    Build shared libs ............... : ${enable_shared}
Packit 78a954
    Build static libs ............... : ${enable_static}
Packit 78a954
    Use JIT in pcregrep ............. : ${enable_pcregrep_jit}
Packit 78a954
    Buffer size for pcregrep ........ : ${with_pcregrep_bufsize}
Packit 78a954
    Link pcregrep with libz ......... : ${enable_pcregrep_libz}
Packit 78a954
    Link pcregrep with libbz2 ....... : ${enable_pcregrep_libbz2}
Packit 78a954
    Link pcretest with libedit ...... : ${enable_pcretest_libedit}
Packit 78a954
    Link pcretest with libreadline .. : ${enable_pcretest_libreadline}
Packit 78a954
    Valgrind support ................ : ${enable_valgrind}
Packit 78a954
    Code coverage ................... : ${enable_coverage}
Packit 78a954
Packit 78a954
EOF
Packit 78a954
Packit 78a954
dnl end configure.ac