From 3fd22b7b86ebad8fbd4b66da3d63e6d9c1ca829c Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <boris@codesynthesis.com>
Date: Mon, 13 Dec 2010 11:38:49 +0200
Subject: Detect TR1 <memory> availability

Also use the wrapper header from libodb.
---
 libcommon/common/common.cxx             |  4 +---
 libcommon/common/config-vc.h            | 14 ++++++++++++++
 libcommon/common/config.h.in            |  1 +
 libcommon/common/config.hxx             | 15 +++++++++++++++
 libcommon/common/export.hxx             |  4 +---
 libcommon/common/libcommon-vc10.vcxproj | 10 +++++-----
 libcommon/common/libcommon-vc9.vcproj   |  8 ++++----
 libcommon/common/makefile               |  8 +++++---
 8 files changed, 46 insertions(+), 18 deletions(-)
 create mode 100644 libcommon/common/config-vc.h
 create mode 100644 libcommon/common/config.hxx

(limited to 'libcommon')

diff --git a/libcommon/common/common.cxx b/libcommon/common/common.cxx
index a2a2e64..a15ab93 100644
--- a/libcommon/common/common.cxx
+++ b/libcommon/common/common.cxx
@@ -6,9 +6,7 @@
 #include <cstdlib> // std::exit
 #include <iostream>
 
-#ifndef _MSC_VER
-#  include <common/config.h>
-#endif
+#include <common/config.hxx>
 
 #if defined(DATABASE_MYSQL)
 #  include <odb/mysql/database.hxx>
diff --git a/libcommon/common/config-vc.h b/libcommon/common/config-vc.h
new file mode 100644
index 0000000..fa739a4
--- /dev/null
+++ b/libcommon/common/config-vc.h
@@ -0,0 +1,14 @@
+/* file      : libcommon/common/config-vc.h
+ * author    : Boris Kolpackov <boris@codesynthesis.com>
+ * copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+ * license   : GNU GPL v2; see accompanying LICENSE file
+ */
+
+/* Configuration file for Windows/VC++. */
+
+#ifndef LIBCOMMON_COMMON_CONFIG_VC_H
+#define LIBCOMMON_COMMON_CONFIG_VC_H
+
+#define HAVE_TR1_MEMORY
+
+#endif /* LIBCOMMON_COMMON_CONFIG_VC_H */
diff --git a/libcommon/common/config.h.in b/libcommon/common/config.h.in
index d0b2bd9..a1140e1 100644
--- a/libcommon/common/config.h.in
+++ b/libcommon/common/config.h.in
@@ -10,6 +10,7 @@
 #define LIBCOMMON_COMMON_CONFIG_H
 
 #undef DATABASE_MYSQL
+#undef HAVE_TR1_MEMORY
 #undef LIBCOMMON_STATIC_LIB
 
 #endif /* LIBCOMMON_COMMON_CONFIG_H */
diff --git a/libcommon/common/config.hxx b/libcommon/common/config.hxx
new file mode 100644
index 0000000..c08be65
--- /dev/null
+++ b/libcommon/common/config.hxx
@@ -0,0 +1,15 @@
+// file      : libcommon/common/config.hxx
+// author    : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// license   : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef LIBCOMMON_COMMON_CONFIG_HXX
+#define LIBCOMMON_COMMON_CONFIG_HXX
+
+#ifdef HAVE_CONFIG_VC_H
+#  include <common/config-vc.h>
+#else
+#  include <common/config.h>
+#endif
+
+#endif // LIBCOMMON_COMMON_CONFIG_HXX
diff --git a/libcommon/common/export.hxx b/libcommon/common/export.hxx
index 4ea2d33..5a7fed1 100644
--- a/libcommon/common/export.hxx
+++ b/libcommon/common/export.hxx
@@ -6,9 +6,7 @@
 #ifndef LIBCOMMON_COMMON_EXPORT_HXX
 #define LIBCOMMON_COMMON_EXPORT_HXX
 
