configure.ac 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. AC_PREREQ(2.59)
  2. AC_INIT([ManaPlus], [1.2.3.4], [akaras@inbox.ru], [manaplus])
  3. AM_INIT_AUTOMAKE([1.9])
  4. AC_CONFIG_HEADERS([config.h:config.h.in])
  5. AC_LANG_CPLUSPLUS
  6. # Checks for programs.
  7. AC_PROG_CXX
  8. AM_PROG_CC_C_O
  9. AC_PROG_INSTALL
  10. # Checks for typedefs, structures, and compiler characteristics.
  11. AC_HEADER_TIME
  12. # Checks for library functions.
  13. AC_FUNC_ERROR_AT_LINE
  14. AC_FUNC_MALLOC
  15. AC_FUNC_REALLOC
  16. AC_FUNC_SELECT_ARGTYPES
  17. AC_FUNC_VPRINTF
  18. AC_CHECK_FUNCS([atexit floor getcwd gethostbyname memset mkdir select socket])
  19. # Checks for internationalization support
  20. AM_GNU_GETTEXT([external],[need-ngettext])
  21. AM_GNU_GETTEXT_VERSION([0.16.1])
  22. # Search for *-config
  23. AC_PATH_PROG(SDL_CONFIG, sdl-config)
  24. AC_PATH_PROG(PKG_CONFIG, pkg-config)
  25. AC_PATH_PROG(CURL_CONFIG, curl-config)
  26. # Checks for libraries
  27. AC_CHECK_LIB([pthread], [pthread_create], ,
  28. AC_MSG_ERROR([ *** Unable to find pthread library]))
  29. if test -n "$SDL_CONFIG"; then
  30. LIBS="$LIBS `$SDL_CONFIG --libs`"
  31. CPPFLAGS="$CPPFLAGS `$SDL_CONFIG --cflags`"
  32. fi
  33. AC_CHECK_LIB([SDL], [SDL_Init], ,
  34. AC_MSG_ERROR([ *** Unable to find SDL library (http://www.libsdl.org/)]))
  35. AC_CHECK_HEADERS([SDL.h], ,
  36. AC_MSG_ERROR([ *** SDL library found but cannot find headers (http://www.libsdl.org/)]))
  37. AC_CHECK_LIB([z], [inflate], ,
  38. AC_MSG_ERROR([ *** Unable to find zlib (http://www.gzip.org/zlib/)]))
  39. AC_CHECK_LIB([physfs], [PHYSFS_init], ,
  40. AC_MSG_ERROR([ *** Unable to find PhysFS library (http://icculus.org/physfs/)]))
  41. AC_CHECK_HEADERS([physfs.h], ,
  42. AC_MSG_ERROR([ *** PhysFS library found but cannot find headers (http://icculus.org/physfs/)]))
  43. if test -n "$CURL_CONFIG"; then
  44. LIBS="$LIBS `$CURL_CONFIG --libs`"
  45. CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
  46. fi
  47. AC_CHECK_LIB([curl], [curl_global_init], ,
  48. AC_MSG_ERROR([ *** Unable to find CURL library (http://curl.haxx.se/)]))
  49. AC_CHECK_HEADERS([curl/curl.h], ,
  50. AC_MSG_ERROR([ *** CURL library found but cannot find headers (http://curl.haxx.se/)]))
  51. if test -n "$PKG_CONFIG"; then
  52. LIBS="$LIBS `$PKG_CONFIG --libs libxml-2.0`"
  53. CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags libxml-2.0`"
  54. fi
  55. AC_CHECK_LIB([xml2], [xmlInitParser], ,
  56. AC_MSG_ERROR([ *** Unable to find libxml2 library (http://xmlsoft.org/)]))
  57. AC_CHECK_HEADERS([libxml/xmlreader.h], ,
  58. AC_MSG_ERROR([ *** libxml2 library found but cannot find headers (http://xmlsoft.org/)]))
  59. AC_CHECK_LIB(png, png_write_info, ,
  60. AC_MSG_ERROR([ *** Unable to find png library]))
  61. AC_CHECK_LIB(SDL_image, IMG_LoadPNG_RW, ,
  62. AC_MSG_ERROR([ *** Unable to find SDL_image library with PNG support
  63. (http://www.libsdl.org/projects/SDL_image/)]))
  64. AC_CHECK_LIB(SDL_ttf, TTF_Quit, ,
  65. AC_MSG_ERROR([ *** Unable to find SDL_ttf library (http://www.libsdl.org/projects/SDL_ttf/)]))
  66. AC_CHECK_LIB([SDL_mixer], [Mix_OpenAudio], ,
  67. AC_MSG_ERROR([ *** Unable to find SDL_mixer library (http://www.libsdl.org/projects/SDL_mixer/)]))
  68. AC_CHECK_LIB(SDL_gfx, rotozoomSurfaceXY, ,
  69. AC_MSG_ERROR([ *** Unable to find SDL_gfx library (http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx)]))
  70. AC_CHECK_HEADERS(SDL_rotozoom.h, ,)
  71. # === Check for X11 (check borrowed from Wormux) ========================
  72. # Deactivated on purpose under OSX (in case X11 SDK is installed)
  73. if test "x$OSX" != "xyes" ; then
  74. AC_CHECK_HEADER(X11/Xlib.h, check_x11="yes",check_x11="no")
  75. if test x${check_x11} = xno ; then
  76. AC_CHECK_HEADER(X11R6/Xlib.h,
  77. [ check_x11="yes"
  78. LDFLAGS="-L/usr/X11R6/include $CFLAGS"],
  79. check_x11="no")
  80. fi
  81. if test x${check_x11} = xyes ; then
  82. AC_CHECK_LIB(X11, XOpenDisplay,
  83. [ LIBS="$LIBS -lX11"
  84. AC_DEFINE(USE_X11, 1, [Define to use X11 copy'n'paste]) ],
  85. [])
  86. fi
  87. fi
  88. # Checks for header files.
  89. AC_HEADER_STDC
  90. AC_CHECK_HEADERS([arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])
  91. # Enable mac build
  92. AC_ARG_ENABLE(applebuild,
  93. [ --enable-applebuild Turn on apple building],
  94. [case "${enableval}" in
  95. yes) applebuild_enabled=true
  96. ;;
  97. no) applebuild_enabled=false
  98. ;;
  99. *) AC_MSG_ERROR(bad value ${enableval} for --enable-applebuild) ;;
  100. esac],[applebuild_enabled=false])
  101. # Option to enable OpenGL
  102. AC_ARG_WITH(opengl,[ --without-opengl don't use OpenGL ] )
  103. if test "x$with_opengl" == "xno"; then
  104. with_opengl=no
  105. else
  106. with_opengl=yes
  107. if test "x$applebuild_enabled" == "xfalse"; then
  108. AC_CHECK_LIB([GL], [glBegin], ,
  109. AC_MSG_ERROR([ *** Unable to find OpenGL library]))
  110. else
  111. LDFLAGS="$LDFLAGS -framework OpenGL"
  112. fi
  113. AC_DEFINE(USE_OPENGL, 1, [Defines if ManaPlus should have OpenGL support])
  114. fi
  115. AC_CHECK_LIB([guichan], [gcnGuichanVersion], ,
  116. AC_MSG_ERROR([ *** Unable to find Guichan library (http://guichan.sf.net/)]))
  117. AC_CHECK_HEADERS([guichan.hpp], ,
  118. AC_MSG_ERROR([ *** Guichan library found but cannot find headers (http://guichan.sf.net/)]))
  119. AC_CHECK_HEADERS([guichan/widgetlistener.hpp], ,
  120. AC_MSG_ERROR([ *** Guichan library version is found but version is < 0.8.0 (http://guichan.sf.net/)]))
  121. AC_CHECK_LIB([guichan_sdl], [gcnSDL], ,
  122. AC_MSG_ERROR([ *** Unable to find Guichan SDL library (http://guichan.sf.net/)]))
  123. AC_CHECK_LIB(SDL_net, SDLNet_Init, ,
  124. AC_MSG_ERROR([ *** Unable to find SDL_net library]))
  125. AC_ARG_WITH(librt,[ --without-librt don't link to librt ] )
  126. if test "x$with_librt" == "xno"; then
  127. without_librt=yes
  128. else
  129. if test "x$applebuild_enabled" == "xfalse"; then
  130. AC_CHECK_LIB(rt, shm_open, ,
  131. AC_MSG_ERROR([ *** Unable to find librt library]))
  132. fi
  133. without_librt=no
  134. fi
  135. # Enable manaserv
  136. AC_ARG_ENABLE(manaserv,
  137. [ --enable-manaserv Turn on manaserv],
  138. [case "${enableval}" in
  139. yes) with_manaserv=true ;;
  140. no) with_manaserv=false ;;
  141. *) AC_MSG_ERROR(bad value ${enableval} for --enable-manaserv) ;;
  142. esac],[with_manaserv=false])
  143. AM_CONDITIONAL(ENABLE_MANASERV, test x$with_manaserv = xtrue)
  144. # Enable portable
  145. AC_ARG_ENABLE(portable,
  146. [ --enable-portable Turn on portable mode for linux],
  147. [case "${enableval}" in
  148. yes) portable_enabled=true ;;
  149. no) portable_enabled=false ;;
  150. *) AC_MSG_ERROR(bad value ${enableval} for --enable-portable) ;;
  151. esac],[portable_enabled=false])
  152. AM_CONDITIONAL(ENABLE_PORTABLE, test x$portable_enabled = xtrue)
  153. # Enable unit tests
  154. AC_ARG_ENABLE(unittests,
  155. [ --enable-unittests Turn on unit tests],
  156. [case "${enableval}" in
  157. yes) unittests_enabled=true
  158. LIBS="$LIBS -lgtest"
  159. ;;
  160. no) unittests_enabled=false ;;
  161. *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
  162. esac],[unittests_enabled=false])
  163. AM_CONDITIONAL(ENABLE_UNITTESTS, test x$unittests_enabled = xtrue)
  164. # Enable tcmalloc
  165. AC_ARG_ENABLE(tcmalloc,
  166. [ --enable-tcmalloc Turn on tcmalloc],
  167. [case "${enableval}" in
  168. yes) tcmalloc_enabled=true
  169. LIBS="$LIBS -ltcmalloc"
  170. ;;
  171. no) tcmalloc_enabled=false ;;
  172. *) AC_MSG_ERROR(bad value ${enableval} for --enable-tcmalloc) ;;
  173. esac],[tcmalloc_enabled=false])
  174. # Enable google profiler
  175. AC_ARG_ENABLE(googleprofiler,
  176. [ --enable-googleprofiler Turn on google profiler],
  177. [case "${enableval}" in
  178. yes) googleprofiler_enabled=true
  179. LIBS="$LIBS -lprofiler"
  180. ;;
  181. no) googleprofiler_enabled=false ;;
  182. *) AC_MSG_ERROR(bad value ${enableval} for --enable-googleprofiler) ;;
  183. esac],[googleprofiler_enabled=false])
  184. AM_CONDITIONAL(ENABLE_GOOGLE_PROFILER, test x$googleprofiler_enabled = xtrue)
  185. AC_CONFIG_FILES([
  186. manaplus.spec
  187. Makefile
  188. PKGBUILD
  189. src/Makefile
  190. data/Makefile
  191. data/graphics/Makefile
  192. data/graphics/gui/Makefile
  193. data/graphics/images/Makefile
  194. data/graphics/sprites/Makefile
  195. data/sfx/Makefile
  196. data/sfx/system/Makefile
  197. data/themes/Makefile
  198. data/themes/enchilado/Makefile
  199. data/themes/mana/Makefile
  200. data/themes/pink/Makefile
  201. data/themes/unity/Makefile
  202. data/themes/wood/Makefile
  203. data/help/Makefile
  204. data/help/es/Makefile
  205. data/help/fr/Makefile
  206. data/help/pt/Makefile
  207. data/help/pt/tips/Makefile
  208. data/help/pt_BR/Makefile
  209. data/help/pt_BR/tips/Makefile
  210. data/help/ru/Makefile
  211. data/help/ru/tips/Makefile
  212. data/help/tips/Makefile
  213. data/icons/Makefile
  214. data/perserver/Makefile
  215. data/perserver/default/Makefile
  216. docs/Makefile
  217. po/Makefile.in
  218. ])
  219. AC_OUTPUT
  220. echo
  221. echo "Build with OpenGL: $with_opengl"
  222. echo
  223. echo "configure complete, now type \"make\""
  224. echo