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.

преди 12 години
преди 13 години
преди 13 години
преди 13 години
преди 14 години
преди 13 години
преди 13 години
преди 13 години
преди 13 години
преди 13 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  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 -lxinput"
  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 Flex's FlexLexer.h or ours?
  239. ac_cv_my_have_flexlexer_h="no"
  240. AC_LANG_PUSH(C++)
  241. AC_CHECK_HEADERS(FlexLexer.h, [ac_cv_my_have_flexlexer_h="yes"])
  242. AC_LANG_POP(C++)
  243. if test "x${ac_cv_my_have_flexlexer_h}" = "xno"; then
  244. LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/contrib/flex-2.5.35/include"
  245. fi
  246. dnl Use NativeClient?
  247. ac_cv_my_have_nacl="no"
  248. AC_LANG_PUSH(C++)
  249. AC_CHECK_HEADERS(ppapi/cpp/instance.h,
  250. [ac_cv_my_have_nacl="yes"
  251. dnl Disable this warning, it's too verbose with vector.h
  252. CXXFLAGS="${CXXFLAGS} -Wno-sign-compare"])
  253. AC_LANG_POP(C++)
  254. AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no")
  255. dnl Use EGL?
  256. ac_cv_my_have_egl="no"
  257. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  258. if test "${ac_cv_my_have_egl}" != "no"; then
  259. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  260. EGL_LIBS="${EGL_LIBS} -lX11"
  261. fi
  262. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  263. dnl Use libpng? (replacement for SDL_image)
  264. ac_cv_my_have_libpng="no"
  265. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  266. if test "${ac_cv_my_have_libpng}" != "no"; then
  267. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  268. fi
  269. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  270. dnl Use Windows GDI+?
  271. ac_cv_my_have_gdiplus="no"
  272. AC_LANG_PUSH(C++)
  273. AC_CHECK_HEADERS(gdiplus.h,
  274. [ac_cv_my_have_gdiplus="yes"
  275. LOL_LIBS="${LOL_LIBS} -lgdiplus"],
  276. [ac_cv_my_have_gdiplus="no"],
  277. [#include <algorithm>
  278. using std::min;
  279. using std::max;
  280. #include <windows.h>])
  281. AC_LANG_POP(C++)
  282. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  283. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  284. fi
  285. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  286. dnl Use libcaca? (required for font generation)
  287. ac_cv_my_have_caca="no"
  288. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  289. if test "${ac_cv_my_have_caca}" != "no"; then
  290. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  291. fi
  292. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  293. dnl Use libpipi? (required for video recording)
  294. ac_cv_my_have_pipi="no"
  295. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  296. if test "${ac_cv_my_have_pipi}" != "no"; then
  297. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  298. fi
  299. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  300. dnl Use GTK+? (required for the deushax editor)
  301. ac_cv_my_have_gtkgl="no"
  302. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  303. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  304. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  305. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  306. fi
  307. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  308. dnl How to use the Lol Engine inside this tree
  309. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  310. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  311. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS"
  312. AC_SUBST(MATH_LIBS)
  313. AC_SUBST(LOL_CFLAGS)
  314. AC_SUBST(LOL_LIBS)
  315. AC_CONFIG_FILES(
  316. [Makefile
  317. src/Makefile
  318. test/Makefile
  319. test/math/Makefile
  320. test/sandbox/Makefile
  321. test/tutorial/Makefile
  322. test/xolotl/Makefile
  323. gfx/Makefile
  324. gfx/font/Makefile
  325. tools/Makefile
  326. ])
  327. AC_CONFIG_FILES(
  328. [monsterz/Makefile
  329. ])
  330. AC_CONFIG_FILES(
  331. [deushax/Makefile
  332. deushax/art/Makefile
  333. deushax/art/test/Makefile
  334. deushax/gfx/Makefile
  335. deushax/maps/Makefile
  336. ])
  337. AC_CONFIG_FILES(
  338. [mrpigeon/Makefile
  339. ])
  340. AC_CONFIG_FILES(
  341. [orbital/Makefile
  342. ])
  343. AC_CONFIG_FILES(
  344. [neercs/Makefile
  345. ])
  346. AC_OUTPUT