選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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