From 3a86fe9bda6ca91f8378fdf4c27adad408b4b0e5 Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Wed, 14 Feb 2007 17:10:51 +0000 Subject: [PATCH] workaround incompatibilies of newer automake (+=) by adding AC_SUBST to configure.in and autoreconf missing -M switch by calling the tools manually --- examples-codegen/example1/codegen.make | 13 ++++++++----- examples-codegen/example2/codegen.make | 13 ++++++++----- examples/Makefile.am | 1 + libt2n.m4 | 17 +++++++++++++++++ test-build-install-use | 7 ++++--- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/examples-codegen/example1/codegen.make b/examples-codegen/example1/codegen.make index b6bbe1b..71179b4 100644 --- a/examples-codegen/example1/codegen.make +++ b/examples-codegen/example1/codegen.make @@ -4,7 +4,7 @@ # gnu make (functions for transforming text) # sed is available -include_HEADERS = $(foreach i, $(CMDGROUPS), $(i)_client.hxx $(i).hxx) +include_HEADERS += $(foreach i, $(CMDGROUPS), $(i)_client.hxx $(i).hxx) # not needed but nice to have # IFILES=$(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j))) @@ -23,12 +23,14 @@ libt2ngroup_%.P : Makefile.am # todo use tmp file for xml file for i in $($*_GROUP); do \ gccxml $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/$${i} -fxml=$${i%*.cpp}.xml; \ - done && $(LIBT2N_CODEGEN) $* $($*_GROUP:.cpp=.xml) && touch $@ + done && $(LIBT2N_CODEGEN) $* $($*_GROUP:.cpp=.xml) && for i in $($*_GROUP); do \ + rm $${i%*.cpp}.xml; \ + done && touch $@ LIBT2N_CODEGEN_BUILT = $(foreach i, $(CMDGROUPS), $(foreach j, _common.hxx _common.cpp _client.hxx _client.cpp _server.hxx _server.cpp, $(i)$(j)) ) # using BUILT_SOURCES is a bit problematic (see also automake manual) -BUILT_SOURCES = $(LIBT2N_CODEGEN_BUILT) +BUILT_SOURCES += $(LIBT2N_CODEGEN_BUILT) LIBT2N_STAMPS=$(CMDGROUPS:=.libt2nstamp) $(BUILT_SOURCES) : $(LIBT2N_STAMPS) @@ -48,7 +50,8 @@ pkgconfig_DATA = $(CMDGROUPS:=.pc) -e 's,\@VERSION\@,$(VERSION),g' \ $< >$*.pc -CLEANFILES = $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconfig_DATA) +CLEANFILES += $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconfig_DATA) +DISTCLEANFILES += $(foreach i, $(CMDGROUPS), libt2ngroup_$(i).P) # didn't work (same problem as with _LTLIBRARIES [parsing by automake], # this time _OBJECTS was not correct) @@ -61,4 +64,4 @@ CLEANFILES = $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconfig_DATA) dist-hook: $(LIBT2N_CODEGEN_BUILT) rm -vf $(foreach i, $(LIBT2N_CODEGEN_BUILT), $(distdir)/$(i)) -EXTRA_DIST = codegen.make +EXTRA_DIST += codegen.make diff --git a/examples-codegen/example2/codegen.make b/examples-codegen/example2/codegen.make index b6bbe1b..71179b4 100644 --- a/examples-codegen/example2/codegen.make +++ b/examples-codegen/example2/codegen.make @@ -4,7 +4,7 @@ # gnu make (functions for transforming text) # sed is available -include_HEADERS = $(foreach i, $(CMDGROUPS), $(i)_client.hxx $(i).hxx) +include_HEADERS += $(foreach i, $(CMDGROUPS), $(i)_client.hxx $(i).hxx) # not needed but nice to have # IFILES=$(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j))) @@ -23,12 +23,14 @@ libt2ngroup_%.P : Makefile.am # todo use tmp file for xml file for i in $($*_GROUP); do \ gccxml $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/$${i} -fxml=$${i%*.cpp}.xml; \ - done && $(LIBT2N_CODEGEN) $* $($*_GROUP:.cpp=.xml) && touch $@ + done && $(LIBT2N_CODEGEN) $* $($*_GROUP:.cpp=.xml) && for i in $($*_GROUP); do \ + rm $${i%*.cpp}.xml; \ + done && touch $@ LIBT2N_CODEGEN_BUILT = $(foreach i, $(CMDGROUPS), $(foreach j, _common.hxx _common.cpp _client.hxx _client.cpp _server.hxx _server.cpp, $(i)$(j)) ) # using BUILT_SOURCES is a bit problematic (see also automake manual) -BUILT_SOURCES = $(LIBT2N_CODEGEN_BUILT) +BUILT_SOURCES += $(LIBT2N_CODEGEN_BUILT) LIBT2N_STAMPS=$(CMDGROUPS:=.libt2nstamp) $(BUILT_SOURCES) : $(LIBT2N_STAMPS) @@ -48,7 +50,8 @@ pkgconfig_DATA = $(CMDGROUPS:=.pc) -e 's,\@VERSION\@,$(VERSION),g' \ $< >$*.pc -CLEANFILES = $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconfig_DATA) +CLEANFILES += $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconfig_DATA) +DISTCLEANFILES += $(foreach i, $(CMDGROUPS), libt2ngroup_$(i).P) # didn't work (same problem as with _LTLIBRARIES [parsing by automake], # this time _OBJECTS was not correct) @@ -61,4 +64,4 @@ CLEANFILES = $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconfig_DATA) dist-hook: $(LIBT2N_CODEGEN_BUILT) rm -vf $(foreach i, $(LIBT2N_CODEGEN_BUILT), $(distdir)/$(i)) -EXTRA_DIST = codegen.make +EXTRA_DIST += codegen.make diff --git a/examples/Makefile.am b/examples/Makefile.am index aac0621..7bffe1a 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -24,3 +24,4 @@ all-local: minimalistic-server.xml minimalistic-server.xml: minimalistic-server.cpp gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/minimalistic-server.cpp -fxml=minimalistic-server.xml +CLEANFILES = minimalistic-server.xml diff --git a/libt2n.m4 b/libt2n.m4 index 6d3ba22..0b7aed4 100644 --- a/libt2n.m4 +++ b/libt2n.m4 @@ -8,4 +8,21 @@ AC_DEFUN([LIBT2N_CHECK], LIBT2N_CLIENT_PCTEMPLATE="$LIBT2N_DATADIR/clientlib.pc.in" AC_SUBST(LIBT2N_CODEGEN) AC_SUBST(LIBT2N_CLIENT_PCTEMPLATE) + + dnl newer automake versions do not allow to use += on undefined variables + dnl but we want to use += in codegen.make (s.a. examples-codegen/example1) + dnl as workaround we always define them + dnl see also: + dnl automake ml: subject: "automake conditional append" + dnl http://sourceware.org/ml/automake/2005-01/msg00019.html + dnl + dnl Note: + dnl if you update from libt2n 0.1 to 0.2 + dnl you must take care to pick up the right libt2n.m4 + + AC_SUBST([include_HEADERS], ['']) + AC_SUBST([BUILT_SOURCES], ['']) + AC_SUBST([CLEANFILES], ['']) + AC_SUBST([DISTCLEANFILES], ['']) + AC_SUBST([EXTRA_DIST], ['']) ]) diff --git a/test-build-install-use b/test-build-install-use index 2ab016c..42b5b73 100755 --- a/test-build-install-use +++ b/test-build-install-use @@ -17,7 +17,7 @@ mkdir "$INSTDIR" mkdir "$BUILDDIR" INSTPREFIX="$INSTDIR/usr" MAKE="dmake" -DOCLEAN="false" +DOCLEAN="true" function prepend() { if [ "x$1" = "x" ]; then @@ -28,10 +28,11 @@ function prepend() { } function build() { - # newer autoreconf (autoconf) versions don't have the -M option and no replacement :-( + # newer autoreconf (autoconf) versions don't have the -M option and no real replacement :-( + # (you can only set ACLOCAL_AMFLAGS in the Makefile.am) # todo: this IMHO should be filed as bug against autoconf # ugly workaround - autoreconf -f -i $@ || (autoreconf -f -i && aclocal --force $(echo "$@"|sed 's,-M,-I,')) +w autoreconf -f -i $@ || { aclocal --force $(echo "$@"|sed 's,-M,-I,') && libtoolize --copy --force && autoconf --force && automake --add-missing --copy --force-missing; } ./configure --prefix="$INSTPREFIX" if $DOCLEAN; then $MAKE distclean -- 1.7.1