source: trunk/configure.ac @ 912

Last change on this file since 912 was 912, checked in by sam, 8 years ago

test: replace CppUnit with our LolUnit test suite.

CppUnit is really too large for our needs, would require to be precompiled
for many platforms, in all combinations of debug and release modes, with
additional variants for libstdc++ versions. We replace it with our own
lightweight implementation, LolUnit. Good riddance.

File size: 8.2 KB
Line 
1dnl configure script for Lol Engine
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 Ensure an error is thrown if pkg-config M4 files are not found.
26m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
27m4_pattern_forbid([^PKG_CHECK_MODULES$])
28m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])
29
30dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling.
31if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
32  export PKG_CONFIG_LIBDIR=/dev/null
33fi
34
35dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
36dnl now otherwise it might be set in an obscure if statement. Same thing for
37dnl PKG_PROG_PKG_CONFIG which needs to be called first.
38AC_EGREP_CPP(yes, foo)
39PKG_PROG_PKG_CONFIG()
40
41dnl conditional builds
42AC_ARG_ENABLE(debug,
43  [  --enable-debug          build debug versions of the game (default no)])
44AC_ARG_ENABLE(release,
45  [  --enable-release        build final release of the game (default no)])
46AC_ARG_ENABLE(experimental,
47  [  --enable-experimental   experimental build (default no)])
48
49AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h fastmath.h)
50
51if test "${enable_debug}" = "yes"; then
52  AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
53  OPT="-O"
54else
55  OPT="-O3 -ffast-math -fno-strength-reduce -fomit-frame-pointer"
56fi
57
58if test "${enable_release}" = "yes"; then
59  AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release)
60  REL=""
61else
62  REL="-g"
63fi
64
65if test "${enable_experimental}" = "yes"; then
66  AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build)
67fi
68
69dnl No exceptions
70CXXFLAGS="${CXXFLAGS} -fno-exceptions"
71dnl Optimizations
72CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}"
73dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
74CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
75
76AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
77
78
79dnl Are we on the PS3?
80AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
81 [LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
82  dnl  For PSGL
83  AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
84  GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
85  if test "x${enable_debug}" = xyes; then
86    GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
87  elif test "x${enable_release}" = xyes; then
88    GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
89  else
90    GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
91  fi
92  dnl  For the runtime Cg compiler
93  GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
94  dnl  For the PNG decoder
95  LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
96  dnl  For the pad library
97  LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
98  AC_PATH_PROG(MAKE_FSELF, make_fself, no)],
99 [MAKE_FSELF=no])
100AM_CONDITIONAL(USE_MAKE_FSELF, test "${MAKE_FSELF}" != "no")
101
102
103dnl Which version of OpenGL to use?
104ac_cv_my_have_gl="no"
105PKG_CHECK_MODULES(GLES2, glesv2,
106 [ac_cv_my_have_gl="yes"
107  AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
108  GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
109  GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
110 [:])
111AC_CHECK_LIB(GL, glLoadIdentity,
112 [ac_cv_my_have_gl="yes"
113  AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
114  GL_LIBS="-lGL"])
115AC_CHECK_HEADER(GL/gl.h,
116 [LIBS_save="$LIBS"
117  LIBS="$LIBS -lopengl32"
118  AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
119  AC_TRY_LINK([#include <GL/gl.h>],
120   [glLoadIdentity();],
121   [ac_cv_my_have_gl="yes"
122    AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
123    AC_MSG_RESULT(yes)
124    GL_LIBS="-lopengl32"],
125   [AC_MSG_RESULT(no)])
126  LIBS="$LIBS_save"])
127AC_CHECK_HEADER(PSGL/psgl.h,
128 [ac_cv_my_have_gl="yes"])
129if test "${ac_cv_my_have_gl}" = "no"; then
130  AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
131fi
132
133dnl Use Glew?
134ac_cv_my_have_glew="no"
135PKG_CHECK_MODULES(GLEW, glew,
136 [ac_cv_my_have_glew="yes"
137  GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
138  GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
139 [:])
140AC_CHECK_HEADER(GL/glew.h,
141 [LIBS_save="${LIBS}"
142  LIBS="${LIBS} -lglew32 ${GL_LIBS}"
143  AC_MSG_CHECKING(for glewInit in -lglew32)
144  AC_TRY_LINK(
145   [#include <GL/glew.h>],
146   [glewInit();],
147   [ac_cv_my_have_glew="yes"
148    GL_LIBS="-lglew32 ${GL_LIBS}"
149    AC_MSG_RESULT(yes)],
150   [AC_MSG_RESULT(no)])
151  LIBS="${LIBS_save}"])
152if test "${ac_cv_my_have_glew}" != "no"; then
153  AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
154  AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
155fi
156AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
157
158dnl Poor man's GL feature detection if all else failed.
159save_LIBS="${LIBS}"
160LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
161AC_CHECK_FUNCS(glBegin)
162LIBS="${save_LIBS}"
163
164dnl Use SDL? (always required on Linux or Win32)
165ac_cv_my_have_sdl="no"
166if test "x$cross_compiling" != xyes; then
167  ac_cv_my_have_sdl="yes"
168  AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
169  if test "${SDL_CONFIG}" != "no" -a "x$cross_compiling" != xyes; then
170    SDL_CFLAGS="${SDL_CFLAGS} `sdl-config --cflags`"
171    SDL_LIBS="${SDL_LIBS} `sdl-config --libs`"
172  fi
173  PKG_CHECK_MODULES(SDL, sdl, [:],
174   [SDL_LIBS="${SDL_LIBS} -lSDL"])
175  PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [:],
176   [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"])
177  PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [:],
178   [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"])
179  SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
180  SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
181  save_CPPFLAGS="${CPPFLAGS}"
182  CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
183  AC_CHECK_HEADERS(SDL_mixer.h, [:], [ac_cv_my_have_sdl="no"])
184  AC_CHECK_HEADERS(SDL_image.h, [:], [ac_cv_my_have_sdl="no"])
185  CPPFLAGS="${save_CPPFLAGS}"
186  if test "${ac_cv_my_have_sdl}" = "no"; then
187    AC_MSG_WARN([[One of SDL, SDL_Image or SDL_Mixer not found]])
188  else
189    AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
190  fi
191fi
192AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
193
194
195dnl Use EGL?
196ac_cv_my_have_egl="no"
197PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
198if test "${ac_cv_my_have_egl}" != "no"; then
199  AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
200  EGL_LIBS="${EGL_LIBS} -lX11"
201fi
202AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
203
204
205dnl Use libpng? (replacement for SDL_image)
206ac_cv_my_have_libpng="no"
207PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
208if test "${ac_cv_my_have_libpng}" != "no"; then
209  AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
210fi
211AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
212
213
214dnl Use libcaca? (required for font generation)
215ac_cv_my_have_caca="no"
216PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
217if test "${ac_cv_my_have_caca}" != "no"; then
218  AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
219fi
220AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
221
222
223dnl Use libpipi? (required for video recording)
224ac_cv_my_have_pipi="no"
225PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
226if test "${ac_cv_my_have_pipi}" != "no"; then
227  AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
228fi
229AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
230
231
232dnl Use GTK+? (required for the deushax editor)
233ac_cv_my_have_gtkgl="no"
234PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
235PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
236if test "${ac_cv_my_have_gtkgl}" != "no"; then
237  AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
238fi
239AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
240
241
242dnl How to use the Lol Engine inside this tree
243LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
244LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
245LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS"
246
247AC_SUBST(MATH_LIBS)
248AC_SUBST(LOL_CFLAGS)
249AC_SUBST(LOL_LIBS)
250
251AC_CONFIG_FILES(
252 [Makefile
253  src/Makefile
254  test/Makefile
255  gfx/Makefile
256  gfx/font/Makefile
257  tools/Makefile
258])
259AC_CONFIG_FILES(
260 [monsterz/Makefile
261])
262AC_CONFIG_FILES(
263 [deushax/Makefile
264  deushax/art/Makefile
265  deushax/art/test/Makefile
266  deushax/gfx/Makefile
267  deushax/maps/Makefile
268])
269
270AC_OUTPUT
271
Note: See TracBrowser for help on using the repository browser.