Annotation of embedaddon/pcre/configure.ac, revision 1.1.1.5

1.1       misho       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])
1.1.1.5 ! misho      12: m4_define(pcre_minor, [34])
1.1       misho      13: m4_define(pcre_prerelease, [])
1.1.1.5 ! misho      14: m4_define(pcre_date, [2013-12-15])
1.1.1.2   misho      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.
1.1       misho      18: 
                     19: # Libtool shared library interface versions (current:revision:age)
1.1.1.5 ! misho      20: m4_define(libpcre_version, [3:2:2])
        !            21: m4_define(libpcre16_version, [2:2:2])
        !            22: m4_define(libpcre32_version, [0:2:0])
1.1.1.4   misho      23: m4_define(libpcreposix_version, [0:2:0])
1.1       misho      24: m4_define(libpcrecpp_version, [0:0: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])
1.1.1.2   misho      30: m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
1.1       misho      31: AC_CONFIG_HEADERS(config.h)
                     32: 
1.1.1.4   misho      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: 
1.1       misho      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
1.1.1.4   misho      54: AM_PROG_CC_C_O
1.1       misho      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: 
1.1.1.4   misho      92: # Check for GCC visibility feature
                     93: 
                     94: PCRE_VISIBILITY
                     95: 
                     96: # Versioning
                     97: 
1.1       misho      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: 
1.1.1.2   misho     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: 
1.1.1.4   misho     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: 
1.1       misho     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]),
1.1.1.2   misho     149:               , enable_cpp=unset)
1.1       misho     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],
1.1.1.2   misho     173:                              [another name for --enable-utf. Kept only for compatibility reasons]),
1.1       misho     174:               , enable_utf8=unset)
                    175: 
1.1.1.2   misho     176: # Handle --enable-utf (disabled by default)
                    177: AC_ARG_ENABLE(utf,
                    178:               AS_HELP_STRING([--enable-utf],
1.1.1.4   misho     179:                              [enable UTF-8/16/32 support (incompatible with --enable-ebcdic)]),
1.1.1.2   misho     180:               , enable_utf=unset)
                    181: 
1.1       misho     182: # Handle --enable-unicode-properties
                    183: AC_ARG_ENABLE(unicode-properties,
                    184:               AS_HELP_STRING([--enable-unicode-properties],
1.1.1.2   misho     185:                              [enable Unicode properties support (implies --enable-utf)]),
1.1       misho     186:               , enable_unicode_properties=no)
                    187: 
1.1.1.4   misho     188: # Handle newline options
1.1       misho     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],
1.1.1.2   misho     221:                              [assume EBCDIC coding rather than ASCII; incompatible with --enable-utf; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]),
1.1       misho     222:               , enable_ebcdic=no)
                    223: 
1.1.1.4   misho     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: 
1.1       misho     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)]),
                    252:               , with_pcregrep_bufsize=20480)
                    253: 
1.1.1.3   misho     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: 
1.1       misho     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: 
1.1.1.5 ! misho     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: 
1.1       misho     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: 
1.1.1.4   misho     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: 
1.1.1.2   misho     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: 
1.1.1.4   misho     337: # Set the default value for pcre32
                    338: if test "x$enable_pcre32" = "xunset"
                    339: then
                    340:   enable_pcre32=no
                    341: fi
                    342: 
1.1.1.2   misho     343: # Make sure enable_pcre8 or enable_pcre16 was set
1.1.1.4   misho     344: if test "x$enable_pcre8$enable_pcre16$enable_pcre32" = "xnonono"
1.1.1.2   misho     345: then
1.1.1.4   misho     346:   AC_MSG_ERROR([At least one of 8, 16 or 32 bit pcre library must be enabled])
1.1.1.2   misho     347: fi
                    348: 
                    349: # Make sure that if enable_unicode_properties was set, that UTF support is enabled.
1.1       misho     350: if test "x$enable_unicode_properties" = "xyes"
                    351: then
1.1.1.2   misho     352:   if test "x$enable_utf" = "xno"
1.1       misho     353:   then
1.1.1.4   misho     354:     AC_MSG_ERROR([support for Unicode properties requires UTF-8/16/32 support])
1.1       misho     355:   fi
1.1.1.2   misho     356:   enable_utf=yes
1.1       misho     357: fi
                    358: 
1.1.1.2   misho     359: # enable_utf is disabled by default.
                    360: if test "x$enable_utf" = "xunset"
1.1       misho     361: then
1.1.1.2   misho     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
1.1       misho     378: fi
                    379: 
1.1.1.4   misho     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.
1.1       misho     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: 
1.1.1.4   misho     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: 
1.1       misho     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([
1.1.1.4   misho     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.
1.1       misho     446: 
                    447: Alternatively, you can avoid editing by using -D on the compiler command line
1.1.1.4   misho     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. */])
1.1       misho     461: 
                    462: # Checks for header files.
                    463: AC_HEADER_STDC
                    464: AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h windows.h)
                    465: 
                    466: # The files below are C++ header files.
                    467: pcre_have_type_traits="0"
                    468: pcre_have_bits_type_traits="0"
