source: trunk/configure.ac @ 943

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

ios: fix iOS build by adding missing files to XCode project.

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