25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

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