"Fossies" - the Fresh Open Source Software Archive

Member "pcre-8.43/configure.ac" (23 Feb 2019, 41991 Bytes) of package /linux/misc/pcre-8.43.tar.bz2:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 8.42_vs_8.43.

    1 dnl Process this file with autoconf to produce a configure script.
    2 
    3 dnl NOTE FOR MAINTAINERS: Do not use minor version numbers 08 or 09 because
    4 dnl the leading zeros may cause them to be treated as invalid octal constants
    5 dnl if a PCRE user writes code that uses PCRE_MINOR as a number. There is now
    6 dnl a check further down that throws an error if 08 or 09 are used.
    7 
    8 dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might
    9 dnl be defined as -RC2, for example. For real releases, it should be empty.
   10 
   11 m4_define(pcre_major, [8])
   12 m4_define(pcre_minor, [43])
   13 m4_define(pcre_prerelease, [])
   14 m4_define(pcre_date, [2019-02-23])
   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)
   20 m4_define(libpcre_version, [3:11:2])
   21 m4_define(libpcre16_version, [2:11:2])
   22 m4_define(libpcre32_version, [0:11:0])
   23 m4_define(libpcreposix_version, [0:6:0])
   24 m4_define(libpcrecpp_version, [0:1:0])
   25 
   26 AC_PREREQ(2.57)
   27 AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre)
   28 AC_CONFIG_SRCDIR([pcre.h.in])
   29 AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
   30 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
   31 AC_CONFIG_HEADERS(config.h)
   32 
   33 # This is a new thing required to stop a warning from automake 1.12
   34 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
   35 
   36 # This was added at the suggestion of libtoolize (03-Jan-10)
   37 AC_CONFIG_MACRO_DIR([m4])
   38 
   39 # The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just
   40 # "-g" for any other compiler. There doesn't seem to be a standard way of
   41 # getting rid of the -g (which I don't think is needed for a production
   42 # library). This fudge seems to achieve the necessary. First, we remember the
   43 # externally set values of CFLAGS and CXXFLAGS. Then call the AC_PROG_CC and
   44 # AC_PROG_CXX macros to find the compilers - if CFLAGS and CXXFLAGS are not
   45 # set, they will be set to Autoconf's defaults. Afterwards, if the original
   46 # values were not set, remove the -g from the Autoconf defaults.
   47 # (PH 02-May-07)
   48 
   49 remember_set_CFLAGS="$CFLAGS"
   50 remember_set_CXXFLAGS="$CXXFLAGS"
   51 
   52 AC_PROG_CC
   53 AC_PROG_CXX
   54 AM_PROG_CC_C_O
   55 
   56 if test "x$remember_set_CFLAGS" = "x"
   57 then
   58   if test "$CFLAGS" = "-g -O2"
   59   then
   60     CFLAGS="-O2"
   61   elif test "$CFLAGS" = "-g"
   62   then
   63     CFLAGS=""
   64   fi
   65 fi
   66 
   67 if test "x$remember_set_CXXFLAGS" = "x"
   68 then
   69   if test "$CXXFLAGS" = "-g -O2"
   70   then
   71     CXXFLAGS="-O2"
   72   elif test "$CXXFLAGS" = "-g"
   73   then
   74     CXXFLAGS=""
   75   fi
   76 fi
   77 
   78 # AC_PROG_CXX will return "g++" even if no c++ compiler is installed.
   79 # Check for that case, and just disable c++ code if g++ doesn't run.
   80 AC_LANG_PUSH(C++)
   81 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],, CXX=""; CXXCP=""; CXXFLAGS="")
   82 AC_LANG_POP
   83 
   84 # Check for a 64-bit integer type
   85 AC_TYPE_INT64_T
   86 
   87 AC_PROG_INSTALL
   88 AC_LIBTOOL_WIN32_DLL
   89 LT_INIT
   90 AC_PROG_LN_S
   91 
   92 # Check for GCC visibility feature
   93 
   94 PCRE_VISIBILITY
   95 
   96 # Versioning
   97 
   98 PCRE_MAJOR="pcre_major"
   99 PCRE_MINOR="pcre_minor"
  100 PCRE_PRERELEASE="pcre_prerelease"
  101 PCRE_DATE="pcre_date"
  102 
  103 if test "$PCRE_MINOR" = "08" -o "$PCRE_MINOR" = "09"
  104 then
  105   echo "***"
  106   echo "*** Minor version number $PCRE_MINOR must not be used. ***"
  107   echo "*** Use only 01 to 07 or 10 onwards, to avoid octal issues. ***"
  108   echo "***"
  109   exit 1
  110 fi
  111 
  112 AC_SUBST(PCRE_MAJOR)
  113 AC_SUBST(PCRE_MINOR)
  114 AC_SUBST(PCRE_PRERELEASE)
  115 AC_SUBST(PCRE_DATE)
  116 
  117 # Set a more sensible default value for $(htmldir).
  118 if test "x$htmldir" = 'x${docdir}'
  119 then
  120   htmldir='${docdir}/html'
  121 fi
  122 
  123 # Handle --disable-pcre8 (enabled by default)
  124 AC_ARG_ENABLE(pcre8,
  125               AS_HELP_STRING([--disable-pcre8],
  126                              [disable 8 bit character support]),
  127               , enable_pcre8=unset)
  128 AC_SUBST(enable_pcre8)
  129 
  130 # Handle --enable-pcre16 (disabled by default)
  131 AC_ARG_ENABLE(pcre16,
  132               AS_HELP_STRING([--enable-pcre16],
  133                              [enable 16 bit character support]),
  134               , enable_pcre16=unset)
  135 AC_SUBST(enable_pcre16)
  136 
  137 # Handle --enable-pcre32 (disabled by default)
  138 AC_ARG_ENABLE(pcre32,
  139               AS_HELP_STRING([--enable-pcre32],
  140                              [enable 32 bit character support]),
  141               , enable_pcre32=unset)
  142 AC_SUBST(enable_pcre32)
  143 
  144 # Handle --disable-cpp. The substitution of enable_cpp is needed for use in
  145 # pcre-config.
  146 AC_ARG_ENABLE(cpp,
  147               AS_HELP_STRING([--disable-cpp],
  148                              [disable C++ support]),
  149               , enable_cpp=unset)
  150 AC_SUBST(enable_cpp)
  151 
  152 # Handle --enable-jit (disabled by default)
  153 AC_ARG_ENABLE(jit,
  154               AS_HELP_STRING([--enable-jit],
  155                              [enable Just-In-Time compiling support]),
  156               , enable_jit=no)
  157 
  158 # This code enables JIT if the hardware supports it.
  159 
  160 if test "$enable_jit" = "auto"; then
  161   AC_LANG(C)
  162   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  163   #define SLJIT_CONFIG_AUTO 1
  164   #include "sljit/sljitConfigInternal.h"
  165   #if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
  166   #error unsupported
  167   #endif]])], enable_jit=yes, enable_jit=no)
  168 fi
  169 
  170 # Handle --disable-pcregrep-jit (enabled by default)
  171 AC_ARG_ENABLE(pcregrep-jit,
  172               AS_HELP_STRING([--disable-pcregrep-jit],
  173                              [disable JIT support in pcregrep]),
  174               , enable_pcregrep_jit=yes)
  175 
  176 # Handle --enable-rebuild-chartables
  177 AC_ARG_ENABLE(rebuild-chartables,
  178               AS_HELP_STRING([--enable-rebuild-chartables],
  179                              [rebuild character tables in current locale]),
  180               , enable_rebuild_chartables=no)
  181 
  182 # Handle --enable-utf8 (disabled by default)
  183 AC_ARG_ENABLE(utf8,
  184               AS_HELP_STRING([--enable-utf8],
  185                              [another name for --enable-utf. Kept only for compatibility reasons]),
  186               , enable_utf8=unset)
  187 
  188 # Handle --enable-utf (disabled by default)
  189 AC_ARG_ENABLE(utf,
  190               AS_HELP_STRING([--enable-utf],
  191                              [enable UTF-8/16/32 support (incompatible with --enable-ebcdic)]),
  192               , enable_utf=unset)
  193 
  194 # Handle --enable-unicode-properties
  195 AC_ARG_ENABLE(unicode-properties,
  196               AS_HELP_STRING([--enable-unicode-properties],
  197                              [enable Unicode properties support (implies --enable-utf)]),
  198               , enable_unicode_properties=no)
  199 
  200 # Handle newline options
  201 ac_pcre_newline=lf
  202 AC_ARG_ENABLE(newline-is-cr,
  203               AS_HELP_STRING([--enable-newline-is-cr],
  204                              [use CR as newline character]),
  205               ac_pcre_newline=cr)
  206 AC_ARG_ENABLE(newline-is-lf,
  207               AS_HELP_STRING([--enable-newline-is-lf],
  208                              [use LF as newline character (default)]),
  209               ac_pcre_newline=lf)
  210 AC_ARG_ENABLE(newline-is-crlf,
  211               AS_HELP_STRING([--enable-newline-is-crlf],
  212                              [use CRLF as newline sequence]),
  213               ac_pcre_newline=crlf)
  214 AC_ARG_ENABLE(newline-is-anycrlf,
  215               AS_HELP_STRING([--enable-newline-is-anycrlf],
  216                              [use CR, LF, or CRLF as newline sequence]),
  217               ac_pcre_newline=anycrlf)
  218 AC_ARG_ENABLE(newline-is-any,
  219               AS_HELP_STRING([--enable-newline-is-any],
  220                              [use any valid Unicode newline sequence]),
  221               ac_pcre_newline=any)
  222 enable_newline="$ac_pcre_newline"
  223 
  224 # Handle --enable-bsr-anycrlf
  225 AC_ARG_ENABLE(bsr-anycrlf,
  226               AS_HELP_STRING([--enable-bsr-anycrlf],
  227                              [\R matches only CR, LF, CRLF by default]),
  228               , enable_bsr_anycrlf=no)
  229 
  230 # Handle --enable-ebcdic
  231 AC_ARG_ENABLE(ebcdic,
  232               AS_HELP_STRING([--enable-ebcdic],
  233                              [assume EBCDIC coding rather than ASCII; incompatible with --enable-utf; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]),
  234               , enable_ebcdic=no)
  235 
  236 # Handle --enable-ebcdic-nl25
  237 AC_ARG_ENABLE(ebcdic-nl25,
  238               AS_HELP_STRING([--enable-ebcdic-nl25],
  239                              [set EBCDIC code for NL to 0x25 instead of 0x15; it implies --enable-ebcdic]),
  240               , enable_ebcdic_nl25=no)
  241 
  242 # Handle --disable-stack-for-recursion
  243 AC_ARG_ENABLE(stack-for-recursion,
  244               AS_HELP_STRING([--disable-stack-for-recursion],
  245                              [don't use stack recursion when matching]),
  246               , enable_stack_for_recursion=yes)
  247 
  248 # Handle --enable-pcregrep-libz
  249 AC_ARG_ENABLE(pcregrep-libz,
  250               AS_HELP_STRING([--enable-pcregrep-libz],
  251                              [link pcregrep with libz to handle .gz files]),
  252               , enable_pcregrep_libz=no)
  253 
  254 # Handle --enable-pcregrep-libbz2
  255 AC_ARG_ENABLE(pcregrep-libbz2,
  256               AS_HELP_STRING([--enable-pcregrep-libbz2],
  257                              [link pcregrep with libbz2 to handle .bz2 files]),
  258               , enable_pcregrep_libbz2=no)
  259 
  260 # Handle --with-pcregrep-bufsize=N
  261 AC_ARG_WITH(pcregrep-bufsize,
  262               AS_HELP_STRING([--with-pcregrep-bufsize=N],
  263                              [pcregrep buffer size (default=20480, minimum=8192)]),
  264               , with_pcregrep_bufsize=20480)
  265 
  266 # Handle --enable-pcretest-libedit
  267 AC_ARG_ENABLE(pcretest-libedit,
  268               AS_HELP_STRING([--enable-pcretest-libedit],
  269                              [link pcretest with libedit]),
  270               , enable_pcretest_libedit=no)
  271 
  272 # Handle --enable-pcretest-libreadline
  273 AC_ARG_ENABLE(pcretest-libreadline,
  274               AS_HELP_STRING([--enable-pcretest-libreadline],
  275                              [link pcretest with libreadline]),
  276               , enable_pcretest_libreadline=no)
  277 
  278 # Handle --with-posix-malloc-threshold=NBYTES
  279 AC_ARG_WITH(posix-malloc-threshold,
  280             AS_HELP_STRING([--with-posix-malloc-threshold=NBYTES],
  281                            [threshold for POSIX malloc usage (default=10)]),
  282             , with_posix_malloc_threshold=10)
  283 
  284 # Handle --with-link-size=N
  285 AC_ARG_WITH(link-size,
  286             AS_HELP_STRING([--with-link-size=N],
  287                            [internal link size (2, 3, or 4 allowed; default=2)]),
  288             , with_link_size=2)
  289 
  290 # Handle --with-parens-nest-limit=N
  291 AC_ARG_WITH(parens-nest-limit,
  292             AS_HELP_STRING([--with-parens-nest-limit=N],
  293                            [nested parentheses limit (default=250)]),
  294             , with_parens_nest_limit=250)
  295 
  296 # Handle --with-match-limit=N
  297 AC_ARG_WITH(match-limit,
  298             AS_HELP_STRING([--with-match-limit=N],
  299                            [default limit on internal looping (default=10000000)]),
  300             , with_match_limit=10000000)
  301 
  302 # Handle --with-match-limit_recursion=N
  303 #
  304 # Note: In config.h, the default is to define MATCH_LIMIT_RECURSION
  305 # symbolically as MATCH_LIMIT, which in turn is defined to be some numeric
  306 # value (e.g. 10000000). MATCH_LIMIT_RECURSION can otherwise be set to some
  307 # different numeric value (or even the same numeric value as MATCH_LIMIT,
  308 # though no longer defined in terms of the latter).
  309 #
  310 AC_ARG_WITH(match-limit-recursion,
  311             AS_HELP_STRING([--with-match-limit-recursion=N],
  312                            [default limit on internal recursion (default=MATCH_LIMIT)]),
  313             , with_match_limit_recursion=MATCH_LIMIT)
  314 
  315 # Handle --enable-valgrind
  316 AC_ARG_ENABLE(valgrind,
  317               AS_HELP_STRING([--enable-valgrind],
  318                              [valgrind support]),
  319               , enable_valgrind=no)
  320 
  321 # Enable code coverage reports using gcov
  322 AC_ARG_ENABLE(coverage,
  323               AS_HELP_STRING([--enable-coverage],
  324                              [enable code coverage reports using gcov]),
  325               , enable_coverage=no)
  326 
  327 # Copy enable_utf8 value to enable_utf for compatibility reasons
  328 if test "x$enable_utf8" != "xunset"
  329 then
  330   if test "x$enable_utf" != "xunset"
  331   then
  332     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.])
  333   fi
  334   enable_utf=$enable_utf8
  335 fi
  336 
  337 # Set the default value for pcre8
  338 if test "x$enable_pcre8" = "xunset"
  339 then
  340   enable_pcre8=yes
  341 fi
  342 
  343 # Set the default value for pcre16
  344 if test "x$enable_pcre16" = "xunset"
  345 then
  346   enable_pcre16=no
  347 fi
  348 
  349 # Set the default value for pcre32
  350 if test "x$enable_pcre32" = "xunset"
  351 then
  352   enable_pcre32=no
  353 fi
  354 
  355 # Make sure enable_pcre8 or enable_pcre16 was set
  356 if test "x$enable_pcre8$enable_pcre16$enable_pcre32" = "xnonono"
  357 then
  358   AC_MSG_ERROR([At least one of 8, 16 or 32 bit pcre library must be enabled])
  359 fi
  360 
  361 # Make sure that if enable_unicode_properties was set, that UTF support is enabled.
  362 if test "x$enable_unicode_properties" = "xyes"
  363 then
  364   if test "x$enable_utf" = "xno"
  365   then
  366     AC_MSG_ERROR([support for Unicode properties requires UTF-8/16/32 support])
  367   fi
  368   enable_utf=yes
  369 fi
  370 
  371 # enable_utf is disabled by default.
  372 if test "x$enable_utf" = "xunset"
  373 then
  374   enable_utf=no
  375 fi
  376 
  377 # enable_cpp copies the value of enable_pcre8 by default
  378 if test "x$enable_cpp" = "xunset"
  379 then
  380   enable_cpp=$enable_pcre8
  381 fi
  382 
  383 # Make sure that if enable_cpp was set, that enable_pcre8 support is enabled
  384 if test "x$enable_cpp" = "xyes"
  385 then
  386   if test "x$enable_pcre8" = "xno"
  387   then
  388     AC_MSG_ERROR([C++ library requires pcre library with 8 bit characters])
  389   fi
  390 fi
  391 
  392 # Convert the newline identifier into the appropriate integer value. The first
  393 # three are ASCII values 0x0a, 0x0d, and 0x0d0a, but if EBCDIC is enabled, they
  394 # are changed below.
  395 
  396 case "$enable_newline" in
  397   lf)      ac_pcre_newline_value=10   ;;
  398   cr)      ac_pcre_newline_value=13   ;;
  399   crlf)    ac_pcre_newline_value=3338 ;;
  400   anycrlf) ac_pcre_newline_value=-2   ;;
  401   any)     ac_pcre_newline_value=-1   ;;
  402   *)
  403   AC_MSG_ERROR([invalid argument \"$enable_newline\" to --enable-newline option])
  404   ;;
  405 esac
  406 
  407 # --enable-ebcdic-nl25 implies --enable-ebcdic
  408 if test "x$enable_ebcdic_nl25" = "xyes"; then
  409   enable_ebcdic=yes
  410 fi
  411 
  412 # Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled,
  413 # and the newline value is adjusted appropriately (CR is still 13, but LF is
  414 # 21 or 37). Also check that UTF support is not requested, because PCRE cannot
  415 # handle EBCDIC and UTF in the same build. To do so it would need to use
  416 # different character constants depending on the mode.
  417 #
  418 if test "x$enable_ebcdic" = "xyes"; then
  419   enable_rebuild_chartables=yes
  420 
  421   if test "x$enable_utf" = "xyes"; then
  422     AC_MSG_ERROR([support for EBCDIC and UTF-8/16/32 cannot be enabled at the same time])
  423   fi
  424 
  425   if test "x$enable_ebcdic_nl25" = "xno"; then
  426     case "$ac_pcre_newline_value" in
  427       10)   ac_pcre_newline_value=21 ;;
  428       3338) ac_pcre_newline_value=3349 ;;
  429     esac
  430   else
  431     case "$ac_pcre_newline_value" in
  432       10)   ac_pcre_newline_value=37 ;;
  433       3338) ac_pcre_newline_value=3365 ;;
  434     esac
  435   fi
  436 fi
  437 
  438 # Check argument to --with-link-size
  439 case "$with_link_size" in
  440   2|3|4) ;;
  441   *)
  442   AC_MSG_ERROR([invalid argument \"$with_link_size\" to --with-link-size option])
  443   ;;
  444 esac
  445 
  446 AH_TOP([
  447 /* PCRE is written in Standard C, but there are a few non-standard things it
  448 can cope with, allowing it to run on SunOS4 and other "close to standard"
  449 systems.
  450 
  451 In environments that support the GNU autotools, config.h.in is converted into
  452 config.h by the "configure" script. In environments that use CMake,
  453 config-cmake.in is converted into config.h. If you are going to build PCRE "by
  454 hand" without using "configure" or CMake, you should copy the distributed
  455 config.h.generic to config.h, and edit the macro definitions to be the way you
  456 need them. You must then add -DHAVE_CONFIG_H to all of your compile commands,
  457 so that config.h is included at the start of every source.
  458 
  459 Alternatively, you can avoid editing by using -D on the compiler command line
  460 to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
  461 but if you do, default values will be taken from config.h for non-boolean
  462 macros that are not defined on the command line.
  463 
  464 Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE8 should either be defined
  465 (conventionally to 1) for TRUE, and not defined at all for FALSE. All such
  466 macros are listed as a commented #undef in config.h.generic. Macros such as
  467 MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
  468 surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
  469 
  470 PCRE uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
  471 HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make
  472 sure both macros are undefined; an emulation function will then be used. */])
  473 
  474 # Checks for header files.
  475 AC_HEADER_STDC
  476 AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h)
  477 AC_CHECK_HEADERS([windows.h], [HAVE_WINDOWS_H=1])
  478 
  479 # The files below are C++ header files.
  480 pcre_have_type_traits="0"
  481 pcre_have_bits_type_traits="0"
  482 
  483 if test "x$enable_cpp" = "xyes" -a -z "$CXX"; then
  484    AC_MSG_ERROR([Invalid C++ compiler or C++ compiler flags])
  485 fi
  486 
  487 if test "x$enable_cpp" = "xyes" -a -n "$CXX"
  488 then
  489 AC_LANG_PUSH(C++)
  490 
  491 # Older versions of pcre defined pcrecpp::no_arg, but in new versions
  492 # it's called pcrecpp::RE::no_arg.  For backwards ABI compatibility,
  493 # we want to make one an alias for the other.  Different systems do
  494 # this in different ways.  Some systems, for instance, can do it via
  495 # a linker flag: -alias (for os x 10.5) or -i (for os x <=10.4).
  496 OLD_LDFLAGS="$LDFLAGS"
  497 for flag in "-alias,__ZN7pcrecpp2RE6no_argE,__ZN7pcrecpp6no_argE" \
  498             "-i__ZN7pcrecpp6no_argE:__ZN7pcrecpp2RE6no_argE"; do
  499   AC_MSG_CHECKING([for alias support in the linker])
  500   LDFLAGS="$OLD_LDFLAGS -Wl,$flag"
  501   # We try to run the linker with this new ld flag.  If the link fails,
  502   # we give up and remove the new flag from LDFLAGS.
  503   AC_LINK_IFELSE([AC_LANG_PROGRAM([namespace pcrecpp {
  504                                     class RE { static int no_arg; };
  505                                     int RE::no_arg;
  506                                   }],
  507                                  [])],
  508                  [AC_MSG_RESULT([yes]);
  509                   EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS -Wl,$flag";
  510                   break;],
  511                  AC_MSG_RESULT([no]))
  512 done
  513 LDFLAGS="$OLD_LDFLAGS"
  514 
  515 # We could be more clever here, given we're doing AC_SUBST with this
  516 # (eg set a var to be the name of the include file we want). But we're not
  517 # so it's easy to change back to 'regular' autoconf vars if we needed to.
  518 AC_CHECK_HEADERS(string, [pcre_have_cpp_headers="1"],
  519                          [pcre_have_cpp_headers="0"])
  520 AC_CHECK_HEADERS(bits/type_traits.h, [pcre_have_bits_type_traits="1"],
  521                                      [pcre_have_bits_type_traits="0"])
  522 AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
  523                                 [pcre_have_type_traits="0"])
  524 
  525 # (This isn't c++-specific, but is only used in pcrecpp.cc, so try this
  526 # in a c++ context.  This matters becuase strtoimax is C99 and may not
  527 # be supported by the C++ compiler.)
  528 # Figure out how to create a longlong from a string: strtoll and
  529 # equiv.  It's not enough to call AC_CHECK_FUNCS: hpux has a
  530 # strtoll, for instance, but it only takes 2 args instead of 3!
  531 # We have to call AH_TEMPLATE since AC_DEFINE_UNQUOTED below is complex.
  532 AH_TEMPLATE(HAVE_STRTOQ, [Define to 1 if you have `strtoq'.])
  533 AH_TEMPLATE(HAVE_STRTOLL, [Define to 1 if you have `strtoll'.])
  534 AH_TEMPLATE(HAVE__STRTOI64, [Define to 1 if you have `_strtoi64'.])
  535 AH_TEMPLATE(HAVE_STRTOIMAX, [Define to 1 if you have `strtoimax'.])
  536 have_strto_fn=0
  537 for fn in strtoq strtoll _strtoi64 strtoimax; do
  538   AC_MSG_CHECKING([for $fn])
  539   if test "$fn" = strtoimax; then
  540     include=stdint.h
  541   else
  542     include=stdlib.h
  543   fi
  544   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <$include>],
  545                                     [char* e; return $fn("100", &e, 10)])],
  546                     [AC_MSG_RESULT(yes)
  547                      AC_DEFINE_UNQUOTED(HAVE_`echo $fn | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`, 1,
  548                                         [Define to 1 if you have `$fn'.])
  549                      have_strto_fn=1
  550                      break],
  551                     [AC_MSG_RESULT(no)])
  552 done
  553 
  554 if test "$have_strto_fn" = 1; then
  555   AC_CHECK_TYPES([long long],
  556                  [pcre_have_long_long="1"],
  557                  [pcre_have_long_long="0"])
  558   AC_CHECK_TYPES([unsigned long long],
  559                  [pcre_have_ulong_long="1"],
  560                  [pcre_have_ulong_long="0"])
  561 else
  562   pcre_have_long_long="0"
  563   pcre_have_ulong_long="0"
  564 fi
  565 AC_SUBST(pcre_have_long_long)
  566 AC_SUBST(pcre_have_ulong_long)
  567 
  568 AC_LANG_POP
  569 fi
  570 # Using AC_SUBST eliminates the need to include config.h in a public .h file
  571 AC_SUBST(pcre_have_type_traits)
  572 AC_SUBST(pcre_have_bits_type_traits)
  573 
  574 # Conditional compilation
  575 AM_CONDITIONAL(WITH_PCRE8, test "x$enable_pcre8" = "xyes")
  576 AM_CONDITIONAL(WITH_PCRE16, test "x$enable_pcre16" = "xyes")
  577 AM_CONDITIONAL(WITH_PCRE32, test "x$enable_pcre32" = "xyes")
  578 AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes")
  579 AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes")
  580 AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes")
  581 AM_CONDITIONAL(WITH_UTF, test "x$enable_utf" = "xyes")
  582 AM_CONDITIONAL(WITH_VALGRIND, test "x$enable_valgrind" = "xyes")
  583 
  584 # Checks for typedefs, structures, and compiler characteristics.
  585 
  586 AC_C_CONST
  587 AC_TYPE_SIZE_T
  588 
  589 # Checks for library functions.
  590 
  591 AC_CHECK_FUNCS(bcopy memmove strerror)
  592 
  593 # Check for the availability of libz (aka zlib)
  594 
  595 AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1])
  596 AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1])
  597 
  598 # Check for the availability of libbz2. Originally we just used AC_CHECK_LIB,
  599 # as for libz. However, this had the following problem, diagnosed and fixed by
  600 # a user:
  601 #
  602 #   - libbz2 uses the Pascal calling convention (WINAPI) for the functions
  603 #     under Win32.
  604 #   - The standard autoconf AC_CHECK_LIB fails to include "bzlib.h",
  605 #     therefore missing the function definition.
  606 #   - The compiler thus generates a "C" signature for the test function.
  607 #   - The linker fails to find the "C" function.
  608 #   - PCRE fails to configure if asked to do so against libbz2.
  609 #
  610 # Solution:
  611 #
  612 #   - Replace the AC_CHECK_LIB test with a custom test.
  613 
  614 AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1])
  615 # Original test
  616 # AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1])
  617 #
  618 # Custom test follows
  619 
  620 AC_MSG_CHECKING([for libbz2])
  621 OLD_LIBS="$LIBS"
  622 LIBS="$LIBS -lbz2"
  623 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  624 #ifdef HAVE_BZLIB_H
  625 #include <bzlib.h>
  626 #endif]],
  627 [[return (int)BZ2_bzopen("conftest", "rb");]])],
  628 [AC_MSG_RESULT([yes]);HAVE_LIBBZ2=1; break;],
  629 AC_MSG_RESULT([no]))
  630 LIBS="$OLD_LIBS"
  631 
  632 # Check for the availabiity of libreadline
  633 
  634 if test "$enable_pcretest_libreadline" = "yes"; then
  635  AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1])
  636  AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1])
  637  AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lreadline"],
  638    [unset ac_cv_lib_readline_readline;
  639     AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltinfo"],
  640      [unset ac_cv_lib_readline_readline;
  641       AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lcurses"],
  642        [unset ac_cv_lib_readline_readline;
  643         AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"],
  644          [unset ac_cv_lib_readline_readline;
  645 	  AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"],
  646            [unset ac_cv_lib_readline_readline;
  647 	    AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"],
  648              [LIBREADLINE=""],
  649              [-ltermcap])],
  650            [-lncursesw])],
  651          [-lncurses])],
  652        [-lcurses])],
  653      [-ltinfo])])
  654  AC_SUBST(LIBREADLINE)
  655  if test -n "$LIBREADLINE"; then
  656    if test "$LIBREADLINE" != "-lreadline"; then
  657      echo "-lreadline needs $LIBREADLINE"
  658      LIBREADLINE="-lreadline $LIBREADLINE"
  659    fi
  660  fi
  661 fi
  662 
  663 
  664 # Check for the availability of libedit. Different distributions put its
  665 # headers in different places. Try to cover the most common ones.
  666 
  667 if test "$enable_pcretest_libedit" = "yes"; then
  668   AC_CHECK_HEADERS([editline/readline.h], [HAVE_EDITLINE_READLINE_H=1],
  669     [AC_CHECK_HEADERS([edit/readline/readline.h], [HAVE_READLINE_READLINE_H=1],
  670       [AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_READLINE_H=1])])])
  671   AC_CHECK_LIB([edit], [readline], [LIBEDIT="-ledit"])
  672 fi
  673 
  674 # This facilitates -ansi builds under Linux
  675 dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc])
  676 
  677 PCRE_STATIC_CFLAG=""
  678 if test "x$enable_shared" = "xno" ; then
  679   AC_DEFINE([PCRE_STATIC], [1], [
  680     Define to any value if linking statically (TODO: make nice with Libtool)])
  681   PCRE_STATIC_CFLAG="-DPCRE_STATIC"
  682 fi
  683 AC_SUBST(PCRE_STATIC_CFLAG)
  684 
  685 # Here is where pcre specific defines are handled
  686 
  687 if test "$enable_pcre8" = "yes"; then
  688   AC_DEFINE([SUPPORT_PCRE8], [], [
  689     Define to any value to enable the 8 bit PCRE library.])
  690 fi
  691 
  692 if test "$enable_pcre16" = "yes"; then
  693   AC_DEFINE([SUPPORT_PCRE16], [], [
  694     Define to any value to enable the 16 bit PCRE library.])
  695 fi
  696 
  697 if test "$enable_pcre32" = "yes"; then
  698   AC_DEFINE([SUPPORT_PCRE32], [], [
  699     Define to any value to enable the 32 bit PCRE library.])
  700 fi
  701 
  702 # Unless running under Windows, JIT support requires pthreads.
  703 
  704 if test "$enable_jit" = "yes"; then
  705   if test "$HAVE_WINDOWS_H" != "1"; then
  706     AX_PTHREAD([], [AC_MSG_ERROR([JIT support requires pthreads])])
  707     CC="$PTHREAD_CC"
  708     CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
  709     LIBS="$PTHREAD_LIBS $LIBS"
  710   fi
  711   AC_DEFINE([SUPPORT_JIT], [], [
  712     Define to any value to enable support for Just-In-Time compiling.])
  713 else
  714   enable_pcregrep_jit="no"
  715 fi
  716 
  717 if test "$enable_pcregrep_jit" = "yes"; then
  718   AC_DEFINE([SUPPORT_PCREGREP_JIT], [], [
  719     Define to any value to enable JIT support in pcregrep.])
  720 fi
  721 
  722 if test "$enable_utf" = "yes"; then
  723   AC_DEFINE([SUPPORT_UTF], [], [
  724     Define to any value to enable support for the UTF-8/16/32 Unicode encoding.
  725     This will work even in an EBCDIC environment, but it is incompatible
  726     with the EBCDIC macro. That is, PCRE can support *either* EBCDIC
  727     code *or* ASCII/UTF-8/16/32, but not both at once.])
  728 fi
  729 
  730 if test "$enable_unicode_properties" = "yes"; then
  731   AC_DEFINE([SUPPORT_UCP], [], [
  732     Define to any value to enable support for Unicode properties.])
  733 fi
  734 
  735 if test "$enable_stack_for_recursion" = "no"; then
  736   AC_DEFINE([NO_RECURSE], [], [
  737     PCRE uses recursive function calls to handle backtracking while
  738     matching. This can sometimes be a problem on systems that have
  739     stacks of limited size. Define NO_RECURSE to any value to get a
  740     version that doesn't use recursion in the match() function; instead
  741     it creates its own stack by steam using pcre_recurse_malloc() to obtain
  742     memory from the heap. For more detail, see the comments and other stuff
  743     just above the match() function.])
  744 fi
  745 
  746 if test "$enable_pcregrep_libz" = "yes"; then
  747   AC_DEFINE([SUPPORT_LIBZ], [], [
  748     Define to any value to allow pcregrep to be linked with libz, so that it is
  749     able to handle .gz files.])
  750 fi
  751 
  752 if test "$enable_pcregrep_libbz2" = "yes"; then
  753   AC_DEFINE([SUPPORT_LIBBZ2], [], [
  754     Define to any value to allow pcregrep to be linked with libbz2, so that it
  755     is able to handle .bz2 files.])
  756 fi
  757 
  758 if test $with_pcregrep_bufsize -lt 8192 ; then
  759   AC_MSG_WARN([$with_pcregrep_bufsize is too small for --with-pcregrep-bufsize; using 8192])
  760   with_pcregrep_bufsize="8192"
  761 else
  762   if test $? -gt 1 ; then
  763   AC_MSG_ERROR([Bad value for  --with-pcregrep-bufsize])
  764   fi
  765 fi
  766 
  767 AC_DEFINE_UNQUOTED([PCREGREP_BUFSIZE], [$with_pcregrep_bufsize], [
  768   The value of PCREGREP_BUFSIZE determines the size of buffer used by pcregrep
  769   to hold parts of the file it is searching. This is also the minimum value.
  770   The actual amount of memory used by pcregrep is three times this number,
  771   because it allows for the buffering of "before" and "after" lines.])
  772 
  773 if test "$enable_pcretest_libedit" = "yes"; then
  774   AC_DEFINE([SUPPORT_LIBEDIT], [], [
  775     Define to any value to allow pcretest to be linked with libedit.])
  776   LIBREADLINE="$LIBEDIT"
  777 elif test "$enable_pcretest_libreadline" = "yes"; then
  778   AC_DEFINE([SUPPORT_LIBREADLINE], [], [
  779     Define to any value to allow pcretest to be linked with libreadline.])
  780 fi
  781 
  782 AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline_value], [
  783   The value of NEWLINE determines the default newline character sequence. PCRE
  784   client programs can override this by selecting other values at run time. In
  785   ASCII environments, the value can be 10 (LF), 13 (CR), or 3338 (CRLF); in
  786   EBCDIC environments the value can be 21 or 37 (LF), 13 (CR), or 3349 or 3365
  787   (CRLF) because there are two alternative codepoints (0x15 and 0x25) that are
  788   used as the NL line terminator that is equivalent to ASCII LF. In both ASCII
  789   and EBCDIC environments the value can also be -1 (ANY), or -2 (ANYCRLF).])
  790 
  791 if test "$enable_bsr_anycrlf" = "yes"; then
  792   AC_DEFINE([BSR_ANYCRLF], [], [
  793     By default, the \R escape sequence matches any Unicode line ending
  794     character or sequence of characters. If BSR_ANYCRLF is defined (to any
  795     value), this is changed so that backslash-R matches only CR, LF, or CRLF.
  796     The build-time default can be overridden by the user of PCRE at runtime.])
  797 fi
  798 
  799 AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [
  800   The value of LINK_SIZE determines the number of bytes used to store
  801   links as offsets within the compiled regex. The default is 2, which
  802   allows for compiled patterns up to 64K long. This covers the vast
  803   majority of cases. However, PCRE can also be compiled to use 3 or 4
  804   bytes instead. This allows for longer patterns in extreme cases.])
  805 
  806 AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$with_posix_malloc_threshold], [
  807   When calling PCRE via the POSIX interface, additional working storage
  808   is required for holding the pointers to capturing substrings because
  809   PCRE requires three integers per substring, whereas the POSIX
  810   interface provides only two. If the number of expected substrings is
  811   small, the wrapper function uses space on the stack, because this is
  812   faster than using malloc() for each call. The threshold above which
  813   the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD.])
  814 
  815 AC_DEFINE_UNQUOTED([PARENS_NEST_LIMIT], [$with_parens_nest_limit], [
  816   The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
  817   parentheses (of any kind) in a pattern. This limits the amount of system
  818   stack that is used while compiling a pattern.])
  819 
  820 AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [
  821   The value of MATCH_LIMIT determines the default number of times the
  822   internal match() function can be called during a single execution of
  823   pcre_exec(). There is a runtime interface for setting a different
  824   limit. The limit exists in order to catch runaway regular
  825   expressions that take for ever to determine that they do not match.
  826   The default is set very large so that it does not accidentally catch
  827   legitimate cases.])
  828 
  829 AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSION], [$with_match_limit_recursion], [
  830   The above limit applies to all calls of match(), whether or not they
  831   increase the recursion depth. In some environments it is desirable
  832   to limit the depth of recursive calls of match() more strictly, in
  833   order to restrict the maximum amount of stack (or heap, if
  834   NO_RECURSE is defined) that is used. The value of
  835   MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To
  836   have any useful effect, it must be less than the value of
  837   MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT.
  838   There is a runtime method for setting a different limit.])
  839 
  840 AC_DEFINE([MAX_NAME_SIZE], [32], [
  841   This limit is parameterized just in case anybody ever wants to
  842   change it. Care must be taken if it is increased, because it guards
  843   against integer overflow caused by enormously large patterns.])
  844 
  845 AC_DEFINE([MAX_NAME_COUNT], [10000], [
  846   This limit is parameterized just in case anybody ever wants to
  847   change it. Care must be taken if it is increased, because it guards
  848   against integer overflow caused by enormously large patterns.])
  849 
  850 AH_VERBATIM([PCRE_EXP_DEFN], [
  851 /* If you are compiling for a system other than a Unix-like system or
  852    Win32, and it needs some magic to be inserted before the definition
  853    of a function that is exported by the library, define this macro to
  854    contain the relevant magic. If you do not define this macro, a suitable
  855     __declspec value is used for Windows systems; in other environments
  856    "extern" is used for a C compiler and "extern C" for a C++ compiler.
  857    This macro apears at the start of every exported function that is part
  858    of the external API. It does not appear on functions that are "external"
  859    in the C sense, but which are internal to the library. */
  860 #undef PCRE_EXP_DEFN])
  861 
  862 if test "$enable_ebcdic" = "yes"; then
  863   AC_DEFINE_UNQUOTED([EBCDIC], [], [
  864     If you are compiling for a system that uses EBCDIC instead of ASCII
  865     character codes, define this macro to any value. You must also edit the
  866     NEWLINE macro below to set a suitable EBCDIC newline, commonly 21 (0x15).
  867     On systems that can use "configure" or CMake to set EBCDIC, NEWLINE is
  868     automatically adjusted. When EBCDIC is set, PCRE assumes that all input
  869     strings are in EBCDIC. If you do not define this macro, PCRE will assume
  870     input strings are ASCII or UTF-8/16/32 Unicode. It is not possible to build
  871     a version of PCRE that supports both EBCDIC and UTF-8/16/32.])
  872 fi
  873 
  874 if test "$enable_ebcdic_nl25" = "yes"; then
  875   AC_DEFINE_UNQUOTED([EBCDIC_NL25], [], [
  876     In an EBCDIC environment, define this macro to any value to arrange for
  877     the NL character to be 0x25 instead of the default 0x15. NL plays the role
  878     that LF does in an ASCII/Unicode environment. The value must also be set in
  879     the NEWLINE macro below. On systems that can use "configure" or CMake to
  880     set EBCDIC_NL25, the adjustment of NEWLINE is automatic.])
  881 fi
  882 
  883 if test "$enable_valgrind" = "yes"; then
  884   AC_DEFINE_UNQUOTED([SUPPORT_VALGRIND], [], [
  885      Define to any value for valgrind support to find invalid memory reads.])
  886 fi
  887 
  888 # Platform specific issues
  889 NO_UNDEFINED=
  890 EXPORT_ALL_SYMBOLS=
  891 case $host_os in
  892   cygwin* | mingw* )
  893     if test X"$enable_shared" = Xyes; then
  894       NO_UNDEFINED="-no-undefined"
  895       EXPORT_ALL_SYMBOLS="-Wl,--export-all-symbols"
  896     fi
  897     ;;
  898 esac
  899 
  900 # The extra LDFLAGS for each particular library
  901 # (Note: The libpcre*_version bits are m4 variables, assigned above)
  902 
  903 EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS \
  904                        $NO_UNDEFINED -version-info libpcre_version"
  905 
  906 EXTRA_LIBPCRE16_LDFLAGS="$EXTRA_LIBPCRE16_LDFLAGS \
  907                        $NO_UNDEFINED -version-info libpcre16_version"
  908 
  909 EXTRA_LIBPCRE32_LDFLAGS="$EXTRA_LIBPCRE32_LDFLAGS \
  910                        $NO_UNDEFINED -version-info libpcre32_version"
  911 
  912 EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS \
  913                             $NO_UNDEFINED -version-info libpcreposix_version"
  914 
  915 EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS \
  916                           $NO_UNDEFINED -version-info libpcrecpp_version \
  917                           $EXPORT_ALL_SYMBOLS"
  918 
  919 AC_SUBST(EXTRA_LIBPCRE_LDFLAGS)
  920 AC_SUBST(EXTRA_LIBPCRE16_LDFLAGS)
  921 AC_SUBST(EXTRA_LIBPCRE32_LDFLAGS)
  922 AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS)
  923 AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS)
  924 
  925 # When we run 'make distcheck', use these arguments. Turning off compiler
  926 # optimization makes it run faster.
  927 DISTCHECK_CONFIGURE_FLAGS="CFLAGS='' CXXFLAGS='' --enable-pcre16 --enable-pcre32 --enable-jit --enable-cpp --enable-unicode-properties"
  928 AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
  929 
  930 # Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is
  931 # specified, the relevant library is available.
  932 
  933 if test "$enable_pcregrep_libz" = "yes"; then
  934   if test "$HAVE_ZLIB_H" != "1"; then
  935     echo "** Cannot --enable-pcregrep-libz because zlib.h was not found"
  936     exit 1
  937   fi
  938   if test "$HAVE_LIBZ" != "1"; then
  939     echo "** Cannot --enable-pcregrep-libz because libz was not found"
  940     exit 1
  941   fi
  942   LIBZ="-lz"
  943 fi
  944 AC_SUBST(LIBZ)
  945 
  946 if test "$enable_pcregrep_libbz2" = "yes"; then
  947   if test "$HAVE_BZLIB_H" != "1"; then
  948     echo "** Cannot --enable-pcregrep-libbz2 because bzlib.h was not found"
  949     exit 1
  950   fi
  951   if test "$HAVE_LIBBZ2" != "1"; then
  952     echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found"
  953     exit 1
  954   fi
  955   LIBBZ2="-lbz2"
  956 fi
  957 AC_SUBST(LIBBZ2)
  958 
  959 # Similarly for --enable-pcretest-readline
  960 
  961 if test "$enable_pcretest_libedit" = "yes"; then
  962   if test "$enable_pcretest_libreadline" = "yes"; then
  963     echo "** Cannot use both --enable-pcretest-libedit and --enable-pcretest-readline"
  964     exit 1
  965   fi
  966   if test "$HAVE_EDITLINE_READLINE_H" != "1" -a \
  967           "$HAVE_READLINE_READLINE_H" != "1"; then
  968     echo "** Cannot --enable-pcretest-libedit because neither editline/readline.h"
  969     echo "** nor readline/readline.h was found."
  970     exit 1
  971   fi
  972   if test -z "$LIBEDIT"; then
  973     echo "** Cannot --enable-pcretest-libedit because libedit library was not found."
  974     exit 1
  975   fi
  976 fi
  977 
  978 if test "$enable_pcretest_libreadline" = "yes"; then
  979   if test "$HAVE_READLINE_H" != "1"; then
  980     echo "** Cannot --enable-pcretest-readline because readline/readline.h was not found."
  981     exit 1
  982   fi
  983   if test "$HAVE_HISTORY_H" != "1"; then
  984     echo "** Cannot --enable-pcretest-readline because readline/history.h was not found."
  985     exit 1
  986   fi
  987   if test -z "$LIBREADLINE"; then
  988     echo "** Cannot --enable-pcretest-readline because readline library was not found."
  989     exit 1
  990   fi
  991 fi
  992 
  993 # Handle valgrind support
  994 
  995 if test "$enable_valgrind" = "yes"; then
  996   m4_ifdef([PKG_CHECK_MODULES],
  997            [PKG_CHECK_MODULES([VALGRIND],[valgrind])],
  998            [AC_MSG_ERROR([pkg-config not supported])])
  999 fi
 1000 
 1001 # Handle code coverage reporting support
 1002 if test "$enable_coverage" = "yes"; then
 1003   if test "x$GCC" != "xyes"; then
 1004     AC_MSG_ERROR([Code coverage reports can only be generated when using GCC])
 1005   fi
 1006 
 1007   # ccache is incompatible with gcov
 1008   AC_PATH_PROG([SHTOOL],[shtool],[false])
 1009   case `$SHTOOL path $CC` in
 1010     *ccache*) cc_ccache=yes;;
 1011     *) cc_ccache=no;;
 1012   esac
 1013 
 1014   if test "$cc_ccache" = "yes"; then
 1015     if test -z "$CCACHE_DISABLE" -o "$CCACHE_DISABLE" != "1"; then
 1016       AC_MSG_ERROR([must export CCACHE_DISABLE=1 to disable ccache for code coverage])
 1017     fi
 1018   fi
 1019 
 1020   AC_ARG_VAR([LCOV],[the ltp lcov program])
 1021   AC_PATH_PROG([LCOV],[lcov],[false])
 1022   if test "x$LCOV" = "xfalse"; then
 1023     AC_MSG_ERROR([lcov not found])
 1024   fi
 1025 
 1026   AC_ARG_VAR([GENHTML],[the ltp genhtml program])
 1027   AC_PATH_PROG([GENHTML],[genhtml],[false])
 1028   if test "x$GENHTML" = "xfalse"; then
 1029     AC_MSG_ERROR([genhtml not found])
 1030   fi
 1031 
 1032   # Set flags needed for gcov
 1033   GCOV_CFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
 1034   GCOV_CXXFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
 1035   GCOV_LIBS="-lgcov"
 1036   AC_SUBST([GCOV_CFLAGS])
 1037   AC_SUBST([GCOV_CXXFLAGS])
 1038   AC_SUBST([GCOV_LIBS])
 1039 fi # enable_coverage
 1040 
 1041 AM_CONDITIONAL([WITH_GCOV],[test "x$enable_coverage" = "xyes"])
 1042 
 1043 # Produce these files, in addition to config.h.
 1044 AC_CONFIG_FILES(
 1045 	Makefile
 1046 	libpcre.pc
 1047 	libpcre16.pc
 1048 	libpcre32.pc
 1049 	libpcreposix.pc
 1050 	libpcrecpp.pc
 1051 	pcre-config
 1052 	pcre.h
 1053 	pcre_stringpiece.h
 1054 	pcrecpparg.h
 1055 )
 1056 
 1057 # Make the generated script files executable.
 1058 AC_CONFIG_COMMANDS([script-chmod], [chmod a+x pcre-config])
 1059 
 1060 # Make sure that pcre_chartables.c is removed in case the method for
 1061 # creating it was changed by reconfiguration.
 1062 AC_CONFIG_COMMANDS([delete-old-chartables], [rm -f pcre_chartables.c])
 1063 
 1064 AC_OUTPUT
 1065 
 1066 # Print out a nice little message after configure is run displaying the
 1067 # chosen options.
 1068 
 1069 ebcdic_nl_code=n/a
 1070 if test "$enable_ebcdic_nl25" = "yes"; then
 1071   ebcdic_nl_code=0x25
 1072 elif test "$enable_ebcdic" = "yes"; then
 1073   ebcdic_nl_code=0x15
 1074 fi
 1075 
 1076 cat <<EOF
 1077 
 1078 $PACKAGE-$VERSION configuration summary:
 1079 
 1080     Install prefix .................. : ${prefix}
 1081     C preprocessor .................. : ${CPP}
 1082     C compiler ...................... : ${CC}
 1083     C++ preprocessor ................ : ${CXXCPP}
 1084     C++ compiler .................... : ${CXX}
 1085     Linker .......................... : ${LD}
 1086     C preprocessor flags ............ : ${CPPFLAGS}
 1087     C compiler flags ................ : ${CFLAGS} ${VISIBILITY_CFLAGS}
 1088     C++ compiler flags .............. : ${CXXFLAGS} ${VISIBILITY_CXXFLAGS}
 1089     Linker flags .................... : ${LDFLAGS}
 1090     Extra libraries ................. : ${LIBS}
 1091 
 1092     Build 8 bit pcre library ........ : ${enable_pcre8}
 1093     Build 16 bit pcre library ....... : ${enable_pcre16}
 1094     Build 32 bit pcre library ....... : ${enable_pcre32}
 1095     Build C++ library ............... : ${enable_cpp}
 1096     Enable JIT compiling support .... : ${enable_jit}
 1097     Enable UTF-8/16/32 support ...... : ${enable_utf}
 1098     Unicode properties .............. : ${enable_unicode_properties}
 1099     Newline char/sequence ........... : ${enable_newline}
 1100     \R matches only ANYCRLF ......... : ${enable_bsr_anycrlf}
 1101     EBCDIC coding ................... : ${enable_ebcdic}
 1102     EBCDIC code for NL .............. : ${ebcdic_nl_code}
 1103     Rebuild char tables ............. : ${enable_rebuild_chartables}
 1104     Use stack recursion ............. : ${enable_stack_for_recursion}
 1105     POSIX mem threshold ............. : ${with_posix_malloc_threshold}
 1106     Internal link size .............. : ${with_link_size}
 1107     Nested parentheses limit ........ : ${with_parens_nest_limit}
 1108     Match limit ..................... : ${with_match_limit}
 1109     Match limit recursion ........... : ${with_match_limit_recursion}
 1110     Build shared libs ............... : ${enable_shared}
 1111     Build static libs ............... : ${enable_static}
 1112     Use JIT in pcregrep ............. : ${enable_pcregrep_jit}
 1113     Buffer size for pcregrep ........ : ${with_pcregrep_bufsize}
 1114     Link pcregrep with libz ......... : ${enable_pcregrep_libz}
 1115     Link pcregrep with libbz2 ....... : ${enable_pcregrep_libbz2}
 1116     Link pcretest with libedit ...... : ${enable_pcretest_libedit}
 1117     Link pcretest with libreadline .. : ${enable_pcretest_libreadline}
 1118     Valgrind support ................ : ${enable_valgrind}
 1119     Code coverage ................... : ${enable_coverage}
 1120 
 1121 EOF
 1122 
 1123 dnl end configure.ac