--- code/trunk/configure.ac 2007/05/02 10:27:18 159 +++ code/trunk/configure.ac 2008/01/28 15:27:45 319 @@ -7,9 +7,9 @@ dnl empty. m4_define(pcre_major, [7]) -m4_define(pcre_minor, [2]) -m4_define(pcre_prerelease, [-RC1]) -m4_define(pcre_date, [2007-05-02]) +m4_define(pcre_minor, [6]) +m4_define(pcre_prerelease, []) +m4_define(pcre_date, [2008-01-28]) # Libtool shared library interface versions (current:revision:age) m4_define(libpcre_version, [0:1:0]) @@ -136,10 +136,16 @@ ac_pcre_newline=any) enable_newline="$ac_pcre_newline" +# Handle --enable-bsr-anycrlf +AC_ARG_ENABLE(bsr-anycrlf, + AS_HELP_STRING([--enable-bsr-anycrlf], + [\R matches only CR, LF, CRLF by default]), + , enable_bsr_anycrlf=no) + # Handle --enable-ebcdic AC_ARG_ENABLE(ebcdic, AS_HELP_STRING([--enable-ebcdic], - [assume EBCDIC coding rather than ASCII (implies --enable-rebuild-chartables)]), + [assume EBCDIC coding rather than ASCII; use this only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]), , enable_ebcdic=no) # Handle --disable-stack-for-recursion @@ -148,6 +154,24 @@ [don't use stack recursion when matching]), , enable_stack_for_recursion=yes) +# Handle --enable-pcregrep-libz +AC_ARG_ENABLE(pcregrep-libz, + AS_HELP_STRING([--enable-pcregrep-libz], + [link pcregrep with libz to handle .gz files]), + , enable_pcregrep_libz=no) + +# Handle --enable-pcregrep-libbz2 +AC_ARG_ENABLE(pcregrep-libbz2, + AS_HELP_STRING([--enable-pcregrep-libbz2], + [link pcregrep with libbz2 to handle .bz2 files]), + , enable_pcregrep_libbz2=no) + +# Handle --enable-pcretest-libreadline +AC_ARG_ENABLE(pcretest-libreadline, + AS_HELP_STRING([--enable-pcretest-libreadline], + [link pcretest with libreadline]), + , enable_pcretest_libreadline=no) + # Handle --with-posix-malloc-threshold=NBYTES AC_ARG_WITH(posix-malloc-threshold, AS_HELP_STRING([--with-posix-malloc-threshold=NBYTES], @@ -231,8 +255,12 @@ If you are going to build PCRE "by hand" on a system without "configure" you should copy the distributed config.h.generic to config.h, and then set up the -macros the way you need them. Alternatively, you can avoid editing by using -D -on the compiler command line to set the macro values. +macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to +all of your compile commands, so that config.h is included at the start of +every source. + +Alternatively, you can avoid editing by using -D on the compiler command line +to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H. PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set @@ -284,7 +312,23 @@ # Checks for library functions. -AC_CHECK_FUNCS(bcopy memmove strerror strtoq strtoll) +AC_CHECK_FUNCS(bcopy memmove strerror strtoq strtoll _strtoi64) + +# Check for the availability of libz (aka zlib) + +AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1]) +AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1]) + +# Check for the availability of libbz2 + +AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1]) +AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1]) + +# Check for the availabiity of libreadline + +AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1]) +AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1]) +AC_CHECK_LIB([readline], [readline], [HAVE_LIB_READLINE=1]) # This facilitates -ansi builds under Linux dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc]) @@ -319,11 +363,38 @@ (use --disable-stack-for-recursion).]) fi +if test "$enable_pcregrep_libz" = "yes"; then + AC_DEFINE([SUPPORT_LIBZ], [], [ + Define to allow pcregrep to be linked with libz, so that it is + able to handle .gz files.]) +fi + +if test "$enable_pcregrep_libbz2" = "yes"; then + AC_DEFINE([SUPPORT_LIBBZ2], [], [ + Define to allow pcregrep to be linked with libbz2, so that it is + able to handle .bz2 files.]) +fi + +if test "$enable_pcretest_libreadline" = "yes"; then + AC_DEFINE([SUPPORT_LIBREADLINE], [], [ + Define to allow pcretest to be linked with libreadline.]) +fi + AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline_value], [ The value of NEWLINE determines the newline character sequence. On - Unix-like systems, "configure" can be used to override the default, - which is 10. The possible values are 10 (LF), 13 (CR), 3338 (CRLF), - -1 (ANY), or -2 (ANYCRLF).]) + systems that support it, "configure" can be used to override the + default, which is 10. The possible values are 10 (LF), 13 (CR), + 3338 (CRLF), -1 (ANY), or -2 (ANYCRLF).]) + +if test "$enable_bsr_anycrlf" = "yes"; then + AC_DEFINE([BSR_ANYCRLF], [], [ + By default, the \R escape sequence matches any Unicode line ending + character or sequence of characters. If BSR_ANYCRLF is defined, this is + changed so that backslash-R matches only CR, LF, or CRLF. The build- + time default can be overridden by the user of PCRE at runtime. On + systems that support it, "configure" can be used to override the + default.]) +fi AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [ The value of LINK_SIZE determines the number of bytes used to store @@ -376,11 +447,6 @@ change it. Care must be taken if it is increased, because it guards against integer overflow caused by enormously large patterns.]) -AC_DEFINE([MAX_DUPLENGTH], [30000], [ - This limit is parameterized just in case anybody ever wants to - change it. Care must be taken if it is increased, because it guards - against integer overflow caused by enormously large patterns.]) - AH_VERBATIM([PCRE_EXP_DEFN], [ /* If you are compiling for a system other than a Unix-like system or Win32, and it needs some magic to be inserted before the definition @@ -429,6 +495,47 @@ DISTCHECK_CONFIGURE_FLAGS="--enable-cpp --enable-unicode-properties" AC_SUBST(DISTCHECK_CONFIGURE_FLAGS) +# Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is +# specified, the relevant library is available. If so, add it to LIBS. + +if test "$enable_pcregrep_libz" = "yes"; then + if test "$HAVE_ZLIB_H" != "1"; then + echo "** Cannot --enable-pcregrep-libz because zlib.h was not found" + exit 1 + fi + if test "$HAVE_LIBZ" != "1"; then + echo "** Cannot --enable-pcregrep-libz because libz was not found" + exit 1 + fi + if test "$LIBS" = ""; then LIBS=-lz; else LIBS="$LIBS -lz"; fi +fi + +if test "$enable_pcregrep_libbz2" = "yes"; then + if test "$HAVE_BZLIB_H" != "1"; then + echo "** Cannot --enable-pcregrep-libbz2 because bzlib.h was not found" + exit 1 + fi + if test "$HAVE_LIBBZ2" != "1"; then + echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found" + exit 1 + fi + if test "$LIBS" = ""; then LIBS=-lbz2; else LIBS="$LIBS -lbz2"; fi +fi + +# Similarly for --enable-pcretest-readline + +if test "$enable_pcretest_libreadline" = "yes"; then + if test "$HAVE_READLINE_H" != "1"; then + echo "** Cannot --enable-pcretest-readline because readline/readline.h was not found." + exit 1 + fi + if test "$HAVE_HISTORY_H" != "1"; then + echo "** Cannot --enable-pcretest-readline because readline/history.h was not found." + exit 1 + fi + if test "$LIBS" = ""; then LIBS=-lreadline; else LIBS="$LIBS -lreadline"; fi +fi + # Produce these files, in addition to config.h. AC_CONFIG_FILES( Makefile @@ -451,36 +558,40 @@ # Print out a nice little message after configure is run displaying your # chosen options. -# + cat <