Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

configure.ac 7.9 KiB

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