Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

276 lines
8.2KB

  1. AC_INIT([projectM], [3.1.13], [me@mish.dev], [projectM], [https://github.com/projectM-visualizer/projectm/])
  2. AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects tar-pax])
  3. AX_IS_RELEASE([git-directory])
  4. AX_CHECK_ENABLE_DEBUG([no], [DEBUG])
  5. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  6. LT_INIT
  7. # Check if we should disable rpath.
  8. #
  9. # For advanced users: In certain configurations, the rpath attributes
  10. # added by libtool cause problems as rpath will be preferred over
  11. # LD_LIBRARY_PATH. This does not seem to be a problem with
  12. # clang. When using --disable-rpath you will likely need to set
  13. # LD_LIBRARY_PATH if you are using libraries in non-system locations.
  14. # YMMV.
  15. #
  16. DISABLE_RPATH
  17. AC_PROG_CXX
  18. AC_LANG(C++)
  19. AC_CONFIG_MACRO_DIRS([m4 m4/autoconf-archive])
  20. dnl emscripten
  21. AC_ARG_ENABLE([emscripten],
  22. AS_HELP_STRING([--enable-emscripten], [Build for web with emscripten]),
  23. [], [enable_emscripten=no])
  24. AS_IF([test "x$enable_emscripten" = "xyes" || test "x$EMSCRIPTEN" = "xyes"], [
  25. dnl Set up emscripten
  26. m4_include([m4/emscripten.m4])
  27. AC_DEFINE([EMSCRIPTEN], [1], [Define EMSCRIPTEN])
  28. enable_threading=no
  29. enable_gles=yes
  30. enable_sdl=yes
  31. ], [
  32. dnl Running in a normal OS (not emscripten)
  33. AX_CHECK_GL
  34. # check OS if mac or linux
  35. AC_CANONICAL_HOST
  36. AC_MSG_CHECKING(Freedom)
  37. case $host_os in
  38. darwin*)
  39. # OSX needs CoreFoundation
  40. AC_MSG_RESULT(Apple hoarderware detected)
  41. LIBS="$LIBS -framework CoreFoundation"
  42. ;;
  43. linux*)
  44. # limux needs dl
  45. AC_MSG_RESULT(GNU/LINUX detected)
  46. LIBS="$LIBS -ldl"
  47. ;;
  48. *)
  49. AC_MSG_RESULT(Unknown)
  50. ;;
  51. esac
  52. ])
  53. AC_CHECK_LIB(c, dlopen, LIBDL="", AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl"))
  54. AC_CHECK_FUNCS_ONCE([aligned_alloc posix_memalign])
  55. AC_CHECK_HEADERS_ONCE([fts.h])
  56. AC_CONFIG_HEADERS([config.h])
  57. AC_CONFIG_FILES([
  58. Makefile
  59. src/Makefile
  60. src/libprojectM/Makefile
  61. src/libprojectM/Renderer/Makefile
  62. src/libprojectM/NativePresetFactory/Makefile
  63. src/libprojectM/MilkdropPresetFactory/Makefile
  64. src/libprojectM/libprojectM.pc
  65. src/NativePresets/Makefile
  66. src/projectM-sdl/Makefile
  67. src/projectM-emscripten/Makefile
  68. src/projectM-qt/Makefile
  69. src/projectM-pulseaudio/Makefile
  70. src/projectM-jack/Makefile
  71. src/projectM-test/Makefile
  72. ])
  73. # SDL
  74. AC_ARG_ENABLE([sdl], AS_HELP_STRING([--enable-sdl], [Build SDL2 application]), [], [enable_sdl=check])
  75. AS_IF([test "$enable_sdl" != "no"], [
  76. PKG_CHECK_MODULES([SDL], [sdl2], [
  77. m4_include([m4/sdl2.m4])
  78. SDL_VERSION="2.0.5"
  79. AS_IF([test "$TRAVIS"], [SDL_VERSION=2.0.2]) # travis has old SDL, we don't care
  80. AS_IF([test "$EMSCRIPTEN"], [SDL_VERSION=2.0.0]) # emscripten has old SDL, we don't care
  81. # Check for libSDL >= $SDL_VERSION
  82. AM_PATH_SDL2($SDL_VERSION,
  83. [enable_sdl=yes],
  84. [AS_IF([test "$enable_sdl" = "yes"], AC_MSG_ERROR([*** SDL version >= $SDL_VERSION not found!])); enable_sdl=no])
  85. ],
  86. [
  87. # not found
  88. AS_IF([test "$enable_sdl" = "yes"], AC_MSG_ERROR([*** libsdl2 not found!]))
  89. enable_sdl=no
  90. ])
  91. ])
  92. # Threading
  93. AC_ARG_ENABLE([threading],
  94. AS_HELP_STRING([--enable-threading], [multhreading]),
  95. [], [enable_threading=yes])
  96. AS_IF([test "x$enable_threading" = "xyes" && ! test "$EMSCRIPTEN"], [
  97. m4_include([m4/autoconf-archive/ax_pthread.m4])
  98. AX_PTHREAD([
  99. AC_DEFINE([USE_THREADS], [1], [Define USE_THREADS])
  100. LIBS="$LIBS $PTHREAD_LIBS $PTHREAD_CFLAGS"
  101. CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  102. CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
  103. echo "LIBS=$LIBS"
  104. ], [
  105. AC_MSG_ERROR([pthreads not found])
  106. ])
  107. ])
  108. AC_ARG_ENABLE([gles],
  109. AS_HELP_STRING([--enable-gles], [OpenGL ES support]),
  110. [], [enable_gles=no])
  111. AS_IF([test "x$enable_gles" = "xyes"], [
  112. AC_DEFINE([USE_GLES], [1], [Define USE_GLES])
  113. ])
  114. dnl LLVM
  115. dnl unfortuately AX_LLVM macro seems to be out of date, so we're going to rely on the user to make sure LLVM is installed correctly
  116. AC_ARG_ENABLE([llvm],
  117. AS_HELP_STRING([--enable-llvm],[Support for JIT using LLVM]),
  118. [], [enable_llvm=no])
  119. AS_IF([test x"$enable_llvm" = "xyes"], [
  120. AC_DEFINE([HAVE_LLVM], [1], [Define HAVE_LLVM])
  121. CFLAGS="$CFLAGS -I$(llvm-config --includedir)"
  122. CXXFLAGS="$CXXFLAGS -I$(llvm-config --includedir)"
  123. LIBS="$LIBS $(llvm-config --libs)"
  124. LDFLAGS="$LDFLAGS $(llvm-config --ldflags)"
  125. ])
  126. dnl from https://stackoverflow.com/questions/30897170/ac-subst-does-not-expand-variable answer: https://stackoverflow.com/a/30960268
  127. dnl ptomato https://stackoverflow.com/users/172999/ptomato
  128. AC_SUBST([PACKAGE])
  129. AC_PROG_SED
  130. AC_CONFIG_FILES([src/libprojectM/config.inp.in])
  131. AC_PREFIX_DEFAULT([/usr/local])
  132. AC_PROG_MKDIR_P
  133. AS_IF([echo ${host} | grep -Fq android], [],
  134. [AX_CHECK_COMPILE_FLAG([-stdlib=libc++], [
  135. CXXFLAGS="$CXXFLAGS -stdlib=libc++"])
  136. ])
  137. AX_CHECK_COMPILE_FLAG([-std=c++14], [
  138. CXXFLAGS="$CXXFLAGS -std=c++14"])
  139. # Qt5
  140. AC_ARG_ENABLE([qt], AS_HELP_STRING([--enable-qt], [Enable Qt: needed for pulseaudio and jack GUIs]), [], [enable_qt=check])
  141. AS_IF([test "$enable_qt" != "no"],
  142. [
  143. case $host_os in
  144. linux*)
  145. PATH="$PATH:`pkg-config --variable=host_bins Qt5Core`"
  146. ;;
  147. esac
  148. AX_HAVE_QT # m4/qt.m4
  149. AS_IF([test "$have_qt" = "yes"], [
  150. # we have at least qt5 if $have_qt is true
  151. enable_qt=yes
  152. export QT_SELECT=qt5
  153. # we depend on libQt5Gui and libQt5OpenGL
  154. # https://github.com/projectM-visualizer/projectm/issues/271
  155. LIBS="$LIBS -lQt5Gui -lQt5OpenGL"
  156. ],
  157. [AS_IF([test "$enable_qt" = "yes"],
  158. [AC_MSG_ERROR(["Qt5 not found"])],
  159. [enable_qt=no])]
  160. )])
  161. # Pulseaudio
  162. AC_ARG_ENABLE([pulseaudio], AS_HELP_STRING([--enable-pulseaudio], [Build Pulseaudio]), [], [enable_pulseaudio=check])
  163. AS_IF([test "$enable_pulseaudio" != "no"],
  164. [PKG_CHECK_MODULES([libpulse],
  165. [libpulse],
  166. [
  167. # still need qt
  168. AS_IF([test "$enable_qt" = "yes"],
  169. [enable_pulseaudio=yes],
  170. [enable_pulseaudio="no (Qt required)"])
  171. ],
  172. [AS_IF([test "$enable_pulseaudio" = "yes"],
  173. [AC_MSG_ERROR([libpulse required, but not found.])],
  174. [enable_pulseaudio=no])])])
  175. # Jack
  176. AC_ARG_ENABLE([jack], AS_HELP_STRING([--enable-jack], [Build Jack]), [], [enable_jack=check])
  177. AS_IF([test "$enable_jack" != "no"],
  178. [PKG_CHECK_MODULES([jack],
  179. [jack],
  180. [
  181. # still need qt
  182. AS_IF([test "$enable_qt" = "yes"],
  183. [enable_jack=yes],
  184. [enable_jack="no (Qt required)"])
  185. ],
  186. [AS_IF([test "$enable_jack" = "yes"],
  187. [AC_MSG_ERROR([jack required, but not found.])],
  188. [enable_jack=no])])])
  189. AM_CONDITIONAL([ENABLE_SDL], [test "x$enable_sdl" = "xyes"])
  190. AM_CONDITIONAL([ENABLE_QT], [test "x$enable_qt" = "xyes"])
  191. AM_CONDITIONAL([ENABLE_JACK], [test "x$enable_jack" = "xyes"])
  192. AM_CONDITIONAL([ENABLE_PULSEAUDIO], [test "x$enable_pulseaudio" = "xyes"])
  193. AM_CONDITIONAL([ENABLE_EMSCRIPTEN], [test "x$enable_emscripten" = "xyes"])
  194. my_CFLAGS="-Wall -Wchar-subscripts -Wformat-security -Wpointer-arith -Wshadow -Wsign-compare -Wtype-limits"
  195. #my_CFLAGS+="-fsanitize=address -fno-omit-frame-pointer "
  196. my_CFLAGS="${my_CFLAGS} -DDATADIR_PATH=\\\"\"\$(pkgdatadir)\\\"\""
  197. my_CFLAGS="${my_CFLAGS} -I\"\$(top_srcdir)/vendor\"" # provides glm headers
  198. my_CFLAGS="${my_CFLAGS} -DGL_SILENCE_DEPRECATION"
  199. AC_SUBST([my_CFLAGS])
  200. # glm (vendored, this should never fail; headers are in vendor/glm)
  201. AC_SUBST(CPPFLAGS, "$CPPFLAGS -I${srcdir}/vendor")
  202. AS_IF([test "x$enable_emscripten" != "xyes"], [
  203. AC_CHECK_HEADER([glm/glm.hpp],, AC_MSG_ERROR(vendored libglm not found.))
  204. ])
  205. AC_OUTPUT
  206. AC_MSG_RESULT([
  207. projectM v$VERSION
  208. =====
  209. prefix: ${prefix}
  210. sysconfdir: ${sysconfdir}
  211. libdir: ${libdir}
  212. includedir: ${includedir}
  213. compiler: ${CC}
  214. cflags: ${CFLAGS} ${my_CFLAGS}
  215. cxxflags: ${CXXFLAGS}
  216. libs: ${LIBS}
  217. ldflags: ${LDFLAGS}
  218. - - -
  219. Applications:
  220. =====
  221. libprojectM: yes
  222. Threading: ${enable_threading}
  223. SDL: ${enable_sdl}
  224. Qt: ${enable_qt}
  225. Pulseaudio: ${enable_pulseaudio}
  226. Jack: ${enable_jack}
  227. OpenGLES: ${enable_gles}
  228. Emscripten: ${enable_emscripten}
  229. LLVM JIT: ${enable_llvm}
  230. ])