configure.ac 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. AC_INIT([audiowmark],[0.6.1])
  2. AC_CONFIG_SRCDIR([src/audiowmark.cc])
  3. AC_CONFIG_AUX_DIR([build-aux])
  4. AC_CONFIG_MACRO_DIR([m4])
  5. AC_CONFIG_HEADERS([config.h])
  6. AM_INIT_AUTOMAKE([foreign])
  7. AC_PROG_CXX
  8. LT_INIT
  9. dnl
  10. dnl sndfile
  11. dnl
  12. AC_DEFUN([AC_SNDFILE_REQUIREMENTS],
  13. [
  14. PKG_CHECK_MODULES(SNDFILE, [sndfile])
  15. AC_SUBST(SNDFILE_CFLAGS)
  16. AC_SUBST(SNDFILE_LIBS)
  17. ])
  18. dnl
  19. dnl libmpg123
  20. dnl
  21. AC_DEFUN([AC_LIBMPG123_REQUIREMENTS],
  22. [
  23. PKG_CHECK_MODULES(LIBMPG123, [libmpg123])
  24. AC_SUBST(LIBMPG123_CFLAGS)
  25. AC_SUBST(LIBMPG123_LIBS)
  26. ])
  27. dnl
  28. dnl zita resampler
  29. dnl
  30. AC_DEFUN([AC_ZITA_REQUIREMENTS],
  31. [
  32. AC_CHECK_LIB(zita-resampler, _Z28zita_resampler_major_versionv,[],
  33. [
  34. AC_MSG_ERROR([You need to install libzita-resampler to build this package.])
  35. ]
  36. )
  37. ])
  38. dnl ffmpeg stuff
  39. AC_DEFUN([AC_FFMPEG_REQUIREMENTS],
  40. [
  41. PKG_CHECK_MODULES(FFMPEG, libavcodec libavformat libavutil libswresample)
  42. ])
  43. dnl FFTW3
  44. AC_DEFUN([AC_FFTW_CHECK],
  45. [
  46. dnl this used to be optional, but is currently required
  47. PKG_CHECK_MODULES(FFTW, [fftw3f])
  48. SPECTMORPH_HAVE_FFTW=1
  49. if test $SPECTMORPH_HAVE_FFTW -gt 0; then
  50. fftw_save_CFLAGS="$CFLAGS"
  51. CFLAGS="$CFLAGS $FFTW_CFLAGS"
  52. AC_MSG_CHECKING([whether FFTW is recent enough])
  53. AC_COMPILE_IFELSE([
  54. AC_LANG_SOURCE([
  55. #include "fftw3.h"
  56. int x = FFTW_WISDOM_ONLY;
  57. ])
  58. ],[
  59. AC_MSG_RESULT([yes])
  60. ],[
  61. AC_MSG_RESULT([no])
  62. SPECTMORPH_HAVE_FFTW=0
  63. ])
  64. fi
  65. CFLAGS="$fftw_save_CFLAGS"
  66. AC_DEFINE_UNQUOTED(SPECTMORPH_HAVE_FFTW, $SPECTMORPH_HAVE_FFTW, [Whether libfftw3 is available])
  67. ])
  68. AC_SNDFILE_REQUIREMENTS
  69. AC_LIBMPG123_REQUIREMENTS
  70. AC_ZITA_REQUIREMENTS
  71. AC_FFTW_CHECK
  72. AM_PATH_LIBGCRYPT
  73. dnl -------------------- ffmpeg is optional ----------------------------
  74. AC_ARG_WITH([ffmpeg], [AS_HELP_STRING([--with-ffmpeg], [build against ffmpeg libraries])], [], [with_ffmpeg=no])
  75. if test "x$with_ffmpeg" != "xno"; then
  76. AC_FFMPEG_REQUIREMENTS
  77. HAVE_FFMPEG=1
  78. else
  79. HAVE_FFMPEG=0
  80. fi
  81. AC_DEFINE_UNQUOTED(HAVE_FFMPEG, $HAVE_FFMPEG, [whether ffmpeg libs are available])
  82. AM_CONDITIONAL([COND_WITH_FFMPEG], [test "x$with_ffmpeg" != "xno"])
  83. dnl -------------------------------------------------------------------------
  84. dnl -------------------- address sanitizer ----------------------------------
  85. AC_ARG_ENABLE([asan], [AS_HELP_STRING([--enable-asan], [build using address sanitizer])],
  86. [
  87. CXXFLAGS="$CXXFLAGS -fsanitize=address -fno-omit-frame-pointer -fstack-protector-all -fno-inline"
  88. LDFLAGS="$LDFLAGS -lasan"
  89. ],
  90. [
  91. enable_asan=no
  92. ])
  93. dnl -------------------------------------------------------------------------
  94. dnl -------------------- undefined behaviour sanitizer ----------------------
  95. AC_ARG_ENABLE([ubsan], [AS_HELP_STRING([--enable-ubsan], [build using undefined behaviour sanitizer])],
  96. [
  97. CXXFLAGS="$CXXFLAGS -fsanitize=undefined -fno-omit-frame-pointer -fstack-protector-all -fno-inline"
  98. LDFLAGS="$LDFLAGS -lubsan"
  99. ],
  100. [
  101. enable_ubsan=no
  102. ])
  103. dnl -------------------------------------------------------------------------
  104. dnl -------------------- thread sanitizer -----------------------------------
  105. AC_ARG_ENABLE([tsan], [AS_HELP_STRING([--enable-tsan], [build using thread sanitizer])],
  106. [
  107. CXXFLAGS="$CXXFLAGS -fsanitize=thread -fno-omit-frame-pointer -fstack-protector-all -fno-inline"
  108. LDFLAGS="$LDFLAGS -ltsan"
  109. ],
  110. [
  111. enable_tsan=no
  112. ])
  113. dnl -------------------------------------------------------------------------
  114. dnl -------------------- leak sanitizer -------------------------------------
  115. AC_ARG_ENABLE([lsan], [AS_HELP_STRING([--enable-lsan], [build using leak sanitizer])],
  116. [
  117. CXXFLAGS="$CXXFLAGS -fsanitize=leak -fno-omit-frame-pointer -fstack-protector-all -fno-inline"
  118. LDFLAGS="$LDFLAGS -llsan"
  119. ],
  120. [
  121. enable_lsan=no
  122. ])
  123. dnl -------------------------------------------------------------------------
  124. dnl -------------------- glibcxx assertions ----------------------------------
  125. AC_ARG_ENABLE(debug-cxx,AS_HELP_STRING([--enable-debug-cxx], [setup compiler flags to do C++ STL debug checks]),
  126. [
  127. CXXFLAGS="$CXXFLAGS -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC"
  128. ],
  129. [
  130. enable_debug_cxx=no
  131. ])
  132. dnl -------------------------------------------------------------------------
  133. # need c++14 mode
  134. AX_CXX_COMPILE_STDCXX_14(ext)
  135. # use -Wall / -pthread if available
  136. AC_LANG_PUSH([C++])
  137. AX_CHECK_COMPILE_FLAG([-Wall], [CXXFLAGS="$CXXFLAGS -Wall"])
  138. AX_CHECK_COMPILE_FLAG([-pthread], [CXXFLAGS="$CXXFLAGS -pthread"])
  139. AC_LANG_POP([C++])
  140. # Less cluttered build output
  141. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  142. AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile tests/test-common.sh])
  143. AC_OUTPUT
  144. # Output summary message
  145. echo
  146. echo "---------------------------------------------------------------------------"
  147. echo "$PACKAGE_NAME $PACKAGE_VERSION"
  148. echo "---------------------------------------------------------------------------"
  149. echo " Use address sanitizer. . . . . . . .: $enable_asan (for debugging)"
  150. echo " Use undefined behaviour sanitizer. .: $enable_ubsan (for debugging)"
  151. echo " Use thread sanitizer . . . . . . . .: $enable_tsan (for debugging)"
  152. echo " Use leak sanitizer . . . . . . . . .: $enable_lsan (for debugging)"
  153. echo " Use stdc++ debug mode. . . . . . . .: $enable_debug_cxx (for debugging)"
  154. echo " Use ffmpeg libs. . . . . . . . . . .: $with_ffmpeg (required for HLS)"