configure.ac 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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([ ./update_version 2>/dev/null || true
  7. if test -e package_version; then
  8. . ./package_version
  9. printf "$PACKAGE_VERSION"
  10. else
  11. printf "unknown"
  12. fi ]))
  13. AC_INIT([opusfile],[CURRENT_VERSION],[opus@xiph.org])
  14. AC_CONFIG_SRCDIR([src/opusfile.c])
  15. AC_CONFIG_MACRO_DIR([m4])
  16. AC_USE_SYSTEM_EXTENSIONS
  17. AC_SYS_LARGEFILE
  18. AM_INIT_AUTOMAKE([1.11 foreign no-define dist-zip])
  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. OP_LT_CURRENT=2
  30. OP_LT_REVISION=0
  31. OP_LT_AGE=2
  32. AC_SUBST(OP_LT_CURRENT)
  33. AC_SUBST(OP_LT_REVISION)
  34. AC_SUBST(OP_LT_AGE)
  35. CC_CHECK_CFLAGS_APPEND(
  36. [-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long])
  37. # Platform-specific tweaks
  38. case $host in
  39. *-mingw*)
  40. # -std=c89 causes some warnings under mingw.
  41. CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
  42. # We need WINNT>=0x501 (WindowsXP) for getaddrinfo/freeaddrinfo.
  43. # It's okay to define this even when HTTP support is disabled, as it only
  44. # affects header declarations, not linking (unless we actually use some
  45. # XP-only functions).
  46. AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x501,
  47. [We need at least WindowsXP for getaddrinfo/freeaddrinfo])
  48. host_mingw=true
  49. ;;
  50. esac
  51. AM_CONDITIONAL(OP_WIN32, test "$host_mingw" = "true")
  52. AC_ARG_ENABLE([assertions],
  53. AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
  54. enable_assertions=no)
  55. AS_IF([test "$enable_assertions" = "yes"], [
  56. AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
  57. ])
  58. AC_ARG_ENABLE([http],
  59. AS_HELP_STRING([--disable-http], [Disable HTTP support]),,
  60. enable_http=yes)
  61. AM_COND_IF(OP_WIN32,
  62. AS_IF([test "$enable_http" != "no"],
  63. AC_CHECK_HEADER([winsock2.h],,
  64. AC_MSG_WARN([HTTP support requires a Winsock socket library.])
  65. enable_http=no
  66. )
  67. ),
  68. AS_IF([test "$enable_http" != "no"],
  69. AC_CHECK_HEADER([sys/socket.h],,
  70. AC_MSG_WARN([HTTP support requires a POSIX socket library.])
  71. enable_http=no
  72. )
  73. )
  74. )
  75. AS_IF([test "$enable_http" != "no"], [
  76. openssl="openssl"
  77. AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
  78. PKG_CHECK_MODULES([URL_DEPS], [openssl])
  79. ])
  80. AM_CONDITIONAL(OP_ENABLE_HTTP, [test "$enable_http" != "no"])
  81. AC_SUBST([openssl])
  82. PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1])
  83. AC_ARG_ENABLE([fixed-point],
  84. AS_HELP_STRING([--enable-fixed-point], [Enable fixed-point calculation]),,
  85. enable_fixed_point=no)
  86. AC_ARG_ENABLE([float],
  87. AS_HELP_STRING([--disable-float], [Disable floating-point API]),,
  88. enable_float=yes)
  89. AS_IF([test "$enable_float" = "no"],
  90. [enable_fixed_point=yes
  91. AC_DEFINE([OP_DISABLE_FLOAT_API], [1], [Disable floating-point API])
  92. ]
  93. )
  94. AS_IF([test "$enable_fixed_point" = "yes"],
  95. [AC_DEFINE([OP_FIXED_POINT], [1], [Enable fixed-point calculation])],
  96. [dnl This only has to be tested for if float->fixed conversions are required
  97. saved_LIBS="$LIBS"
  98. AC_SEARCH_LIBS([lrintf], [m], [
  99. AC_DEFINE([OP_HAVE_LRINTF], [1], [Enable use of lrintf function])
  100. lrintf_notice="
  101. Library for lrintf() ......... ${ac_cv_search_lrintf}"
  102. ])
  103. LIBS="$saved_LIBS"
  104. ]
  105. )
  106. AS_CASE(["$ac_cv_search_lrintf"],
  107. ["no"],[],
  108. ["none required"],[],
  109. [lrintf_lib="$ac_cv_search_lrintf"])
  110. AC_SUBST([lrintf_lib])
  111. CC_ATTRIBUTE_VISIBILITY([default], [
  112. CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
  113. ])
  114. dnl Check for doxygen
  115. AC_ARG_ENABLE([doc],
  116. AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
  117. [enable_doc=yes]
  118. )
  119. AS_IF([test "$enable_doc" = "yes"], [
  120. AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no])
  121. ],[
  122. HAVE_DOXYGEN=no
  123. ])
  124. AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])
  125. AC_CONFIG_FILES([
  126. Makefile
  127. opusfile.pc
  128. opusurl.pc
  129. opusfile-uninstalled.pc
  130. opusurl-uninstalled.pc
  131. doc/Doxyfile
  132. ])
  133. AC_CONFIG_HEADERS([config.h])
  134. AC_OUTPUT
  135. AC_MSG_NOTICE([
  136. ------------------------------------------------------------------------
  137. $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
  138. Assertions ................... ${enable_assertions}
  139. HTTP support ................. ${enable_http}
  140. Fixed-point .................. ${enable_fixed_point}
  141. Floating-point API ........... ${enable_float}${lrintf_notice}
  142. Hidden visibility ............ ${cc_cv_flag_visibility}
  143. API documentation ............ ${enable_doc}
  144. ------------------------------------------------------------------------
  145. ])