1 # Process this file with autoconf to produce a configure script.
3 # This file is part of DisOrder.
4 # Copyright (C) 2004-2013 Richard Kettlewell
5 # Portions copyright (C) 2007 Ross Younger
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
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.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 AC_INIT([disorder], [5.1], [richard+disorder@sfere.greenend.org.uk])
22 AC_CONFIG_AUX_DIR([config.aux])
23 AM_INIT_AUTOMAKE([foreign])
24 AC_CONFIG_SRCDIR([server/disorderd.c])
25 AM_CONFIG_HEADER([config.h])
26 AC_CONFIG_MACRO_DIR([m4])
31 # What we want to build
43 # By default we don't want gtk-osx. But if you ask for --with-gtk-osx...
45 # Disobedience can be built to a native OS X application. There are some
47 # - you will still need Fink (or something) for other libraries
48 # - if you wanted an application bundle you are out of luck
49 # - the menu bar is still in the main window (not at the top of the screen)
51 # So it's still rather rough and ready. But it does work...
54 # http://www.gtk-osx.org/
55 # http://live.gnome.org/GTK%2B/OSX/Framework
58 # Checks for programs.
63 if test "x$GCC" = xyes; then
73 AC_MSG_ERROR([GNU C is required to build this program])
78 [AS_HELP_STRING([--without-alsa],
79 [do not build with ALSA support])],
82 [AS_HELP_STRING([--without-oss],
83 [do not build with OSS support])],
85 AC_ARG_WITH([coreaudio],
86 [AS_HELP_STRING([--without-coreaudio],
87 [do not build with Core Audio support])],
88 [want_coreaudio=$withval])
90 [AS_HELP_STRING([--without-tests],
91 [do not build test suit])],
92 [want_tests=$withval])
93 AC_ARG_WITH([gtk-osx],
94 [AS_HELP_STRING([--with-gtk-osx],
95 [use native GTK+ (OS X only)])],
96 [want_gtkosx=$withval])
98 AC_MSG_CHECKING([for a known target platform])
101 AC_MSG_RESULT([empeg car stereo])
102 AC_DEFINE([EMPEG_HOST],[1],[define if host is an empeg car stereo])
103 # work around broken toolchain
104 AC_CHECK_LIB([gpg-error], [gpg_strerror])
105 AC_CHECK_LIB([pthread], [pthread_create])
110 AC_MSG_RESULT([Linux])
111 AC_DEFINE_UNQUOTED([PATH_PROC_MOUNTS],["/proc/mounts"],[path to kernel mount list])
114 AC_MSG_RESULT([Mac OS X])
115 # AudioHardwareGetProperty is deprecated in 10.6, but it's still _there_,
116 # so we'll just turn off the warning.
117 CC="$CC -Wno-deprecated-declarations"
118 if test $want_coreaudio = yes; then
119 COREAUDIO="-framework CoreFoundation -framework CoreServices -framework CoreAudio"
122 AC_MSG_CHECKING([Mac OS X target version])
123 # We honor MACOSX_DEPLOYMENT_TARGET in the environment, emulating gcc's
124 # behaviour. But we provide a command line option to override it and
125 # we default to wide support instead of supporting only the build platform.
127 # Currently if you ask for 10.5 you will get a deprecation warning
128 # when building the CoreAudio support code. For the time being the
129 # answer to this is "don't do that then". If a good reason to ask
130 # for a 10.5 deployment target emerges then this will be fixed.
131 if test -z "$MACOSX_DEPLOYMENT_TARGET"; then
132 MACOSX_DEPLOYMENT_TARGET=10.0
134 AC_ARG_WITH([deployment-target],
135 [AS_HELP_STRING([--with-deployment-target=TARGET],
136 [set target OS X version])],
137 [MACOSX_DEPLOYMENT_TARGET=$withval])
138 # Convert to desired format
139 underscored=`echo $MACOSX_DEPLOYMENT_TARGET|sed 's/\./_/'`
140 minver="MAC_OS_X_VERSION_$underscored"
141 AC_MSG_RESULT([$minver])
142 AC_DEFINE_UNQUOTED([MAC_OS_X_VERSION_MIN_REQUIRED], [$minver],
143 [define to minimum version of Mac OS X to support])
145 if test $want_gtkosx = no; then
146 # Fink's GTK+ is hopelessly broken
147 PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/sw/lib/pango-ft219/lib/pkgconfig}
148 export PKG_CONFIG_PATH
153 AC_MSG_RESULT([FreeBSD])
154 # Ports install to /usr/local but the compiler stupidly doesn't look
156 LDFLAGS="${LDFLAGS} -L/usr/local/lib"
157 CPPFLAGS="${CPPFLAGS} -isystem /usr/local/include"
158 # Look for a suitable version of libdb among the versions found in FreeBSD 7.0
159 AC_CACHE_CHECK([looking for a libdb install],[rjk_cv_libdb],[
161 for db in db43 db44 db45 db47; do
162 if test -e /usr/local/lib/$db; then
168 if test $rjk_cv_libdb != none; then
169 LDFLAGS="${LDFLAGS} -L/usr/local/lib/$rjk_cv_libdb"
170 CPPFLAGS="${CPPFLAGS} -isystem /usr/local/include/$rjk_cv_libdb"
174 AC_MSG_RESULT([unknown, winging it])
177 AC_SUBST([COREAUDIO])
179 AC_ARG_WITH([browser],
180 [AS_HELP_STRING([--with-browser=BROWSER],
181 [use BROWSER to display HTML])],
184 AC_CACHE_CHECK([default HTML viewer],[rjk_cv_browser],[
185 rjk_cv_browser=UNKNOWN
186 for candidate in x-www-browser sensible-browser firefox mozilla konqueror netscape; do
187 if type $candidate >/dev/null 2>&1; then
188 rjk_cv_browser="$candidate"
193 if test -z "$browser"; then
194 browser="$rjk_cv_browser"
196 AC_DEFINE_UNQUOTED([BROWSER],["$browser"],[HTML viewer])
198 # Figure out what version of sox is installed
199 AC_CACHE_CHECK([sox version],[rjk_cv_soxver],[
200 rjk_cv_soxver=UNKNOWN
201 if sox --version > /dev/null 2>&1; then
202 rjk_cv_soxver=`sox --version|$AWK '{ if(match($0, /[[0-9\.]]+/)) print substr($0,RSTART,RLENGTH)}'`
204 rjk_cv_soxver=`sox -h 2>&1|$AWK '/Version/ { if(match($0, /[[0-9\.]]+/)) print substr($0,RSTART,RLENGTH)}'`
208 # Decide what command line options to use
210 # sox version endian bits deployed
211 # 12.17.9 -x -[bwld] debian etch, ubuntu dapper
212 # 14.0.0 -x/-[BL] -[bwld] ubuntu hardy
213 # 14.0.1 -x/-[BL] -[1248] debian lenny
214 # 14.2.0 -x/-[BL] -[1248] debian sid (at 2008-12)
216 AC_CACHE_CHECK([default sox generation],[rjk_cv_soxgen],[
217 case $rjk_cv_soxver in
218 [[0-9]].* | 1[[0123]].* )
226 AC_DEFINE_UNQUOTED([DEFAULT_SOX_GENERATION],[$rjk_cv_soxgen],
227 [default sox generation])
229 AC_ARG_WITH([server],
230 [AS_HELP_STRING([--without-server],
231 [do not build server])],
232 [want_server=$withval])
234 [AS_HELP_STRING([--without-cgi],
235 [do not build CGI])],
238 [AS_HELP_STRING([--without-gtk],
239 [do not build GTK+ client])],
241 AC_ARG_WITH([python],
242 [AS_HELP_STRING([--without-python],
243 [do not build Python support])],
244 [want_python=$withval])
246 if test $want_server = no; then
251 # OS Document Root CGI directory
252 # == ============= =============
253 # Debian /var/www /usr/lib/cgi-bin
254 # Ubuntu /var/www /usr/lib/cgi-bin
255 # Red Hat /var/www/html /var/www/cgi-bin
256 # or: /home/httpd/html/ /home/httpd/cgi-bin
257 # Slackware /var/www/htdocs (unknown)
258 # SuSE /srv/www/html /srv/www/cgi-bin
259 # Gentoo /var/www/localhost/htdocs /var/www/localhost/cgi-bin/
260 # FreeBSD /usr/local/www/data /usr/local/www/cgi-bin
261 # or: /usr/local/www/???/data /usr/local/www/???/cgi-bin
262 # OS X /Library/WebServer/Documents /Library/WebServer/CGI-Executables
263 # Apache /usr/local/apache/htdocs (none)
266 # http://wiki.linuxquestions.org/wiki/Apache
267 # http://mapserver.gis.umn.edu/docs/howto/suse-linux
268 # http://www.yolinux.com/TUTORIALS/LinuxTutorialWebSiteConfig.html
269 # http://sources.gentoo.org/viewcvs.py/apache/trunk/dist/2.2/conf/vhosts.d/default_vhost.include?rev=198&view=log
270 # http://httpd.apache.org/docs/
272 if test $want_cgi = yes; then
273 if test -z "$httpdir"; then
274 AC_CACHE_CHECK([for httpd document root],[rjk_cv_httpdir],[
275 rjk_cv_httpdir="not found"
276 for dir in /var/www/html \
278 /var/www/localhost/htdocs \
282 /usr/local/www/data \
283 /usr/local/www/*/data \
284 /Library/WebServer/Documents \
285 /usr/local/apache/htdocs; do
286 if test -d "$dir"; then
287 rjk_cv_httpdir="$dir"
291 if test "$rjk_cv_httpdir" = "not found"; then
292 AC_MSG_ERROR([cannot identify httpd documentroot. Set httpdir on configure command line])
294 httpdir="$rjk_cv_httpdir"
296 if test ! -z "$cgidir"; then
297 # This is a bit harsh but should stop any disasters
298 AC_MSG_ERROR([cgidir has been renamed to cgiexecdir])
300 if test -z "$cgiexecdir"; then
301 AC_CACHE_CHECK([for CGI directory],[rjk_cv_cgiexecdir],[
302 rjk_cv_cgiexecdir="not found"
303 for dir in /usr/lib/cgi-bin \
304 /Library/WebServer/CGI-Executables \
307 /home/httpd/cgi-bin \
308 /var/www/localhost/cgi-bin \
309 /usr/local/lib/cgi-bin \
310 /usr/local/www/cgi-bin \
311 /usr/local/www/*/cgi-bin; do
312 if test -d "$dir"; then
313 rjk_cv_cgiexecdir="$dir"
318 if test "$rjk_cv_cgiexecdir" = "not found"; then
319 AC_MSG_ERROR([cannot identify CGI install directory. Set cgiexecdir on configure command line])
321 cgiexecdir="$rjk_cv_cgiexecdir"
324 AC_ARG_VAR([cgiexecdir], [location of cgi-bin directory, e.g. /usr/lib/cgi-bin])
325 AC_ARG_VAR([httpdir], [location of http document root, e.g. /var/www/htdocs])
326 if test -z "$pkghttpdir"; then
327 pkghttpdir='$(httpdir)/disorder'
329 AC_SUBST([pkghttpdir])
331 if test -z "$dochtmldir"; then
332 dochtmldir='$(docdir)/html'
334 AC_SUBST([dochtmldir])
336 subdirs="scripts lib"
337 if test $want_tests = yes; then
338 subdirs="${subdirs} libtests"
340 subdirs="${subdirs} clients doc examples debian"
342 if test $want_server = yes; then
343 subdirs="${subdirs} server plugins sounds"
345 if test $want_cgi = yes; then
346 subdirs="${subdirs} cgi templates images"
348 if test $want_gtk = yes; then
349 subdirs="${subdirs} disobedience"
350 if test $want_server = no; then
351 subdirs="${subdirs} images"
354 if test $want_tests = yes && test $want_python = yes; then
355 AM_PATH_PYTHON([2.5])
356 subdirs="${subdirs} python tests"
366 AC_CACHE_CHECK([for GNU sed],[rjk_cv_gnused],[
367 rjk_cv_gnused="not found"
368 for candidate in sed gsed; do
369 if $candidate --version >/dev/null 2>&1; then
370 rjk_cv_gnused=$candidate
374 GNUSED="${GNUSED:-$rjk_cv_gnused}"
375 if test "$GNUSED" = "not found"; then
376 AC_MSG_ERROR([GNU sed is required to build this program])
380 AC_CHECK_PROGS([GROG],[grog])
381 AM_CONDITIONAL([GROG],[test "x$GROG" != xnone])
387 AC_DEFINE(_GNU_SOURCE, 1, [required for e.g. strsignal])
389 AC_PATH_PROG([SENDMAIL],[sendmail],[none],[$PATH:/usr/sbin:/usr/lib])
391 # Macs might have libraries under fink's root
392 AC_PATH_PROG([FINK],[fink],[none],[$PATH:/sw/bin])
393 if test "x$FINK" != xnone; then
395 AC_CACHE_CHECK([fink install directory],[rjk_cv_finkprefix],[
396 rjk_cv_finkprefix="`echo "$FINK" | sed 's,/bin/fink$,,'`"
398 # Add include and link paths
399 finkdir="${rjk_cv_finkprefix}"
400 finkbindir="${rjk_cv_finkprefix}/bin"
401 CPPFLAGS="${CPPFLAGS} -isystem ${rjk_cv_finkprefix}/include/gc -isystem ${rjk_cv_finkprefix}/include"
402 if test $want_server = yes; then
403 CPPFLAGS="${CPPFLAGS} -isystem ${rjk_cv_finkprefix}/include/db4"
405 LDFLAGS="${LDFLAGS} -L${rjk_cv_finkprefix}/lib"
406 # Distinguish 32- and 64-bit fink
407 AC_CACHE_CHECK([whether Fink is 32-bit or 64-bit],[rjk_cv_finkbits],[
408 odata=`otool -v -h $finkbindir/dpkg`
417 rjk_cv_finkbits=unknown
421 # Match Fink so we can use its libraries
422 case $rjk_cv_finkbits in
424 CC="$CC -m$rjk_cv_finkbits"
431 AC_SUBST([finkbindir])
433 # Checks for libraries.
434 # We save up a list of missing libraries that we can't do without
435 # and report them all at once.
436 AC_CHECK_LIB(gc, GC_malloc, [AC_SUBST(LIBGC,[-lgc])],
437 [missing_libraries="$missing_libraries libgc"])
438 AC_CHECK_LIB(gcrypt, gcry_md_open,
439 [AC_SUBST(LIBGCRYPT,[-lgcrypt])],
440 [missing_libraries="$missing_libraries libgcrypt"])
441 AC_CHECK_LIB(pcre, pcre_compile,
442 [AC_SUBST(LIBPCRE,[-lpcre])],
443 [missing_libraries="$missing_libraries libpcre"])
444 if test $want_alsa = yes; then
445 AC_CHECK_LIB([asound], [snd_pcm_open],
446 [AC_SUBST(LIBASOUND,[-lasound])])
448 AC_CHECK_LIB([samplerate],[src_new],
449 [AC_SUBST([LIBSAMPLERATE],[-lsamplerate])])
450 if test $want_server = yes; then
451 RJK_CHECK_LIB(db, db_create, [#include <db.h>],
452 [AC_SUBST(LIBDB,[-ldb])],
453 [missing_libraries="$missing_libraries libdb"])
454 AC_CHECK_LIB(vorbis, vorbis_info_clear,
456 [missing_libraries="$missing_libraries libvorbis"])
457 AC_CHECK_LIB(vorbisfile, ov_open,
458 [AC_SUBST(LIBVORBISFILE,["-lvorbisfile -lvorbis"])],
459 [missing_libraries="$missing_libraries libvorbisfile"],
461 AC_CHECK_LIB(mad, mad_stream_init,
462 [AC_SUBST(LIBMAD,[-lmad])],
463 [missing_libraries="$missing_libraries libmad"])
464 AC_CHECK_LIB([ao], [ao_initialize],
465 [AC_SUBST(LIBAO,[-lao])],
466 [missing_libraries="$missing_libraries libao"])
467 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new],
468 [AC_SUBST(LIBFLAC,[-lFLAC])],
469 [missing_libraries="$missing_libraries libFLAC"])
471 AC_CHECK_LIB([pthread], [pthread_create],
472 [AC_SUBST(LIBPTHREAD,[-lpthread])],
473 [missing_libraries="$missing_libraries libpthread"])
475 if test $want_gtk = yes; then
476 if test $want_gtkosx = yes; then
477 GTK_CFLAGS="-isystem /Library/Frameworks/Gtk.framework/Headers -isystem /Library/Frameworks/Cairo.framework/Headers"
478 GLIB_CFLAGS="-isystem /Library/Frameworks/GLib.framework/Headers"
479 GTK_LIBS="-framework Gtk -framework GLib"
481 AM_PATH_GLIB_2_0([],[],[missing_libraries="$missing_libraries libglib"])
482 AM_PATH_GTK_2_0([],[],[missing_libraries="$missing_libraries libgtk"])
486 # Some platforms have iconv already
487 AC_CHECK_FUNC(iconv_open, [:],
488 [RJK_CHECK_LIB(iconv, iconv_open, [#include <iconv.h>],
489 [AC_SUBST(LIBICONV,[-liconv])],
490 [missing_functions="$missing_functions iconv_open"])])
491 AC_CHECK_FUNC([gethostbyname],[:],[
492 AC_CHECK_LIB(nsl,gethostbyname,
493 [AC_SUBST(LIBNSL,[-lnsl])],
494 [missing_functions="$missing_functions gethostbyname"])])
495 AC_CHECK_FUNC([socket],[:],[
496 AC_CHECK_LIB(socket,socket,
497 [AC_SUBST(LIBSOCKET,[-lsocket])],
498 [missing_functions="$missing_functions socket"])])
499 AC_CHECK_FUNC([dlopen],[:],[
500 AC_CHECK_LIB(dl,dlopen,
501 [AC_SUBST(LIBDL,[-ldl])],
502 [missing_functions="$missing_functions dlopen"])])
504 if test ! -z "$missing_libraries"; then
505 AC_MSG_ERROR([missing libraries:$missing_libraries])
508 # Checks for header files.
510 if test $want_oss = yes; then
511 AC_CHECK_HEADERS([sys/soundcard.h])
513 if test $want_alsa = yes; then
514 AC_CHECK_HEADERS([alsa/asoundlib.h])
516 if test $want_coreaudio = yes; then
517 AC_CHECK_HEADERS([CoreAudio/AudioHardware.h])
519 AC_CHECK_HEADERS([inttypes.h])
520 # We don't bother checking very standard stuff
521 # Compilation will fail if any of these headers are missing, so we
522 # check for them here and fail early.
523 if test $want_server = yes; then
524 AC_CHECK_HEADERS([db.h],[:],[
525 missing_headers="$missing_headers $ac_header"
528 AC_CHECK_HEADERS([dlfcn.h gcrypt.h \
529 getopt.h iconv.h langinfo.h \
531 syslog.h unistd.h],[:],[
532 missing_headers="$missing_headers $ac_header"
534 AC_CHECK_HEADERS([samplerate.h])
536 if test ! -z "$missing_headers"; then
537 AC_MSG_ERROR([missing headers:$missing_headers])
540 # We require that libpcre support UTF-8
541 RJK_REQUIRE_PCRE_UTF8([-lpcre])
543 # Checks for typedefs, structures, and compiler characteristics.
548 AC_CHECK_TYPES([struct sockaddr_in6],,,[AC_INCLUDES_DEFAULT
549 #include <netinet/in.h>])
551 # Figure out how we'll check for devices being mounted and unmounted
552 AC_CACHE_CHECK([for list of mounted filesystems],[rjk_cv_mtab],[
553 if test -e /etc/mtab; then
554 rjk_cv_mtab=/etc/mtab
559 if test $rjk_cv_mtab != none; then
560 AC_DEFINE_UNQUOTED([PATH_MTAB],["$rjk_cv_mtab"],[path to file containing mount list])
563 # enable -Werror when we check for certain characteristics:
565 old_CFLAGS="${CFLAGS}"
566 CFLAGS="${CFLAGS} $gcc_werror"
567 AC_CHECK_TYPES([long long,uint32_t,uint8_t,intmax_t,uintmax_t])
569 # Some GCC invocations warn for converting function pointers to void *.
570 # This is fair enough, as it's technically forbidden, but we use dlsym()
571 # which can pretty much only exist if object and function pointers are
572 # interconvertable. So we disable -Werror if need be.
573 if test ! -z "$gcc_werror"; then
574 AC_CACHE_CHECK([whether function pointers can be converted to void * without a warning],
575 [rjk_cv_function_pointer_cast],[
576 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
577 void somefunction(void);],
578 [(void *)somefunction])],
579 [rjk_cv_function_pointer_cast=yes],
580 [rjk_cv_function_pointer_cast=no])])
581 if test $rjk_cv_function_pointer_cast = no; then
586 CFLAGS="${old_CFLAGS}"
588 # gcrypt maintainers keep changing everything. Design your interface
589 # first, then implement it once, rather than getting it wrong three or
590 # four times and shipping between each attempt.
591 AC_CACHE_CHECK([for hash handle type in <grypt.h>],
592 [rjk_cv_gcrypt_hash_handle],[
593 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
597 [rjk_cv_gcrypt_hash_handle=gcry_md_hd_t],[
598 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
602 [rjk_cv_gcrypt_hash_handle=GcryMDHd],
603 [rjk_cv_gcrypt_hash_handle=GCRY_MD_HD])])])
604 AC_DEFINE_UNQUOTED([gcrypt_hash_handle],[$rjk_cv_gcrypt_hash_handle],
605 [libgcrypt hash handle type])
607 AC_CACHE_CHECK([for gcry_error_t in <grypt.h>],
608 [rjk_cv_have_gcry_error_t],[
609 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
613 [rjk_cv_have_gcry_error_t=yes],
614 [rjk_cv_have_gcry_error_t=no])])
615 if test $rjk_cv_have_gcry_error_t = yes; then
616 AC_DEFINE([HAVE_GCRY_ERROR_T],1,[define if <gcrypt.h> defines gcry_error_t])
619 # Checks for functions
620 if test $ac_cv_type_long_long = yes; then
621 AC_CHECK_FUNCS([atoll strtoll],[:],[
622 missing_functions="$missing_functions $ac_func"
624 # Darwin sometimes fails to declare strtoll (e.g. if you ask for -std=c99)
625 AC_CACHE_CHECK([whether strtoll is declared in <stdlib.h>],
626 [rjk_cv_strtoll_declared],[
627 AC_EGREP_HEADER([strtoll], [stdlib.h],
628 [rjk_cv_strtoll_declared=yes],
629 [rjk_cv_strtoll_declared=no])])
630 if test $rjk_cv_strtoll_declared = yes; then
631 AC_DEFINE([DECLARES_STRTOLL],[1],[define if <stdlib.h> declares strtoll])
633 AC_CACHE_CHECK([whether atoll is declared in <stdlib.h>],
634 [rjk_cv_atoll_declared],[
635 AC_EGREP_HEADER([atoll], [stdlib.h],
636 [rjk_cv_atoll_declared=yes],
637 [rjk_cv_atoll_declared=no])])
638 if test $rjk_cv_atoll_declared = yes; then
639 AC_DEFINE([DECLARES_ATOLL],[1],[define if <stdlib.h> declares atoll])
642 AC_CHECK_FUNCS([ioctl nl_langinfo strsignal setenv unsetenv],[:],[
643 missing_functions="$missing_functions $ac_func"
645 # fsync will do if fdatasync not available
646 AC_CHECK_FUNCS([fdatasync],[:],[
647 AC_CHECK_FUNCS([fsync],
648 [AC_DEFINE([fdatasync],[fsync],[define fdatasync to fsync if not available])],
649 [missing_functions="$missing_functions fdatasync"])])
650 if test ! -z "$missing_functions"; then
651 AC_MSG_ERROR([missing functions:$missing_functions])
654 # Functions we can take or leave
655 AC_CHECK_FUNCS([fls getfsstat])
657 if test $want_server = yes; then
658 # <db.h> had better be version 3 or later
659 AC_CACHE_CHECK([db.h version],[rjk_cv_db_version],[
660 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
662 #ifndef DB_VERSION_MAJOR
663 # error cannot determine db version
665 #if DB_VERSION_MAJOR < 4
666 # error inadequate db version
668 #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR <= 2
669 # error inadequate db version
672 [rjk_cv_db_version=ok],
673 [rjk_cv_db_version=inadequate])
674 if test $rjk_cv_db_version = ok; then
675 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
677 #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 6
678 # error http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510270
681 [rjk_cv_db_version=ok],
682 [rjk_cv_db_version=toxic])
685 case $rjk_cv_db_version in
689 AC_MSG_ERROR([need db version at least 4.3 (but not 4.6)])
692 AC_MSG_ERROR([db version 4.6.x does not work - see debian bug 510270])
697 AM_CONDITIONAL([SERVER], [test x$want_server = xyes])
698 if test $want_gtk = yes; then
699 AC_DEFINE([WITH_GTK], [1], [define if using GTK+])
701 AM_CONDITIONAL([GTK], [test x$want_gtk = xyes])
703 if test "x$GCC" = xyes; then
704 # We need LLONG_MAX and annoyingly GCC doesn't always give it to us
706 AC_CACHE_CHECK([what C version to ask for],[rjk_cv_cstd],[
707 AC_TRY_COMPILE([#include <limits.h>],[
708 long long n = LLONG_MAX;
709 ],[rjk_cv_cstd=default],[
711 CC="${CC} -std=gnu99"
712 AC_TRY_COMPILE([#include <limits.h>],[
713 long long n = LLONG_MAX;
714 ],[rjk_cv_cstd=gnu99],[rjk_cv_cstd=unknown])
722 CC="${CC} -std=${rjk_cv_cstd}"
726 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29478
727 AC_CACHE_CHECK([checking for GCC bug 29478],[rjk_cv_pr29478],[
729 if test $GCC = yes; then
730 CC="$CC -Wall -Werror"
732 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
733 static int x(char *f) {
736 int z(const char *g) {
744 if test $rjk_cv_pr29478 = yes; then
748 AC_CACHE_CHECK([checking for excessively strict -Wreturn-type],
749 [rjk_cv_gcc44_stupidity],[
751 if test $GCC = yes; then
752 CC="$CC -Wreturn-type -Werror"
754 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[
755 static void *threadfn(void) {
759 [rjk_cv_gcc44_stupidity=no],
760 [rjk_cv_gcc44_stupidity=yes])
763 if test $rjk_cv_gcc44_stupidity = yes; then
764 AC_DEFINE([HAVE_STUPID_GCC44],[1],[Define if your compiler has excessively strict -Wreturn-type])
767 # a reasonable default set of warnings
768 CC="${CC} -Wall -W -Wpointer-arith \
769 -Wwrite-strings -Wmissing-prototypes \
770 -Wmissing-declarations -Wnested-externs"
772 # Fix up GTK+ and GLib compiler flags
773 GTK_CFLAGS="`echo \"$GTK_CFLAGS\"|sed 's/-I/-isystem /g'`"
774 GLIB_CFLAGS="`echo \"$GLIB_CFLAGS\"|sed 's/-I/-isystem /g'`"
776 if test "$gcc_werror" != ''; then
777 # GCC 2.95 doesn't know to ignore warnings from system headers
778 AC_CACHE_CHECK([whether -Werror is usable],
780 save_CFLAGS="${CFLAGS}"
781 CFLAGS="${CFLAGS} ${GTK_CFLAGS} -Werror"
782 AC_TRY_COMPILE([#if WITH_GTK
786 struct s { int a, b; };
787 const struct s sv = { .a = 1 };],
791 CFLAGS="${save_CFLAGS}"
793 if test $rjk_cv_werror = no; then
797 CC="${CC} $gcc_werror"
799 # for older GCCs that don't know %ju (etc)
800 AC_CACHE_CHECK([whether -Wno-format is required],
802 AC_TRY_COMPILE([#include <stdio.h>
805 [printf("%ju", (uintmax_t)0);],
806 [rjk_cv_noformat=no],
807 [rjk_cv_noformat=yes]))
808 if test $rjk_cv_noformat = yes; then
809 CC="${CC} -Wno-format"
812 AC_CACHE_CHECK([whether -Wshadow is OK],
818 #include <vorbis/vorbisfile.h>
824 if test $rjk_cv_shadow = yes; then
831 AH_BOTTOM([#ifdef __GNUC__
832 # define attribute(x) __attribute__(x)
834 # define attribute(x)
837 AC_CONFIG_FILES([Makefile
844 disobedience/Makefile
845 disobedience/manual/Makefile
857 if test $GCC = yes && test "$gcc_werror" = ''; then
858 AC_MSG_WARN([building without -Werror])
860 if test $want_python = no; then
861 AC_MSG_WARN([cannot run the test suit without Python])
863 if test $want_server = yes && test "$ac_cv_lib_samplerate_src_new" != yes; then
864 AC_MSG_WARN([libsamplerate will be required in a future version])
868 # indent-tabs-mode:nil