No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

281 líneas
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(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 a config-lol.h file in the parent project)
  89. if test -f "../config-lol.h"; then
  90. AC_MSG_RESULT(yes)
  91. AC_DEFINE(HAVE_CONFIG_LOL_H, 1, Define to if parent project provides config-lol.h)
  92. AH_BOTTOM([
  93. #if HAVE_CONFIG_LOL_H
  94. #include "../config-lol.h"
  95. #endif
  96. ])
  97. else
  98. AC_MSG_RESULT(no)
  99. fi
  100. fi
  101. dnl Common C headers
  102. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h stdint.h math.h)
  103. AC_CHECK_HEADERS(fastmath.h unistd.h io.h)
  104. AC_CHECK_HEADERS(execinfo.h)
  105. AC_CHECK_HEADERS(sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h)
  106. AC_CHECK_HEADERS(sys/wait.h sys/time.h sys/types.h)
  107. dnl Common C++ headers
  108. AC_LANG_PUSH(C++)
  109. AC_CHECK_HEADERS(cxxabi.h)
  110. AC_LANG_POP(C++)
  111. dnl Common C functions
  112. AC_CHECK_FUNCS(getenv system tmpfile tmpnam getcwd _getcwd)
  113. AC_CHECK_FUNCS(backtrace_symbols)
  114. AC_CHECK_FUNCS(gettimeofday usleep)
  115. dnl Build mode
  116. ac_cv_my_build_mode="devel"
  117. if test "x${enable_release}" = "xyes"; then
  118. ac_cv_my_build_mode="release"
  119. fi
  120. if test "x${enable_devel}" = "xyes"; then
  121. ac_cv_my_build_mode="devel"
  122. fi
  123. if test "x${enable_debug}" = "xyes"; then
  124. ac_cv_my_build_mode="debug"
  125. fi
  126. if test "x${ac_cv_my_build_mode}" = "xdebug"; then
  127. AC_DEFINE(LOL_BUILD_DEBUG, 1, Define to 1 to activate debug build)
  128. LOL_TRY_CXXFLAGS(-O, [AM_CXXFLAGS="${AM_CXXFLAGS} -O"])
  129. LOL_TRY_CXXFLAGS(-g, [AM_CXXFLAGS="${AM_CXXFLAGS} -g"])
  130. elif test "x${ac_cv_my_build_mode}" = "xdevel"; then
  131. AC_DEFINE(LOL_BUILD_DEVEL, 1, Define to 1 to activate development build)
  132. LOL_TRY_CXXFLAGS(-Os, [AM_CXXFLAGS="${AM_CXXFLAGS} -Os"])
  133. LOL_TRY_CXXFLAGS(-g, [AM_CXXFLAGS="${AM_CXXFLAGS} -g"])
  134. LOL_TRY_CXXFLAGS(-ffast-math, [AM_CXXFLAGS="${AM_CXXFLAGS} -ffast-math"])
  135. else
  136. AC_DEFINE(LOL_BUILD_RELEASE, 1, Define to 1 to activate final release)
  137. LOL_TRY_CXXFLAGS(-Os, [AM_CXXFLAGS="${AM_CXXFLAGS} -Os"])
  138. LOL_TRY_CXXFLAGS(-ffast-math, [AM_CXXFLAGS="${AM_CXXFLAGS} -ffast-math"])
  139. LOL_TRY_CXXFLAGS(-fomit-frame-pointer, [AM_CXXFLAGS="${AM_CXXFLAGS} -fomit-frame-pointer"])
  140. LOL_TRY_CXXFLAGS(-fno-strength-reduce, [AM_CXXFLAGS="${AM_CXXFLAGS} -fno-strength-reduce"])
  141. fi
  142. dnl Build documentation?
  143. DOXYGEN="no"
  144. LATEX="no"
  145. if test "${enable_doc}" != "no" -a "${enable_subproject}" != "yes"; then
  146. AC_PATH_PROG(DOXYGEN, doxygen, no)
  147. if test "${DOXYGEN}" != "no"; then
  148. # Build LaTeX documentation?
  149. AC_PATH_PROG(LATEX, pdflatex, no)
  150. AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
  151. AC_PATH_PROG(DVIPS, dvips, no)
  152. if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
  153. LATEX="no"
  154. fi
  155. if test "${LATEX}" != "no"; then
  156. AC_MSG_CHECKING(for a4.sty and a4wide.sty)
  157. if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
  158. if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
  159. AC_MSG_RESULT(yes)
  160. else
  161. LATEX="no"
  162. AC_MSG_RESULT(no)
  163. fi
  164. else
  165. LATEX="no"
  166. AC_MSG_RESULT(no)
  167. fi
  168. fi
  169. AC_PATH_PROG(DOT, dot, no)
  170. if test "${DOT}" != "no"; then
  171. LOL_USE_DOT="YES"
  172. else
  173. LOL_USE_DOT="NO"
  174. fi
  175. fi
  176. fi
  177. dnl XXX: disable LaTeX because we use too much memory
  178. LATEX=no
  179. AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
  180. AM_CONDITIONAL(LOL_USE_LATEX, test "${LATEX}" != "no")
  181. AM_CONDITIONAL(LOL_USE_DOT, test "${DOT}" != "no")
  182. AC_SUBST(LOL_USE_DOT)
  183. dnl GCC-specific symbol demangling
  184. AC_LANG_PUSH(C++)
  185. AC_TRY_LINK(
  186. [#include <cxxabi.h>],
  187. [abi::__cxa_demangle(NULL, 0, 0, NULL);],
  188. [AC_DEFINE(HAVE_CXA_DEMANGLE, 1, Define to 1 if abi::__cxa_demangle is available)])
  189. AC_LANG_POP(C++)
  190. LOL_AC_CHECK()
  191. dnl Use libcaca? (required for font generation)
  192. ac_cv_my_have_caca="no"
  193. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  194. if test "${ac_cv_my_have_caca}" != "no"; then
  195. AC_DEFINE(LOL_USE_CACA, 1, Define to 1 to use libcaca)
  196. fi
  197. AM_CONDITIONAL(LOL_USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  198. dnl Use GTK+? (required for the deushax editor)
  199. ac_cv_my_have_gtkgl="no"
  200. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  201. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  202. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  203. AC_DEFINE(LOL_USE_GTKGL, 1, Define to 1 to use GtkGl)
  204. fi
  205. AM_CONDITIONAL(LOL_USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  206. dnl Optional features
  207. AM_CONDITIONAL(BUILD_TEST, test "${enable_test}" != "no" -a "${enable_subproject}" != "yes")
  208. AM_CONDITIONAL(BUILD_TOOLS, test "${enable_tools}" != "no" -a "${enable_subproject}" != "yes")
  209. AM_CONDITIONAL(BUILD_TUTORIAL, test "${enable_tutorial}" != "no" -a "${enable_subproject}" != "yes")
  210. AM_CONDITIONAL(BUILD_SAMPLES, test "${enable_samples}" != "no" -a "${enable_subproject}" != "yes")
  211. LOL_AC_FINI()
  212. AC_CONFIG_HEADER(config.h)
  213. AC_CONFIG_FILES(
  214. [Makefile
  215. src/Makefile
  216. src/3rdparty/Makefile
  217. src/data/Makefile
  218. src/data/font/Makefile
  219. src/t/Makefile
  220. build/Makefile
  221. binaries/Makefile
  222. doc/Makefile
  223. doc/doxygen.cfg
  224. doc/samples/Makefile
  225. doc/samples/math/Makefile
  226. doc/samples/meshviewer/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