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