You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 13 години
преди 14 години
преди 13 години
преди 13 години
преди 13 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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. LIBS_save="$LIBS"
  88. LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
  89. AC_MSG_CHECKING(for -framework OpenGL)
  90. AC_TRY_LINK([], [],
  91. [ac_cv_my_have_cocoa="yes"
  92. AC_MSG_RESULT(yes)
  93. GL_LIBS="${GL_LIBS} -framework OpenGL"
  94. CXXFLAGS="${CXXFLAGS} -ObjC++"],
  95. [AC_MSG_RESULT(no)])
  96. LIBS="$LIBS_save"
  97. dnl Which version of OpenGL to use?
  98. ac_cv_my_have_gl="no"
  99. PKG_CHECK_MODULES(GLES2, glesv2,
  100. [ac_cv_my_have_gl="yes"
  101. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  102. GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
  103. GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
  104. [:])
  105. PKG_CHECK_MODULES(GL, gl,
  106. [ac_cv_my_have_gl="yes"
  107. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
  108. [:])
  109. AC_CHECK_LIB(GL, glLoadIdentity,
  110. [ac_cv_my_have_gl="yes"
  111. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
  112. GL_LIBS="-lGL"])
  113. AC_CHECK_HEADER(GL/gl.h,
  114. [LIBS_save="$LIBS"
  115. LIBS="$LIBS -lopengl32"
  116. AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
  117. AC_TRY_LINK([#include <GL/gl.h>],
  118. [glLoadIdentity();],
  119. [ac_cv_my_have_gl="yes"
  120. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
  121. AC_MSG_RESULT(yes)
  122. GL_LIBS="-lopengl32"],
  123. [AC_MSG_RESULT(no)])
  124. LIBS="$LIBS_save"])
  125. AC_CHECK_HEADER(PSGL/psgl.h,
  126. [ac_cv_my_have_gl="yes"])
  127. if test "${ac_cv_my_have_gl}" = "no"; then
  128. AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  129. fi
  130. dnl Use Glew?
  131. ac_cv_my_have_glew="no"
  132. PKG_CHECK_MODULES(GLEW, glew,
  133. [ac_cv_my_have_glew="yes"
  134. GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
  135. GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
  136. [:])
  137. AC_CHECK_HEADER(glew.h,
  138. [LIBS_save="${LIBS}"
  139. LIBS="${LIBS} -lglew32 ${GL_LIBS}"
  140. AC_MSG_CHECKING(for glewInit in -lglew32)
  141. AC_TRY_LINK(
  142. [#include <glew.h>],
  143. [glewInit();],
  144. [ac_cv_my_have_glew="yes"
  145. GL_LIBS="-lglew32 ${GL_LIBS}"
  146. AC_MSG_RESULT(yes)],
  147. [AC_MSG_RESULT(no)])
  148. LIBS="${LIBS_save}"])
  149. if test "${ac_cv_my_have_glew}" != "no"; then
  150. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  151. AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
  152. fi
  153. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  154. dnl Poor man's GL feature detection if all else failed.
  155. save_LIBS="${LIBS}"
  156. LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
  157. AC_CHECK_FUNCS(glBegin)
  158. LIBS="${save_LIBS}"
  159. dnl Use SDL? (always required on Linux or Win32)
  160. ac_cv_my_have_sdl="no"
  161. ac_cv_my_have_sdl_image="no"
  162. ac_cv_my_have_sdl_mixer="no"
  163. dnl
  164. dnl First, try the proper pkg-config check
  165. PKG_CHECK_MODULES(SDL, sdl, [ac_cv_my_have_sdl="yes"], [:])
  166. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [ac_cv_my_have_sdl_mixer="yes"], [:])
  167. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [ac_cv_my_have_sdl_image="yes"], [:])
  168. dnl
  169. dnl Then the old sdl-config method
  170. if test "x${cross_compiling}" != xyes -a "${ac_cv_my_have_sdl}" != yes; then
  171. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  172. if test "${SDL_CONFIG}" != "no"; then
  173. SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`"
  174. SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`"
  175. ac_cv_my_have_sdl="yes"
  176. fi
  177. fi
  178. dnl
  179. dnl Maybe all this has failed, try direct inclusion
  180. save_CPPFLAGS="${CPPFLAGS}"
  181. save_LIBS="${LIBS}"
  182. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  183. LIBS="${LIBS} ${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  184. AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_sdl="yes"])
  185. AC_CHECK_HEADERS(SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
  186. AC_CHECK_HEADERS(SDL_image.h, [ac_cv_my_have_sdl_image="yes"])
  187. AC_CHECK_LIB(SDL, main,
  188. [SDL_LIBS="${SDL_LIBS} -lSDL"],
  189. [ac_cv_my_have_sdl="no"])
  190. AC_CHECK_LIB(SDL_mixer, main,
  191. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"],
  192. [ac_cv_my_have_sdl_mixer="no"])
  193. AC_CHECK_LIB(SDL_image, main,
  194. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"],
  195. [ac_cv_my_have_sdl_image="no"])
  196. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  197. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  198. CPPFLAGS="${save_CPPFLAGS}"
  199. LIBS="${save_LIBS}"
  200. if test "${ac_cv_my_have_sdl}" = "no"; then
  201. AC_MSG_WARN([SDL not found])
  202. else
  203. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  204. fi
  205. if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
  206. AC_MSG_WARN([SDL_mixer not found])
  207. else
  208. AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer)
  209. fi
  210. if test "${ac_cv_my_have_sdl_image}" = "no"; then
  211. AC_MSG_WARN([SDL_image not found])
  212. else
  213. AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image)
  214. fi
  215. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  216. AM_CONDITIONAL(USE_SDL_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes")
  217. AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes")
  218. dnl Use EGL?
  219. ac_cv_my_have_egl="no"
  220. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  221. if test "${ac_cv_my_have_egl}" != "no"; then
  222. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  223. EGL_LIBS="${EGL_LIBS} -lX11"
  224. fi
  225. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  226. dnl Use libpng? (replacement for SDL_image)
  227. ac_cv_my_have_libpng="no"
  228. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  229. if test "${ac_cv_my_have_libpng}" != "no"; then
  230. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  231. fi
  232. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  233. dnl Use libcaca? (required for font generation)
  234. ac_cv_my_have_caca="no"
  235. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  236. if test "${ac_cv_my_have_caca}" != "no"; then
  237. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  238. fi
  239. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  240. dnl Use libpipi? (required for video recording)
  241. ac_cv_my_have_pipi="no"
  242. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  243. if test "${ac_cv_my_have_pipi}" != "no"; then
  244. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  245. fi
  246. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  247. dnl Use GTK+? (required for the deushax editor)
  248. ac_cv_my_have_gtkgl="no"
  249. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  250. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  251. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  252. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  253. fi
  254. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  255. dnl How to use the Lol Engine inside this tree
  256. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  257. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  258. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS"
  259. AC_SUBST(MATH_LIBS)
  260. AC_SUBST(LOL_CFLAGS)
  261. AC_SUBST(LOL_LIBS)
  262. AC_CONFIG_FILES(
  263. [Makefile
  264. src/Makefile
  265. test/Makefile
  266. gfx/Makefile
  267. gfx/font/Makefile
  268. tools/Makefile
  269. ])
  270. AC_CONFIG_FILES(
  271. [monsterz/Makefile
  272. ])
  273. AC_CONFIG_FILES(
  274. [deushax/Makefile
  275. deushax/art/Makefile
  276. deushax/art/test/Makefile
  277. deushax/gfx/Makefile
  278. deushax/maps/Makefile
  279. ])
  280. AC_OUTPUT