comparison src/opusfile-0.9/configure.ac @ 69:7aeed7906520

Add Opus sources and macOS builds
author Chris Cannam
date Wed, 23 Jan 2019 13:48:08 +0000
parents
children
comparison
equal deleted inserted replaced
68:85d5306e114e 69:7aeed7906520
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([opusfile],[CURRENT_VERSION],[opus@xiph.org])
16 AC_CONFIG_SRCDIR([src/opusfile.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 LT_INIT
25
26 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
27
28 dnl Library versioning for libtool.
29 dnl Please update these for releases.
30 dnl CURRENT, REVISION, AGE
31 dnl - library source changed -> increment REVISION
32 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
33 dnl - interfaces added -> increment AGE
34 dnl - interfaces removed -> AGE = 0
35
36 OP_LT_CURRENT=4
37 OP_LT_REVISION=2
38 OP_LT_AGE=4
39
40 AC_SUBST(OP_LT_CURRENT)
41 AC_SUBST(OP_LT_REVISION)
42 AC_SUBST(OP_LT_AGE)
43
44 CC_CHECK_CFLAGS_APPEND(
45 [-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long])
46
47 # Platform-specific tweaks
48 case $host in
49 *-mingw*)
50 # -std=c89 causes some warnings under mingw.
51 CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
52 # We need WINNT>=0x501 (WindowsXP) for getaddrinfo/freeaddrinfo.
53 # It's okay to define this even when HTTP support is disabled, as it only
54 # affects header declarations, not linking (unless we actually use some
55 # XP-only functions).
56 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x501,
57 [We need at least WindowsXP for getaddrinfo/freeaddrinfo])
58 host_mingw=true
59 ;;
60 esac
61 AM_CONDITIONAL(OP_WIN32, test "$host_mingw" = "true")
62
63 AC_ARG_ENABLE([assertions],
64 AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
65 enable_assertions=no)
66
67 AS_IF([test "$enable_assertions" = "yes"], [
68 AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
69 ])
70
71 AC_ARG_ENABLE([http],
72 AS_HELP_STRING([--disable-http], [Disable HTTP support]),,
73 enable_http=yes)
74
75 AM_COND_IF(OP_WIN32,
76 AS_IF([test "$enable_http" != "no"],
77 AC_CHECK_HEADER([winsock2.h],,
78 AC_MSG_WARN([HTTP support requires a Winsock socket library.])
79 enable_http=no
80 )
81 ),
82 AS_IF([test "$enable_http" != "no"],
83 AC_CHECK_HEADER([sys/socket.h],,
84 AC_MSG_WARN([HTTP support requires a POSIX socket library.])
85 enable_http=no
86 )
87 )
88 )
89 AC_SEARCH_LIBS(ftime, [compat], , [enable_http=no])
90
91 m4_ifndef([PKG_PROG_PKG_CONFIG],
92 [m4_fatal([Could not locate the pkg-config autoconf macros.
93 Please make sure pkg-config is installed and, if necessary, set the environment
94 variable ACLOCAL="aclocal -I/path/to/pkg.m4".])])
95
96 AS_IF([test "$enable_http" != "no"], [
97 openssl="openssl"
98 AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
99 PKG_CHECK_MODULES([URL_DEPS], [openssl])
100 ])
101 AM_CONDITIONAL(OP_ENABLE_HTTP, [test "$enable_http" != "no"])
102 AC_SUBST([openssl])
103
104 PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1])
105
106 AC_ARG_ENABLE([fixed-point],
107 AS_HELP_STRING([--enable-fixed-point], [Enable fixed-point calculation]),,
108 enable_fixed_point=no)
109 AC_ARG_ENABLE([float],
110 AS_HELP_STRING([--disable-float], [Disable floating-point API]),,
111 enable_float=yes)
112
113 AS_IF([test "$enable_float" = "no"],
114 [enable_fixed_point=yes
115 AC_DEFINE([OP_DISABLE_FLOAT_API], [1], [Disable floating-point API])
116 ]
117 )
118
119 AS_IF([test "$enable_fixed_point" = "yes"],
120 [AC_DEFINE([OP_FIXED_POINT], [1], [Enable fixed-point calculation])],
121 [dnl This only has to be tested for if float->fixed conversions are required
122 saved_LIBS="$LIBS"
123 AC_SEARCH_LIBS([lrintf], [m], [
124 AC_DEFINE([OP_HAVE_LRINTF], [1], [Enable use of lrintf function])
125 lrintf_notice="
126 Library for lrintf() ......... ${ac_cv_search_lrintf}"
127 ])
128 LIBS="$saved_LIBS"
129 ]
130 )
131
132 AC_ARG_ENABLE([examples],
133 AS_HELP_STRING([--disable-examples], [Do not build example applications]),,
134 enable_examples=yes)
135 AM_CONDITIONAL([OP_ENABLE_EXAMPLES], [test "$enable_examples" = "yes"])
136
137 AS_CASE(["$ac_cv_search_lrintf"],
138 ["no"],[],
139 ["none required"],[],
140 [lrintf_lib="$ac_cv_search_lrintf"])
141
142 AC_SUBST([lrintf_lib])
143
144 CC_ATTRIBUTE_VISIBILITY([default], [
145 CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
146 ])
147
148 dnl Check for doxygen
149 AC_ARG_ENABLE([doc],
150 AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
151 [enable_doc=yes]
152 )
153
154 AS_IF([test "$enable_doc" = "yes"], [
155 AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no])
156 AC_CHECK_PROG([HAVE_DOT], [dot], [yes], [no])
157 ],[
158 HAVE_DOXYGEN=no
159 ])
160
161 AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])
162
163 AC_CONFIG_FILES([
164 Makefile
165 opusfile.pc
166 opusurl.pc
167 opusfile-uninstalled.pc
168 opusurl-uninstalled.pc
169 doc/Doxyfile
170 ])
171 AC_CONFIG_HEADERS([config.h])
172 AC_OUTPUT
173
174 AC_MSG_NOTICE([
175 ------------------------------------------------------------------------
176 $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
177
178 Assertions ................... ${enable_assertions}
179
180 HTTP support ................. ${enable_http}
181 Fixed-point .................. ${enable_fixed_point}
182 Floating-point API ........... ${enable_float}${lrintf_notice}
183
184 Hidden visibility ............ ${cc_cv_flag_visibility}
185
186 API code examples ............ ${enable_examples}
187 API documentation ............ ${enable_doc}
188 ------------------------------------------------------------------------
189 ])