Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

configure.ac 4.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. # $Id$
  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(cppunit,
  38. [ --enable-cppunit use cppunit for unit tests (autodetected)])
  39. AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
  40. if test "${enable_debug}" = "yes"; then
  41. AC_DEFINE(_DEBUG, 1, Define to 1 to activate debug)
  42. fi
  43. # Optimizations
  44. CXXFLAGS="${CXXFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  45. # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
  46. CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
  47. AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
  48. # Use SDL? (always required)
  49. ac_cv_my_have_sdl="yes"
  50. AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
  51. if test "${SDL_CONFIG}" != "no"; then
  52. SDL_CFLAGS="${SDL_CFLAGS} `sdl-config --cflags`"
  53. SDL_LIBS="${SDL_LIBS} `sdl-config --libs`"
  54. fi
  55. PKG_CHECK_MODULES(SDL, sdl, [:],
  56. [SDL_LIBS="${SDL_LIBS} -lSDL"])
  57. AC_CHECK_LIB(GL, glLoadIdentity, SDL_LIBS="${SDL_LIBS} -lGL") # FIXME: hackish
  58. PKG_CHECK_MODULES(SDLMIXER, SDL_mixer, [:],
  59. [SDLMIXER_LIBS="${SDLMIXER_LIBS} -lSDL_mixer"])
  60. PKG_CHECK_MODULES(SDLIMAGE, SDL_image, [:],
  61. [SDLIMAGE_LIBS="${SDLIMAGE_LIBS} -lSDL_image"])
  62. save_CPPFLAGS="${CPPFLAGS}"
  63. SDL_CFLAGS="${SDL_CFLAGS} ${SDLMIXER_CFLAGS} ${SDLIMAGE_CFLAGS}"
  64. SDL_LIBS="${SDL_LIBS} ${SDLMIXER_LIBS} ${SDLIMAGE_LIBS}"
  65. CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
  66. AC_CHECK_HEADERS(SDL_mixer.h, [:], [ac_cv_my_have_sdl="no"])
  67. AC_CHECK_HEADERS(SDL_image.h, [:], [ac_cv_my_have_sdl="no"])
  68. CPPFLAGS="${save_CPPFLAGS}"
  69. if test "${ac_cv_my_have_sdl}" = "no"; then
  70. AC_MSG_ERROR([[One of SDL, SDL_Image or SDL_Mixer not found]])
  71. else
  72. AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
  73. fi
  74. AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
  75. dnl Use libcaca? (required for font generation)
  76. ac_cv_my_have_caca="no"
  77. PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
  78. if test "${ac_cv_my_have_caca}" != "no"; then
  79. AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
  80. fi
  81. AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
  82. dnl Use libpipi? (required for video recording)
  83. ac_cv_my_have_pipi="no"
  84. PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
  85. if test "${ac_cv_my_have_pipi}" != "no"; then
  86. AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
  87. fi
  88. AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
  89. dnl Use GTK+? (required for the deushax editor)
  90. ac_cv_my_have_gtkgl="no"
  91. PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
  92. PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
  93. if test "${ac_cv_my_have_gtkgl}" != "no"; then
  94. AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
  95. fi
  96. AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
  97. dnl Use cppunit for unit tests?
  98. PKG_CHECK_MODULES(CPPUNIT, cppunit, [CPPUNIT="yes"], [CPPUNIT="no"])
  99. AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes")
  100. # How to use the Lol Engine inside this tree
  101. LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src $SDL_CFLAGS"
  102. LOL_LIBS="$LOL_LIBS $SDL_LIBS"
  103. if test "${enable_release}" = "yes"; then
  104. AC_DEFINE(FINAL_RELEASE, 1, Define to 1 to activate final release)
  105. fi
  106. AC_SUBST(MATH_LIBS)
  107. AC_SUBST(LOL_CFLAGS)
  108. AC_SUBST(LOL_LIBS)
  109. AC_CONFIG_FILES([
  110. Makefile
  111. src/Makefile
  112. test/Makefile
  113. monsterz/Makefile
  114. deushax/Makefile
  115. tools/Makefile
  116. art/Makefile
  117. art/test/Makefile
  118. gfx/Makefile
  119. gfx/font/Makefile
  120. maps/Makefile
  121. ])
  122. AC_OUTPUT