--- embedaddon/pcre/configure.ac 2012/02/21 23:05:51 1.1 +++ embedaddon/pcre/configure.ac 2012/10/09 09:19:17 1.1.1.3 @@ -9,19 +9,24 @@ dnl The PCRE_PRERELEASE feature is for identifying rel dnl be defined as -RC2, for example. For real releases, it should be empty. m4_define(pcre_major, [8]) -m4_define(pcre_minor, [21]) +m4_define(pcre_minor, [31]) m4_define(pcre_prerelease, []) -m4_define(pcre_date, [2011-12-12]) +m4_define(pcre_date, [2012-07-06]) +# NOTE: The CMakeLists.txt file searches for the above variables in the first +# 50 lines of this file. Please update that if the variables above are moved. + # Libtool shared library interface versions (current:revision:age) -m4_define(libpcre_version, [0:1:0]) -m4_define(libpcreposix_version, [0:0:0]) +m4_define(libpcre_version, [1:1:0]) +m4_define(libpcre16_version, [0:1:0]) +m4_define(libpcreposix_version, [0:1:0]) m4_define(libpcrecpp_version, [0:0:0]) AC_PREREQ(2.57) AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre) AC_CONFIG_SRCDIR([pcre.h.in]) AM_INIT_AUTOMAKE([dist-bzip2 dist-zip]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_HEADERS(config.h) # This was added at the suggestion of libtoolize (03-Jan-10) @@ -104,12 +109,26 @@ then htmldir='${docdir}/html' fi +# Handle --disable-pcre8 (enabled by default) +AC_ARG_ENABLE(pcre8, + AS_HELP_STRING([--disable-pcre8], + [disable 8 bit character support]), + , enable_pcre8=unset) +AC_SUBST(enable_pcre8) + +# Handle --enable-pcre16 (disabled by default) +AC_ARG_ENABLE(pcre16, + AS_HELP_STRING([--enable-pcre16], + [enable 16 bit character support]), + , enable_pcre16=unset) +AC_SUBST(enable_pcre16) + # Handle --disable-cpp. The substitution of enable_cpp is needed for use in # pcre-config. AC_ARG_ENABLE(cpp, AS_HELP_STRING([--disable-cpp], [disable C++ support]), - , enable_cpp=yes) + , enable_cpp=unset) AC_SUBST(enable_cpp) # Handle --enable-jit (disabled by default) @@ -133,13 +152,19 @@ AC_ARG_ENABLE(rebuild-chartables, # Handle --enable-utf8 (disabled by default) AC_ARG_ENABLE(utf8, AS_HELP_STRING([--enable-utf8], - [enable UTF-8 support (incompatible with --enable-ebcdic)]), + [another name for --enable-utf. Kept only for compatibility reasons]), , enable_utf8=unset) +# Handle --enable-utf (disabled by default) +AC_ARG_ENABLE(utf, + AS_HELP_STRING([--enable-utf], + [enable UTF-8/16 support (incompatible with --enable-ebcdic)]), + , enable_utf=unset) + # Handle --enable-unicode-properties AC_ARG_ENABLE(unicode-properties, AS_HELP_STRING([--enable-unicode-properties], - [enable Unicode properties support (implies --enable-utf8)]), + [enable Unicode properties support (implies --enable-utf)]), , enable_unicode_properties=no) # Handle --enable-newline=NL @@ -181,7 +206,7 @@ AC_ARG_ENABLE(bsr-anycrlf, # Handle --enable-ebcdic AC_ARG_ENABLE(ebcdic, AS_HELP_STRING([--enable-ebcdic], - [assume EBCDIC coding rather than ASCII; incompatible with --enable-utf8; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]), + [assume EBCDIC coding rather than ASCII; incompatible with --enable-utf; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]), , enable_ebcdic=no) # Handle --disable-stack-for-recursion @@ -208,6 +233,12 @@ AC_ARG_WITH(pcregrep-bufsize, [pcregrep buffer size (default=20480)]), , with_pcregrep_bufsize=20480) +# Handle --enable-pcretest-libedit +AC_ARG_ENABLE(pcretest-libedit, + AS_HELP_STRING([--enable-pcretest-libedit], + [link pcretest with libedit]), + , enable_pcretest_libedit=no) + # Handle --enable-pcretest-libreadline AC_ARG_ENABLE(pcretest-libreadline, AS_HELP_STRING([--enable-pcretest-libreadline], @@ -245,34 +276,76 @@ AC_ARG_WITH(match-limit-recursion, [default limit on internal recursion (default=MATCH_LIMIT)]), , with_match_limit_recursion=MATCH_LIMIT) -# Make sure that if enable_unicode_properties was set, that UTF-8 support -# is enabled. -# +# Copy enable_utf8 value to enable_utf for compatibility reasons +if test "x$enable_utf8" != "xunset" +then + if test "x$enable_utf" != "xunset" + then + 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.]) + fi + enable_utf=$enable_utf8 +fi + +# Set the default value for pcre8 +if test "x$enable_pcre8" = "xunset" +then + enable_pcre8=yes +fi + +# Set the default value for pcre16 +if test "x$enable_pcre16" = "xunset" +then + enable_pcre16=no +fi + +# Make sure enable_pcre8 or enable_pcre16 was set +if test "x$enable_pcre8$enable_pcre16" = "xnono" +then + AC_MSG_ERROR([Either 8 or 16 bit (or both) pcre library must be enabled]) +fi + +# Make sure that if enable_unicode_properties was set, that UTF support is enabled. if test "x$enable_unicode_properties" = "xyes" then - if test "x$enable_utf8" = "xno" + if test "x$enable_utf" = "xno" then - AC_MSG_ERROR([support for Unicode properties requires UTF-8 support]) + AC_MSG_ERROR([support for Unicode properties requires UTF-8/16 support]) fi - enable_utf8=yes + enable_utf=yes fi -if test "x$enable_utf8" = "xunset" +# enable_utf is disabled by default. +if test "x$enable_utf" = "xunset" then - enable_utf8=no + enable_utf=no fi +# enable_cpp copies the value of enable_pcre8 by default +if test "x$enable_cpp" = "xunset" +then + enable_cpp=$enable_pcre8 +fi + +# Make sure that if enable_cpp was set, that enable_pcre8 support is enabled +if test "x$enable_cpp" = "xyes" +then + if test "x$enable_pcre8" = "xno" + then + AC_MSG_ERROR([C++ library requires pcre library with 8 bit characters]) + fi +fi + # Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled. -# Also check that UTF-8 support is not requested, because PCRE cannot handle -# EBCDIC and UTF-8 in the same build. To do so it would need to use different +# Also check that UTF support is not requested, because PCRE cannot handle +# EBCDIC and UTF in the same build. To do so it would need to use different # character constants depending on the mode. # if test "x$enable_ebcdic" = "xyes" then enable_rebuild_chartables=yes - if test "x$enable_utf8" = "xyes" + if test "x$enable_utf" = "xyes" then - AC_MSG_ERROR([support for EBCDIC and UTF-8 cannot be enabled at the same time]) + AC_MSG_ERROR([support for EBCDIC and UTF-8/16 cannot be enabled at the same time]) fi fi @@ -410,10 +483,12 @@ AC_SUBST(pcre_have_type_traits) AC_SUBST(pcre_have_bits_type_traits) # Conditional compilation +AM_CONDITIONAL(WITH_PCRE8, test "x$enable_pcre8" = "xyes") +AM_CONDITIONAL(WITH_PCRE16, test "x$enable_pcre16" = "xyes") AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes") AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes") AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes") -AM_CONDITIONAL(WITH_UTF8, test "x$enable_utf8" = "xyes") +AM_CONDITIONAL(WITH_UTF, test "x$enable_utf" = "xyes") # Checks for typedefs, structures, and compiler characteristics. @@ -465,10 +540,46 @@ LIBS="$OLD_LIBS" # 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]) +if test "$enable_pcretest_libreadline" = "yes"; then + 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], [LIBREADLINE="-lreadline"], + [unset ac_cv_lib_readline_readline; + AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltinfo"], + [unset ac_cv_lib_readline_readline; + AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lcurses"], + [unset ac_cv_lib_readline_readline; + AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"], + [unset ac_cv_lib_readline_readline; + AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"], + [unset ac_cv_lib_readline_readline; + AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"], + [LIBREADLINE=""], + [-ltermcap])], + [-lncursesw])], + [-lncurses])], + [-lcurses])], + [-ltinfo])]) + AC_SUBST(LIBREADLINE) + if test -n "$LIBREADLINE"; then + if test "$LIBREADLINE" != "-lreadline"; then + echo "-lreadline needs $LIBREADLINE" + LIBREADLINE="-lreadline $LIBREADLINE" + fi + fi +fi + +# Check for the availability of libedit. Different distributions put its +# headers in different places. Try to cover the most common ones. + +if test "$enable_pcretest_libedit" = "yes"; then + AC_CHECK_HEADERS([editline/readline.h], [HAVE_EDITLINE_READLINE_H=1], + [AC_CHECK_HEADERS([edit/readline/readline.h], [HAVE_READLINE_READLINE_H=1], + [AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_READLINE_H=1])])]) + AC_CHECK_LIB([edit], [readline], [LIBEDIT="-ledit"]) +fi + # This facilitates -ansi builds under Linux dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc]) @@ -482,6 +593,16 @@ AC_SUBST(PCRE_STATIC_CFLAG) # Here is where pcre specific defines are handled +if test "$enable_pcre8" = "yes"; then + AC_DEFINE([SUPPORT_PCRE8], [], [ + Define to enable the 8 bit PCRE library.]) +fi + +if test "$enable_pcre16" = "yes"; then + AC_DEFINE([SUPPORT_PCRE16], [], [ + Define to enable the 16 bit PCRE library.]) +fi + if test "$enable_jit" = "yes"; then AC_DEFINE([SUPPORT_JIT], [], [ Define to enable support for Just-In-Time compiling.]) @@ -494,12 +615,12 @@ if test "$enable_pcregrep_jit" = "yes"; then Define to enable JIT support in pcregrep.]) fi -if test "$enable_utf8" = "yes"; then - AC_DEFINE([SUPPORT_UTF8], [], [ - Define to enable support for the UTF-8 Unicode encoding. This will - work even in an EBCDIC environment, but it is incompatible with - the EBCDIC macro. That is, PCRE can support *either* EBCDIC code - *or* ASCII/UTF-8, but not both at once.]) +if test "$enable_utf" = "yes"; then + AC_DEFINE([SUPPORT_UTF], [], [ + Define to enable support for the UTF-8/16 Unicode encoding. This + will work even in an EBCDIC environment, but it is incompatible + with the EBCDIC macro. That is, PCRE can support *either* EBCDIC + code *or* ASCII/UTF-8/16, but not both at once.]) fi if test "$enable_unicode_properties" = "yes"; then @@ -544,7 +665,11 @@ AC_DEFINE_UNQUOTED([PCREGREP_BUFSIZE], [$with_pcregrep pcregrep is three times this number, because it allows for the buffering of "before" and "after" lines.]) -if test "$enable_pcretest_libreadline" = "yes"; then +if test "$enable_pcretest_libedit" = "yes"; then + AC_DEFINE([SUPPORT_LIBEDIT], [], [ + Define to allow pcretest to be linked with libedit.]) + LIBREADLINE="$LIBEDIT" +elif test "$enable_pcretest_libreadline" = "yes"; then AC_DEFINE([SUPPORT_LIBREADLINE], [], [ Define to allow pcretest to be linked with libreadline.]) fi @@ -634,9 +759,9 @@ if test "$enable_ebcdic" = "yes"; then character codes, define this macro as 1. On systems that can use "configure", this can be done via --enable-ebcdic. PCRE will then assume that all input strings are in EBCDIC. If you do not define - this macro, PCRE will assume input strings are ASCII or UTF-8 Unicode. - It is not possible to build a version of PCRE that supports both - EBCDIC and UTF-8.]) + this macro, PCRE will assume input strings are ASCII or UTF-8/16 + Unicode. It is not possible to build a version of PCRE that + supports both EBCDIC and UTF-8/16.]) fi # Platform specific issues @@ -657,6 +782,9 @@ esac EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS \ $NO_UNDEFINED -version-info libpcre_version" +EXTRA_LIBPCRE16_LDFLAGS="$EXTRA_LIBPCRE16_LDFLAGS \ + $NO_UNDEFINED -version-info libpcre16_version" + EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS \ $NO_UNDEFINED -version-info libpcreposix_version" @@ -665,11 +793,13 @@ EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS \ $EXPORT_ALL_SYMBOLS" AC_SUBST(EXTRA_LIBPCRE_LDFLAGS) +AC_SUBST(EXTRA_LIBPCRE16_LDFLAGS) AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS) AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS) -# When we run 'make distcheck', use these arguments. -DISTCHECK_CONFIGURE_FLAGS="--enable-jit --enable-cpp --enable-unicode-properties" +# When we run 'make distcheck', use these arguments. Turning off compiler +# optimization makes it run faster. +DISTCHECK_CONFIGURE_FLAGS="CFLAGS='' CXXFLAGS='' --enable-pcre16 --enable-jit --enable-cpp --enable-unicode-properties" AC_SUBST(DISTCHECK_CONFIGURE_FLAGS) # Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is @@ -703,6 +833,23 @@ AC_SUBST(LIBBZ2) # Similarly for --enable-pcretest-readline +if test "$enable_pcretest_libedit" = "yes"; then + if test "$enable_pcretest_libreadline" = "yes"; then + echo "** Cannot use both --enable-pcretest-libedit and --enable-pcretest-readline" + exit 1 + fi + if test "$HAVE_EDITLINE_READLINE_H" != "1" -a \ + "$HAVE_READLINE_READLINE_H" != "1"; then + echo "** Cannot --enable-pcretest-libedit because neither editline/readline.h" + echo "** nor readline/readline.h was found." + exit 1 + fi + if test -z "$LIBEDIT"; then + echo "** Cannot --enable-pcretest-libedit because libedit library was not found." + exit 1 + fi +fi + 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." @@ -712,15 +859,18 @@ if test "$enable_pcretest_libreadline" = "yes"; then echo "** Cannot --enable-pcretest-readline because readline/history.h was not found." exit 1 fi - LIBREADLINE="-lreadline" + if test -z "$LIBREADLINE"; then + echo "** Cannot --enable-pcretest-readline because readline library was not found." + exit 1 + fi fi -AC_SUBST(LIBREADLINE) # Produce these files, in addition to config.h. AC_CONFIG_FILES( Makefile libpcre.pc - libpcreposix.pc + libpcre16.pc + libpcreposix.pc libpcrecpp.pc pcre-config pcre.h @@ -756,9 +906,11 @@ $PACKAGE-$VERSION configuration summary: Linker flags .................... : ${LDFLAGS} Extra libraries ................. : ${LIBS} + Build 8 bit pcre library ........ : ${enable_pcre8} + Build 16 bit pcre library ....... : ${enable_pcre16} Build C++ library ............... : ${enable_cpp} Enable JIT compiling support .... : ${enable_jit} - Enable UTF-8 support ............ : ${enable_utf8} + Enable UTF-8/16 support ......... : ${enable_utf} Unicode properties .............. : ${enable_unicode_properties} Newline char/sequence ........... : ${enable_newline} \R matches only ANYCRLF ......... : ${enable_bsr_anycrlf} @@ -775,6 +927,7 @@ $PACKAGE-$VERSION configuration summary: Buffer size for pcregrep ........ : ${with_pcregrep_bufsize} Link pcregrep with libz ......... : ${enable_pcregrep_libz} Link pcregrep with libbz2 ....... : ${enable_pcregrep_libbz2} + Link pcretest with libedit ...... : ${enable_pcretest_libedit} Link pcretest with libreadline .. : ${enable_pcretest_libreadline} EOF