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