Make building the demo app optional if SDL_image and/or libpng12 are not found.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 6 Feb 2013 00:09:27 +0000 (01:09 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 6 Feb 2013 00:09:27 +0000 (01:09 +0100)
Makefile.in
configure.ac

index f98bbfc..4656959 100644 (file)
@@ -6,6 +6,7 @@ includedir = @includedir@
 libdir = @libdir@
 datarootdir = @datarootdir@
 datadir = @datadir@
+with_demo_app = @with_demo_app@
 
 CC=@CC@
 CXX=@CXX@
@@ -62,7 +63,11 @@ TESTS=effect_chain_test $(TESTED_INPUTS:=_test) $(TESTED_EFFECTS:=_test)
 LIB_OBJS=effect_util.o util.o widgets.o effect.o effect_chain.o init.o $(INPUTS:=.o) $(EFFECTS:=.o)
 
 # Default target:
-all: $(TESTS) demo
+all: libmovit.a $(TESTS)
+
+ifeq ($(with_demo_app),yes)
+all: demo
+endif
 
 # Google Test and other test library functions.
 TEST_OBJS = gtest-all.o gtest_sdl_main.o test_util.o
index f044a17..d21b85a 100644 (file)
@@ -7,10 +7,15 @@ AC_PROG_CXX
 PKG_CHECK_MODULES([Eigen3], [eigen3])
 PKG_CHECK_MODULES([GLEW], [glew])
 
-# These are only needed for the demo app.
+# Needed for unit tests and the demo app.
 PKG_CHECK_MODULES([SDL], [sdl])
-PKG_CHECK_MODULES([SDL_image], [SDL_image])
-PKG_CHECK_MODULES([libpng], [libpng12])
+
+# These are only needed for the demo app.
+with_demo_app=yes
+PKG_CHECK_MODULES([SDL_image], [SDL_image], [], [with_demo_app=no; AC_MSG_WARN([SDL_image not found, demo program will not be built])])
+PKG_CHECK_MODULES([libpng], [libpng12], [], [with_demo_app=no; AC_MSG_WARN([libpng12 not found, demo program will not be built])])
+
+AC_SUBST([with_demo_app])
 
 AC_CONFIG_FILES([Makefile movit.pc])
 AC_OUTPUT