configure.ac 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # autoconf source script for generating configure
  2. AC_INIT([opusfile], m4_esyscmd([doc/git-version.sh]))
  3. AC_USE_SYSTEM_EXTENSIONS
  4. AC_SYS_LARGEFILE
  5. AM_INIT_AUTOMAKE([1.11 foreign])
  6. AM_MAINTAINER_MODE([enable])
  7. LT_INIT
  8. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  9. AC_CONFIG_MACRO_DIR([m4])
  10. dnl Library versioning for libtool.
  11. dnl Please update these for releases.
  12. dnl CURRENT, REVISION, AGE
  13. dnl - library source changed -> increment REVISION
  14. dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
  15. dnl - interfaces added -> increment AGE
  16. dnl - interfaces removed -> AGE = 0
  17. OP_LT_CURRENT=0
  18. OP_LT_REVISION=1
  19. OP_LT_AGE=0
  20. AC_SUBST(OP_LT_CURRENT)
  21. AC_SUBST(OP_LT_REVISION)
  22. AC_SUBST(OP_LT_AGE)
  23. AC_ARG_ENABLE([assertions],
  24. AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
  25. enable_assertions=no)
  26. AS_IF([test "x$enable_assertions" = "xyes"], [
  27. AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
  28. ])
  29. AC_ARG_ENABLE([http],
  30. AS_HELP_STRING([--disable-http], [Disable HTTP support]),,
  31. enable_http=yes)
  32. AS_IF([test "x$enable_http" != "xno"],
  33. AC_CHECK_HEADER([sys/socket.h],,
  34. AC_MSG_WARN([HTTP support requires a posix socket library.])
  35. enable_http=no
  36. )
  37. )
  38. AS_IF([test "x$enable_http" != "xno"], [
  39. openssl="openssl"
  40. AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
  41. ])
  42. AC_SUBST(openssl)
  43. PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1 ${openssl}])
  44. AC_ARG_ENABLE([fixed-point],
  45. AS_HELP_STRING([--enable-fixed-point], [Enable fixed-point calculation]),,
  46. enable_fixed_point=no)
  47. AC_ARG_ENABLE([float],
  48. AS_HELP_STRING([--disable-float], [Disable floating-point API]),,
  49. enable_float=yes)
  50. AS_IF([test "x$enable_float" = "xno"],
  51. [enable_fixed_point=yes
  52. AC_DEFINE([OP_DISABLE_FLOAT_API], [1], [Disable floating-point API])
  53. ]
  54. )
  55. AS_IF([test "x$enable_fixed_point" = "xyes"],
  56. [AC_DEFINE([OP_FIXED_POINT], [1], [Enable fixed-point calculation])],
  57. [dnl This only has to be tested for if float->fixed conversions are required
  58. AC_SEARCH_LIBS([lrintf], [m], [
  59. AC_DEFINE([OP_HAVE_LRINTF], [1], [Enable use of lrintf function])
  60. lrintf_notice="
  61. Library for lrintf() ......... ${ac_cv_search_lrintf}"
  62. ])
  63. ]
  64. )
  65. AC_SUBST(ac_cv_search_lrintf)
  66. CC_ATTRIBUTE_VISIBILITY([default], [
  67. CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
  68. ])
  69. CC_CHECK_CFLAGS_APPEND([-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long])
  70. # Platform-specific tweaks
  71. case $host in
  72. *-mingw*)
  73. # -std=c89 causes some warnings under mingw.
  74. CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
  75. ;;
  76. esac
  77. dnl Check for doxygen
  78. AC_ARG_ENABLE([doc],
  79. AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
  80. [enable_doc=yes]
  81. )
  82. AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
  83. if test "$HAVE_DOXYGEN" != "yes" -o "$enable_doc" != "yes" ; then
  84. HAVE_DOXYGEN="no"
  85. enable_doc="no"
  86. fi
  87. AM_CONDITIONAL(HAVE_DOXYGEN, [test $HAVE_DOXYGEN = yes])
  88. AC_OUTPUT([
  89. Makefile
  90. opusfile.pc
  91. opusfile-uninstalled.pc
  92. doc/Doxyfile
  93. ])
  94. AC_MSG_NOTICE([
  95. ------------------------------------------------------------------------
  96. $PACKAGE $VERSION: Automatic configuration OK.
  97. Assertions ................... ${enable_assertions}
  98. HTTP support ................. ${enable_http}
  99. Fixed-point .................. ${enable_fixed_point}
  100. Floating-point API ........... ${enable_float}${lrintf_notice}
  101. Hidden visibility ............ ${cc_cv_flag_visibility}
  102. API documentation ............ ${enable_doc}
  103. ------------------------------------------------------------------------
  104. ])