configure.ac 5.6 KB

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