configure.ac 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ(2.60)
  4. AC_INIT(vcmi, 0.83) # Follow NAME_VER in global.h
  5. AM_INIT_AUTOMAKE
  6. AC_CONFIG_MACRO_DIR([aclocal/m4])
  7. # Checks for build toolchain
  8. AC_LANG(C++)
  9. AC_PROG_CXX
  10. AC_ENABLE_SHARED
  11. AC_DISABLE_STATIC
  12. AC_PROG_LIBTOOL
  13. # Use silent rules if supported.
  14. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  15. AC_ARG_ENABLE(debug,
  16. [ --disable-debug turn off debugging (default=enable)],
  17. [ if test x$enableval = xyes ; then
  18. enable_debug="yes"
  19. else
  20. enable_debug="no"
  21. fi],
  22. [ enable_debug="yes" ])
  23. if test "x$GXX" = "xyes" -a "x$enable_debug" = "xyes" ; then
  24. CXXFLAGS="-O0 -ggdb"
  25. fi
  26. if test "x$GXX" = "xyes" ; then
  27. CXXFLAGS="$CXXFLAGS -Wall -Wno-switch -Wno-sign-compare -Wcast-align -Wpointer-arith"
  28. fi
  29. # For clang only. Need an autoconf test.
  30. # CXXFLAGS="$CXXFLAGS -Wno-address-of-temporary -Wno-unused-value -Wno-unknown-pragmas -Wno-cast-align"
  31. # Check for Boost libraries
  32. AX_BOOST_BASE([1.36])
  33. AX_BOOST_SYSTEM
  34. AX_BOOST_FILESYSTEM
  35. AX_BOOST_THREAD
  36. AX_BOOST_IOSTREAMS
  37. AX_BOOST_PROGRAM_OPTIONS
  38. # Check for SDL libraries
  39. saved_LIBS=$LIBS
  40. AC_CHECK_PROG(HAVE_SDL_CONFIG, sdl-config, yes, no)
  41. if test "$HAVE_SDL_CONFIG" = no; then
  42. AC_MSG_ERROR(sdl-config doesn't exist. Try to check the PATH enviroment.)
  43. fi
  44. AC_CHECK_LIB(SDL, SDL_Init,,AC_MSG_ERROR([SDL library not found. Please install it.]))
  45. AC_CHECK_LIB(SDL_mixer,main,,AC_MSG_ERROR([SDL_mixer library not found. Please install it.]))
  46. AC_CHECK_LIB(SDL_image,IMG_Load,,AC_MSG_ERROR([SDL_image library not found. Please install it.]))
  47. AC_CHECK_LIB(SDL_ttf,main,,AC_MSG_ERROR([SDL_ttf library not found. Please install it.]))
  48. SDL_CXXFLAGS=`sdl-config --cflags`
  49. SDL_LIBS="`sdl-config --libs` $LIBS"
  50. LIBS=$saved_LIBS
  51. # Check for ffmpeg libraries
  52. saved_LIBS=$LIBS
  53. AC_CHECK_LIB(avformat,main,,AC_MSG_ERROR([FFMpeg avformat library not found. Please install it.]))
  54. AC_CHECK_LIB(swscale,main,,AC_MSG_ERROR([FFMpeg swscale library not found. Please install it.]))
  55. FFMPEG_CXXFLAGS=`pkg-config --cflags libavformat libswscale`
  56. FFMPEG_LIBS=`pkg-config --libs libavformat libswscale`
  57. LIBS=$saved_LIBS
  58. # Checks for header files.
  59. AC_HEADER_STDC
  60. AC_CHECK_HEADERS([fcntl.h stdlib.h string.h])
  61. CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
  62. AC_CHECK_HEADERS([boost/filesystem.hpp boost/algorithm/string.hpp boost/algorithm/string/replace.hpp boost/filesystem/operations.hpp boost/assign/std/vector.hpp boost/algorithm/string/find.hpp boost/function.hpp boost/bind.hpp],,AC_MSG_ERROR([Required boost headers not found. Please install it.]))
  63. # Checks for library functions.
  64. AC_CHECK_FUNCS([atexit memset pow select sqrt])
  65. CXXFLAGS="$CXXFLAGS -DDATA_DIR=\\\"\$(pkgdatadir)\\\" -DBIN_DIR=\\\"\$(bindir)\\\" -DLIB_DIR=\\\"\$(pkglibdir)\\\""
  66. AC_SUBST(SDL_LIBS)
  67. AC_SUBST(SDL_CXXFLAGS)
  68. AC_SUBST(FFMPEG_LIBS)
  69. AC_SUBST(FFMPEG_CXXFLAGS)
  70. AC_OUTPUT(Makefile lib/Makefile client/Makefile server/Makefile AI/Makefile AI/GeniusAI/Makefile AI/EmptyAI/Makefile)