configure.ac 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. # autoconf source script for generating configure
  2. dnl The package_version file will be automatically synced to the git revision
  3. dnl by the update_version script when configured in the repository, but will
  4. dnl remain constant in tarball releases unless it is manually edited.
  5. m4_define([CURRENT_VERSION],
  6. m4_esyscmd([ if test -e package_version || ./update_version; then
  7. . ./package_version
  8. printf "$PACKAGE_VERSION"
  9. else
  10. printf "unknown"
  11. fi ]))
  12. AC_INIT([daala],[CURRENT_VERSION],[daala@xiph.org])
  13. AC_CONFIG_SRCDIR([src/decode.c])
  14. AC_CONFIG_MACRO_DIR([m4])
  15. AC_CONFIG_AUX_DIR([build-aux])
  16. AC_USE_SYSTEM_EXTENSIONS
  17. AC_SYS_LARGEFILE
  18. AC_PROG_CXX
  19. AM_INIT_AUTOMAKE([1.11 foreign no-define subdir-objects])
  20. AM_MAINTAINER_MODE([enable])
  21. LT_INIT
  22. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  23. dnl Library versioning for libtool.
  24. dnl Please update these for releases.
  25. dnl CURRENT, REVISION, AGE
  26. dnl - library source changed -> increment REVISION
  27. dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
  28. dnl - interfaces added -> increment AGE
  29. dnl - interfaces removed -> AGE = 0
  30. OD_LT_CURRENT=0
  31. OD_LT_REVISION=1
  32. OD_LT_AGE=0
  33. AC_SUBST(OD_LT_CURRENT)
  34. AC_SUBST(OD_LT_REVISION)
  35. AC_SUBST(OD_LT_AGE)
  36. CFLAGS="-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long \
  37. -Wshadow -Wno-overlength-strings $CFLAGS $OD_CFLAGS"
  38. # Platform-specific tweaks
  39. case $host in
  40. *-mingw*)
  41. # -std=c89 causes some warnings under mingw.
  42. CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
  43. # We need WINNT>=0x501 (WindowsXP) for getaddrinfo/freeaddrinfo.
  44. # It's okay to define this even when HTTP support is disabled, as it only
  45. # affects header declarations, not linking (unless we actually use some
  46. # XP-only functions).
  47. AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x501,
  48. [We need at least WindowsXP for getaddrinfo/freaddrinfo])
  49. host_mingw=true
  50. ;;
  51. *-*-darwin*)
  52. os_darwin=true
  53. ;;
  54. esac
  55. dnl These two are entirely unused at present.
  56. dnl AM_CONDITIONAL(OD_WIN32, test "$host_mingw" = "true")
  57. dnl AM_CONDITIONAL(OD_OS_DARWIN, test "$os_darwin" = "true")
  58. AC_ARG_ENABLE([assertions],
  59. AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
  60. enable_assertions=no)
  61. AM_CONDITIONAL([ENABLE_ASSERTIONS], [test "$enable_assertions" = "yes"])
  62. AS_IF([test "$enable_assertions" = "yes"], [
  63. AC_DEFINE([OD_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
  64. ])
  65. AC_ARG_ENABLE([logging],
  66. AS_HELP_STRING([--enable-logging], [Enable logging]),,
  67. enable_logging=no)
  68. AS_IF([test "$enable_logging" = "yes"], [
  69. AC_DEFINE([OD_LOGGING_ENABLED], [1], [Enable logging])
  70. ])
  71. AC_ARG_ENABLE([player],
  72. AS_HELP_STRING([--disable-player], [Disable the example player]),,
  73. enable_player=yes)
  74. dnl Set LIBM to the math library if needed.
  75. LT_LIB_M
  76. AC_CHECK_FUNCS([gettimeofday ftime],[break])
  77. AS_IF([test "$enable_player" = "yes"], [
  78. PKG_CHECK_MODULES([SDL], [sdl2])
  79. ])
  80. AM_CONDITIONAL([ENABLE_PLAYER_EXAMPLE], [test "$enable_player" = "yes"])
  81. PKG_CHECK_MODULES([OGG], [ogg >= 1.3])
  82. AC_ARG_ENABLE([analyzer],
  83. AS_HELP_STRING([--enable-analyzer], [Enable the stream analyzer]),,
  84. enable_analyzer=no)
  85. AS_IF([test "$enable_analyzer" = "yes"], [
  86. WX_CONFIG_OPTIONS
  87. WX_CONFIG_CHECK([2.8.0], [wxWin=1])
  88. if test "$wxWin" != 1 || test "$wx_ver_ok" != "yes"; then
  89. AC_MSG_ERROR([
  90. wxWidgets 2.8.0 must be installed on your system to build the stream
  91. analyzer. Please install or update your wxWidgets.
  92. ])
  93. fi
  94. ])
  95. AM_CONDITIONAL([ENABLE_ANALYZER], [test "$enable_analyzer" = "yes"])
  96. #CC_ATTRIBUTE_VISIBILITY([default], [
  97. # CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
  98. #])
  99. dnl Check for tools
  100. AC_ARG_ENABLE([tools],
  101. AC_HELP_STRING([--disable-tools], [Disable the tools]),,
  102. [enable_tools=yes])
  103. if test "$enable_tools" = "yes" ; then
  104. AC_CHECK_LIB([jpeg],[jpeg_start_compress],[JPEG_LIBS="-ljpeg"],[AC_MSG_ERROR([libjpeg needed for building tools])])
  105. AC_SUBST([JPEG_LIBS])
  106. PKG_CHECK_MODULES([PNG], [libpng])
  107. PKG_CHECK_MODULES([TIFF], [libtiff-4])
  108. AC_OPENMP
  109. fi
  110. AM_CONDITIONAL(ENABLE_TOOLS, [test $enable_tools = "yes"])
  111. dnl Check for check
  112. AC_ARG_ENABLE([unit-tests],
  113. AS_HELP_STRING([--disable-unit-tests], [Do not build unit tests]),,
  114. [enable_unit_tests=yes]
  115. )
  116. if test "$enable_unit_tests" = "yes" ; then
  117. PKG_CHECK_MODULES([CHECK], [check >= 0.9.8])
  118. dnl As of version 0.9.10, check does not include -pthread in its Cflags or
  119. dnl Libs even though it does depend on it. Assuming that check.pc may one day
  120. dnl be fixed for that, only add it here if it's not there already. It really
  121. dnl belongs in LDFLAGS here (since check is a static lib and doesn't expose
  122. dnl pthread functions in its header), but it can't be added to CHECK_LIBS,
  123. dnl since automake 1.13 will barf about adding -pthread to *_LDADD rather
  124. dnl than *_LDFLAGS. However libtool does also include CFLAGS when linking.
  125. case $CHECK_CFLAGS in
  126. *-pthread*)
  127. ;;
  128. *)
  129. CHECK_CFLAGS="-pthread $CHECK_CFLAGS"
  130. ;;
  131. esac
  132. fi
  133. AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test $enable_unit_tests = "yes"])
  134. AC_ARG_ENABLE([doc],
  135. AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
  136. [enable_doc=yes]
  137. )
  138. AS_IF([test "$enable_doc" = "yes"], [
  139. AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no])
  140. AC_CHECK_PROG([HAVE_FIG2DEV], [fig2dev], [yes], [no])
  141. ],[
  142. HAVE_DOXYGEN=no
  143. HAVE_FIG2DEV=no
  144. ])
  145. AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])
  146. AM_CONDITIONAL([HAVE_FIG2DEV], [test "$HAVE_FIG2DEV" = "yes"])
  147. AC_ARG_ENABLE([asm],
  148. AS_HELP_STRING([--disable-asm], [Do not compile assembly versions]),,
  149. [enable_asm=yes]
  150. )
  151. case $host_cpu in
  152. i[3456]86)
  153. cpu_x86=true
  154. ;;
  155. x86_64)
  156. cpu_x86=true
  157. ;;
  158. esac
  159. TMP_CFLAGS="$CFLAGS"
  160. AS_IF([test "$enable_asm" = "yes" -a "$cpu_x86" = "true"], [
  161. AC_DEFINE([OD_X86ASM], [1], [Enable asm optimisations])
  162. CFLAGS="$CFLAGS -msse2"
  163. AC_TRY_LINK([
  164. #include <xmmintrin.h>
  165. ], [
  166. return _mm_cvtsi128_si32(_mm_setzero_si128());
  167. ], [
  168. enable_sse2_intrinsics=yes
  169. AC_DEFINE([OD_SSE2_INTRINSICS], [1],
  170. [Enable SSE2 intrinsics optimisations])
  171. TMP_CFLAGS="$CFLAGS"
  172. CFLAGS="$CFLAGS -msse4.1"
  173. AC_TRY_LINK([
  174. #include <smmintrin.h>
  175. ], [
  176. return _mm_cvtsi128_si32(_mm_mullo_epi32(_mm_setzero_si128(),
  177. _mm_setzero_si128()));
  178. ], [
  179. enable_sse41_intrinsics=yes
  180. AC_DEFINE([OD_SSE41_INTRINSICS], [1],
  181. [Enable SSE4.1 intrinsics optimisations])
  182. TMP_CFLAGS="$CFLAGS"
  183. CFLAGS="$CFLAGS -mavx2"
  184. AC_TRY_LINK([
  185. #include <immintrin.h>
  186. ], [
  187. return _mm_cvtsi128_si32(_mm_broadcastb_epi8(_mm_setzero_si128()));
  188. ], [
  189. enable_avx2_intrinsics=yes
  190. AC_DEFINE([OD_AVX2_INTRINSICS], [1],
  191. [Enable AVX2 intrinsics optimisations])
  192. ], [enable_avx2_intrinsics=no]
  193. )
  194. ], [enable_sse41_intrinsics=no]
  195. )
  196. ], [enable_sse2_intrinsics=no]
  197. )
  198. ])
  199. CFLAGS="$TMP_CFLAGS"
  200. AM_CONDITIONAL([ENABLE_X86ASM],
  201. [test "$enable_asm" = "yes" -a "$cpu_x86" = "true"])
  202. AM_CONDITIONAL([ENABLE_SSE2_INTRINSICS],
  203. [test "$enable_asm" = "yes" -a "$cpu_x86" = "true" -a "$enable_sse2_intrinsics" = "yes"])
  204. AM_CONDITIONAL([ENABLE_SSE41_INTRINSICS],
  205. [test "$enable_asm" = "yes" -a "$cpu_x86" = "true" -a "$enable_sse41_intrinsics" = "yes"])
  206. AM_CONDITIONAL([ENABLE_AVX2_INTRINSICS],
  207. [test "$enable_asm" = "yes" -a "$cpu_x86" = "true" -a "$enable_avx2_intrinsics" = "yes"])
  208. AC_ARG_ENABLE([encoder-check],
  209. AS_HELP_STRING([--enable-encoder-check], [Compare reconstructed frames]),,
  210. [enable_encoder_check=no])
  211. AS_IF([test "$enable_encoder_check" = "yes"], [
  212. AC_DEFINE([OD_ENCODER_CHECK], [1], [Enable comparison of reconstructed frames])
  213. ])
  214. AM_CONDITIONAL([ENCODER_CHECK], [test "$enable_encoder_check" = "yes"])
  215. AC_ARG_ENABLE([dct-check-overflow],
  216. AS_HELP_STRING([--enable-dct-check-overflow], [Check for DCT overflow]),,
  217. [enable_dct_check_overflow=no])
  218. AS_IF([test "$enable_dct_check_overflow" = "yes"], [
  219. AC_DEFINE([OD_DCT_CHECK_OVERFLOW], [1], [Check for DCT overflow])
  220. ])
  221. AC_ARG_ENABLE([check-asm],
  222. AS_HELP_STRING([--enable-check-asm], [Validate assembly code]),,
  223. [enable_check_asm=no])
  224. AS_IF([test "$enable_check_asm" = "yes"], [
  225. AC_DEFINE([OD_CHECKASM], [1], [Validate assembly code])
  226. ])
  227. AC_ARG_ENABLE([dump-images],
  228. AS_HELP_STRING([--enable-dump-images], [Dump debugging images]),,
  229. [enable_dump_images=no])
  230. AS_IF([test "$enable_dump_images" = "yes"], [
  231. AC_DEFINE([OD_DUMP_IMAGES], [1], [Enable image dumping])
  232. if test "$enable_tools" != "yes" ; then
  233. PKG_CHECK_MODULES([PNG], [libpng])
  234. fi
  235. PC_PNG_REQUIRES="libpng"
  236. PC_PNG_LIBS="$PNG_LIBS"
  237. ])
  238. AM_CONDITIONAL([DUMP_IMAGES], [test "$enable_dump_images" = "yes"])
  239. AC_SUBST([PC_PNG_REQUIRES])
  240. AC_SUBST([PC_PNG_LIBS])
  241. AC_ARG_ENABLE([dump-recons],
  242. AS_HELP_STRING([--enable-dump-recons], [Dump reconstructed video]),,
  243. [enable_dump_recons=no])
  244. AS_IF([test "$enable_dump_recons" = "yes"], [
  245. AC_DEFINE([OD_DUMP_RECONS], [1], [Enable reconstructed video dumping])
  246. ])
  247. AC_ARG_ENABLE([dump-coeffs],
  248. AS_HELP_STRING([--enable-dump-coeffs], [Dump transform coefficients]),,
  249. [enable_dump_coeffs=no])
  250. AS_IF([test "$enable_dump_coeffs" = "yes"], [
  251. AC_DEFINE([OD_DUMP_COEFFS], [1], [Enable transform coefficient dumping])
  252. ])
  253. AC_ARG_ENABLE([accounting],
  254. AS_HELP_STRING([--enable-accounting], [Enable bit accounting]),
  255. [if test "$host_mingw" = "true"; then AC_MSG_ERROR([accounting not supported on Windows]); fi],
  256. [enable_accounting=no])
  257. AS_IF([test "$enable_accounting" = "yes"], [
  258. AC_DEFINE([OD_ACCOUNTING], [1], [Enable bit accounting])])
  259. AC_ARG_ENABLE([ec-accounting],
  260. AS_HELP_STRING([--enable-ec-accounting], [Enable entropy coder accounting]),,
  261. [enable_ec_accounting=no])
  262. AS_IF([test "$enable_ec_accounting" = "yes"], [
  263. AC_DEFINE([OD_EC_ACCOUNTING], [1], [Enable entropy coder accounting])])
  264. AC_CONFIG_FILES([
  265. Makefile
  266. daalaenc.pc
  267. daaladec.pc
  268. daalaenc-uninstalled.pc
  269. daaladec-uninstalled.pc
  270. doc/Doxyfile
  271. doc/Makefile
  272. ])
  273. AC_CONFIG_HEADERS([config.h])
  274. AC_OUTPUT
  275. AC_MSG_NOTICE([
  276. ------------------------------------------------------------------------
  277. $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
  278. Assertions ................... ${enable_assertions}
  279. Logging ...................... ${enable_logging}
  280. API documentation ............ ${enable_doc}
  281. Assembly optimizations ....... ${enable_asm}
  282. Image dumping ................ ${enable_dump_images}
  283. Reconstructed video dumping .. ${enable_dump_recons}
  284. Transform coeffs dumping ..... ${enable_dump_coeffs}
  285. Check encoder ................ ${enable_encoder_check}
  286. Check DCT overflow............ ${enable_dct_check_overflow}
  287. Check assembly................ ${enable_check_asm}
  288. Bit accounting ............... ${enable_accounting}
  289. Entropy coder accounting ..... ${enable_ec_accounting}
  290. Tools ........................ ${enable_tools}
  291. Unit tests ................... ${enable_unit_tests}
  292. Example Player................ ${enable_player}
  293. Stream Analyzer .............. ${enable_analyzer}
  294. ------------------------------------------------------------------------
  295. Use "make tools" to compile the tools.
  296. Use "make clean && make debug" to enable assertions and logging
  297. without needing to reconfigure the source tree.
  298. ])