Commit | Line | Data |
---|---|---|
460b9539 | 1 | # Process this file with autoconf to produce a configure script. |
2 | # | |
3 | # This file is part of DisOrder. | |
aec64660 | 4 | # Copyright (C) 2004-2014 Richard Kettlewell |
313acc77 | 5 | # Portions copyright (C) 2007 Ross Younger |
460b9539 | 6 | # |
e7eb3a27 | 7 | # This program is free software: you can redistribute it and/or modify |
460b9539 | 8 | # it under the terms of the GNU General Public License as published by |
e7eb3a27 | 9 | # the Free Software Foundation, either version 3 of the License, or |
460b9539 | 10 | # (at your option) any later version. |
11 | # | |
e7eb3a27 RK |
12 | # This program is distributed in the hope that it will be useful, |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | # | |
460b9539 | 17 | # You should have received a copy of the GNU General Public License |
e7eb3a27 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
460b9539 | 19 | # |
20 | ||
ed929240 | 21 | AC_INIT([disorder], [5.1.1], [rjk@greenend.org.uk]) |
460b9539 | 22 | AC_CONFIG_AUX_DIR([config.aux]) |
c37132f2 | 23 | AM_INIT_AUTOMAKE([foreign]) |
460b9539 | 24 | AC_CONFIG_SRCDIR([server/disorderd.c]) |
25 | AM_CONFIG_HEADER([config.h]) | |
b8ca4525 | 26 | AC_CONFIG_MACRO_DIR([m4]) |
460b9539 | 27 | |
dea8f8aa RK |
28 | # Find host type |
29 | AC_CANONICAL_HOST | |
30 | ||
460b9539 | 31 | # What we want to build |
460b9539 | 32 | want_gtk=yes |
33 | want_python=yes | |
7affb407 | 34 | want_tests=yes |
4cbafe13 | 35 | want_server=yes |
7207a21b | 36 | want_gstdecode=whatever |
4cbafe13 | 37 | want_cgi=yes |
460b9539 | 38 | |
e2f0c461 RK |
39 | # APIs we want |
40 | want_alsa=yes | |
41 | want_oss=yes | |
42 | want_coreaudio=yes | |
de0ef46e | 43 | want_pulseaudio=yes |
ae2d6475 | 44 | want_gstreamer=yes |
e2f0c461 | 45 | |
f243316a RK |
46 | # By default we don't want gtk-osx. But if you ask for --with-gtk-osx... |
47 | # | |
48 | # Disobedience can be built to a native OS X application. There are some | |
49 | # caveats: | |
50 | # - you will still need Fink (or something) for other libraries | |
51 | # - if you wanted an application bundle you are out of luck | |
52 | # - the menu bar is still in the main window (not at the top of the screen) | |
d61f831b | 53 | # - drag and drop doesn't work |
f243316a RK |
54 | # |
55 | # So it's still rather rough and ready. But it does work... | |
56 | # | |
57 | # See: | |
58 | # http://www.gtk-osx.org/ | |
59 | # http://live.gnome.org/GTK%2B/OSX/Framework | |
60 | want_gtkosx=no | |
61 | ||
a9f0ad12 RK |
62 | # Checks for programs. |
63 | AC_PROG_CC | |
1f2e762f | 64 | AM_PROG_CC_C_O |
419893d7 | 65 | AC_PROG_AWK |
a9f0ad12 RK |
66 | AC_SET_MAKE |
67 | if test "x$GCC" = xyes; then | |
68 | gcc_werror=-Werror | |
439c12ca RK |
69 | case "$CC" in |
70 | *-std=* ) | |
71 | ;; | |
72 | * ) | |
73 | CC="${CC} -std=gnu99" | |
74 | ;; | |
75 | esac | |
a9f0ad12 | 76 | else |
fdca70ee | 77 | AC_MSG_ERROR([GNU C is required to build this program]) |
a9f0ad12 RK |
78 | gcc_werror="" |
79 | fi | |
80 | ||
e2f0c461 RK |
81 | AC_ARG_WITH([alsa], |
82 | [AS_HELP_STRING([--without-alsa], | |
83 | [do not build with ALSA support])], | |
84 | [want_alsa=$withval]) | |
de0ef46e RK |
85 | AC_ARG_WITH([pulseaudio], |
86 | [AS_HELP_STRING([--without-pulseaudio], | |
87 | [do not build with PulseAudio support])], | |
88 | [want_pulseaudio=$withval]) | |
e2f0c461 RK |
89 | AC_ARG_WITH([oss], |
90 | [AS_HELP_STRING([--without-oss], | |
91 | [do not build with OSS support])], | |
92 | [want_oss=$withval]) | |
93 | AC_ARG_WITH([coreaudio], | |
94 | [AS_HELP_STRING([--without-coreaudio], | |
95 | [do not build with Core Audio support])], | |
96 | [want_coreaudio=$withval]) | |
7affb407 RK |
97 | AC_ARG_WITH([tests], |
98 | [AS_HELP_STRING([--without-tests], | |
99 | [do not build test suit])], | |
100 | [want_tests=$withval]) | |
f243316a RK |
101 | AC_ARG_WITH([gtk-osx], |
102 | [AS_HELP_STRING([--with-gtk-osx], | |
1746361e | 103 | [use native GTK+ (OS X only)])], |
f243316a | 104 | [want_gtkosx=$withval]) |
ae2d6475 MW |
105 | AC_ARG_WITH([gstreamer], |
106 | [AS_HELP_STRING([--with-gstreamer], [select GStreamer version])], | |
107 | [want_gstreamer=$withval]) | |
e2f0c461 | 108 | |
a9f0ad12 | 109 | AC_MSG_CHECKING([for a known target platform]) |
dea8f8aa | 110 | case "$host" in |
a9f0ad12 | 111 | *empeg* ) |
e3426f7b | 112 | AC_MSG_RESULT([empeg car stereo]) |
a9f0ad12 RK |
113 | AC_DEFINE([EMPEG_HOST],[1],[define if host is an empeg car stereo]) |
114 | # work around broken toolchain | |
115 | AC_CHECK_LIB([gpg-error], [gpg_strerror]) | |
e3426f7b | 116 | AC_CHECK_LIB([pthread], [pthread_create]) |
a9f0ad12 | 117 | want_server=no |
4cbafe13 | 118 | want_cgi=no |
a9f0ad12 | 119 | ;; |
dea8f8aa | 120 | *linux* | *Linux* ) |
a9f0ad12 | 121 | AC_MSG_RESULT([Linux]) |
8138da17 | 122 | AC_DEFINE_UNQUOTED([PATH_PROC_MOUNTS],["/proc/mounts"],[path to kernel mount list]) |
dea8f8aa | 123 | ;; |
9086a105 | 124 | *-apple-darwin* ) |
e3426f7b | 125 | AC_MSG_RESULT([Mac OS X]) |
529a6ee3 RK |
126 | # AudioHardwareGetProperty is deprecated in 10.6, but it's still _there_, |
127 | # so we'll just turn off the warning. | |
128 | CC="$CC -Wno-deprecated-declarations" | |
e2f0c461 | 129 | if test $want_coreaudio = yes; then |
ca6b4a12 | 130 | COREAUDIO="-framework CoreFoundation -framework CoreServices -framework CoreAudio" |
e2f0c461 | 131 | fi |
0ec4c5e6 | 132 | browser=open |
8fcf5c48 RK |
133 | AC_MSG_CHECKING([Mac OS X target version]) |
134 | # We honor MACOSX_DEPLOYMENT_TARGET in the environment, emulating gcc's | |
135 | # behaviour. But we provide a command line option to override it and | |
136 | # we default to wide support instead of supporting only the build platform. | |
137 | # | |
138 | # Currently if you ask for 10.5 you will get a deprecation warning | |
139 | # when building the CoreAudio support code. For the time being the | |
140 | # answer to this is "don't do that then". If a good reason to ask | |
141 | # for a 10.5 deployment target emerges then this will be fixed. | |
142 | if test -z "$MACOSX_DEPLOYMENT_TARGET"; then | |
143 | MACOSX_DEPLOYMENT_TARGET=10.0 | |
144 | fi | |
145 | AC_ARG_WITH([deployment-target], | |
146 | [AS_HELP_STRING([--with-deployment-target=TARGET], | |
147 | [set target OS X version])], | |
148 | [MACOSX_DEPLOYMENT_TARGET=$withval]) | |
149 | # Convert to desired format | |
150 | underscored=`echo $MACOSX_DEPLOYMENT_TARGET|sed 's/\./_/'` | |
151 | minver="MAC_OS_X_VERSION_$underscored" | |
152 | AC_MSG_RESULT([$minver]) | |
153 | AC_DEFINE_UNQUOTED([MAC_OS_X_VERSION_MIN_REQUIRED], [$minver], | |
154 | [define to minimum version of Mac OS X to support]) | |
467b6eb1 | 155 | |
f243316a RK |
156 | if test $want_gtkosx = no; then |
157 | # Fink's GTK+ is hopelessly broken | |
158 | PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/sw/lib/pango-ft219/lib/pkgconfig} | |
159 | export PKG_CONFIG_PATH | |
160 | fi | |
467b6eb1 | 161 | |
9086a105 | 162 | ;; |
70f47acd RK |
163 | *-freebsd* ) |
164 | AC_MSG_RESULT([FreeBSD]) | |
edbd470f | 165 | # Ports install to /usr/local but the compiler stupidly doesn't look |
166 | # there by default | |
70f47acd | 167 | LDFLAGS="${LDFLAGS} -L/usr/local/lib" |
e6ea27d8 | 168 | CPPFLAGS="${CPPFLAGS} -isystem /usr/local/include" |
42f43a11 RK |
169 | # Look for a suitable version of libdb among the versions found in FreeBSD 7.0 |
170 | AC_CACHE_CHECK([looking for a libdb install],[rjk_cv_libdb],[ | |
171 | rjk_cv_libdb="none" | |
aec64660 | 172 | for db in db43 db44 db45 db47 db48; do |
42f43a11 RK |
173 | if test -e /usr/local/lib/$db; then |
174 | rjk_cv_libdb=$db | |
175 | break | |
176 | fi | |
177 | done | |
178 | ]) | |
179 | if test $rjk_cv_libdb != none; then | |
180 | LDFLAGS="${LDFLAGS} -L/usr/local/lib/$rjk_cv_libdb" | |
181 | CPPFLAGS="${CPPFLAGS} -isystem /usr/local/include/$rjk_cv_libdb" | |
182 | fi | |
aec64660 RK |
183 | # iconv needs bodging |
184 | AC_SUBST(LIBICONV,[-liconv]) | |
70f47acd | 185 | ;; |
dea8f8aa | 186 | * ) |
a9f0ad12 | 187 | AC_MSG_RESULT([unknown, winging it]) |
dea8f8aa RK |
188 | ;; |
189 | esac | |
9086a105 | 190 | AC_SUBST([COREAUDIO]) |
dea8f8aa | 191 | |
f486ea18 RK |
192 | AC_ARG_WITH([browser], |
193 | [AS_HELP_STRING([--with-browser=BROWSER], | |
194 | [use BROWSER to display HTML])], | |
195 | [browser=$withval]) | |
196 | ||
197 | AC_CACHE_CHECK([default HTML viewer],[rjk_cv_browser],[ | |
198 | rjk_cv_browser=UNKNOWN | |
f2b0ad05 | 199 | for candidate in sensible-browser x-www-browser firefox mozilla chromium google-chrome konqueror netscape; do |
f486ea18 RK |
200 | if type $candidate >/dev/null 2>&1; then |
201 | rjk_cv_browser="$candidate" | |
202 | break | |
203 | fi | |
204 | done | |
205 | ]) | |
206 | if test -z "$browser"; then | |
207 | browser="$rjk_cv_browser" | |
208 | fi | |
209 | AC_DEFINE_UNQUOTED([BROWSER],["$browser"],[HTML viewer]) | |
210 | ||
419893d7 RK |
211 | # Figure out what version of sox is installed |
212 | AC_CACHE_CHECK([sox version],[rjk_cv_soxver],[ | |
213 | rjk_cv_soxver=UNKNOWN | |
214 | if sox --version > /dev/null 2>&1; then | |
215 | rjk_cv_soxver=`sox --version|$AWK '{ if(match($0, /[[0-9\.]]+/)) print substr($0,RSTART,RLENGTH)}'` | |
216 | else | |
217 | rjk_cv_soxver=`sox -h 2>&1|$AWK '/Version/ { if(match($0, /[[0-9\.]]+/)) print substr($0,RSTART,RLENGTH)}'` | |
218 | fi | |
219 | ]) | |
220 | ||
221 | # Decide what command line options to use | |
222 | # | |
223 | # sox version endian bits deployed | |
224 | # 12.17.9 -x -[bwld] debian etch, ubuntu dapper | |
225 | # 14.0.0 -x/-[BL] -[bwld] ubuntu hardy | |
226 | # 14.0.1 -x/-[BL] -[1248] debian lenny | |
227 | # 14.2.0 -x/-[BL] -[1248] debian sid (at 2008-12) | |
228 | ||
229 | AC_CACHE_CHECK([default sox generation],[rjk_cv_soxgen],[ | |
230 | case $rjk_cv_soxver in | |
a4846a87 | 231 | [[0-9]].* | 1[[0123]].* ) |
419893d7 RK |
232 | rjk_cv_soxgen=0 |
233 | ;; | |
234 | * ) | |
235 | rjk_cv_soxgen=1 | |
236 | ;; | |
237 | esac | |
238 | ]) | |
239 | AC_DEFINE_UNQUOTED([DEFAULT_SOX_GENERATION],[$rjk_cv_soxgen], | |
240 | [default sox generation]) | |
241 | ||
460b9539 | 242 | AC_ARG_WITH([server], |
243 | [AS_HELP_STRING([--without-server], | |
244 | [do not build server])], | |
245 | [want_server=$withval]) | |
4cbafe13 RK |
246 | AC_ARG_WITH([cgi], |
247 | [AS_HELP_STRING([--without-cgi], | |
248 | [do not build CGI])], | |
249 | [want_cgi=$withval]) | |
460b9539 | 250 | AC_ARG_WITH([gtk], |
251 | [AS_HELP_STRING([--without-gtk], | |
252 | [do not build GTK+ client])], | |
253 | [want_gtk=$withval]) | |
254 | AC_ARG_WITH([python], | |
255 | [AS_HELP_STRING([--without-python], | |
256 | [do not build Python support])], | |
257 | [want_python=$withval]) | |
7207a21b MW |
258 | AC_ARG_WITH([gstdecode], |
259 | [AS_HELP_STRING([--with-gstdecode], | |
260 | [require GStreamer-based decoder])], | |
261 | [want_gstdecode=$withval]) | |
460b9539 | 262 | |
4cbafe13 RK |
263 | if test $want_server = no; then |
264 | want_cgi=no | |
7207a21b | 265 | want_gstdecode=no |
4cbafe13 RK |
266 | fi |
267 | ||
64ac73bb RK |
268 | # |
269 | # OS Document Root CGI directory | |
270 | # == ============= ============= | |
271 | # Debian /var/www /usr/lib/cgi-bin | |
272 | # Ubuntu /var/www /usr/lib/cgi-bin | |
273 | # Red Hat /var/www/html /var/www/cgi-bin | |
274 | # or: /home/httpd/html/ /home/httpd/cgi-bin | |
275 | # Slackware /var/www/htdocs (unknown) | |
276 | # SuSE /srv/www/html /srv/www/cgi-bin | |
277 | # Gentoo /var/www/localhost/htdocs /var/www/localhost/cgi-bin/ | |
278 | # FreeBSD /usr/local/www/data /usr/local/www/cgi-bin | |
279 | # or: /usr/local/www/???/data /usr/local/www/???/cgi-bin | |
280 | # OS X /Library/WebServer/Documents /Library/WebServer/CGI-Executables | |
281 | # Apache /usr/local/apache/htdocs (none) | |
282 | # | |
283 | # Sources: | |
284 | # http://wiki.linuxquestions.org/wiki/Apache | |
285 | # http://mapserver.gis.umn.edu/docs/howto/suse-linux | |
286 | # http://www.yolinux.com/TUTORIALS/LinuxTutorialWebSiteConfig.html | |
287 | # http://sources.gentoo.org/viewcvs.py/apache/trunk/dist/2.2/conf/vhosts.d/default_vhost.include?rev=198&view=log | |
288 | # http://httpd.apache.org/docs/ | |
289 | # | |
4cbafe13 | 290 | if test $want_cgi = yes; then |
64ac73bb RK |
291 | if test -z "$httpdir"; then |
292 | AC_CACHE_CHECK([for httpd document root],[rjk_cv_httpdir],[ | |
f87af497 | 293 | rjk_cv_httpdir="/usr/local/apache/htdocs" |
64ac73bb RK |
294 | for dir in /var/www/html \ |
295 | /var/www/htdocs \ | |
296 | /var/www/localhost/htdocs \ | |
297 | /var/www \ | |
298 | /home/httpd/html \ | |
299 | /srv/www/html \ | |
300 | /usr/local/www/data \ | |
301 | /usr/local/www/*/data \ | |
302 | /Library/WebServer/Documents \ | |
303 | /usr/local/apache/htdocs; do | |
304 | if test -d "$dir"; then | |
305 | rjk_cv_httpdir="$dir" | |
306 | fi | |
307 | done | |
308 | ]) | |
64ac73bb RK |
309 | httpdir="$rjk_cv_httpdir" |
310 | fi | |
f03d4184 RK |
311 | if test ! -z "$cgidir"; then |
312 | # This is a bit harsh but should stop any disasters | |
313 | AC_MSG_ERROR([cgidir has been renamed to cgiexecdir]) | |
314 | fi | |
315 | if test -z "$cgiexecdir"; then | |
316 | AC_CACHE_CHECK([for CGI directory],[rjk_cv_cgiexecdir],[ | |
f87af497 | 317 | rjk_cv_cgiexecdir="/usr/lib/cgi-bin" |
4cbafe13 RK |
318 | for dir in /usr/lib/cgi-bin \ |
319 | /Library/WebServer/CGI-Executables \ | |
64ac73bb RK |
320 | /srv/www/cgi-bin \ |
321 | /var/www/cgi-bin \ | |
322 | /home/httpd/cgi-bin \ | |
323 | /var/www/localhost/cgi-bin \ | |
4cbafe13 RK |
324 | /usr/local/lib/cgi-bin \ |
325 | /usr/local/www/cgi-bin \ | |
326 | /usr/local/www/*/cgi-bin; do | |
327 | if test -d "$dir"; then | |
f03d4184 | 328 | rjk_cv_cgiexecdir="$dir" |
4cbafe13 RK |
329 | break |
330 | fi | |
331 | done | |
332 | ]) | |
f03d4184 | 333 | cgiexecdir="$rjk_cv_cgiexecdir" |
4cbafe13 RK |
334 | fi |
335 | fi | |
f03d4184 | 336 | AC_ARG_VAR([cgiexecdir], [location of cgi-bin directory, e.g. /usr/lib/cgi-bin]) |
64ac73bb RK |
337 | AC_ARG_VAR([httpdir], [location of http document root, e.g. /var/www/htdocs]) |
338 | if test -z "$pkghttpdir"; then | |
339 | pkghttpdir='$(httpdir)/disorder' | |
340 | fi | |
341 | AC_SUBST([pkghttpdir]) | |
4cbafe13 | 342 | |
7e960883 RK |
343 | if test -z "$dochtmldir"; then |
344 | dochtmldir='$(docdir)/html' | |
345 | fi | |
346 | AC_SUBST([dochtmldir]) | |
347 | ||
3e1d9716 | 348 | subdirs="scripts common lib" |
7affb407 RK |
349 | if test $want_tests = yes; then |
350 | subdirs="${subdirs} libtests" | |
351 | fi | |
352 | subdirs="${subdirs} clients doc examples debian" | |
460b9539 | 353 | |
354 | if test $want_server = yes; then | |
86541f5a | 355 | subdirs="${subdirs} server plugins sounds" |
4cbafe13 RK |
356 | fi |
357 | if test $want_cgi = yes; then | |
358 | subdirs="${subdirs} cgi templates images" | |
460b9539 | 359 | fi |
460b9539 | 360 | if test $want_gtk = yes; then |
361 | subdirs="${subdirs} disobedience" | |
362 | if test $want_server = no; then | |
363 | subdirs="${subdirs} images" | |
364 | fi | |
365 | fi | |
7affb407 | 366 | if test $want_tests = yes && test $want_python = yes; then |
72a2cb48 | 367 | AM_PATH_PYTHON([2.5]) |
56fac00d RK |
368 | subdirs="${subdirs} python tests" |
369 | fi | |
460b9539 | 370 | AC_SUBST([subdirs]) |
371 | ||
372 | # libtool config | |
373 | AC_LIBTOOL_DLOPEN | |
374 | AC_DISABLE_STATIC | |
375 | ||
376 | AC_PROG_LIBTOOL | |
377 | ||
edbd470f | 378 | AC_CACHE_CHECK([for GNU sed],[rjk_cv_gnused],[ |
379 | rjk_cv_gnused="not found" | |
380 | for candidate in sed gsed; do | |
381 | if $candidate --version >/dev/null 2>&1; then | |
382 | rjk_cv_gnused=$candidate | |
383 | fi | |
384 | done | |
385 | ]) | |
386 | GNUSED="${GNUSED:-$rjk_cv_gnused}" | |
387 | if test "$GNUSED" = "not found"; then | |
388 | AC_MSG_ERROR([GNU sed is required to build this program]) | |
389 | fi | |
390 | AC_SUBST([GNUSED]) | |
391 | ||
4b9b77a6 RK |
392 | AC_CHECK_PROGS([GROG],[grog]) |
393 | AM_CONDITIONAL([GROG],[test "x$GROG" != xnone]) | |
394 | ||
460b9539 | 395 | missing_libraries="" |
396 | missing_headers="" | |
397 | missing_functions="" | |
398 | ||
399 | AC_DEFINE(_GNU_SOURCE, 1, [required for e.g. strsignal]) | |
400 | ||
2eee4b0c RK |
401 | AC_PATH_PROG([SENDMAIL],[sendmail],[none],[$PATH:/usr/sbin:/usr/lib]) |
402 | ||
460b9539 | 403 | # Macs might have libraries under fink's root |
404 | AC_PATH_PROG([FINK],[fink],[none],[$PATH:/sw/bin]) | |
405 | if test "x$FINK" != xnone; then | |
dde24f58 | 406 | # Find Fink prefix |
460b9539 | 407 | AC_CACHE_CHECK([fink install directory],[rjk_cv_finkprefix],[ |
408 | rjk_cv_finkprefix="`echo "$FINK" | sed 's,/bin/fink$,,'`" | |
409 | ]) | |
dde24f58 | 410 | # Add include and link paths |
f9592fe7 | 411 | finkdir="${rjk_cv_finkprefix}" |
e83d0967 | 412 | finkbindir="${rjk_cv_finkprefix}/bin" |
afa2e136 | 413 | CPPFLAGS="${CPPFLAGS} -isystem ${rjk_cv_finkprefix}/include/gc -isystem ${rjk_cv_finkprefix}/include" |
460b9539 | 414 | if test $want_server = yes; then |
afa2e136 | 415 | CPPFLAGS="${CPPFLAGS} -isystem ${rjk_cv_finkprefix}/include/db4" |
460b9539 | 416 | fi |
417 | LDFLAGS="${LDFLAGS} -L${rjk_cv_finkprefix}/lib" | |
dde24f58 RK |
418 | # Distinguish 32- and 64-bit fink |
419 | AC_CACHE_CHECK([whether Fink is 32-bit or 64-bit],[rjk_cv_finkbits],[ | |
420 | odata=`otool -v -h $finkbindir/dpkg` | |
421 | case "$odata" in | |
422 | *X86_64* ) | |
423 | rjk_cv_finkbits=64 | |
424 | ;; | |
425 | *I386* ) | |
426 | rjk_cv_finkbits=32 | |
427 | ;; | |
428 | * ) | |
429 | rjk_cv_finkbits=unknown | |
430 | ;; | |
431 | esac | |
432 | ]) | |
433 | # Match Fink so we can use its libraries | |
434 | case $rjk_cv_finkbits in | |
435 | 32 | 64 ) | |
436 | CC="$CC -m$rjk_cv_finkbits" | |
437 | ;; | |
438 | esac | |
e83d0967 RK |
439 | else |
440 | finkbindir="" | |
460b9539 | 441 | fi |
f9592fe7 | 442 | AC_SUBST([finkdir]) |
e83d0967 | 443 | AC_SUBST([finkbindir]) |
460b9539 | 444 | |
7207a21b | 445 | # Checks for packages. |
ae2d6475 MW |
446 | case $want_gstdecode,$want_gstreamer in |
447 | yes,no) AC_MSG_ERROR([gstdecode requires GStreamer]) ;; | |
448 | whatever,no) want_gstdecode=no ;; | |
449 | no,*) want_gstreamer=no ;; | |
c076146f | 450 | *,yes) want_gstreamer="1.0 0.10" ;; |
7207a21b | 451 | esac |
ae2d6475 MW |
452 | |
453 | AH_TEMPLATE([HAVE_GSTREAMER_0_10], | |
454 | [Define if building against GStreamer 0.10]) | |
c076146f MW |
455 | AH_TEMPLATE([HAVE_GSTREAMER_1_0], |
456 | [Define if building against GStreamer 1.0]) | |
ae2d6475 | 457 | |
05fd0aa1 | 458 | mdw_gstreamer_version=nil |
ae2d6475 MW |
459 | for i in $want_gstreamer; do |
460 | case $i in | |
461 | 0.10) v=0.10 V=0_10 ;; | |
462 | 1.0) v=1.0 V=1_0 ;; | |
463 | *) AC_MSG_ERROR([unrecognized GStreamer version]) ;; | |
464 | esac | |
465 | PKG_CHECK_MODULES([GSTREAMER], | |
5dcfc065 | 466 | [gstreamer-$v gstreamer-app-$v gstreamer-audio-$v gstreamer-pbutils-$v], |
ae2d6475 MW |
467 | [have_gstreamer=$v], [have_gstreamer=no]) |
468 | case $have_gstreamer in no) continue ;; esac | |
469 | AC_DEFINE_UNQUOTED([HAVE_GSTREAMER_$V], [1]) | |
05fd0aa1 | 470 | mdw_gstreamer_version=$v |
ae2d6475 MW |
471 | break |
472 | done | |
473 | ||
7207a21b | 474 | case $want_gstdecode,$have_gstreamer,$have_gst_plugins_base in |
ae2d6475 MW |
475 | whatever,no,* | whatever,*,no) |
476 | want_gstdecode=no | |
477 | ;; | |
478 | yes,no,* | yes,*,no) | |
7207a21b | 479 | case $have_gstreamer in |
ae2d6475 | 480 | no) missing_libraries="$missing_libraries gstreamer" ;; |
7207a21b | 481 | esac |
ae2d6475 MW |
482 | ;; |
483 | *) | |
484 | want_gstdecode=yes | |
485 | ;; | |
7207a21b MW |
486 | esac |
487 | ||
488 | mdw_SAVE_CFLAGS=$CFLAGS | |
489 | mdw_SAVE_LIBS=$LIBS | |
ae2d6475 MW |
490 | CFLAGS="$CFLAGS $GSTREAMER_CFLAGS" |
491 | LIBS="$LIBS $GSTREAMER_LIBS" | |
7207a21b MW |
492 | AC_CHECK_FUNCS([gst_audio_info_from_caps]) |
493 | CFLAGS=$mdw_SAVE_CFLAGS | |
494 | LIBS=$mdw_SAVE_LIBS | |
495 | ||
460b9539 | 496 | # Checks for libraries. |
497 | # We save up a list of missing libraries that we can't do without | |
498 | # and report them all at once. | |
499 | AC_CHECK_LIB(gc, GC_malloc, [AC_SUBST(LIBGC,[-lgc])], | |
500 | [missing_libraries="$missing_libraries libgc"]) | |
445e4fc8 MW |
501 | mdw_SAVE_LIBS=$LIBS |
502 | LIBS="$LIBS $LIBGC" | |
4265131b | 503 | AC_CHECK_FUNCS(GC_get_all_interior_pointers) |
445e4fc8 | 504 | LIBS=$mdw_SAVE_LIBS |
460b9539 | 505 | AC_CHECK_LIB(gcrypt, gcry_md_open, |
506 | [AC_SUBST(LIBGCRYPT,[-lgcrypt])], | |
507 | [missing_libraries="$missing_libraries libgcrypt"]) | |
16e4a580 MW |
508 | PKG_CHECK_MODULES([PCRE2], [libpcre2-8], [have_pcre2=yes], [have_pcre2=no]) |
509 | case $have_pcre2 in | |
510 | yes) | |
511 | CFLAGS="$CFLAGS $PCRE2_CFLAGS" LIBPCRE=$PCRE2_LIBS | |
512 | AC_DEFINE([HAVE_LIBPCRE2], [1], [Define if building with libpcre2.]) | |
513 | ;; | |
514 | no) | |
515 | AC_CHECK_LIB(pcre, pcre_compile, | |
516 | [AC_SUBST(LIBPCRE,[-lpcre])], | |
517 | [missing_libraries="$missing_libraries libpcre"]) | |
518 | ;; | |
519 | esac | |
e2f0c461 RK |
520 | if test $want_alsa = yes; then |
521 | AC_CHECK_LIB([asound], [snd_pcm_open], | |
522 | [AC_SUBST(LIBASOUND,[-lasound])]) | |
523 | fi | |
de0ef46e RK |
524 | if test $want_pulseaudio = yes; then |
525 | PKG_CHECK_MODULES([PULSEAUDIO],[libpulse], | |
526 | [AC_DEFINE([HAVE_PULSEAUDIO],[1],[define to 1 for PulseAudio support])], | |
527 | [missing_libraries="$missing_libraries libpulse"]) | |
528 | PKG_CHECK_MODULES([PULSEAUDIO_SIMPLE],[libpulse-simple],, | |
529 | [missing_libraries="$missing_libraries libpulse-simple"]) | |
530 | fi | |
0e8c21de RK |
531 | AC_CHECK_LIB([samplerate],[src_new], |
532 | [AC_SUBST([LIBSAMPLERATE],[-lsamplerate])]) | |
460b9539 | 533 | if test $want_server = yes; then |
534 | RJK_CHECK_LIB(db, db_create, [#include <db.h>], | |
535 | [AC_SUBST(LIBDB,[-ldb])], | |
536 | [missing_libraries="$missing_libraries libdb"]) | |
537 | AC_CHECK_LIB(vorbis, vorbis_info_clear, | |
538 | [:], | |
539 | [missing_libraries="$missing_libraries libvorbis"]) | |
540 | AC_CHECK_LIB(vorbisfile, ov_open, | |
541 | [AC_SUBST(LIBVORBISFILE,["-lvorbisfile -lvorbis"])], | |
542 | [missing_libraries="$missing_libraries libvorbisfile"], | |
543 | [-lvorbis]) | |
544 | AC_CHECK_LIB(mad, mad_stream_init, | |
545 | [AC_SUBST(LIBMAD,[-lmad])], | |
546 | [missing_libraries="$missing_libraries libmad"]) | |
c57f1201 | 547 | AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], |
548 | [AC_SUBST(LIBFLAC,[-lFLAC])], | |
549 | [missing_libraries="$missing_libraries libFLAC"]) | |
d19ccd72 | 550 | fi |
edbd470f | 551 | AC_CHECK_LIB([pthread], [pthread_create], |
552 | [AC_SUBST(LIBPTHREAD,[-lpthread])], | |
553 | [missing_libraries="$missing_libraries libpthread"]) | |
460b9539 | 554 | |
555 | if test $want_gtk = yes; then | |
f243316a RK |
556 | if test $want_gtkosx = yes; then |
557 | GTK_CFLAGS="-isystem /Library/Frameworks/Gtk.framework/Headers -isystem /Library/Frameworks/Cairo.framework/Headers" | |
558 | GLIB_CFLAGS="-isystem /Library/Frameworks/GLib.framework/Headers" | |
559 | GTK_LIBS="-framework Gtk -framework GLib" | |
560 | else | |
561 | AM_PATH_GLIB_2_0([],[],[missing_libraries="$missing_libraries libglib"]) | |
562 | AM_PATH_GTK_2_0([],[],[missing_libraries="$missing_libraries libgtk"]) | |
563 | fi | |
460b9539 | 564 | fi |
565 | ||
566 | # Some platforms have iconv already | |
567 | AC_CHECK_FUNC(iconv_open, [:], | |
568 | [RJK_CHECK_LIB(iconv, iconv_open, [#include <iconv.h>], | |
569 | [AC_SUBST(LIBICONV,[-liconv])], | |
570 | [missing_functions="$missing_functions iconv_open"])]) | |
571 | AC_CHECK_FUNC([gethostbyname],[:],[ | |
572 | AC_CHECK_LIB(nsl,gethostbyname, | |
573 | [AC_SUBST(LIBNSL,[-lnsl])], | |
574 | [missing_functions="$missing_functions gethostbyname"])]) | |
575 | AC_CHECK_FUNC([socket],[:],[ | |
576 | AC_CHECK_LIB(socket,socket, | |
577 | [AC_SUBST(LIBSOCKET,[-lsocket])], | |
578 | [missing_functions="$missing_functions socket"])]) | |
579 | AC_CHECK_FUNC([dlopen],[:],[ | |
580 | AC_CHECK_LIB(dl,dlopen, | |
581 | [AC_SUBST(LIBDL,[-ldl])], | |
582 | [missing_functions="$missing_functions dlopen"])]) | |
583 | ||
584 | if test ! -z "$missing_libraries"; then | |
585 | AC_MSG_ERROR([missing libraries:$missing_libraries]) | |
586 | fi | |
587 | ||
460b9539 | 588 | # Checks for header files. |
589 | RJK_FIND_GC_H | |
e2f0c461 RK |
590 | if test $want_oss = yes; then |
591 | AC_CHECK_HEADERS([sys/soundcard.h]) | |
592 | fi | |
593 | if test $want_alsa = yes; then | |
594 | AC_CHECK_HEADERS([alsa/asoundlib.h]) | |
595 | fi | |
596 | if test $want_coreaudio = yes; then | |
597 | AC_CHECK_HEADERS([CoreAudio/AudioHardware.h]) | |
598 | fi | |
cca89d7c | 599 | AC_CHECK_HEADERS([inttypes.h sys/time.h sys/socket.h netinet/in.h \ |
16e4a580 | 600 | arpa/inet.h sys/un.h netdb.h pwd.h langinfo.h]) |
146e86fb | 601 | # We don't bother checking very standard stuff |
460b9539 | 602 | # Compilation will fail if any of these headers are missing, so we |
603 | # check for them here and fail early. | |
460b9539 | 604 | if test $want_server = yes; then |
605 | AC_CHECK_HEADERS([db.h],[:],[ | |
606 | missing_headers="$missing_headers $ac_header" | |
607 | ]) | |
460b9539 | 608 | fi |
609 | AC_CHECK_HEADERS([dlfcn.h gcrypt.h \ | |
610 | getopt.h iconv.h langinfo.h \ | |
16e4a580 | 611 | sys/ioctl.h \ |
460b9539 | 612 | syslog.h unistd.h],[:],[ |
613 | missing_headers="$missing_headers $ac_header" | |
614 | ]) | |
16e4a580 MW |
615 | case $have_pcre2 in |
616 | no) | |
617 | AC_CHECK_HEADERS([pcre.h], [:], | |
618 | [missing_headers="$missing_headers $ac_header"]) | |
619 | ;; | |
620 | esac | |
0e8c21de | 621 | AC_CHECK_HEADERS([samplerate.h]) |
460b9539 | 622 | |
623 | if test ! -z "$missing_headers"; then | |
624 | AC_MSG_ERROR([missing headers:$missing_headers]) | |
625 | fi | |
626 | ||
70f47acd | 627 | # We require that libpcre support UTF-8 |
16e4a580 MW |
628 | case $have_pcre2 in |
629 | yes) RJK_REQUIRE_PCRE2_UTF8([$PCRE2_CFLAGS], [$PCRE2_LIBS]) ;; | |
630 | no) RJK_REQUIRE_PCRE_UTF8([-lpcre]) ;; | |
631 | esac | |
70f47acd | 632 | |
460b9539 | 633 | # Checks for typedefs, structures, and compiler characteristics. |
634 | AC_C_CONST | |
635 | AC_TYPE_SIZE_T | |
636 | AC_C_INLINE | |
5330d674 | 637 | AC_C_BIGENDIAN |
460b9539 | 638 | AC_CHECK_TYPES([struct sockaddr_in6],,,[AC_INCLUDES_DEFAULT |
639 | #include <netinet/in.h>]) | |
640 | ||
18f94073 RK |
641 | # Figure out how we'll check for devices being mounted and unmounted |
642 | AC_CACHE_CHECK([for list of mounted filesystems],[rjk_cv_mtab],[ | |
643 | if test -e /etc/mtab; then | |
644 | rjk_cv_mtab=/etc/mtab | |
645 | else | |
646 | rjk_cv_mtab=none | |
647 | fi | |
648 | ]) | |
649 | if test $rjk_cv_mtab != none; then | |
650 | AC_DEFINE_UNQUOTED([PATH_MTAB],["$rjk_cv_mtab"],[path to file containing mount list]) | |
651 | fi | |
652 | ||
460b9539 | 653 | # enable -Werror when we check for certain characteristics: |
654 | ||
655 | old_CFLAGS="${CFLAGS}" | |
656 | CFLAGS="${CFLAGS} $gcc_werror" | |
0b29fd3d | 657 | AC_CHECK_TYPES([long long,uint32_t,uint16_t,uint8_t,intmax_t,uintmax_t]) |
460b9539 | 658 | CFLAGS="${old_CFLAGS}" |
659 | ||
660 | # gcrypt maintainers keep changing everything. Design your interface | |
661 | # first, then implement it once, rather than getting it wrong three or | |
662 | # four times and shipping between each attempt. | |
663 | AC_CACHE_CHECK([for hash handle type in <grypt.h>], | |
664 | [rjk_cv_gcrypt_hash_handle],[ | |
665 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT | |
666 | #include <gcrypt.h> | |
667 | ], | |
668 | [gcry_md_hd_t h;])], | |
669 | [rjk_cv_gcrypt_hash_handle=gcry_md_hd_t],[ | |
670 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT | |
671 | #include <gcrypt.h> | |
672 | ], | |
673 | [GcryMDHd h;])], | |
674 | [rjk_cv_gcrypt_hash_handle=GcryMDHd], | |
675 | [rjk_cv_gcrypt_hash_handle=GCRY_MD_HD])])]) | |
676 | AC_DEFINE_UNQUOTED([gcrypt_hash_handle],[$rjk_cv_gcrypt_hash_handle], | |
677 | [libgcrypt hash handle type]) | |
678 | ||
679 | AC_CACHE_CHECK([for gcry_error_t in <grypt.h>], | |
680 | [rjk_cv_have_gcry_error_t],[ | |
681 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT | |
682 | #include <gcrypt.h> | |
683 | ], | |
684 | [gcry_error_t e;])], | |
685 | [rjk_cv_have_gcry_error_t=yes], | |
686 | [rjk_cv_have_gcry_error_t=no])]) | |
687 | if test $rjk_cv_have_gcry_error_t = yes; then | |
688 | AC_DEFINE([HAVE_GCRY_ERROR_T],1,[define if <gcrypt.h> defines gcry_error_t]) | |
689 | fi | |
690 | ||
691 | # Checks for functions | |
692 | if test $ac_cv_type_long_long = yes; then | |
693 | AC_CHECK_FUNCS([atoll strtoll],[:],[ | |
694 | missing_functions="$missing_functions $ac_func" | |
695 | ]) | |
696 | # Darwin sometimes fails to declare strtoll (e.g. if you ask for -std=c99) | |
697 | AC_CACHE_CHECK([whether strtoll is declared in <stdlib.h>], | |
698 | [rjk_cv_strtoll_declared],[ | |
699 | AC_EGREP_HEADER([strtoll], [stdlib.h], | |
700 | [rjk_cv_strtoll_declared=yes], | |
701 | [rjk_cv_strtoll_declared=no])]) | |
702 | if test $rjk_cv_strtoll_declared = yes; then | |
703 | AC_DEFINE([DECLARES_STRTOLL],[1],[define if <stdlib.h> declares strtoll]) | |
704 | fi | |
705 | AC_CACHE_CHECK([whether atoll is declared in <stdlib.h>], | |
706 | [rjk_cv_atoll_declared],[ | |
707 | AC_EGREP_HEADER([atoll], [stdlib.h], | |
708 | [rjk_cv_atoll_declared=yes], | |
709 | [rjk_cv_atoll_declared=no])]) | |
710 | if test $rjk_cv_atoll_declared = yes; then | |
711 | AC_DEFINE([DECLARES_ATOLL],[1],[define if <stdlib.h> declares atoll]) | |
712 | fi | |
713 | fi | |
5b708e0c | 714 | AC_CHECK_FUNCS([ioctl nl_langinfo strsignal setenv unsetenv],[:],[ |
460b9539 | 715 | missing_functions="$missing_functions $ac_func" |
716 | ]) | |
717 | # fsync will do if fdatasync not available | |
718 | AC_CHECK_FUNCS([fdatasync],[:],[ | |
719 | AC_CHECK_FUNCS([fsync], | |
720 | [AC_DEFINE([fdatasync],[fsync],[define fdatasync to fsync if not available])], | |
721 | [missing_functions="$missing_functions fdatasync"])]) | |
722 | if test ! -z "$missing_functions"; then | |
723 | AC_MSG_ERROR([missing functions:$missing_functions]) | |
724 | fi | |
3bd1c92f RK |
725 | # dlsym will do if dlfunc not available |
726 | AC_CHECK_FUNCS([dlfunc],[:],[ | |
727 | AC_DEFINE([dlfunc],[dlsym],[define dlfunc to dlsym if not available]) | |
728 | ]) | |
729 | if test ! -z "$missing_functions"; then | |
730 | AC_MSG_ERROR([missing functions:$missing_functions]) | |
731 | fi | |
7c8c2fc9 RK |
732 | |
733 | # Functions we can take or leave | |
aa846a75 | 734 | AC_CHECK_FUNCS([fls getfsstat closesocket]) |
7c8c2fc9 | 735 | |
460b9539 | 736 | if test $want_server = yes; then |
737 | # <db.h> had better be version 3 or later | |
738 | AC_CACHE_CHECK([db.h version],[rjk_cv_db_version],[ | |
b8ca4525 | 739 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ |
460b9539 | 740 | #include <db.h> |
741 | #ifndef DB_VERSION_MAJOR | |
742 | # error cannot determine db version | |
743 | #endif | |
744 | #if DB_VERSION_MAJOR < 4 | |
745 | # error inadequate db version | |
746 | #endif | |
87573ede | 747 | #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR <= 2 |
460b9539 | 748 | # error inadequate db version |
749 | #endif | |
b8ca4525 | 750 | ],[])], |
460b9539 | 751 | [rjk_cv_db_version=ok], |
752 | [rjk_cv_db_version=inadequate]) | |
12f09e37 | 753 | if test $rjk_cv_db_version = ok; then |
b8ca4525 | 754 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ |
12f09e37 RK |
755 | #include <db.h> |
756 | #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 6 | |
757 | # error http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510270 | |
758 | #endif | |
b8ca4525 | 759 | ],[])], |
12f09e37 RK |
760 | [rjk_cv_db_version=ok], |
761 | [rjk_cv_db_version=toxic]) | |
762 | fi | |
460b9539 | 763 | ]) |
12f09e37 RK |
764 | case $rjk_cv_db_version in |
765 | ok ) | |
766 | ;; | |
767 | inadequate ) | |
768 | AC_MSG_ERROR([need db version at least 4.3 (but not 4.6)]) | |
769 | ;; | |
770 | toxic ) | |
771 | AC_MSG_ERROR([db version 4.6.x does not work - see debian bug 510270]) | |
772 | ;; | |
773 | esac | |
460b9539 | 774 | fi |
775 | ||
e63c38e8 | 776 | AM_CONDITIONAL([SERVER], [test x$want_server = xyes]) |
588b2763 RK |
777 | if test $want_gtk = yes; then |
778 | AC_DEFINE([WITH_GTK], [1], [define if using GTK+]) | |
779 | fi | |
444be909 | 780 | AM_CONDITIONAL([GTK], [test x$want_gtk = xyes]) |
7207a21b | 781 | AM_CONDITIONAL([GSTDECODE], [test x$want_gstdecode = xyes]) |
e63c38e8 | 782 | |
3bd1c92f RK |
783 | # Some GCC invocations warn for converting function pointers to void *. |
784 | # This is fair enough, as it's technically forbidden, but we use dlsym() | |
785 | # which can pretty much only exist if object and function pointers are | |
786 | # interconvertable. So we disable -Werror if need be. | |
787 | if test ! -z "$gcc_werror" && test "$ac_cv_func_dlfunc" != yes; then | |
788 | CFLAGS="${CFLAGS} $gcc_werror" | |
789 | AC_CACHE_CHECK([whether function pointers can be converted to void * without a warning], | |
790 | [rjk_cv_function_pointer_cast],[ | |
791 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT | |
792 | void somefunction(void);], | |
793 | [(void *)somefunction])], | |
794 | [rjk_cv_function_pointer_cast=yes], | |
795 | [rjk_cv_function_pointer_cast=no])]) | |
796 | if test $rjk_cv_function_pointer_cast = no; then | |
797 | gcc_werror="" | |
798 | fi | |
799 | CFLAGS="${old_CFLAGS}" | |
800 | fi | |
801 | ||
460b9539 | 802 | if test "x$GCC" = xyes; then |
e84ca290 RK |
803 | # We need LLONG_MAX and annoyingly GCC doesn't always give it to us |
804 | # by default. | |
805 | AC_CACHE_CHECK([what C version to ask for],[rjk_cv_cstd],[ | |
806 | AC_TRY_COMPILE([#include <limits.h>],[ | |
807 | long long n = LLONG_MAX; | |
808 | ],[rjk_cv_cstd=default],[ | |
809 | old_CC="$CC" | |
810 | CC="${CC} -std=gnu99" | |
811 | AC_TRY_COMPILE([#include <limits.h>],[ | |
812 | long long n = LLONG_MAX; | |
813 | ],[rjk_cv_cstd=gnu99],[rjk_cv_cstd=unknown]) | |
814 | CC="$old_CC" | |
815 | ]) | |
816 | ]) | |
817 | case $rjk_cv_cstd in | |
818 | default | unknown ) | |
819 | ;; | |
820 | * ) | |
821 | CC="${CC} -std=${rjk_cv_cstd}" | |
822 | ;; | |
823 | esac | |
824 | ||
f368d6c7 RK |
825 | # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29478 |
826 | AC_CACHE_CHECK([checking for GCC bug 29478],[rjk_cv_pr29478],[ | |
827 | old_CC="$CC" | |
828 | if test $GCC = yes; then | |
829 | CC="$CC -Wall -Werror" | |
830 | fi | |
34a1fb8c | 831 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ |
f368d6c7 RK |
832 | static int x(char *f) { |
833 | return *f; | |
834 | } | |
835 | int z(const char *g) { | |
836 | return x((char *)g); | |
34a1fb8c | 837 | }],[])], |
f368d6c7 RK |
838 | [rjk_cv_pr29478=no], |
839 | [rjk_cv_pr29478=yes] | |
840 | ) | |
841 | CC="$old_CC" | |
842 | ]) | |
843 | if test $rjk_cv_pr29478 = yes; then | |
844 | gcc_werror='' | |
845 | fi | |
846 | ||
c6a70f38 RK |
847 | AC_CACHE_CHECK([checking for excessively strict -Wreturn-type], |
848 | [rjk_cv_gcc44_stupidity],[ | |
849 | old_CC="$CC" | |
850 | if test $GCC = yes; then | |
851 | CC="$CC -Wreturn-type -Werror" | |
852 | fi | |
b8ca4525 | 853 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ |
c6a70f38 RK |
854 | static void *threadfn(void) { |
855 | for(;;) | |
856 | ; | |
b8ca4525 | 857 | }],[])], |
c6a70f38 RK |
858 | [rjk_cv_gcc44_stupidity=no], |
859 | [rjk_cv_gcc44_stupidity=yes]) | |
860 | CC="$old_CC" | |
861 | ]) | |
862 | if test $rjk_cv_gcc44_stupidity = yes; then | |
863 | AC_DEFINE([HAVE_STUPID_GCC44],[1],[Define if your compiler has excessively strict -Wreturn-type]) | |
864 | fi | |
865 | ||
460b9539 | 866 | # a reasonable default set of warnings |
f8753294 | 867 | CC="${CC} -Wall -W -Wpointer-arith \ |
460b9539 | 868 | -Wwrite-strings -Wmissing-prototypes \ |
869 | -Wmissing-declarations -Wnested-externs" | |
870 | ||
871 | # Fix up GTK+ and GLib compiler flags | |
872 | GTK_CFLAGS="`echo \"$GTK_CFLAGS\"|sed 's/-I/-isystem /g'`" | |
873 | GLIB_CFLAGS="`echo \"$GLIB_CFLAGS\"|sed 's/-I/-isystem /g'`" | |
874 | ||
f368d6c7 RK |
875 | if test "$gcc_werror" != ''; then |
876 | # GCC 2.95 doesn't know to ignore warnings from system headers | |
877 | AC_CACHE_CHECK([whether -Werror is usable], | |
878 | rjk_cv_werror, [ | |
879 | save_CFLAGS="${CFLAGS}" | |
880 | CFLAGS="${CFLAGS} ${GTK_CFLAGS} -Werror" | |
588b2763 RK |
881 | AC_TRY_COMPILE([#if WITH_GTK |
882 | #include <gtk/gtk.h> | |
883 | #endif | |
884 | ||
885 | struct s { int a, b; }; | |
886 | const struct s sv = { .a = 1 };], | |
f368d6c7 RK |
887 | [], |
888 | [rjk_cv_werror=yes], | |
889 | [rjk_cv_werror=no]) | |
890 | CFLAGS="${save_CFLAGS}" | |
891 | ]) | |
892 | if test $rjk_cv_werror = no; then | |
893 | gcc_werror='' | |
894 | fi | |
460b9539 | 895 | fi |
896 | CC="${CC} $gcc_werror" | |
897 | ||
898 | # for older GCCs that don't know %ju (etc) | |
9a5f7aba | 899 | AC_CACHE_CHECK([whether -Wno-format is required], |
460b9539 | 900 | rjk_cv_noformat, |
901 | AC_TRY_COMPILE([#include <stdio.h> | |
902 | #include <stdint.h> | |
903 | ], | |
904 | [printf("%ju", (uintmax_t)0);], | |
905 | [rjk_cv_noformat=no], | |
906 | [rjk_cv_noformat=yes])) | |
907 | if test $rjk_cv_noformat = yes; then | |
908 | CC="${CC} -Wno-format" | |
909 | fi | |
910 | ||
9a5f7aba | 911 | AC_CACHE_CHECK([whether -Wshadow is OK], |
460b9539 | 912 | rjk_cv_shadow, |
913 | oldCC="${CC}" | |
914 | CC="${CC} -Wshadow" | |
915 | [AC_TRY_COMPILE([ | |
916 | #include <unistd.h> | |
917 | #include <vorbis/vorbisfile.h> | |
918 | ], | |
919 | [], | |
920 | [rjk_cv_shadow=yes], | |
921 | [rjk_cv_shadow=no]) | |
922 | CC="${oldCC}"]) | |
923 | if test $rjk_cv_shadow = yes; then | |
924 | CC="${CC} -Wshadow" | |
925 | fi | |
460b9539 | 926 | fi |
927 | ||
1a00f590 RK |
928 | RJK_GCOV |
929 | ||
460b9539 | 930 | AH_BOTTOM([#ifdef __GNUC__ |
931 | # define attribute(x) __attribute__(x) | |
932 | #else | |
933 | # define attribute(x) | |
934 | #endif]) | |
935 | ||
936 | AC_CONFIG_FILES([Makefile | |
460b9539 | 937 | images/Makefile |
938 | scripts/Makefile | |
3e1d9716 | 939 | common/Makefile |
460b9539 | 940 | lib/Makefile |
941 | server/Makefile | |
05b75f8d | 942 | cgi/Makefile |
460b9539 | 943 | clients/Makefile |
944 | disobedience/Makefile | |
7e960883 | 945 | disobedience/manual/Makefile |
460b9539 | 946 | doc/Makefile |
3e1616b6 | 947 | templates/Makefile |
460b9539 | 948 | plugins/Makefile |
460b9539 | 949 | debian/Makefile |
950 | sounds/Makefile | |
951 | python/Makefile | |
c5dbcd79 | 952 | examples/Makefile |
7affb407 | 953 | libtests/Makefile |
c5dbcd79 | 954 | tests/Makefile]) |
460b9539 | 955 | AC_OUTPUT |
f368d6c7 | 956 | |
05fd0aa1 MW |
957 | # A hack: communicate our selection of GStreamer version back to the |
958 | # Debian packaging machinery so that it can build the right dependencies. | |
959 | echo '### extra control substitutions for Debian' >debian/substvars.auto.new | |
960 | case $mdw_gstreamer_version in | |
961 | nil) ;; | |
962 | *) echo >>debian/substvars.auto.new \ | |
963 | "disorder:GstVersion=gstreamer$mdw_gstreamer_version" ;; | |
964 | esac | |
965 | mv debian/substvars.auto.new debian/substvars.auto | |
966 | ||
f368d6c7 RK |
967 | if test $GCC = yes && test "$gcc_werror" = ''; then |
968 | AC_MSG_WARN([building without -Werror]) | |
969 | fi | |
56fac00d RK |
970 | if test $want_python = no; then |
971 | AC_MSG_WARN([cannot run the test suit without Python]) | |
972 | fi | |
a19aff42 RK |
973 | if test $want_server = yes && test "$ac_cv_lib_samplerate_src_new" != yes; then |
974 | AC_MSG_WARN([libsamplerate will be required in a future version]) | |
975 | fi | |
4cbafe13 RK |
976 | |
977 | # Local Variables: | |
978 | # indent-tabs-mode:nil | |
979 | # End: |