-#ifndef _MSC_VER
-#  include <common/config.h>
-#endif
+#include <common/config.hxx>
 
 #ifdef LIBCOMMON_STATIC_LIB
 #  define LIBCOMMON_EXPORT
diff --git a/libcommon/common/libcommon-vc10.vcxproj b/libcommon/common/libcommon-vc10.vcxproj
index 44034da..69494b0 100644
--- a/libcommon/common/libcommon-vc10.vcxproj
+++ b/libcommon/common/libcommon-vc10.vcxproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
@@ -88,7 +88,7 @@
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_VC_H;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
       <DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
     </ClCompile>
@@ -106,7 +106,7 @@
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_VC_H;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
       <DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
     </ClCompile>
@@ -126,7 +126,7 @@
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_VC_H;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
       <DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
     </ClCompile>
@@ -148,7 +148,7 @@
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_VC_H;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
       <DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
     </ClCompile>
diff --git a/libcommon/common/libcommon-vc9.vcproj b/libcommon/common/libcommon-vc9.vcproj
index c7ef766..a7ec116 100644
--- a/libcommon/common/libcommon-vc9.vcproj
+++ b/libcommon/common/libcommon-vc9.vcproj
@@ -46,7 +46,7 @@
 				AdditionalOptions="/wd4355 /wd4800 /wd4290"
 				Optimization="0"
 				AdditionalIncludeDirectories=".."
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_VC_H;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -124,7 +124,7 @@
 				AdditionalOptions="/wd4355 /wd4800 /wd4290"
 				Optimization="0"
 				AdditionalIncludeDirectories=".."
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;__upcase__(database_)__upcase__(__value__(database));__upcase__(database_)__upcase__(__value__(database));__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_VC_H;__upcase__(database_)__upcase__(__value__(database));__upcase__(database_)__upcase__(__value__(database));__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -203,7 +203,7 @@
 				Optimization="2"
 				EnableIntrinsicFunctions="true"
 				AdditionalIncludeDirectories=".."
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_VC_H;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
 				UsePrecompiledHeader="0"
@@ -284,7 +284,7 @@
 				Optimization="2"
 				EnableIntrinsicFunctions="true"
 				AdditionalIncludeDirectories=".."
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_VC_H;__upcase__(database_)__upcase__(__value__(database));LIBCOMMON_DYNAMIC_LIB"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
 				UsePrecompiledHeader="0"
diff --git a/libcommon/common/makefile b/libcommon/common/makefile
index c9ecdaf..6259e69 100644
--- a/libcommon/common/makefile
+++ b/libcommon/common/makefile
@@ -42,8 +42,9 @@ $(common.l.cpp-options): value := -I$(out_root)/libcommon -I$(src_root)/libcommo
 $(common.l.cpp-options): $(odb_db.l.cpp-options) $(odb.l.cpp-options)
 
 $(out_base)/config.h: $(dcf_root)/configuration-dynamic.make
-	@echo '// file      : libcommon/config.h'                        >$@
-	@echo '// author    : automatically generated'                  >>$@
+	@echo '/* file      : libcommon/common/config.h'                 >$@
+	@echo ' * author    : automatically generated'                  >>$@
+	@echo ' */'                                                     >>$@
 	@echo ''                                                        >>$@
 	@echo '#ifndef LIBCOMMON_COMMON_CONFIG_H'                       >>$@
 	@echo '#define LIBCOMMON_COMMON_CONFIG_H'                       >>$@
@@ -51,8 +52,9 @@ $(out_base)/config.h: $(dcf_root)/configuration-dynamic.make
 ifeq ($(db_id),mysql)
 	@echo '#define DATABASE_MYSQL 1'                                >>$@
 endif
+	@echo '#define HAVE_TR1_MEMORY 1'                               >>$@
 	@echo ''                                                        >>$@
-	@echo '#endif // LIBCOMMON_COMMON_CONFIG_H'                     >>$@
+	@echo '#endif /* LIBCOMMON_COMMON_CONFIG_H */'                  >>$@
 
 $(call include-dep,$(cxx_od),$(cxx_obj),$(out_base)/config.h)
 
-- 
cgit v1.1