configure.ac 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 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. OP_LT_CURRENT=4
  30. OP_LT_REVISION=0
  31. OP_LT_AGE=4
  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. AC_SEARCH_LIBS(ftime, [compat], , [enable_http=no])
  76. AS_IF([test "$enable_http" != "no"], [
  77. openssl="openssl"
  78. AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
  79. PKG_CHECK_MODULES([URL_DEPS], [openssl])
  80. ])
  81. AM_CONDITIONAL(OP_ENABLE_HTTP, [test "$enable_http" != "no"])
  82. AC_SUBST([openssl])
  83. PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1])
  84. AC_ARG_ENABLE([fixed-point],
  85. AS_HELP_STRING([--enable-fixed-point], [Enable fixed-point calculation]),,
  86. enable_fixed_point=no)
  87. AC_ARG_ENABLE([float],
  88. AS_HELP_STRING([--disable-float], [Disable floating-point API]),,
  89. enable_float=yes)
  90. AS_IF([test "$enable_float" = "no"],
  91. [enable_fixed_point=yes
  92. AC_DEFINE([OP_DISABLE_FLOAT_API], [1], [Disable floating-point API])
  93. ]
  94. )
  95. AS_IF([test "$enable_fixed_point" = "yes"],
  96. [AC_DEFINE([OP_FIXED_POINT], [1], [Enable fixed-point calculation])],
  97. [dnl This only has to be tested for if float->fixed conversions are required
  98. saved_LIBS="$LIBS"
  99. AC_SEARCH_LIBS([lrintf], [m], [
  100. AC_DEFINE([OP_HAVE_LRINTF], [1], [Enable use of lrintf function])
  101. lrintf_notice="
  102. Library for lrintf() ......... ${ac_cv_search_lrintf}"
  103. ])
  104. LIBS="$saved_LIBS"
  105. ]
  106. )
  107. AC_ARG_ENABLE([examples],
  108. AS_HELP_STRING([--disable-examples], [Do not build example applications]),,
  109. enable_examples=yes)
  110. AM_CONDITIONAL([OP_ENABLE_EXAMPLES], [test "$enable_examples" = "yes"])
  111. AS_CASE(["$ac_cv_search_lrintf"],
  112. ["no"],[],
  113. ["none required"],[],
  114. [lrintf_lib="$ac_cv_search_lrintf"])
  115. AC_SUBST([lrintf_lib])
  116. CC_ATTRIBUTE_VISIBILITY([default], [
  117. CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
  118. ])
  119. dnl Check for doxygen
  120. AC_ARG_ENABLE([doc],
  121. AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
  122. [enable_doc=yes]
  123. )
  124. AS_IF([test "$enable_doc" = "yes"], [
  125. AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no])
  126. ],[
  127. HAVE_DOXYGEN=no
  128. ])
  129. AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])
  130. AC_CONFIG_FILES([
  131. Makefile
  132. opusfile.pc
  133. opusurl.pc
  134. opusfile-uninstalled.pc
  135. opusurl-uninstalled.pc
  136. doc/Doxyfile
  137. ])
  138. AC_CONFIG_HEADERS([config.h])
  139. AC_OUTPUT
  140. AC_MSG_NOTICE([
  141. ------------------------------------------------------------------------
  142. $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
  143. Assertions ................... ${enable_assertions}
  144. HTTP support ................. ${enable_http}
  145. Fixed-point .................. ${enable_fixed_point}
  146. Floating-point API ........... ${enable_float}${lrintf_notice}
  147. Hidden visibility ............ ${cc_cv_flag_visibility}
  148. API code examples ............ ${enable_examples}
  149. API documentation ............ ${enable_doc}
  150. ------------------------------------------------------------------------
  151. ])