configure.ac 6.0 KB

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