Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

280 Zeilen
8.4 KiB

  1. dnl configure script for Lol Engine
  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="-O"
  45. else
  46. OPT="-O2 -fno-strength-reduce -fomit-frame-pointer"
  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. dnl No exceptions
  58. CXXFLAGS="${CXXFLAGS} -fno-exceptions"
  59. dnl Optimizations
  60. CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}"
  61. dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  62. CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
  63. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  64. dnl Are we on the PS3?
  65. AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
  66. [LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
  67. dnl For PSGL
  68. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
  69. GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
  70. if test "x${enable_debug}" = xyes; then
  71. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
  72. elif test "x${enable_release}" = xyes; then
  73. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
  74. else
  75. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
  76. fi
  77. dnl For the runtime Cg compiler
  78. GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
  79. dnl For the PNG decoder
  80. LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
  81. dnl For the pad library
  82. LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
  83. AC_PATH_PROG(MAKE_FSELF, make_fself, no)],
  84. [MAKE_FSELF=no])
  85. AM_CONDITIONAL(USE_MAKE_FSELF, test "${MAKE_FSELF}" != "no")
  86. dnl Which version of OpenGL to use?
  87. ac_cv_my_have_gl="no"
  88. PKG_CHECK_MODULES(GLES2, glesv2,
  89. [ac_cv_my_have_gl="yes"
  90. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  91. GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
  92. GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
  93. [:])
  94. AC_CHECK_LIB(GL, glLoadIdentity,
  95. [ac_cv_my_have_gl="yes"
  96. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
  97. GL_LIBS="-lGL"])
  98. AC_CHECK_HEADER(GL/gl.h,
  99. [LIBS_save="$LIBS"
  100. LIBS="$LIBS -lopengl32"
  101. AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
  102. AC_TRY_LINK([#include <GL/gl.h>],
  103. [glLoadIdentity();],
  104. [ac_cv_my_have_gl="yes"
  105. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
  106. AC_MSG_RESULT(yes)
  107. GL_LIBS="-lopengl32"],
  108. [AC_MSG_RESULT(no)])
  109. LIBS="$LIBS_save"])
  110. AC_CHECK_HEADER(PSGL/psgl.h,
  111. [ac_cv_my_have_gl="yes"])
  112. if test "${ac_cv_my_have_gl}" = "no"; then
  113. AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  114. fi
  115. dnl Use Glew?
  116. ac_cv_my_have_glew="no"
  117. PKG_CHECK_MODULES(GLEW, glew,
  118. [ac_cv_my_have_glew="yes"
  119. GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
  120. GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
  121. [:])
  122. AC_CHECK_HEADER(GL/glew.h,
  123. [LIBS_save="${LIBS}"
  124. LIBS="${LIBS} -lglew32 ${GL_LIBS}"
  125. AC_MSG_CHECKING(for glewInit in -lglew32)
  126. AC_TRY_LINK(
  127. [#include <GL/glew.h>],
  128. [glewInit();],
  129. [ac_cv_my_have_glew="yes"
  130. GL_LIBS="-lglew32 ${GL_LIBS}"
  131. AC_MSG_RESULT(yes)],
  132. [AC_MSG_RESULT(no)])
  133. LIBS="${LIBS_save}"])
  134. if test "${ac_cv_my_have_glew}" != "no"; then
  135. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  136. AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
  137. fi
  138. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  139. dnl Poor man's GL feature detection if all else failed.
  140. save_LIBS="${LIBS}"
  141. LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
  142. AC_CHECK_FUNCS(glBegin)
  143. LIBS="${save_LIBS}"
  144. dnl Use SDL? (always required on Linux or Win32)
  145. ac_cv_my_have_sdl="yes"
  146. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  147. if test "${SDL_CONFIG}" != "no" -a "x$cross_compiling" != xyes; then
  148. SDL_CFLAGS="${SDL_CFLAGS} `sdl-config --cflags`"
  149. SDL_LIBS="${SDL_LIBS} `sdl-config --libs`"
  150. fi
  151. SDL_CFLAGS="${SDL_CFLAGS} ${GL_CFLAGS}"
  152. SDL_LIBS="${SDL_LIBS} ${GL_LIBS}"
  153. PKG_CHECK_MODULES(SDL, sdl, [:],
  154. [SDL_LIBS="${SDL_LIBS} -lSDL"])
  155. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [:],
  156. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"])
  157. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [:],
  158. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"])
  159. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  160. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  161. save_CPPFLAGS="${CPPFLAGS}"
  162. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
  163. AC_CHECK_HEADERS(SDL_mixer.h, [:], [ac_cv_my_have_sdl="no"])
  164. AC_CHECK_HEADERS(SDL_image.h, [:], [ac_cv_my_have_sdl="no"])
  165. CPPFLAGS="${save_CPPFLAGS}"
  166. if test "${ac_cv_my_have_sdl}" = "no"; then
  167. AC_MSG_WARN([[One of SDL, SDL_Image or SDL_Mixer not found]])
  168. else
  169. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  170. fi
  171. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  172. dnl Use EGL?
  173. ac_cv_my_have_egl="no"
  174. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  175. if test "${ac_cv_my_have_egl}" != "no"; then
  176. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  177. EGL_LIBS="${EGL_LIBS} -lX11"
  178. fi
  179. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  180. dnl Use libpng? (replacement for SDL_image)
  181. ac_cv_my_have_libpng="no"
  182. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  183. if test "${ac_cv_my_have_libpng}" != "no"; then
  184. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  185. fi
  186. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  187. dnl Use libcaca? (required for font generation)
  188. ac_cv_my_have_caca="no"
  189. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  190. if test "${ac_cv_my_have_caca}" != "no"; then
  191. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  192. fi
  193. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  194. dnl Use libpipi? (required for video recording)
  195. ac_cv_my_have_pipi="no"
  196. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  197. if test "${ac_cv_my_have_pipi}" != "no"; then
  198. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  199. fi
  200. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  201. dnl Use GTK+? (required for the deushax editor)
  202. ac_cv_my_have_gtkgl="no"
  203. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  204. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  205. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  206. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  207. fi
  208. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  209. dnl Use cppunit for unit tests?
  210. PKG_CHECK_MODULES(CPPUNIT, cppunit, [CPPUNIT="yes"], [CPPUNIT="no"])
  211. AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes")
  212. dnl How to use the Lol Engine inside this tree
  213. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  214. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  215. LOL_LIBS="$LOL_LIBS $SDL_LIBS $EGL_LIBS $LIBPNG_LIBS"
  216. AC_SUBST(MATH_LIBS)
  217. AC_SUBST(LOL_CFLAGS)
  218. AC_SUBST(LOL_LIBS)
  219. AC_CONFIG_FILES(
  220. [Makefile
  221. src/Makefile
  222. test/Makefile
  223. gfx/Makefile
  224. gfx/font/Makefile
  225. tools/Makefile
  226. ])
  227. AC_CONFIG_FILES(
  228. [monsterz/Makefile
  229. ])
  230. AC_CONFIG_FILES(
  231. [deushax/Makefile
  232. deushax/art/Makefile
  233. deushax/art/test/Makefile
  234. deushax/gfx/Makefile
  235. deushax/maps/Makefile
  236. ])
  237. AC_OUTPUT