summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorDaniel Elstner <danielk@openismus.com>2009-08-17 13:05:30 +0200
committerDaniel Elstner <danielk@openismus.com>2009-08-17 13:36:34 +0200
commit47791a90b249948c194ce2caeb2bdf2f10cfd8e8 (patch)
tree4f9a5694539212188b6624d5ac660c539667085f /macros
parent4a72657779fe4c0c2c57aada5bee5bddd6bc2c46 (diff)
downloadmm-common-47791a90b249948c194ce2caeb2bdf2f10cfd8e8.tar.gz
Implement generic --disable-deprecated-api macro
* macros/mm-dietlib.m4: New Autoconf macro file for configuration macros that have the effect of reducing the size of the compiled binding library. (MM_ARG_DISABLE_DEPRECATED_API): New M4 macro for use by C++ bindings in order to allow deprecated API to be omitted from the library build.
Diffstat (limited to 'macros')
-rw-r--r--macros/mm-dietlib.m470
1 files changed, 70 insertions, 0 deletions
diff --git a/macros/mm-dietlib.m4 b/macros/mm-dietlib.m4
new file mode 100644
index 0000000..890ed62
--- /dev/null
+++ b/macros/mm-dietlib.m4
@@ -0,0 +1,70 @@
+## Copyright (c) 2009 Openismus GmbH <http://www.openismus.com/>
+##
+## This file is part of mm-common.
+##
+## mm-common is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published
+## by the Free Software Foundation, either version 2 of the License,
+## or (at your option) any later version.
+##
+## mm-common is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with mm-common. If not, see <http://www.gnu.org/licenses/>.
+
+#serial 20090817
+
+## _MM_ARG_DISABLE_DEPRECATED_API_OPTION
+##
+## Implementation helper macro of MM_ARG_DISABLE_DEPRECATED_API(). Pulled
+## in through AC_REQUIRE() so that it will only be expanded once.
+##
+m4_define([_MM_ARG_DISABLE_DEPRECATED_API_OPTION],
+[dnl
+AC_PROVIDE([$0])[]dnl
+AC_ARG_ENABLE([deprecated-api],
+ [AS_HELP_STRING([--disable-deprecated-api],
+ [omit deprecated API from the library])],
+ [mm_enable_deprecated_api=$enableval],
+ [mm_enable_deprecated_api=yes])[]dnl
+AS_IF([test "x$mm_enable_deprecated_api" = xno],
+ [AC_MSG_WARN([[Deprecated API will not be built, breaking compatibility.
+Do not use this option for distribution packages.]])],
+ [AC_MSG_NOTICE([[Deprecated API will be built, for backwards-compatibility.]])])
+AM_CONDITIONAL([DISABLE_DEPRECATED_API], [test "x$mm_enable_deprecated_api" = xno])[]dnl
+])
+
+## _MM_ARG_DISABLE_DEPRECATED_API_DEFINE(define-prefix [define-prefix ...])
+##
+## Implementation helper macro of MM_ARG_DISABLE_DEPRECATED_API(). Expands
+## to a list of AC_DEFINE() calls, one for each prefix in the argument list.
+##
+m4_define([_MM_ARG_DISABLE_DEPRECATED_API_DEFINE],
+[m4_foreach_w([mm_prefix], [$1],
+[AC_DEFINE(m4_defn([mm_prefix])[_DISABLE_DEPRECATED], [1],
+ [Define to omit deprecated API from the library.])
+])])
+
+## MM_ARG_DISABLE_DEPRECATED_API([define-prefix [define-prefix ...]])
+##
+## Provide the --disable-deprecated-api configure option, which may be used
+## to trim the size of the resulting library at the cost of breaking binary
+## compatibility. By default, deprecated API will be built.
+##
+## Each <define-prefix> in the whitespace-separated argument list is expanded
+## to a C preprocessor macro name <define-prefix>_DISABLE_DEPRECATED, which
+## will be defined to 1 in the generated configuration header if the option
+## to disable deprecated API is used. The DISABLE_DEPRECATED_API Automake
+## conditional is provided as well.
+##
+AC_DEFUN([MM_ARG_DISABLE_DEPRECATED_API],
+[dnl
+AC_REQUIRE([_MM_PRE_INIT])[]dnl
+AC_REQUIRE([_MM_ARG_DISABLE_DEPRECATED_API_OPTION])[]dnl
+AS_IF([test "x$mm_enable_deprecated_api" = xno],
+ [_MM_ARG_DISABLE_DEPRECATED_API_DEFINE(
+ m4_ifval([$1], [[$1]], [AS_TR_CPP(m4_defn([AC_PACKAGE_TARNAME]))]))])[]dnl
+])