.dirstamp
/INSTALL
/aclocal.m4
+/atconfig
+/atlocal
/autom4te.cache
/compile
/config.*
/libtool
/ltmain.sh
/missing
+/package.m4
/stamp-h1
+/testsuite
+/testsuite.deps
+/testsuite.dir
+/testsuite.log
/ylwrap
Makefile
Makefile.in
--- /dev/null
+[submodule "common"]
+ path = common
+ url = https://git.draconx.ca/dxcommon.git
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
-ACLOCAL_AMFLAGS = -I m4
+ACLOCAL_AMFLAGS = -I m4 -I common/m4
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
-I$(builddir) -I$(srcdir) -DPKGDATADIR=\"$(pkgdatadir)\"
-AM_CFLAGS = $(GLIB_CFLAGS)
+AM_CFLAGS = $(LIBGLIB_CFLAGS)
AM_YFLAGS = -d -t
bin_PROGRAMS = gob2
examples/gtk-button-count.gob examples/my-glade-main.c \
examples/my-glade.glade examples/my-glade.gob gob2.spec \
src/treefuncs.c src/treefuncs.h src/treefuncs.stamp \
- src/treefuncs.def src/generate_treefuncs.pl
+ src/treefuncs.def src/generate_treefuncs.pl \
+ t/test.gob t/str.gob
CLEANFILES =
DISTCLEANFILES =
gob2_SOURCES = src/main.c src/main.h src/treefuncs.c src/out.c src/util.c \
src/checks.c src/parse.y src/lexer.l
-gob2_LDADD = $(GLIB_LIBS) @LEXLIB@
+gob2_LDADD = $(LIBGLIB_LIBS) @LEXLIB@
$(gob2_OBJECTS): src/treefuncs.h
man_MANS = doc/gob2.1
m4dir = $(datadir)/aclocal
dist_m4_DATA = gob2.m4
+
+include $(top_srcdir)/common/snippet/autotest.mk
--- /dev/null
+: "${CC=@CC@}"
+: "${CXX=@CXX@}"
+: "${CPPFLAGS=@CPPFLAGS@}"
+: "${CFLAGS=@CFLAGS@}"
+: "${CXXFLAGS=@CXXFLAGS@}"
+: "${LDFLAGS=@LDFLAGS@}"
+: "${GTK_CFLAGS=@GTK_CFLAGS@}"
+: "${GTK_LIBS=@GTK_LIBS@}"
+: "${LIBGOBJECT_CFLAGS=@LIBGOBJECT_CFLAGS@}"
+: "${LIBGOBJECT_LIBS=@LIBGOBJECT_LIBS@}"
+: "${HAVE_GOBJECT=@HAVE_GOBJECT@}"
+: "${HAVE_GTK2=@HAVE_GTK2@}"
--- /dev/null
+#!/bin/sh
+
+argv0=$0
+
+err () { printf '%s: %s\n' "$argv0" "$@" 1>&2; }
+die () { err "$@"; exit 1; }
+
+: "${AUTORECONF=autoreconf}"
+: "${GIT=git}"
+
+$GIT submodule update --init || err "Failed to update submodules from git."
+
+# Punt some automake-generated files so that Gentoo's wrapper script
+# doesn'# try to detect the automake version in use.
+rm -f Makefile.in aclocal.m4
+$AUTORECONF -fis
--- /dev/null
+Subproject commit 9ade2c8c042ab15030d7bbb49fa97ae692a10e4f
AM_SILENT_RULES([yes])
AC_PROG_CC
+AC_PROG_CXX
AC_PROG_LEX
AC_PROG_YACC
LT_INIT
-PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.4.0])
+DX_LIB_GLIB2
-AC_CONFIG_FILES([Makefile gob2.spec doc/gob2.1])
+dnl Dependencies for test suite
+DX_LIB_GLIB2([], [gobject], [HAVE_GOBJECT=true], [HAVE_GOBJECT=false])
+AC_SUBST([HAVE_GOBJECT])
+
+DX_LIB_GTK2([], [HAVE_GTK2=true], [HAVE_GTK2=false])
+AC_SUBST([HAVE_GTK2])
+
+AC_CONFIG_TESTDIR([.], [t:.])
+DX_PROG_AUTOTEST
+AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
+
+AC_CONFIG_FILES([Makefile gob2.spec doc/gob2.1 atlocal])
AC_OUTPUT
+++ /dev/null
-#include "str.h"
-
-int
-main (void)
-{
- g_type_init ();
-
- int the_answer = 42;
- char *stupid_pointer = "ug";
-
- // This works fine.
- Str *test_good = (Str *) (str_new ("%d", the_answer));
- test_good = test_good;
-
- // This gets a warning thanks to our function attribute.
- Str *test_bad = (Str *) (str_new ("%d", stupid_pointer));
- test_bad = test_bad;
-
- return 0;
-}
--- /dev/null
+dnl Copyright © 2019 Nick Bowler
+dnl License GPLv2+: GNU General Public License version 2 or any later version.
+dnl This is free software: you are free to change and redistribute it.
+dnl There is NO WARRANTY, to the extent permitted by law.
+
+AT_SETUP([test.gob compilation])
+
+AT_CHECK([gob2 "$abs_top_srcdir/t/test.gob"])
+AT_CHECK([$HAVE_GTK2 || exit 77])
+TEST_COMPILE_GOBJECT([$GTK_CFLAGS test-object.c], [0], [], [ignore])
+
+AT_CLEANUP
+
+AT_SETUP([test.gob C++ compilation])
+
+AT_CHECK([gob2 --for-cpp "$abs_top_srcdir/t/test.gob"])
+AT_CHECK([$HAVE_GTK2 || exit 77])
+TEST_COMPILEXX_GOBJECT([$GTK_CFLAGS test-object.cc], [0], [], [ignore])
+
+AT_CLEANUP
+
+AT_SETUP([str.gob])
+
+AT_DATA([main.c],
+[[#include "str.h"
+
+int main(void)
+{
+ g_type_init ();
+
+ int the_answer = 42;
+ char *stupid_pointer = "ug";
+
+ /* This works fine. */
+ Str *test_good = (Str *) (str_new ("%d", the_answer));
+ test_good = test_good;
+
+ /* This gets a warning thanks to our function attribute. */
+ Str *test_bad = (Str *) (str_new ("%d", stupid_pointer));
+ test_bad = test_bad;
+
+ return 0;
+}
+]])
+
+str_gob=$abs_top_srcdir/t/str.gob
+AT_CHECK([gob2 "$str_gob"])
+TEST_COMPILE_GOBJECT([str.c], [0], [], [stderr])
+mv stderr str_stderr
+
+# Check for correct diagnostic messages on the target lines...
+AT_CHECK([awk '/want a string/ { print NR }' "$str_gob" >str_lines])
+total=0
+exec 3<str_lines
+while read l <&3; do
+ AS_VAR_ARITH([total], [1 + $total])
+ AT_CHECK([awk -v line="$l" -v file="$str_gob" -NF : \
+ '$1 == file && $2 == line { exit 42 }' str_stderr], [42])
+done
+exec 3<&-
+AT_CHECK([test x"$total" = x"2"])
+
+TEST_COMPILE_GOBJECT([main.c], [0], [], [stderr])
+AT_CHECK([awk -NF : '$1 == "main.c" && $2 == "15" { exit 42 }' stderr], [42])
+
+AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main str.o main.o])
+
+AT_CLEANUP
--- /dev/null
+AT_COPYRIGHT([Copyright © 2019 Nick Bowler
+License GPLv2+: GNU General Public License version 2 or any later version.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.])
+
+dnl Compile a C source file with default cflags for libgobject. The test
+dnl group is skipped if libgobject was not enabled at configure time. The
+dnl first argument contains extra compiler flags, which must include the
+dnl source file name. The remaining arguments correspond to the remaining
+dnl arguments of AT_CHECK (e.g., the 2nd argument to TEST_COMPILE_GOBJECT
+dnl is the 2nd argument of AT_CHECK -- the expected exit status).
+m4_define([TEST_COMPILE_GOBJECT], [AT_CHECK([$HAVE_GOBJECT || exit 77
+$CC $CPPFLAGS $CFLAGS $LIBGOBJECT_CFLAGS -c $1], m4_shift($@))])
+
+dnl Same as TEST_COMPILE_GOBJECT, except that the C++ compiler is used.
+m4_define([TEST_COMPILEXX_GOBJECT], [AT_CHECK([$HAVE_GOBJECT || exit 77
+$CXX $CPPFLAGS $CXXFLAGS $LIBGOBJECT_CFLAGS -c $1], m4_shift($@))])
+
+AT_INIT
+AT_COLOR_TESTS
+
+AT_TESTED([gob2])
+
+m4_include([tests/general.at])