From 77cd9e6aa4435397687fb4c6e3329d23c0fd6ab4 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 16 Jul 2015 18:13:02 +0000 Subject: [PATCH] ICU-11763 turn icuplugs off by default add "--enable-plugins" to configure, and also "UCONFIG_ENABLE_PLUGINS". These are disabled by default. Also, start splitting out acinclude.m4 content to source/config/m4/.. X-SVN-Rev: 37675 --- .gitattributes | 1 + icu4c/readme.html | 11 ++- icu4c/source/acinclude.m4 | 11 +-- icu4c/source/aclocal.m4 | 109 +++++++++++++++++----- icu4c/source/common/icuplug.cpp | 9 ++ icu4c/source/common/icuplugimp.h | 6 +- icu4c/source/common/uinit.cpp | 4 +- icu4c/source/common/unicode/icuplug.h | 11 ++- icu4c/source/common/unicode/uconfig.h | 10 +- icu4c/source/config/m4/icu-conditional.m4 | 16 ++++ icu4c/source/configure | 91 ++++++++++++++++-- icu4c/source/configure.ac | 26 +++++- icu4c/source/tools/icuinfo/Makefile.in | 15 ++- icu4c/source/tools/icuinfo/icuinfo.cpp | 15 ++- icu4c/source/tools/icuinfo/testplug.c | 7 +- icu4c/source/tools/toolutil/udbgutil.cpp | 12 ++- icu4c/source/tools/toolutil/udbgutil.h | 4 +- 17 files changed, 294 insertions(+), 64 deletions(-) create mode 100644 icu4c/source/config/m4/icu-conditional.m4 diff --git a/.gitattributes b/.gitattributes index 3f06605624..218d6a8b11 100644 --- a/.gitattributes +++ b/.gitattributes @@ -51,6 +51,7 @@ README text !eol icu4c/icu4c.css -text icu4c/source/aclocal.m4 -text icu4c/source/allinone/icucheck.bat -text +icu4c/source/config/m4/icu-conditional.m4 -text icu4c/source/data/curr/pool.res -text icu4c/source/data/icu-rbnf-deprecates.xml -text icu4c/source/data/in/coll/ucadata-implicithan.icu -text diff --git a/icu4c/readme.html b/icu4c/readme.html index 3be7a2e57c..2567eb4d7a 100644 --- a/icu4c/readme.html +++ b/icu4c/readme.html @@ -43,7 +43,7 @@

This is a release candidate version of ICU4C. It is not recommended for production use.

-

Last updated: 2015-Jul-1
+

Last updated: 2015-Jul-16
Copyright © 1997-2015 International Business Machines Corporation and others. All Rights Reserved.

@@ -234,7 +234,14 @@

API Changes

See the API Change Report for a complete - list of APIs added, removed, or changed in this release.

+ list of APIs added, removed, or changed in this release.

+ + +

ICU Plugins: disabled by default

+

ICU Plugins are now disabled by default. They may be enabled + with the configure option + --enable-plugins or by means of + #define UCONFIG_ENABLE_PLUGINS.

Layout Engine: breaking API change

