From 1cda5350173ab595b1ea2a7a00f599a988c1438a Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 09:14:26 +0000 Subject: [PATCH 01/16] added missing .pc template --- codegen/clientlib.pc.in | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) create mode 100644 codegen/clientlib.pc.in diff --git a/codegen/clientlib.pc.in b/codegen/clientlib.pc.in new file mode 100644 index 0000000..38c90a6 --- /dev/null +++ b/codegen/clientlib.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: @CMDGROUP@ +Description: command group @CMDGROUP@ client library +Version: @VERSION@ +Requires: libt2n +Libs: -L${libdir} -l@CMDGROUP@ +Cflags: -I${includedir} -- 1.7.1 From d6d16279eafa85a7581c285d11b59f374cd5fa1f Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 09:19:50 +0000 Subject: [PATCH 02/16] install makefile snippet and .pc file template --- codegen/Makefile.am | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/codegen/Makefile.am b/codegen/Makefile.am index b5689df..2463620 100644 --- a/codegen/Makefile.am +++ b/codegen/Makefile.am @@ -5,7 +5,11 @@ libt2n_codegen_SOURCES = main.cpp bin_PROGRAMS = libt2n-codegen -EXTRA_DIST = clientlib.pc.in codegen.make +pkgdata_DATA = clientlib.pc.in codegen.make + +# needed because we use old automake not supporting dist_ prefix + +EXTRA_DIST = $(pkgdata_DATA) # todo: do we really want to install it # (maybe it would be better to install a copy with each client lib?) -- 1.7.1 From 44a58adde741c1cde579b8d2a678906023475536 Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 09:39:58 +0000 Subject: [PATCH 03/16] fake installed libt2n for example-codegen --- codegen/codegen.make | 3 --- configure.in | 14 ++++++++++++++ example-codegen/Makefile.am | 7 ++++--- example-codegen/TODO | 7 ++----- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/codegen/codegen.make b/codegen/codegen.make index 99ffd3d..02c2873 100644 --- a/codegen/codegen.make +++ b/codegen/codegen.make @@ -13,9 +13,6 @@ include_HEADERS += $(foreach i, $(CMDGROUPS), $(i)_client.hxx $(i).hxx) libt2ngroup_%.P : Makefile.am echo $@ : $($*_GROUP) > libt2ngroup_$*.P -LIBT2N_CODEGEN ?= $(top_builddir)/codegen/libt2n-codegen -LIBT2N_CLIENT_PC_IN ?= $(top_srcdir)/codegen/clientlib.pc.in - %.libt2nstamp : libt2ngroup_%.P $(LIBT2N_CODEGEN) # assuming we have some unix like shell (maybe even bash) echo BUILT_SOURCES: $(BUILT_SOURCES) diff --git a/configure.in b/configure.in index 967635f..65137d8 100644 --- a/configure.in +++ b/configure.in @@ -27,4 +27,18 @@ PKG_CHECK_MODULES(XMLPP, libxml++-2.6 >= 2.8.1) AC_SUBST(XMLPP_CFLAGS) AC_SUBST(XMLPP_LIBS) +dnl fake installed libt2n (codegen) +dnl todo: remove codegen include path (codegen-stubhead.hxx will be removed) +LIBT2N_CPPFLAGS="-I\$(top_srcdir)/src @BOOST_CPPFLAGS@ @CPPUNIT_CFLAGS@ -I\$(top_srcdir)/codegen" +LIBT2N_LIBS="\$(top_builddir)/src/libt2n.la @BOOST_SERIALIZATION_LIB@ @BOOST_LDFLAGS@" +LIBT2N_CODEGEN="\$(top_builddir)/codegen/libt2n-codegen" +LIBT2N_CLIENT_PC_IN = "\$(top_srcdir)/codegen/clientlib.pc.in" +LIBT2N_CODEGEN_MAKESNIPPET="\$(top_srcdir)/codegen/codegen.make" + +AC_SUBST(LIBT2N_CPPFLAGS) +AC_SUBST(LIBT2N_LIBS) +AC_SUBST(LIBT2N_CODEGEN) +AC_SUBST(LIBT2N_CLIENT_PC_IN) +AC_SUBST(LIBT2N_CODEGEN_MAKESNIPPET) + AC_OUTPUT(Makefile doc/Doxyfile doc/Makefile src/Makefile libt2n.pc libt2n.spec test/Makefile examples/Makefile codegen/Makefile example-codegen/Makefile) diff --git a/example-codegen/Makefile.am b/example-codegen/Makefile.am index d1134fe..30b8d8d 100644 --- a/example-codegen/Makefile.am +++ b/example-codegen/Makefile.am @@ -1,5 +1,6 @@ -INCLUDES = -I$(top_srcdir)/src @BOOST_CPPFLAGS@ @CPPUNIT_CFLAGS@ -I$(top_srcdir)/codegen -LDADD = $(top_builddir)/src/libt2n.la @BOOST_SERIALIZATION_LIB@ @BOOST_LDFLAGS@ +# todo: remove codegen include path (codegen-stubhead.hxx will be removed) +INCLUDES = @LIBT2N_CPPFLAGS@ +LDADD = @LIBT2N_LIBS@ # list your command groups CMDGROUPS = default other @@ -38,4 +39,4 @@ TESTS = test EXTRA_DIST = $(TESTS) -include $(top_srcdir)/codegen/codegen.make +include @LIBT2N_CODEGEN_MAKESNIPPET@ diff --git a/example-codegen/TODO b/example-codegen/TODO index 6afaf9b..56b0337 100644 --- a/example-codegen/TODO +++ b/example-codegen/TODO @@ -6,17 +6,14 @@ include problem: - a simple solution would be to have a special include file containing the neccessary includes (or 2: one for the type definitions and one for the serialization) - another solution would be to extract the includes from the file and add them to the generated code both solutions only work if the include paths used during compilation of a program using the library are correct[tm] - now we use the first solution -- make distcheck -- .pc file -- make install (in this example the "other" client lib would have to install foo.hxx) - test using valgrind - would be nice to reduce amount of changed files (codegen output is often the same as the existing files - something similar to ccache for codegen - but not overwriting output files if they are the same) - howto include the part after "# always the same:" in all makefiles using the codegenerator + (we now use make's include) - lib name should be group name + suffix/prefix - at the moment make dist from within a clean source will not work - (this is related to the nodist problem) + (this is related to the nodist problem / old automake version) -- 1.7.1 From 1f0aa49ffeccf4ac8562a82a941b17c63503c4cc Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 10:32:11 +0000 Subject: [PATCH 04/16] use pkgincludedir for headers (to avoid file name collisions), renamed LIBT2N_CLIENT_PC_IN to LIBT2N_CLIENT_PCTEMPLATE and removed harmfull whitespace, remove empty file other.cpp --- codegen/TODO | 4 ++-- codegen/codegen.make | 2 +- configure.in | 8 ++++---- example-codegen/Makefile.am | 6 +++--- libt2n.pc.in | 2 +- src/Makefile.am | 3 +-- 6 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 example-codegen/other.cpp diff --git a/codegen/TODO b/codegen/TODO index dd9baca..7519db7 100644 --- a/codegen/TODO +++ b/codegen/TODO @@ -11,5 +11,5 @@ open questions: - makefile snippet must work for builds outside of libt2n (=> some variables must be set by configure, the snippet must be installed => pc file template must be installed, too) - - +- it would really be much nicer if the client lib includes would not depend upon boost serialization + a solution would be to provide this optionally by wrapping the corresponding includes in a #ifdef diff --git a/codegen/codegen.make b/codegen/codegen.make index 02c2873..450597f 100644 --- a/codegen/codegen.make +++ b/codegen/codegen.make @@ -35,7 +35,7 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = $(CMDGROUPS:=.pc) # .pc files (one pc file for each command group) -%.pc : $(LIBT2N_CLIENT_PC_IN) Makefile +%.pc : $(LIBT2N_CLIENT_PCTEMPLATE) Makefile sed \ -e 's,@CMDGROUP@,$*,g' \ -e 's,\@prefix\@,$(prefix),g' \ diff --git a/configure.in b/configure.in index 65137d8..1d07fab 100644 --- a/configure.in +++ b/configure.in @@ -27,18 +27,18 @@ PKG_CHECK_MODULES(XMLPP, libxml++-2.6 >= 2.8.1) AC_SUBST(XMLPP_CFLAGS) AC_SUBST(XMLPP_LIBS) -dnl fake installed libt2n (codegen) +dnl fake installed libt2n (codegen) for example-codegen dnl todo: remove codegen include path (codegen-stubhead.hxx will be removed) LIBT2N_CPPFLAGS="-I\$(top_srcdir)/src @BOOST_CPPFLAGS@ @CPPUNIT_CFLAGS@ -I\$(top_srcdir)/codegen" LIBT2N_LIBS="\$(top_builddir)/src/libt2n.la @BOOST_SERIALIZATION_LIB@ @BOOST_LDFLAGS@" LIBT2N_CODEGEN="\$(top_builddir)/codegen/libt2n-codegen" -LIBT2N_CLIENT_PC_IN = "\$(top_srcdir)/codegen/clientlib.pc.in" -LIBT2N_CODEGEN_MAKESNIPPET="\$(top_srcdir)/codegen/codegen.make" +LIBT2N_CLIENT_PCTEMPLATE="\$(top_srcdir)/codegen/clientlib.pc.in" +LIBT2N_CODEGEN_MAKESNIPPET="include \$(top_srcdir)/codegen/codegen.make" AC_SUBST(LIBT2N_CPPFLAGS) AC_SUBST(LIBT2N_LIBS) AC_SUBST(LIBT2N_CODEGEN) -AC_SUBST(LIBT2N_CLIENT_PC_IN) +AC_SUBST(LIBT2N_CLIENT_PCTEMPLATE) AC_SUBST(LIBT2N_CODEGEN_MAKESNIPPET) AC_OUTPUT(Makefile doc/Doxyfile doc/Makefile src/Makefile libt2n.pc libt2n.spec test/Makefile examples/Makefile codegen/Makefile example-codegen/Makefile) diff --git a/example-codegen/Makefile.am b/example-codegen/Makefile.am index 30b8d8d..1911f20 100644 --- a/example-codegen/Makefile.am +++ b/example-codegen/Makefile.am @@ -1,4 +1,6 @@ -# todo: remove codegen include path (codegen-stubhead.hxx will be removed) +# if you use codegen you should add the next line +@LIBT2N_CODEGEN_MAKESNIPPET@ + INCLUDES = @LIBT2N_CPPFLAGS@ LDADD = @LIBT2N_LIBS@ @@ -38,5 +40,3 @@ server_SOURCES = \ TESTS = test EXTRA_DIST = $(TESTS) - -include @LIBT2N_CODEGEN_MAKESNIPPET@ diff --git a/example-codegen/other.cpp b/example-codegen/other.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/libt2n.pc.in b/libt2n.pc.in index a9ff269..03d773f 100644 --- a/libt2n.pc.in +++ b/libt2n.pc.in @@ -1,7 +1,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@ +includedir=@includedir@/libt2n Name: libt2n Description: talk2neighbor - C++ IPC library diff --git a/src/Makefile.am b/src/Makefile.am index 9911bf0..0211215 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,3 @@ - # set the include path found by configure INCLUDES= $(all_includes) @@ -9,6 +8,6 @@ libt2n_la_SOURCES = server.cpp socket_server.cpp client.cpp connection.cpp \ socket_handler.cpp socket_client.cpp command_server.cpp command_client.cpp \ t2n_exception.cpp command.cpp container.cpp -include_HEADERS = server.hxx socket_server.hxx t2n_exception.hxx client.hxx \ +pkginclude_HEADERS = server.hxx socket_server.hxx t2n_exception.hxx client.hxx \ socket_client.hxx connection.hxx types.hxx socket_handler.hxx command.hxx container.hxx \ command_client.hxx command_server.hxx log.hxx -- 1.7.1 From cf4062359a4db715c11402d64ccd059877fd2f74 Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 10:50:36 +0000 Subject: [PATCH 05/16] --- codegen/TODO | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/codegen/TODO b/codegen/TODO index 7519db7..2e00c40 100644 --- a/codegen/TODO +++ b/codegen/TODO @@ -12,4 +12,6 @@ open questions: (=> some variables must be set by configure, the snippet must be installed => pc file template must be installed, too) - it would really be much nicer if the client lib includes would not depend upon boost serialization - a solution would be to provide this optionally by wrapping the corresponding includes in a #ifdef + i thought a solution would be to provide this optionally by wrapping the corresponding includes in a #ifdef + but this does not work since command.hxx is included which depends on boost serialization headers anyway + => we do not provide this for now -- 1.7.1 From 044cb458410020e50b1c40b7b5078fc203669ee1 Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 11:07:10 +0000 Subject: [PATCH 06/16] --- example-codegen/TODO | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/example-codegen/TODO b/example-codegen/TODO index 56b0337..e14b880 100644 --- a/example-codegen/TODO +++ b/example-codegen/TODO @@ -17,3 +17,5 @@ now we use the first solution - lib name should be group name + suffix/prefix - at the moment make dist from within a clean source will not work (this is related to the nodist problem / old automake version) +- the example should not get installed (but still it should show how to build a lib that gets installed :-( + (overwriting install: doesn't work) -- 1.7.1 From 3907d211b0856140709b2376739bc462c4d37ba0 Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 12:44:22 +0000 Subject: [PATCH 07/16] include VERSION --- codegen/main.cpp | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/codegen/main.cpp b/codegen/main.cpp index ec97403..fb57155 100644 --- a/codegen/main.cpp +++ b/codegen/main.cpp @@ -6,6 +6,9 @@ #include #include #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif //! convert string to upper case std::string @@ -444,7 +447,7 @@ struct header_file : public std::ofstream header_file(const char* fname) : std::ofstream(fname) { std::cerr << "create header: '" << fname << "'" << std::endl; std::string macro(replace(toupper(fname),'.','_')); - *this << "// automatically generated code - do not edit\n" << std::endl; + *this << "// automatically generated code (generated by libt2n-codegen " << VERSION << ") - do not edit\n" << std::endl; *this << "#ifndef " << macro << "\n" << "#define " << macro << "\n"; } @@ -464,12 +467,18 @@ struct cpp_file : public std::ofstream int main(int argc, char* argv[]) { - if (argc < 3) { - std::cerr << "Usage: " << argv[0] << "default-group gccxml-file1 gccxml-file2 ... " << std::endl; - return 1; - } + // todo: maybe use getopt + if ((argc>1)&&(std::string(argv[1])=="--version")) { + std::cerr << VERSION << std::endl; + return 0; + } + if (argc < 3) + { + std::cerr << "Usage: " << argv[0] << "default-group gccxml-file1 gccxml-file2 ... " << std::endl; + return 1; + } - try{ + try{ std::string group(argv[1]); std::list xmlfiles; for (int i=2;i Date: Mon, 4 Dec 2006 13:45:55 +0000 Subject: [PATCH 08/16] install codegen-stubhead.hxx in package include directory --- codegen/Makefile.am | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/codegen/Makefile.am b/codegen/Makefile.am index 2463620..e831e3e 100644 --- a/codegen/Makefile.am +++ b/codegen/Makefile.am @@ -11,6 +11,7 @@ pkgdata_DATA = clientlib.pc.in codegen.make EXTRA_DIST = $(pkgdata_DATA) -# todo: do we really want to install it -# (maybe it would be better to install a copy with each client lib?) -include_HEADERS = codegen-stubhead.hxx +# do we really want to install it? +# maybe it would be better to install a copy with each client lib or let codegen insert the code? +# on the other hand the generated libraries depend on the libt2n headers anyway +pkginclude_HEADERS = codegen-stubhead.hxx -- 1.7.1 From 5a7380a04aa973dbd47d8f1dfba68a73b95ed67b Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 13:46:55 +0000 Subject: [PATCH 09/16] unfortunately dist-hook only works if directly visible for automake --- codegen/codegen.make | 8 +++++--- example-codegen/Makefile.am | 13 +++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/codegen/codegen.make b/codegen/codegen.make index 450597f..d097350 100644 --- a/codegen/codegen.make +++ b/codegen/codegen.make @@ -25,7 +25,8 @@ libt2ngroup_%.P : Makefile.am done; \ $(LIBT2N_CODEGEN) $* $($*_GROUP:.cpp=.xml) && touch $@ -BUILT_SOURCES = $(foreach i, $(CMDGROUPS), $(foreach j, _common.hxx _common.cpp _client.hxx _client.cpp _server.hxx _server.cpp, $(i)$(j)) ) +LIBT2N_CODEGEN_BUILT = $(foreach i, $(CMDGROUPS), $(foreach j, _common.hxx _common.cpp _client.hxx _client.cpp _server.hxx _server.cpp, $(i)$(j)) ) +BUILT_SOURCES = $(LIBT2N_CODEGEN_BUILT) STAMPS=$(CMDGROUPS:=.libt2nstamp) $(BUILT_SOURCES) : $(STAMPS) @@ -54,5 +55,6 @@ CLEANFILES = $(BUILT_SOURCES) $(STAMPS) $(pkgconfig_DATA) # we have got an old automake version (1.4-p5) which doesn't support nodist_ # => we use the dist-hook -dist-hook: - rm -vf $(foreach i, $(BUILT_SOURCES), $(distdir)/$(i)) +# unfortunately dist-hook only works if directly visible for automake (=> not in this include) +#dist-hook: +# rm -vf $(foreach i, $(BUILT_SOURCES), $(distdir)/$(i)) diff --git a/example-codegen/Makefile.am b/example-codegen/Makefile.am index 1911f20..cabf100 100644 --- a/example-codegen/Makefile.am +++ b/example-codegen/Makefile.am @@ -1,6 +1,3 @@ -# if you use codegen you should add the next line -@LIBT2N_CODEGEN_MAKESNIPPET@ - INCLUDES = @LIBT2N_CPPFLAGS@ LDADD = @LIBT2N_LIBS@ @@ -39,4 +36,12 @@ server_SOURCES = \ TESTS = test -EXTRA_DIST = $(TESTS) +EXTRA_DIST = $(TESTS) configure.in + +# we have got an old automake version (1.4-p5) which doesn't support nodist_ +# => you might want to use the dist-hook to remove generated files +dist-hook: + rm -vf $(foreach i, $(BUILT_SOURCES), $(distdir)/$(i)) + +# if you use codegen you should add the next line at the end +@LIBT2N_CODEGEN_MAKESNIPPET@ -- 1.7.1 From 7eb34f4dcd6b5eba1846bce22e95d54418b2e34e Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 13:47:30 +0000 Subject: [PATCH 10/16] comments --- configure.in | 4 +++- example-codegen/client.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 1d07fab..83d0cfd 100644 --- a/configure.in +++ b/configure.in @@ -28,7 +28,6 @@ AC_SUBST(XMLPP_CFLAGS) AC_SUBST(XMLPP_LIBS) dnl fake installed libt2n (codegen) for example-codegen -dnl todo: remove codegen include path (codegen-stubhead.hxx will be removed) LIBT2N_CPPFLAGS="-I\$(top_srcdir)/src @BOOST_CPPFLAGS@ @CPPUNIT_CFLAGS@ -I\$(top_srcdir)/codegen" LIBT2N_LIBS="\$(top_builddir)/src/libt2n.la @BOOST_SERIALIZATION_LIB@ @BOOST_LDFLAGS@" LIBT2N_CODEGEN="\$(top_builddir)/codegen/libt2n-codegen" @@ -40,5 +39,8 @@ AC_SUBST(LIBT2N_LIBS) AC_SUBST(LIBT2N_CODEGEN) AC_SUBST(LIBT2N_CLIENT_PCTEMPLATE) AC_SUBST(LIBT2N_CODEGEN_MAKESNIPPET) + +dnl todo: do not create .pc file in configure but in make +dnl see also autoconf manual "Installation Directory Variables" AC_OUTPUT(Makefile doc/Doxyfile doc/Makefile src/Makefile libt2n.pc libt2n.spec test/Makefile examples/Makefile codegen/Makefile example-codegen/Makefile) diff --git a/example-codegen/client.cpp b/example-codegen/client.cpp index cdeb124..1029abe 100644 --- a/example-codegen/client.cpp +++ b/example-codegen/client.cpp @@ -6,7 +6,7 @@ #include -// include library header +// include generated library headers #include "default_client.hxx" #include "other_client.hxx" -- 1.7.1 From 25ad20c2ddb424a8d4c639fd0050d0afb595ae7f Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 13:48:13 +0000 Subject: [PATCH 11/16] unfortunately dist-hook only works if directly visible for automake --- example-codegen/TODO | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/example-codegen/TODO b/example-codegen/TODO index e14b880..07d4eff 100644 --- a/example-codegen/TODO +++ b/example-codegen/TODO @@ -19,3 +19,5 @@ now we use the first solution (this is related to the nodist problem / old automake version) - the example should not get installed (but still it should show how to build a lib that gets installed :-( (overwriting install: doesn't work) + +- dist-hook in included makefile does not work (because automake doesn't see it!) -- 1.7.1 From 26eca3d84050172b9485555ee63e7f2ba19f5c51 Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 13:49:15 +0000 Subject: [PATCH 12/16] added variables to pc file --- codegen/TODO | 19 +++++++++++++++++++ libt2n.pc.in | 3 +++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/codegen/TODO b/codegen/TODO index 2e00c40..cbc6c1c 100644 --- a/codegen/TODO +++ b/codegen/TODO @@ -11,7 +11,26 @@ open questions: - makefile snippet must work for builds outside of libt2n (=> some variables must be set by configure, the snippet must be installed => pc file template must be installed, too) + + the variables which must be set: + LIBT2N_CODEGEN="\$(top_builddir)/codegen/libt2n-codegen" + LIBT2N_CLIENT_PCTEMPLATE="\$(top_srcdir)/codegen/clientlib.pc.in" + LIBT2N_CODEGEN_MAKESNIPPET="include \$(top_srcdir)/codegen/codegen.make" + + LIBT2N_CODEGEN will be handled by AC_PATH_PROG + the other two? can't we use pkgconfig?! + perhaps best provide a m4 macro for use with autoconf? + + AC_DEFUN([LIBT2N_CODEGEN ... + + alternatively we could add a option --datadir to codegen which prints out the + path to clientlib.pc.in and codegen.make + (first solution is the better one) + + we can use pkg-config => best solution + - it would really be much nicer if the client lib includes would not depend upon boost serialization i thought a solution would be to provide this optionally by wrapping the corresponding includes in a #ifdef but this does not work since command.hxx is included which depends on boost serialization headers anyway => we do not provide this for now + diff --git a/libt2n.pc.in b/libt2n.pc.in index 03d773f..343998a 100644 --- a/libt2n.pc.in +++ b/libt2n.pc.in @@ -1,7 +1,10 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ +bindir=@bindir@ libdir=@libdir@ includedir=@includedir@/libt2n +libt2n_codegen=@bindir@/libt2n-codegen +libt2n_datadir=@datadir@/libt2n Name: libt2n Description: talk2neighbor - C++ IPC library -- 1.7.1 From 86c3b9abe80f01be882fdc84f601e65e056006bb Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 14:05:46 +0000 Subject: [PATCH 13/16] rename LIBT2N_CPPFLAGS to LIBT2N_CFLAGS since this is the variable defined by PKG_CHECK_MODULES --- configure.in | 4 ++-- example-codegen/Makefile.am | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index 83d0cfd..5086b6f 100644 --- a/configure.in +++ b/configure.in @@ -28,13 +28,13 @@ AC_SUBST(XMLPP_CFLAGS) AC_SUBST(XMLPP_LIBS) dnl fake installed libt2n (codegen) for example-codegen -LIBT2N_CPPFLAGS="-I\$(top_srcdir)/src @BOOST_CPPFLAGS@ @CPPUNIT_CFLAGS@ -I\$(top_srcdir)/codegen" +LIBT2N_CFLAGS="-I\$(top_srcdir)/src @BOOST_CPPFLAGS@ @CPPUNIT_CFLAGS@ -I\$(top_srcdir)/codegen" LIBT2N_LIBS="\$(top_builddir)/src/libt2n.la @BOOST_SERIALIZATION_LIB@ @BOOST_LDFLAGS@" LIBT2N_CODEGEN="\$(top_builddir)/codegen/libt2n-codegen" LIBT2N_CLIENT_PCTEMPLATE="\$(top_srcdir)/codegen/clientlib.pc.in" LIBT2N_CODEGEN_MAKESNIPPET="include \$(top_srcdir)/codegen/codegen.make" -AC_SUBST(LIBT2N_CPPFLAGS) +AC_SUBST(LIBT2N_CFLAGS) AC_SUBST(LIBT2N_LIBS) AC_SUBST(LIBT2N_CODEGEN) AC_SUBST(LIBT2N_CLIENT_PCTEMPLATE) diff --git a/example-codegen/Makefile.am b/example-codegen/Makefile.am index cabf100..ca49cb8 100644 --- a/example-codegen/Makefile.am +++ b/example-codegen/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = @LIBT2N_CPPFLAGS@ +INCLUDES = @LIBT2N_CFLAGS@ LDADD = @LIBT2N_LIBS@ # list your command groups -- 1.7.1 From 2c2d29e114d44d1a2d4fb5f1c2b49b60b80b304a Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 14:45:55 +0000 Subject: [PATCH 14/16] CLEANFILES must be listed directly, too - otherwise automake will not use it :-( --- codegen/codegen.make | 13 ++++++++----- example-codegen/Makefile.am | 11 +++++++++-- example-codegen/TODO | 1 + 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/codegen/codegen.make b/codegen/codegen.make index d097350..e67760c 100644 --- a/codegen/codegen.make +++ b/codegen/codegen.make @@ -26,12 +26,12 @@ libt2ngroup_%.P : Makefile.am $(LIBT2N_CODEGEN) $* $($*_GROUP:.cpp=.xml) && touch $@ LIBT2N_CODEGEN_BUILT = $(foreach i, $(CMDGROUPS), $(foreach j, _common.hxx _common.cpp _client.hxx _client.cpp _server.hxx _server.cpp, $(i)$(j)) ) -BUILT_SOURCES = $(LIBT2N_CODEGEN_BUILT) +BUILT_SOURCES += $(LIBT2N_CODEGEN_BUILT) -STAMPS=$(CMDGROUPS:=.libt2nstamp) -$(BUILT_SOURCES) : $(STAMPS) +LIBT2N_STAMPS=$(CMDGROUPS:=.libt2nstamp) +$(BUILT_SOURCES) : $(LIBT2N_STAMPS) -# Install the pkg-config files: +# Install the pkg-config files: (todo: perhaps use +=) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = $(CMDGROUPS:=.pc) @@ -45,7 +45,10 @@ pkgconfig_DATA = $(CMDGROUPS:=.pc) -e 's,\@includedir\@,$(includedir),g' \ $< >$*.pc -CLEANFILES = $(BUILT_SOURCES) $(STAMPS) $(pkgconfig_DATA) +LIBT2N_SUGGESTED_CLEANFILES = $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconfig_DATA) + +# doesn't work +# CLEANFILES = $(LIBT2N_SUGGESTED_CLEANFILES) # didn't work (same problem as with _LTLIBRARIES [parsing by automake], # this time _OBJECTS was not correct) diff --git a/example-codegen/Makefile.am b/example-codegen/Makefile.am index ca49cb8..a4195d4 100644 --- a/example-codegen/Makefile.am +++ b/example-codegen/Makefile.am @@ -1,3 +1,7 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 + INCLUDES = @LIBT2N_CFLAGS@ LDADD = @LIBT2N_LIBS@ @@ -41,7 +45,10 @@ EXTRA_DIST = $(TESTS) configure.in # we have got an old automake version (1.4-p5) which doesn't support nodist_ # => you might want to use the dist-hook to remove generated files dist-hook: - rm -vf $(foreach i, $(BUILT_SOURCES), $(distdir)/$(i)) + rm -vf $(foreach i, $(LIBT2N_CODEGEN_BUILT), $(distdir)/$(i)) -# if you use codegen you should add the next line at the end +# if you use libt2n-codegen you should add this @LIBT2N_CODEGEN_MAKESNIPPET@ + +CLEANFILES = $(LIBT2N_SUGGESTED_CLEANFILES) + diff --git a/example-codegen/TODO b/example-codegen/TODO index 07d4eff..53f0f9e 100644 --- a/example-codegen/TODO +++ b/example-codegen/TODO @@ -21,3 +21,4 @@ now we use the first solution (overwriting install: doesn't work) - dist-hook in included makefile does not work (because automake doesn't see it!) +- CLEANFILES doesn't work in included makefile either -- 1.7.1 From f84afc276afaf5a0c70b648f0a586d9caf5b02b4 Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 15:18:00 +0000 Subject: [PATCH 15/16] added configure.in to built example completely seperately (using installed version of libt2n and libt2n-codegen) --- example-codegen/configure.in | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) create mode 100644 example-codegen/configure.in diff --git a/example-codegen/configure.in b/example-codegen/configure.in new file mode 100644 index 0000000..e02f97f --- /dev/null +++ b/example-codegen/configure.in @@ -0,0 +1,21 @@ +AC_INIT(configure.in) + +AM_INIT_AUTOMAKE(libt2n-example, 0.1) + +AC_LANG_CPLUSPLUS +AC_PROG_CXX +AM_PROG_LIBTOOL + + +dnl: todo wrap this in a m4 macro? + +PKG_CHECK_MODULES(LIBT2N, libt2n = 0.1) +LIBT2N_CODEGEN=`$PKG_CONFIG --variable libt2n_codegen libt2n` +LIBT2N_DATADIR=`$PKG_CONFIG --variable libt2n_datadir libt2n` +LIBT2N_CLIENT_PCTEMPLATE="$LIBT2N_DATADIR/clientlib.pc.in" +LIBT2N_CODEGEN_MAKESNIPPET="include $LIBT2N_DATADIR/codegen.make" +AC_SUBST(LIBT2N_CODEGEN) +AC_SUBST(LIBT2N_CLIENT_PCTEMPLATE) +AC_SUBST(LIBT2N_CODEGEN_MAKESNIPPET) + +AC_OUTPUT(Makefile) -- 1.7.1 From 630ececc28458d4442e8a128f215f2450f46bf95 Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 16:10:16 +0000 Subject: [PATCH 16/16] --- codegen/codegen.make | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/codegen/codegen.make b/codegen/codegen.make index e67760c..747ed31 100644 --- a/codegen/codegen.make +++ b/codegen/codegen.make @@ -10,7 +10,7 @@ include_HEADERS += $(foreach i, $(CMDGROUPS), $(i)_client.hxx $(i).hxx) -include $(foreach i, $(CMDGROUPS), libt2ngroup_$(i).P) -libt2ngroup_%.P : Makefile.am +libt2ngroup_%.P : Makefile echo $@ : $($*_GROUP) > libt2ngroup_$*.P %.libt2nstamp : libt2ngroup_%.P $(LIBT2N_CODEGEN) -- 1.7.1