25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 13 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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, UTIL_LIBS="${UTIL_LIBS} -lutil")
  88. dnl Are we on the PS3?
  89. ac_cv_my_have_ps3="no"
  90. AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
  91. [ac_cv_my_have_ps3="yes"
  92. LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
  93. dnl For PSGL
  94. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
  95. GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
  96. dnl This is the old way; we now use CELL_SDK instead of CELLSDK
  97. if test "x${CELLSDK}" != x -a "x${CELL_SDK}" = x; then
  98. CELL_SDK="${CELLSDK}"
  99. fi
  100. if test "x${enable_debug}" = xyes; then
  101. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
  102. elif test "x${enable_release}" = xyes; then
  103. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
  104. else
  105. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
  106. fi
  107. dnl For the runtime Cg compiler
  108. GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
  109. dnl For the PNG decoder
  110. LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
  111. dnl For the pad library
  112. LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
  113. dnl Disable this warning, it's too verbose with vector.h
  114. CXXFLAGS="${CXXFLAGS} -Wno-sign-compare"
  115. AC_PATH_PROG(MAKE_FSELF, make_fself, no)
  116. if test "${MAKE_FSELF}" = "no"; then
  117. AC_MSG_ERROR([[Building for PS3 but make_fself not found]])
  118. fi],
  119. [MAKE_FSELF=no])
  120. AM_CONDITIONAL(USE_PS3, test "${ac_cv_my_have_ps3}" != "no")
  121. dnl Are we building using MinGW?
  122. LIBS_save="$LIBS"
  123. LIBS="$LIBS -mwindows -mwin32"
  124. AC_MSG_CHECKING(for -mwindows -mwin32)
  125. AC_TRY_LINK([], [],
  126. [AC_MSG_RESULT(yes)
  127. CXXFLAGS="${CXXFLAGS} -mwindows -mwin32"
  128. LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"],
  129. [AC_MSG_RESULT(no)])
  130. LIBS="$LIBS_save"
  131. dnl Are we on the Xbox 360?
  132. dnl Answer: NO! we don't know how to build for it anyway
  133. AM_CONDITIONAL(USE_X360, false)
  134. dnl Are we on a Direct3D 9 platform?
  135. #ac_cv_my_have_d3d9="no"
  136. #AC_CHECK_HEADERS(d3d9.h, [ac_cv_my_have_d3d9="yes"])
  137. #if test "${ac_cv_my_have_d3d9}" != "no"; then
  138. # D3D_LIBS="${D3D_LIBS} -ld3d9 -ld3dx9 -lxinput"
  139. # AC_DEFINE(USE_D3D9, 1, Define to 1 to use DirectX 9)
  140. #fi
  141. #AM_CONDITIONAL(USE_D3D9, test "${ac_cv_my_have_d3d9}" != "no")
  142. LOL_CHECK_OPENGL
  143. dnl Use SDL? (always required on Linux or Win32)
  144. ac_cv_my_have_sdl="no"
  145. ac_cv_my_have_sdl_image="no"
  146. ac_cv_my_have_sdl_mixer="no"
  147. dnl
  148. dnl First, try the proper pkg-config check
  149. PKG_CHECK_MODULES(SDL, sdl, [ac_cv_my_have_sdl="yes"], [:])
  150. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [ac_cv_my_have_sdl_mixer="yes"], [:])
  151. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [ac_cv_my_have_sdl_image="yes"], [:])
  152. dnl
  153. dnl Then the old sdl-config method
  154. if test "x${cross_compiling}" != xyes -a "${ac_cv_my_have_sdl}" != yes; then
  155. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  156. if test "${SDL_CONFIG}" != "no"; then
  157. SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`"
  158. SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`"
  159. ac_cv_my_have_sdl="yes"
  160. fi
  161. fi
  162. dnl
  163. dnl Maybe all this has failed, try direct inclusion
  164. save_CPPFLAGS="${CPPFLAGS}"
  165. save_LIBS="${LIBS}"
  166. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  167. LIBS="${LIBS} ${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  168. AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_sdl="yes"])
  169. AC_CHECK_HEADERS(SDL_mixer.h SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
  170. AC_CHECK_HEADERS(SDL_image.h SDL/SDL_image.h, [ac_cv_my_have_sdl_image="yes"])
  171. AC_CHECK_LIB(SDL, main,
  172. [SDL_LIBS="${SDL_LIBS} -lSDL"],
  173. [ac_cv_my_have_sdl="no"])
  174. AC_CHECK_LIB(SDLmain, main,
  175. [SDL_LIBS="${SDL_LIBS} -lSDLmain -lSDL"])
  176. AC_CHECK_LIB(SDL_mixer, main,
  177. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"],
  178. [ac_cv_my_have_sdl_mixer="no"])
  179. AC_CHECK_LIB(SDL_image, main,
  180. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"],
  181. [ac_cv_my_have_sdl_image="no"])
  182. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  183. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  184. CPPFLAGS="${save_CPPFLAGS}"
  185. LIBS="${save_LIBS}"
  186. if test "${ac_cv_my_have_sdl}" = "no"; then
  187. AC_MSG_WARN([SDL not found])
  188. else
  189. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  190. fi
  191. if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
  192. AC_MSG_WARN([SDL_mixer not found])
  193. else
  194. AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer)
  195. fi
  196. if test "${ac_cv_my_have_sdl_image}" = "no"; then
  197. AC_MSG_WARN([SDL_image not found])
  198. else
  199. AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image)
  200. fi
  201. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  202. AM_CONDITIONAL(USE_SDL_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes")
  203. AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes")
  204. dnl Use Flex's FlexLexer.h or ours?
  205. ac_cv_my_have_flexlexer_h="no"
  206. AC_LANG_PUSH(C++)
  207. AC_CHECK_HEADERS(FlexLexer.h,
  208. dnl Ensure that FlexLexer::yleng is of type int, and not size_t like
  209. dnl on recent Apple systems. It would break all our existing code.
  210. [AC_MSG_CHECKING(for FlexLexer.h validity)
  211. AC_COMPILE_IFELSE(
  212. [AC_LANG_PROGRAM([#include <FlexLexer.h>
  213. class Foo : public FlexLexer
  214. {
  215. Foo() { int &test = yyleng; }
  216. }],
  217. [])],
  218. [AC_MSG_RESULT(yes)
  219. ac_cv_my_have_flexlexer_h="yes"],
  220. [AC_MSG_RESULT(no)])])
  221. AC_LANG_POP(C++)
  222. if test "x${ac_cv_my_have_flexlexer_h}" = "xno"; then
  223. LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/external/flex-2.5.35/include"
  224. fi
  225. dnl Use NativeClient?
  226. ac_cv_my_have_nacl="no"
  227. AC_LANG_PUSH(C++)
  228. AC_CHECK_HEADERS(ppapi/cpp/instance.h,
  229. [ac_cv_my_have_nacl="yes"
  230. dnl Disable this warning, it's too verbose with vector.h
  231. CXXFLAGS="${CXXFLAGS} -Wno-sign-compare"])
  232. AC_LANG_POP(C++)
  233. AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no")
  234. dnl Use Android? FIXME: super hacks!
  235. ac_cv_my_have_android="no"
  236. AC_CHECK_LIB(log, __android_log_vprint,
  237. [ac_cv_my_have_android="yes"
  238. LOL_LIBS="${LOL_LIBS} -llog -module"])
  239. AM_CONDITIONAL(USE_ANDROID, test "${ac_cv_my_have_android}" != "no")
  240. dnl Use EGL?
  241. ac_cv_my_have_egl="no"
  242. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  243. if test "${ac_cv_my_have_egl}" != "no"; then
  244. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  245. EGL_LIBS="${EGL_LIBS} -lX11"
  246. fi
  247. AC_CHECK_LIB(EGL, main,
  248. [ac_cv_my_have_egl="yes"
  249. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  250. EGL_LIBS="-lEGL"])
  251. dnl Raspberry Pi is different, check for it with extra libs; also we
  252. dnl look for a different function to bypass autoconf caching
  253. AC_CHECK_LIB(EGL, eglGetDisplay,
  254. [ac_cv_my_have_egl="yes"
  255. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  256. EGL_LIBS="-lEGL -lvcos -lvchiq_arm -lbcm_host -lGLESv2"],
  257. [:],
  258. [-lvcos -lvchiq_arm -lbcm_host -lGLESv2])
  259. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  260. dnl Use libpng? (replacement for SDL_image)
  261. ac_cv_my_have_libpng="no"
  262. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  263. if test "${ac_cv_my_have_libpng}" != "no"; then
  264. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  265. fi
  266. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  267. dnl Use Windows GDI+?
  268. ac_cv_my_have_gdiplus="no"
  269. AC_LANG_PUSH(C++)
  270. AC_CHECK_HEADERS(gdiplus.h,
  271. [ac_cv_my_have_gdiplus="yes"
  272. LOL_LIBS="${LOL_LIBS} -lgdiplus"],
  273. [ac_cv_my_have_gdiplus="no"],
  274. [#include <algorithm>
  275. using std::min;
  276. using std::max;
  277. #include <windows.h>])
  278. AC_LANG_POP(C++)
  279. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  280. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  281. fi
  282. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  283. dnl Use libcaca? (required for font generation)
  284. ac_cv_my_have_caca="no"
  285. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  286. if test "${ac_cv_my_have_caca}" != "no"; then
  287. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  288. fi
  289. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  290. dnl Use libpipi? (required for video recording)
  291. ac_cv_my_have_pipi="no"
  292. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  293. if test "${ac_cv_my_have_pipi}" != "no"; then
  294. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  295. fi
  296. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  297. dnl Use GTK+? (required for the deushax editor)
  298. ac_cv_my_have_gtkgl="no"
  299. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  300. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  301. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  302. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  303. fi
  304. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  305. dnl Can we build neercs?
  306. AM_CONDITIONAL(BUILD_NEERCS, test "${ac_cv_my_have_caca}" != "no" -a "${ac_cv_header_glob_h}" = "yes")
  307. dnl Extra libraries we may need
  308. AC_SUBST(MATH_LIBS)
  309. AC_SUBST(PAM_LIBS)
  310. AC_SUBST(UTIL_LIBS)
  311. dnl How to use the Lol Engine inside this tree
  312. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  313. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  314. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS"
  315. AC_SUBST(LOL_CFLAGS)
  316. AC_SUBST(LOL_LIBS)
  317. AC_CONFIG_FILES(
  318. [Makefile
  319. src/Makefile
  320. src/data/Makefile
  321. src/data/font/Makefile
  322. tutorial/Makefile
  323. test/Makefile
  324. test/math/Makefile
  325. test/sandbox/Makefile
  326. test/xolotl/Makefile
  327. build/Makefile
  328. binaries/Makefile
  329. people/Makefile
  330. games/Makefile
  331. tools/Makefile
  332. tools/vimlol/Makefile
  333. tools/vslol/Makefile
  334. ])
  335. AC_CONFIG_FILES(
  336. [games/monsterz/Makefile
  337. ])
  338. AC_CONFIG_FILES(
  339. [games/deushax/Makefile
  340. games/deushax/art/Makefile
  341. games/deushax/art/test/Makefile
  342. games/deushax/gfx/Makefile
  343. games/deushax/maps/Makefile
  344. ])
  345. AC_CONFIG_FILES(
  346. [games/mrpigeon/Makefile
  347. ])
  348. AC_CONFIG_FILES(
  349. [games/orbital/Makefile
  350. ])
  351. AC_CONFIG_FILES(
  352. [tools/neercs/Makefile
  353. ])
  354. AC_CONFIG_FILES(
  355. [people/jnat/Makefile
  356. people/jnat/TestProject/Makefile
  357. people/peeweek/Makefile
  358. people/touky/Makefile
  359. ])
  360. AC_OUTPUT