source: trunk/configure.ac @ 2386

Last change on this file since 2386 was 2386, checked in by sam, 7 years ago

build: split the main library into lolcore and lolbullet.

File size: 12.0 KB
RevLine 
[700]1dnl configure script for Lol Engine
[92]2
[221]3AC_INIT(lolengine, 0.0)
[92]4AC_PREREQ(2.50)
5AC_CONFIG_AUX_DIR(.auto)
6AC_CANONICAL_SYSTEM
[1388]7AM_INIT_AUTOMAKE([subdir-objects no-define tar-ustar silent-rules])
[92]8dnl AM_MAINTAINER_MODE
[1939]9AM_DEFAULT_VERBOSITY=0
[92]10
[938]11dnl Versioning of the separate software we ship
12LOLUNIT_VERSION=0.1
13AC_SUBST(LOLUNIT_VERSION)
[1129]14LOLREMEZ_VERSION=0.2
[1119]15AC_SUBST(LOLREMEZ_VERSION)
[938]16
[2285]17AC_CONFIG_HEADER(config.h)
[92]18
19AM_PROG_CC_C_O
20AC_PROG_CPP
21AC_PROG_CXX
22AC_PROG_CXXCPP
23AC_PROG_RANLIB
24
25AC_LIBTOOL_WIN32_DLL
26AM_PROG_LIBTOOL
27AC_LIBTOOL_CXX
28
29AC_C_CONST
30AC_C_INLINE
31
[623]32dnl Ensure an error is thrown if pkg-config M4 files are not found.
33m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
34m4_pattern_forbid([^PKG_CHECK_MODULES$])
35m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])
36
[1984]37dnl  Same for Lol Engine M4 files.
38m4_pattern_forbid([^LOL_])
39
40
[623]41dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling.
42if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
43  export PKG_CONFIG_LIBDIR=/dev/null
44fi
45
[92]46dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
47dnl now otherwise it might be set in an obscure if statement. Same thing for
48dnl PKG_PROG_PKG_CONFIG which needs to be called first.
49AC_EGREP_CPP(yes, foo)
50PKG_PROG_PKG_CONFIG()
51
[2036]52
53dnl  Check for a working implementation of sed
54AC_PROG_SED
55AC_MSG_CHECKING(for a sed that understands \t)
56if test "$(echo 'x\x' | "${SED}" 's/.*@<:@^x\t@:>@//')" != x; then
57  AC_MSG_RESULT(no)
58  AC_MSG_ERROR([[consider installing GNU sed]])
59else
60  AC_MSG_RESULT(yes)
61fi
62
63
[1036]64AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
[92]65dnl conditional builds
66AC_ARG_ENABLE(debug,
[97]67  [  --enable-debug          build debug versions of the game (default no)])
68AC_ARG_ENABLE(release,
69  [  --enable-release        build final release of the game (default no)])
[658]70AC_ARG_ENABLE(experimental,
71  [  --enable-experimental   experimental build (default no)])
[2167]72AC_ARG_ENABLE(doc,
73  [  --enable-doc            build documentation (needs doxygen and LaTeX)])
[92]74
[1505]75AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
[2262]76AC_CHECK_HEADERS(fastmath.h pthread.h libutil.h util.h pty.h glob.h unistd.h)
[1505]77AC_CHECK_HEADERS(sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h)
78AC_CHECK_HEADERS(sys/wait.h)
79AC_CHECK_HEADERS(linux/kdev_t.h linux/major.h)
80AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h)
[1642]81AC_CHECK_HEADERS(pam/pam_appl.h pam/pam_misc.h)
[92]82
[2263]83AC_CHECK_FUNCS(getcwd _getcwd)
84
[421]85if test "${enable_debug}" = "yes"; then
[658]86  AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
[693]87  OPT="-O"
[644]88else
[884]89  OPT="-O3 -ffast-math -fno-strength-reduce -fomit-frame-pointer"
[421]90fi
91
[644]92if test "${enable_release}" = "yes"; then
[658]93  AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release)
[644]94  REL=""
95else
96  REL="-g"
97fi
98
[658]99if test "${enable_experimental}" = "yes"; then
100  AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build)
101fi
102
[2167]103# Build documentation?
104DOXYGEN="no"
105LATEX="no"
106if test "${enable_doc}" != "no"; then
107  AC_PATH_PROG(DOXYGEN, doxygen, no)
108  if test "${DOXYGEN}" != "no"; then
109    # Build LaTeX documentation?
110    AC_PATH_PROG(LATEX, pdflatex, no)
111    AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
112    AC_PATH_PROG(DVIPS, dvips, no)
113    if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
114      LATEX="no"
115    fi
116    if test "${LATEX}" != "no"; then
117      AC_MSG_CHECKING(for a4.sty and a4wide.sty)
118      if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
119        if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
120          AC_MSG_RESULT(yes)
121        else
122          LATEX="no"
123          AC_MSG_RESULT(no)
124        fi
125      else
126        LATEX="no"
127        AC_MSG_RESULT(no)
128      fi
129    fi
[2174]130    AC_PATH_PROG(DOT, dot, no)
131    if test "${DOT}" != "no"; then
132      USE_DOT="YES"
133    else
134      USE_DOT="NO"
135    fi
[2167]136  fi
137fi
138AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
139AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
[2174]140AM_CONDITIONAL(USE_DOT, test "${DOT}" != "no")
[2167]141
[840]142dnl No exceptions
[935]143CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-rtti"
[700]144dnl Optimizations
[693]145CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}"
[700]146dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
[92]147CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
148
149AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
[1093]150AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
[92]151
[2090]152AC_CHECK_LIB(util, forkpty,
153 [UTIL_LIBS="${UTIL_LIBS} -lutil"
154  dnl  Override future forkpty detection
155  ac_cv_func_forkpty="yes"])
156AC_CHECK_FUNCS(forkpty)
157
[840]158dnl Are we on the PS3?
[1563]159ac_cv_my_have_ps3="no"
[840]160AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
[1563]161 [ac_cv_my_have_ps3="yes"
162  LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
[840]163  dnl  For PSGL
164  AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
165  GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
[1959]166  dnl  This is the old way; we now use CELL_SDK instead of CELLSDK
167  if test "x${CELLSDK}" != x -a "x${CELL_SDK}" = x; then
[1533]168    CELL_SDK="${CELLSDK}"
169  fi
[840]170  if test "x${enable_debug}" = xyes; then
[1533]171    GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
[840]172  elif test "x${enable_release}" = xyes; then
[1533]173    GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
[840]174  else
[1533]175    GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
[840]176  fi
177  dnl  For the runtime Cg compiler
178  GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
179  dnl  For the PNG decoder
180  LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
181  dnl  For the pad library
182  LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
[1288]183  dnl  Disable this warning, it's too verbose with vector.h
184  CXXFLAGS="${CXXFLAGS} -Wno-sign-compare"
[1981]185  AC_PATH_PROG(MAKE_FSELF, make_fself, no)
186  if test "${MAKE_FSELF}" = "no"; then
187    AC_MSG_ERROR([[Building for PS3 but make_fself not found]])
188  fi],
[844]189 [MAKE_FSELF=no])
[1563]190AM_CONDITIONAL(USE_PS3, test "${ac_cv_my_have_ps3}" != "no")
[840]191
192
[1647]193dnl  Are we building using MinGW?
194LIBS_save="$LIBS"
[1653]195LIBS="$LIBS -mwindows -mwin32"
196AC_MSG_CHECKING(for -mwindows -mwin32)
[1647]197AC_TRY_LINK([], [],
198 [AC_MSG_RESULT(yes)
[1653]199  CXXFLAGS="${CXXFLAGS} -mwindows -mwin32"
[2276]200  LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"],
[1647]201 [AC_MSG_RESULT(no)])
202LIBS="$LIBS_save"
203
204
[1563]205dnl  Are we on the Xbox 360?
206dnl  Answer: NO! we don't know how to build for it anyway
207AM_CONDITIONAL(USE_X360, false)
208
209
[1212]210dnl Are we on a Direct3D 9 platform?
[1485]211#ac_cv_my_have_d3d9="no"
212#AC_CHECK_HEADERS(d3d9.h, [ac_cv_my_have_d3d9="yes"])
213#if test "${ac_cv_my_have_d3d9}" != "no"; then
214#  D3D_LIBS="${D3D_LIBS} -ld3d9 -ld3dx9 -lxinput"
215#  AC_DEFINE(USE_D3D9, 1, Define to 1 to use DirectX 9)
216#fi
217#AM_CONDITIONAL(USE_D3D9, test "${ac_cv_my_have_d3d9}" != "no")
[1212]218
[1984]219LOL_CHECK_OPENGL
[1212]220
[2300]221LOL_CHECK_SDL
[1670]222
[1436]223dnl  Use Flex's FlexLexer.h or ours?
224ac_cv_my_have_flexlexer_h="no"
225AC_LANG_PUSH(C++)
[2036]226AC_CHECK_HEADERS(FlexLexer.h,
227 dnl  Ensure that FlexLexer::yleng is of type int, and not size_t like
228 dnl  on recent Apple systems. It would break all our existing code.
229 [AC_MSG_CHECKING(for FlexLexer.h validity)
230  AC_COMPILE_IFELSE(
231   [AC_LANG_PROGRAM([#include <FlexLexer.h>
232      class Foo : public FlexLexer
233      {
234          Foo() { int &test = yyleng; }
235      }],
236     [])],
237   [AC_MSG_RESULT(yes)
238    ac_cv_my_have_flexlexer_h="yes"],
239   [AC_MSG_RESULT(no)])])
[1436]240AC_LANG_POP(C++)
241if test "x${ac_cv_my_have_flexlexer_h}" = "xno"; then
[1995]242  LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/external/flex-2.5.35/include"
[1436]243fi
244
245
[1084]246dnl  Use NativeClient?
247ac_cv_my_have_nacl="no"
248AC_LANG_PUSH(C++)
[1438]249AC_CHECK_HEADERS(ppapi/cpp/instance.h,
250 [ac_cv_my_have_nacl="yes"
251  dnl  Disable this warning, it's too verbose with vector.h
252  CXXFLAGS="${CXXFLAGS} -Wno-sign-compare"])
[1084]253AC_LANG_POP(C++)
254AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no")
255
[1438]256
[1684]257dnl  Use Android? FIXME: super hacks!
258ac_cv_my_have_android="no"
259AC_CHECK_LIB(log, __android_log_vprint,
260 [ac_cv_my_have_android="yes"
261  LOL_LIBS="${LOL_LIBS} -llog -module"])
262AM_CONDITIONAL(USE_ANDROID, test "${ac_cv_my_have_android}" != "no")
263
264
[1677]265dnl  Use EGL?
[682]266ac_cv_my_have_egl="no"
267PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
268if test "${ac_cv_my_have_egl}" != "no"; then
269  AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
270  EGL_LIBS="${EGL_LIBS} -lX11"
271fi
[1677]272AC_CHECK_LIB(EGL, main,
[1670]273 [ac_cv_my_have_egl="yes"
274  AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
[1677]275  EGL_LIBS="-lEGL"])
276dnl  Raspberry Pi is different, check for it with extra libs; also we
277dnl  look for a different function to bypass autoconf caching
278AC_CHECK_LIB(EGL, eglGetDisplay,
279 [ac_cv_my_have_egl="yes"
280  AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
281  EGL_LIBS="-lEGL -lvcos -lvchiq_arm -lbcm_host -lGLESv2"],
282 [:],
283 [-lvcos -lvchiq_arm -lbcm_host -lGLESv2])
[682]284AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
285
286
[711]287dnl Use libpng? (replacement for SDL_image)
288ac_cv_my_have_libpng="no"
289PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
290if test "${ac_cv_my_have_libpng}" != "no"; then
291  AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
292fi
293AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
294
295
[981]296dnl Use Windows GDI+?
297ac_cv_my_have_gdiplus="no"
298AC_LANG_PUSH(C++)
[1156]299AC_CHECK_HEADERS(gdiplus.h,
[981]300 [ac_cv_my_have_gdiplus="yes"
301  LOL_LIBS="${LOL_LIBS} -lgdiplus"],
302 [ac_cv_my_have_gdiplus="no"],
303 [#include <algorithm>
304  using std::min;
305  using std::max;
306  #include <windows.h>])
307AC_LANG_POP(C++)
308if test "${ac_cv_my_have_gdiplus}" != "no"; then
309  AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
310fi
311AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
312
313
[623]314dnl Use libcaca? (required for font generation)
[178]315ac_cv_my_have_caca="no"
316PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
317if test "${ac_cv_my_have_caca}" != "no"; then
318  AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
[92]319fi
[178]320AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
[92]321
[178]322
[623]323dnl Use libpipi? (required for video recording)
[178]324ac_cv_my_have_pipi="no"
325PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
326if test "${ac_cv_my_have_pipi}" != "no"; then
327  AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
[2085]328  LOL_CFLAGS="${LOL_CFLAGS} ${PIPI_CFLAGS}"
329  LOL_LIBS="${LOL_LIBS} ${PIPI_LIBS}"
[178]330fi
331AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
332
333
[623]334dnl Use GTK+? (required for the deushax editor)
[628]335ac_cv_my_have_gtkgl="no"
336PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
337PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
338if test "${ac_cv_my_have_gtkgl}" != "no"; then
339  AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
340fi
341AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
[623]342
[642]343
[1643]344dnl  Can we build neercs?
[2090]345AM_CONDITIONAL(BUILD_NEERCS, test "${ac_cv_my_have_caca}" != "no")
[1643]346
347
[2237]348dnl  Extra libraries we may need
[1505]349AC_SUBST(MATH_LIBS)
350AC_SUBST(PAM_LIBS)
351AC_SUBST(UTIL_LIBS)
352
[2237]353dnl  How to use the Lol Engine inside this tree
354LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/src"
355LOL_CFLAGS="$LOL_CFLAGS -DLOL_SOURCE_SUBDIR=\\\"\$(subdir)\\\""
[848]356LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
[1212]357LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS"
[2386]358LOL_STATIC_LIBS="\$(top_builddir)/src/liblolcore.a $LOL_STATIC_LIBS"
359LOL_STATIC_LIBS="\$(top_builddir)/src/bullet/liblolbullet.a $LOL_STATIC_LIBS"
[220]360
[2237]361dnl  Extra flags
[220]362AC_SUBST(LOL_CFLAGS)
363AC_SUBST(LOL_LIBS)
[2386]364AC_SUBST(LOL_STATIC_LIBS)
[92]365
[2174]366AC_SUBST(USE_DOT)
[1505]367
[793]368AC_CONFIG_FILES(
369 [Makefile
[92]370  src/Makefile
[2386]371  src/bullet/Makefile
[1524]372  src/data/Makefile
373  src/data/font/Makefile
[1518]374  tutorial/Makefile
[642]375  test/Makefile
[984]376  test/math/Makefile
[1112]377  test/sandbox/Makefile
[1043]378  test/xolotl/Makefile
[1520]379  build/Makefile
380  binaries/Makefile
[1744]381  people/Makefile
[1524]382  games/Makefile
383  tools/Makefile
[2071]384  tools/vimlol/Makefile
[1938]385  tools/vslol/Makefile
[2167]386  doc/Makefile
387  doc/doxygen.cfg
[92]388])
[793]389AC_CONFIG_FILES(
[1524]390 [games/monsterz/Makefile
[785]391])
[793]392AC_CONFIG_FILES(
[1524]393 [games/deushax/Makefile
394  games/deushax/art/Makefile
395  games/deushax/art/test/Makefile
396  games/deushax/gfx/Makefile
397  games/deushax/maps/Makefile
[785]398])
[1168]399AC_CONFIG_FILES(
[1524]400 [games/mrpigeon/Makefile
[1168]401])
[1235]402AC_CONFIG_FILES(
[1524]403 [games/orbital/Makefile
[1235]404])
[1449]405AC_CONFIG_FILES(
[1744]406 [tools/neercs/Makefile
[1713]407])
408AC_CONFIG_FILES(
[1744]409 [people/jnat/Makefile
[1980]410  people/jnat/TestProject/Makefile
[1778]411  people/peeweek/Makefile
[2343]412  people/peeweek/private/Makefile
[1744]413  people/touky/Makefile
[2343]414  people/touky/private/Makefile
[2163]415  people/jylam/Makefile
[2343]416  people/jylam/private/Makefile
417  people/jylam/private/chat/Makefile
[1529]418])
[92]419
420AC_OUTPUT
421
Note: See TracBrowser for help on using the repository browser.