Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

280 rindas
8.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. 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 fastmath.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="-O3 -ffast-math -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="no"
  146. if test "x$cross_compiling" != xyes; then
  147. ac_cv_my_have_sdl="yes"
  148. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  149. if test "${SDL_CONFIG}" != "no" -a "x$cross_compiling" != xyes; then
  150. SDL_CFLAGS="${SDL_CFLAGS} `sdl-config --cflags`"
  151. SDL_LIBS="${SDL_LIBS} `sdl-config --libs`"
  152. fi
  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. fi
  172. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  173. dnl Use EGL?
  174. ac_cv_my_have_egl="no"
  175. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  176. if test "${ac_cv_my_have_egl}" != "no"; then
  177. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  178. EGL_LIBS="${EGL_LIBS} -lX11"
  179. fi
  180. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  181. dnl Use libpng? (replacement for SDL_image)
  182. ac_cv_my_have_libpng="no"
  183. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  184. if test "${ac_cv_my_have_libpng}" != "no"; then
  185. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  186. fi
  187. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  188. dnl Use libcaca? (required for font generation)
  189. ac_cv_my_have_caca="no"
  190. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  191. if test "${ac_cv_my_have_caca}" != "no"; then
  192. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  193. fi
  194. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  195. dnl Use libpipi? (required for video recording)
  196. ac_cv_my_have_pipi="no"
  197. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  198. if test "${ac_cv_my_have_pipi}" != "no"; then
  199. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  200. fi
  201. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  202. dnl Use GTK+? (required for the deushax editor)
  203. ac_cv_my_have_gtkgl="no"
  204. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  205. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  206. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  207. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  208. fi
  209. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  210. dnl Use cppunit for unit tests?
  211. PKG_CHECK_MODULES(CPPUNIT, cppunit, [CPPUNIT="yes"], [CPPUNIT="no"])
  212. AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes")
  213. dnl How to use the Lol Engine inside this tree
  214. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  215. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  216. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS"
  217. AC_SUBST(MATH_LIBS)
  218. AC_SUBST(LOL_CFLAGS)
  219. AC_SUBST(LOL_LIBS)
  220. AC_CONFIG_FILES(
  221. [Makefile
  222. src/Makefile
  223. test/Makefile
  224. gfx/Makefile
  225. gfx/font/Makefile
  226. tools/Makefile
  227. ])
  228. AC_CONFIG_FILES(
  229. [monsterz/Makefile
  230. ])
  231. AC_CONFIG_FILES(
  232. [deushax/Makefile
  233. deushax/art/Makefile
  234. deushax/art/test/Makefile
  235. deushax/gfx/Makefile
  236. deushax/maps/Makefile
  237. ])
  238. AC_OUTPUT