From cdb019ee207a4bf4872203db94184bb507fa6670 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Mon, 27 Jan 2020 15:00:16 -0500 Subject: [PATCH] Make GOB2 optional. When building from a distribution tarball, gob2 should not actually be required because all its outputs are distributed. Allow configure to proceed in this case, and defer the failure until later, when make actually tries to process a gob file. And add a proper configure test for the dynamic type support in the gob-dx fork, which we require. --- Makefile.am | 16 ++++++++++++++++ common | 2 +- configure.ac | 32 +++++++++++++++++++++++++++----- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 495f40a..b1330d0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -107,8 +107,24 @@ GOB_V_0 = @printf ' %$(DX_ALIGN_V)s %s\n' 'GOB ' $<; # rather than its filename. This isn't really suitable for use with make, so # this rule has to make some assumptions about the source tree layout. .gob.gobstamp: +if HAVE_GOB2_DYN $(GOB_V) $(GOB2) -o src --file-sep=/ --no-private-header $< $(AM_V_at) touch $@ +else +if HAVE_GOB2 + @echo "ERROR: *** $(GOB2) does not support dynamic types." 1>&2 +else + @echo "ERROR: *** gob2 is missing on your system." 1>&2 +endif + @:; { \ + echo " *** Because of this, I cannot compile $<, but"; \ + echo " *** (perhaps because you modified it) the sources appear out of date."; \ + echo " *** A newer version of gob2 may be required; the latest version"; \ + echo " *** may be found at ."; \ + echo " *** See config.log for more details."; \ + } 1>&2 + @false +endif STAMP_RECOVER = \ @if test -f $@; then :; else rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; fi diff --git a/common b/common index 92a8970..4705ffd 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 92a89700c65e52fac8c2cace51a7112d60b3f42f +Subproject commit 4705ffd69e7b7551bab4650f9e49756667be783b diff --git a/configure.ac b/configure.ac index 752343f..85dfd3c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -dnl Copyright © 2009-2012, 2015, 2019 Nick Bowler +dnl Copyright © 2009-2012, 2015, 2019-2020 Nick Bowler dnl dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2. dnl This is free software: you are free to do what the fuck you want to. @@ -23,6 +23,8 @@ LTDL_INIT([nonrecursive]) gl_INIT +AC_CACHE_SAVE + m4_include([lib/gnulib.mk]) CHECK_GLIB_2([], [gobject]) @@ -47,10 +49,30 @@ AC_MSG_RESULT([$use_modlib]) AM_CONDITIONAL([USE_LIBMODPLUG], [test x$use_modlib = xmodplug]) AM_CONDITIONAL([USE_DUMMYMOD], [test x$use_modlib = xnone]) -GOB2_CHECK([2.0.0]) +DX_PROG_GOB2([2.0.0], [have_gob2=yes], [have_gob2=no]) +AM_CONDITIONAL([HAVE_GOB2], [test x"$have_gob2" = x"yes"]) -AC_CONFIG_FILES([ - Makefile - libuobject.pc +AS_IF([test x"$have_gob2" != x"yes"], [dx_cv_gob2_dynamic_types=no]) +AC_CACHE_CHECK([Whether $GOB2 supports dynamic types], + [dx_cv_gob2_dynamic_types], [cat >conftest.gob <<'EOF' +class :Conftest from G:Object (dynamic) +{ + public void test(void) + { + } +} +EOF +dx_cv_gob2_dynamic_types=no +AS_IF([$GOB2 conftest.gob >/dev/null 2>&1], +[mv conftest.c conftest.inc +save_CFLAGS=$CFLAGS save_LIBS=$LIBS +CFLAGS="$GLIB_CFLAGS $CFLAGS" +LIBS="$LIBS $GLIB_LIBS" +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#]include "conftest.inc"], +[conftest_register_type(0);])], [dx_cv_gob2_dynamic_types=yes]) +CFLAGS=$save_CFLAGS LIBS=$save_LIBS]) ]) +AM_CONDITIONAL([HAVE_GOB2_DYN], [test x"$dx_cv_gob2_dynamic_types" = x"yes"]) + +AC_CONFIG_FILES([Makefile libuobject.pc]) AC_OUTPUT -- 2.43.0