configure.ac 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. AC_INIT([love], [HEAD])
  2. AC_CONFIG_HEADERS([config.h])
  3. AC_CONFIG_AUX_DIR([platform/unix])
  4. AC_CONFIG_MACRO_DIR([platform/unix/m4])
  5. AC_CONFIG_SRCDIR([src/love.cpp])
  6. AM_INIT_AUTOMAKE([foreign -Wall foreign tar-ustar silent-rules])
  7. AM_SILENT_RULES
  8. AC_PREFIX_DEFAULT([/usr])
  9. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  10. LT_INIT([disable-static])
  11. AC_PROG_CC
  12. AC_PROG_CXX
  13. AC_PROG_SED
  14. AC_PROG_MKDIR_P
  15. AC_PROG_OBJCXX
  16. PKG_PROG_PKG_CONFIG
  17. AC_C_BIGENDIAN
  18. AC_LANG([C++])
  19. dnl Workaround for old aclocal versions
  20. m4_include([platform/unix/cpp11.m4])
  21. includes=
  22. AC_DEFUN([LOVE_MSG_ERROR],
  23. [AC_MSG_ERROR([LÖVE needs "$1"[,] please install "$1" with development files and try again])])
  24. # C++11 support in cpp11.m4
  25. ACLOVE_CPP11_TEST
  26. # Allow people on OSX to use autotools, they need their platform files
  27. AC_ARG_ENABLE([osx],
  28. AC_HELP_STRING([--enable-osx], [Compile platform-specific files for OSX]), [], [enable_osx=no])
  29. AS_VAR_IF([enable_osx], [no], [], #else
  30. ac_cv_search_glLoadIdentity="-framework OpenGL"
  31. AC_SUBST([LDFLAGS], ["${LDFLAGS} -framework CoreFoundation -framework Cocoa"])
  32. AC_SUBST([CPPFLAGS], ["${CPPFLAGS} -I../platform/macosx"]))
  33. # --with-lua and --with-luaversion
  34. AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [Select the lua implementation])],
  35. [], [with_lua=luajit])
  36. AC_ARG_WITH([luaversion], [AS_HELP_STRING([--with-luaversion], [Select the lua version])],
  37. [], [with_luaversion=5.1])
  38. # pkg-config libraries
  39. AM_PATH_SDL2([], [], [LOVE_MSG_ERROR([SDL 2])])
  40. with_clean_luaversion=`printf ${with_luaversion} | sed 's/\.//g'`
  41. PKG_CHECK_MODULES([lua], [${with_lua}${with_luaversion}], [lua_found=yes],
  42. [PKG_CHECK_MODULES([lua], [${with_lua}${with_clean_luaversion}], [lua_found=yes],
  43. [PKG_CHECK_MODULES([lua], [${with_lua}], [lua_found=yes], [lua_found=no])])])
  44. PKG_CHECK_MODULES([freetype2], [freetype2], [], [LOVE_MSG_ERROR([FreeType2])])
  45. PKG_CHECK_MODULES([openal], [openal], [], [LOVE_MSG_ERROR([OpenAL])])
  46. PKG_CHECK_MODULES([libmodplug], [libmodplug], [], [LOVE_MSG_ERROR([libmodplug])])
  47. PKG_CHECK_MODULES([vorbisfile], [vorbisfile], [], [LOVE_MSG_ERROR([libvorbis and libvorbisfile])])
  48. PKG_CHECK_MODULES([zlib], [zlib], [], [LOVE_MSG_ERROR([zlib])])
  49. PKG_CHECK_MODULES([theora], [theoradec], [], [LOVE_MSG_ERROR([libtheora])])
  50. # Other libraries
  51. AC_SEARCH_LIBS([sqrt], [m], [], [LOVE_MSG_ERROR([the C math library])])
  52. AC_SEARCH_LIBS([PHYSFS_init], [physfs], [], [LOVE_MSG_ERROR([PhysicsFS])])
  53. # Lua, treated seperately because of --with-lua
  54. AS_VAR_IF([lua_found], [yes],
  55. #if
  56. [
  57. luaheaders_found=yes
  58. AC_MSG_CHECKING([for library containing lua_call])
  59. AC_MSG_RESULT([${lua_LIBS}])],
  60. #else
  61. [
  62. AC_MSG_WARN([Could not find pkg-config definition for ${with_lua}${with_luaversion} or ${with_lua}${with_clean_luaversion}${with_lua}, falling back to manual detection])
  63. AC_SEARCH_LIBS([lua_call], ["${with_lua}${with_luaversion}" "${with_lua}"], [],
  64. [LOVE_MSG_ERROR([$with_lua])])
  65. luaheaders_found=no
  66. AC_CHECK_HEADER(["${with_lua}${with_luaversion}/lua.h"], [luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}${with_luaversion}"], [])
  67. AC_CHECK_HEADER(["${with_lua}/lua.h"], [luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}"], [])])
  68. AS_VAR_IF([luaheaders_found], [yes], [], #else
  69. [
  70. AC_MSG_WARN([Could not locate lua headers for ${with_lua}${with_luaversion} or ${with_lua}, you probably need to specify them with CPPFLAGS])])
  71. # mpg123, treated seperately because it can be disabled (default on)
  72. # also not pkg-config because of the FILE_OFFSET_BITS.. bit
  73. AC_ARG_ENABLE([mpg123], AC_HELP_STRING([--disable-mpg123], [Disable mp3 support, for patent-free builds]), [], [enable_mpg123=yes])
  74. AS_VAR_IF([enable_mpg123], [no],
  75. AC_DEFINE([LOVE_NOMPG123], [], [Build without mpg123]),
  76. # else
  77. AC_SEARCH_LIBS([mpg123_open_feed], [mpg123], [],
  78. [LOVE_MSG_ERROR([libmpg123])])
  79. AC_SEARCH_LIBS([mpg123_seek_64], [mpg123],
  80. AC_SUBST([FILE_OFFSET],[-D_FILE_OFFSET_BITS=64]),
  81. AC_SUBST([FILE_OFFSET],[])))
  82. # GME, treated seperately because it can be enabled (default off)
  83. AC_ARG_ENABLE([gme], AC_HELP_STRING([--enable-gme], [Enable GME support, for more chiptuney goodness]), [], [enable_gme=no])
  84. AS_VAR_IF([enable_gme], [yes],
  85. AC_SEARCH_LIBS([gme_open_data], [gme], [], [LOVE_MSG_ERROR([gme])])
  86. AC_DEFINE([LOVE_SUPPORT_GME], [], [Enable gme])
  87. AC_CHECK_HEADER([gme/gme.h], [includes="$includes -I/usr/include/gme"], []))
  88. # libenet check for socklen_t
  89. AC_CHECK_TYPE([socklen_t], [AC_DEFINE([HAS_SOCKLEN_T], [1], [Define if socklen_t exists.] )], ,
  90. #include <sys/types.h>
  91. #include <sys/socket.h>
  92. )
  93. # Optionally build the executable (default on)
  94. AC_ARG_ENABLE([exe],
  95. AC_HELP_STRING([--disable-exe], [Disable building of executable launcher]), [], [enable_exe=yes])
  96. AS_VAR_IF([enable_exe], [no], [], #else
  97. AC_DEFINE([LOVE_BUILD_EXE], [], [Skip building launcher]))
  98. AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno])
  99. AM_CONDITIONAL([LOVE_NOMPG123], [test "x$enable_mpg123" = xno])
  100. AM_CONDITIONAL([LOVE_TARGET_OSX], [test "x$enable_osx" != xno])
  101. # Automatic script file rebuilding
  102. AC_CHECK_PROGS([LUA_EXECUTABLE], ["${with_lua}${with_luaversion}" "${with_lua}" "lua"], [:])
  103. AS_VAR_IF([LUA_EXECUTABLE], [:],
  104. [AC_MSG_WARN([Did not find a lua executable, you may need to update the scripts manually if you change them])], [])
  105. # Set our includes as automake variable
  106. AC_SUBST([LOVE_INCLUDES], ["$includes"])
  107. m4_include([configure-modules.ac])
  108. AC_CONFIG_FILES([
  109. Makefile
  110. src/Makefile
  111. platform/unix/debian/control
  112. platform/unix/debian/changelog
  113. platform/unix/debian/rules
  114. ])
  115. AC_OUTPUT
  116. chmod 755 platform/unix/debian/rules