[flac-dev] [PATCH 3/5] configure.ac: Don't build any tests when they are explicitely disabled

Hugo Beauzée-Luyssen hugo at beauzee.fr
Fri Jan 6 12:53:37 UTC 2017


---
 configure.ac                   |  1 +
 src/Makefile.am                | 10 +++++++---
 src/test_libFLAC++/Makefile.am |  5 +++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index bdeba93a..9c852157 100644
--- a/configure.ac
+++ b/configure.ac
@@ -270,6 +270,7 @@ else
 FLAC__TEST_LEVEL=2
 fi
 AC_SUBST(FLAC__TEST_LEVEL)
+AM_CONDITIONAL(FLaC__HAS_TESTS, [test FLAC__TEST_LEVEL -gt 0])
 
 AC_ARG_ENABLE(werror,
 	AC_HELP_STRING([--enable-werror], [Enable -Werror in all Makefiles]))
diff --git a/src/Makefile.am b/src/Makefile.am
index 01417362..0e2ed05a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,13 +30,17 @@ SUBDIRS = \
 	flac \
 	metaflac \
 	$(XMMS_DIRS) \
+	utils \
+	$(CPPLIBS_DIRS)
+
+if FLaC__HAS_TESTS
+SUBDIRS += \
 	test_grabbag \
 	test_libs_common \
 	test_libFLAC \
 	test_seeking \
-	test_streams \
-	utils \
-	$(CPPLIBS_DIRS)
+	test_streams
+endif
 
 EXTRA_DIST = \
 	Makefile.lite
diff --git a/src/test_libFLAC++/Makefile.am b/src/test_libFLAC++/Makefile.am
index fec7e81a..2d9b0016 100644
--- a/src/test_libFLAC++/Makefile.am
+++ b/src/test_libFLAC++/Makefile.am
@@ -23,6 +23,9 @@ EXTRA_DIST = \
 	test_libFLAC++.vcxproj.filters
 
 AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include
+
+if FLaC__HAS_TESTS
+
 noinst_PROGRAMS = test_libFLAC++
 test_libFLAC___LDADD = \
 	$(top_builddir)/src/share/grabbag/libgrabbag.la \
@@ -44,4 +47,6 @@ test_libFLAC___SOURCES = \
 	encoders.h \
 	metadata.h
 
+endif
+
 CLEANFILES = test_libFLAC++.exe
-- 
2.11.0



More information about the flac-dev mailing list