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.
 
 
 

381 satır
11 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. 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. AC_PATH_PROG(MAKE_FSELF, make_fself, no)],
  92. [MAKE_FSELF=no])
  93. AM_CONDITIONAL(USE_MAKE_FSELF, test "${MAKE_FSELF}" != "no")
  94. dnl Are we on a Direct3D 9 platform?
  95. ac_cv_my_have_d3d9="no"
  96. AC_CHECK_HEADERS(d3d9.h, [ac_cv_my_have_d3d9="yes"])
  97. if test "${ac_cv_my_have_d3d9}" != "no"; then
  98. D3D_LIBS="${D3D_LIBS} -ld3d9 -ld3dx9"
  99. AC_DEFINE(USE_D3D9, 1, Define to 1 to use DirectX 9)
  100. fi
  101. AM_CONDITIONAL(USE_D3D9, test "${ac_cv_my_have_d3d9}" != "no")
  102. LIBS_save="$LIBS"
  103. LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
  104. AC_MSG_CHECKING(for -framework OpenGL)
  105. AC_TRY_LINK([], [],
  106. [ac_cv_my_have_cocoa="yes"
  107. AC_MSG_RESULT(yes)
  108. GL_LIBS="${GL_LIBS} -framework OpenGL"
  109. CXXFLAGS="${CXXFLAGS} -ObjC++"],
  110. [AC_MSG_RESULT(no)])
  111. LIBS="$LIBS_save"
  112. dnl Which version of OpenGL to use?
  113. ac_cv_my_have_gl="no"
  114. PKG_CHECK_MODULES(GLES2, glesv2,
  115. [ac_cv_my_have_gl="yes"
  116. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  117. GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
  118. GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
  119. [:])
  120. AC_CHECK_HEADER(GLES2/gl2.h,
  121. [AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  122. ac_cv_my_have_gl="yes"])
  123. PKG_CHECK_MODULES(GL, gl,
  124. [ac_cv_my_have_gl="yes"
  125. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
  126. [:])
  127. AC_CHECK_LIB(GL, glLoadIdentity,
  128. [ac_cv_my_have_gl="yes"
  129. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
  130. GL_LIBS="-lGL"])
  131. AC_CHECK_HEADER(GL/gl.h,
  132. [LIBS_save="$LIBS"
  133. LIBS="$LIBS -lopengl32"
  134. AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
  135. AC_TRY_LINK([#include <GL/gl.h>],
  136. [glLoadIdentity();],
  137. [ac_cv_my_have_gl="yes"
  138. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
  139. AC_MSG_RESULT(yes)
  140. GL_LIBS="-lopengl32"],
  141. [AC_MSG_RESULT(no)])
  142. LIBS="$LIBS_save"])
  143. AC_CHECK_HEADER(PSGL/psgl.h,
  144. [ac_cv_my_have_gl="yes"])
  145. if test "${ac_cv_my_have_gl}" = "no"; then
  146. AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  147. fi
  148. dnl Use Glew?
  149. ac_cv_my_have_glew="no"
  150. PKG_CHECK_MODULES(GLEW, glew,
  151. [ac_cv_my_have_glew="yes"
  152. GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
  153. GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
  154. [:])
  155. AC_CHECK_HEADER(glew.h,
  156. [LIBS_save="${LIBS}"
  157. LIBS="${LIBS} -lglew32 ${GL_LIBS}"
  158. AC_MSG_CHECKING(for glewInit in -lglew32)
  159. AC_TRY_LINK(
  160. [#include <glew.h>],
  161. [glewInit();],
  162. [ac_cv_my_have_glew="yes"
  163. GL_LIBS="-lglew32 ${GL_LIBS}"
  164. AC_MSG_RESULT(yes)],
  165. [AC_MSG_RESULT(no)])
  166. LIBS="${LIBS_save}"])
  167. if test "${ac_cv_my_have_glew}" != "no"; then
  168. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  169. AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
  170. fi
  171. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  172. dnl Poor man's GL feature detection if all else failed.
  173. save_LIBS="${LIBS}"
  174. LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
  175. AC_CHECK_FUNCS(glBegin)
  176. LIBS="${save_LIBS}"
  177. dnl Use SDL? (always required on Linux or Win32)
  178. ac_cv_my_have_sdl="no"
  179. ac_cv_my_have_sdl_image="no"
  180. ac_cv_my_have_sdl_mixer="no"
  181. dnl
  182. dnl First, try the proper pkg-config check
  183. PKG_CHECK_MODULES(SDL, sdl, [ac_cv_my_have_sdl="yes"], [:])
  184. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [ac_cv_my_have_sdl_mixer="yes"], [:])
  185. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [ac_cv_my_have_sdl_image="yes"], [:])
  186. dnl
  187. dnl Then the old sdl-config method
  188. if test "x${cross_compiling}" != xyes -a "${ac_cv_my_have_sdl}" != yes; then
  189. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  190. if test "${SDL_CONFIG}" != "no"; then
  191. SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`"
  192. SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`"
  193. ac_cv_my_have_sdl="yes"
  194. fi
  195. fi
  196. dnl
  197. dnl Maybe all this has failed, try direct inclusion
  198. save_CPPFLAGS="${CPPFLAGS}"
  199. save_LIBS="${LIBS}"
  200. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  201. LIBS="${LIBS} ${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  202. AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_sdl="yes"])
  203. AC_CHECK_HEADERS(SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
  204. AC_CHECK_HEADERS(SDL_image.h, [ac_cv_my_have_sdl_image="yes"])
  205. AC_CHECK_LIB(SDL, main,
  206. [SDL_LIBS="${SDL_LIBS} -lSDL"],
  207. [ac_cv_my_have_sdl="no"])
  208. AC_CHECK_LIB(SDL_mixer, main,
  209. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"],
  210. [ac_cv_my_have_sdl_mixer="no"])
  211. AC_CHECK_LIB(SDL_image, main,
  212. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"],
  213. [ac_cv_my_have_sdl_image="no"])
  214. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  215. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  216. CPPFLAGS="${save_CPPFLAGS}"
  217. LIBS="${save_LIBS}"
  218. if test "${ac_cv_my_have_sdl}" = "no"; then
  219. AC_MSG_WARN([SDL not found])
  220. else
  221. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  222. fi
  223. if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
  224. AC_MSG_WARN([SDL_mixer not found])
  225. else
  226. AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer)
  227. fi
  228. if test "${ac_cv_my_have_sdl_image}" = "no"; then
  229. AC_MSG_WARN([SDL_image not found])
  230. else
  231. AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image)
  232. fi
  233. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  234. AM_CONDITIONAL(USE_SDL_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes")
  235. AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes")
  236. dnl Use NativeClient?
  237. ac_cv_my_have_nacl="no"
  238. AC_LANG_PUSH(C++)
  239. AC_CHECK_HEADERS(ppapi/cpp/instance.h, [ac_cv_my_have_nacl="yes"])
  240. AC_LANG_POP(C++)
  241. AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no")
  242. dnl Use EGL?
  243. ac_cv_my_have_egl="no"
  244. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  245. if test "${ac_cv_my_have_egl}" != "no"; then
  246. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  247. EGL_LIBS="${EGL_LIBS} -lX11"
  248. fi
  249. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  250. dnl Use libpng? (replacement for SDL_image)
  251. ac_cv_my_have_libpng="no"
  252. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  253. if test "${ac_cv_my_have_libpng}" != "no"; then
  254. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  255. fi
  256. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  257. dnl Use Windows GDI+?
  258. ac_cv_my_have_gdiplus="no"
  259. AC_LANG_PUSH(C++)
  260. AC_CHECK_HEADERS(gdiplus.h,
  261. [ac_cv_my_have_gdiplus="yes"
  262. LOL_LIBS="${LOL_LIBS} -lgdiplus"],
  263. [ac_cv_my_have_gdiplus="no"],
  264. [#include <algorithm>
  265. using std::min;
  266. using std::max;
  267. #include <windows.h>])
  268. AC_LANG_POP(C++)
  269. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  270. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  271. fi
  272. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  273. dnl Use libcaca? (required for font generation)
  274. ac_cv_my_have_caca="no"
  275. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  276. if test "${ac_cv_my_have_caca}" != "no"; then
  277. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  278. fi
  279. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  280. dnl Use libpipi? (required for video recording)
  281. ac_cv_my_have_pipi="no"
  282. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  283. if test "${ac_cv_my_have_pipi}" != "no"; then
  284. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  285. fi
  286. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  287. dnl Use GTK+? (required for the deushax editor)
  288. ac_cv_my_have_gtkgl="no"
  289. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  290. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  291. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  292. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  293. fi
  294. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  295. dnl How to use the Lol Engine inside this tree
  296. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  297. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  298. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS"
  299. AC_SUBST(MATH_LIBS)
  300. AC_SUBST(LOL_CFLAGS)
  301. AC_SUBST(LOL_LIBS)
  302. AC_CONFIG_FILES(
  303. [Makefile
  304. src/Makefile
  305. test/Makefile
  306. test/math/Makefile
  307. test/sandbox/Makefile
  308. test/tutorial/Makefile
  309. test/xolotl/Makefile
  310. gfx/Makefile
  311. gfx/font/Makefile
  312. tools/Makefile
  313. ])
  314. AC_CONFIG_FILES(
  315. [monsterz/Makefile
  316. ])
  317. AC_CONFIG_FILES(
  318. [deushax/Makefile
  319. deushax/art/Makefile
  320. deushax/art/test/Makefile
  321. deushax/gfx/Makefile
  322. deushax/maps/Makefile
  323. ])
  324. AC_CONFIG_FILES(
  325. [mrpigeon/Makefile
  326. ])
  327. AC_CONFIG_FILES(
  328. [orbital/Makefile
  329. ])
  330. AC_OUTPUT