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