No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

200 líneas
5.8 KiB

  1. # $Id$
  2. AC_INIT(lolengine, 0.0)
  3. AC_PREREQ(2.50)
  4. AC_CONFIG_AUX_DIR(.auto)
  5. AC_CANONICAL_SYSTEM
  6. AM_INIT_AUTOMAKE([no-define tar-ustar])
  7. dnl AM_MAINTAINER_MODE
  8. AM_CONFIG_HEADER(config.h)
  9. AM_PROG_CC_C_O
  10. AC_PROG_CPP
  11. AC_PROG_CXX
  12. AC_PROG_CXXCPP
  13. AC_PROG_RANLIB
  14. AC_LIBTOOL_WIN32_DLL
  15. AM_PROG_LIBTOOL
  16. AC_LIBTOOL_CXX
  17. AC_C_CONST
  18. AC_C_INLINE
  19. dnl Ensure an error is thrown if pkg-config M4 files are not found.
  20. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  21. m4_pattern_forbid([^PKG_CHECK_MODULES$])
  22. m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])
  23. dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling.
  24. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  25. export PKG_CONFIG_LIBDIR=/dev/null
  26. fi
  27. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  28. dnl now otherwise it might be set in an obscure if statement. Same thing for
  29. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  30. AC_EGREP_CPP(yes, foo)
  31. PKG_PROG_PKG_CONFIG()
  32. dnl conditional builds
  33. AC_ARG_ENABLE(debug,
  34. [ --enable-debug build debug versions of the game (default no)])
  35. AC_ARG_ENABLE(release,
  36. [ --enable-release build final release of the game (default no)])
  37. AC_ARG_ENABLE(experimental,
  38. [ --enable-experimental experimental build (default no)])
  39. AC_ARG_ENABLE(cppunit,
  40. [ --enable-cppunit use cppunit for unit tests (autodetected)])
  41. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
  42. if test "${enable_debug}" = "yes"; then
  43. AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
  44. OPT="-O0"
  45. else
  46. OPT="-O2"
  47. fi
  48. if test "${enable_release}" = "yes"; then
  49. AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release)
  50. REL=""
  51. else
  52. REL="-g"
  53. fi
  54. if test "${enable_experimental}" = "yes"; then
  55. AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build)
  56. fi
  57. # Optimizations
  58. CXXFLAGS="${CXXFLAGS} ${REL} ${OPT} -fno-strength-reduce -fomit-frame-pointer"
  59. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  60. CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
  61. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  62. # Which version of OpenGL to use?
  63. ac_cv_my_have_gl="no"
  64. PKG_CHECK_MODULES(GLES1, glesv1_cm,
  65. [ac_cv_my_have_gl="yes"
  66. AC_DEFINE(HAVE_GLES_1X, 1, Define to 1 if GLES 1.x is available)
  67. GL_CFLAGS="${GLES1_CFLAGS}"
  68. GL_LIBS="${GLES1_LIBS}"],
  69. [:])
  70. PKG_CHECK_MODULES(GLES2, glesv2,
  71. [ac_cv_my_have_gl="yes"
  72. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  73. GL_CFLAGS="${GLES2_CFLAGS}"
  74. GL_LIBS="${GLES2_LIBS}"],
  75. [:])
  76. AC_CHECK_LIB(GL, glLoadIdentity,
  77. [ac_cv_my_have_gl="yes"
  78. AC_DEFINE(HAVE_GL_1X, 1, Define to 1 if GL 1.x is available)
  79. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)
  80. GL_LIBS="-lGL"]) # FIXME: hackish
  81. if test "${ac_cv_my_have_gl}" = "no"; then
  82. AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  83. fi
  84. # Use SDL? (always required)
  85. ac_cv_my_have_sdl="yes"
  86. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  87. if test "${SDL_CONFIG}" != "no"; then
  88. SDL_CFLAGS="${SDL_CFLAGS} `sdl-config --cflags`"
  89. SDL_LIBS="${SDL_LIBS} `sdl-config --libs`"
  90. fi
  91. SDL_CFLAGS="${SDL_CFLAGS} ${GL_CFLAGS}"
  92. SDL_LIBS="${SDL_LIBS} ${GL_LIBS}"
  93. PKG_CHECK_MODULES(SDL, sdl, [:],
  94. [SDL_LIBS="${SDL_LIBS} -lSDL"])
  95. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [:],
  96. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"])
  97. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [:],
  98. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"])
  99. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  100. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  101. save_CPPFLAGS="${CPPFLAGS}"
  102. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
  103. AC_CHECK_HEADERS(SDL_mixer.h, [:], [ac_cv_my_have_sdl="no"])
  104. AC_CHECK_HEADERS(SDL_image.h, [:], [ac_cv_my_have_sdl="no"])
  105. CPPFLAGS="${save_CPPFLAGS}"
  106. if test "${ac_cv_my_have_sdl}" = "no"; then
  107. AC_MSG_ERROR([[One of SDL, SDL_Image or SDL_Mixer not found]])
  108. else
  109. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  110. fi
  111. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  112. dnl Use EGL?
  113. ac_cv_my_have_egl="no"
  114. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  115. if test "${ac_cv_my_have_egl}" != "no"; then
  116. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  117. EGL_LIBS="${EGL_LIBS} -lX11"
  118. fi
  119. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  120. dnl Use libcaca? (required for font generation)
  121. ac_cv_my_have_caca="no"
  122. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  123. if test "${ac_cv_my_have_caca}" != "no"; then
  124. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  125. fi
  126. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  127. dnl Use libpipi? (required for video recording)
  128. ac_cv_my_have_pipi="no"
  129. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  130. if test "${ac_cv_my_have_pipi}" != "no"; then
  131. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  132. fi
  133. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  134. dnl Use GTK+? (required for the deushax editor)
  135. ac_cv_my_have_gtkgl="no"
  136. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  137. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  138. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  139. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  140. fi
  141. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  142. dnl Use cppunit for unit tests?
  143. PKG_CHECK_MODULES(CPPUNIT, cppunit, [CPPUNIT="yes"], [CPPUNIT="no"])
  144. AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes")
  145. # How to use the Lol Engine inside this tree
  146. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src $SDL_CFLAGS $EGL_CFLAGS"
  147. LOL_LIBS="$LOL_LIBS $SDL_LIBS $EGL_LIBS"
  148. AC_SUBST(MATH_LIBS)
  149. AC_SUBST(LOL_CFLAGS)
  150. AC_SUBST(LOL_LIBS)
  151. AC_CONFIG_FILES([
  152. Makefile
  153. src/Makefile
  154. test/Makefile
  155. monsterz/Makefile
  156. deushax/Makefile
  157. tools/Makefile
  158. art/Makefile
  159. art/test/Makefile
  160. gfx/Makefile
  161. gfx/font/Makefile
  162. maps/Makefile
  163. ])
  164. AC_OUTPUT