From 3e266b5dce00fada031d9fdfff1ed19ae5a1de72 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 28 Aug 2010 17:19:14 +0000 Subject: [PATCH] Proper detection of libcaca and libpipi. --- configure.ac | 19 +++++++++++++++++-- gfx/font/Makefile.am | 2 ++ src/Makefile.am | 4 ++-- src/debugrecord.cpp | 10 +++++----- tools/Makefile.am | 10 +++++++--- 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index a0c71108..2adb1128 100644 --- a/configure.ac +++ b/configure.ac @@ -67,9 +67,24 @@ if test "${ac_cv_my_have_sdl}" = "no" -a "${ac_cv_my_have_imlib2}" = "no"; then AC_MSG_ERROR([[cannot find SDL_Image or GTK+, please install one of them]]) fi -if test "${enable_debug}" = "yes"; then - AC_DEFINE(DEBUG, 1, Define to 1 to activate debug) + +# Use libcaca? (required for font generation) +ac_cv_my_have_caca="no" +PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:]) +if test "${ac_cv_my_have_caca}" != "no"; then + AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca) fi +AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no") + + +# Use libpipi? (required for video recording) +ac_cv_my_have_pipi="no" +PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:]) +if test "${ac_cv_my_have_pipi}" != "no"; then + AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi) +fi +AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no") + if test "${enable_release}" = "yes"; then AC_DEFINE(FINAL_RELEASE, 1, Define to 1 to activate final release) diff --git a/gfx/font/Makefile.am b/gfx/font/Makefile.am index 4268c3f2..f3acd639 100644 --- a/gfx/font/Makefile.am +++ b/gfx/font/Makefile.am @@ -1,4 +1,5 @@ +if USE_CACA all: ascii.png ascii.png: @@ -6,4 +7,5 @@ ascii.png: clean: rm -f ascii.png +endif diff --git a/src/Makefile.am b/src/Makefile.am index 8adc2fa5..8cfdc9d0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,9 +14,9 @@ libcommon_a_SOURCES = \ libcommon_a_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` test_map_SOURCES = test-map.cpp sdlinput.cpp sdlinput.h -test_map_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` +test_map_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` @PIPI_CFLAGS@ test_map_LDADD = libcommon.a -test_map_LDFLAGS = `pkg-config --libs sdl gl SDL_image` -lpipi +test_map_LDFLAGS = `pkg-config --libs sdl gl SDL_image` @PIPI_LIBS@ editor_SOURCES = gtk/editor.cpp gtk/glmapview.cpp gtk/glmapview.h editor_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image gtk+-2.0 gtkgl-2.0` diff --git a/src/debugrecord.cpp b/src/debugrecord.cpp index abf31e5f..e60c7654 100644 --- a/src/debugrecord.cpp +++ b/src/debugrecord.cpp @@ -10,7 +10,7 @@ #include #include -#if defined HAVE_PIPI_H +#if defined USE_PIPI # include #endif @@ -28,7 +28,7 @@ class DebugRecordData private: char const *path; int width, height; -#if defined HAVE_PIPI_H +#if defined USE_PIPI pipi_sequence_t *sequence; #endif }; @@ -43,7 +43,7 @@ DebugRecord::DebugRecord(char const *path) data->path = strdup(path); data->width = 0; data->height = 0; -#if defined HAVE_PIPI_H +#if defined USE_PIPI data->sequence = NULL; #endif } @@ -70,7 +70,7 @@ void DebugRecord::TickDraw(float deltams) data->width = width; data->height = height; -#if defined HAVE_PIPI_H +#if defined USE_PIPI if (data->sequence) pipi_close_sequence(data->sequence); @@ -78,7 +78,7 @@ void DebugRecord::TickDraw(float deltams) #endif } -#if defined HAVE_PIPI_H +#if defined USE_PIPI if (data->sequence) { uint32_t *buffer = new uint32_t[width * height]; diff --git a/tools/Makefile.am b/tools/Makefile.am index 44711721..e4cec9fa 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,7 +1,11 @@ -noinst_PROGRAMS = make-font +noinst_PROGRAMS = $(make_font) make_font_SOURCES = make-font.cpp -make_font_CXXFLAGS = `pkg-config --cflags caca` -make_font_LDFLAGS = `pkg-config --libs caca` +make_font_CXXFLAGS = @CACA_CFLAGS@ +make_font_LDFLAGS = @CACA_LIBS@ + +if USE_CACA +make_font = make-font +endif