Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

configure.ac 19 KiB

11 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  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. dnl Check that the C++ compiler really works
  21. AC_LANG_PUSH(C++)
  22. AC_MSG_CHECKING(for a fully working C++ compiler)
  23. AC_TRY_LINK([], [],
  24. [AC_MSG_RESULT(yes)],
  25. [AC_MSG_RESULT(no)
  26. AC_MSG_ERROR([[C++ compiler cannot link executables]])])
  27. AC_LANG_POP(C++)
  28. dnl C++11 mode. Checked early so that we don't run into surprises.
  29. LOL_TRY_CXXFLAGS(-std=c++11,
  30. [AM_CXXFLAGS="${AM_CXXFLAGS} -std=c++11"
  31. CXXFLAGS="${CXXFLAGS} -std=c++11"])
  32. LOL_TRY_CXXFLAGS(-std=c++0x,
  33. [AM_CXXFLAGS="${AM_CXXFLAGS} -std=c++0x"
  34. CXXFLAGS="${CXXFLAGS} -std=c++0x"])
  35. AC_LANG_PUSH(C++)
  36. AC_MSG_CHECKING(for C++11 enum class support)
  37. AC_TRY_LINK([], [enum class Foo : int { Bar, Baz };],
  38. [AC_MSG_RESULT(yes)],
  39. [AC_MSG_RESULT(no)
  40. AC_MSG_ERROR([[C++ compiler does not support C++11 enum classes]])])
  41. AC_LANG_POP(C++)
  42. AC_LIBTOOL_WIN32_DLL
  43. AM_PROG_LIBTOOL
  44. AC_LIBTOOL_CXX
  45. AC_C_CONST
  46. AC_C_INLINE
  47. dnl Ensure an error is thrown if pkg-config M4 files are not found.
  48. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  49. m4_pattern_forbid([^PKG_CHECK_MODULES$])
  50. m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])
  51. dnl Same for Lol Engine M4 files.
  52. m4_pattern_forbid([^LOL_])
  53. dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling.
  54. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  55. export PKG_CONFIG_LIBDIR=/dev/null
  56. fi
  57. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  58. dnl now otherwise it might be set in an obscure if statement. Same thing for
  59. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  60. AC_EGREP_CPP(yes, foo)
  61. PKG_PROG_PKG_CONFIG()
  62. dnl Check for a working implementation of sed
  63. AC_PROG_SED
  64. AC_MSG_CHECKING(for a sed that understands \t)
  65. if test "$(echo 'x\x' | "${SED}" 's/.*@<:@^x\t@:>@//')" != x; then
  66. AC_MSG_RESULT(no)
  67. AC_MSG_ERROR([[consider installing GNU sed]])
  68. else
  69. AC_MSG_RESULT(yes)
  70. fi
  71. dnl conditional builds
  72. AC_ARG_ENABLE(debug,
  73. [ --enable-debug build debug versions of the game (default no)])
  74. AC_ARG_ENABLE(release,
  75. [ --enable-release build final release of the game (default no)])
  76. AC_ARG_ENABLE(experimental,
  77. [ --enable-experimental experimental build (default no)])
  78. AC_ARG_ENABLE(doc,
  79. [ --enable-doc build documentation (needs doxygen and LaTeX)])
  80. dnl Common C headers
  81. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h math.h)
  82. AC_CHECK_HEADERS(fastmath.h pthread.h libutil.h util.h pty.h glob.h unistd.h io.h)
  83. AC_CHECK_HEADERS(execinfo.h)
  84. AC_CHECK_HEADERS(sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h)
  85. AC_CHECK_HEADERS(sys/wait.h sys/time.h sys/types.h)
  86. AC_CHECK_HEADERS(linux/kdev_t.h linux/major.h)
  87. AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h)
  88. AC_CHECK_HEADERS(pam/pam_appl.h pam/pam_misc.h)
  89. dnl Common C++ headers
  90. AC_LANG_PUSH(C++)
  91. AC_CHECK_HEADERS(cxxabi.h)
  92. AC_LANG_POP(C++)
  93. dnl Common C functions
  94. AC_CHECK_FUNCS(getenv system tmpfile tmpnam getcwd _getcwd getlogin)
  95. AC_CHECK_FUNCS(backtrace_symbols)
  96. AC_CHECK_FUNCS(gettimeofday usleep)
  97. dnl Build mode
  98. ac_cv_my_build_mode="devel"
  99. if test "x${enable_release}" = "xyes"; then
  100. ac_cv_my_build_mode="release"
  101. fi
  102. if test "x${enable_devel}" = "xyes"; then
  103. ac_cv_my_build_mode="devel"
  104. fi
  105. if test "x${enable_debug}" = "xyes"; then
  106. ac_cv_my_build_mode="debug"
  107. fi
  108. if test "x${ac_cv_my_build_mode}" = "xdebug"; then
  109. AC_DEFINE(LOL_BUILD_DEBUG, 1, Define to 1 to activate debug build)
  110. LOL_TRY_CXXFLAGS(-O, [AM_CXXFLAGS="${AM_CXXFLAGS} -O"])
  111. LOL_TRY_CXXFLAGS(-g, [AM_CXXFLAGS="${AM_CXXFLAGS} -g"])
  112. elif test "x${ac_cv_my_build_mode}" = "xdevel"; then
  113. AC_DEFINE(LOL_BUILD_DEVEL, 1, Define to 1 to activate development build)
  114. LOL_TRY_CXXFLAGS(-Os, [AM_CXXFLAGS="${AM_CXXFLAGS} -Os"])
  115. LOL_TRY_CXXFLAGS(-g, [AM_CXXFLAGS="${AM_CXXFLAGS} -g"])
  116. LOL_TRY_CXXFLAGS(-ffast-math, [AM_CXXFLAGS="${AM_CXXFLAGS} -ffast-math"])
  117. else
  118. AC_DEFINE(LOL_BUILD_RELEASE, 1, Define to 1 to activate final release)
  119. LOL_TRY_CXXFLAGS(-Os, [AM_CXXFLAGS="${AM_CXXFLAGS} -Os"])
  120. LOL_TRY_CXXFLAGS(-ffast-math, [AM_CXXFLAGS="${AM_CXXFLAGS} -ffast-math"])
  121. dnl Removed this so .nexe build ok.
  122. dnl LOL_TRY_CXXFLAGS(-fomit-frame-pointer, [AM_CXXFLAGS="${AM_CXXFLAGS} -fomit-frame-pointer"])
  123. dnl LOL_TRY_CXXFLAGS(-fno-strength-reduce, [AM_CXXFLAGS="${AM_CXXFLAGS} -fno-strength-reduce"])
  124. fi
  125. dnl Build documentation?
  126. DOXYGEN="no"
  127. LATEX="no"
  128. if test "${enable_doc}" != "no"; then
  129. AC_PATH_PROG(DOXYGEN, doxygen, no)
  130. if test "${DOXYGEN}" != "no"; then
  131. # Build LaTeX documentation?
  132. AC_PATH_PROG(LATEX, pdflatex, no)
  133. AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
  134. AC_PATH_PROG(DVIPS, dvips, no)
  135. if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
  136. LATEX="no"
  137. fi
  138. if test "${LATEX}" != "no"; then
  139. AC_MSG_CHECKING(for a4.sty and a4wide.sty)
  140. if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
  141. if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
  142. AC_MSG_RESULT(yes)
  143. else
  144. LATEX="no"
  145. AC_MSG_RESULT(no)
  146. fi
  147. else
  148. LATEX="no"
  149. AC_MSG_RESULT(no)
  150. fi
  151. fi
  152. AC_PATH_PROG(DOT, dot, no)
  153. if test "${DOT}" != "no"; then
  154. USE_DOT="YES"
  155. else
  156. USE_DOT="NO"
  157. fi
  158. fi
  159. fi
  160. dnl XXX: disable LaTeX because we use too much memory
  161. LATEX=no
  162. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  163. AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
  164. AM_CONDITIONAL(USE_DOT, test "${DOT}" != "no")
  165. dnl No exceptions…
  166. LOL_TRY_CXXFLAGS(-fno-exceptions, [AM_CXXFLAGS="${AM_CXXFLAGS} -fno-exceptions"])
  167. LOL_TRY_CXXFLAGS(-fno-rtti, [AM_CXXFLAGS="${AM_CXXFLAGS} -fno-rtti"])
  168. dnl Debug symbols
  169. LOL_TRY_LDFLAGS(-rdynamic, [AM_LDFLAGS="${AM_LDFLAGS} -rdynamic"])
  170. dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  171. LOL_TRY_CXXFLAGS(-Wall, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wall"])
  172. LOL_TRY_CXXFLAGS(-Wextra, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wextra"])
  173. LOL_TRY_CXXFLAGS(-Wpointer-arith, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wpointer-arith"])
  174. LOL_TRY_CXXFLAGS(-Wcast-align, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wcast-align"])
  175. LOL_TRY_CXXFLAGS(-Wcast-qual, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wcast-qual"])
  176. LOL_TRY_CXXFLAGS(-Wshadow, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wshadow"])
  177. LOL_TRY_CXXFLAGS(-Wsign-compare, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wsign-compare"])
  178. LOL_TRY_CXXFLAGS(-Wstrict-overflow=1, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wstrict-overflow=1"])
  179. dnl Add these even though they're implicitly set, so that we can safely
  180. dnl remove them from within a Makefile.
  181. LOL_TRY_CXXFLAGS(-Wmaybe-uninitialized, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wmaybe-uninitialized"])
  182. LOL_TRY_CXXFLAGS(-Wnarrowing, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wnarrowing"])
  183. LOL_TRY_CXXFLAGS(-Wunused, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wunused"])
  184. LOL_TRY_CXXFLAGS(-Wstrict-aliasing, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wstrict-aliasing"])
  185. LOL_TRY_CXXFLAGS(-Wparentheses, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wparentheses"])
  186. LOL_TRY_CXXFLAGS(-Wreorder, [AM_CXXFLAGS="${AM_CXXFLAGS} -Wreorder"])
  187. dnl Disable these warnings because they're annoyingly verbose
  188. LOL_TRY_CXXFLAGS(-Wno-psabi, [AM_CPPFLAGS="${AM_CPPFLAGS} -Wno-psabi"])
  189. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  190. AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
  191. dnl Unix-specific libutil
  192. AC_CHECK_LIB(util, forkpty,
  193. [UTIL_LIBS="${UTIL_LIBS} -lutil"
  194. dnl Override future forkpty detection
  195. ac_cv_func_forkpty="yes"])
  196. AC_CHECK_FUNCS(forkpty)
  197. dnl GCC-specific symbol demangling
  198. AC_LANG_PUSH(C++)
  199. AC_TRY_LINK(
  200. [#include <cxxabi.h>],
  201. [abi::__cxa_demangle(NULL, 0, 0, NULL);],
  202. [AC_DEFINE(HAVE_CXA_DEMANGLE, 1, Define to 1 if abi::__cxa_demangle is available)])
  203. AC_LANG_POP(C++)
  204. dnl Are we on the PS3?
  205. ac_cv_my_have_ps3="no"
  206. AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
  207. [ac_cv_my_have_ps3="yes"
  208. LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
  209. dnl For PSGL
  210. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
  211. GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
  212. dnl This is the old way; we now use CELL_SDK instead of CELLSDK
  213. if test "x${CELLSDK}" != x -a "x${CELL_SDK}" = x; then
  214. CELL_SDK="${CELLSDK}"
  215. fi
  216. if test "x${enable_debug}" = xyes; then
  217. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
  218. elif test "x${enable_release}" = xyes; then
  219. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
  220. else
  221. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
  222. fi
  223. dnl For the runtime Cg compiler
  224. GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
  225. dnl For the PNG decoder
  226. LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
  227. dnl For the pad library
  228. LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
  229. dnl For the audio library
  230. LOL_LIBS="${LOL_LIBS} -laudio_stub -lspurs_stub -lmstreamSPURSMP3"
  231. dnl For the filesystem support
  232. LOL_LIBS="${LOL_LIBS} -lfs_stub"
  233. dnl Disable this warning, it's too verbose with vector.h
  234. AM_CXXFLAGS="${AM_CXXFLAGS} -Wno-sign-compare"
  235. AC_PATH_PROG(MAKE_FSELF, make_fself, no)
  236. if test "${MAKE_FSELF}" = "no"; then
  237. AC_MSG_ERROR([[Building for PS3 but make_fself not found]])
  238. fi],
  239. [MAKE_FSELF=no])
  240. AM_CONDITIONAL(USE_PS3, test "${ac_cv_my_have_ps3}" != "no")
  241. dnl Are we building using MinGW?
  242. LOL_TRY_CXXFLAGS(-mwindows -mwin32,
  243. [AM_CXXFLAGS="${AM_CXXFLAGS} -mwindows -mwin32"
  244. LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"])
  245. dnl Are we building using Emscripten?
  246. ac_cv_my_have_emscripten="no"
  247. AC_CHECK_HEADERS(emscripten.h,
  248. [ac_cv_my_have_emscripten="yes"
  249. dnl XXX: activate this if memory heap is too small
  250. #AM_CXXFLAGS="${AM_CXXFLAGS} -s ALLOW_MEMORY_GROWTH=1"
  251. dnl HACK: until emcc properly adds these to EMSDK_OPTS
  252. CPPFLAGS="${CPPFLAGS} -U__i386__ -U__x86_64__ -U__i386 -U__x86_64 -Ui386 -Ux86_64"
  253. CPPFLAGS="${CPPFLAGS} -U__SSE__ -U__SSE2__ -U__MMX__ -UX87_DOUBLE_ROUNDING"
  254. CPPFLAGS="${CPPFLAGS} -UHAVE_GCC_ASM_FOR_X87 -DEMSCRIPTEN -U__STRICT_ANSI__"
  255. CPPFLAGS="${CPPFLAGS} -U__CYGWIN__"])
  256. AM_CONDITIONAL(USE_EMSCRIPTEN, test "${ac_cv_my_have_emscripten}" != "no")
  257. dnl Are we on the Xbox 360?
  258. dnl Answer: NO! we don't know how to build for it anyway
  259. AM_CONDITIONAL(USE_X360, false)
  260. dnl Are we on an OS X or iOS platform?
  261. LOL_TRY_LDFLAGS(-framework Foundation,
  262. [LOL_LIBS="${LOL_LIBS} -framework Foundation"])
  263. LOL_TRY_LDFLAGS(-framework CoreGraphics,
  264. [LOL_LIBS="${LOL_LIBS} -framework CoreGraphics"])
  265. LOL_TRY_LDFLAGS(-framework CoreData,
  266. [LOL_LIBS="${LOL_LIBS} -framework CoreData"])
  267. LOL_TRY_LDFLAGS(-framework UIKit,
  268. [LOL_LIBS="${LOL_LIBS} -framework UIKit"])
  269. dnl Are we on a Direct3D 9 platform?
  270. #ac_cv_my_have_d3d9="no"
  271. #AC_CHECK_HEADERS(d3d9.h, [ac_cv_my_have_d3d9="yes"])
  272. #if test "${ac_cv_my_have_d3d9}" != "no"; then
  273. # D3D_LIBS="${D3D_LIBS} -ld3d9 -ld3dx9 -lxinput"
  274. # AC_DEFINE(USE_D3D9, 1, Define to 1 to use DirectX 9)
  275. #fi
  276. #AM_CONDITIONAL(USE_D3D9, test "${ac_cv_my_have_d3d9}" != "no")
  277. LOL_CHECK_OPENGL
  278. LOL_CHECK_SDL
  279. dnl Use Flex's FlexLexer.h or ours?
  280. ac_cv_my_have_flexlexer_h="no"
  281. AC_LANG_PUSH(C++)
  282. AC_CHECK_HEADERS(FlexLexer.h,
  283. dnl Ensure that FlexLexer::yleng is of type int, and not size_t like
  284. dnl on recent Apple systems. It would break all our existing code.
  285. [AC_MSG_CHECKING(for FlexLexer.h validity)
  286. AC_COMPILE_IFELSE(
  287. [AC_LANG_PROGRAM([#include <FlexLexer.h>
  288. class Foo : public FlexLexer
  289. {
  290. Foo() { int &test = yyleng; }
  291. };],
  292. [])],
  293. [AC_MSG_RESULT(yes)
  294. ac_cv_my_have_flexlexer_h="yes"],
  295. [AC_MSG_RESULT(no)])])
  296. AC_LANG_POP(C++)
  297. if test "x${ac_cv_my_have_flexlexer_h}" = "xno"; then
  298. LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/external/flex-2.5.35/include"
  299. fi
  300. dnl Use NativeClient?
  301. ac_cv_my_have_nacl="no"
  302. AC_LANG_PUSH(C++)
  303. AC_CHECK_HEADERS(ppapi/cpp/instance.h,
  304. [ac_cv_my_have_nacl="yes"
  305. LOL_LIBS="${LOL_LIBS} -lnosys"
  306. if test "${ac_cv_my_build_mode}" = "xrelease"; then
  307. LOL_TRY_CXXFLAGS(-s, [AM_CXXFLAGS="${AM_CXXFLAGS} -s"])
  308. fi])
  309. AC_LANG_POP(C++)
  310. AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no")
  311. dnl Use Android? FIXME: super hacks!
  312. ac_cv_my_have_android="no"
  313. AC_CHECK_LIB(log, __android_log_vprint,
  314. [ac_cv_my_have_android="yes"
  315. LOL_LIBS="${LOL_LIBS} -llog -landroid -module -lEGL -lGLESv2"])
  316. AM_CONDITIONAL(USE_ANDROID, test "${ac_cv_my_have_android}" != "no")
  317. dnl Use EGL?
  318. ac_cv_my_have_egl="no"
  319. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  320. if test "${ac_cv_my_have_egl}" != "no"; then
  321. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  322. EGL_LIBS="${EGL_LIBS} -lX11"
  323. fi
  324. AC_CHECK_LIB(EGL, main,
  325. [ac_cv_my_have_egl="yes"
  326. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  327. EGL_LIBS="-lEGL"])
  328. dnl Raspberry Pi is different, check for it with extra libs; also we
  329. dnl look for a different function to bypass autoconf caching
  330. AC_CHECK_LIB(EGL, eglGetDisplay,
  331. [ac_cv_my_have_egl="yes"
  332. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  333. EGL_LIBS="-lEGL -lvcos -lvchiq_arm -lbcm_host -lGLESv2"],
  334. [:],
  335. [-lvcos -lvchiq_arm -lbcm_host -lGLESv2])
  336. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  337. dnl Use libpng? (replacement for SDL_image)
  338. ac_cv_my_have_libpng="no"
  339. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  340. if test "${ac_cv_my_have_libpng}" != "no"; then
  341. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  342. fi
  343. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  344. dnl Use Windows GDI+?
  345. ac_cv_my_have_gdiplus="no"
  346. AC_LANG_PUSH(C++)
  347. AC_CHECK_HEADERS(gdiplus.h,
  348. [ac_cv_my_have_gdiplus="yes"
  349. LOL_LIBS="${LOL_LIBS} -lgdiplus"],
  350. [ac_cv_my_have_gdiplus="no"],
  351. [#include <algorithm>
  352. using std::min;
  353. using std::max;
  354. #include <windows.h>])
  355. AC_LANG_POP(C++)
  356. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  357. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  358. fi
  359. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  360. dnl Use libcaca? (required for font generation)
  361. ac_cv_my_have_caca="no"
  362. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  363. if test "${ac_cv_my_have_caca}" != "no"; then
  364. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  365. fi
  366. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  367. # Use Imlib2?
  368. ac_cv_my_have_imlib2="no"
  369. PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:])
  370. if test "${ac_cv_my_have_imlib2}" != "no"; then
  371. AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
  372. LOL_CFLAGS="${LOL_CFLAGS} ${IMLIB2_CFLAGS}"
  373. LOL_LIBS="${LOL_LIBS} ${IMLIB2_LIBS}"
  374. fi
  375. AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
  376. # Use libavcodec? (required for movie encoding)
  377. ac_cv_my_have_ffmpeg="yes"
  378. PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no])
  379. PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no])
  380. PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no])
  381. if test "${ac_cv_my_have_ffmpeg}" = "no"; then
  382. AC_CHECK_HEADERS(libavformat/avformat.h,
  383. [ac_cv_my_have_ffmpeg="yes"
  384. LOL_LIBS="${LOL_LIBS} -lswscale -lavformat -lavcodec -lswresample -lavutil -lws2_32"])
  385. fi
  386. if test "${ac_cv_my_have_ffmpeg}" != "no"; then
  387. AC_DEFINE(USE_FFMPEG, 1, Define to 1 to use FFmpeg)
  388. LOL_CFLAGS="${LOL_CFLAGS} ${LIBAVFORMAT_CFLAGS} ${LIBAVCODEC_CFLAGS} ${CFLAGSWSCALE_LIBS}"
  389. LOL_LIBS="${LOL_LIBS} ${LIBAVFORMAT_LIBS} ${LIBAVCODEC_LIBS} ${LIBSWSCALE_LIBS}"
  390. fi
  391. AM_CONDITIONAL(USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" != "no")
  392. dnl Use GTK+? (required for the deushax editor)
  393. ac_cv_my_have_gtkgl="no"
  394. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  395. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  396. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  397. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  398. fi
  399. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  400. dnl Can we build neercs?
  401. AM_CONDITIONAL(BUILD_NEERCS, test "${ac_cv_my_have_caca}" != "no")
  402. dnl Should we ship non-free data?
  403. AM_CONDITIONAL(HAVE_NONFREE, true)
  404. dnl Extra libraries we may need
  405. AC_SUBST(MATH_LIBS)
  406. AC_SUBST(PAM_LIBS)
  407. AC_SUBST(UTIL_LIBS)
  408. dnl How to use the Lol Engine outside this tree
  409. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  410. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS"
  411. LOL_DEPS="${LOL_DEPS} \$(top_builddir)/src/liblolcore.a"
  412. LOL_DEPS="${LOL_DEPS} \$(top_builddir)/src/bullet/liblolbullet.a"
  413. LOL_DEPS="${LOL_DEPS} \$(top_builddir)/src/lua/liblollua.a"
  414. dnl How to use the Lol Engine inside this tree
  415. AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/src"
  416. AM_CPPFLAGS="${AM_CPPFLAGS} -DLOL_CONFIG_SOURCESUBDIR=\\\"\$(subdir)\\\""
  417. AM_CPPFLAGS="${AM_CPPFLAGS} ${LOL_CFLAGS}"
  418. AM_LDFLAGS="${AM_LDFLAGS} ${LOL_DEPS}"
  419. AM_LDFLAGS="${AM_LDFLAGS} ${LOL_LIBS}"
  420. dnl Extra flags
  421. AC_SUBST(LOL_CFLAGS)
  422. AC_SUBST(LOL_LIBS)
  423. AC_SUBST(LOL_DEPS)
  424. AC_SUBST(AM_CFLAGS)
  425. AC_SUBST(AM_CPPFLAGS)
  426. AC_SUBST(AM_CXXFLAGS)
  427. AC_SUBST(AM_LDFLAGS)
  428. AC_SUBST(USE_DOT)
  429. AC_CONFIG_FILES(
  430. [Makefile
  431. src/Makefile
  432. src/bullet/Makefile
  433. src/lua/Makefile
  434. src/data/Makefile
  435. src/data/font/Makefile
  436. src/t/Makefile
  437. build/Makefile
  438. binaries/Makefile
  439. people/Makefile
  440. games/Makefile
  441. demos/Makefile
  442. tools/Makefile
  443. tools/vimlol/Makefile
  444. tools/vslol/Makefile
  445. doc/Makefile
  446. doc/doxygen.cfg
  447. ])
  448. AC_CONFIG_FILES(
  449. [games/monsterz/Makefile
  450. ])
  451. AC_CONFIG_FILES(
  452. [games/deushax/Makefile
  453. games/deushax/art/Makefile
  454. games/deushax/art/test/Makefile
  455. games/deushax/gfx/Makefile
  456. games/deushax/maps/Makefile
  457. ])
  458. AC_CONFIG_FILES(
  459. [games/mrpigeon/Makefile
  460. ])
  461. AC_CONFIG_FILES(
  462. [games/orbital/Makefile
  463. ])
  464. AC_CONFIG_FILES(
  465. [games/abuse/Makefile
  466. games/abuse/src/Makefile
  467. games/abuse/data/Makefile
  468. games/abuse/doc/Makefile
  469. games/abuse/doc/abuse.6
  470. games/abuse/doc/abuse-tool.6
  471. ])
  472. AC_CONFIG_FILES(
  473. [games/singlshot/Makefile
  474. ])
  475. AC_CONFIG_FILES(
  476. [demos/tutorial/Makefile
  477. demos/lol.js/Makefile
  478. demos/test/Makefile
  479. demos/test/math/Makefile
  480. demos/test/sandbox/Makefile
  481. ])
  482. AC_CONFIG_FILES(
  483. [tools/lolremez/Makefile
  484. tools/lolunit/Makefile
  485. tools/neercs/Makefile
  486. tools/pimp/Makefile
  487. ])
  488. AC_CONFIG_FILES(
  489. [people/jnat/Makefile
  490. people/jnat/TestProject/Makefile
  491. people/peeweek/Makefile
  492. people/benlitz/Makefile
  493. people/benlitz/test1/Makefile
  494. people/benlitz/voxel/Makefile
  495. people/benlitz/lolui/Makefile
  496. people/touky/Makefile
  497. people/touky/sprite_sorter/Makefile
  498. people/touky/squad_shooter/Makefile
  499. people/touky/top_shooter/Makefile
  500. people/touky/touky_demo/Makefile
  501. people/touky/tactics/Makefile
  502. people/touky/the_unfortunate_voronoid/Makefile
  503. people/touky/workbench/Makefile
  504. people/jylam/Makefile
  505. people/jylam/private/Makefile
  506. people/jylam/private/chat/Makefile
  507. people/jylam/private/lander/Makefile
  508. people/jylam/private/oric_convert/Makefile
  509. people/sam/Makefile
  510. people/sam/ld27/Makefile
  511. people/sam/vip2014/Makefile
  512. people/sam/kanagawa/Makefile
  513. people/sam/sapp/Makefile
  514. ])
  515. AC_OUTPUT