diff --git a/icu4c/source/acinclude.m4 b/icu4c/source/acinclude.m4 index 179c1c8276..b64e984b6c 100644 --- a/icu4c/source/acinclude.m4 +++ b/icu4c/source/acinclude.m4 @@ -1,4 +1,4 @@ -# Copyright (c) 1999-2014, International Business Machines Corporation and +# Copyright (c) 1999-2015, International Business Machines Corporation and # others. All Rights Reserved. # acinclude.m4 for ICU # Don't edit aclocal.m4, do edit acinclude.m4 @@ -88,15 +88,6 @@ esac ) ]) -# ICU_CONDITIONAL - similar example taken from Automake 1.4 -AC_DEFUN([ICU_CONDITIONAL], -[AC_SUBST($1_TRUE) -if $2; then - $1_TRUE= -else - $1_TRUE='#' -fi]) - # ICU_PROG_LINK - Make sure that the linker is usable AC_DEFUN([ICU_PROG_LINK], [ diff --git a/icu4c/source/aclocal.m4 b/icu4c/source/aclocal.m4 index 1a1680690a..f0ae29f5a8 100644 --- a/icu4c/source/aclocal.m4 +++ b/icu4c/source/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- +# generated automatically by aclocal 1.15 -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,7 +11,9 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # @@ -38,8 +40,12 @@ # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi @@ -52,7 +58,6 @@ if test -n "$PKG_CONFIG"; then AC_MSG_RESULT([no]) PKG_CONFIG="" fi - fi[]dnl ])# PKG_PROG_PKG_CONFIG @@ -61,21 +66,20 @@ fi[]dnl # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # -# -# Similar to PKG_CHECK_MODULES, make sure that the first instance of -# this or PKG_CHECK_MODULES is called, or make sure to call -# PKG_CHECK_EXISTS manually +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_ifval([$2], [$2], [:]) + m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) - # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], @@ -83,7 +87,8 @@ m4_define([_PKG_CONFIG], pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried @@ -128,16 +133,17 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - ifelse([$4], , [AC_MSG_ERROR(dnl + m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS @@ -145,26 +151,81 @@ $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -_PKG_TEXT -])], - [AC_MSG_RESULT([no]) - $4]) +_PKG_TEXT])[]dnl + ]) elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT -To get pkg-config, see .])], - [$4]) +To get pkg-config, see .])[]dnl + ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) - ifelse([$3], , :, [$3]) + $3 fi[]dnl ])# PKG_CHECK_MODULES + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR + +m4_include([config/m4/icu-conditional.m4]) m4_include([acinclude.m4]) diff --git a/icu4c/source/common/icuplug.cpp b/icu4c/source/common/icuplug.cpp index 2764ea5ee0..79ca35b840 100644 --- a/icu4c/source/common/icuplug.cpp +++ b/icu4c/source/common/icuplug.cpp @@ -14,6 +14,11 @@ */ #include "unicode/icuplug.h" + + +#if UCONFIG_ENABLE_PLUGINS + + #include "icuplugimp.h" #include "cstring.h" #include "cmemory.h" @@ -870,3 +875,7 @@ uplug_init(UErrorCode *status) { gCurrentLevel = UPLUG_LEVEL_HIGH; ucln_registerCleanup(UCLN_UPLUG, uplug_cleanup); } + +#endif + + diff --git a/icu4c/source/common/icuplugimp.h b/icu4c/source/common/icuplugimp.h index 53b9c0cd6f..6b4f12279a 100644 --- a/icu4c/source/common/icuplugimp.h +++ b/icu4c/source/common/icuplugimp.h @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 2009-2010, International Business Machines +* Copyright (C) 2009-2015, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -21,6 +21,8 @@ #include "unicode/icuplug.h" +#if UCONFIG_ENABLE_PLUGINS + /*========================*/ /** @{ Library Manipulation */ @@ -85,3 +87,5 @@ uplug_getPluginFile(void); /** @} */ #endif + +#endif diff --git a/icu4c/source/common/uinit.cpp b/icu4c/source/common/uinit.cpp index 323dab404d..901692864b 100644 --- a/icu4c/source/common/uinit.cpp +++ b/icu4c/source/common/uinit.cpp @@ -1,6 +1,6 @@ /* ****************************************************************************** -* Copyright (C) 2001-2013, International Business Machines +* Copyright (C) 2001-2015, International Business Machines * Corporation and others. All Rights Reserved. ****************************************************************************** * file name: uinit.cpp @@ -34,8 +34,10 @@ static UBool U_CALLCONV uinit_cleanup() { static void U_CALLCONV initData(UErrorCode &status) { +#if UCONFIG_ENABLE_PLUGINS /* initialize plugins */ uplug_init(&status); +#endif #if !UCONFIG_NO_CONVERSION /* diff --git a/icu4c/source/common/unicode/icuplug.h b/icu4c/source/common/unicode/icuplug.h index 61dc2a3eb0..3a600f7c8a 100644 --- a/icu4c/source/common/unicode/icuplug.h +++ b/icu4c/source/common/unicode/icuplug.h @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 2009-2012, International Business Machines +* Copyright (C) 2009-2015, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -108,6 +108,10 @@ #include "unicode/utypes.h" +#if UCONFIG_ENABLE_PLUGINS + + + /* === Basic types === */ #ifndef U_HIDE_INTERNAL_API @@ -368,4 +372,7 @@ U_INTERNAL void U_EXPORT2 uplug_removePlug(UPlugData *plug, UErrorCode *status); #endif /* U_HIDE_INTERNAL_API */ -#endif +#endif /* UCONFIG_ENABLE_PLUGINS */ + +#endif /* _ICUPLUG */ + diff --git a/icu4c/source/common/unicode/uconfig.h b/icu4c/source/common/unicode/uconfig.h index f6223bb8a8..8602ce2e2d 100644 --- a/icu4c/source/common/unicode/uconfig.h +++ b/icu4c/source/common/unicode/uconfig.h @@ -134,6 +134,15 @@ #define U_ENABLE_TRACING 0 #endif +/** + * \def U_ENABLE_PLUGINS + * Determines whether to enable ICU plugins. + * @internal + */ +#ifndef UCONFIG_ENABLE_PLUGINS +#define UCONFIG_ENABLE_PLUGINS 0 +#endif + /** * \def U_ENABLE_DYLOAD * Whether to enable Dynamic loading in ICU. @@ -152,7 +161,6 @@ #define U_CHECK_DYLOAD 1 #endif - /** * \def U_DEFAULT_SHOW_DRAFT * Do we allow ICU users to use the draft APIs by default? diff --git a/icu4c/source/config/m4/icu-conditional.m4 b/icu4c/source/config/m4/icu-conditional.m4 new file mode 100644 index 0000000000..3d0aee9f2a --- /dev/null +++ b/icu4c/source/config/m4/icu-conditional.m4 @@ -0,0 +1,16 @@ +# Copyright (c) 1999-2015, International Business Machines Corporation and +# others. All Rights Reserved. + +# moved here from ../../acinclude.m4 + +# ICU_CONDITIONAL - similar example taken from Automake 1.4 +AC_DEFUN([ICU_CONDITIONAL], +[AC_SUBST($1_TRUE) +AC_SUBST(U_HAVE_$1) +if $2; then + $1_TRUE= + U_HAVE_$1=1 +else + $1_TRUE='#' + U_HAVE_$1=0 +fi]) diff --git a/icu4c/source/configure b/icu4c/source/configure index 188d091e7a..7190d41c8e 100755 --- a/icu4c/source/configure +++ b/icu4c/source/configure @@ -635,7 +635,9 @@ platform_make_fragment platform_make_fragment_name platform ICUDATA_CHAR +U_HAVE_SAMPLES SAMPLES_TRUE +U_HAVE_TESTS TESTS_TRUE ICULIBSUFFIXCNAME U_HAVE_LIB_SUFFIX @@ -643,10 +645,15 @@ ICULIBSUFFIX DATA_PACKAGING_MODE thepkgicudatadir pkgicudatadir +U_HAVE_TOOLS TOOLS_TRUE +U_HAVE_LAYOUTEX LAYOUTEX_TRUE +U_HAVE_LAYOUT LAYOUT_TRUE +U_HAVE_ICUIO ICUIO_TRUE +U_HAVE_EXTRAS EXTRAS_TRUE U_HAVE_WCSCPY U_HAVE_WCHAR_H @@ -671,6 +678,8 @@ U_HAVE_ATOMIC U_HAVE_STD_STRING ENABLE_RPATH U_ENABLE_DYLOAD +U_HAVE_PLUGINS +PLUGINS_TRUE U_ENABLE_TRACING U_DISABLE_RENAMING AR @@ -694,6 +703,8 @@ INSTALL_PROGRAM CPP ICULEHB_LIBS ICULEHB_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH PKG_CONFIG ac_ct_CXX CXXFLAGS @@ -776,6 +787,7 @@ enable_auto_cleanup enable_draft enable_renaming enable_tracing +enable_plugins enable_dyload enable_rpath enable_weak_threads @@ -801,6 +813,8 @@ CXX CXXFLAGS CCC PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR ICULEHB_CFLAGS ICULEHB_LIBS CPP' @@ -1428,6 +1442,7 @@ Optional Features: --enable-draft enable draft APIs (and internal APIs) default=yes --enable-renaming add a version suffix to symbols default=yes --enable-tracing enable function and data tracing default=no + --enable-plugins enable plugins default=no --disable-dyload disable dynamic loading default=no --enable-rpath use rpath when linking default is only if necessary --enable-weak-threads weakly reference the threading library default=no @@ -1469,6 +1484,10 @@ Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path ICULEHB_CFLAGS C compiler flags for ICULEHB, overriding pkg-config ICULEHB_LIBS @@ -3667,6 +3686,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # pkg-config is needed for harfbuzz support + + + + + if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. @@ -3779,7 +3803,6 @@ $as_echo "yes" >&6; } $as_echo "no" >&6; } PKG_CONFIG="" fi - fi pkg_failed=no @@ -3796,6 +3819,7 @@ if test -n "$ICULEHB_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_ICULEHB_CFLAGS=`$PKG_CONFIG --cflags "icu-le-hb" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -3812,6 +3836,7 @@ if test -n "$ICULEHB_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_ICULEHB_LIBS=`$PKG_CONFIG --libs "icu-le-hb" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -3822,6 +3847,8 @@ fi if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -3829,17 +3856,17 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - ICULEHB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "icu-le-hb" 2>&1` + ICULEHB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "icu-le-hb" 2>&1` else - ICULEHB_PKG_ERRORS=`$PKG_CONFIG --print-errors "icu-le-hb" 2>&1` + ICULEHB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "icu-le-hb" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$ICULEHB_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - : + : elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } : else ICULEHB_CFLAGS=$pkg_cv_ICULEHB_CFLAGS @@ -5682,10 +5709,37 @@ if test "x$ac_cv_header_elf_h" = "xyes"; then CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_HAVE_ELF_H=1"; fi +# Enable/disable plugins +# Check whether --enable-plugins was given. +if test "${enable_plugins+set}" = set; then : + enableval=$enable_plugins; case "${enableval}" in + yes) plugins=true ;; + no) plugins=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-plugins" "$LINENO" 5 ;; + esac +else + plugins=false +fi + + + +if test "$plugins" = true; then + PLUGINS_TRUE= + U_HAVE_PLUGINS=1 +else + PLUGINS_TRUE='#' + U_HAVE_PLUGINS=0 +fi + +if test "x$plugins" = "xtrue"; then + UCONFIG_CPPFLAGS="$UCONFIG_CPPFLAGS -DUCONFIG_ENABLE_PLUGINS=1" +fi + + U_ENABLE_DYLOAD=1 enable=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable dynamic loading of plugins" >&5 -$as_echo_n "checking whether to enable dynamic loading of plugins... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable dynamic loading of plugins. Ignored if plugins disabled." >&5 +$as_echo_n "checking whether to enable dynamic loading of plugins. Ignored if plugins disabled.... " >&6; } # Check whether --enable-dyload was given. if test "${enable_dyload+set}" = set; then : enableval=$enable_dyload; case "${enableval}" in @@ -7426,10 +7480,13 @@ else fi + if test "$extras" = true; then EXTRAS_TRUE= + U_HAVE_EXTRAS=1 else EXTRAS_TRUE='#' + U_HAVE_EXTRAS=0 fi # Check whether --enable-icuio was given. if test "${enable_icuio+set}" = set; then : @@ -7443,10 +7500,13 @@ else fi + if test "$icuio" = true; then ICUIO_TRUE= + U_HAVE_ICUIO=1 else ICUIO_TRUE='#' + U_HAVE_ICUIO=0 fi # Enable/disable layout @@ -7462,10 +7522,13 @@ else fi + if test "$layout" = true; then LAYOUT_TRUE= + U_HAVE_LAYOUT=1 else LAYOUT_TRUE='#' + U_HAVE_LAYOUT=0 fi # Enable/disable layoutex @@ -7481,10 +7544,13 @@ else fi + if test "$layoutex" = true; then LAYOUTEX_TRUE= + U_HAVE_LAYOUTEX=1 else LAYOUTEX_TRUE='#' + U_HAVE_LAYOUTEX=0 fi # Enable/disable tools @@ -7500,10 +7566,13 @@ else fi + if test "$tools" = true; then TOOLS_TRUE= + U_HAVE_TOOLS=1 else TOOLS_TRUE='#' + U_HAVE_TOOLS=0 fi @@ -7622,10 +7691,13 @@ else fi + if test "$tests" = true; then TESTS_TRUE= + U_HAVE_TESTS=1 else TESTS_TRUE='#' + U_HAVE_TESTS=0 fi # Enable/disable samples @@ -7641,10 +7713,13 @@ else fi + if test "$samples" = true; then SAMPLES_TRUE= + U_HAVE_SAMPLES=1 else SAMPLES_TRUE='#' + U_HAVE_SAMPLES=0 fi ICUDATA_CHAR=$U_ENDIAN_CHAR diff --git a/icu4c/source/configure.ac b/icu4c/source/configure.ac index ecbaf62d81..595bd122ce 100644 --- a/icu4c/source/configure.ac +++ b/icu4c/source/configure.ac @@ -3,10 +3,12 @@ AC_COPYRIGHT([ Copyright (c) 1999-2015, International Business Machines Corporat # configure.in for ICU # Stephen F. Booth, heavily modified by Yves and others -# Check for autoconf version -AC_PREREQ(2.68) +# NOTE: please use 'autoreconf' to rebuild, otherwise 'aclocal && autoconf'. -# Process this file with autoconf to produce a configure script +# Check for autoconf version +AC_PREREQ(2.69) + +# Process this file with autoreconf to produce a configure script AC_INIT([ICU], m4_esyscmd_s([sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "./common/unicode/uvernum.h]"), [http://icu-project.org/bugs], @@ -409,9 +411,25 @@ if test "x$ac_cv_header_elf_h" = "xyes"; then CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_HAVE_ELF_H=1"; fi +# Enable/disable plugins +AC_ARG_ENABLE(plugins, + [ --enable-plugins enable plugins [default=no]], + [case "${enableval}" in + yes) plugins=true ;; + no) plugins=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-plugins) ;; + esac], + plugins=false) +ICU_CONDITIONAL(PLUGINS, test "$plugins" = true) + +if test "x$plugins" = "xtrue"; then + UCONFIG_CPPFLAGS="$UCONFIG_CPPFLAGS -DUCONFIG_ENABLE_PLUGINS=1" +fi + + U_ENABLE_DYLOAD=1 enable=yes -AC_MSG_CHECKING([whether to enable dynamic loading of plugins]) +AC_MSG_CHECKING([whether to enable dynamic loading of plugins. Ignored if plugins disabled.]) AC_ARG_ENABLE(dyload, [ --disable-dyload disable dynamic loading [default=no]], [ case "${enableval}" in diff --git a/icu4c/source/tools/icuinfo/Makefile.in b/icu4c/source/tools/icuinfo/Makefile.in index 89c0b74be6..d6905406a2 100644 --- a/icu4c/source/tools/icuinfo/Makefile.in +++ b/icu4c/source/tools/icuinfo/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/icuinfo -## Copyright (c) 1999-2012, International Business Machines Corporation and +## Copyright (c) 1999-2015, International Business Machines Corporation and ## others. All Rights Reserved. ## Madhu Katragadda @@ -25,7 +25,7 @@ CPPFLAGS+= -I$(top_srcdir)/i18n LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = icuinfo.o -PLUGIN_OBJECTS = testplug.o +@PLUGINS_TRUE@PLUGIN_OBJECTS = testplug.o DEPS = $(OBJECTS:.o=.d) @@ -82,10 +82,14 @@ PLUGINDIR=$(shell pwd) PLUGINFILE=$(PLUGINDIR)/icuplugins$(SO_TARGET_VERSION_MAJOR).txt +CFLAGS+=$(SHAREDLIBCFLAGS) + +@PLUGINS_TRUE@HAVE_PLUGINS=yes + +ifeq ($(HAVE_PLUGINS),yes) $(PLUGINFILE): Makefile echo "$(CURR_FULL_DIR)/$(PLUGIN) myPlugin x=4" > $@ -CFLAGS+=$(SHAREDLIBCFLAGS) $(PLUGIN): $(PLUGIN_OBJECTS) $(SHLIB.cc) $(SHAREDLIBCFLAGS) $(LD_SONAME) $(OUTOPT)$@ $^ $(LIBS) @@ -94,7 +98,10 @@ plugin: $(PLUGIN) plugin-check: $(PLUGIN) $(PLUGINFILE) $(INVOKE) ICU_PLUGINS="$(CURR_FULL_DIR)" ./$(TARGET) -v -L - +else +plugin plugin-check $(PLUGIN): + @echo "Plugins are disabled (use --enable-plugins to enable)" +endif ifeq (,$(MAKECMDGOALS)) -include $(DEPS) diff --git a/icu4c/source/tools/icuinfo/icuinfo.cpp b/icu4c/source/tools/icuinfo/icuinfo.cpp index 218310bcab..003b0bde50 100644 --- a/icu4c/source/tools/icuinfo/icuinfo.cpp +++ b/icu4c/source/tools/icuinfo/icuinfo.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2012, International Business Machines +* Copyright (C) 1999-2015, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -40,7 +40,7 @@ static UOption options[]={ /*1*/ UOPTION_HELP_QUESTION_MARK, /*2*/ UOPTION_ICUDATADIR, /*3*/ UOPTION_VERBOSE, - /*4*/ UOPTION_DEF("list-plugins", 'L', UOPT_NO_ARG), + /*4*/ UOPTION_DEF("list-plugins", 'L', UOPT_NO_ARG), // may be a no-op if disabled /*5*/ UOPTION_DEF("milisecond-time", 'm', UOPT_NO_ARG), /*6*/ UOPTION_DEF("cleanup", 'K', UOPT_NO_ARG), /*7*/ UOPTION_DEF("xml", 'x', UOPT_REQUIRES_ARG), @@ -108,13 +108,17 @@ void cmd_version(UBool /* noLoad */, UErrorCode &errorCode) printf("\n\nICU Initialization returned: %s\n", u_errorName(initStatus)); - + +#if UCONFIG_ENABLE_PLUGINS #if U_ENABLE_DYLOAD const char *pluginFile = uplug_getPluginFile(); printf("Plugin file is: %s\n", (pluginFile&&*pluginFile)?pluginFile:"(not set. try setting ICU_PLUGINS to a directory.)"); #else fprintf(stderr, "Dynamic Loading: is disabled. No plugins will be loaded at start-up.\n"); #endif +#else + fprintf(stderr, "Plugins are disabled.\n"); +#endif } void cmd_cleanup() @@ -125,6 +129,7 @@ void cmd_cleanup() void cmd_listplugins() { +#if UCONFIG_ENABLE_PLUGINS int32_t i; UPlugData *plug; @@ -201,7 +206,7 @@ void cmd_listplugins() { if(i==0) { printf("No plugins loaded.\n"); } - +#endif } @@ -227,7 +232,9 @@ main(int argc, char* argv[]) { " -m or --millisecond-time - Print the current UTC time in milliseconds.\n" " -d or --icudatadir - Set the ICU Data Directory\n" " -v - Print version and configuration information about ICU\n" +#if UCONFIG_ENABLE_PLUGINS " -L or --list-plugins - List and diagnose issues with ICU Plugins\n" +#endif " -K or --cleanup - Call u_cleanup() before exitting (will attempt to unload plugins)\n" "\n" "If no arguments are given, the tool will print ICU version and configuration information.\n" diff --git a/icu4c/source/tools/icuinfo/testplug.c b/icu4c/source/tools/icuinfo/testplug.c index 73e8588109..0149badbde 100644 --- a/icu4c/source/tools/icuinfo/testplug.c +++ b/icu4c/source/tools/icuinfo/testplug.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 2009-2010, International Business Machines +* Copyright (C) 2009-2015, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -18,6 +18,10 @@ */ #include "unicode/icuplug.h" + +#if UCONFIG_ENABLE_PLUGINS +/* This file isn't usually compiled except on Windows. Guard it. */ + #include /* for fprintf */ #include /* for malloc */ #include "udbgutil.h" @@ -202,3 +206,4 @@ UPlugTokenReturn U_EXPORT2 debugMemoryPlugin ( return UPLUG_TOKEN; } +#endif diff --git a/icu4c/source/tools/toolutil/udbgutil.cpp b/icu4c/source/tools/toolutil/udbgutil.cpp index 911425c1ad..da484aafe5 100644 --- a/icu4c/source/tools/toolutil/udbgutil.cpp +++ b/icu4c/source/tools/toolutil/udbgutil.cpp @@ -17,6 +17,8 @@ To add a new enum type (For example: UShoeSize with values USHOE_WIDE=0, USHOE_REGULAR, USHOE_NARROW, USHOE_COUNT) + 0. Make sure that all lines you add are protected with appropriate uconfig guards, + such as '#if !UCONFIG_NO_SHOES'. 1. udbgutil.h: add UDBG_UShoeSize to the UDebugEnumType enum before UDBG_ENUM_COUNT ( The subsequent steps involve this file, udbgutil.cpp ) 2. Find the marker "Add new enum types above this line" @@ -184,6 +186,7 @@ static const Field names_UColAttributeValue[] = { #endif +#if UCONFIG_ENABLE_PLUGINS #include "unicode/icuplug.h" #define LEN_UPLUG_REASON 13 /* UPLUG_REASON_ */ @@ -202,6 +205,7 @@ static const Field names_UPlugLevel[] = { FIELD_NAME_STR( LEN_UPLUG_LEVEL, UPLUG_LEVEL_LOW ), FIELD_NAME_STR( LEN_UPLUG_LEVEL, UPLUG_LEVEL_HIGH ), }; +#endif #define LEN_UDBG 5 /* "UDBG_" */ static const int32_t count_UDebugEnumType = UDBG_ENUM_COUNT; @@ -213,8 +217,10 @@ static const Field names_UDebugEnumType[] = FIELD_NAME_STR( LEN_UDBG, UDBG_UCalendarMonths ), FIELD_NAME_STR( LEN_UDBG, UDBG_UDateFormatStyle ), #endif +#if UCONFIG_ENABLE_PLUGINS FIELD_NAME_STR( LEN_UDBG, UDBG_UPlugReason ), FIELD_NAME_STR( LEN_UDBG, UDBG_UPlugLevel ), +#endif FIELD_NAME_STR( LEN_UDBG, UDBG_UAcceptResult ), #if !UCONFIG_NO_COLLATION FIELD_NAME_STR( LEN_UDBG, UDBG_UColAttributeValue ), @@ -244,8 +250,10 @@ static int32_t _udbg_enumCount(UDebugEnumType type, UBool actual) { COUNT_CASE(UCalendarMonths) COUNT_CASE(UDateFormatStyle) #endif +#if UCONFIG_ENABLE_PLUGINS COUNT_CASE(UPlugReason) COUNT_CASE(UPlugLevel) +#endif COUNT_CASE(UAcceptResult) #if !UCONFIG_NO_COLLATION COUNT_CASE(UColAttributeValue) @@ -264,10 +272,12 @@ static const Field* _udbg_enumFields(UDebugEnumType type) { FIELD_CASE(UCalendarMonths) FIELD_CASE(UDateFormatStyle) #endif +#if UCONFIG_ENABLE_PLUGINS FIELD_CASE(UPlugReason) FIELD_CASE(UPlugLevel) +#endif FIELD_CASE(UAcceptResult) - // FIELD_FAIL_CASE(UNonExistentEnum) + // FIELD_FAIL_CASE(UNonExistentEnum) #if !UCONFIG_NO_COLLATION FIELD_CASE(UColAttributeValue) #endif diff --git a/icu4c/source/tools/toolutil/udbgutil.h b/icu4c/source/tools/toolutil/udbgutil.h index e8590b1552..3f6ecb0c85 100644 --- a/icu4c/source/tools/toolutil/udbgutil.h +++ b/icu4c/source/tools/toolutil/udbgutil.h @@ -1,6 +1,6 @@ /* ************************************************************************ -* Copyright (c) 2008-2013, International Business Machines +* Copyright (c) 2008-2015, International Business Machines * Corporation and others. All Rights Reserved. ************************************************************************ */ @@ -20,8 +20,10 @@ enum UDebugEnumType { UDBG_UCalendarMonths, /* UCalendarMonths. Count= (UCAL_UNDECIMBER+1) */ UDBG_UDateFormatStyle, /* Count = UDAT_SHORT=1 */ #endif +#if UCONFIG_ENABLE_PLUGINS UDBG_UPlugReason, /* Count = UPLUG_REASON_COUNT */ UDBG_UPlugLevel, /* COUNT = UPLUG_LEVEL_COUNT */ +#endif UDBG_UAcceptResult, /* Count = ULOC_ACCEPT_FALLBACK+1=3 */ /* All following enums may be discontiguous. */