1.1.1.4   misho     469: 
                    470: if test "x$enable_cpp" = "xyes" -a -z "$CXX"; then
                    471:    AC_MSG_ERROR([You need a C++ compiler for C++ support.])
                    472: fi
                    473: 
1.1       misho     474: if test "x$enable_cpp" = "xyes" -a -n "$CXX"
                    475: then
                    476: AC_LANG_PUSH(C++)
                    477: 
                    478: # Older versions of pcre defined pcrecpp::no_arg, but in new versions
                    479: # it's called pcrecpp::RE::no_arg.  For backwards ABI compatibility,
                    480: # we want to make one an alias for the other.  Different systems do
                    481: # this in different ways.  Some systems, for instance, can do it via
                    482: # a linker flag: -alias (for os x 10.5) or -i (for os x <=10.4).
                    483: OLD_LDFLAGS="$LDFLAGS"
                    484: for flag in "-alias,__ZN7pcrecpp2RE6no_argE,__ZN7pcrecpp6no_argE" \
                    485:             "-i__ZN7pcrecpp6no_argE:__ZN7pcrecpp2RE6no_argE"; do
                    486:   AC_MSG_CHECKING([for alias support in the linker])
                    487:   LDFLAGS="$OLD_LDFLAGS -Wl,$flag"
                    488:   # We try to run the linker with this new ld flag.  If the link fails,
                    489:   # we give up and remove the new flag from LDFLAGS.
                    490:   AC_LINK_IFELSE([AC_LANG_PROGRAM([namespace pcrecpp {
                    491:                                     class RE { static int no_arg; };
                    492:                                     int RE::no_arg;
                    493:                                   }],
                    494:                                  [])],
                    495:                  [AC_MSG_RESULT([yes]);
                    496:                   EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS -Wl,$flag";
                    497:                   break;],
                    498:                  AC_MSG_RESULT([no]))
                    499: done
                    500: LDFLAGS="$OLD_LDFLAGS"
                    501: 
                    502: # We could be more clever here, given we're doing AC_SUBST with this
                    503: # (eg set a var to be the name of the include file we want). But we're not
                    504: # so it's easy to change back to 'regular' autoconf vars if we needed to.
                    505: AC_CHECK_HEADERS(string, [pcre_have_cpp_headers="1"],
                    506:                          [pcre_have_cpp_headers="0"])
                    507: AC_CHECK_HEADERS(bits/type_traits.h, [pcre_have_bits_type_traits="1"],
                    508:                                      [pcre_have_bits_type_traits="0"])
                    509: AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
                    510:                                 [pcre_have_type_traits="0"])
                    511: 
                    512: # (This isn't c++-specific, but is only used in pcrecpp.cc, so try this
                    513: # in a c++ context.  This matters becuase strtoimax is C99 and may not
                    514: # be supported by the C++ compiler.)
                    515: # Figure out how to create a longlong from a string: strtoll and
                    516: # equiv.  It's not enough to call AC_CHECK_FUNCS: hpux has a
                    517: # strtoll, for instance, but it only takes 2 args instead of 3!
                    518: # We have to call AH_TEMPLATE since AC_DEFINE_UNQUOTED below is complex.
                    519: AH_TEMPLATE(HAVE_STRTOQ, [Define to 1 if you have `strtoq'.])
                    520: AH_TEMPLATE(HAVE_STRTOLL, [Define to 1 if you have `strtoll'.])
                    521: AH_TEMPLATE(HAVE__STRTOI64, [Define to 1 if you have `_strtoi64'.])
                    522: AH_TEMPLATE(HAVE_STRTOIMAX, [Define to 1 if you have `strtoimax'.])
                    523: have_strto_fn=0
                    524: for fn in strtoq strtoll _strtoi64 strtoimax; do
                    525:   AC_MSG_CHECKING([for $fn])
                    526:   if test "$fn" = strtoimax; then
                    527:     include=stdint.h
                    528:   else
                    529:     include=stdlib.h
                    530:   fi
                    531:   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <$include>],
                    532:                                     [char* e; return $fn("100", &e, 10)])],
                    533:                     [AC_MSG_RESULT(yes)
                    534:                      AC_DEFINE_UNQUOTED(HAVE_`echo $fn | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`, 1,
                    535:                                         [Define to 1 if you have `$fn'.])
                    536:                      have_strto_fn=1
                    537:                      break],
                    538:                     [AC_MSG_RESULT(no)])
                    539: done
                    540: 
                    541: if test "$have_strto_fn" = 1; then
                    542:   AC_CHECK_TYPES([long long],
                    543:                  [pcre_have_long_long="1"],
                    544:                  [pcre_have_long_long="0"])
                    545:   AC_CHECK_TYPES([unsigned long long],
                    546:                  [pcre_have_ulong_long="1"],
                    547:                  [pcre_have_ulong_long="0"])
                    548: else
                    549:   pcre_have_long_long="0"
                    550:   pcre_have_ulong_long="0"
                    551: fi
                    552: AC_SUBST(pcre_have_long_long)
                    553: AC_SUBST(pcre_have_ulong_long)
                    554: 
                    555: AC_LANG_POP
                    556: fi
                    557: # Using AC_SUBST eliminates the need to include config.h in a public .h file
                    558: AC_SUBST(pcre_have_type_traits)
                    559: AC_SUBST(pcre_have_bits_type_traits)
                    560: 
                    561: # Conditional compilation
1.1.1.2   misho     562: AM_CONDITIONAL(WITH_PCRE8, test "x$enable_pcre8" = "xyes")
                    563: AM_CONDITIONAL(WITH_PCRE16, test "x$enable_pcre16" = "xyes")
1.1.1.4   misho     564: AM_CONDITIONAL(WITH_PCRE32, test "x$enable_pcre32" = "xyes")
1.1       misho     565: AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes")
                    566: AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes")
                    567: AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes")
1.1.1.2   misho     568: AM_CONDITIONAL(WITH_UTF, test "x$enable_utf" = "xyes")
1.1.1.4   misho     569: AM_CONDITIONAL(WITH_VALGRIND, test "x$enable_valgrind" = "xyes")
1.1       misho     570: 
                    571: # Checks for typedefs, structures, and compiler characteristics.
                    572: 
                    573: AC_C_CONST
                    574: AC_TYPE_SIZE_T
                    575: 
                    576: # Checks for library functions.
                    577: 
                    578: AC_CHECK_FUNCS(bcopy memmove strerror)
                    579: 
                    580: # Check for the availability of libz (aka zlib)
                    581: 
                    582: AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1])
                    583: AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1])
                    584: 
                    585: # Check for the availability of libbz2. Originally we just used AC_CHECK_LIB,
                    586: # as for libz. However, this had the following problem, diagnosed and fixed by
                    587: # a user:
                    588: #
                    589: #   - libbz2 uses the Pascal calling convention (WINAPI) for the functions
                    590: #     under Win32.
                    591: #   - The standard autoconf AC_CHECK_LIB fails to include "bzlib.h",
                    592: #     therefore missing the function definition.
                    593: #   - The compiler thus generates a "C" signature for the test function.
                    594: #   - The linker fails to find the "C" function.
                    595: #   - PCRE fails to configure if asked to do so against libbz2.
                    596: #
                    597: # Solution:
                    598: #
                    599: #   - Replace the AC_CHECK_LIB test with a custom test.
                    600: 
                    601: AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1])
                    602: # Original test
                    603: # AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1])
                    604: #
                    605: # Custom test follows
                    606: 
                    607: AC_MSG_CHECKING([for libbz2])
                    608: OLD_LIBS="$LIBS"
                    609: LIBS="$LIBS -lbz2"
                    610: AC_LINK_IFELSE([AC_LANG_PROGRAM([[
                    611: #ifdef HAVE_BZLIB_H
                    612: #include <bzlib.h>
                    613: #endif]],
                    614: [[return (int)BZ2_bzopen("conftest", "rb");]])],
                    615: [AC_MSG_RESULT([yes]);HAVE_LIBBZ2=1; break;],
                    616: AC_MSG_RESULT([no]))
                    617: LIBS="$OLD_LIBS"
                    618: 
                    619: # Check for the availabiity of libreadline
                    620: 
1.1.1.3   misho     621: if test "$enable_pcretest_libreadline" = "yes"; then
                    622:  AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1])
                    623:  AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1])
                    624:  AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lreadline"],
                    625:    [unset ac_cv_lib_readline_readline;
                    626:     AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltinfo"],
                    627:      [unset ac_cv_lib_readline_readline;
                    628:       AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lcurses"],
                    629:        [unset ac_cv_lib_readline_readline;
                    630:         AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"],
                    631:          [unset ac_cv_lib_readline_readline;
                    632:          AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"],
                    633:            [unset ac_cv_lib_readline_readline;
                    634:            AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"],
                    635:              [LIBREADLINE=""],
                    636:              [-ltermcap])],
                    637:            [-lncursesw])],
                    638:          [-lncurses])],
                    639:        [-lcurses])],
                    640:      [-ltinfo])])
                    641:  AC_SUBST(LIBREADLINE)
                    642:  if test -n "$LIBREADLINE"; then
                    643:    if test "$LIBREADLINE" != "-lreadline"; then
                    644:      echo "-lreadline needs $LIBREADLINE"
                    645:      LIBREADLINE="-lreadline $LIBREADLINE"
                    646:    fi
                    647:  fi
                    648: fi
                    649: 
                    650: 
                    651: # Check for the availability of libedit. Different distributions put its
                    652: # headers in different places. Try to cover the most common ones.
                    653: 
                    654: if test "$enable_pcretest_libedit" = "yes"; then
                    655:   AC_CHECK_HEADERS([editline/readline.h], [HAVE_EDITLINE_READLINE_H=1],
                    656:     [AC_CHECK_HEADERS([edit/readline/readline.h], [HAVE_READLINE_READLINE_H=1],
                    657:       [AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_READLINE_H=1])])])
                    658:   AC_CHECK_LIB([edit], [readline], [LIBEDIT="-ledit"])
1.1.1.2   misho     659: fi
1.1       misho     660: 
                    661: # This facilitates -ansi builds under Linux
                    662: dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc])
                    663: 
                    664: PCRE_STATIC_CFLAG=""
                    665: if test "x$enable_shared" = "xno" ; then
                    666:   AC_DEFINE([PCRE_STATIC], [1], [
1.1.1.4   misho     667:     Define to any value if linking statically (TODO: make nice with Libtool)])
1.1       misho     668:   PCRE_STATIC_CFLAG="-DPCRE_STATIC"
                    669: fi
                    670: AC_SUBST(PCRE_STATIC_CFLAG)
                    671: 
                    672: # Here is where pcre specific defines are handled
                    673: 
1.1.1.2   misho     674: if test "$enable_pcre8" = "yes"; then
                    675:   AC_DEFINE([SUPPORT_PCRE8], [], [
1.1.1.4   misho     676:     Define to any value to enable the 8 bit PCRE library.])
1.1.1.2   misho     677: fi
                    678: 
                    679: if test "$enable_pcre16" = "yes"; then
                    680:   AC_DEFINE([SUPPORT_PCRE16], [], [
1.1.1.4   misho     681:     Define to any value to enable the 16 bit PCRE library.])
                    682: fi
                    683: 
                    684: if test "$enable_pcre32" = "yes"; then
                    685:   AC_DEFINE([SUPPORT_PCRE32], [], [
                    686:     Define to any value to enable the 32 bit PCRE library.])
1.1.1.2   misho     687: fi
                    688: 
1.1       misho     689: if test "$enable_jit" = "yes"; then
1.1.1.4   misho     690:   AX_PTHREAD([], [AC_MSG_ERROR([JIT support requires pthreads])])
                    691:   CC="$PTHREAD_CC"
                    692:   CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
                    693:   LIBS="$PTHREAD_LIBS $LIBS"
1.1       misho     694:   AC_DEFINE([SUPPORT_JIT], [], [
1.1.1.4   misho     695:     Define to any value to enable support for Just-In-Time compiling.])
1.1       misho     696: else
                    697:   enable_pcregrep_jit="no"
                    698: fi
                    699: 
                    700: if test "$enable_pcregrep_jit" = "yes"; then
                    701:   AC_DEFINE([SUPPORT_PCREGREP_JIT], [], [
1.1.1.4   misho     702:     Define to any value to enable JIT support in pcregrep.])
1.1       misho     703: fi
                    704: 
1.1.1.2   misho     705: if test "$enable_utf" = "yes"; then
                    706:   AC_DEFINE([SUPPORT_UTF], [], [
1.1.1.4   misho     707:     Define to any value to enable support for the UTF-8/16/32 Unicode encoding.
                    708:     This will work even in an EBCDIC environment, but it is incompatible
1.1.1.2   misho     709:     with the EBCDIC macro. That is, PCRE can support *either* EBCDIC
1.1.1.4   misho     710:     code *or* ASCII/UTF-8/16/32, but not both at once.])
1.1       misho     711: fi
                    712: 
                    713: if test "$enable_unicode_properties" = "yes"; then
                    714:   AC_DEFINE([SUPPORT_UCP], [], [
1.1.1.4   misho     715:     Define to any value to enable support for Unicode properties.])
1.1       misho     716: fi
                    717: 
                    718: if test "$enable_stack_for_recursion" = "no"; then
                    719:   AC_DEFINE([NO_RECURSE], [], [
                    720:     PCRE uses recursive function calls to handle backtracking while
                    721:     matching. This can sometimes be a problem on systems that have
1.1.1.4   misho     722:     stacks of limited size. Define NO_RECURSE to any value to get a
                    723:     version that doesn't use recursion in the match() function; instead
                    724:     it creates its own stack by steam using pcre_recurse_malloc() to obtain
                    725:     memory from the heap. For more detail, see the comments and other stuff
                    726:     just above the match() function.])
1.1       misho     727: fi
                    728: 
                    729: if test "$enable_pcregrep_libz" = "yes"; then
                    730:   AC_DEFINE([SUPPORT_LIBZ], [], [
1.1.1.4   misho     731:     Define to any value to allow pcregrep to be linked with libz, so that it is
1.1       misho     732:     able to handle .gz files.])
                    733: fi
                    734: 
                    735: if test "$enable_pcregrep_libbz2" = "yes"; then
                    736:   AC_DEFINE([SUPPORT_LIBBZ2], [], [
1.1.1.4   misho     737:     Define to any value to allow pcregrep to be linked with libbz2, so that it
                    738:     is able to handle .bz2 files.])
1.1       misho     739: fi
                    740: 
                    741: if test $with_pcregrep_bufsize -lt 8192 ; then
                    742:   with_pcregrep_bufsize="8192"
                    743: fi
                    744: 
                    745: AC_DEFINE_UNQUOTED([PCREGREP_BUFSIZE], [$with_pcregrep_bufsize], [
1.1.1.4   misho     746:   The value of PCREGREP_BUFSIZE determines the size of buffer used by pcregrep
                    747:   to hold parts of the file it is searching. This is also the minimum value.
                    748:   The actual amount of memory used by pcregrep is three times this number,
                    749:   because it allows for the buffering of "before" and "after" lines.])
1.1       misho     750: 
1.1.1.3   misho     751: if test "$enable_pcretest_libedit" = "yes"; then
                    752:   AC_DEFINE([SUPPORT_LIBEDIT], [], [
1.1.1.4   misho     753:     Define to any value to allow pcretest to be linked with libedit.])
1.1.1.3   misho     754:   LIBREADLINE="$LIBEDIT"
                    755: elif test "$enable_pcretest_libreadline" = "yes"; then
1.1       misho     756:   AC_DEFINE([SUPPORT_LIBREADLINE], [], [
1.1.1.4   misho     757:     Define to any value to allow pcretest to be linked with libreadline.])
1.1       misho     758: fi
                    759: 
                    760: AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline_value], [
1.1.1.4   misho     761:   The value of NEWLINE determines the default newline character sequence. PCRE
                    762:   client programs can override this by selecting other values at run time. In
                    763:   ASCII environments, the value can be 10 (LF), 13 (CR), or 3338 (CRLF); in
                    764:   EBCDIC environments the value can be 21 or 37 (LF), 13 (CR), or 3349 or 3365
                    765:   (CRLF) because there are two alternative codepoints (0x15 and 0x25) that are
                    766:   used as the NL line terminator that is equivalent to ASCII LF. In both ASCII
                    767:   and EBCDIC environments the value can also be -1 (ANY), or -2 (ANYCRLF).])
1.1       misho     768: 
                    769: if test "$enable_bsr_anycrlf" = "yes"; then
                    770:   AC_DEFINE([BSR_ANYCRLF], [], [
                    771:     By default, the \R escape sequence matches any Unicode line ending
1.1.1.4   misho     772:     character or sequence of characters. If BSR_ANYCRLF is defined (to any
                    773:     value), this is changed so that backslash-R matches only CR, LF, or CRLF.
                    774:     The build-time default can be overridden by the user of PCRE at runtime.])
1.1       misho     775: fi
                    776: 
                    777: AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [
                    778:   The value of LINK_SIZE determines the number of bytes used to store
                    779:   links as offsets within the compiled regex. The default is 2, which
                    780:   allows for compiled patterns up to 64K long. This covers the vast
                    781:   majority of cases. However, PCRE can also be compiled to use 3 or 4
1.1.1.4   misho     782:   bytes instead. This allows for longer patterns in extreme cases.])
1.1       misho     783: 
                    784: AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$with_posix_malloc_threshold], [
                    785:   When calling PCRE via the POSIX interface, additional working storage
                    786:   is required for holding the pointers to capturing substrings because
                    787:   PCRE requires three integers per substring, whereas the POSIX
                    788:   interface provides only two. If the number of expected substrings is
                    789:   small, the wrapper function uses space on the stack, because this is
                    790:   faster than using malloc() for each call. The threshold above which
1.1.1.4   misho     791:   the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD.])
1.1       misho     792: 
1.1.1.5 ! misho     793: AC_DEFINE_UNQUOTED([PARENS_NEST_LIMIT], [$with_parens_nest_limit], [
        !           794:   The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
        !           795:   parentheses (of any kind) in a pattern. This limits the amount of system
        !           796:   stack that is used while compiling a pattern.])
        !           797: 
1.1       misho     798: AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [
                    799:   The value of MATCH_LIMIT determines the default number of times the
                    800:   internal match() function can be called during a single execution of
                    801:   pcre_exec(). There is a runtime interface for setting a different
                    802:   limit. The limit exists in order to catch runaway regular
                    803:   expressions that take for ever to determine that they do not match.
                    804:   The default is set very large so that it does not accidentally catch
1.1.1.4   misho     805:   legitimate cases.])
1.1       misho     806: 
                    807: AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSION], [$with_match_limit_recursion], [
                    808:   The above limit applies to all calls of match(), whether or not they
                    809:   increase the recursion depth. In some environments it is desirable
                    810:   to limit the depth of recursive calls of match() more strictly, in
                    811:   order to restrict the maximum amount of stack (or heap, if
                    812:   NO_RECURSE is defined) that is used. The value of
                    813:   MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To
                    814:   have any useful effect, it must be less than the value of
                    815:   MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT.
1.1.1.4   misho     816:   There is a runtime method for setting a different limit.])
1.1       misho     817: 
                    818: AC_DEFINE([MAX_NAME_SIZE], [32], [
                    819:   This limit is parameterized just in case anybody ever wants to
                    820:   change it. Care must be taken if it is increased, because it guards
                    821:   against integer overflow caused by enormously large patterns.])
                    822: 
                    823: AC_DEFINE([MAX_NAME_COUNT], [10000], [
                    824:   This limit is parameterized just in case anybody ever wants to
                    825:   change it. Care must be taken if it is increased, because it guards
                    826:   against integer overflow caused by enormously large patterns.])
                    827: 
                    828: AH_VERBATIM([PCRE_EXP_DEFN], [
                    829: /* If you are compiling for a system other than a Unix-like system or
                    830:    Win32, and it needs some magic to be inserted before the definition
                    831:    of a function that is exported by the library, define this macro to
1.1.1.4   misho     832:    contain the relevant magic. If you do not define this macro, a suitable
                    833:     __declspec value is used for Windows systems; in other environments
                    834:    "extern" is used for a C compiler and "extern C" for a C++ compiler.
                    835:    This macro apears at the start of every exported function that is part
                    836:    of the external API. It does not appear on functions that are "external"
                    837:    in the C sense, but which are internal to the library. */
1.1       misho     838: #undef PCRE_EXP_DEFN])
                    839: 
                    840: if test "$enable_ebcdic" = "yes"; then
                    841:   AC_DEFINE_UNQUOTED([EBCDIC], [], [
                    842:     If you are compiling for a system that uses EBCDIC instead of ASCII
1.1.1.4   misho     843:     character codes, define this macro to any value. You must also edit the
                    844:     NEWLINE macro below to set a suitable EBCDIC newline, commonly 21 (0x15).
                    845:     On systems that can use "configure" or CMake to set EBCDIC, NEWLINE is
                    846:     automatically adjusted. When EBCDIC is set, PCRE assumes that all input
                    847:     strings are in EBCDIC. If you do not define this macro, PCRE will assume
                    848:     input strings are ASCII or UTF-8/16/32 Unicode. It is not possible to build
                    849:     a version of PCRE that supports both EBCDIC and UTF-8/16/32.])
                    850: fi
                    851: 
                    852: if test "$enable_ebcdic_nl25" = "yes"; then
                    853:   AC_DEFINE_UNQUOTED([EBCDIC_NL25], [], [
                    854:     In an EBCDIC environment, define this macro to any value to arrange for
                    855:     the NL character to be 0x25 instead of the default 0x15. NL plays the role
                    856:     that LF does in an ASCII/Unicode environment. The value must also be set in
                    857:     the NEWLINE macro below. On systems that can use "configure" or CMake to
                    858:     set EBCDIC_NL25, the adjustment of NEWLINE is automatic.])
                    859: fi
                    860: 
                    861: if test "$enable_valgrind" = "yes"; then
                    862:   AC_DEFINE_UNQUOTED([SUPPORT_VALGRIND], [], [
                    863:      Define to any value for valgrind support to find invalid memory reads.])
1.1       misho     864: fi
                    865: 
                    866: # Platform specific issues
                    867: NO_UNDEFINED=
                    868: EXPORT_ALL_SYMBOLS=
                    869: case $host_os in
                    870:   cygwin* | mingw* )
                    871:     if test X"$enable_shared" = Xyes; then
                    872:       NO_UNDEFINED="-no-undefined"
                    873:       EXPORT_ALL_SYMBOLS="-Wl,--export-all-symbols"
                    874:     fi
                    875:     ;;
                    876: esac
                    877: 
                    878: # The extra LDFLAGS for each particular library
                    879: # (Note: The libpcre*_version bits are m4 variables, assigned above)
                    880: 
                    881: EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS \
                    882:                        $NO_UNDEFINED -version-info libpcre_version"
                    883: 
1.1.1.2   misho     884: EXTRA_LIBPCRE16_LDFLAGS="$EXTRA_LIBPCRE16_LDFLAGS \
                    885:                        $NO_UNDEFINED -version-info libpcre16_version"
                    886: 
1.1.1.4   misho     887: EXTRA_LIBPCRE32_LDFLAGS="$EXTRA_LIBPCRE32_LDFLAGS \
                    888:                        $NO_UNDEFINED -version-info libpcre32_version"
                    889: 
1.1       misho     890: EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS \
                    891:                             $NO_UNDEFINED -version-info libpcreposix_version"
                    892: 
                    893: EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS \
                    894:                           $NO_UNDEFINED -version-info libpcrecpp_version \
                    895:                           $EXPORT_ALL_SYMBOLS"
                    896: 
                    897: AC_SUBST(EXTRA_LIBPCRE_LDFLAGS)
1.1.1.2   misho     898: AC_SUBST(EXTRA_LIBPCRE16_LDFLAGS)
1.1.1.4   misho     899: AC_SUBST(EXTRA_LIBPCRE32_LDFLAGS)
1.1       misho     900: AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS)
                    901: AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS)
                    902: 
1.1.1.2   misho     903: # When we run 'make distcheck', use these arguments. Turning off compiler
                    904: # optimization makes it run faster.
1.1.1.4   misho     905: DISTCHECK_CONFIGURE_FLAGS="CFLAGS='' CXXFLAGS='' --enable-pcre16 --enable-pcre32 --enable-jit --enable-cpp --enable-unicode-properties"
1.1       misho     906: AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
                    907: 
                    908: # Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is
                    909: # specified, the relevant library is available.
                    910: 
                    911: if test "$enable_pcregrep_libz" = "yes"; then
                    912:   if test "$HAVE_ZLIB_H" != "1"; then
                    913:     echo "** Cannot --enable-pcregrep-libz because zlib.h was not found"
                    914:     exit 1
                    915:   fi
                    916:   if test "$HAVE_LIBZ" != "1"; then
                    917:     echo "** Cannot --enable-pcregrep-libz because libz was not found"
                    918:     exit 1
                    919:   fi
                    920:   LIBZ="-lz"
                    921: fi
                    922: AC_SUBST(LIBZ)
                    923: 
                    924: if test "$enable_pcregrep_libbz2" = "yes"; then
                    925:   if test "$HAVE_BZLIB_H" != "1"; then
                    926:     echo "** Cannot --enable-pcregrep-libbz2 because bzlib.h was not found"
                    927:     exit 1
                    928:   fi
                    929:   if test "$HAVE_LIBBZ2" != "1"; then
                    930:     echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found"
                    931:     exit 1
                    932:   fi
                    933:   LIBBZ2="-lbz2"
                    934: fi
                    935: AC_SUBST(LIBBZ2)
                    936: 
                    937: # Similarly for --enable-pcretest-readline
                    938: 
1.1.1.3   misho     939: if test "$enable_pcretest_libedit" = "yes"; then
                    940:   if test "$enable_pcretest_libreadline" = "yes"; then
                    941:     echo "** Cannot use both --enable-pcretest-libedit and --enable-pcretest-readline"
                    942:     exit 1
                    943:   fi
                    944:   if test "$HAVE_EDITLINE_READLINE_H" != "1" -a \
                    945:           "$HAVE_READLINE_READLINE_H" != "1"; then
                    946:     echo "** Cannot --enable-pcretest-libedit because neither editline/readline.h"
                    947:     echo "** nor readline/readline.h was found."
                    948:     exit 1
                    949:   fi
                    950:   if test -z "$LIBEDIT"; then
                    951:     echo "** Cannot --enable-pcretest-libedit because libedit library was not found."
                    952:     exit 1
                    953:   fi
                    954: fi
                    955: 
1.1       misho     956: if test "$enable_pcretest_libreadline" = "yes"; then
                    957:   if test "$HAVE_READLINE_H" != "1"; then
                    958:     echo "** Cannot --enable-pcretest-readline because readline/readline.h was not found."
                    959:     exit 1
                    960:   fi
                    961:   if test "$HAVE_HISTORY_H" != "1"; then
                    962:     echo "** Cannot --enable-pcretest-readline because readline/history.h was not found."
                    963:     exit 1
                    964:   fi
1.1.1.2   misho     965:   if test -z "$LIBREADLINE"; then
                    966:     echo "** Cannot --enable-pcretest-readline because readline library was not found."
                    967:     exit 1
                    968:   fi
1.1       misho     969: fi
                    970: 
1.1.1.5 ! misho     971: # Handle valgrind support
1.1.1.4   misho     972: 
                    973: if test "$enable_valgrind" = "yes"; then
                    974:   m4_ifdef([PKG_CHECK_MODULES],
                    975:            [PKG_CHECK_MODULES([VALGRIND],[valgrind])],
                    976:            [AC_MSG_ERROR([pkg-config not supported])])
                    977: fi
                    978: 
1.1.1.5 ! misho     979: # Handle code coverage reporting support
1.1.1.4   misho     980: if test "$enable_coverage" = "yes"; then
                    981:   if test "x$GCC" != "xyes"; then
                    982:     AC_MSG_ERROR([Code coverage reports can only be generated when using GCC])
                    983:   fi
                    984: 
                    985:   # ccache is incompatible with gcov
                    986:   AC_PATH_PROG([SHTOOL],[shtool],[false])
                    987:   case `$SHTOOL path $CC` in
                    988:     *ccache*) cc_ccache=yes;;
                    989:     *) cc_ccache=no;;
                    990:   esac
                    991: 
                    992:   if test "$cc_ccache" = "yes"; then
                    993:     if test -z "$CCACHE_DISABLE" -o "$CCACHE_DISABLE" != "1"; then
                    994:       AC_MSG_ERROR([must export CCACHE_DISABLE=1 to disable ccache for code coverage])
                    995:     fi
                    996:   fi
                    997: 
                    998:   AC_ARG_VAR([LCOV],[the ltp lcov program])
                    999:   AC_PATH_PROG([LCOV],[lcov],[false])
                   1000:   if test "x$LCOV" = "xfalse"; then
                   1001:     AC_MSG_ERROR([lcov not found])
                   1002:   fi
                   1003: 
                   1004:   AC_ARG_VAR([GENHTML],[the ltp genhtml program])
                   1005:   AC_PATH_PROG([GENHTML],[genhtml],[false])
                   1006:   if test "x$GENHTML" = "xfalse"; then
                   1007:     AC_MSG_ERROR([genhtml not found])
                   1008:   fi
                   1009: 
1.1.1.5 ! misho    1010:   # Set flags needed for gcov
1.1.1.4   misho    1011:   GCOV_CFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
                   1012:   GCOV_CXXFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
                   1013:   GCOV_LIBS="-lgcov"
                   1014:   AC_SUBST([GCOV_CFLAGS])
                   1015:   AC_SUBST([GCOV_CXXFLAGS])
                   1016:   AC_SUBST([GCOV_LIBS])
                   1017: fi # enable_coverage
                   1018: 
                   1019: AM_CONDITIONAL([WITH_GCOV],[test "x$enable_coverage" = "xyes"])
                   1020: 
1.1       misho    1021: # Produce these files, in addition to config.h.
                   1022: AC_CONFIG_FILES(
                   1023:        Makefile
                   1024:        libpcre.pc
1.1.1.2   misho    1025:        libpcre16.pc
1.1.1.4   misho    1026:        libpcre32.pc
1.1.1.2   misho    1027:        libpcreposix.pc
1.1       misho    1028:        libpcrecpp.pc
                   1029:        pcre-config
                   1030:        pcre.h
                   1031:        pcre_stringpiece.h
                   1032:        pcrecpparg.h
                   1033: )
                   1034: 
                   1035: # Make the generated script files executable.
                   1036: AC_CONFIG_COMMANDS([script-chmod], [chmod a+x pcre-config])
                   1037: 
                   1038: # Make sure that pcre_chartables.c is removed in case the method for
                   1039: # creating it was changed by reconfiguration.
                   1040: AC_CONFIG_COMMANDS([delete-old-chartables], [rm -f pcre_chartables.c])
                   1041: 
                   1042: AC_OUTPUT
                   1043: 
1.1.1.4   misho    1044: # Print out a nice little message after configure is run displaying the
1.1       misho    1045: # chosen options.
                   1046: 
1.1.1.4   misho    1047: ebcdic_nl_code=n/a
                   1048: if test "$enable_ebcdic_nl25" = "yes"; then
                   1049:   ebcdic_nl_code=0x25
                   1050: elif test "$enable_ebcdic" = "yes"; then
                   1051:   ebcdic_nl_code=0x15
                   1052: fi
                   1053: 
1.1       misho    1054: cat <<EOF
                   1055: 
                   1056: $PACKAGE-$VERSION configuration summary:
                   1057: 
                   1058:     Install prefix .................. : ${prefix}
                   1059:     C preprocessor .................. : ${CPP}
                   1060:     C compiler ...................... : ${CC}
                   1061:     C++ preprocessor ................ : ${CXXCPP}
                   1062:     C++ compiler .................... : ${CXX}
                   1063:     Linker .......................... : ${LD}
                   1064:     C preprocessor flags ............ : ${CPPFLAGS}
1.1.1.4   misho    1065:     C compiler flags ................ : ${CFLAGS} ${VISIBILITY_CFLAGS}
                   1066:     C++ compiler flags .............. : ${CXXFLAGS} ${VISIBILITY_CXXFLAGS}
1.1       misho    1067:     Linker flags .................... : ${LDFLAGS}
                   1068:     Extra libraries ................. : ${LIBS}
                   1069: 
1.1.1.2   misho    1070:     Build 8 bit pcre library ........ : ${enable_pcre8}
                   1071:     Build 16 bit pcre library ....... : ${enable_pcre16}
1.1.1.4   misho    1072:     Build 32 bit pcre library ....... : ${enable_pcre32}
1.1       misho    1073:     Build C++ library ............... : ${enable_cpp}
                   1074:     Enable JIT compiling support .... : ${enable_jit}
1.1.1.4   misho    1075:     Enable UTF-8/16/32 support ...... : ${enable_utf}
1.1       misho    1076:     Unicode properties .............. : ${enable_unicode_properties}
                   1077:     Newline char/sequence ........... : ${enable_newline}
                   1078:     \R matches only ANYCRLF ......... : ${enable_bsr_anycrlf}
                   1079:     EBCDIC coding ................... : ${enable_ebcdic}
1.1.1.4   misho    1080:     EBCDIC code for NL .............. : ${ebcdic_nl_code}
1.1       misho    1081:     Rebuild char tables ............. : ${enable_rebuild_chartables}
                   1082:     Use stack recursion ............. : ${enable_stack_for_recursion}
                   1083:     POSIX mem threshold ............. : ${with_posix_malloc_threshold}
                   1084:     Internal link size .............. : ${with_link_size}
1.1.1.5 ! misho    1085:     Nested parentheses limit ........ : ${with_parens_nest_limit}
1.1       misho    1086:     Match limit ..................... : ${with_match_limit}
                   1087:     Match limit recursion ........... : ${with_match_limit_recursion}
                   1088:     Build shared libs ............... : ${enable_shared}
                   1089:     Build static libs ............... : ${enable_static}
                   1090:     Use JIT in pcregrep ............. : ${enable_pcregrep_jit}
                   1091:     Buffer size for pcregrep ........ : ${with_pcregrep_bufsize}
                   1092:     Link pcregrep with libz ......... : ${enable_pcregrep_libz}
                   1093:     Link pcregrep with libbz2 ....... : ${enable_pcregrep_libbz2}
1.1.1.3   misho    1094:     Link pcretest with libedit ...... : ${enable_pcretest_libedit}
1.1       misho    1095:     Link pcretest with libreadline .. : ${enable_pcretest_libreadline}
1.1.1.4   misho    1096:     Valgrind support ................ : ${enable_valgrind}
                   1097:     Code coverage ................... : ${enable_coverage}
1.1       misho    1098: 
                   1099: EOF
                   1100: 
                   1101: dnl end configure.ac

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>