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.
 
 
 

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