configure.ac 6.1 KB

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