diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-12-07 17:51:21 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-12-07 19:48:16 +0100 |
commit | 1aad4689babec28f47b99666b303ab8bfffc3106 (patch) | |
tree | 04e82f39d983dfedfdbf25331380456187e096e7 | |
parent | e56c274f815a9b0cc55489537fad8c59273d2c94 (diff) |
use config_xxx.h files instead of -DHAVE_XXX on the command line
As the latter does not quite scale, and also source files depending
on the setting/feature did not rebuild in case of a change.
There are intentionally more config_xxx.h files (so autoheader
from autotools is not used), so that a setting change does not force
automatically a rebuild of everything. Running configure does not
touch those config_xxx.h files that have not changed.
There's config/README with a howto.
Change-Id: I6d6e82050ff8faf5364ed246848b8401aca3e0e5
34 files changed, 124 insertions, 25 deletions
diff --git a/config/.gitignore b/config/.gitignore new file mode 100644 index 000000000000..325a7fd030e4 --- /dev/null +++ b/config/.gitignore @@ -0,0 +1,3 @@ +config_global.h +config_vclplug.h +config_telepathy.h diff --git a/config/README b/config/README new file mode 100644 index 000000000000..fd58b64045bb --- /dev/null +++ b/config/README @@ -0,0 +1,24 @@ +These are configuration files for various features as detected by configure. + +Include only those files you need (in order to reduce rebuilds when a setting changes). + +Settings here are only C/C++ #define directives, so they apply only to C/C++ source, +not to Makefiles. + + + +Adding a new setting: +===================== + +- do AC_DEFINE(HAVE_FOO) in configure.ac when a setting should be set +- choose the proper config/config_xxx.h file to use + - if it is a global setting (such as availability of a compiler feature), + use config/config_global.h + - otherwise check if there is a matching config/config_hxx.h file + - if none matches, add a new one: + - add config/config_xxx.h.in here, with just #ifndef include guard + - add AC_CONFIG_HEADERS([config/config_xxx.h]) next to the others + in configure.ac + - add config_hxx.h to config/.gitignore +- add #undef HAVE_FOO to the config/config_hxx.h , possibly with a comment +- add #include <config_xxx.h> before any #ifdef HAVE_XXX in a source file diff --git a/config/config_global.h.in b/config/config_global.h.in new file mode 100644 index 000000000000..a9eb54f68c34 --- /dev/null +++ b/config/config_global.h.in @@ -0,0 +1,14 @@ +/* +Global configuration file. + +Only for settings that apply to every source file and are unlikely to change often, +such as whether a certain C++11 feature is available. + +Do NOT use for settings local to some code or for settings that can change often. +Any change in this header will cause a rebuild of almost everything. + +*/ + +#undef HAVE_GCC_BUILTIN_ATOMIC +#undef HAVE_SFINAE_ANONYMOUS_BROKEN +#undef HAVE_THREADSAFE_STATICS diff --git a/config/config_telepathy.h.in b/config/config_telepathy.h.in new file mode 100644 index 000000000000..f8752b5f5336 --- /dev/null +++ b/config/config_telepathy.h.in @@ -0,0 +1,6 @@ +#ifndef CONFIG_TELEPATHY +#define CONFIG_TELEPATHY + +#undef ENABLE_TELEPATHY + +#endif diff --git a/config/config_vclplug.h.in b/config/config_vclplug.h.in new file mode 100644 index 000000000000..46c6bd1aea77 --- /dev/null +++ b/config/config_vclplug.h.in @@ -0,0 +1,15 @@ +/* + +Settings about which X11 desktops have support enabled. + +*/ + +#ifndef CONFIG_VCLPLUG_H +#define CONFIG_VCLPLUG_H + +#undef ENABLE_GTK +#undef ENABLE_KDE +#undef ENABLE_KDE4 +#undef ENABLE_TDE + +#endif diff --git a/configure.ac b/configure.ac index d0178d4c797c..9a0d449c26c4 100644 --- a/configure.ac +++ b/configure.ac @@ -5579,6 +5579,7 @@ if test "$GCC" = "yes"; then AC_MSG_RESULT([broken (i.e., no)]) else HAVE_THREADSAFE_STATICS=TRUE + AC_DEFINE(HAVE_THREADSAFE_STATICS) AC_MSG_RESULT([yes]) fi else @@ -5646,6 +5647,7 @@ if test "$GCC" = "yes"; then ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[]) if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC) else AC_MSG_RESULT([no]) fi @@ -5692,6 +5694,7 @@ return !(i != 0 && j != 0); fi if test "$HAVE_CXX0X" = "TRUE"; then AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_CXX0X]) else AC_MSG_RESULT([no]) fi @@ -5864,6 +5867,7 @@ void test( ... ); AC_MSG_RESULT([$sfinae_anonymous_broken]) if test "$sfinae_anonymous_broken" = "yes"; then HAVE_SFINAE_ANONYMOUS_BROKEN="TRUE" + AC_DEFINE(HAVE_SFINAE_ANONYMOUS_BROKEN) fi AC_LANG_POP([C++]) fi @@ -9432,6 +9436,7 @@ fi ENABLE_GTK="" if test "x$enable_gtk" = "xyes"; then ENABLE_GTK="TRUE" + AC_DEFINE(ENABLE_GTK) R="gtk $R" fi AC_SUBST(ENABLE_GTK) @@ -9444,6 +9449,7 @@ if test "x$enable_tde" = "xyes"; then AC_MSG_ERROR([enabling both KDE and TDE is not supported]) fi ENABLE_TDE="TRUE" + AC_DEFINE(ENABLE_TDE) R="$R tde" fi AC_SUBST(ENABLE_TDE) @@ -9451,6 +9457,7 @@ AC_SUBST(ENABLE_TDE) ENABLE_KDE="" if test "x$enable_kde" = "xyes"; then ENABLE_KDE="TRUE" + AC_DEFINE(ENABLE_KDE) R="$R kde" fi AC_SUBST(ENABLE_KDE) @@ -9458,6 +9465,7 @@ AC_SUBST(ENABLE_KDE) ENABLE_KDE4="" if test "x$enable_kde4" = "xyes"; then ENABLE_KDE4="TRUE" + AC_DEFINE(ENABLE_KDE4) R="$R kde4" fi AC_SUBST(ENABLE_KDE4) @@ -9671,6 +9679,7 @@ TELEPATHY_LIBS="" AC_MSG_CHECKING([whether to enable Telepathy support]) if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then ENABLE_TELEPATHY="TRUE" + AC_DEFINE(ENABLE_TELEPATHY) AC_MSG_RESULT([yes]) PKG_CHECK_MODULES( TELEPATHY, telepathy-glib >= 0.18.0 glib-2.0 gobject-2.0 gthread-2.0 gio-2.0 ) else @@ -12461,6 +12470,9 @@ else fi AC_CONFIG_FILES([config_host.mk]) +AC_CONFIG_HEADERS([config/config_global.h]) +AC_CONFIG_HEADERS([config/config_telepathy.h]) +AC_CONFIG_HEADERS([config/config_vclplug.h]) AC_OUTPUT # touch the config timestamp file diff --git a/connectivity/source/drivers/kab/KDEInit.h b/connectivity/source/drivers/kab/KDEInit.h index f974ff51348b..2f59b73c3d37 100644 --- a/connectivity/source/drivers/kab/KDEInit.h +++ b/connectivity/source/drivers/kab/KDEInit.h @@ -25,6 +25,8 @@ #define KAB_DRIVER_VERSION_MAJOR 0 #define KAB_DRIVER_VERSION_MINOR 2 +#include <config_vclplug.h> + #ifdef ENABLE_TDE // the minimum TDE version which is required at runtime diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 098b550982c7..8f8e664b59bb 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -89,6 +89,8 @@ #include <svtools/apearcfg.hxx> #include <svtools/optionsdrawinglayer.hxx> +#include <config_vclplug.h> + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx index 9fd2c2b04062..e5c43f79cf11 100644 --- a/cui/source/options/optmemory.cxx +++ b/cui/source/options/optmemory.cxx @@ -59,6 +59,8 @@ #include "helpid.hrc" #include <dialmgr.hxx> +#include <config_vclplug.h> + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 7177e49d02b0..12f804882cd7 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -95,6 +95,8 @@ #include "langselect.hxx" +#include <config_telepathy.h> + #ifdef ENABLE_TELEPATHY #include <tubes/manager.hxx> #endif diff --git a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx index 8c7175f99e6b..cdb8b39f445f 100644 --- a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx +++ b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx @@ -92,6 +92,8 @@ extern "C" { #endif #endif +#include <config_vclplug.h> + #ifdef ENABLE_GTK #include <gtk/gtk.h> #include <gdk/gdkx.h> diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx index 21591923f293..bfc6fa16cdab 100644 --- a/extensions/source/plugin/unx/npnapi.cxx +++ b/extensions/source/plugin/unx/npnapi.cxx @@ -40,6 +40,8 @@ #include <osl/module.h> +#include <config_vclplug.h> + extern PluginConnector* pConnector; extern XtAppContext app_context; extern int wakeup_fd[]; diff --git a/extensions/source/plugin/unx/npwrap.cxx b/extensions/source/plugin/unx/npwrap.cxx index b2cd5324c19a..8229abb6812f 100644 --- a/extensions/source/plugin/unx/npwrap.cxx +++ b/extensions/source/plugin/unx/npwrap.cxx @@ -44,6 +44,8 @@ #include <osl/file.h> #include <osl/module.h> +#include <config_vclplug.h> + PluginConnector* pConnector = NULL; int nAppArguments = 0; diff --git a/sal/inc/rtl/instance.hxx b/sal/inc/rtl/instance.hxx index e2e1f6326c4e..9e73af09b168 100644 --- a/sal/inc/rtl/instance.hxx +++ b/sal/inc/rtl/instance.hxx @@ -20,6 +20,8 @@ #ifndef INCLUDED_RTL_INSTANCE_HXX #define INCLUDED_RTL_INSTANCE_HXX +#include <config_global.h> + #include "osl/doublecheckedlocking.h" #include "osl/getglobalmutex.hxx" diff --git a/sal/inc/rtl/stringutils.hxx b/sal/inc/rtl/stringutils.hxx index c6e44b66d4b1..e8909327ac2c 100644 --- a/sal/inc/rtl/stringutils.hxx +++ b/sal/inc/rtl/stringutils.hxx @@ -31,6 +31,8 @@ #include "sal/config.h" +#include <config_global.h> + // Manually defining RTL_DISABLE_FAST_STRING allows to force turning fast string concatenation off // (e.g. for debugging). #ifndef RTL_DISABLE_FAST_STRING diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 22322ba4da28..d801b9b71130 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -105,6 +105,8 @@ #include "markdata.hxx" #include "orcusfilters.hxx" +#include <config_telepathy.h> + #ifdef ENABLE_TELEPATHY #include "sccollaboration.hxx" #endif diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index eeb0708e9184..aa0afde1173c 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -39,6 +39,8 @@ #include <boost/unordered_map.hpp> #include <cppuhelper/implbase1.hxx> +#include <config_telepathy.h> + class ScEditEngineDefaulter; class SfxStyleSheetBasePool; class SfxStyleSheetHint; diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 4186f86a6771..88a41dd9997c 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -43,6 +43,8 @@ #include "markdata.hxx" #include "scabstdlg.hxx" +#include <config_telepathy.h> + #ifdef ENABLE_TELEPATHY #include "sccollaboration.hxx" #endif diff --git a/shell/inc/shell/kde_headers.h b/shell/inc/shell/kde_headers.h index 015fe5f4ebc5..161e1ff1ec8c 100644 --- a/shell/inc/shell/kde_headers.h +++ b/shell/inc/shell/kde_headers.h @@ -20,6 +20,8 @@ #ifndef INCLUDED_VCL_KDE_HEADERS_H #define INCLUDED_VCL_KDE_HEADERS_H +#include <config_vclplug.h> + #ifdef ENABLE_TDE #include "shell/tde_headers.h" diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index 6f3a99c20458..83a0e1a62212 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -262,12 +262,6 @@ gb_GLOBALDEFS += \ DISABLE_EXTENSIONS \ DISABLE_SCRIPTING \ ENABLE_GRAPHITE \ - ENABLE_GTK \ - ENABLE_KDE \ - ENABLE_KDE4 \ - ENABLE_TDE \ - ENABLE_TELEPATHY \ - HAVE_THREADSAFE_STATICS \ ) gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS)) diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index 2fa302360aba..973f47685b92 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -59,12 +59,6 @@ gb_COMPILERDEFS := \ -DCPPU_ENV=$(gb_CPPU_ENV) \ -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \ -ifeq ($(HAVE_GCC_BUILTIN_ATOMIC),TRUE) -gb_COMPILERDEFS += \ - -DHAVE_GCC_BUILTIN_ATOMIC \ - -endif - gb_CFLAGS_COMMON := \ -Wall \ -Wendif-labels \ @@ -158,7 +152,9 @@ gb_DEBUG_CFLAGS := $(GGDB2) $(FINLINE_LIMIT0) $(FNO_INLINE) gb_DEBUG_CXXFLAGS := $(FNO_DEFAULT_INLINE) -gb_LinkTarget_INCLUDE := $(subst -I. , ,$(SOLARINC)) +gb_LinkTarget_INCLUDE :=\ + $(subst -I. , ,$(SOLARINC)) \ + -I$(SRCDIR)/config \ ifeq ($(COM_GCC_IS_CLANG),TRUE) ifeq ($(COMPILER_PLUGIN_TOOL),) diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk index d0b3cfc78817..1102da933939 100644 --- a/solenv/gbuild/platform/com_MSC_class.mk +++ b/solenv/gbuild/platform/com_MSC_class.mk @@ -108,6 +108,7 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) gb_LinkTarget_INCLUDE :=\ $(subst -I. , ,$(SOLARINC)) \ $(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \ + -I$(SRCDIR)/config \ gb_LinkTarget_get_pdbfile = $(call gb_LinkTarget_get_target,)pdb/$(1).pdb diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index 2515b4546ef8..3a6f097f6b1c 100644 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -69,12 +69,6 @@ gb_CXXFLAGS := \ #-fsigned-char \ might be removed? #-malign-natural \ might be removed? -ifeq ($(HAVE_SFINAE_ANONYMOUS_BROKEN),TRUE) -gb_COMPILERDEFS += \ - -DHAVE_SFINAE_ANONYMOUS_BROKEN \ - -endif - # Without this I get struct/class clashes for "complex" when compiling # some source files in vcl, at least with the 10.7 SDK. ifneq ($(filter 1070,$(MACOSX_SDK_VERSION)),) diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index dbd00a1744c4..4b1f74748f7d 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -76,12 +76,6 @@ else gb_CXXFLAGS += -Wnon-virtual-dtor endif -ifeq ($(HAVE_SFINAE_ANONYMOUS_BROKEN),TRUE) -gb_COMPILERDEFS += \ - -DHAVE_SFINAE_ANONYMOUS_BROKEN \ - -endif - # enable debug STL ifeq ($(gb_ENABLE_DBGUTIL),$(true)) gb_COMPILERDEFS += \ diff --git a/vcl/unx/kde/FPServiceInfo.hxx b/vcl/unx/kde/FPServiceInfo.hxx index 202686012965..5cddc5f2e829 100644 --- a/vcl/unx/kde/FPServiceInfo.hxx +++ b/vcl/unx/kde/FPServiceInfo.hxx @@ -20,6 +20,8 @@ #ifndef _FPSERVICEINFO_HXX_ #define _FPSERVICEINFO_HXX_ +#include <config_vclplug.h> + #ifdef ENABLE_TDE // the service names diff --git a/vcl/unx/kde/UnxFilePicker.cxx b/vcl/unx/kde/UnxFilePicker.cxx index afa9db0ea884..19c9e5fe81fe 100644 --- a/vcl/unx/kde/UnxFilePicker.cxx +++ b/vcl/unx/kde/UnxFilePicker.cxx @@ -51,6 +51,8 @@ #include <iostream> +#include <config_vclplug.h> + using namespace ::com::sun::star; using namespace ::com::sun::star::ui::dialogs; diff --git a/vcl/unx/kde/fpicker/kdecommandthread.cxx b/vcl/unx/kde/fpicker/kdecommandthread.cxx index c783556c5268..1f9f663fa15d 100644 --- a/vcl/unx/kde/fpicker/kdecommandthread.cxx +++ b/vcl/unx/kde/fpicker/kdecommandthread.cxx @@ -21,6 +21,8 @@ #include <kdecommandthread.hxx> +#include <config_vclplug.h> + #ifdef ENABLE_TDE #include <tqstringlist.h> #else // ENABLE_TDE diff --git a/vcl/unx/kde/fpicker/kdecommandthread.hxx b/vcl/unx/kde/fpicker/kdecommandthread.hxx index 70c790af92c1..acb90d8af248 100644 --- a/vcl/unx/kde/fpicker/kdecommandthread.hxx +++ b/vcl/unx/kde/fpicker/kdecommandthread.hxx @@ -20,6 +20,8 @@ #ifndef _KDECOMMANDTHREAD_HXX_ #define _KDECOMMANDTHREAD_HXX_ +#include <config_vclplug.h> + #ifdef ENABLE_TDE #include <shell/tde_defines.h> #endif // ENABLE_TDE diff --git a/vcl/unx/kde/fpicker/kdefilepicker.cxx b/vcl/unx/kde/fpicker/kdefilepicker.cxx index f937eb914cf0..b0d20e4a43f4 100644 --- a/vcl/unx/kde/fpicker/kdefilepicker.cxx +++ b/vcl/unx/kde/fpicker/kdefilepicker.cxx @@ -22,6 +22,8 @@ #include <kdecommandthread.hxx> #include <kdefilepicker.hxx> +#include <config_vclplug.h> + #ifdef ENABLE_TDE #include <tqcheckbox.h> diff --git a/vcl/unx/kde/fpicker/kdefilepicker.hxx b/vcl/unx/kde/fpicker/kdefilepicker.hxx index 2e4166742268..e7638eaa0e91 100644 --- a/vcl/unx/kde/fpicker/kdefilepicker.hxx +++ b/vcl/unx/kde/fpicker/kdefilepicker.hxx @@ -20,6 +20,8 @@ #ifndef _KDEFILEPICKER_HXX_ #define _KDEFILEPICKER_HXX_ +#include <config_vclplug.h> + #ifdef ENABLE_TDE #include <shell/tde_defines.h> #endif // ENABLE_TDE diff --git a/vcl/unx/kde/fpicker/kdefpmain.cxx b/vcl/unx/kde/fpicker/kdefpmain.cxx index c794d53b6775..a18a9695f2f7 100644 --- a/vcl/unx/kde/fpicker/kdefpmain.cxx +++ b/vcl/unx/kde/fpicker/kdefpmain.cxx @@ -30,6 +30,8 @@ #include <iostream> #include <stdlib.h> +#include <config_vclplug.h> + #ifdef ENABLE_TDE #define THIS_DESKENV_NAME_CAP "TDE" #define THIS_DESKENV_NAME_LOW "tde" diff --git a/vcl/unx/kde/fpicker/kdemodalityfilter.hxx b/vcl/unx/kde/fpicker/kdemodalityfilter.hxx index 607a57652a0a..05331fe8afb3 100644 --- a/vcl/unx/kde/fpicker/kdemodalityfilter.hxx +++ b/vcl/unx/kde/fpicker/kdemodalityfilter.hxx @@ -20,6 +20,8 @@ #ifndef _KDEMODALITYFILTER_HXX_ #define _KDEMODALITYFILTER_HXX_ +#include <config_vclplug.h> + #ifdef ENABLE_TDE #include <shell/tde_defines.h> #endif // ENABLE_TDE diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index e66475d6d598..7d84c7963161 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -45,6 +45,8 @@ #include "vclpluginapi.h" +#include <config_vclplug.h> + #ifdef ENABLE_TDE #define THIS_DESKENV_NAME_CAP "TDE" #define THIS_DESKENV_NAME_LOW "tde" diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 1440b841a71c..8f6c26b9a047 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -32,6 +32,8 @@ #include <vcl/vclenum.hxx> #include <rtl/ustrbuf.hxx> +#include <config_vclplug.h> + #ifdef ENABLE_TDE #define QPushButton_String "TQPushButton" #define QRadioButton_String "TQRadioButton" |