]> git.draconx.ca Git - upkg.git/commitdiff
Make GOB2 optional.
authorNick Bowler <nbowler@draconx.ca>
Mon, 27 Jan 2020 20:00:16 +0000 (15:00 -0500)
committerNick Bowler <nbowler@draconx.ca>
Mon, 27 Jan 2020 23:36:01 +0000 (18:36 -0500)
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
common
configure.ac

index 495f40af87b39cdbf9c7ffe9a192592387f6d5c3..b1330d05cd1dfa0a9e94fbf3173d2271ea070e65 100644 (file)
@@ -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 <https://draconx.ca/projects/gob-dx/>."; \
+        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 92a89700c65e52fac8c2cace51a7112d60b3f42f..4705ffd69e7b7551bab4650f9e49756667be783b 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 92a89700c65e52fac8c2cace51a7112d60b3f42f
+Subproject commit 4705ffd69e7b7551bab4650f9e49756667be783b
index 752343f62616ae84dffb1c1b50c776cdbc143ee5..85dfd3cf92d3f93c8105558d10e7cc412ef21133 100644 (file)
@@ -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