diff --git a/app/Makefile.am b/app/Makefile.am
index d837cdba5cc7d27b8f9127a4355456bfc01f8493..67fc38e0a2a67e54c0e2584130a859d62097df3e 100644
--- a/app/Makefile.am
+++ b/app/Makefile.am
@@ -10,7 +10,11 @@ noinst_PROGRAMS += cdi
 endif !ENABLE_CDI_LIB
 noinst_PROGRAMS += createtable
 else !ENABLE_CDI_APP
+if with_on_demand_check_programs
 check_PROGRAMS += cdi
+else !with_on_demand_check_programs
+noinst_PROGRAMS += cdi
+endif !with_on_demand_check_programs
 endif !ENABLE_CDI_APP
 
 AM_CPPFLAGS = -I$(top_srcdir)/src
diff --git a/configure.ac b/configure.ac
index 442e4a861f5530aa075927b393e9dea6e857f2a9..f478090a4f3f6ea2b0337ea54f499aa3d2519f6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -611,6 +611,15 @@ AM_MISSING_PROG([PYTHON], [python])
 AM_CONDITIONAL([ENABLE_PYTHON_INTERFACE],
   [test "x$enable_python_interface" = xyes])
 
+AC_ARG_WITH([on-demand-check-programs],
+  [AS_HELP_STRING([--with-on-demand-check-programs],
+     [only build test programs when calling 'make check' @<:@default: build ]dnl
+[during 'make all'@:>@])],
+  [test "x$withval" != xno && with_on_demand_check_programs=yes],
+  [with_on_demand_check_programs=no])
+AM_CONDITIONAL([with_on_demand_check_programs],
+  [test "x$with_on_demand_check_programs" = xyes])
+
 AC_ARG_WITH([concurrent-mpi-checks],
   [AS_HELP_STRING([--with-concurrent-mpi-checks],
      [allow for simultaneous runs of MPI tests @<:@default: run MPI test ]dnl
diff --git a/examples/Makefile.am b/examples/Makefile.am
index ad384fcd7cb8c4d9793398075b941afc209e3758..5b9f88f403674201aea17cbdc9528a9376d2104d 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -12,14 +12,23 @@ noinst_PROGRAMS = \
 
 check_PROGRAMS =
 
+# Examples that are part of the test suite:
+test_PROGRAMS_ =
+
 if ENABLE_NETCDF
-check_PROGRAMS += cdi_write_const
+test_PROGRAMS_ += cdi_write_const
 endif
 
 if ENABLE_ISOC_INTERFACE
-check_PROGRAMS += cdi_read_f2003 cdi_write_f2003
+test_PROGRAMS_ += cdi_read_f2003 cdi_write_f2003
 endif ENABLE_ISOC_INTERFACE
 
+if with_on_demand_check_programs
+check_PROGRAMS += $(test_PROGRAMS_)
+else !with_on_demand_check_programs
+noinst_PROGRAMS += $(test_PROGRAMS_)
+endif !with_on_demand_check_programs
+
 AM_CPPFLAGS = -I$(top_srcdir)/src
 
 AM_FCFLAGS =
diff --git a/src/Makefile.am b/src/Makefile.am
index 91116f24fe2f5c67c3a4db2837020d00064f3723..ebc5469646961b0abeba3ecd3505f57983450fe9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,7 @@ cmakedir = $(libdir)/cmake
 include_HEADERS =
 nodist_include_HEADERS =
 lib_LTLIBRARIES =
-check_LTLIBRARIES = libcdiresunpack.la
+check_LTLIBRARIES =
 noinst_LTLIBRARIES =
 EXTRA_PROGRAMS = make_fint
 EXTRA_DIST = cdilib.c
@@ -54,6 +54,12 @@ noinst_LTLIBRARIES += libcdipio.la
 endif ENABLE_MPI
 endif !ENABLE_CDI_LIB
 
+if with_on_demand_check_programs
+check_LTLIBRARIES += libcdiresunpack.la
+else !with_on_demand_check_programs
+noinst_LTLIBRARIES += libcdiresunpack.la
+endif !with_on_demand_check_programs
+
 AM_CPPFLAGS =
 if ENABLE_MPI
 # TODO: this needs a refactoring but for now we set this macro here and not in
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cf07f1500e12edbcaad3f7be325a2cb47a66c714..d2651df406e735ed9579e13defca4a769c69bf37 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -53,7 +53,7 @@ pio_write_run_parallel.log: pio_write_deco2d_run_parallel.log
 test_resource_copy_mpi_run.log: pio_write_run_parallel.log
 endif !with_concurrent_mpi_checks
 
-check_PROGRAMS = \
+test_PROGRAMS_ = \
   calendar_test1 \
   cksum_read \
   cksum_verify \
@@ -67,18 +67,24 @@ check_PROGRAMS = \
   test_table
 
 if ENABLE_NETCDF
-check_PROGRAMS += \
+test_PROGRAMS_ += \
   test_cdf_read \
   test_cdf_write
 endif
 
 if ENABLE_MPI
-check_PROGRAMS += \
+test_PROGRAMS_ += \
   pio_write_deco2d_parallel \
   pio_write_parallel \
   test_resource_copy_mpi
 endif ENABLE_MPI
 
+if with_on_demand_check_programs
+check_PROGRAMS = $(test_PROGRAMS_)
+else !with_on_demand_check_programs
+noinst_PROGRAMS = $(test_PROGRAMS_)
+endif !with_on_demand_check_programs
+
 AM_CPPFLAGS = -I$(top_srcdir)/src
 AM_CFLAGS = $(PPM_CORE_C_INCLUDE) $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE)