From 19d0eb2adcda31d9919bca8fef98cb1871b4ce54 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 14 Sep 2010 19:01:49 +0200 Subject: Add automake and VC++ builds (meta-build) --- Makefile.am | 12 ++ TODO | 6 +- bootstrap | 18 ++ build/bootstrap.make | 33 +++- configure.ac | 41 +++++ cutl/Makefile.am | 15 ++ cutl/compiler/context.hxx | 8 +- cutl/compiler/type-id.hxx | 4 +- cutl/compiler/type-info.hxx | 14 +- cutl/container/any.hxx | 8 +- cutl/container/graph.hxx | 6 +- cutl/cutl-8.0.sln | 20 --- cutl/cutl-8.0.vcproj | 214 ----------------------- cutl/cutl-9.0.sln | 20 --- cutl/cutl-9.0.vcproj | 215 ----------------------- cutl/details/config.h.in | 14 ++ cutl/details/config.hxx | 14 ++ cutl/details/export.hxx | 37 ++++ cutl/exception.hxx | 4 +- cutl/fs/auto-remove.hxx | 6 +- cutl/fs/exception.hxx | 2 +- cutl/fs/path.hxx | 4 +- cutl/libcutl-vc10.vcxproj | 170 ++++++++++++++++++ cutl/libcutl-vc10.vcxproj.filters | 19 ++ cutl/libcutl-vc9.vcproj | 355 ++++++++++++++++++++++++++++++++++++++ cutl/makefile | 50 +++++- cutl/shared-ptr/base.hxx | 16 +- libcutl-vc10.sln | 26 +++ libcutl-vc9.sln | 26 +++ libcutl.pc.in | 16 ++ m4/disable-rpath.m4 | 26 +++ m4/libtool-link.m4 | 31 ++++ m4/pkgconfig.m4 | 13 ++ makefile | 36 ++-- tests/Makefile.am | 6 + tests/makefile | 9 + 36 files changed, 998 insertions(+), 516 deletions(-) create mode 100644 Makefile.am create mode 100755 bootstrap create mode 100644 configure.ac create mode 100644 cutl/Makefile.am delete mode 100644 cutl/cutl-8.0.sln delete mode 100644 cutl/cutl-8.0.vcproj delete mode 100644 cutl/cutl-9.0.sln delete mode 100644 cutl/cutl-9.0.vcproj create mode 100644 cutl/details/config.h.in create mode 100644 cutl/details/config.hxx create mode 100644 cutl/details/export.hxx create mode 100644 cutl/libcutl-vc10.vcxproj create mode 100644 cutl/libcutl-vc10.vcxproj.filters create mode 100644 cutl/libcutl-vc9.vcproj create mode 100644 libcutl-vc10.sln create mode 100644 libcutl-vc9.sln create mode 100644 libcutl.pc.in create mode 100644 m4/disable-rpath.m4 create mode 100644 m4/libtool-link.m4 create mode 100644 m4/pkgconfig.m4 create mode 100644 tests/Makefile.am diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..de949c6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,12 @@ +# file : Makefile.am +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +SUBDIRS = __path__(dirs) +dist_doc_DATA = __file__(docs) +EXTRA_DIST = __file__(extra_dist) +ACLOCAL_AMFLAGS = -I m4 + +pkgconfigdir = @pkgconfigdir@ +pkgconfig_DATA= libcutl.pc diff --git a/TODO b/TODO index 02118ed..99f4b73 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,7 @@ @@ Add memprof? -@@ path::base() and ".." & "." special directories +@@ path::base() and ".." & "." special directories. +@@ INSTALL does not describe automake/vc++ (not currently dist'ed). +@@ Add static lib vc++ configurations (for cli). +@@ Handle tests in automake. + diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..611e838 --- /dev/null +++ b/bootstrap @@ -0,0 +1,18 @@ +#! /bin/sh + +# file : bootstrap +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +# +# Bootstrap the automake build system. +# + +rm -f config.cache + +if test ! -d m4; then + mkdir m4 +fi + +autoreconf --install diff --git a/build/bootstrap.make b/build/bootstrap.make index 7d34526..6c742dd 100644 --- a/build/bootstrap.make +++ b/build/bootstrap.make @@ -21,29 +21,54 @@ endif # .PHONY: $(out_base)/ \ $(out_base)/.test \ + $(out_base)/.dist \ $(out_base)/.install \ $(out_base)/.clean ifdef %interactive% -.PHONY: test install clean +.PHONY: test dist install clean test: $(out_base)/.test +dist: $(out_base)/.dist install: $(out_base)/.install clean: $(out_base)/.clean -ifneq ($(filter $(.DEFAULT_GOAL),test install clean),) +ifneq ($(filter $(.DEFAULT_GOAL),test dist install clean),) .DEFAULT_GOAL := endif endif -# Don't include dependency info for certain targets. +# Make sure the distribution prefix is set if the goal is dist. # +ifneq ($(filter $(MAKECMDGOALS),dist),) +ifeq ($(dist_prefix),) +$(error dist_prefix is not set) +endif +endif + +# If we don't have dependency auto-generation then we need to manually +# make sure that generated files are generated before C++ file are +# compiler. To do this we make the object files ($2) depend in order- +# only on generated files ($3). +# +ifeq ($(cxx_id),generic) + +define include-dep +$(if $2,$(eval $2: | $3)) +endef + +else + define include-dep $(call -include,$1) endef -ifneq ($(filter $(MAKECMDGOALS),clean disfigure),) +endif + +# Don't include dependency info for certain targets. +# +ifneq ($(filter $(MAKECMDGOALS),clean disfigure dist),) include-dep = endif diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..e45f845 --- /dev/null +++ b/configure.ac @@ -0,0 +1,41 @@ +# file : configure.ac +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +AC_PREREQ(2.60) +AC_INIT([libcutl], [__value__(version)], [libcutl-users@codesynthesis.com]) +AC_CONFIG_AUX_DIR([config]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_SRCDIR([cutl/exception.hxx]) + +AM_INIT_AUTOMAKE([-Wall -Werror foreign nostdinc subdir-objects dist-bzip2 dist-zip tar-ustar]) + +LT_INIT([win32-dll]) + +AC_CANONICAL_HOST + +# Check for C++ compiler and use it to compile the tests. +# +AC_PROG_CXX +AC_LANG(C++) + +# Create the libtool executable so that we can use it in further tests. +# +LT_OUTPUT + +# Allow the user to specify the pkgconfig directory. +# +PKGCONFIG + +# Check if we should disable rpath. +# +DISABLE_RPATH + +# Output. +# +AC_CONFIG_HEADERS([cutl/config.h cutl/details/config.h]) +AC_CONFIG_FILES([ + __path__(config_files) +]) +AC_OUTPUT diff --git a/cutl/Makefile.am b/cutl/Makefile.am new file mode 100644 index 0000000..53859e4 --- /dev/null +++ b/cutl/Makefile.am @@ -0,0 +1,15 @@ +# file : cutl/Makefile.am +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +EXTRA_DIST = __file__(extra_dist) + +lib_LTLIBRARIES = libcutl.la +libcutl_la_SOURCES = __path__(sources) + +cutlincludedir = $(includedir)/cutl +nobase_cutlinclude_HEADERS = __path__(headers) + +AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) +libcutl_la_LDFLAGS = -release __value__(interface_version) diff --git a/cutl/compiler/context.hxx b/cutl/compiler/context.hxx index 32f301f..f5d2c6d 100644 --- a/cutl/compiler/context.hxx +++ b/cutl/compiler/context.hxx @@ -13,15 +13,17 @@ #include #include +#include + namespace cutl { namespace compiler { - class context + class LIBCUTL_EXPORT context { public: - struct no_entry: exception {}; - struct typing: exception {}; + struct LIBCUTL_EXPORT no_entry: exception {}; + struct LIBCUTL_EXPORT typing: exception {}; public: context () {} diff --git a/cutl/compiler/type-id.hxx b/cutl/compiler/type-id.hxx index 099da6d..87ffad4 100644 --- a/cutl/compiler/type-id.hxx +++ b/cutl/compiler/type-id.hxx @@ -8,11 +8,13 @@ #include // std::type_info +#include + namespace cutl { namespace compiler { - class type_id + class LIBCUTL_EXPORT type_id { public: template diff --git a/cutl/compiler/type-info.hxx b/cutl/compiler/type-info.hxx index b005ec4..b69451c 100644 --- a/cutl/compiler/type-info.hxx +++ b/cutl/compiler/type-info.hxx @@ -14,6 +14,8 @@ #include #include +#include + namespace cutl { namespace compiler @@ -26,7 +28,7 @@ namespace cutl // // - class base_info + class LIBCUTL_EXPORT base_info { public: base_info (type_id const&); @@ -45,7 +47,7 @@ namespace cutl // // - class type_info + class LIBCUTL_EXPORT type_info { typedef std::vector bases; @@ -77,12 +79,12 @@ namespace cutl // // - class no_type_info: exception {}; + class LIBCUTL_EXPORT no_type_info: exception {}; - type_info const& + LIBCUTL_EXPORT type_info const& lookup (type_id const&); - type_info const& + LIBCUTL_EXPORT type_info const& lookup (std::type_info const&); template @@ -93,7 +95,7 @@ namespace cutl type_info const& lookup (); - void + LIBCUTL_EXPORT void insert (type_info const&); namespace bits diff --git a/cutl/container/any.hxx b/cutl/container/any.hxx index 8999fbb..feeb302 100644 --- a/cutl/container/any.hxx +++ b/cutl/container/any.hxx @@ -11,14 +11,16 @@ #include +#include + namespace cutl { namespace container { - class any + class LIBCUTL_EXPORT any { public: - struct typing: exception {}; + struct LIBCUTL_EXPORT typing: exception {}; public: template @@ -76,7 +78,7 @@ namespace cutl } private: - class holder + class LIBCUTL_EXPORT holder { public: virtual diff --git a/cutl/container/graph.hxx b/cutl/container/graph.hxx index 9244351..e797c22 100644 --- a/cutl/container/graph.hxx +++ b/cutl/container/graph.hxx @@ -11,12 +11,14 @@ #include #include +#include + namespace cutl { namespace container { - struct no_edge: exception {}; - struct no_node: exception {}; + struct LIBCUTL_EXPORT no_edge: exception {}; + struct LIBCUTL_EXPORT no_node: exception {}; template class graph diff --git a/cutl/cutl-8.0.sln b/cutl/cutl-8.0.sln deleted file mode 100644 index e5e8477..0000000 --- a/cutl/cutl-8.0.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cutl", "cutl-8.0.vcproj", "{162AFFCF-ABD2-46F3-97A8-642F1256D8B5}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {162AFFCF-ABD2-46F3-97A8-642F1256D8B5}.Debug|Win32.ActiveCfg = Debug|Win32 - {162AFFCF-ABD2-46F3-97A8-642F1256D8B5}.Debug|Win32.Build.0 = Debug|Win32 - {162AFFCF-ABD2-46F3-97A8-642F1256D8B5}.Release|Win32.ActiveCfg = Release|Win32 - {162AFFCF-ABD2-46F3-97A8-642F1256D8B5}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/cutl/cutl-8.0.vcproj b/cutl/cutl-8.0.vcproj deleted file mode 100644 index 82164d3..0000000 --- a/cutl/cutl-8.0.vcproj +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cutl/cutl-9.0.sln b/cutl/cutl-9.0.sln deleted file mode 100644 index 33a21d7..0000000 --- a/cutl/cutl-9.0.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cutl", "cutl-9.0.vcproj", "{630FA2F0-018B-463D-A56C-59EC72CC6521}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {630FA2F0-018B-463D-A56C-59EC72CC6521}.Debug|Win32.ActiveCfg = Debug|Win32 - {630FA2F0-018B-463D-A56C-59EC72CC6521}.Debug|Win32.Build.0 = Debug|Win32 - {630FA2F0-018B-463D-A56C-59EC72CC6521}.Release|Win32.ActiveCfg = Release|Win32 - {630FA2F0-018B-463D-A56C-59EC72CC6521}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/cutl/cutl-9.0.vcproj b/cutl/cutl-9.0.vcproj deleted file mode 100644 index 4416aa6..0000000 --- a/cutl/cutl-9.0.vcproj +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cutl/details/config.h.in b/cutl/details/config.h.in new file mode 100644 index 0000000..18b8f9d --- /dev/null +++ b/cutl/details/config.h.in @@ -0,0 +1,14 @@ +/* file : cutl/details/config.h.in + * author : Boris Kolpackov + * copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC + * license : MIT; see accompanying LICENSE file + */ + +/* This file is automatically processed by configure. */ + +#ifndef CUTL_DETAILS_CONFIG_H +#define CUTL_DETAILS_CONFIG_H + +#undef LIBCUTL_STATIC_LIB + +#endif /* CUTL_DETAILS_CONFIG_H */ diff --git a/cutl/details/config.hxx b/cutl/details/config.hxx new file mode 100644 index 0000000..2bbc274 --- /dev/null +++ b/cutl/details/config.hxx @@ -0,0 +1,14 @@ +// file : cutl/details/config.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#ifndef CUTL_DETAILS_CONFIG_HXX +#define CUTL_DETAILS_CONFIG_HXX + +#ifdef _MSC_VER +#else +# include +#endif + +#endif // CUTL_DETAILS_CONFIG_HXX diff --git a/cutl/details/export.hxx b/cutl/details/export.hxx new file mode 100644 index 0000000..4c7b494 --- /dev/null +++ b/cutl/details/export.hxx @@ -0,0 +1,37 @@ +// file : cutl/details/export.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#ifndef CUTL_DETAILS_EXPORT_HXX +#define CUTL_DETAILS_EXPORT_HXX + +#include + +#ifdef LIBCUTL_STATIC_LIB +# define LIBCUTL_EXPORT +#else +# ifdef _WIN32 +# ifdef _MSC_VER +# ifdef LIBCUTL_DYNAMIC_LIB +# define LIBCUTL_EXPORT __declspec(dllexport) +# else +# define LIBCUTL_EXPORT __declspec(dllimport) +# endif +# else +# ifdef LIBCUTL_DYNAMIC_LIB +# ifdef DLL_EXPORT +# define LIBCUTL_EXPORT __declspec(dllexport) +# else +# define LIBCUTL_EXPORT +# endif +# else +# define LIBCUTL_EXPORT __declspec(dllimport) +# endif +# endif +# else +# define LIBCUTL_EXPORT +# endif +#endif + +#endif // CUTL_DETAILS_EXPORT_HXX diff --git a/cutl/exception.hxx b/cutl/exception.hxx index e8e12b4..228a7ad 100644 --- a/cutl/exception.hxx +++ b/cutl/exception.hxx @@ -8,9 +8,11 @@ #include +#include + namespace cutl { - struct exception: std::exception + struct LIBCUTL_EXPORT exception: std::exception { // By default return the exception type name ( typeid (*this).name () ). // diff --git a/cutl/fs/auto-remove.hxx b/cutl/fs/auto-remove.hxx index bf2b701..c30a630 100644 --- a/cutl/fs/auto-remove.hxx +++ b/cutl/fs/auto-remove.hxx @@ -11,13 +11,15 @@ #include #include +#include + namespace cutl { namespace fs { // Remove a file or an empty directory on destruction unless canceled. // - struct auto_remove + struct LIBCUTL_EXPORT auto_remove { explicit auto_remove (path const& p) @@ -47,7 +49,7 @@ namespace cutl // Remove a list of file or aempty directories on destruction unless // canceled. // - struct auto_removes + struct LIBCUTL_EXPORT auto_removes { auto_removes () {} ~auto_removes (); diff --git a/cutl/fs/exception.hxx b/cutl/fs/exception.hxx index f00dadb..d238a73 100644 --- a/cutl/fs/exception.hxx +++ b/cutl/fs/exception.hxx @@ -12,7 +12,7 @@ namespace cutl { namespace fs { - struct error: exception + struct LIBCUTL_EXPORT error: exception { error (int code): code_ (code) {} diff --git a/cutl/fs/path.hxx b/cutl/fs/path.hxx index fbf179e..9fed07a 100644 --- a/cutl/fs/path.hxx +++ b/cutl/fs/path.hxx @@ -11,6 +11,8 @@ #include +#include + namespace cutl { namespace fs @@ -86,7 +88,7 @@ namespace cutl // // - class invalid_path_base: exception + class LIBCUTL_EXPORT invalid_path_base: exception { public: virtual char const* diff --git a/cutl/libcutl-vc10.vcxproj b/cutl/libcutl-vc10.vcxproj new file mode 100644 index 0000000..573d60a --- /dev/null +++ b/cutl/libcutl-vc10.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {A3903F70-CC9F-4D1C-9793-221EAE08DBB5} + Win32Proj + libcutl + + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + + + + + + + + + + + + + + + + + true + ..\bin\ + cutl-d-__value__(interface_version)-vc10 + + + true + ..\bin64\ + cutl-d-__value__(interface_version)-vc10 + + + false + ..\bin\ + cutl-__value__(interface_version)-vc10 + + + false + ..\bin64\ + cutl-__value__(interface_version)-vc10 + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBCUTL_DYNAMIC_LIB;%(PreprocessorDefinitions) + .. + 4355;4800;4290;4251;%(DisableSpecificWarnings) + + + Windows + true + $(TargetPath) + ..\lib\cutl-d.lib + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBCUTL_DYNAMIC_LIB;%(PreprocessorDefinitions) + .. + 4355;4800;4290;4251;%(DisableSpecificWarnings) + + + Windows + true + $(TargetPath) + ..\lib64\cutl-d.lib + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBCUTL_DYNAMIC_LIB;%(PreprocessorDefinitions) + .. + 4355;4800;4290;4251;%(DisableSpecificWarnings) + + + Windows + true + true + true + $(TargetPath) + ..\lib\cutl.lib + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBCUTL_DYNAMIC_LIB;%(PreprocessorDefinitions) + .. + 4355;4800;4290;4251;%(DisableSpecificWarnings) + + + Windows + true + true + true + $(TargetPath) + ..\lib64\cutl.lib + + + +__header_entries__(headers) + + +__source_entries__(sources) + + + + + diff --git a/cutl/libcutl-vc10.vcxproj.filters b/cutl/libcutl-vc10.vcxproj.filters new file mode 100644 index 0000000..641661b --- /dev/null +++ b/cutl/libcutl-vc10.vcxproj.filters @@ -0,0 +1,19 @@ + + + + + {A4EE4929-6BF6-4B45-8BF1-3187A81F096E} + cxx + + + {D965C189-96AF-4E9F-9C05-D815464A588F} + h;hxx;ixx;txx + + + +__header_filter_entries__(headers) + + +__source_filter_entries__(sources) + + diff --git a/cutl/libcutl-vc9.vcproj b/cutl/libcutl-vc9.vcproj new file mode 100644 index 0000000..474112f --- /dev/null +++ b/cutl/libcutl-vc9.vcproj @@ -0,0 +1,355 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +__source_entries__(sources) + + +__file_entries__(headers) + + + + + diff --git a/cutl/makefile b/cutl/makefile index 137da68..efc4301 100644 --- a/cutl/makefile +++ b/cutl/makefile @@ -21,6 +21,7 @@ cutl.l := $(out_base)/cutl.l cutl.l.cpp-options := $(out_base)/cutl.l.cpp-options default := $(out_base)/ +dist := $(out_base)/.dist install := $(out_base)/.install clean := $(out_base)/.clean @@ -30,21 +31,49 @@ clean := $(out_base)/.clean $(cutl.l): $(cxx_obj) $(cxx_obj) $(cxx_od): $(cutl.l.cpp-options) -$(cutl.l.cpp-options): value := -I$(src_root) +$(cutl.l.cpp-options): value := -I$(out_root) -I$(src_root) +$(cxx_obj) $(cxx_od): $(odb_tracer.l.cpp-options) $(out_base)/details/config.h -$(call include-dep,$(cxx_od)) +$(out_base)/details/config.h: + @echo '// file : cutl/details/config.h' >$@ + @echo '// author : automatically generated' >>$@ + @echo '' >>$@ + @echo '#ifndef CUTL_DETAILS_CONFIG_H' >>$@ + @echo '#define CUTL_DETAILS_CONFIG_H' >>$@ + @echo '' >>$@ + @echo '' >>$@ + @echo '#endif // CUTL_DETAILS_CONFIG_H' >>$@ +$(call include-dep,$(cxx_od),$(cxx_obj),$(out_base)/details/config.h) # Convenience alias for default target. # $(out_base)/: $(cutl.l) +# Dist. +# +$(dist): export sources := $(cxx_tun) +$(dist): export headers = $(subst $(src_base)/,,$(shell find $(src_base) \ +-name '*.hxx' -o -name '*.ixx' -o -name '*.txx')) +$(dist): export extra_dist := libcutl-vc9.vcproj libcutl-vc10.vcxproj \ +libcutl-vc10.vcxproj.filters +$(dist): export interface_version = $(shell sed -e \ +'s/^\([0-9]*\.[0-9]*\).*/\1/' $(src_root)/version) + +$(dist): + $(call dist-data,$(sources) $(headers) details/config.h.in) + $(call meta-vc9proj,libcutl-vc9.vcproj) + $(call meta-vc10proj,libcutl-vc10.vcxproj) + $(call meta-automake) + # Install. # $(install): $(cutl.l) $(call install-lib,$<,$(install_lib_dir)/$(ld_lib_prefix)cutl$(ld_lib_suffix)) $(call install-dir,$(src_base),$(install_inc_dir)/cutl,\ '(' -name '*.hxx' -o -name '*.ixx' -o -name '*.txx' ')') + $(call install-data,$(out_base)/details/config.h,\ +$(install_inc_dir)/cutl/details/config.h) # Clean. # @@ -52,10 +81,27 @@ $(clean): $(cutl.l).o.clean \ $(cutl.l.cpp-options).clean \ $(addsuffix .cxx.clean,$(cxx_obj)) \ $(addsuffix .cxx.clean,$(cxx_od)) + $(call message,rm $$1,rm -f $$1,$(out_base)/details/config.h) + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(cutl.l): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := details/config.h +$(clean): $(out_base)/.gitignore.clean +$(call include,$(bld_root)/git/gitignore.make) +endif # How to. # +$(call include,$(bld_root)/dist.make) +$(call include,$(bld_root)/install.make) +$(call include,$(bld_root)/meta/vc9proj.make) +$(call include,$(bld_root)/meta/vc10proj.make) +$(call include,$(bld_root)/meta/automake.make) + $(call include,$(bld_root)/cxx/o-l.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/cxx-d.make) diff --git a/cutl/shared-ptr/base.hxx b/cutl/shared-ptr/base.hxx index 0a631d4..50e54d4 100644 --- a/cutl/shared-ptr/base.hxx +++ b/cutl/shared-ptr/base.hxx @@ -11,9 +11,11 @@ #include +#include + namespace cutl { - struct share + struct LIBCUTL_EXPORT share { explicit share (char id); @@ -26,24 +28,24 @@ namespace cutl }; } -extern cutl::share shared; -extern cutl::share exclusive; +extern LIBCUTL_EXPORT cutl::share shared; +extern LIBCUTL_EXPORT cutl::share exclusive; -void* +LIBCUTL_EXPORT void* operator new (std::size_t, cutl::share) throw (std::bad_alloc); -void +LIBCUTL_EXPORT void operator delete (void*, cutl::share) throw (); namespace cutl { - struct not_shared: exception + struct LIBCUTL_EXPORT not_shared: exception { virtual char const* what () const throw (); }; - struct shared_base + struct LIBCUTL_EXPORT shared_base { shared_base (); shared_base (shared_base const&); diff --git a/libcutl-vc10.sln b/libcutl-vc10.sln new file mode 100644 index 0000000..d28c0b2 --- /dev/null +++ b/libcutl-vc10.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcutl", "cutl\libcutl-vc10.vcxproj", "{A3903F70-CC9F-4D1C-9793-221EAE08DBB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A3903F70-CC9F-4D1C-9793-221EAE08DBB5}.Debug|Win32.ActiveCfg = Debug|Win32 + {A3903F70-CC9F-4D1C-9793-221EAE08DBB5}.Debug|Win32.Build.0 = Debug|Win32 + {A3903F70-CC9F-4D1C-9793-221EAE08DBB5}.Debug|x64.ActiveCfg = Debug|x64 + {A3903F70-CC9F-4D1C-9793-221EAE08DBB5}.Debug|x64.Build.0 = Debug|x64 + {A3903F70-CC9F-4D1C-9793-221EAE08DBB5}.Release|Win32.ActiveCfg = Release|Win32 + {A3903F70-CC9F-4D1C-9793-221EAE08DBB5}.Release|Win32.Build.0 = Release|Win32 + {A3903F70-CC9F-4D1C-9793-221EAE08DBB5}.Release|x64.ActiveCfg = Release|x64 + {A3903F70-CC9F-4D1C-9793-221EAE08DBB5}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libcutl-vc9.sln b/libcutl-vc9.sln new file mode 100644 index 0000000..164db43 --- /dev/null +++ b/libcutl-vc9.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcutl", "cutl\libcutl-vc9.vcproj", "{E12E5299-8AFB-43F3-832F-9919A26C4F9C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E12E5299-8AFB-43F3-832F-9919A26C4F9C}.Debug|Win32.ActiveCfg = Debug|Win32 + {E12E5299-8AFB-43F3-832F-9919A26C4F9C}.Debug|Win32.Build.0 = Debug|Win32 + {E12E5299-8AFB-43F3-832F-9919A26C4F9C}.Debug|x64.ActiveCfg = Debug|x64 + {E12E5299-8AFB-43F3-832F-9919A26C4F9C}.Debug|x64.Build.0 = Debug|x64 + {E12E5299-8AFB-43F3-832F-9919A26C4F9C}.Release|Win32.ActiveCfg = Release|Win32 + {E12E5299-8AFB-43F3-832F-9919A26C4F9C}.Release|Win32.Build.0 = Release|Win32 + {E12E5299-8AFB-43F3-832F-9919A26C4F9C}.Release|x64.ActiveCfg = Release|x64 + {E12E5299-8AFB-43F3-832F-9919A26C4F9C}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libcutl.pc.in b/libcutl.pc.in new file mode 100644 index 0000000..be2e0d6 --- /dev/null +++ b/libcutl.pc.in @@ -0,0 +1,16 @@ +# file : libcutl.pc.in +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libcutl +Description: C++ utility library +URL: http://www.codesynthesis.com/projects/libcutl/ +Version: @VERSION@ +Libs: -L${libdir} -lcutl +Cflags: -I${includedir} diff --git a/m4/disable-rpath.m4 b/m4/disable-rpath.m4 new file mode 100644 index 0000000..4540e66 --- /dev/null +++ b/m4/disable-rpath.m4 @@ -0,0 +1,26 @@ +dnl file : m4/disable-rpath.m4 +dnl author : Boris Kolpackov +dnl copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +dnl license : MIT; 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/libtool-link.m4 b/m4/libtool-link.m4 new file mode 100644 index 0000000..4748520 --- /dev/null +++ b/m4/libtool-link.m4 @@ -0,0 +1,31 @@ +dnl file : m4/libtool-link.m4 +dnl author : Boris Kolpackov +dnl copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +dnl license : MIT; 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..64d90f1 --- /dev/null +++ b/m4/pkgconfig.m4 @@ -0,0 +1,13 @@ +dnl file : m4/pkgconfig.m4 +dnl author : Boris Kolpackov +dnl copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +dnl license : MIT; 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/makefile b/makefile index a89c8eb..86de3a7 100644 --- a/makefile +++ b/makefile @@ -5,31 +5,41 @@ include $(dir $(lastword $(MAKEFILE_LIST)))build/bootstrap.make +dirs := cutl tests + default := $(out_base)/ test := $(out_base)/.test +dist := $(out_base)/.dist install := $(out_base)/.install clean := $(out_base)/.clean -# Build. -# -$(default): $(out_base)/cutl/ $(out_base)/tests/ +$(default): $(addprefix $(out_base)/,$(addsuffix /,$(dirs))) +$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(dirs))) + +$(dist): export dirs := $(dirs) +$(dist): export docs := LICENSE NEWS README version +$(dist): data_dist := libcutl-vc9.sln libcutl-vc10.sln +$(dist): exec_dist := bootstrap +$(dist): export extra_dist := $(data_dist) $(exec_dist) +$(dist): export version = $(shell cat $(src_root)/version) -# Test. -# -$(test): $(out_base)/tests/.test +$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(dirs))) + $(call dist-data,$(docs) $(data_dist) libcutl.pc.in) + $(call dist-exec,$(exec_dist)) + $(call dist-dir,m4) + $(call meta-automake) + $(call meta-autoconf) -# Install. -# $(install): $(out_base)/cutl/.install $(call install-data,$(src_base)/LICENSE,$(install_doc_dir)/libcutl/LICENSE) $(call install-data,$(src_base)/NEWS,$(install_doc_dir)/libcutl/NEWS) $(call install-data,$(src_base)/README,$(install_doc_dir)/libcutl/README) -# Clean. -# -$(clean): $(out_base)/cutl/.clean $(out_base)/tests/.clean +$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(dirs))) +$(call include,$(bld_root)/dist.make) $(call include,$(bld_root)/install.make) +$(call include,$(bld_root)/meta/automake.make) +$(call include,$(bld_root)/meta/autoconf.make) -$(call import,$(src_base)/cutl/makefile) -$(call import,$(src_base)/tests/makefile) +$(foreach d,$(dirs),$(call import,$(src_base)/$d/makefile)) diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..52ecabc --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,6 @@ +# file : Makefile.am +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +SUBDIRS = __path__(dirs) diff --git a/tests/makefile b/tests/makefile index 20dd4ea..5b7bbf9 100644 --- a/tests/makefile +++ b/tests/makefile @@ -9,10 +9,19 @@ tests := compiler fs shared-ptr default := $(out_base)/ test := $(out_base)/.test +dist := $(out_base)/.dist clean := $(out_base)/.clean $(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests))) $(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(tests))) + +$(dist): export dirs := +$(dist): #$(addprefix $(out_base)/,$(addsuffix /.dist,$(tests))) + $(call meta-automake) + $(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(tests))) +$(call include,$(bld_root)/dist.make) +$(call include,$(bld_root)/meta/automake.make) + $(foreach t,$(tests),$(call import,$(src_base)/$t/makefile)) -- cgit v1.1