aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-08-30 15:49:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-08-30 15:49:05 +0200
commit547d1dd2da9c9b2b010da6d167ac88959342a634 (patch)
tree2d778c647f7bcd97fcd60660281f4d9b0a806735
parente927a6f2a3e3a72a18441fe9f603a336503f68e8 (diff)
Support for automake and VC++ builds
-rw-r--r--configure.ac90
-rw-r--r--libodb-vc9.sln2
-rw-r--r--libodb.pc.in2
-rw-r--r--m4/disable-rpath.m426
-rw-r--r--m4/libodb.m483
-rw-r--r--m4/libtool-link.m431
-rw-r--r--m4/pkgconfig.m413
-rw-r--r--m4/threads.m441
-rw-r--r--makefile1
-rw-r--r--odb/compilers/vc/pre.hxx7
-rw-r--r--odb/libodb-vc10.vcxproj16
-rw-r--r--odb/libodb-vc9.vcproj8
12 files changed, 231 insertions, 89 deletions
diff --git a/configure.ac b/configure.ac
index 932b47c..cad1e36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,82 +20,33 @@ AC_CANONICAL_HOST
AC_PROG_CXX
AC_LANG(C++)
-# Check for threads.
+# Required by subdir-objects.
#
-AC_ARG_ENABLE(
- [threads],
- AS_HELP_STRING([--disable-threads], [disable threads (enabled by default)]),
- [AS_IF([test x"$enableval" = xno], [threads=none], [threads=check])],
- [threads=check])
+AM_PROG_CC_C_O
-# If thread support is not disabled by the user, figure out what we
-# can use.
+# Create the libtool executable so that we can use it in further tests.
#
-AS_IF(
- [test x$threads = xcheck],
- [
- case $host_os in
- windows* | mingw*)
- AC_DEFINE([ODB_THREADS_WIN32], [1], [Have Win32 threads.])
- case $host_os in
- mingw*)
- CXXFLAGS="$CXXFLAGS -mthreads"
- ;;
- esac
- threads=win32
- ;;
- *)
- ACX_PTHREAD
- AS_IF(
- [test x$acx_pthread_ok = xyes],
- [
- threads=posix
- LIBS="$LIBS $PTHREAD_LIBS"
- CXXFLAGS="$CXXFLAGS $PTHREAD_CXXFLAGS"
- AC_DEFINE([ODB_THREADS_POSIX], [1], [Have POSIX threads.])
- ])
- ;;
- esac
- ],
- [AC_DEFINE([ODB_THREADS_NONE], [1], [Have no threads.])])
-
-AM_CONDITIONAL([ODB_THREADS_NONE], [test x"$threads" = xnone])
-AM_CONDITIONAL([ODB_THREADS_WIN32], [test x"$threads" = xwin32])
-AM_CONDITIONAL([ODB_THREADS_POSIX], [test x"$threads" = xposix])
+LT_OUTPUT
-# Check if we should disable rpath.
+# Check for threads.
#
-AC_MSG_CHECKING([whether to use rpath])
-AC_ARG_ENABLE(
- [rpath],
- [AC_HELP_STRING([--disable-rpath], [patch libtool to not use rpath])],
- [libtool_rpath="$enable_rpath"],
- [libtool_rpath="yes"])
-AC_MSG_RESULT($libtool_rpath)
+THREADS
-# Allow the user to specify the pkgconfig directory.
-#
-AC_ARG_WITH(
- [pkgconfigdir],
- [AC_HELP_STRING([--with-pkgconfigdir=DIR],[location of pkgconfig dir (default is libdir/pkgconfig)])],
- [pkgconfigdir=${withval}],
- [pkgconfigdir='${libdir}/pkgconfig'])
-AC_SUBST([pkgconfigdir])
+AM_CONDITIONAL([ODB_THREADS_NONE], [test x$threads = xnone])
+AM_CONDITIONAL([ODB_THREADS_WIN32], [test x$threads = xwin32])
+AM_CONDITIONAL([ODB_THREADS_POSIX], [test x$threads = xposix])
-# Required by subdir-objects.
+AS_IF([test x$threads = xnone], AC_DEFINE([ODB_THREADS_NONE], [1], [Have no threads.]))
+AS_IF([test x$threads = xwin32], AC_DEFINE([ODB_THREADS_WIN32], [1], [Have Win32 threads.]))
+AS_IF([test x$threads = xposix], AC_DEFINE([ODB_THREADS_POSIX], [1], [Have POSIX threads.]))
+
+# Allow the user to specify the pkgconfig directory.
#
-AM_PROG_CC_C_O
+PKGCONFIG
-# Patch libtool to not use rpath if requested.
+# Check if we should disable rpath.
#
-AC_CONFIG_COMMANDS(
- [libtool-rpath-patch],
- [if test "$libtool_use_rpath" = "no"; then
- sed < libtool > libtool-2 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_NO_RPATH__ "/'
- mv libtool-2 libtool
- chmod 755 libtool
- fi],
- [libtool_use_rpath=$libtool_rpath])
+DISABLE_RPATH
# Output.
#
@@ -104,10 +55,3 @@ AC_CONFIG_FILES([
__path__(config_files)
])
AC_OUTPUT
-
-AS_IF(
- [test x$threads = xcheck],
- [
- AC_MSG_NOTICE
- AC_MSG_NOTICE([warning: thread support not available, building single-threaded])
- ])
diff --git a/libodb-vc9.sln b/libodb-vc9.sln
index ff293ae..2ca5e34 100644
--- a/libodb-vc9.sln
+++ b/libodb-vc9.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libodb", "odb/libodb-vc9.vcproj", "{513E5721-D318-46B0-8CFB-054042DF87A7}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libodb", "odb\libodb-vc9.vcproj", "{513E5721-D318-46B0-8CFB-054042DF87A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/libodb.pc.in b/libodb.pc.in
index a4bcba5..145bbb0 100644
--- a/libodb.pc.in
+++ b/libodb.pc.in
@@ -9,7 +9,7 @@ libdir=@libdir@
includedir=@includedir@
Name: libodb
-Description: Object persistence compiler for C++, runtime library
+Description: Object persistence compiler for C++, common runtime library
URL: http://www.codesynthesis.com/products/odb/
Version: @VERSION@
Libs: -L${libdir} -lodb
diff --git a/m4/disable-rpath.m4 b/m4/disable-rpath.m4
new file mode 100644
index 0000000..da77bbe
--- /dev/null
+++ b/m4/disable-rpath.m4
@@ -0,0 +1,26 @@
+dnl file : m4/disable-rpath.m4
+dnl author : Boris Kolpackov <boris@codesynthesis.com>
+dnl copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+dnl license : GNU GPL v2; see accompanying LICENSE file
+dnl
+AC_DEFUN([DISABLE_RPATH],[
+
+AC_MSG_CHECKING([whether to use rpath])
+AC_ARG_ENABLE(
+ [rpath],
+ [AC_HELP_STRING([--disable-rpath], [patch libtool to not use rpath])],
+ [libtool_rpath="$enable_rpath"],
+ [libtool_rpath="yes"])
+AC_MSG_RESULT($libtool_rpath)
+
+# Patch libtool to not use rpath if requested.
+#
+AC_CONFIG_COMMANDS(
+ [libtool-rpath-patch],
+ [if test "$libtool_use_rpath" = "no"; then
+ sed < libtool > libtool-2 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_NO_RPATH__ "/'
+ mv libtool-2 libtool
+ chmod 755 libtool
+ fi],
+ [libtool_use_rpath=$libtool_rpath])
+])dnl
diff --git a/m4/libodb.m4 b/m4/libodb.m4
new file mode 100644
index 0000000..a205afd
--- /dev/null
+++ b/m4/libodb.m4
@@ -0,0 +1,83 @@
+dnl file : m4/libodb.m4
+dnl author : Boris Kolpackov <boris@codesynthesis.com>
+dnl copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+dnl license : GNU GPL v2; see accompanying LICENSE file
+dnl
+dnl LIBODB([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl
+AC_DEFUN([LIBODB], [
+libodb_found=no
+
+AC_ARG_WITH(
+ [libodb],
+ [AC_HELP_STRING([--with-libodb=DIR],[location of libodb build directory])],
+ [libodb_dir=${withval}],
+ [libodb_dir=])
+
+AC_MSG_CHECKING([for libodb])
+
+# If libodb_dir was given, add the necessary preprocessor and linker flags.
+#
+if test x"$libodb_dir" != x; then
+ save_CPPFLAGS="$CPPFLAGS"
+ save_LDFLAGS="$LDFLAGS"
+
+ AS_SET_CATFILE([abs_libodb_dir], [$ac_pwd], [$libodb_dir])
+
+ CPPFLAGS="$CPPFLAGS -I$abs_libodb_dir"
+ LDFLAGS="$LDFLAGS -L$abs_libodb_dir/odb"
+fi
+
+save_LIBS="$LIBS"
+LIBS="-lodb $LIBS"
+
+CXX_LIBTOOL_LINK_IFELSE(
+AC_LANG_SOURCE([[
+#include <odb/exception.hxx>
+
+void
+f ()
+{
+}
+
+const char*
+g ()
+{
+ try
+ {
+ f ();
+ }
+ catch (const odb::exception& e)
+ {
+ return e.what ();
+ }
+ return 0;
+}
+
+int
+main ()
+{
+ const char* m (g ());
+ return m != 0;
+}
+]]),
+[libodb_found=yes])
+
+if test x"$libodb_found" = xno; then
+ LIBS="$save_LIBS"
+
+ if test x"$libodb_dir" != x; then
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ fi
+fi
+
+if test x"$libodb_found" = xyes; then
+ AC_MSG_RESULT([yes])
+ $1
+else
+ AC_MSG_RESULT([no])
+ $2
+fi
+])dnl
diff --git a/m4/libtool-link.m4 b/m4/libtool-link.m4
new file mode 100644
index 0000000..229b270
--- /dev/null
+++ b/m4/libtool-link.m4
@@ -0,0 +1,31 @@
+dnl file : m4/libtool-link.m4
+dnl author : Boris Kolpackov <boris@codesynthesis.com>
+dnl copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+dnl license : GNU GPL v2; see accompanying LICENSE file
+dnl
+dnl
+dnl CXX_LIBTOOL_LINK_IFELSE (input, [action-if-true], [action-if-false])
+dnl
+dnl Similar to AC_LINK_IFELSE except it uses libtool to perform the
+dnl linking and it does this using the C++ compiler.
+dnl
+AC_DEFUN([CXX_LIBTOOL_LINK_IFELSE],[
+AC_LANG_SAVE
+save_CXX="$CXX"
+CXX="./libtool --tag=CXX --mode=link $CXX -no-install"
+AC_LANG(C++)
+
+if test -d .libs; then
+ delete_libs_dir=no
+else
+ delete_libs_dir=yes
+fi
+
+AC_LINK_IFELSE([$1], [$2], [$3])
+
+if test x"$delete_libs_dir" != xyes; then
+ rm -rf .libs
+fi
+
+CXX="$save_CXX"
+AC_LANG_RESTORE])dnl
diff --git a/m4/pkgconfig.m4 b/m4/pkgconfig.m4
new file mode 100644
index 0000000..ef48ee8
--- /dev/null
+++ b/m4/pkgconfig.m4
@@ -0,0 +1,13 @@
+dnl file : m4/pkgconfig.m4
+dnl author : Boris Kolpackov <boris@codesynthesis.com>
+dnl copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+dnl license : GNU GPL v2; see accompanying LICENSE file
+dnl
+AC_DEFUN([PKGCONFIG],[
+AC_ARG_WITH(
+ [pkgconfigdir],
+ [AC_HELP_STRING([--with-pkgconfigdir=DIR],[location of pkgconfig dir (default is libdir/pkgconfig)])],
+ [pkgconfigdir=${withval}],
+ [pkgconfigdir='${libdir}/pkgconfig'])
+AC_SUBST([pkgconfigdir])
+])dnl
diff --git a/m4/threads.m4 b/m4/threads.m4
new file mode 100644
index 0000000..7c32abe
--- /dev/null
+++ b/m4/threads.m4
@@ -0,0 +1,41 @@
+dnl file : m4/threads.m4
+dnl author : Boris Kolpackov <boris@codesynthesis.com>
+dnl copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+dnl license : GNU GPL v2; see accompanying LICENSE file
+dnl
+AC_DEFUN([THREADS],[
+
+AC_ARG_ENABLE(
+ [threads],
+ AS_HELP_STRING([--disable-threads], [disable threads (enabled by default)]),
+ [AS_IF([test x"$enableval" = xno], [threads=none], [threads=check])],
+ [threads=check])
+
+# If thread support is not disabled by the user, figure out what we can use.
+#
+if test x$threads = xcheck; then
+ case $host_os in
+ windows* | mingw*)
+ case $host_os in
+ mingw*)
+ CXXFLAGS="$CXXFLAGS -mthreads"
+ ;;
+ esac
+ threads=win32
+ ;;
+ *)
+ ACX_PTHREAD
+
+ if test x$acx_pthread_ok = xyes; then
+ threads=posix
+ LIBS="$LIBS $PTHREAD_LIBS"
+ CXXFLAGS="$CXXFLAGS $PTHREAD_CXXFLAGS"
+ fi
+ ;;
+ esac
+fi
+
+if test x$threads = xcheck; then
+ AC_MSG_ERROR([thread support not available; use --disable-threads to force single-threaded mode])
+fi
+])dnl
diff --git a/makefile b/makefile
index c69fe3d..e03a047 100644
--- a/makefile
+++ b/makefile
@@ -15,7 +15,6 @@ $(default): $(addprefix $(out_base)/,$(addsuffix /,$(dirs)))
$(dist): export dirs := $(dirs)
$(dist): export docs := GPLv2 LICENSE README version
-$(dist): export docs := GPLv2 LICENSE README version
$(dist): data_dist := libodb-vc9.sln libodb-vc10.sln
$(dist): exec_dist := bootstrap
$(dist): export extra_dist := $(data_dist) $(exec_dist)
diff --git a/odb/compilers/vc/pre.hxx b/odb/compilers/vc/pre.hxx
index cdcb527..13a006b 100644
--- a/odb/compilers/vc/pre.hxx
+++ b/odb/compilers/vc/pre.hxx
@@ -19,10 +19,15 @@
#pragma warning (disable:4355) // passing 'this' to a member
#pragma warning (disable:4800) // forcing value to bool
#pragma warning (disable:4290) // exception specification ignored
+
//#pragma warning (disable:4275) // non dll-interface base
-//#pragma warning (disable:4251) // base needs to have dll-interface
//#pragma warning (disable:4224) // nonstandard extension (/Za option)
+// VC++ 10.0 (2010)
+//
+#if (_MSC_VER == 1600)
+# pragma warning (disable:4251) // needs to have DLL-interface
+#endif
// Elevated warnings.
//
diff --git a/odb/libodb-vc10.vcxproj b/odb/libodb-vc10.vcxproj
index 5047a56..81f1a2a 100644
--- a/odb/libodb-vc10.vcxproj
+++ b/odb/libodb-vc10.vcxproj
@@ -65,12 +65,12 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>..\bin\</OutDir>
- <TargetName>odb_d-__value__(interface_version)-vc10</TargetName>
+ <TargetName>odb-d-__value__(interface_version)-vc10</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>..\bin64\</OutDir>
- <TargetName>odb_d-__value__(interface_version)-vc10</TargetName>
+ <TargetName>odb-d-__value__(interface_version)-vc10</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
@@ -90,13 +90,13 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBODB_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
- <DisableSpecificWarnings>4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(TargetPath)</OutputFile>
- <ImportLibrary>..\lib\odb_d.lib</ImportLibrary>
+ <ImportLibrary>..\lib\odb-d.lib</ImportLibrary>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -107,13 +107,13 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBODB_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
- <DisableSpecificWarnings>4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(TargetPath)</OutputFile>
- <ImportLibrary>..\lib64\odb_d.lib</ImportLibrary>
+ <ImportLibrary>..\lib64\odb-d.lib</ImportLibrary>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -126,7 +126,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBODB_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
- <DisableSpecificWarnings>4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -147,7 +147,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBODB_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
- <DisableSpecificWarnings>4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
diff --git a/odb/libodb-vc9.vcproj b/odb/libodb-vc9.vcproj
index ac970db..3877c89 100644
--- a/odb/libodb-vc9.vcproj
+++ b/odb/libodb-vc9.vcproj
@@ -66,11 +66,11 @@
/>
<Tool
Name="VCLinkerTool"
- OutputFile="$(OutDir)\bin\odb_d-__value__(interface_version)-vc9.dll"
+ OutputFile="$(OutDir)\bin\odb-d-__value__(interface_version)-vc9.dll"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
- ImportLibrary="$(OutDir)\lib\odb_d.lib"
+ ImportLibrary="$(OutDir)\lib\odb-d.lib"
TargetMachine="1"
/>
<Tool
@@ -143,11 +143,11 @@
/>
<Tool
Name="VCLinkerTool"
- OutputFile="$(OutDir)\bin64\odb_d-__value__(interface_version)-vc9.dll"
+ OutputFile="$(OutDir)\bin64\odb-d-__value__(interface_version)-vc9.dll"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
- ImportLibrary="$(OutDir)\lib64\odb_d.lib"
+ ImportLibrary="$(OutDir)\lib64\odb-d.lib"
TargetMachine="17"
/>
<Tool