Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

configure.ac 8.1 KiB

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