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

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