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.
 
 
 
 
 
 

286 line
8.6 KiB

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