+if GNM_SUPPORT
+dist_TESTS += tests/command/get-data-gnm.sh
+endif
+
+if PSQL_SUPPORT
+dist_TESTS += tests/command/get-data-psql.sh
+endif
+
+nodist_TESTS = \
+ tests/libpspp/abt-test \
+ tests/libpspp/bt-test \
+ tests/libpspp/heap-test \
+ tests/libpspp/hmap-test \
+ tests/libpspp/hmapx-test \
+ tests/libpspp/ll-test \
+ tests/libpspp/llx-test \
+ tests/libpspp/range-map-test \
+ tests/libpspp/range-set-test \
+ tests/libpspp/sparse-array-test \
+ tests/libpspp/str-test \
+ tests/libpspp/tower-test
+
+TESTS = $(dist_TESTS) $(nodist_TESTS)
+
+check_PROGRAMS += \
+ $(nodist_TESTS) \
+ tests/data/datasheet-test \
+ tests/formats/inexactify \
+ tests/libpspp/sparse-xarray-test
+
+tests_data_datasheet_test_SOURCES = \
+ tests/data/datasheet-test.c
+tests_data_datasheet_test_LDADD = src/libpspp-core.la @LIBINTL@
+
+tests_libpspp_ll_test_SOURCES = \
+ src/libpspp/ll.c \
+ src/libpspp/ll.h \
+ tests/libpspp/ll-test.c
+tests_libpspp_ll_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_ll_test_CFLAGS = $(AM_CFLAGS)
+
+tests_libpspp_llx_test_SOURCES = \
+ src/libpspp/ll.c \
+ src/libpspp/ll.h \
+ src/libpspp/llx.c \
+ src/libpspp/llx.h \
+ tests/libpspp/llx-test.c
+tests_libpspp_llx_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_llx_test_CFLAGS = $(AM_CFLAGS)
+
+tests_libpspp_heap_test_SOURCES = \
+ src/libpspp/heap.c \
+ src/libpspp/heap.h \
+ src/libpspp/pool.c \
+ src/libpspp/pool.h \
+ tests/libpspp/heap-test.c
+tests_libpspp_heap_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_heap_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
+
+tests_libpspp_hmap_test_SOURCES = \
+ src/libpspp/hmap.c \
+ src/libpspp/hmap.h \
+ tests/libpspp/hmap-test.c
+tests_libpspp_hmap_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_hmap_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
+
+tests_libpspp_hmapx_test_SOURCES = \
+ src/libpspp/hmap.c \
+ src/libpspp/hmap.h \
+ src/libpspp/hmapx.c \
+ src/libpspp/hmapx.h \
+ tests/libpspp/hmapx-test.c
+tests_libpspp_hmapx_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_hmapx_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
+
+tests_libpspp_abt_test_SOURCES = \
+ src/libpspp/abt.c \
+ src/libpspp/abt.h \
+ tests/libpspp/abt-test.c
+tests_libpspp_abt_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_abt_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
+
+tests_libpspp_bt_test_SOURCES = \
+ src/libpspp/bt.c \
+ src/libpspp/bt.h \
+ tests/libpspp/bt-test.c
+tests_libpspp_bt_test_LDADD = gl/libgl.la
+tests_libpspp_bt_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
+
+tests_libpspp_range_map_test_SOURCES = \
+ src/libpspp/bt.c \
+ src/libpspp/bt.h \
+ src/libpspp/range-map.c \
+ src/libpspp/range-map.h \
+ tests/libpspp/range-map-test.c
+tests_libpspp_range_map_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_range_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
+
+tests_libpspp_range_set_test_SOURCES = \
+ src/libpspp/bt.c \
+ src/libpspp/bt.h \
+ src/libpspp/pool.c \
+ src/libpspp/pool.h \
+ src/libpspp/range-set.c \
+ src/libpspp/range-set.h \
+ tests/libpspp/range-set-test.c
+tests_libpspp_range_set_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_range_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
+
+tests_libpspp_str_test_SOURCES = \
+ tests/libpspp/str-test.c
+tests_libpspp_str_test_LDADD = src/libpspp/libpspp.la gl/libgl.la @LIBINTL@
+
+tests_libpspp_tower_test_SOURCES = \
+ src/libpspp/abt.c \
+ src/libpspp/abt.h \
+ src/libpspp/pool.c \
+ src/libpspp/pool.h \
+ src/libpspp/tower.c \
+ src/libpspp/tower.h \
+ tests/libpspp/tower-test.c
+tests_libpspp_tower_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_tower_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
+
+tests_libpspp_sparse_array_test_SOURCES = \
+ src/libpspp/sparse-array.c \
+ src/libpspp/sparse-array.h \
+ src/libpspp/pool.c \
+ src/libpspp/pool.h \
+ tests/libpspp/sparse-array-test.c
+tests_libpspp_sparse_array_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_sparse_array_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
+
+tests_libpspp_sparse_xarray_test_SOURCES = \
+ src/libpspp/argv-parser.c \
+ src/libpspp/bt.c \
+ src/libpspp/deque.c \
+ src/libpspp/model-checker.c \
+ src/libpspp/range-set.c \
+ src/libpspp/sparse-array.c \
+ src/libpspp/sparse-xarray.c \
+ src/libpspp/str.c \
+ src/libpspp/pool.c \
+ src/libpspp/tmpfile.c \
+ tests/libpspp/sparse-xarray-test.c
+tests_libpspp_sparse_xarray_test_LDADD = gl/libgl.la @LIBINTL@
+tests_libpspp_sparse_xarray_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
+
+tests_formats_inexactify_SOURCES = tests/formats/inexactify.c
+
+noinst_PROGRAMS += tests/dissect-sysfile
+tests_dissect_sysfile_SOURCES = \
+ src/libpspp/integer-format.c \
+ src/libpspp/float-format.c \
+ tests/dissect-sysfile.c
+tests_dissect_sysfile_LDADD = gl/libgl.la @LIBINTL@
+tests_dissect_sysfile_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+
+EXTRA_DIST += \
+ $(dist_TESTS) \
+ tests/Book1.gnm.unzipped \
+ tests/weighting.data tests/data-list.data tests/list.data \