diff --git a/Makefile.am b/Makefile.am index d3d5f57a15..35f4771254 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,6 +40,7 @@ dist_doc_DATA = \ # CVS dirs. EXTRA_DIST = \ + $(SWIG_DIST_FAIL) \ make-gnucash-potfiles.in \ macros/as-scrub-include.m4 \ macros/binreloc.m4 \ @@ -146,6 +147,14 @@ distuninstallcheck_listfiles = \ #dist-hook: po/POTFILES.in +# Make "make dist" fail if we have the wrong version of swig +if SWIG_DIST_FAIL +SWIG_DIST_FAIL = swig-dist-fail +swig-dist-fail: + @echo "You cannot build the dist with your version of swig" + @exit 1 +endif + distcheck-hook: @e=''; \ for X in `grep -v \# ${distdir}/po/POTFILES.in | sed 's/\[type:.*\]//'` ; do \ diff --git a/configure.ac b/configure.ac index 198137594f..bc047df62b 100644 --- a/configure.ac +++ b/configure.ac @@ -476,21 +476,51 @@ AM_CONDITIONAL(GNC_HAVE_GUILE_WWW, test "${gnc_have_guile_www}" = yes) ### -------------------------------------------------------------------------- ### SWIG version checks (only when building from SCM) # -# We need at least version 2.0.10 of SWIG because that's the first version -# that supports guile 2 -# For a guile 1.8 build we could have gotten away with an older version -# but we need to apply a patch to the swig generated files that needs to -# go into the release tarball. At that point we don't know yet which -# version of guile will be used together with that tarball so we have -# to prepare the tarball for guile 2 compatibility. +# In order to build against guile 2 or build the dist we need at least +# version 2.0.10 of SWIG, because that's the first version that supports +# guile 2. +# +# For a guile 1.8 build we accept an older version, but wont allow you +# to build the dist because we need to apply a patch to the swig +# generated files that needs to go into the release tarball. At that +# point we don't know yet which version of guile will be used together +# with that tarball so we have to prepare the tarball for guile 2 +# compatibility. +# if test "${BUILDING_FROM_SCM}" = yes then - AX_PKG_SWIG(2.0.10, [], - [AC_MSG_ERROR([ + AX_PKG_SWIG(2.0.10, [gnc_have_swig_2_0_10=yes], [gnc_have_swig_2_0_10=no]) + + if test "${gnc_have_guile_2}" = yes + then + if test "${gnc_have_swig_2_0_10}" = no + then + AC_MSG_ERROR([ You are building from ${SCM_TYPE} but swig was not found or too old. To build gnucash you need at least swig version 2.0.10. - ])]) + ]) + fi + else # using guile 1.8 + if test "${gnc_have_swig_2_0_10}" = no + then + AX_PKG_SWIG(1.3.31, [], + [AC_MSG_ERROR([ + You are building from ${SCM_TYPE} but swig was not found or too old. + To build gnucash with guile 1.8 you need at least swig version 1.3.31. + ])]) + fi + fi + + # If we get here then we have an okay version to build locally. + # Check if we can build dist (which always requires swig 2.0.10) + if test "${gnc_have_swig_2_0_10}" = no + then + AC_MSG_WARN([You don't have SWIG 2.0.10 so you will not be able to "make dist"]) + fi fi + +AM_CONDITIONAL([SWIG_DIST_FAIL], test "${gnc_have_swig_2_0_10}" != yes) + ### -------------------------------------------------------------------------- ### LIBXML -- GNOME_XML_LIB is defined by GNOME_XML_CHECK diff --git a/src/app-utils/Makefile.am b/src/app-utils/Makefile.am index 5fc3586f90..8627c5dd95 100644 --- a/src/app-utils/Makefile.am +++ b/src/app-utils/Makefile.am @@ -110,10 +110,12 @@ swig-app-utils-guile.c: app-utils.i ${top_srcdir}/src/base-typemaps.i $(SWIG) -guile $(SWIG_ARGS) -Linkage module \ -I${top_srcdir}/src -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif +endif swig-app-utils-python.c: app-utils.i ${top_srcdir}/src/base-typemaps.i $(SWIG) -python -Wall -Werror $(SWIG_ARGS) \ -I${top_srcdir}/src -o $@ $< diff --git a/src/core-utils/Makefile.am b/src/core-utils/Makefile.am index a26dfea2ef..b067e881dc 100644 --- a/src/core-utils/Makefile.am +++ b/src/core-utils/Makefile.am @@ -47,10 +47,12 @@ swig-core-utils-guile.c: core-utils.i ${top_srcdir}/src/base-typemaps.i $(SWIG) -guile $(SWIG_ARGS) -Linkage module \ -I${top_srcdir}/src -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif +endif swig-core-utils-python.c: core-utils.i ${top_srcdir}/src/base-typemaps.i $(SWIG) -python -Wall -Werror $(SWIG_ARGS) \ -I${top_srcdir}/src -o $@ $< diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am index 5d6f8a06ac..a550530739 100644 --- a/src/engine/Makefile.am +++ b/src/engine/Makefile.am @@ -206,11 +206,13 @@ swig-engine.c: engine.i $(top_srcdir)/src/base-typemaps.i \ $(SWIG) -guile $(SWIG_ARGS) -Linkage module \ -I${top_srcdir}/src/libqof/qof -I${top_srcdir}/src -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif endif +endif iso-4217-currencies.c: iso-4217-currencies.scm iso-currencies-to-c -chmod u+x ./iso-currencies-to-c diff --git a/src/gnc-module/Makefile.am b/src/gnc-module/Makefile.am index b11cee08d4..7ee546b014 100644 --- a/src/gnc-module/Makefile.am +++ b/src/gnc-module/Makefile.am @@ -34,11 +34,13 @@ swig-gnc-module.c: gnc-module.i ${top_srcdir}/src/base-typemaps.i $(SWIG) -guile $(SWIG_ARGS) -Linkage module \ -I${top_srcdir}/src -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif endif +endif EXTRA_DIST = \ ${gncmod_DATA} \ diff --git a/src/gnc-module/test/mod-bar/Makefile.am b/src/gnc-module/test/mod-bar/Makefile.am index 368b14fc27..d076bae112 100644 --- a/src/gnc-module/test/mod-bar/Makefile.am +++ b/src/gnc-module/test/mod-bar/Makefile.am @@ -26,11 +26,13 @@ if BUILDING_FROM_SCM swig-bar.c: bar.i $(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif endif +endif EXTRA_DIST = \ bar.i \ diff --git a/src/gnc-module/test/mod-baz/Makefile.am b/src/gnc-module/test/mod-baz/Makefile.am index fad5672e2b..82d8a699f1 100644 --- a/src/gnc-module/test/mod-baz/Makefile.am +++ b/src/gnc-module/test/mod-baz/Makefile.am @@ -30,11 +30,13 @@ if BUILDING_FROM_SCM swig-baz.c: baz.i $(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif endif +endif EXTRA_DIST = \ baz.i \ diff --git a/src/gnc-module/test/mod-foo/Makefile.am b/src/gnc-module/test/mod-foo/Makefile.am index 6938cda448..cd06ed96ef 100644 --- a/src/gnc-module/test/mod-foo/Makefile.am +++ b/src/gnc-module/test/mod-foo/Makefile.am @@ -31,11 +31,13 @@ if BUILDING_FROM_SCM swig-foo.c: foo.i $(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif endif +endif BUILT_SOURCES = swig-foo.c MAINTAINERCLEANFILES = swig-foo.c diff --git a/src/gnome-utils/Makefile.am b/src/gnome-utils/Makefile.am index 6d723dbf14..b973a6bb8f 100644 --- a/src/gnome-utils/Makefile.am +++ b/src/gnome-utils/Makefile.am @@ -229,11 +229,13 @@ swig-gnome-utils.c: gnome-utils.i \ $(SWIG) -guile $(SWIG_ARGS) -Linkage module \ -I${top_srcdir}/src -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif endif +endif gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash gncmod_DATA = gnome-utils.scm diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am index 2fc53b3ddf..41ed1f9e70 100644 --- a/src/gnome/Makefile.am +++ b/src/gnome/Makefile.am @@ -116,11 +116,13 @@ swig-gnome.c: gnome.i dialog-progress.h ${top_srcdir}/src/base-typemaps.i $(SWIG) -guile $(SWIG_ARGS) -Linkage module \ -I${top_srcdir}/src -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif endif +endif EXTRA_DIST = \ gnome.i \ diff --git a/src/html/Makefile.am b/src/html/Makefile.am index 725b704f8f..5013e92ce5 100644 --- a/src/html/Makefile.am +++ b/src/html/Makefile.am @@ -60,11 +60,13 @@ swig-gnc-html.c: gnc-html.i gnc-html.h \ $(SWIG) -guile $(SWIG_ARGS) -Linkage module \ -I${top_srcdir}/src -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif endif +endif EXTRA_DIST = \ gnc-html.i diff --git a/src/report/report-gnome/Makefile.am b/src/report/report-gnome/Makefile.am index 9200a7d01e..5f65a0ed5a 100644 --- a/src/report/report-gnome/Makefile.am +++ b/src/report/report-gnome/Makefile.am @@ -54,11 +54,13 @@ swig-report-gnome.c: report-gnome.i ${top_srcdir}/src/base-typemaps.i $(SWIG) -guile $(SWIG_ARGS) -Linkage module \ -I${top_srcdir}/src -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif endif +endif gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash/report gncmod_DATA = report-gnome.scm diff --git a/src/report/report-system/Makefile.am b/src/report/report-system/Makefile.am index 425cce3c2a..da487d1cbd 100644 --- a/src/report/report-system/Makefile.am +++ b/src/report/report-system/Makefile.am @@ -26,11 +26,13 @@ swig-report-system.c: report-system.i ${top_srcdir}/src/base-typemaps.i $(SWIG) -guile $(SWIG_ARGS) -Linkage module \ -I${top_srcdir}/src -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif endif +endif AM_CPPFLAGS = \ -I${top_srcdir}/src \ diff --git a/src/test-core/Makefile.am b/src/test-core/Makefile.am index fb31c58445..8ed78a4fdf 100644 --- a/src/test-core/Makefile.am +++ b/src/test-core/Makefile.am @@ -29,10 +29,12 @@ swig-unittest-support-guile.c: unittest-support.i $(top_srcdir)/src/base-typemap -I${top_srcdir}/src \ ${AM_CPPFLAGS} -o $@ $< if ! OS_WIN32 +if ! SWIG_DIST_FAIL if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \ patch $@ $(top_srcdir)/src/swig-utf8.patch; \ fi endif +endif swig-unittest-support-python.c: unittest-support.i $(top_srcdir)/src/base-typemaps.i $(SWIG) -python -Wall -Werror $(SWIG_ARGS) \