configure.ac 3.5 KB

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