Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

configure.ac 11 KiB

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