You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 8.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. dnl
  2. dnl Lol Engine
  3. dnl
  4. dnl Copyright © 2010—2017 Sam Hocevar <sam@hocevar.net>
  5. dnl
  6. dnl Lol Engine is free software. It comes without any warranty, to
  7. dnl the extent permitted by applicable law. You can redistribute it
  8. dnl and/or modify it under the terms of the Do What the Fuck You Want
  9. dnl to Public License, Version 2, as published by the WTFPL Task Force.
  10. dnl See http://www.wtfpl.net/ for more details.
  11. dnl
  12. AC_INIT(lolengine, 0.0)
  13. AC_PREREQ(2.50)
  14. AC_CONFIG_AUX_DIR(.auto)
  15. AC_CANONICAL_SYSTEM
  16. AM_INIT_AUTOMAKE([subdir-objects no-define tar-ustar silent-rules])
  17. dnl AM_MAINTAINER_MODE
  18. dnl Versioning of the separate software we ship
  19. LOLUNIT_VERSION=0.1
  20. AC_SUBST(LOLUNIT_VERSION)
  21. AC_SUBST(lol_srcdir, '${top_srcdir}')
  22. AC_SUBST(lol_builddir, '${top_builddir}')
  23. AM_PROG_CC_C_O
  24. AC_PROG_CPP
  25. AC_PROG_CXX
  26. AC_PROG_CXXCPP
  27. AC_PROG_RANLIB
  28. LOL_AC_INIT()
  29. AC_LIBTOOL_WIN32_DLL
  30. AM_PROG_LIBTOOL
  31. AC_LIBTOOL_CXX
  32. dnl Ensure an error is thrown if pkg-config M4 files are not found.
  33. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  34. m4_pattern_forbid([^PKG_CHECK_MODULES$])
  35. m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])
  36. dnl Same for Lol Engine M4 files.
  37. m4_pattern_forbid([^LOL_AC_])
  38. dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling.
  39. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  40. export PKG_CONFIG_LIBDIR=/dev/null
  41. fi
  42. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  43. dnl now otherwise it might be set in an obscure if statement. Same thing for
  44. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  45. AC_EGREP_CPP(yes, foo)
  46. PKG_PROG_PKG_CONFIG()
  47. dnl Check for a working implementation of sed
  48. AC_PROG_SED
  49. AC_MSG_CHECKING(for a sed that understands \t)
  50. if test "$(echo 'x\x' | "${SED}" 's/.*@<:@^x\t@:>@//')" != x; then
  51. AC_MSG_RESULT(no)
  52. AC_MSG_ERROR([[consider installing GNU sed]])
  53. else
  54. AC_MSG_RESULT(yes)
  55. fi
  56. dnl conditional builds
  57. AC_ARG_ENABLE(debug,
  58. [ --enable-debug build debug versions of the game (default no)])
  59. AC_ARG_ENABLE(release,
  60. [ --enable-release build final release of the game (default no)])
  61. AC_ARG_ENABLE(experimental,
  62. [ --enable-experimental experimental build (default no)])
  63. AC_ARG_ENABLE(subproject,
  64. [ --enable-subproject build as a subproject (default no)])
  65. AC_ARG_ENABLE(gl,
  66. [ --enable-gl build using OpenGL or OpenGL ES (default autodetected)])
  67. AC_ARG_ENABLE(ffmpeg,
  68. [ --enable-ffmpeg build using FFmpeg (default autodetected)])
  69. AC_ARG_ENABLE(sdl,
  70. [ --enable-sdl build using SDL (default autodetected)])
  71. AC_ARG_ENABLE(imlib2,
  72. [ --enable-imlib2 build using Imlib2 (default autodetected)])
  73. AC_ARG_ENABLE(png,
  74. [ --enable-png build using libpng (default autodetected)])
  75. AC_ARG_ENABLE(bullet,
  76. [ --enable-bullet build using Bullet Physics (default yes)])
  77. AC_ARG_ENABLE(test,
  78. [ --enable-test build test suite (default yes)])
  79. AC_ARG_ENABLE(tools,
  80. [ --enable-tools build miscellaneous tools (default yes)])
  81. AC_ARG_ENABLE(tutorial,
  82. [ --enable-tutorial build tutorial applications (default yes)])
  83. AC_ARG_ENABLE(samples,
  84. [ --enable-samples build sample applications (default yes)])
  85. AC_ARG_ENABLE(doc,
  86. [ --enable-doc build documentation (needs doxygen and LaTeX)])
  87. dnl Subproject builds
  88. if test "${enable_subproject}" = "yes"; then
  89. AC_MSG_CHECKING(for a config-lol.h file in the parent project)
  90. if test -f "../config-lol.h"; then
  91. AC_MSG_RESULT(yes)
  92. AC_DEFINE(HAVE_CONFIG_LOL_H, 1, Define to if parent project provides config-lol.h)
  93. AH_BOTTOM([
  94. #if HAVE_CONFIG_LOL_H
  95. #include "../config-lol.h"
  96. #endif
  97. ])
  98. else
  99. AC_MSG_RESULT(no)
  100. fi
  101. fi
  102. dnl Common C headers
  103. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h stdint.h math.h)
  104. AC_CHECK_HEADERS(fastmath.h unistd.h io.h)
  105. AC_CHECK_HEADERS(execinfo.h)
  106. AC_CHECK_HEADERS(sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h)
  107. AC_CHECK_HEADERS(sys/wait.h sys/time.h sys/types.h)
  108. dnl Common C++ headers
  109. AC_LANG_PUSH(C++)
  110. AC_CHECK_HEADERS(cxxabi.h)
  111. AC_LANG_POP(C++)
  112. dnl Common C functions
  113. AC_CHECK_FUNCS(getenv system tmpfile tmpnam getcwd _getcwd)
  114. AC_CHECK_FUNCS(backtrace_symbols)
  115. AC_CHECK_FUNCS(gettimeofday usleep)
  116. dnl Build mode
  117. ac_cv_my_build_mode="devel"
  118. if test "x${enable_release}" = "xyes"; then
  119. ac_cv_my_build_mode="release"
  120. fi
  121. if test "x${enable_devel}" = "xyes"; then
  122. ac_cv_my_build_mode="devel"
  123. fi
  124. if test "x${enable_debug}" = "xyes"; then
  125. ac_cv_my_build_mode="debug"
  126. fi
  127. if test "x${ac_cv_my_build_mode}" = "xdebug"; then
  128. AC_DEFINE(LOL_BUILD_DEBUG, 1, Define to 1 to activate debug build)
  129. LOL_TRY_CXXFLAGS(-O, [AM_CXXFLAGS="${AM_CXXFLAGS} -O"])
  130. LOL_TRY_CXXFLAGS(-g, [AM_CXXFLAGS="${AM_CXXFLAGS} -g"])
  131. elif test "x${ac_cv_my_build_mode}" = "xdevel"; then
  132. AC_DEFINE(LOL_BUILD_DEVEL, 1, Define to 1 to activate development build)
  133. LOL_TRY_CXXFLAGS(-Os, [AM_CXXFLAGS="${AM_CXXFLAGS} -Os"])
  134. LOL_TRY_CXXFLAGS(-g, [AM_CXXFLAGS="${AM_CXXFLAGS} -g"])
  135. LOL_TRY_CXXFLAGS(-ffast-math, [AM_CXXFLAGS="${AM_CXXFLAGS} -ffast-math"])
  136. else
  137. AC_DEFINE(LOL_BUILD_RELEASE, 1, Define to 1 to activate final release)
  138. LOL_TRY_CXXFLAGS(-Os, [AM_CXXFLAGS="${AM_CXXFLAGS} -Os"])
  139. LOL_TRY_CXXFLAGS(-ffast-math, [AM_CXXFLAGS="${AM_CXXFLAGS} -ffast-math"])
  140. LOL_TRY_CXXFLAGS(-fomit-frame-pointer, [AM_CXXFLAGS="${AM_CXXFLAGS} -fomit-frame-pointer"])
  141. LOL_TRY_CXXFLAGS(-fno-strength-reduce, [AM_CXXFLAGS="${AM_CXXFLAGS} -fno-strength-reduce"])
  142. fi
  143. dnl Build documentation?
  144. DOXYGEN="no"
  145. LATEX="no"
  146. if test "${enable_doc}" != "no" -a "${enable_subproject}" != "yes"; then
  147. AC_PATH_PROG(DOXYGEN, doxygen, no)
  148. if test "${DOXYGEN}" != "no"; then
  149. # Build LaTeX documentation?
  150. AC_PATH_PROG(LATEX, pdflatex, no)
  151. AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
  152. AC_PATH_PROG(DVIPS, dvips, no)
  153. if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
  154. LATEX="no"
  155. fi
  156. if test "${LATEX}" != "no"; then
  157. AC_MSG_CHECKING(for a4.sty and a4wide.sty)
  158. if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
  159. if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
  160. AC_MSG_RESULT(yes)
  161. else
  162. LATEX="no"
  163. AC_MSG_RESULT(no)
  164. fi
  165. else
  166. LATEX="no"
  167. AC_MSG_RESULT(no)
  168. fi
  169. fi
  170. AC_PATH_PROG(DOT, dot, no)
  171. if test "${DOT}" != "no"; then
  172. LOL_USE_DOT="YES"
  173. else
  174. LOL_USE_DOT="NO"
  175. fi
  176. fi
  177. fi
  178. dnl XXX: disable LaTeX because we use too much memory
  179. LATEX=no
  180. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  181. AM_CONDITIONAL(LOL_USE_LATEX, test "${LATEX}" != "no")
  182. AM_CONDITIONAL(LOL_USE_DOT, test "${DOT}" != "no")
  183. AC_SUBST(LOL_USE_DOT)
  184. dnl GCC-specific symbol demangling
  185. AC_LANG_PUSH(C++)
  186. AC_TRY_LINK(
  187. [#include <cxxabi.h>],
  188. [abi::__cxa_demangle(NULL, 0, 0, NULL);],
  189. [AC_DEFINE(HAVE_CXA_DEMANGLE, 1, Define to 1 if abi::__cxa_demangle is available)])
  190. AC_LANG_POP(C++)
  191. LOL_AC_CHECK()
  192. dnl Use libcaca? (required for font generation)
  193. ac_cv_my_have_caca="no"
  194. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  195. if test "${ac_cv_my_have_caca}" != "no"; then
  196. AC_DEFINE(LOL_USE_CACA, 1, Define to 1 to use libcaca)
  197. fi
  198. AM_CONDITIONAL(LOL_USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  199. dnl Use GTK+? (required for the deushax editor)
  200. ac_cv_my_have_gtkgl="no"
  201. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  202. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  203. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  204. AC_DEFINE(LOL_USE_GTKGL, 1, Define to 1 to use GtkGl)
  205. fi
  206. AM_CONDITIONAL(LOL_USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  207. dnl Optional features
  208. AM_CONDITIONAL(BUILD_TEST, test "${enable_test}" != "no" -a "${enable_subproject}" != "yes")
  209. AM_CONDITIONAL(BUILD_TOOLS, test "${enable_tools}" != "no" -a "${enable_subproject}" != "yes")
  210. AM_CONDITIONAL(BUILD_TUTORIAL, test "${enable_tutorial}" != "no" -a "${enable_subproject}" != "yes")
  211. AM_CONDITIONAL(BUILD_SAMPLES, test "${enable_samples}" != "no" -a "${enable_subproject}" != "yes")
  212. LOL_AC_FINI()
  213. AC_CONFIG_HEADER(config.h)
  214. AC_CONFIG_FILES(
  215. [Makefile
  216. src/Makefile
  217. src/3rdparty/Makefile
  218. src/data/Makefile
  219. src/data/font/Makefile
  220. src/t/Makefile
  221. build/Makefile
  222. binaries/Makefile
  223. doc/Makefile
  224. doc/doxygen.cfg
  225. doc/samples/Makefile
  226. doc/samples/math/Makefile
  227. doc/samples/sandbox/Makefile
  228. doc/tutorial/Makefile
  229. tools/Makefile
  230. tools/lolunit/Makefile
  231. tools/vimlol/Makefile
  232. tools/vslol/Makefile
  233. ])
  234. AC_OUTPUT