From 9ff7e35c1df6e44031b38853c52a749a9c1fa0f3 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 8 Oct 2007 10:03:17 +0000
Subject: [PATCH] =?UTF-8?q?Fix=20=E2=80=9Cmake=20distcheck=E2=80=9D.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- Move symlink to β€œganeti” to top dir
- Add ganeti.config_unittest.py to tests to be run
- Make sure everything is built before tests are run

Reviewed-by: iustinp
---
 Makefile.am      |  9 +++++++--
 configure.ac     |  3 ++-
 lib/Makefile.am  |  5 +++++
 test/Makefile.am | 16 +++++++++-------
 4 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index fffd09b47..e2a034566 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,13 @@
-# standard automake rules
 SUBDIRS = man lib scripts daemons doc test tools qa
-
 EXTRA_DIST = NEWS
 
+.PHONY: ganeti
+ganeti:
+	cd $(top_builddir) && rm -f $@ && $(LN_S) lib $@
+
+pre-check: ganeti
+	$(MAKE) -C lib $@
+
 # custom rules
 depgraph: depgraph.png
 
diff --git a/configure.ac b/configure.ac
index d233f1224..1ed111059 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
 # Configure script for Ganeti
-
 AC_PREREQ(2.59)
 AC_INIT(ganeti, 1.2b2, ganeti@googlegroups.com)
 AC_CONFIG_AUX_DIR(autotools)
+AC_CONFIG_SRCDIR(configure)
 AM_INIT_AUTOMAKE([foreign tar-ustar])
 
 # --with-ssh-initscript=...
@@ -35,6 +35,7 @@ AC_SUBST(OS_SEARCH_PATH, $os_search_path)
 
 # Check common programs
 AC_PROG_INSTALL
+AC_PROG_LN_S
 
 # Check for Python
 AM_PATH_PYTHON(2.4)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 3bcc2f966..1e353563d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -19,3 +19,8 @@ _autoconf.py: Makefile
 	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
 	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
 	} > $@
+
+pre-check: all
+	for i in $(pkgpython_PYTHON); do \
+		if test ! -f $$i; then $(LN_S) $(srcdir)/$$i $$i; fi; \
+	done
diff --git a/test/Makefile.am b/test/Makefile.am
index 43f0b4de9..83c7b9b00 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,11 +1,13 @@
-TESTS = ganeti.hooks_unittest.py ganeti.utils_unittest.py
-TESTS_ENVIRONMENT = PYTHONPATH=.:$(srcdir)
+TESTS = \
+  ganeti.config_unittest.py \
+  ganeti.hooks_unittest.py \
+  ganeti.utils_unittest.py
+TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir)
 
-check_DATA = ganeti
-ganeti:
-	rm -f ganeti
-	ln -s $(top_srcdir)/lib ganeti
+check-am: do-pre-check
+
+do-pre-check:
+	$(MAKE) -C $(top_builddir) pre-check
 
 EXTRA_DIST = $(TESTS) mocks.py
 CLEANFILES = *.py[co]
-MAINTAINERCLEANFILES = ganeti
-- 
GitLab