configure.ac 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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. AM_INIT_AUTOMAKE([1.11 foreign no-define subdir-objects])
  19. AM_MAINTAINER_MODE([enable])
  20. LT_INIT
  21. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  22. dnl Library versioning for libtool.
  23. dnl Please update these for releases.
  24. dnl CURRENT, REVISION, AGE
  25. dnl - library source changed -> increment REVISION
  26. dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
  27. dnl - interfaces added -> increment AGE
  28. dnl - interfaces removed -> AGE = 0
  29. OD_LT_CURRENT=0
  30. OD_LT_REVISION=1
  31. OD_LT_AGE=0
  32. AC_SUBST(OD_LT_CURRENT)
  33. AC_SUBST(OD_LT_REVISION)
  34. AC_SUBST(OD_LT_AGE)
  35. CFLAGS="-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long -Wno-overlength-strings $CFLAGS"
  36. # Platform-specific tweaks
  37. case $host in
  38. *-mingw*)
  39. # -std=c89 causes some warnings under mingw.
  40. CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
  41. # We need WINNT>=0x501 (WindowsXP) for getaddrinfo/freeaddrinfo.
  42. # It's okay to define this even when HTTP support is disabled, as it only
  43. # affects header declarations, not linking (unless we actually use some
  44. # XP-only functions).
  45. AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x501,
  46. [We need at least WindowsXP for getaddrinfo/freaddrinfo])
  47. host_mingw=true
  48. ;;
  49. *-*-darwin*)
  50. os_darwin=true
  51. ;;
  52. esac
  53. dnl These two are entirely unused at present.
  54. dnl AM_CONDITIONAL(OD_WIN32, test "$host_mingw" = "true")
  55. dnl AM_CONDITIONAL(OD_OS_DARWIN, test "$os_darwin" = "true")
  56. AC_ARG_ENABLE([assertions],
  57. AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
  58. enable_assertions=no)
  59. AM_CONDITIONAL([ENABLE_ASSERTIONS], [test "$enable_assertions" = "yes"])
  60. AS_IF([test "$enable_assertions" = "yes"], [
  61. AC_DEFINE([OD_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
  62. ])
  63. AC_ARG_ENABLE([logging],
  64. AS_HELP_STRING([--enable-logging], [Enable logging]),,
  65. enable_logging=no)
  66. AS_IF([test "$enable_logging" = "yes"], [
  67. AC_DEFINE([OD_LOGGING_ENABLED], [1], [Enable logging])
  68. ])
  69. AC_ARG_ENABLE([player],
  70. AS_HELP_STRING([--disable-player], [Disable the example player]),,
  71. enable_player=yes)
  72. dnl Set LIBM to the math library if needed.
  73. LT_LIB_M
  74. AC_CHECK_FUNCS([gettimeofday ftime],[break])
  75. AS_IF([test "$enable_player" = "yes"], [
  76. PKG_CHECK_MODULES([SDL], [sdl])
  77. ])
  78. AM_CONDITIONAL([ENABLE_PLAYER_EXAMPLE], [test "$enable_player" = "yes"])
  79. PKG_CHECK_MODULES([OGG], [ogg >= 1.3])
  80. PKG_CHECK_MODULES([PNG], [libpng])
  81. #CC_ATTRIBUTE_VISIBILITY([default], [
  82. # CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
  83. #])
  84. dnl Check for tools
  85. AC_ARG_ENABLE([tools],
  86. AC_HELP_STRING([--disable-tools], [Disable the tools]),,
  87. [enable_tools=yes])
  88. if test "$enable_tools" = "yes" ; then
  89. AC_CHECK_LIB([jpeg],[jpeg_start_compress],[JPEG_LIBS="-ljpeg"],[AC_MSG_ERROR([libjpeg needed for building tools])])
  90. AC_SUBST([JPEG_LIBS])
  91. AC_OPENMP
  92. fi
  93. AM_CONDITIONAL(ENABLE_TOOLS, [test $enable_tools = "yes"])
  94. dnl Check for check
  95. AC_ARG_ENABLE([unit-tests],
  96. AS_HELP_STRING([--disable-unit-tests], [Do not build unit tests]),,
  97. [enable_unit_tests=yes]
  98. )
  99. if test "$enable_unit_tests" = "yes" ; then
  100. PKG_CHECK_MODULES([CHECK], [check >= 0.9.8])
  101. dnl As of version 0.9.10, check does not include -pthread in its Cflags or
  102. dnl Libs even though it does depend on it. Assuming that check.pc may one day
  103. dnl be fixed for that, only add it here if it's not there already. It really
  104. dnl belongs in LDFLAGS here (since check is a static lib and doesn't expose
  105. dnl pthread functions in its header), but it can't be added to CHECK_LIBS,
  106. dnl since automake 1.13 will barf about adding -pthread to *_LDADD rather
  107. dnl than *_LDFLAGS. However libtool does also include CFLAGS when linking.
  108. case $CHECK_CFLAGS in
  109. *-pthread*)
  110. ;;
  111. *)
  112. CHECK_CFLAGS="-pthread $CHECK_CFLAGS"
  113. ;;
  114. esac
  115. fi
  116. AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test $enable_unit_tests = "yes"])
  117. AC_ARG_ENABLE([doc],
  118. AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
  119. [enable_doc=yes]
  120. )
  121. AS_IF([test "$enable_doc" = "yes"], [
  122. AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no])
  123. AC_CHECK_PROG([HAVE_FIG2DEV], [fig2dev], [yes], [no])
  124. ],[
  125. HAVE_DOXYGEN=no
  126. HAVE_FIG2DEV=no
  127. ])
  128. AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])
  129. AM_CONDITIONAL([HAVE_FIG2DEV], [test "$HAVE_FIG2DEV" = "yes"])
  130. AC_ARG_ENABLE([asm],
  131. AS_HELP_STRING([--disable-asm], [Do not compile assembly versions]),,
  132. [enable_asm=yes]
  133. )
  134. case $host_cpu in
  135. i[3456]86)
  136. cpu_x86=true
  137. ;;
  138. x86_64)
  139. cpu_x86=true
  140. ;;
  141. esac
  142. AM_CONDITIONAL([ENABLE_X86ASM], [test "$enable_asm" = "yes" -a "$cpu_x86" = "true"])
  143. AS_IF([test "$enable_asm" = "yes" -a "$cpu_x86" = "true"], [
  144. AC_DEFINE([OD_X86ASM], [1], [Enable asm optimisations])
  145. ])
  146. AC_ARG_ENABLE([encoder-check],
  147. AS_HELP_STRING([--enable-encoder-check], [Compare reconstructed frames]),,
  148. [enable_encoder_check=no])
  149. AS_IF([test "$enable_encoder_check" = "yes"], [
  150. AC_DEFINE([OD_ENCODER_CHECK], [1], [Enable comparison of reconstructed frames])
  151. ])
  152. AM_CONDITIONAL([ENCODER_CHECK], [test "$enable_encoder_check" = "yes"])
  153. AC_ARG_ENABLE([dump-images],
  154. AS_HELP_STRING([--enable-dump-images], [Dump debugging images]),,
  155. [enable_dump_images=no])
  156. AS_IF([test "$enable_dump_images" = "yes"], [
  157. AC_DEFINE([OD_DUMP_IMAGES], [1], [Enable image dumping])
  158. PC_PNG_REQUIRES="libpng"
  159. PC_PNG_LIBS="$PNG_LIBS"
  160. ])
  161. AM_CONDITIONAL([DUMP_IMAGES], [test "$enable_dump_images" = "yes"])
  162. AC_SUBST([PC_PNG_REQUIRES])
  163. AC_SUBST([PC_PNG_LIBS])
  164. AC_ARG_ENABLE([dump-recons],
  165. AS_HELP_STRING([--enable-dump-recons], [Dump reconstructed video]),,
  166. [enable_dump_recons=no])
  167. AS_IF([test "$enable_dump_recons" = "yes"], [
  168. AC_DEFINE([OD_DUMP_RECONS], [1], [Enable reconstructed video dumping])
  169. ])
  170. AC_ARG_ENABLE([accounting],
  171. AS_HELP_STRING([--enable-accounting], [Enable bit accounting]),
  172. [if test "$host_mingw" = "true"; then AC_MSG_ERROR([accounting not supported on Windows]); fi],
  173. [enable_accounting=no])
  174. AS_IF([test "$enable_accounting" = "yes"], [
  175. AC_DEFINE([OD_ACCOUNTING], [1], [Enable bit accounting])])
  176. AC_CONFIG_FILES([
  177. Makefile
  178. daalaenc.pc
  179. daaladec.pc
  180. daalaenc-uninstalled.pc
  181. daaladec-uninstalled.pc
  182. doc/Doxyfile
  183. ])
  184. AC_CONFIG_HEADERS([config.h])
  185. AC_OUTPUT
  186. AC_MSG_NOTICE([
  187. ------------------------------------------------------------------------
  188. $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
  189. Assertions ................... ${enable_assertions}
  190. Logging ...................... ${enable_logging}
  191. API documentation ............ ${enable_doc}
  192. Assembly optimizations ....... ${enable_asm}
  193. Image dumping ................ ${enable_dump_images}
  194. Reconstructed video dumping .. ${enable_dump_recons}
  195. Check encoder ................ ${enable_encoder_check}
  196. Bit accounting ............... ${enable_accounting}
  197. Tools ........................ ${enable_tools}
  198. Unit tests ................... ${enable_unit_tests}
  199. Example Player................ ${enable_player}
  200. ------------------------------------------------------------------------
  201. Use "make tools" to compile the tools.
  202. Use "make clean && make debug" to enable assertions and logging
  203. without needing to reconfigure the source tree.
  204. ])