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

276 行
8.3 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. dnl Which version of OpenGL to use?
  88. ac_cv_my_have_gl="no"
  89. PKG_CHECK_MODULES(GLES2, glesv2,
  90. [ac_cv_my_have_gl="yes"
  91. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  92. GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
  93. GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
  94. [:])
  95. AC_CHECK_LIB(GL, glLoadIdentity,
  96. [ac_cv_my_have_gl="yes"
  97. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
  98. GL_LIBS="-lGL"])
  99. AC_CHECK_HEADER(GL/gl.h,
  100. [LIBS_save="$LIBS"
  101. LIBS="$LIBS -lopengl32"
  102. AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
  103. AC_TRY_LINK([#include <GL/gl.h>],
  104. [glLoadIdentity();],
  105. [ac_cv_my_have_gl="yes"
  106. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
  107. AC_MSG_RESULT(yes)
  108. GL_LIBS="-lopengl32"],
  109. [AC_MSG_RESULT(no)])
  110. LIBS="$LIBS_save"])
  111. AC_CHECK_HEADER(PSGL/psgl.h,
  112. [ac_cv_my_have_gl="yes"])
  113. if test "${ac_cv_my_have_gl}" = "no"; then
  114. AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  115. fi
  116. dnl Use Glew?
  117. ac_cv_my_have_glew="no"
  118. PKG_CHECK_MODULES(GLEW, glew,
  119. [ac_cv_my_have_glew="yes"
  120. GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
  121. GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
  122. [:])
  123. AC_CHECK_HEADER(GL/glew.h,
  124. [LIBS_save="${LIBS}"
  125. LIBS="${LIBS} -lglew32 ${GL_LIBS}"
  126. AC_MSG_CHECKING(for glewInit in -lglew32)
  127. AC_TRY_LINK(
  128. [#include <GL/glew.h>],
  129. [glewInit();],
  130. [ac_cv_my_have_glew="yes"
  131. GL_LIBS="-lglew32 ${GL_LIBS}"
  132. AC_MSG_RESULT(yes)],
  133. [AC_MSG_RESULT(no)])
  134. LIBS="${LIBS_save}"])
  135. if test "${ac_cv_my_have_glew}" != "no"; then
  136. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  137. AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
  138. fi
  139. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  140. dnl Poor man's GL feature detection if all else failed.
  141. save_LIBS="${LIBS}"
  142. LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
  143. AC_CHECK_FUNCS(glBegin)
  144. LIBS="${save_LIBS}"
  145. dnl Use SDL? (always required on Linux or Win32)
  146. ac_cv_my_have_sdl="no"
  147. if test "x$cross_compiling" != xyes; then
  148. ac_cv_my_have_sdl="yes"
  149. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  150. if test "${SDL_CONFIG}" != "no" -a "x$cross_compiling" != xyes; then
  151. SDL_CFLAGS="${SDL_CFLAGS} `sdl-config --cflags`"
  152. SDL_LIBS="${SDL_LIBS} `sdl-config --libs`"
  153. fi
  154. PKG_CHECK_MODULES(SDL, sdl, [:],
  155. [SDL_LIBS="${SDL_LIBS} -lSDL"])
  156. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [:],
  157. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"])
  158. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [:],
  159. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"])
  160. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  161. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  162. save_CPPFLAGS="${CPPFLAGS}"
  163. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
  164. AC_CHECK_HEADERS(SDL_mixer.h, [:], [ac_cv_my_have_sdl="no"])
  165. AC_CHECK_HEADERS(SDL_image.h, [:], [ac_cv_my_have_sdl="no"])
  166. CPPFLAGS="${save_CPPFLAGS}"
  167. if test "${ac_cv_my_have_sdl}" = "no"; then
  168. AC_MSG_WARN([[One of SDL, SDL_Image or SDL_Mixer not found]])
  169. else
  170. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
  171. fi
  172. fi
  173. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  174. dnl Use EGL?
  175. ac_cv_my_have_egl="no"
  176. PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:])
  177. if test "${ac_cv_my_have_egl}" != "no"; then
  178. AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
  179. EGL_LIBS="${EGL_LIBS} -lX11"
  180. fi
  181. AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
  182. dnl Use libpng? (replacement for SDL_image)
  183. ac_cv_my_have_libpng="no"
  184. PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:])
  185. if test "${ac_cv_my_have_libpng}" != "no"; then
  186. AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng)
  187. fi
  188. AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no")
  189. dnl Use libcaca? (required for font generation)
  190. ac_cv_my_have_caca="no"
  191. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  192. if test "${ac_cv_my_have_caca}" != "no"; then
  193. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  194. fi
  195. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  196. dnl Use libpipi? (required for video recording)
  197. ac_cv_my_have_pipi="no"
  198. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  199. if test "${ac_cv_my_have_pipi}" != "no"; then
  200. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  201. fi
  202. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  203. dnl Use GTK+? (required for the deushax editor)
  204. ac_cv_my_have_gtkgl="no"
  205. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  206. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  207. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  208. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  209. fi
  210. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  211. dnl How to use the Lol Engine inside this tree
  212. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
  213. LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
  214. LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS"
  215. AC_SUBST(MATH_LIBS)
  216. AC_SUBST(LOL_CFLAGS)
  217. AC_SUBST(LOL_LIBS)
  218. AC_CONFIG_FILES(
  219. [Makefile
  220. src/Makefile
  221. test/Makefile
  222. gfx/Makefile
  223. gfx/font/Makefile
  224. tools/Makefile
  225. ])
  226. AC_CONFIG_FILES(
  227. [monsterz/Makefile
  228. ])
  229. AC_CONFIG_FILES(
  230. [deushax/Makefile
  231. deushax/art/Makefile
  232. deushax/art/test/Makefile
  233. deushax/gfx/Makefile
  234. deushax/maps/Makefile
  235. ])
  236. AC_OUTPUT