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.
 
 
 

349 lines
10 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 Available platforms: some of these are not public
  36. AM_CONDITIONAL(HAVE_PS3, test -f src/platform/ps3/ps3app.cpp)
  37. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  38. dnl conditional builds
  39. AC_ARG_ENABLE(debug,
  40. [ --enable-debug build debug versions of the game (default no)])
  41. AC_ARG_ENABLE(release,
  42. [ --enable-release build final release of the game (default no)])
  43. AC_ARG_ENABLE(experimental,
  44. [ --enable-experimental experimental build (default no)])
  45. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h fastmath.h)
  46. if test "${enable_debug}" = "yes"; then
  47. AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
  48. OPT="-O"
  49. else
  50. OPT="-O3 -ffast-math -fno-strength-reduce -fomit-frame-pointer"
  51. fi
  52. if test "${enable_release}" = "yes"; then
  53. AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release)
  54. REL=""
  55. else
  56. REL="-g"
  57. fi
  58. if test "${enable_experimental}" = "yes"; then
  59. AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build)
  60. fi
  61. dnl No exceptions
  62. CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-rtti"
  63. dnl Optimizations
  64. CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}"
  65. dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  66. CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
  67. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  68. dnl Are we on the PS3?
  69. AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
  70. [LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
  71. dnl For PSGL
  72. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
  73. GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
  74. if test "x${enable_debug}" = xyes; then
  75. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
  76. elif test "x${enable_release}" = xyes; then
  77. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
  78. else
  79. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
  80. fi
  81. dnl For the runtime Cg compiler
  82. GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
  83. dnl For the PNG decoder
  84. LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
  85. dnl For the pad library
  86. LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
  87. AC_PATH_PROG(MAKE_FSELF, make_fself, no)],
  88. [MAKE_FSELF=no])
  89. AM_CONDITIONAL(USE_MAKE_FSELF, test "${MAKE_FSELF}" != "no")
  90. LIBS_save="$LIBS"
  91. LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
  92. AC_MSG_CHECKING(for -framework OpenGL)
  93. AC_TRY_LINK([], [],
  94. [ac_cv_my_have_cocoa="yes"
  95. AC_MSG_RESULT(yes)
  96. GL_LIBS="${GL_LIBS} -framework OpenGL"
  97. CXXFLAGS="${CXXFLAGS} -ObjC++"],
  98. [AC_MSG_RESULT(no)])
  99. LIBS="$LIBS_save"
  100. dnl Which version of OpenGL to use?
  101. ac_cv_my_have_gl="no"
  102. PKG_CHECK_MODULES(GLES2, glesv2,
  103. [ac_cv_my_have_gl="yes"
  104. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  105. GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
  106. GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
  107. [:])
  108. PKG_CHECK_MODULES(GL, gl,
  109. [ac_cv_my_have_gl="yes"
  110. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
  111. [:])
  112. AC_CHECK_LIB(GL, glLoadIdentity,
  113. [ac_cv_my_have_gl="yes"
  114. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
  115. GL_LIBS="-lGL"])
  116. AC_CHECK_HEADER(GL/gl.h,
  117. [LIBS_save="$LIBS"
  118. LIBS="$LIBS -lopengl32"
  119. AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
  120. AC_TRY_LINK([#include <GL/gl.h>],
  121. [glLoadIdentity();],
  122. [ac_cv_my_have_gl="yes"
  123. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
  124. AC_MSG_RESULT(yes)
  125. GL_LIBS="-lopengl32"],
  126. [AC_MSG_RESULT(no)])
  127. LIBS="$LIBS_save"])
  128. AC_CHECK_HEADER(PSGL/psgl.h,
  129. [ac_cv_my_have_gl="yes"])
  130. if test "${ac_cv_my_have_gl}" = "no"; then
  131. AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  132. fi
  133. dnl Use Glew?
  134. ac_cv_my_have_glew="no"
  135. PKG_CHECK_MODULES(GLEW, glew,
  136. [ac_cv_my_have_glew="yes"
  137. GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
  138. GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
  139. [:])
  140. AC_CHECK_HEADER(glew.h,
  141. [LIBS_save="${LIBS}"
  142. LIBS="${LIBS} -lglew32 ${GL_LIBS}"
  143. AC_MSG_CHECKING(for glewInit in -lglew32)
  144. AC_TRY_LINK(
  145. [#include <glew.h>],
  146. [glewInit();],
  147. [ac_cv_my_have_glew="yes"
  148. GL_LIBS="-lglew32 ${GL_LIBS}"
  149. AC_MSG_RESULT(yes)],
  150. [AC_MSG_RESULT(no)])
  151. LIBS="${LIBS_save}"])
  152. if test "${ac_cv_my_have_glew}" != "no"; then
  153. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  154. AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
  155. fi
  156. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  157. dnl Poor man's GL feature detection if all else failed.
  158. save_LIBS="${LIBS}"
  159. LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
  160. AC_CHECK_FUNCS(glBegin)
  161. LIBS="${save_LIBS}"
  162. dnl Use SDL? (always required on Linux or Win32)
  163. ac_cv_my_have_sdl="no"
  164. ac_cv_my_have_sdl_image="no"
  165. ac_cv_my_have_sdl_mixer="no"
  166. dnl
  167. dnl First, try the proper pkg-config check
  168. PKG_CHECK_MODULES(SDL, sdl, [ac_cv_my_have_sdl="yes"], [:])
  169. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [ac_cv_my_have_sdl_mixer="yes"], [:])
  170. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [ac_cv_my_have_sdl_image="yes"], [:])
  171. dnl
  172. dnl Then the old sdl-config method
  173. if test "x${cross_compiling}" != xyes -a "${ac_cv_my_have_sdl}" != yes; then
  174. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  175. if test "${SDL_CONFIG}" != "no"; then
  176. SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`"
  177. SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`"
  178. ac_cv_my_have_sdl="yes"
  179. fi
  180. fi
  181. dnl
  182. dnl Maybe all this has failed, try direct inclusion
  183. save_CPPFLAGS="${CPPFLAGS}"
  184. save_LIBS="${LIBS}"
  185. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  186. LIBS="${LIBS} ${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  187. AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_sdl="yes"])
  188. AC_CHECK_HEADERS(SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
  189. AC_CHECK_HEADERS(SDL_image.h, [ac_cv_my_have_sdl_image="yes"])
  190. AC_CHECK_LIB(SDL, main,
  191. [SDL_LIBS="${SDL_LIBS} -lSDL"],
  192. [ac_cv_my_have_sdl="no"])
  193. AC_CHECK_LIB(SDL_mixer, main,
  194. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"],
  195. [ac_cv_my_have_sdl_mixer="no"])
  196. AC_CHECK_LIB(SDL_image, main,
  197. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"],
  198. [ac_cv_my_have_sdl_image="no"])
  199. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  200. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  201. CPPFLAGS="${save_CPPFLAGS}"
  202. LIBS="${save_LIBS}"
  203. if test "${ac_cv_my_have_sdl}" = "no"; then
  204. AC_MSG_WARN([SDL not found])
  205. else
  206. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  207. fi
  208. if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
  209. AC_MSG_WARN([SDL_mixer not found])
  210. else
  211. AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer)
  212. fi
  213. if test "${ac_cv_my_have_sdl_image}" = "no"; then
  214. AC_MSG_WARN([SDL_image not found])
  215. else
  216. AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image)
  217. fi
  218. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  219. AM_CONDITIONAL(USE_SDL_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes")
  220. AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes")
  221. dnl Use EGL?
  222. ac_cv_my_have_egl="no"
  223. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  224. if test "${ac_cv_my_have_egl}" != "no"; then
  225. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  226. EGL_LIBS="${EGL_LIBS} -lX11"
  227. fi
  228. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  229. dnl Use libpng? (replacement for SDL_image)
  230. ac_cv_my_have_libpng="no"
  231. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  232. if test "${ac_cv_my_have_libpng}" != "no"; then
  233. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  234. fi
  235. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  236. dnl Use Windows GDI+?
  237. ac_cv_my_have_gdiplus="no"
  238. AC_LANG_PUSH(C++)
  239. AC_CHECK_HEADERS(Gdiplus.h,
  240. [ac_cv_my_have_gdiplus="yes"
  241. LOL_LIBS="${LOL_LIBS} -lgdiplus"],
  242. [ac_cv_my_have_gdiplus="no"],
  243. [#include <algorithm>
  244. using std::min;
  245. using std::max;
  246. #include <windows.h>])
  247. AC_LANG_POP(C++)
  248. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  249. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  250. fi
  251. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  252. dnl Use libcaca? (required for font generation)
  253. ac_cv_my_have_caca="no"
  254. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  255. if test "${ac_cv_my_have_caca}" != "no"; then
  256. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  257. fi
  258. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  259. dnl Use libpipi? (required for video recording)
  260. ac_cv_my_have_pipi="no"
  261. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  262. if test "${ac_cv_my_have_pipi}" != "no"; then
  263. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  264. fi
  265. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  266. dnl Use GTK+? (required for the deushax editor)
  267. ac_cv_my_have_gtkgl="no"
  268. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  269. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  270. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  271. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  272. fi
  273. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  274. dnl How to use the Lol Engine inside this tree
  275. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  276. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  277. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS"
  278. AC_SUBST(MATH_LIBS)
  279. AC_SUBST(LOL_CFLAGS)
  280. AC_SUBST(LOL_LIBS)
  281. AC_CONFIG_FILES(
  282. [Makefile
  283. src/Makefile
  284. test/Makefile
  285. test/math/Makefile
  286. test/tutorial/Makefile
  287. test/xolotl/Makefile
  288. gfx/Makefile
  289. gfx/font/Makefile
  290. tools/Makefile
  291. ])
  292. AC_CONFIG_FILES(
  293. [monsterz/Makefile
  294. ])
  295. AC_CONFIG_FILES(
  296. [deushax/Makefile
  297. deushax/art/Makefile
  298. deushax/art/test/Makefile
  299. deushax/gfx/Makefile
  300. deushax/maps/Makefile
  301. ])
  302. AC_OUTPUT