選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

427 行
13 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. AM_DEFAULT_VERBOSITY=0
  9. dnl Versioning of the separate software we ship
  10. LOLUNIT_VERSION=0.1
  11. AC_SUBST(LOLUNIT_VERSION)
  12. LOLREMEZ_VERSION=0.2
  13. AC_SUBST(LOLREMEZ_VERSION)
  14. AM_CONFIG_HEADER(config.h)
  15. AM_PROG_CC_C_O
  16. AC_PROG_CPP
  17. AC_PROG_CXX
  18. AC_PROG_CXXCPP
  19. AC_PROG_RANLIB
  20. AC_LIBTOOL_WIN32_DLL
  21. AM_PROG_LIBTOOL
  22. AC_LIBTOOL_CXX
  23. AC_C_CONST
  24. AC_C_INLINE
  25. dnl Ensure an error is thrown if pkg-config M4 files are not found.
  26. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  27. m4_pattern_forbid([^PKG_CHECK_MODULES$])
  28. m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])
  29. dnl Same for Lol Engine M4 files.
  30. m4_pattern_forbid([^LOL_])
  31. dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling.
  32. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  33. export PKG_CONFIG_LIBDIR=/dev/null
  34. fi
  35. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  36. dnl now otherwise it might be set in an obscure if statement. Same thing for
  37. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  38. AC_EGREP_CPP(yes, foo)
  39. PKG_PROG_PKG_CONFIG()
  40. dnl Check for a working implementation of sed
  41. AC_PROG_SED
  42. AC_MSG_CHECKING(for a sed that understands \t)
  43. if test "$(echo 'x\x' | "${SED}" 's/.*@<:@^x\t@:>@//')" != x; then
  44. AC_MSG_RESULT(no)
  45. AC_MSG_ERROR([[consider installing GNU sed]])
  46. else
  47. AC_MSG_RESULT(yes)
  48. fi
  49. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  50. dnl conditional builds
  51. AC_ARG_ENABLE(debug,
  52. [ --enable-debug build debug versions of the game (default no)])
  53. AC_ARG_ENABLE(release,
  54. [ --enable-release build final release of the game (default no)])
  55. AC_ARG_ENABLE(experimental,
  56. [ --enable-experimental experimental build (default no)])
  57. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
  58. AC_CHECK_HEADERS(fastmath.h pthread.h libutil.h util.h pty.h glob.h)
  59. AC_CHECK_HEADERS(sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h)
  60. AC_CHECK_HEADERS(sys/wait.h)
  61. AC_CHECK_HEADERS(linux/kdev_t.h linux/major.h)
  62. AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h)
  63. AC_CHECK_HEADERS(pam/pam_appl.h pam/pam_misc.h)
  64. if test "${enable_debug}" = "yes"; then
  65. AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
  66. OPT="-O"
  67. else
  68. OPT="-O3 -ffast-math -fno-strength-reduce -fomit-frame-pointer"
  69. fi
  70. if test "${enable_release}" = "yes"; then
  71. AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release)
  72. REL=""
  73. else
  74. REL="-g"
  75. fi
  76. if test "${enable_experimental}" = "yes"; then
  77. AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build)
  78. fi
  79. dnl No exceptions
  80. CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-rtti"
  81. dnl Optimizations
  82. CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}"
  83. dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  84. CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
  85. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  86. AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
  87. AC_CHECK_LIB(util, forkpty,
  88. [UTIL_LIBS="${UTIL_LIBS} -lutil"
  89. dnl Override future forkpty detection
  90. ac_cv_func_forkpty="yes"])
  91. AC_CHECK_FUNCS(forkpty)
  92. dnl Are we on the PS3?
  93. ac_cv_my_have_ps3="no"
  94. AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
  95. [ac_cv_my_have_ps3="yes"
  96. LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
  97. dnl For PSGL
  98. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
  99. GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
  100. dnl This is the old way; we now use CELL_SDK instead of CELLSDK
  101. if test "x${CELLSDK}" != x -a "x${CELL_SDK}" = x; then
  102. CELL_SDK="${CELLSDK}"
  103. fi
  104. if test "x${enable_debug}" = xyes; then
  105. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
  106. elif test "x${enable_release}" = xyes; then
  107. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
  108. else
  109. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
  110. fi
  111. dnl For the runtime Cg compiler
  112. GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
  113. dnl For the PNG decoder
  114. LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
  115. dnl For the pad library
  116. LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
  117. dnl Disable this warning, it's too verbose with vector.h
  118. CXXFLAGS="${CXXFLAGS} -Wno-sign-compare"
  119. AC_PATH_PROG(MAKE_FSELF, make_fself, no)
  120. if test "${MAKE_FSELF}" = "no"; then
  121. AC_MSG_ERROR([[Building for PS3 but make_fself not found]])
  122. fi],
  123. [MAKE_FSELF=no])
  124. AM_CONDITIONAL(USE_PS3, test "${ac_cv_my_have_ps3}" != "no")
  125. dnl Are we building using MinGW?
  126. LIBS_save="$LIBS"
  127. LIBS="$LIBS -mwindows -mwin32"
  128. AC_MSG_CHECKING(for -mwindows -mwin32)
  129. AC_TRY_LINK([], [],
  130. [AC_MSG_RESULT(yes)
  131. CXXFLAGS="${CXXFLAGS} -mwindows -mwin32"
  132. LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"],
  133. [AC_MSG_RESULT(no)])
  134. LIBS="$LIBS_save"
  135. dnl Are we on the Xbox 360?
  136. dnl Answer: NO! we don't know how to build for it anyway
  137. AM_CONDITIONAL(USE_X360, false)
  138. dnl Are we on a Direct3D 9 platform?
  139. #ac_cv_my_have_d3d9="no"
  140. #AC_CHECK_HEADERS(d3d9.h, [ac_cv_my_have_d3d9="yes"])
  141. #if test "${ac_cv_my_have_d3d9}" != "no"; then
  142. # D3D_LIBS="${D3D_LIBS} -ld3d9 -ld3dx9 -lxinput"
  143. # AC_DEFINE(USE_D3D9, 1, Define to 1 to use DirectX 9)
  144. #fi
  145. #AM_CONDITIONAL(USE_D3D9, test "${ac_cv_my_have_d3d9}" != "no")
  146. LOL_CHECK_OPENGL
  147. dnl Use SDL? (always required on Linux or Win32)
  148. ac_cv_my_have_sdl="no"
  149. ac_cv_my_have_sdl_image="no"
  150. ac_cv_my_have_sdl_mixer="no"
  151. dnl
  152. dnl First, try the proper pkg-config check
  153. PKG_CHECK_MODULES(SDL, sdl, [ac_cv_my_have_sdl="yes"], [:])
  154. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [ac_cv_my_have_sdl_mixer="yes"], [:])
  155. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [ac_cv_my_have_sdl_image="yes"], [:])
  156. dnl
  157. dnl Then the old sdl-config method
  158. if test "x${cross_compiling}" != xyes -a "${ac_cv_my_have_sdl}" != yes; then
  159. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  160. if test "${SDL_CONFIG}" != "no"; then
  161. SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`"
  162. SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`"
  163. ac_cv_my_have_sdl="yes"
  164. fi
  165. fi
  166. dnl
  167. dnl Maybe all this has failed, try direct inclusion
  168. save_CPPFLAGS="${CPPFLAGS}"
  169. save_LIBS="${LIBS}"
  170. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  171. LIBS="${LIBS} ${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  172. AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_sdl="yes"])
  173. AC_CHECK_HEADERS(SDL_mixer.h SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
  174. AC_CHECK_HEADERS(SDL_image.h SDL/SDL_image.h, [ac_cv_my_have_sdl_image="yes"])
  175. AC_CHECK_LIB(SDL, main,
  176. [SDL_LIBS="${SDL_LIBS} -lSDL"],
  177. [ac_cv_my_have_sdl="no"])
  178. AC_CHECK_LIB(SDLmain, main,
  179. [SDL_LIBS="${SDL_LIBS} -lSDLmain -lSDL"])
  180. AC_CHECK_LIB(SDL_mixer, main,
  181. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"],
  182. [ac_cv_my_have_sdl_mixer="no"])
  183. AC_CHECK_LIB(SDL_image, main,
  184. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"],
  185. [ac_cv_my_have_sdl_image="no"])
  186. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  187. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  188. CPPFLAGS="${save_CPPFLAGS}"
  189. LIBS="${save_LIBS}"
  190. if test "${ac_cv_my_have_sdl}" = "no"; then
  191. AC_MSG_WARN([SDL not found])
  192. else
  193. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  194. fi
  195. if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
  196. AC_MSG_WARN([SDL_mixer not found])
  197. else
  198. AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer)
  199. fi
  200. if test "${ac_cv_my_have_sdl_image}" = "no"; then
  201. AC_MSG_WARN([SDL_image not found])
  202. else
  203. AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image)
  204. fi
  205. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  206. AM_CONDITIONAL(USE_SDL_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes")
  207. AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes")
  208. dnl Use Flex's FlexLexer.h or ours?
  209. ac_cv_my_have_flexlexer_h="no"
  210. AC_LANG_PUSH(C++)
  211. AC_CHECK_HEADERS(FlexLexer.h,
  212. dnl Ensure that FlexLexer::yleng is of type int, and not size_t like
  213. dnl on recent Apple systems. It would break all our existing code.
  214. [AC_MSG_CHECKING(for FlexLexer.h validity)
  215. AC_COMPILE_IFELSE(
  216. [AC_LANG_PROGRAM([#include <FlexLexer.h>
  217. class Foo : public FlexLexer
  218. {
  219. Foo() { int &test = yyleng; }
  220. }],
  221. [])],
  222. [AC_MSG_RESULT(yes)
  223. ac_cv_my_have_flexlexer_h="yes"],
  224. [AC_MSG_RESULT(no)])])
  225. AC_LANG_POP(C++)
  226. if test "x${ac_cv_my_have_flexlexer_h}" = "xno"; then
  227. LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/external/flex-2.5.35/include"
  228. fi
  229. dnl Use NativeClient?
  230. ac_cv_my_have_nacl="no"
  231. AC_LANG_PUSH(C++)
  232. AC_CHECK_HEADERS(ppapi/cpp/instance.h,
  233. [ac_cv_my_have_nacl="yes"
  234. dnl Disable this warning, it's too verbose with vector.h
  235. CXXFLAGS="${CXXFLAGS} -Wno-sign-compare"])
  236. AC_LANG_POP(C++)
  237. AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no")
  238. dnl Use Android? FIXME: super hacks!
  239. ac_cv_my_have_android="no"
  240. AC_CHECK_LIB(log, __android_log_vprint,
  241. [ac_cv_my_have_android="yes"
  242. LOL_LIBS="${LOL_LIBS} -llog -module"])
  243. AM_CONDITIONAL(USE_ANDROID, test "${ac_cv_my_have_android}" != "no")
  244. dnl Use EGL?
  245. ac_cv_my_have_egl="no"
  246. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  247. if test "${ac_cv_my_have_egl}" != "no"; then
  248. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  249. EGL_LIBS="${EGL_LIBS} -lX11"
  250. fi
  251. AC_CHECK_LIB(EGL, main,
  252. [ac_cv_my_have_egl="yes"
  253. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  254. EGL_LIBS="-lEGL"])
  255. dnl Raspberry Pi is different, check for it with extra libs; also we
  256. dnl look for a different function to bypass autoconf caching
  257. AC_CHECK_LIB(EGL, eglGetDisplay,
  258. [ac_cv_my_have_egl="yes"
  259. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  260. EGL_LIBS="-lEGL -lvcos -lvchiq_arm -lbcm_host -lGLESv2"],
  261. [:],
  262. [-lvcos -lvchiq_arm -lbcm_host -lGLESv2])
  263. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  264. dnl Use libpng? (replacement for SDL_image)
  265. ac_cv_my_have_libpng="no"
  266. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  267. if test "${ac_cv_my_have_libpng}" != "no"; then
  268. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  269. fi
  270. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  271. dnl Use Windows GDI+?
  272. ac_cv_my_have_gdiplus="no"
  273. AC_LANG_PUSH(C++)
  274. AC_CHECK_HEADERS(gdiplus.h,
  275. [ac_cv_my_have_gdiplus="yes"
  276. LOL_LIBS="${LOL_LIBS} -lgdiplus"],
  277. [ac_cv_my_have_gdiplus="no"],
  278. [#include <algorithm>
  279. using std::min;
  280. using std::max;
  281. #include <windows.h>])
  282. AC_LANG_POP(C++)
  283. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  284. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  285. fi
  286. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  287. dnl Use libcaca? (required for font generation)
  288. ac_cv_my_have_caca="no"
  289. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  290. if test "${ac_cv_my_have_caca}" != "no"; then
  291. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  292. fi
  293. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  294. dnl Use libpipi? (required for video recording)
  295. ac_cv_my_have_pipi="no"
  296. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  297. if test "${ac_cv_my_have_pipi}" != "no"; then
  298. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  299. LOL_CFLAGS="${LOL_CFLAGS} ${PIPI_CFLAGS}"
  300. LOL_LIBS="${LOL_LIBS} ${PIPI_LIBS}"
  301. fi
  302. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  303. dnl Use GTK+? (required for the deushax editor)
  304. ac_cv_my_have_gtkgl="no"
  305. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  306. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  307. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  308. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  309. fi
  310. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  311. dnl Can we build neercs?
  312. AM_CONDITIONAL(BUILD_NEERCS, test "${ac_cv_my_have_caca}" != "no")
  313. dnl Extra libraries we may need
  314. AC_SUBST(MATH_LIBS)
  315. AC_SUBST(PAM_LIBS)
  316. AC_SUBST(UTIL_LIBS)
  317. dnl How to use the Lol Engine inside this tree
  318. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  319. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  320. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS"
  321. AC_SUBST(LOL_CFLAGS)
  322. AC_SUBST(LOL_LIBS)
  323. AC_CONFIG_FILES(
  324. [Makefile
  325. src/Makefile
  326. src/data/Makefile
  327. src/data/font/Makefile
  328. tutorial/Makefile
  329. test/Makefile
  330. test/math/Makefile
  331. test/sandbox/Makefile
  332. test/xolotl/Makefile
  333. build/Makefile
  334. binaries/Makefile
  335. people/Makefile
  336. games/Makefile
  337. tools/Makefile
  338. tools/vimlol/Makefile
  339. tools/vslol/Makefile
  340. ])
  341. AC_CONFIG_FILES(
  342. [games/monsterz/Makefile
  343. ])
  344. AC_CONFIG_FILES(
  345. [games/deushax/Makefile
  346. games/deushax/art/Makefile
  347. games/deushax/art/test/Makefile
  348. games/deushax/gfx/Makefile
  349. games/deushax/maps/Makefile
  350. ])
  351. AC_CONFIG_FILES(
  352. [games/mrpigeon/Makefile
  353. ])
  354. AC_CONFIG_FILES(
  355. [games/orbital/Makefile
  356. ])
  357. AC_CONFIG_FILES(
  358. [tools/neercs/Makefile
  359. ])
  360. AC_CONFIG_FILES(
  361. [people/jnat/Makefile
  362. people/jnat/TestProject/Makefile
  363. people/peeweek/Makefile
  364. people/touky/Makefile
  365. ])
  366. AC_OUTPUT