選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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