Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

13 роки тому
13 роки тому
13 роки тому
13 роки тому
13 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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)
  49. AC_CHECK_HEADERS(fastmath.h pthread.h libutil.h util.h pty.h)
  50. AC_CHECK_HEADERS(sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h)
  51. AC_CHECK_HEADERS(sys/wait.h)
  52. AC_CHECK_HEADERS(linux/kdev_t.h linux/major.h)
  53. AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h)
  54. if test "${enable_debug}" = "yes"; then
  55. AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
  56. OPT="-O"
  57. else
  58. OPT="-O3 -ffast-math -fno-strength-reduce -fomit-frame-pointer"
  59. fi
  60. if test "${enable_release}" = "yes"; then
  61. AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release)
  62. REL=""
  63. else
  64. REL="-g"
  65. fi
  66. if test "${enable_experimental}" = "yes"; then
  67. AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build)
  68. fi
  69. dnl No exceptions
  70. CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-rtti"
  71. dnl Optimizations
  72. CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}"
  73. dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  74. CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
  75. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  76. AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
  77. AC_CHECK_LIB(util, forkpty, UTIL_LIBS="${UTIL_LIBS} -lutil")
  78. dnl Are we on the PS3?
  79. AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
  80. [LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
  81. dnl For PSGL
  82. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
  83. GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
  84. dnl This is the old way
  85. if test "x${CELLSDK}" != x -a "x${CELLSDK}" = x; then
  86. CELL_SDK="${CELLSDK}"
  87. fi
  88. if test "x${enable_debug}" = xyes; then
  89. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
  90. elif test "x${enable_release}" = xyes; then
  91. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
  92. else
  93. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
  94. fi
  95. dnl For the runtime Cg compiler
  96. GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
  97. dnl For the PNG decoder
  98. LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
  99. dnl For the pad library
  100. LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
  101. dnl Disable this warning, it's too verbose with vector.h
  102. CXXFLAGS="${CXXFLAGS} -Wno-sign-compare"
  103. AC_PATH_PROG(MAKE_FSELF, make_fself, no)],
  104. [MAKE_FSELF=no])
  105. AM_CONDITIONAL(USE_MAKE_FSELF, test "${MAKE_FSELF}" != "no")
  106. dnl Are we on a Direct3D 9 platform?
  107. #ac_cv_my_have_d3d9="no"
  108. #AC_CHECK_HEADERS(d3d9.h, [ac_cv_my_have_d3d9="yes"])
  109. #if test "${ac_cv_my_have_d3d9}" != "no"; then
  110. # D3D_LIBS="${D3D_LIBS} -ld3d9 -ld3dx9 -lxinput"
  111. # AC_DEFINE(USE_D3D9, 1, Define to 1 to use DirectX 9)
  112. #fi
  113. #AM_CONDITIONAL(USE_D3D9, test "${ac_cv_my_have_d3d9}" != "no")
  114. LIBS_save="$LIBS"
  115. LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
  116. AC_MSG_CHECKING(for -framework OpenGL)
  117. AC_TRY_LINK([], [],
  118. [ac_cv_my_have_cocoa="yes"
  119. AC_MSG_RESULT(yes)
  120. GL_LIBS="${GL_LIBS} -framework OpenGL"
  121. CXXFLAGS="${CXXFLAGS} -ObjC++"],
  122. [AC_MSG_RESULT(no)])
  123. LIBS="$LIBS_save"
  124. dnl Which version of OpenGL to use?
  125. ac_cv_my_have_gl="no"
  126. PKG_CHECK_MODULES(GLES2, glesv2,
  127. [ac_cv_my_have_gl="yes"
  128. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  129. GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
  130. GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
  131. [:])
  132. AC_CHECK_HEADER(GLES2/gl2.h,
  133. [AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  134. ac_cv_my_have_gl="yes"])
  135. PKG_CHECK_MODULES(GL, gl,
  136. [ac_cv_my_have_gl="yes"
  137. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
  138. [:])
  139. AC_CHECK_LIB(GL, glLoadIdentity,
  140. [ac_cv_my_have_gl="yes"
  141. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
  142. GL_LIBS="-lGL"])
  143. AC_CHECK_HEADER(GL/gl.h,
  144. [LIBS_save="$LIBS"
  145. LIBS="$LIBS -lopengl32"
  146. AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
  147. AC_TRY_LINK([#include <GL/gl.h>],
  148. [glLoadIdentity();],
  149. [ac_cv_my_have_gl="yes"
  150. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
  151. AC_MSG_RESULT(yes)
  152. GL_LIBS="-lopengl32"],
  153. [AC_MSG_RESULT(no)])
  154. LIBS="$LIBS_save"])
  155. AC_CHECK_HEADER(PSGL/psgl.h,
  156. [ac_cv_my_have_gl="yes"])
  157. if test "${ac_cv_my_have_gl}" = "no"; then
  158. AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  159. fi
  160. dnl Use Glew?
  161. ac_cv_my_have_glew="no"
  162. PKG_CHECK_MODULES(GLEW, glew,
  163. [ac_cv_my_have_glew="yes"
  164. GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
  165. GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
  166. [:])
  167. AC_CHECK_HEADER(glew.h,
  168. [LIBS_save="${LIBS}"
  169. LIBS="${LIBS} -lglew32 ${GL_LIBS}"
  170. AC_MSG_CHECKING(for glewInit in -lglew32)
  171. AC_TRY_LINK(
  172. [#include <glew.h>],
  173. [glewInit();],
  174. [ac_cv_my_have_glew="yes"
  175. GL_LIBS="-lglew32 ${GL_LIBS}"
  176. AC_MSG_RESULT(yes)],
  177. [AC_MSG_RESULT(no)])
  178. LIBS="${LIBS_save}"])
  179. if test "${ac_cv_my_have_glew}" != "no"; then
  180. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  181. AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
  182. fi
  183. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  184. dnl Poor man's GL feature detection if all else failed.
  185. save_LIBS="${LIBS}"
  186. LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
  187. AC_CHECK_FUNCS(glBegin)
  188. LIBS="${save_LIBS}"
  189. dnl Use SDL? (always required on Linux or Win32)
  190. ac_cv_my_have_sdl="no"
  191. ac_cv_my_have_sdl_image="no"
  192. ac_cv_my_have_sdl_mixer="no"
  193. dnl
  194. dnl First, try the proper pkg-config check
  195. PKG_CHECK_MODULES(SDL, sdl, [ac_cv_my_have_sdl="yes"], [:])
  196. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [ac_cv_my_have_sdl_mixer="yes"], [:])
  197. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [ac_cv_my_have_sdl_image="yes"], [:])
  198. dnl
  199. dnl Then the old sdl-config method
  200. if test "x${cross_compiling}" != xyes -a "${ac_cv_my_have_sdl}" != yes; then
  201. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  202. if test "${SDL_CONFIG}" != "no"; then
  203. SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`"
  204. SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`"
  205. ac_cv_my_have_sdl="yes"
  206. fi
  207. fi
  208. dnl
  209. dnl Maybe all this has failed, try direct inclusion
  210. save_CPPFLAGS="${CPPFLAGS}"
  211. save_LIBS="${LIBS}"
  212. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  213. LIBS="${LIBS} ${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  214. AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_sdl="yes"])
  215. AC_CHECK_HEADERS(SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
  216. AC_CHECK_HEADERS(SDL_image.h, [ac_cv_my_have_sdl_image="yes"])
  217. AC_CHECK_LIB(SDL, main,
  218. [SDL_LIBS="${SDL_LIBS} -lSDL"],
  219. [ac_cv_my_have_sdl="no"])
  220. AC_CHECK_LIB(SDL_mixer, main,
  221. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"],
  222. [ac_cv_my_have_sdl_mixer="no"])
  223. AC_CHECK_LIB(SDL_image, main,
  224. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"],
  225. [ac_cv_my_have_sdl_image="no"])
  226. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  227. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  228. CPPFLAGS="${save_CPPFLAGS}"
  229. LIBS="${save_LIBS}"
  230. if test "${ac_cv_my_have_sdl}" = "no"; then
  231. AC_MSG_WARN([SDL not found])
  232. else
  233. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  234. fi
  235. if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
  236. AC_MSG_WARN([SDL_mixer not found])
  237. else
  238. AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer)
  239. fi
  240. if test "${ac_cv_my_have_sdl_image}" = "no"; then
  241. AC_MSG_WARN([SDL_image not found])
  242. else
  243. AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image)
  244. fi
  245. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  246. AM_CONDITIONAL(USE_SDL_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes")
  247. AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes")
  248. dnl Use Flex's FlexLexer.h or ours?
  249. ac_cv_my_have_flexlexer_h="no"
  250. AC_LANG_PUSH(C++)
  251. AC_CHECK_HEADERS(FlexLexer.h, [ac_cv_my_have_flexlexer_h="yes"])
  252. AC_LANG_POP(C++)
  253. if test "x${ac_cv_my_have_flexlexer_h}" = "xno"; then
  254. LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/contrib/flex-2.5.35/include"
  255. fi
  256. dnl Use NativeClient?
  257. ac_cv_my_have_nacl="no"
  258. AC_LANG_PUSH(C++)
  259. AC_CHECK_HEADERS(ppapi/cpp/instance.h,
  260. [ac_cv_my_have_nacl="yes"
  261. dnl Disable this warning, it's too verbose with vector.h
  262. CXXFLAGS="${CXXFLAGS} -Wno-sign-compare"])
  263. AC_LANG_POP(C++)
  264. AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no")
  265. dnl Use EGL?
  266. ac_cv_my_have_egl="no"
  267. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  268. if test "${ac_cv_my_have_egl}" != "no"; then
  269. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  270. EGL_LIBS="${EGL_LIBS} -lX11"
  271. fi
  272. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  273. dnl Use libpng? (replacement for SDL_image)
  274. ac_cv_my_have_libpng="no"
  275. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  276. if test "${ac_cv_my_have_libpng}" != "no"; then
  277. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  278. fi
  279. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  280. dnl Use Windows GDI+?
  281. ac_cv_my_have_gdiplus="no"
  282. AC_LANG_PUSH(C++)
  283. AC_CHECK_HEADERS(gdiplus.h,
  284. [ac_cv_my_have_gdiplus="yes"
  285. LOL_LIBS="${LOL_LIBS} -lgdiplus"],
  286. [ac_cv_my_have_gdiplus="no"],
  287. [#include <algorithm>
  288. using std::min;
  289. using std::max;
  290. #include <windows.h>])
  291. AC_LANG_POP(C++)
  292. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  293. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  294. fi
  295. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  296. dnl Use libcaca? (required for font generation)
  297. ac_cv_my_have_caca="no"
  298. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  299. if test "${ac_cv_my_have_caca}" != "no"; then
  300. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  301. fi
  302. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  303. dnl Use libpipi? (required for video recording)
  304. ac_cv_my_have_pipi="no"
  305. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  306. if test "${ac_cv_my_have_pipi}" != "no"; then
  307. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  308. fi
  309. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  310. dnl Use GTK+? (required for the deushax editor)
  311. ac_cv_my_have_gtkgl="no"
  312. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  313. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  314. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  315. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  316. fi
  317. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  318. dnl LolFx compilation rule
  319. LOLFX_BUILD='(echo "char const *"; echo "lolfx_$(notdir $(basename $(filter %.lolfx, $^))) ="; $(SED) '"'"'s/"/\\"/g'"'"' $(filter %.lolfx, $^) | $(SED) '"'"'s/\([[^\r]]*\).*/"\1\\n"/'"'"'; echo ";") | $(CXXCOMPILE) -xc++ -c - -o $@'
  320. AC_SUBST(LOLFX_BUILD)
  321. dnl Extra libraries we may need
  322. AC_SUBST(MATH_LIBS)
  323. AC_SUBST(PAM_LIBS)
  324. AC_SUBST(UTIL_LIBS)
  325. dnl How to use the Lol Engine inside this tree
  326. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  327. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  328. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS"
  329. AC_SUBST(LOL_CFLAGS)
  330. AC_SUBST(LOL_LIBS)
  331. AC_CONFIG_FILES(
  332. [Makefile
  333. src/Makefile
  334. src/data/Makefile
  335. src/data/font/Makefile
  336. tutorial/Makefile
  337. test/Makefile
  338. test/math/Makefile
  339. test/sandbox/Makefile
  340. test/xolotl/Makefile
  341. build/Makefile
  342. binaries/Makefile
  343. games/Makefile
  344. tools/Makefile
  345. ])
  346. AC_CONFIG_FILES(
  347. [games/monsterz/Makefile
  348. ])
  349. AC_CONFIG_FILES(
  350. [games/deushax/Makefile
  351. games/deushax/art/Makefile
  352. games/deushax/art/test/Makefile
  353. games/deushax/gfx/Makefile
  354. games/deushax/maps/Makefile
  355. ])
  356. AC_CONFIG_FILES(
  357. [games/mrpigeon/Makefile
  358. ])
  359. AC_CONFIG_FILES(
  360. [games/orbital/Makefile
  361. ])
  362. AC_CONFIG_FILES(
  363. [games/ToukyDemo/Makefile
  364. ])
  365. AC_CONFIG_FILES(
  366. [tools/neercs/Makefile
  367. ])
  368. AC_OUTPUT