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

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

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