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.

преди 14 години
преди 13 години
преди 13 години
преди 13 години
преди 13 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. dnl configure script for Lol Engine
  2. AC_INIT(lolengine, 0.0)
  3. AC_PREREQ(2.50)
  4. AC_CONFIG_AUX_DIR(.auto)
  5. AC_CANONICAL_SYSTEM
  6. AM_INIT_AUTOMAKE([no-define tar-ustar])
  7. dnl AM_MAINTAINER_MODE
  8. AM_CONFIG_HEADER(config.h)
  9. AM_PROG_CC_C_O
  10. AC_PROG_CPP
  11. AC_PROG_CXX
  12. AC_PROG_CXXCPP
  13. AC_PROG_RANLIB
  14. AC_LIBTOOL_WIN32_DLL
  15. AM_PROG_LIBTOOL
  16. AC_LIBTOOL_CXX
  17. AC_C_CONST
  18. AC_C_INLINE
  19. dnl Ensure an error is thrown if pkg-config M4 files are not found.
  20. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  21. m4_pattern_forbid([^PKG_CHECK_MODULES$])
  22. m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])
  23. dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling.
  24. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  25. export PKG_CONFIG_LIBDIR=/dev/null
  26. fi
  27. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  28. dnl now otherwise it might be set in an obscure if statement. Same thing for
  29. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  30. AC_EGREP_CPP(yes, foo)
  31. PKG_PROG_PKG_CONFIG()
  32. dnl conditional builds
  33. AC_ARG_ENABLE(debug,
  34. [ --enable-debug build debug versions of the game (default no)])
  35. AC_ARG_ENABLE(release,
  36. [ --enable-release build final release of the game (default no)])
  37. AC_ARG_ENABLE(experimental,
  38. [ --enable-experimental experimental build (default no)])
  39. AC_ARG_ENABLE(cppunit,
  40. [ --enable-cppunit use cppunit for unit tests (autodetected)])
  41. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
  42. if test "${enable_debug}" = "yes"; then
  43. AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
  44. OPT="-O"
  45. else
  46. OPT="-O2 -fno-strength-reduce -fomit-frame-pointer"
  47. fi
  48. if test "${enable_release}" = "yes"; then
  49. AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release)
  50. REL=""
  51. else
  52. REL="-g"
  53. fi
  54. if test "${enable_experimental}" = "yes"; then
  55. AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build)
  56. fi
  57. dnl Optimizations
  58. CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}"
  59. dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  60. CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
  61. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  62. dnl Which version of OpenGL to use?
  63. ac_cv_my_have_gl="no"
  64. PKG_CHECK_MODULES(GLES2, glesv2,
  65. [ac_cv_my_have_gl="yes"
  66. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  67. GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
  68. GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
  69. [:])
  70. AC_CHECK_LIB(GL, glLoadIdentity,
  71. [ac_cv_my_have_gl="yes"
  72. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
  73. GL_LIBS="-lGL"])
  74. AC_CHECK_HEADER(GL/gl.h,
  75. [LIBS_save="$LIBS"
  76. LIBS="$LIBS -lopengl32"
  77. AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
  78. AC_TRY_LINK([#include <GL/gl.h>],
  79. [glLoadIdentity();],
  80. [ac_cv_my_have_gl="yes"
  81. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hacky
  82. AC_MSG_RESULT(yes)
  83. GL_LIBS="-lopengl32"],
  84. [AC_MSG_RESULT(no)])
  85. LIBS="$LIBS_save"])
  86. if test "${ac_cv_my_have_gl}" = "no"; then
  87. AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  88. fi
  89. dnl Use Glew?
  90. ac_cv_my_have_glew="no"
  91. PKG_CHECK_MODULES(GLEW, glew,
  92. [ac_cv_my_have_glew="yes"
  93. GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
  94. GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
  95. [:])
  96. AC_CHECK_HEADER(GL/glew.h,
  97. [LIBS_save="${LIBS}"
  98. LIBS="${LIBS} -lglew32 ${GL_LIBS}"
  99. AC_MSG_CHECKING(for glewInit in -lglew32)
  100. AC_TRY_LINK(
  101. [#include <GL/glew.h>],
  102. [glewInit();],
  103. [ac_cv_my_have_glew="yes"
  104. GL_LIBS="-lglew32 ${GL_LIBS}"
  105. AC_MSG_RESULT(yes)],
  106. [AC_MSG_RESULT(no)])
  107. LIBS="${LIBS_save}"])
  108. if test "${ac_cv_my_have_glew}" != "no"; then
  109. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  110. AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
  111. fi
  112. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  113. dnl Poor man's GL feature detection if all else failed.
  114. save_LIBS="${LIBS}"
  115. LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
  116. AC_CHECK_FUNCS(glBegin)
  117. LIBS="${save_LIBS}"
  118. dnl Use SDL? (always required)
  119. ac_cv_my_have_sdl="yes"
  120. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  121. if test "${SDL_CONFIG}" != "no"; then
  122. SDL_CFLAGS="${SDL_CFLAGS} `sdl-config --cflags`"
  123. SDL_LIBS="${SDL_LIBS} `sdl-config --libs`"
  124. fi
  125. SDL_CFLAGS="${SDL_CFLAGS} ${GL_CFLAGS}"
  126. SDL_LIBS="${SDL_LIBS} ${GL_LIBS}"
  127. PKG_CHECK_MODULES(SDL, sdl, [:],
  128. [SDL_LIBS="${SDL_LIBS} -lSDL"])
  129. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [:],
  130. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"])
  131. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [:],
  132. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"])
  133. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  134. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  135. save_CPPFLAGS="${CPPFLAGS}"
  136. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
  137. AC_CHECK_HEADERS(SDL_mixer.h, [:], [ac_cv_my_have_sdl="no"])
  138. AC_CHECK_HEADERS(SDL_image.h, [:], [ac_cv_my_have_sdl="no"])
  139. CPPFLAGS="${save_CPPFLAGS}"
  140. if test "${ac_cv_my_have_sdl}" = "no"; then
  141. AC_MSG_ERROR([[One of SDL, SDL_Image or SDL_Mixer not found]])
  142. else
  143. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  144. fi
  145. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  146. dnl Use EGL?
  147. ac_cv_my_have_egl="no"
  148. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  149. if test "${ac_cv_my_have_egl}" != "no"; then
  150. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  151. EGL_LIBS="${EGL_LIBS} -lX11"
  152. fi
  153. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  154. dnl Use libpng? (replacement for SDL_image)
  155. ac_cv_my_have_libpng="no"
  156. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  157. if test "${ac_cv_my_have_libpng}" != "no"; then
  158. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  159. fi
  160. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  161. dnl Use libcaca? (required for font generation)
  162. ac_cv_my_have_caca="no"
  163. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  164. if test "${ac_cv_my_have_caca}" != "no"; then
  165. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  166. fi
  167. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  168. dnl Use libpipi? (required for video recording)
  169. ac_cv_my_have_pipi="no"
  170. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  171. if test "${ac_cv_my_have_pipi}" != "no"; then
  172. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  173. fi
  174. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  175. dnl Use GTK+? (required for the deushax editor)
  176. ac_cv_my_have_gtkgl="no"
  177. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  178. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  179. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  180. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  181. fi
  182. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  183. dnl Use cppunit for unit tests?
  184. PKG_CHECK_MODULES(CPPUNIT, cppunit, [CPPUNIT="yes"], [CPPUNIT="no"])
  185. AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes")
  186. dnl How to use the Lol Engine inside this tree
  187. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  188. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  189. LOL_LIBS="$LOL_LIBS $SDL_LIBS $EGL_LIBS $LIBPNG_LIBS"
  190. AC_SUBST(MATH_LIBS)
  191. AC_SUBST(LOL_CFLAGS)
  192. AC_SUBST(LOL_LIBS)
  193. AC_CONFIG_FILES(
  194. [Makefile
  195. src/Makefile
  196. test/Makefile
  197. gfx/Makefile
  198. gfx/font/Makefile
  199. tools/Makefile
  200. ])
  201. AC_CONFIG_FILES(
  202. [monsterz/Makefile
  203. ])
  204. AC_CONFIG_FILES(
  205. [deushax/Makefile
  206. deushax/art/Makefile
  207. deushax/art/test/Makefile
  208. deushax/gfx/Makefile
  209. deushax/maps/Makefile
  210. ])
  211. AC_OUTPUT