configure.ac 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. AC_INIT([love], [0.11.0])
  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. m4_include([platform/unix/deps.m4])
  22. includes=
  23. AC_DEFUN([LOVE_MSG_ERROR],
  24. [AC_MSG_ERROR([LÖVE needs "$1"[,] please install "$1" with development files and try again])])
  25. # C++11 support in cpp11.m4
  26. ACLOVE_CPP11_TEST
  27. # Allow people on OSX to use autotools, they need their platform files
  28. AC_ARG_ENABLE([osx],
  29. AC_HELP_STRING([--enable-osx], [Compile platform-specific files for OSX]), [], [enable_osx=no])
  30. AS_VAR_IF([enable_osx], [no], [], #else
  31. ac_cv_search_glLoadIdentity="-framework OpenGL"
  32. AC_SUBST([LDFLAGS], ["${LDFLAGS} -framework CoreFoundation -framework Cocoa"])
  33. AC_SUBST([CPPFLAGS], ["${CPPFLAGS} -I../platform/macosx"]))
  34. # stb_image sse2 override (https://github.com/nothings/stb/issues/280)
  35. AC_ARG_ENABLE([stbi-sse2-override],
  36. AC_HELP_STRING([--enable-stbi-sse2-override], [Force stb_image SSE2 support]), [], [enable_stbi_sse2_override=no])
  37. AS_VAR_IF([enable_stbi_sse2_override], [no], [], #else
  38. AC_SUBST([CPPFLAGS], ["${CPPFLAGS} -DLOVE_STBI_SSE2_OVERRIDE"]))
  39. # --with-lua and --with-luaversion
  40. AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [Select the lua implementation])],
  41. [], [with_lua=luajit])
  42. AC_ARG_WITH([luaversion], [AS_HELP_STRING([--with-luaversion], [Select the lua version])],
  43. [], [with_luaversion=5.1])
  44. with_clean_luaversion=`printf ${with_luaversion} | sed 's/\.//g'`
  45. # Generated sources for enabling/disabling modules
  46. m4_include([configure-modules-pre.ac])
  47. # Other features that can be enabled/disabled
  48. AC_ARG_ENABLE([mpg123], AC_HELP_STRING([--disable-mpg123], [Disable mp3 support, for patent-free builds]), [], [enable_mpg123=yes])
  49. AC_ARG_ENABLE([gme], AC_HELP_STRING([--enable-gme], [Enable GME support, for more chiptuney goodness]), [], [enable_gme=no])
  50. # Dependencies we always use
  51. ACLOVE_DEP_LUA
  52. ACLOVE_DEP_SDL2
  53. ACLOVE_DEP_LIBM
  54. ACLOVE_DEP_ZLIB
  55. # Conditional dependencies
  56. AS_VAR_IF([enable_module_audio], [yes], [ACLOVE_DEP_OPENAL], [])
  57. AS_VAR_IF([enable_module_filesystem], [yes], [ACLOVE_DEP_PHYSFS], [])
  58. AS_VAR_IF([enable_module_font], [yes], [ACLOVE_DEP_FREETYPE2], [])
  59. AS_VAR_IF([enable_module_sound], [yes], [
  60. ACLOVE_DEP_LIBMODPLUG
  61. ACLOVE_DEP_VORBISFILE
  62. ], [enable_mpg123=no])
  63. AS_VAR_IF([enable_module_video], [yes], [ACLOVE_DEP_THEORA], [])
  64. AS_VAR_IF([enable_gme], [yes], [ACLOVE_DEP_GME], [])
  65. AS_VAR_IF([enable_mpg123], [no],
  66. AC_DEFINE([LOVE_NOMPG123], [], [Build without mpg123]),
  67. [ACLOVE_DEP_MPG123])
  68. # Add flags for optional libraries
  69. AC_ARG_ENABLE([library-enet], [ --disable-library-enet Turn off library enet], [], [enable_library_enet=yes])
  70. AC_ARG_ENABLE([library-luasocket], [ --disable-library-luasocket Turn off library luasocket], [], [enable_library_luasocket=yes])
  71. AC_ARG_ENABLE([library-luautf8], [ --disable-library-luautf8 Turn off library luautf8], [], [enable_library_luautf8=yes])
  72. # Select the libraries we need to build, based on the selected modules
  73. AS_VAR_IF([enable_module_physics], [yes], [enable_library_Box2D=yes], [enable_library_Box2D=no])
  74. AS_VAR_IF([enable_module_image], [yes], [enable_library_ddsparse=yes], [enable_library_ddsparse=no])
  75. AS_VAR_IF([enable_module_graphics], [yes], [enable_library_glad=yes], [enable_library_glad=no])
  76. AS_VAR_IF([enable_module_graphics], [yes], [enable_library_glslang=yes], [enable_library_glslang=no])
  77. AS_VAR_IF([enable_module_image], [yes], [enable_library_lodepng=yes], [enable_library_lodepng=no])
  78. AS_VAR_IF([enable_module_math], [yes], [enable_library_lz4=yes], [enable_library_lz4=no])
  79. AS_VAR_IF([enable_module_math], [yes], [enable_library_noise1234=yes], [enable_library_noise1234=no])
  80. AS_VAR_IF([enable_module_image], [yes], [enable_library_stb=yes], [enable_library_stb=no])
  81. AS_VAR_IF([enable_module_image], [yes], [enable_library_tinyexr=yes], [enable_library_tinyexr=no])
  82. AS_VAR_IF([enable_module_sound], [yes], [enable_library_Wuff=yes], [enable_library_Wuff=no])
  83. AS_VAR_IF([enable_module_graphics], [yes], [enable_library_xxHash=yes], [enable_library_xxHash=no])
  84. # Utf8 is required by both graphics and font, so enable if either is enabled
  85. enable_library_utf8=no
  86. AS_VAR_IF([enable_module_graphics], [yes], [enable_library_utf8=yes], [])
  87. AS_VAR_IF([enable_module_font], [yes], [enable_library_utf8=yes], [])
  88. # libenet check for socklen_t
  89. ACLOVE_SOCKLEN_T
  90. # Generated sources for enabling/disabling modules
  91. m4_include([configure-modules-post.ac])
  92. # Optionally build the executable (default on)
  93. AC_ARG_ENABLE([exe],
  94. AC_HELP_STRING([--disable-exe], [Disable building of executable launcher]), [], [enable_exe=yes])
  95. AS_VAR_IF([enable_exe], [no], [], #else
  96. AC_DEFINE([LOVE_BUILD_EXE], [], [Skip building launcher]))
  97. AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno])
  98. AM_CONDITIONAL([LOVE_NOMPG123], [test "x$enable_mpg123" = xno])
  99. AM_CONDITIONAL([LOVE_TARGET_OSX], [test "x$enable_osx" != xno])
  100. # Automatic script file rebuilding
  101. AC_CHECK_PROGS([LUA_EXECUTABLE], ["${with_lua}${with_luaversion}" "${with_lua}" "lua"], [:])
  102. AS_VAR_IF([LUA_EXECUTABLE], [:],
  103. [AC_MSG_WARN([Did not find a lua executable, you may need to update the scripts manually if you change them])], [])
  104. # Set our includes as automake variable
  105. AC_SUBST([LOVE_INCLUDES], ["$includes"])
  106. AC_CONFIG_FILES([
  107. Makefile
  108. src/Makefile
  109. platform/unix/debian/control
  110. platform/unix/debian/changelog
  111. platform/unix/debian/rules
  112. ])
  113. AC_OUTPUT
  114. chmod 755 platform/unix/debian/rules