Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

448 строки
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. AC_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_ARG_ENABLE(doc,
  58. [ --enable-doc build documentation (needs doxygen and LaTeX)])
  59. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
  60. AC_CHECK_HEADERS(fastmath.h pthread.h libutil.h util.h pty.h glob.h unistd.h)
  61. AC_CHECK_HEADERS(sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h)
  62. AC_CHECK_HEADERS(sys/wait.h)
  63. AC_CHECK_HEADERS(linux/kdev_t.h linux/major.h)
  64. AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h)
  65. AC_CHECK_HEADERS(pam/pam_appl.h pam/pam_misc.h)
  66. AC_CHECK_FUNCS(getcwd _getcwd)
  67. if test "${enable_debug}" = "yes"; then
  68. AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
  69. OPT="-O"
  70. else
  71. OPT="-O3 -ffast-math -fno-strength-reduce -fomit-frame-pointer"
  72. fi
  73. if test "${enable_release}" = "yes"; then
  74. AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release)
  75. REL=""
  76. else
  77. REL="-g"
  78. fi
  79. if test "${enable_experimental}" = "yes"; then
  80. AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build)
  81. fi
  82. # Build documentation?
  83. DOXYGEN="no"
  84. LATEX="no"
  85. if test "${enable_doc}" != "no"; then
  86. AC_PATH_PROG(DOXYGEN, doxygen, no)
  87. if test "${DOXYGEN}" != "no"; then
  88. # Build LaTeX documentation?
  89. AC_PATH_PROG(LATEX, pdflatex, no)
  90. AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
  91. AC_PATH_PROG(DVIPS, dvips, no)
  92. if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
  93. LATEX="no"
  94. fi
  95. if test "${LATEX}" != "no"; then
  96. AC_MSG_CHECKING(for a4.sty and a4wide.sty)
  97. if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
  98. if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
  99. AC_MSG_RESULT(yes)
  100. else
  101. LATEX="no"
  102. AC_MSG_RESULT(no)
  103. fi
  104. else
  105. LATEX="no"
  106. AC_MSG_RESULT(no)
  107. fi
  108. fi
  109. AC_PATH_PROG(DOT, dot, no)
  110. if test "${DOT}" != "no"; then
  111. USE_DOT="YES"
  112. else
  113. USE_DOT="NO"
  114. fi
  115. fi
  116. fi
  117. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  118. AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
  119. AM_CONDITIONAL(USE_DOT, test "${DOT}" != "no")
  120. dnl No exceptions
  121. LOL_TRY_CXXFLAGS(-fno-exceptions, [AM_CXXFLAGS="${AM_CXXFLAGS} -fno-exceptions"])
  122. LOL_TRY_CXXFLAGS(-fno-rtti, [AM_CXXFLAGS="${AM_CXXFLAGS} -fno-rtti"])
  123. dnl Optimizations
  124. AM_CXXFLAGS="${AM_CXXFLAGS} ${REL} ${OPT}"
  125. dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  126. LOL_TRY_CXXFLAGS(-Wall, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wall"])
  127. LOL_TRY_CXXFLAGS(-Wextra, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wextra"])
  128. LOL_TRY_CXXFLAGS(-Wpointer-arith, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wpointer-arith"])
  129. LOL_TRY_CXXFLAGS(-Wcast-align, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wcast-align"])
  130. LOL_TRY_CXXFLAGS(-Wcast-qual, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wcast-qual"])
  131. LOL_TRY_CXXFLAGS(-Wshadow, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wshadow"])
  132. LOL_TRY_CXXFLAGS(-Wsign-compare, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wsign-compare"])
  133. dnl Add these even though they're implicitly set, so that we can safely
  134. dnl remove them from within a Makefile.
  135. LOL_TRY_CXXFLAGS(-Wno-maybe-uninitialized, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wno-maybe-uninitialized"])
  136. LOL_TRY_CXXFLAGS(-Wno-narrowing, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wno-narrowing"])
  137. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  138. AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
  139. AC_CHECK_LIB(util, forkpty,
  140. [UTIL_LIBS="${UTIL_LIBS} -lutil"
  141. dnl Override future forkpty detection
  142. ac_cv_func_forkpty="yes"])
  143. AC_CHECK_FUNCS(forkpty)
  144. dnl Are we on the PS3?
  145. ac_cv_my_have_ps3="no"
  146. AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
  147. [ac_cv_my_have_ps3="yes"
  148. LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
  149. dnl For PSGL
  150. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
  151. GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
  152. dnl This is the old way; we now use CELL_SDK instead of CELLSDK
  153. if test "x${CELLSDK}" != x -a "x${CELL_SDK}" = x; then
  154. CELL_SDK="${CELLSDK}"
  155. fi
  156. if test "x${enable_debug}" = xyes; then
  157. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
  158. elif test "x${enable_release}" = xyes; then
  159. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
  160. else
  161. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
  162. fi
  163. dnl For the runtime Cg compiler
  164. GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
  165. dnl For the PNG decoder
  166. LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
  167. dnl For the pad library
  168. LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
  169. dnl Disable this warning, it's too verbose with vector.h
  170. AM_CXXFLAGS="${AM_CXXFLAGS} -Wno-sign-compare"
  171. AC_PATH_PROG(MAKE_FSELF, make_fself, no)
  172. if test "${MAKE_FSELF}" = "no"; then
  173. AC_MSG_ERROR([[Building for PS3 but make_fself not found]])
  174. fi],
  175. [MAKE_FSELF=no])
  176. AM_CONDITIONAL(USE_PS3, test "${ac_cv_my_have_ps3}" != "no")
  177. dnl Are we building using MinGW?
  178. LIBS_save="$LIBS"
  179. LIBS="$LIBS -mwindows -mwin32"
  180. AC_MSG_CHECKING(for -mwindows -mwin32)
  181. AC_TRY_LINK([], [],
  182. [AC_MSG_RESULT(yes)
  183. AM_CXXFLAGS="${AM_CXXFLAGS} -mwindows -mwin32"
  184. LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"],
  185. [AC_MSG_RESULT(no)])
  186. LIBS="$LIBS_save"
  187. dnl Are we on the Xbox 360?
  188. dnl Answer: NO! we don't know how to build for it anyway
  189. AM_CONDITIONAL(USE_X360, false)
  190. dnl Are we on a Direct3D 9 platform?
  191. #ac_cv_my_have_d3d9="no"
  192. #AC_CHECK_HEADERS(d3d9.h, [ac_cv_my_have_d3d9="yes"])
  193. #if test "${ac_cv_my_have_d3d9}" != "no"; then
  194. # D3D_LIBS="${D3D_LIBS} -ld3d9 -ld3dx9 -lxinput"
  195. # AC_DEFINE(USE_D3D9, 1, Define to 1 to use DirectX 9)
  196. #fi
  197. #AM_CONDITIONAL(USE_D3D9, test "${ac_cv_my_have_d3d9}" != "no")
  198. LOL_CHECK_OPENGL
  199. LOL_CHECK_SDL
  200. dnl Use Flex's FlexLexer.h or ours?
  201. ac_cv_my_have_flexlexer_h="no"
  202. AC_LANG_PUSH(C++)
  203. AC_CHECK_HEADERS(FlexLexer.h,
  204. dnl Ensure that FlexLexer::yleng is of type int, and not size_t like
  205. dnl on recent Apple systems. It would break all our existing code.
  206. [AC_MSG_CHECKING(for FlexLexer.h validity)
  207. AC_COMPILE_IFELSE(
  208. [AC_LANG_PROGRAM([#include <FlexLexer.h>
  209. class Foo : public FlexLexer
  210. {
  211. Foo() { int &test = yyleng; }
  212. }],
  213. [])],
  214. [AC_MSG_RESULT(yes)
  215. ac_cv_my_have_flexlexer_h="yes"],
  216. [AC_MSG_RESULT(no)])])
  217. AC_LANG_POP(C++)
  218. if test "x${ac_cv_my_have_flexlexer_h}" = "xno"; then
  219. LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/external/flex-2.5.35/include"
  220. fi
  221. dnl Use NativeClient?
  222. ac_cv_my_have_nacl="no"
  223. AC_LANG_PUSH(C++)
  224. AC_CHECK_HEADERS(ppapi/cpp/instance.h,
  225. [ac_cv_my_have_nacl="yes"
  226. dnl Disable this warning, it's too verbose with vector.h
  227. AM_CXXFLAGS="${AM_CXXFLAGS} -Wno-sign-compare"])
  228. AC_LANG_POP(C++)
  229. AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no")
  230. dnl Use Android? FIXME: super hacks!
  231. ac_cv_my_have_android="no"
  232. AC_CHECK_LIB(log, __android_log_vprint,
  233. [ac_cv_my_have_android="yes"
  234. LOL_LIBS="${LOL_LIBS} -llog -module"])
  235. AM_CONDITIONAL(USE_ANDROID, test "${ac_cv_my_have_android}" != "no")
  236. dnl Use EGL?
  237. ac_cv_my_have_egl="no"
  238. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  239. if test "${ac_cv_my_have_egl}" != "no"; then
  240. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  241. EGL_LIBS="${EGL_LIBS} -lX11"
  242. fi
  243. AC_CHECK_LIB(EGL, main,
  244. [ac_cv_my_have_egl="yes"
  245. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  246. EGL_LIBS="-lEGL"])
  247. dnl Raspberry Pi is different, check for it with extra libs; also we
  248. dnl look for a different function to bypass autoconf caching
  249. AC_CHECK_LIB(EGL, eglGetDisplay,
  250. [ac_cv_my_have_egl="yes"
  251. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  252. EGL_LIBS="-lEGL -lvcos -lvchiq_arm -lbcm_host -lGLESv2"],
  253. [:],
  254. [-lvcos -lvchiq_arm -lbcm_host -lGLESv2])
  255. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  256. dnl Use libpng? (replacement for SDL_image)
  257. ac_cv_my_have_libpng="no"
  258. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  259. if test "${ac_cv_my_have_libpng}" != "no"; then
  260. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  261. fi
  262. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  263. dnl Use Windows GDI+?
  264. ac_cv_my_have_gdiplus="no"
  265. AC_LANG_PUSH(C++)
  266. AC_CHECK_HEADERS(gdiplus.h,
  267. [ac_cv_my_have_gdiplus="yes"
  268. LOL_LIBS="${LOL_LIBS} -lgdiplus"],
  269. [ac_cv_my_have_gdiplus="no"],
  270. [#include <algorithm>
  271. using std::min;
  272. using std::max;
  273. #include <windows.h>])
  274. AC_LANG_POP(C++)
  275. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  276. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  277. fi
  278. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  279. dnl Use libcaca? (required for font generation)
  280. ac_cv_my_have_caca="no"
  281. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  282. if test "${ac_cv_my_have_caca}" != "no"; then
  283. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  284. fi
  285. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  286. dnl Use libpipi? (required for video recording)
  287. ac_cv_my_have_pipi="no"
  288. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  289. if test "${ac_cv_my_have_pipi}" != "no"; then
  290. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  291. LOL_CFLAGS="${LOL_CFLAGS} ${PIPI_CFLAGS}"
  292. LOL_LIBS="${LOL_LIBS} ${PIPI_LIBS}"
  293. fi
  294. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  295. dnl Use GTK+? (required for the deushax editor)
  296. ac_cv_my_have_gtkgl="no"
  297. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  298. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  299. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  300. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  301. fi
  302. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  303. dnl Can we build neercs?
  304. AM_CONDITIONAL(BUILD_NEERCS, test "${ac_cv_my_have_caca}" != "no")
  305. dnl Extra libraries we may need
  306. AC_SUBST(MATH_LIBS)
  307. AC_SUBST(PAM_LIBS)
  308. AC_SUBST(UTIL_LIBS)
  309. dnl How to use the Lol Engine outside this tree
  310. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  311. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS"
  312. LOL_DEPENDENCIES="${LOL_DEPENDENCIES} \$(top_builddir)/src/liblolcore.a"
  313. LOL_DEPENDENCIES="${LOL_DEPENDENCIES} \$(top_builddir)/src/bullet/liblolbullet.a"
  314. dnl How to use the Lol Engine inside this tree
  315. AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/src"
  316. AM_CPPFLAGS="${AM_CPPFLAGS} -DLOL_SOURCE_SUBDIR=\\\"\$(subdir)\\\""
  317. AM_CPPFLAGS="${AM_CPPFLAGS} ${LOL_CFLAGS}"
  318. AM_LDFLAGS="${AM_LDFLAGS} ${LOL_DEPENDENCIES}"
  319. AM_LDFLAGS="${AM_LDFLAGS} ${LOL_LIBS}"
  320. dnl Extra flags
  321. AC_SUBST(LOL_CFLAGS)
  322. AC_SUBST(LOL_LIBS)
  323. AC_SUBST(LOL_DEPENDENCIES)
  324. AC_SUBST(AM_CFLAGS)
  325. AC_SUBST(AM_CPPFLAGS)
  326. AC_SUBST(AM_CXXFLAGS)
  327. AC_SUBST(AM_LDFLAGS)
  328. AC_SUBST(USE_DOT)
  329. AC_CONFIG_FILES(
  330. [Makefile
  331. src/Makefile
  332. src/bullet/Makefile
  333. src/data/Makefile
  334. src/data/font/Makefile
  335. tutorial/Makefile
  336. test/Makefile
  337. test/math/Makefile
  338. test/sandbox/Makefile
  339. test/xolotl/Makefile
  340. build/Makefile
  341. binaries/Makefile
  342. people/Makefile
  343. games/Makefile
  344. tools/Makefile
  345. tools/vimlol/Makefile
  346. tools/vslol/Makefile
  347. doc/Makefile
  348. doc/doxygen.cfg
  349. ])
  350. AC_CONFIG_FILES(
  351. [games/monsterz/Makefile
  352. ])
  353. AC_CONFIG_FILES(
  354. [games/deushax/Makefile
  355. games/deushax/art/Makefile
  356. games/deushax/art/test/Makefile
  357. games/deushax/gfx/Makefile
  358. games/deushax/maps/Makefile
  359. ])
  360. AC_CONFIG_FILES(
  361. [games/mrpigeon/Makefile
  362. ])
  363. AC_CONFIG_FILES(
  364. [games/orbital/Makefile
  365. ])
  366. AC_CONFIG_FILES(
  367. [tools/neercs/Makefile
  368. ])
  369. AC_CONFIG_FILES(
  370. [people/jnat/Makefile
  371. people/jnat/TestProject/Makefile
  372. people/peeweek/Makefile
  373. people/peeweek/private/Makefile
  374. people/touky/Makefile
  375. people/touky/private/Makefile
  376. people/jylam/Makefile
  377. people/jylam/private/Makefile
  378. people/jylam/private/chat/Makefile
  379. ])
  380. AC_OUTPUT