1# autoconf source script for generating configure
2
3dnl The package_version file will be automatically synced to the git revision
4dnl by the update_version script when configured in the repository, but will
5dnl remain constant in tarball releases unless it is manually edited.
6m4_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
15AC_INIT([rnnoise],[CURRENT_VERSION],[jmvalin@jmvalin.ca])
16AC_CONFIG_SRCDIR([src/denoise.c])
17AC_CONFIG_MACRO_DIR([m4])
18
19AC_USE_SYSTEM_EXTENSIONS
20AC_SYS_LARGEFILE
21
22AM_INIT_AUTOMAKE([1.11 foreign no-define dist-zip subdir-objects])
23AM_MAINTAINER_MODE([enable])
24
25AC_C_INLINE
26
27LT_INIT
28
29m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
30
31AC_DEFINE([RNNOISE_BUILD], [], [This is a build of the library])
32
33dnl Library versioning for libtool.
34dnl Please update these for releases.
35dnl CURRENT, REVISION, AGE
36dnl - library source changed -> increment REVISION
37dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
38dnl - interfaces added -> increment AGE
39dnl - interfaces removed -> AGE = 0
40
41OP_LT_CURRENT=4
42OP_LT_REVISION=1
43OP_LT_AGE=4
44
45AC_SUBST(OP_LT_CURRENT)
46AC_SUBST(OP_LT_REVISION)
47AC_SUBST(OP_LT_AGE)
48
49CC_CHECK_CFLAGS_APPEND(
50  [-pedantic -Wall -Wextra -Wno-sign-compare -Wno-parentheses -Wno-long-long])
51
52# Platform-specific tweaks
53case $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    ;;
65esac
66AM_CONDITIONAL(OP_WIN32, test "$host_mingw" = "true")
67
68AC_ARG_ENABLE([assertions],
69  AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
70  enable_assertions=no)
71
72AS_IF([test "$enable_assertions" = "yes"], [
73  AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
74])
75
76AC_ARG_ENABLE([examples],
77  AS_HELP_STRING([--disable-examples], [Do not build example applications]),,
78  enable_examples=yes)
79AM_CONDITIONAL([OP_ENABLE_EXAMPLES], [test "$enable_examples" = "yes"])
80
81AS_CASE(["$ac_cv_search_lrintf"],
82  ["no"],[],
83  ["none required"],[],
84  [lrintf_lib="$ac_cv_search_lrintf"])
85
86LT_LIB_M
87
88AC_SUBST([lrintf_lib])
89
90CC_ATTRIBUTE_VISIBILITY([default], [
91  CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
92])
93
94dnl Check for doxygen
95AC_ARG_ENABLE([doc],
96  AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
97  [enable_doc=yes]
98)
99
100AS_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
107AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])
108
109AC_CONFIG_FILES([
110  Makefile
111  rnnoise.pc
112  rnnoise-uninstalled.pc
113  doc/Doxyfile
114])
115AC_CONFIG_HEADERS([config.h])
116AC_OUTPUT
117
118AC_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])
130