source: trunk/configure.ac @ 421

Last change on this file since 421 was 421, checked in by sam, 10 years ago

Define _DEBUG when configure is called with --enable-debug.

File size: 3.2 KB
Line 
1# $Id$
2
3AC_INIT(lolengine, 0.0)
4AC_PREREQ(2.50)
5AC_CONFIG_AUX_DIR(.auto)
6AC_CANONICAL_SYSTEM
7AM_INIT_AUTOMAKE([no-define tar-ustar])
8dnl AM_MAINTAINER_MODE
9
10AM_CONFIG_HEADER(config.h)
11
12AM_PROG_CC_C_O
13AC_PROG_CPP
14AC_PROG_CXX
15AC_PROG_CXXCPP
16AC_PROG_RANLIB
17
18AC_LIBTOOL_WIN32_DLL
19AM_PROG_LIBTOOL
20AC_LIBTOOL_CXX
21
22AC_C_CONST
23AC_C_INLINE
24
25dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
26dnl now otherwise it might be set in an obscure if statement. Same thing for
27dnl PKG_PROG_PKG_CONFIG which needs to be called first.
28AC_EGREP_CPP(yes, foo)
29PKG_PROG_PKG_CONFIG()
30m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
31if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
32  export PKG_CONFIG_LIBDIR=/dev/null
33fi
34
35dnl conditional builds
36AC_ARG_ENABLE(debug,
37  [  --enable-debug          build debug versions of the game (default no)])
38AC_ARG_ENABLE(release,
39  [  --enable-release        build final release of the game (default no)])
40
41AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
42
43if test "${enable_debug}" = "yes"; then
44  AC_DEFINE(_DEBUG, 1, Define to 1 to activate debug)
45fi
46
47# Optimizations
48CXXFLAGS="${CXXFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
49# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
50CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
51
52AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
53
54# Use SDL?
55ac_cv_my_have_sdl="yes"
56save_CPPFLAGS="${CPPFLAGS}"
57AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
58if test "${SDL_CONFIG}" != "no"; then
59  CPPFLAGS="${CPPFLAGS} `sdl-config --cflags`"
60fi
61AC_CHECK_HEADERS(SDL_image.h,
62 [:],[ac_cv_my_have_sdl="no"])
63AC_CHECK_HEADERS(SDL_mixer.h,
64 [:],[ac_cv_my_have_sdl="no"])
65CPPFLAGS="${save_CPPFLAGS}"
66if test "${ac_cv_my_have_sdl}" != "no"; then
67  AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
68fi
69AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
70
71if test "${ac_cv_my_have_sdl}" = "no"; then
72  AC_MSG_ERROR([[One of SDL, SDL_Image or SDL_Mixer not found]])
73fi
74
75
76# Use libcaca? (required for font generation)
77ac_cv_my_have_caca="no"
78PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
79if test "${ac_cv_my_have_caca}" != "no"; then
80  AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
81fi
82AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
83
84
85# Use libpipi? (required for video recording)
86ac_cv_my_have_pipi="no"
87PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
88if test "${ac_cv_my_have_pipi}" != "no"; then
89  AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
90fi
91AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
92
93
94# How to use the Lol Engine inside this tree
95LOL_CFLAGS="-I \$(top_srcdir)/src `pkg-config --cflags sdl gl SDL_image`"
96LOL_LIBS="`pkg-config --libs sdl gl SDL_image` -lSDL_mixer"
97
98if test "${enable_release}" = "yes"; then
99  AC_DEFINE(FINAL_RELEASE, 1, Define to 1 to activate final release)
100fi
101
102AC_SUBST(MATH_LIBS)
103AC_SUBST(LOL_CFLAGS)
104AC_SUBST(LOL_LIBS)
105
106AC_CONFIG_FILES([
107  Makefile
108  src/Makefile
109  monsterz/Makefile
110  deushax/Makefile
111  tools/Makefile
112  art/Makefile
113  art/test/Makefile
114  gfx/Makefile
115  gfx/font/Makefile
116  maps/Makefile
117])
118
119AC_OUTPUT
120
Note: See TracBrowser for help on using the repository browser.