aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac7
-rw-r--r--m4/static-lib.m419
-rw-r--r--odb/tracer/Makefile.am5
-rw-r--r--odb/tracer/details/config.h.in14
-rw-r--r--odb/tracer/details/config.hxx23
-rw-r--r--odb/tracer/details/export.hxx20
-rw-r--r--odb/tracer/makefile2
7 files changed, 83 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 10b2bdd..63a881a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,11 @@ THREADS
#
LIBODB([],[AC_MSG_ERROR([libodb is not found; consider using --with-libodb=DIR])])
+# Define LIBODB_TRACER_STATIC_LIB if we are build static library on certain
+# platforms.
+#
+STATIC_LIB([LIBODB_TRACER_STATIC_LIB], [Static library interface.])
+
# Allow the user to specify the pkgconfig directory.
#
PKGCONFIG
@@ -42,7 +47,7 @@ DISABLE_RPATH
# Output.
#
-AC_CONFIG_HEADERS([odb/tracer/config.h])
+AC_CONFIG_HEADERS([odb/tracer/config.h odb/tracer/details/config.h])
AC_CONFIG_FILES([
__path__(config_files)
])
diff --git a/m4/static-lib.m4 b/m4/static-lib.m4
new file mode 100644
index 0000000..1c0af42
--- /dev/null
+++ b/m4/static-lib.m4
@@ -0,0 +1,19 @@
+dnl file : m4/static-lib.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 STATIC_LIB(MACRO, DESCRIPTION)
+dnl
+dnl Define MACRO if we are on MinGW and are only building static library.
+dnl
+AC_DEFUN([STATIC_LIB],
+[
+if test x$enable_shared = xno; then
+ case $host_os in
+ mingw*)
+ AC_DEFINE([$1], [1], [$2])
+ ;;
+ esac
+fi
+])dnl
diff --git a/odb/tracer/Makefile.am b/odb/tracer/Makefile.am
index ee14818..09c4244 100644
--- a/odb/tracer/Makefile.am
+++ b/odb/tracer/Makefile.am
@@ -8,8 +8,9 @@ libodb_tracer_la_SOURCES = __path__(sources)
odbtracerincludedir = $(includedir)/odb/tracer/
nobase_odbtracerinclude_HEADERS = __path__(headers)
+nobase_nodist_odbtracerinclude_HEADERS = details/config.h
EXTRA_DIST = __file__(extra_dist)
-AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
-libodb_tracer_la_LDFLAGS = -release __value__(interface_version)
+libodb_tracer_la_CPPFLAGS= -I$(top_builddir) -I$(top_srcdir) -DLIBODB_TRACER_DYNAMIC_LIB
+libodb_tracer_la_LDFLAGS = -release __value__(interface_version) -no-undefined
diff --git a/odb/tracer/details/config.h.in b/odb/tracer/details/config.h.in
new file mode 100644
index 0000000..4e4d215
--- /dev/null
+++ b/odb/tracer/details/config.h.in
@@ -0,0 +1,14 @@
+/* file : odb/tracer/details/config.h.in
+ * author : Boris Kolpackov <boris@codesynthesis.com>
+ * copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+ * license : GNU GPL v2; see accompanying LICENSE file
+ */
+
+/* This file is automatically processed by configure. */
+
+#ifndef ODB_TRACER_DETAILS_CONFIG_H
+#define ODB_TRACER_DETAILS_CONFIG_H
+
+#undef LIBODB_TRACER_STATIC_LIB
+
+#endif /* ODB_TRACER_DETAILS_CONFIG_H */
diff --git a/odb/tracer/details/config.hxx b/odb/tracer/details/config.hxx
new file mode 100644
index 0000000..d8e15b6
--- /dev/null
+++ b/odb/tracer/details/config.hxx
@@ -0,0 +1,23 @@
+// file : odb/tracer/details/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 ODB_TRACER_DETAILS_CONFIG_HXX
+#define ODB_TRACER_DETAILS_CONFIG_HXX
+
+// no pre
+
+#ifdef HAVE_CONFIG_H
+# include <odb/tracer/details/config.h>
+#endif
+
+#ifndef LIBODB_TRACER_INCLUDE_SHORT
+ #ifdef _WIN32
+ #define LIBODB_TRACER_INCLUDE_SHORT 1
+ #endif
+#endif
+
+// no post
+
+#endif // ODB_TRACER_DETAILS_CONFIG_HXX
diff --git a/odb/tracer/details/export.hxx b/odb/tracer/details/export.hxx
index 152a967..0bd43da 100644
--- a/odb/tracer/details/export.hxx
+++ b/odb/tracer/details/export.hxx
@@ -8,14 +8,28 @@
#include <odb/pre.hxx>
+#include <odb/tracer/details/config.hxx>
+
#ifdef LIBODB_TRACER_STATIC_LIB
# define LIBODB_TRACER_EXPORT
#else
# ifdef _WIN32
-# ifdef LIBODB_TRACER_DYNAMIC_LIB
-# define LIBODB_TRACER_EXPORT __declspec(dllexport)
+# ifdef _MSC_VER
+# ifdef LIBODB_TRACER_DYNAMIC_LIB
+# define LIBODB_TRACER_EXPORT __declspec(dllexport)
+# else
+# define LIBODB_TRACER_EXPORT __declspec(dllimport)
+# endif
# else
-# define LIBODB_TRACER_EXPORT __declspec(dllimport)
+# ifdef LIBODB_TRACER_DYNAMIC_LIB
+# ifdef DLL_EXPORT
+# define LIBODB_TRACER_EXPORT __declspec(dllexport)
+# else
+# define LIBODB_TRACER_EXPORT
+# endif
+# else
+# define LIBODB_TRACER_EXPORT __declspec(dllimport)
+# endif
# endif
# else
# define LIBODB_TRACER_EXPORT
diff --git a/odb/tracer/makefile b/odb/tracer/makefile
index 40a9215..3402451 100644
--- a/odb/tracer/makefile
+++ b/odb/tracer/makefile
@@ -49,7 +49,7 @@ $(dist): export interface_version = $(shell sed -e \
's/^\([0-9]*\.[0-9]*\).*/\1/' $(src_root)/version)
$(dist):
- $(call dist-data,$(sources) $(headers))
+ $(call dist-data,$(sources) $(headers) details/config.h.in)
$(call meta-vc9proj,$(src_base)/libodb-tracer-vc9.vcproj)
$(call meta-vc10proj,$(src_base)/libodb-tracer-vc10.vcxproj)
$(call meta-automake)