Index: INSTALL
===================================================================
--- INSTALL	(revision 526)
+++ INSTALL	(revision 611)
@@ -28,6 +28,6 @@
 
       This command compiles the non-template part of LEMON into libemon.a
-      file. It also compiles the programs in the tools and demo subdirectories
-      when enabled.
+      file. It also compiles the programs in the tools subdirectory by
+      default.
 
    4. `make check'
@@ -75,12 +75,4 @@
 
   Set the installation prefix to PREFIX. By default it is /usr/local.
-
---enable-demo
-
-   Build the examples in the demo subdirectory.
-
---disable-demo
-
-   Do not build the examples in the demo subdirectory (default).
 
 --enable-tools
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 555)
+++ Makefile.am	(revision 611)
@@ -40,6 +40,10 @@
 include test/Makefile.am
 include doc/Makefile.am
-include demo/Makefile.am
 include tools/Makefile.am
+
+DIST_SUBDIRS = demo
+
+demo:
+	$(MAKE) $(AM_MAKEFLAGS) -C demo
 
 MRPROPERFILES = \
@@ -69,3 +73,3 @@
 	bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2
 
-.PHONY: mrproper dist-bz2 distcheck-bz2
+.PHONY: demo mrproper dist-bz2 distcheck-bz2
Index: configure.ac
===================================================================
--- configure.ac	(revision 564)
+++ configure.ac	(revision 611)
@@ -65,17 +65,4 @@
 AM_CONDITIONAL([HAVE_MIP], [test x"$lx_mip_found" = x"yes"])
 
-dnl Disable/enable building the demo programs.
-AC_ARG_ENABLE([demo],
-AS_HELP_STRING([--enable-demo], [build the demo programs])
-AS_HELP_STRING([--disable-demo], [do not build the demo programs @<:@default@:>@]),
-              [], [enable_demo=no])
-AC_MSG_CHECKING([whether to build the demo programs])
-if test x"$enable_demo" != x"no"; then
-  AC_MSG_RESULT([yes])
-else
-  AC_MSG_RESULT([no])
-fi
-AM_CONDITIONAL([WANT_DEMO], [test x"$enable_demo" != x"no"])
-
 dnl Disable/enable building the binary tools.
 AC_ARG_ENABLE([tools],
@@ -111,4 +98,5 @@
 AC_CONFIG_FILES([
 Makefile
+demo/Makefile
 cmake/version.cmake
 doc/Doxyfile
@@ -133,5 +121,4 @@
 echo CLP support................... : $lx_clp_found
 echo
-echo Build demo programs........... : $enable_demo
 echo Build additional tools........ : $enable_tools
 echo
Index: demo/Makefile.am
===================================================================
--- demo/Makefile.am	(revision 415)
+++ demo/Makefile.am	(revision 611)
@@ -1,16 +1,17 @@
-EXTRA_DIST += \
-	demo/CMakeLists.txt \
-	demo/digraph.lgf
+AM_CXXFLAGS = $(WARNINGCXXFLAGS)
 
-if WANT_DEMO
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
+LDADD = $(top_builddir)/lemon/libemon.la
 
-noinst_PROGRAMS += \
-	demo/arg_parser_demo \
-	demo/graph_to_eps_demo \
-	demo/lgf_demo
+EXTRA_DIST = \
+	CMakeLists.txt \
+	digraph.lgf
 
-endif WANT_DEMO
+noinst_PROGRAMS = \
+	arg_parser_demo \
+	graph_to_eps_demo \
+	lgf_demo
 
-demo_arg_parser_demo_SOURCES = demo/arg_parser_demo.cc
-demo_graph_to_eps_demo_SOURCES = demo/graph_to_eps_demo.cc
-demo_lgf_demo_SOURCES = demo/lgf_demo.cc
+arg_parser_demo_SOURCES = arg_parser_demo.cc
+graph_to_eps_demo_SOURCES = graph_to_eps_demo.cc
+lgf_demo_SOURCES = lgf_demo.cc
Index: doc/groups.dox
===================================================================
--- doc/groups.dox	(revision 606)
+++ doc/groups.dox	(revision 611)
@@ -672,6 +672,6 @@
 the \c demo subdirectory of the source tree.
 
-It order to compile them, use <tt>--enable-demo</tt> configure option when
-build the library.
+In order to compile them, use the <tt>make demo</tt> or the
+<tt>make check</tt> commands.
 */
 
Index: scripts/mk-release.sh
===================================================================
--- scripts/mk-release.sh	(revision 536)
+++ scripts/mk-release.sh	(revision 611)
@@ -15,5 +15,5 @@
 
 autoreconf -vif
-./configure --enable-demo
+./configure
 
 make
Index: test/Makefile.am
===================================================================
--- test/Makefile.am	(revision 590)
+++ test/Makefile.am	(revision 611)
@@ -37,4 +37,6 @@
 	test/time_measure_test \
 	test/unionfind_test
+
+test_test_tools_pass_DEPENDENCIES = demo
 
 if HAVE_LP
