Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

364 Zeilen
11 KiB

  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. dnl Versioning of the separate software we ship
  9. LOLUNIT_VERSION=0.1
  10. AC_SUBST(LOLUNIT_VERSION)
  11. LOLREMEZ_VERSION=0.2
  12. AC_SUBST(LOLREMEZ_VERSION)
  13. AM_CONFIG_HEADER(config.h)
  14. AM_PROG_CC_C_O
  15. AC_PROG_CPP
  16. AC_PROG_CXX
  17. AC_PROG_CXXCPP
  18. AC_PROG_RANLIB
  19. AC_LIBTOOL_WIN32_DLL
  20. AM_PROG_LIBTOOL
  21. AC_LIBTOOL_CXX
  22. AC_C_CONST
  23. AC_C_INLINE
  24. dnl Ensure an error is thrown if pkg-config M4 files are not found.
  25. m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
  26. m4_pattern_forbid([^PKG_CHECK_MODULES$])
  27. m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])
  28. dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling.
  29. if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
  30. export PKG_CONFIG_LIBDIR=/dev/null
  31. fi
  32. dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
  33. dnl now otherwise it might be set in an obscure if statement. Same thing for
  34. dnl PKG_PROG_PKG_CONFIG which needs to be called first.
  35. AC_EGREP_CPP(yes, foo)
  36. PKG_PROG_PKG_CONFIG()
  37. dnl Available platforms: some of these are not public
  38. AM_CONDITIONAL(HAVE_PS3, test -f src/platform/ps3/ps3app.cpp)
  39. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  40. dnl conditional builds
  41. AC_ARG_ENABLE(debug,
  42. [ --enable-debug build debug versions of the game (default no)])
  43. AC_ARG_ENABLE(release,
  44. [ --enable-release build final release of the game (default no)])
  45. AC_ARG_ENABLE(experimental,
  46. [ --enable-experimental experimental build (default no)])
  47. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h fastmath.h pthread.h)
  48. if test "${enable_debug}" = "yes"; then
  49. AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
  50. OPT="-O"
  51. else
  52. OPT="-O3 -ffast-math -fno-strength-reduce -fomit-frame-pointer"
  53. fi
  54. if test "${enable_release}" = "yes"; then
  55. AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release)
  56. REL=""
  57. else
  58. REL="-g"
  59. fi
  60. if test "${enable_experimental}" = "yes"; then
  61. AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build)
  62. fi
  63. dnl No exceptions
  64. CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-rtti"
  65. dnl Optimizations
  66. CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}"
  67. dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  68. CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
  69. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  70. AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
  71. dnl Are we on the PS3?
  72. AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
  73. [LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
  74. dnl For PSGL
  75. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
  76. GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
  77. if test "x${enable_debug}" = xyes; then
  78. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
  79. elif test "x${enable_release}" = xyes; then
  80. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
  81. else
  82. GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
  83. fi
  84. dnl For the runtime Cg compiler
  85. GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
  86. dnl For the PNG decoder
  87. LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
  88. dnl For the pad library
  89. LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
  90. AC_PATH_PROG(MAKE_FSELF, make_fself, no)],
  91. [MAKE_FSELF=no])
  92. AM_CONDITIONAL(USE_MAKE_FSELF, test "${MAKE_FSELF}" != "no")
  93. LIBS_save="$LIBS"
  94. LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
  95. AC_MSG_CHECKING(for -framework OpenGL)
  96. AC_TRY_LINK([], [],
  97. [ac_cv_my_have_cocoa="yes"
  98. AC_MSG_RESULT(yes)
  99. GL_LIBS="${GL_LIBS} -framework OpenGL"
  100. CXXFLAGS="${CXXFLAGS} -ObjC++"],
  101. [AC_MSG_RESULT(no)])
  102. LIBS="$LIBS_save"
  103. dnl Which version of OpenGL to use?
  104. ac_cv_my_have_gl="no"
  105. PKG_CHECK_MODULES(GLES2, glesv2,
  106. [ac_cv_my_have_gl="yes"
  107. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  108. GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
  109. GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
  110. [:])
  111. AC_CHECK_HEADER(GLES2/gl2.h,
  112. [AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  113. ac_cv_my_have_gl="yes"])
  114. PKG_CHECK_MODULES(GL, gl,
  115. [ac_cv_my_have_gl="yes"
  116. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
  117. [:])
  118. AC_CHECK_LIB(GL, glLoadIdentity,
  119. [ac_cv_my_have_gl="yes"
  120. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
  121. GL_LIBS="-lGL"])
  122. AC_CHECK_HEADER(GL/gl.h,
  123. [LIBS_save="$LIBS"
  124. LIBS="$LIBS -lopengl32"
  125. AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
  126. AC_TRY_LINK([#include <GL/gl.h>],
  127. [glLoadIdentity();],
  128. [ac_cv_my_have_gl="yes"
  129. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
  130. AC_MSG_RESULT(yes)
  131. GL_LIBS="-lopengl32"],
  132. [AC_MSG_RESULT(no)])
  133. LIBS="$LIBS_save"])
  134. AC_CHECK_HEADER(PSGL/psgl.h,
  135. [ac_cv_my_have_gl="yes"])
  136. if test "${ac_cv_my_have_gl}" = "no"; then
  137. AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  138. fi
  139. dnl Use Glew?
  140. ac_cv_my_have_glew="no"
  141. PKG_CHECK_MODULES(GLEW, glew,
  142. [ac_cv_my_have_glew="yes"
  143. GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
  144. GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
  145. [:])
  146. AC_CHECK_HEADER(glew.h,
  147. [LIBS_save="${LIBS}"
  148. LIBS="${LIBS} -lglew32 ${GL_LIBS}"
  149. AC_MSG_CHECKING(for glewInit in -lglew32)
  150. AC_TRY_LINK(
  151. [#include <glew.h>],
  152. [glewInit();],
  153. [ac_cv_my_have_glew="yes"
  154. GL_LIBS="-lglew32 ${GL_LIBS}"
  155. AC_MSG_RESULT(yes)],
  156. [AC_MSG_RESULT(no)])
  157. LIBS="${LIBS_save}"])
  158. if test "${ac_cv_my_have_glew}" != "no"; then
  159. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  160. AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
  161. fi
  162. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  163. dnl Poor man's GL feature detection if all else failed.
  164. save_LIBS="${LIBS}"
  165. LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
  166. AC_CHECK_FUNCS(glBegin)
  167. LIBS="${save_LIBS}"
  168. dnl Use SDL? (always required on Linux or Win32)
  169. ac_cv_my_have_sdl="no"
  170. ac_cv_my_have_sdl_image="no"
  171. ac_cv_my_have_sdl_mixer="no"
  172. dnl
  173. dnl First, try the proper pkg-config check
  174. PKG_CHECK_MODULES(SDL, sdl, [ac_cv_my_have_sdl="yes"], [:])
  175. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [ac_cv_my_have_sdl_mixer="yes"], [:])
  176. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [ac_cv_my_have_sdl_image="yes"], [:])
  177. dnl
  178. dnl Then the old sdl-config method
  179. if test "x${cross_compiling}" != xyes -a "${ac_cv_my_have_sdl}" != yes; then
  180. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  181. if test "${SDL_CONFIG}" != "no"; then
  182. SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`"
  183. SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`"
  184. ac_cv_my_have_sdl="yes"
  185. fi
  186. fi
  187. dnl
  188. dnl Maybe all this has failed, try direct inclusion
  189. save_CPPFLAGS="${CPPFLAGS}"
  190. save_LIBS="${LIBS}"
  191. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  192. LIBS="${LIBS} ${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  193. AC_CHECK_HEADERS(SDL.h SDL/SDL.h, [ac_cv_my_have_sdl="yes"])
  194. AC_CHECK_HEADERS(SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
  195. AC_CHECK_HEADERS(SDL_image.h, [ac_cv_my_have_sdl_image="yes"])
  196. AC_CHECK_LIB(SDL, main,
  197. [SDL_LIBS="${SDL_LIBS} -lSDL"],
  198. [ac_cv_my_have_sdl="no"])
  199. AC_CHECK_LIB(SDL_mixer, main,
  200. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"],
  201. [ac_cv_my_have_sdl_mixer="no"])
  202. AC_CHECK_LIB(SDL_image, main,
  203. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"],
  204. [ac_cv_my_have_sdl_image="no"])
  205. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  206. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  207. CPPFLAGS="${save_CPPFLAGS}"
  208. LIBS="${save_LIBS}"
  209. if test "${ac_cv_my_have_sdl}" = "no"; then
  210. AC_MSG_WARN([SDL not found])
  211. else
  212. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  213. fi
  214. if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
  215. AC_MSG_WARN([SDL_mixer not found])
  216. else
  217. AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer)
  218. fi
  219. if test "${ac_cv_my_have_sdl_image}" = "no"; then
  220. AC_MSG_WARN([SDL_image not found])
  221. else
  222. AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image)
  223. fi
  224. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  225. AM_CONDITIONAL(USE_SDL_MIXER, test "${ac_cv_my_have_sdl_mixer}" = "yes")
  226. AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes")
  227. dnl Use NativeClient?
  228. ac_cv_my_have_nacl="no"
  229. AC_LANG_PUSH(C++)
  230. AC_CHECK_HEADERS(ppapi/cpp/instance.h, [ac_cv_my_have_nacl="yes"])
  231. AC_LANG_POP(C++)
  232. AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no")
  233. dnl Use EGL?
  234. ac_cv_my_have_egl="no"
  235. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  236. if test "${ac_cv_my_have_egl}" != "no"; then
  237. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  238. EGL_LIBS="${EGL_LIBS} -lX11"
  239. fi
  240. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  241. dnl Use libpng? (replacement for SDL_image)
  242. ac_cv_my_have_libpng="no"
  243. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  244. if test "${ac_cv_my_have_libpng}" != "no"; then
  245. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  246. fi
  247. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  248. dnl Use Windows GDI+?
  249. ac_cv_my_have_gdiplus="no"
  250. AC_LANG_PUSH(C++)
  251. AC_CHECK_HEADERS(Gdiplus.h,
  252. [ac_cv_my_have_gdiplus="yes"
  253. LOL_LIBS="${LOL_LIBS} -lgdiplus"],
  254. [ac_cv_my_have_gdiplus="no"],
  255. [#include <algorithm>
  256. using std::min;
  257. using std::max;
  258. #include <windows.h>])
  259. AC_LANG_POP(C++)
  260. if test "${ac_cv_my_have_gdiplus}" != "no"; then
  261. AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
  262. fi
  263. AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
  264. dnl Use libcaca? (required for font generation)
  265. ac_cv_my_have_caca="no"
  266. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  267. if test "${ac_cv_my_have_caca}" != "no"; then
  268. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  269. fi
  270. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  271. dnl Use libpipi? (required for video recording)
  272. ac_cv_my_have_pipi="no"
  273. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  274. if test "${ac_cv_my_have_pipi}" != "no"; then
  275. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  276. fi
  277. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  278. dnl Use GTK+? (required for the deushax editor)
  279. ac_cv_my_have_gtkgl="no"
  280. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  281. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  282. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  283. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  284. fi
  285. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  286. dnl How to use the Lol Engine inside this tree
  287. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  288. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  289. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS"
  290. AC_SUBST(MATH_LIBS)
  291. AC_SUBST(LOL_CFLAGS)
  292. AC_SUBST(LOL_LIBS)
  293. AC_CONFIG_FILES(
  294. [Makefile
  295. src/Makefile
  296. test/Makefile
  297. test/math/Makefile
  298. test/sandbox/Makefile
  299. test/tutorial/Makefile
  300. test/xolotl/Makefile
  301. gfx/Makefile
  302. gfx/font/Makefile
  303. tools/Makefile
  304. ])
  305. AC_CONFIG_FILES(
  306. [monsterz/Makefile
  307. ])
  308. AC_CONFIG_FILES(
  309. [deushax/Makefile
  310. deushax/art/Makefile
  311. deushax/art/test/Makefile
  312. deushax/gfx/Makefile
  313. deushax/maps/Makefile
  314. ])
  315. AC_OUTPUT