Jean-Marc Valin | 5b0673f | 2017-08-16 20:59:14 -0400 | [diff] [blame] | 1 | # autoconf source script for generating configure |
| 2 | |
| 3 | dnl The package_version file will be automatically synced to the git revision |
| 4 | dnl by the update_version script when configured in the repository, but will |
| 5 | dnl remain constant in tarball releases unless it is manually edited. |
| 6 | m4_define([CURRENT_VERSION], |
| 7 | m4_esyscmd([ ./update_version 2>/dev/null || true |
| 8 | if test -e package_version; then |
| 9 | . ./package_version |
| 10 | printf "$PACKAGE_VERSION" |
| 11 | else |
| 12 | printf "unknown" |
| 13 | fi ])) |
| 14 | |
| 15 | AC_INIT([rnnoise],[CURRENT_VERSION],[jmvalin@jmvalin.ca]) |
| 16 | AC_CONFIG_SRCDIR([src/denoise.c]) |
| 17 | AC_CONFIG_MACRO_DIR([m4]) |
| 18 | |
| 19 | AC_USE_SYSTEM_EXTENSIONS |
| 20 | AC_SYS_LARGEFILE |
| 21 | |
| 22 | AM_INIT_AUTOMAKE([1.11 foreign no-define dist-zip subdir-objects]) |
| 23 | AM_MAINTAINER_MODE([enable]) |
| 24 | |
| 25 | AC_C_INLINE |
| 26 | |
| 27 | LT_INIT |
| 28 | |
| 29 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 30 | |
| 31 | AC_DEFINE([RNNOISE_BUILD], [], [This is a build of the library]) |
| 32 | |
| 33 | dnl Library versioning for libtool. |
| 34 | dnl Please update these for releases. |
| 35 | dnl CURRENT, REVISION, AGE |
| 36 | dnl - library source changed -> increment REVISION |
| 37 | dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0 |
| 38 | dnl - interfaces added -> increment AGE |
| 39 | dnl - interfaces removed -> AGE = 0 |
| 40 | |
| 41 | OP_LT_CURRENT=4 |
| 42 | OP_LT_REVISION=1 |
| 43 | OP_LT_AGE=4 |
| 44 | |
| 45 | AC_SUBST(OP_LT_CURRENT) |
| 46 | AC_SUBST(OP_LT_REVISION) |
| 47 | AC_SUBST(OP_LT_AGE) |
| 48 | |
| 49 | CC_CHECK_CFLAGS_APPEND( |
| 50 | [-pedantic -Wall -Wextra -Wno-sign-compare -Wno-parentheses -Wno-long-long]) |
| 51 | |
| 52 | # Platform-specific tweaks |
| 53 | case $host in |
| 54 | *-mingw*) |
| 55 | # -std=c89 causes some warnings under mingw. |
| 56 | CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__]) |
| 57 | # We need WINNT>=0x501 (WindowsXP) for getaddrinfo/freeaddrinfo. |
| 58 | # It's okay to define this even when HTTP support is disabled, as it only |
| 59 | # affects header declarations, not linking (unless we actually use some |
| 60 | # XP-only functions). |
| 61 | AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x501, |
| 62 | [We need at least WindowsXP for getaddrinfo/freeaddrinfo]) |
| 63 | host_mingw=true |
| 64 | ;; |
| 65 | esac |
| 66 | AM_CONDITIONAL(OP_WIN32, test "$host_mingw" = "true") |
| 67 | |
| 68 | AC_ARG_ENABLE([assertions], |
| 69 | AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),, |
| 70 | enable_assertions=no) |
| 71 | |
| 72 | AS_IF([test "$enable_assertions" = "yes"], [ |
| 73 | AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code]) |
| 74 | ]) |
| 75 | |
| 76 | AC_ARG_ENABLE([examples], |
| 77 | AS_HELP_STRING([--disable-examples], [Do not build example applications]),, |
| 78 | enable_examples=yes) |
| 79 | AM_CONDITIONAL([OP_ENABLE_EXAMPLES], [test "$enable_examples" = "yes"]) |
| 80 | |
| 81 | AS_CASE(["$ac_cv_search_lrintf"], |
| 82 | ["no"],[], |
| 83 | ["none required"],[], |
| 84 | [lrintf_lib="$ac_cv_search_lrintf"]) |
| 85 | |
| 86 | LT_LIB_M |
| 87 | |
| 88 | AC_SUBST([lrintf_lib]) |
| 89 | |
| 90 | CC_ATTRIBUTE_VISIBILITY([default], [ |
| 91 | CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"]) |
| 92 | ]) |
| 93 | |
| 94 | dnl Check for doxygen |
| 95 | AC_ARG_ENABLE([doc], |
| 96 | AS_HELP_STRING([--disable-doc], [Do not build API documentation]),, |
| 97 | [enable_doc=yes] |
| 98 | ) |
| 99 | |
| 100 | AS_IF([test "$enable_doc" = "yes"], [ |
| 101 | AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no]) |
| 102 | AC_CHECK_PROG([HAVE_DOT], [dot], [yes], [no]) |
| 103 | ],[ |
| 104 | HAVE_DOXYGEN=no |
| 105 | ]) |
| 106 | |
| 107 | AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"]) |
| 108 | |
| 109 | AC_CONFIG_FILES([ |
| 110 | Makefile |
| 111 | rnnoise.pc |
| 112 | rnnoise-uninstalled.pc |
| 113 | doc/Doxyfile |
| 114 | ]) |
| 115 | AC_CONFIG_HEADERS([config.h]) |
| 116 | AC_OUTPUT |
| 117 | |
| 118 | AC_MSG_NOTICE([ |
| 119 | ------------------------------------------------------------------------ |
| 120 | $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK. |
| 121 | |
| 122 | Assertions ................... ${enable_assertions} |
| 123 | |
| 124 | Hidden visibility ............ ${cc_cv_flag_visibility} |
| 125 | |
| 126 | API code examples ............ ${enable_examples} |
| 127 | API documentation ............ ${enable_doc} |
| 128 | ------------------------------------------------------------------------ |
| 129 | ]) |