chiark / gitweb /
remove action; better findtrack; more template fiddling
[disorder] / configure.ac
CommitLineData
7c8c2fc9 1
460b9539 2# Process this file with autoconf to produce a configure script.
3#
4# This file is part of DisOrder.
5aff007d 5# Copyright (C) 2004-2008 Richard Kettlewell
313acc77 6# Portions copyright (C) 2007 Ross Younger
460b9539 7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21# USA
22#
23
bea6f6d5 24AC_INIT([disorder], [3.0+], [richard+disorder@sfere.greenend.org.uk])
460b9539 25AC_CONFIG_AUX_DIR([config.aux])
bea6f6d5 26AM_INIT_AUTOMAKE(disorder, [3.0+])
460b9539 27AC_CONFIG_SRCDIR([server/disorderd.c])
28AM_CONFIG_HEADER([config.h])
29
dea8f8aa
RK
30# Find host type
31AC_CANONICAL_HOST
32
460b9539 33# What we want to build
460b9539 34want_gtk=yes
35want_python=yes
36
e2f0c461
RK
37# APIs we want
38want_alsa=yes
39want_oss=yes
40want_coreaudio=yes
41
a9f0ad12
RK
42# Checks for programs.
43AC_PROG_CC
44AC_SET_MAKE
45if test "x$GCC" = xyes; then
46 gcc_werror=-Werror
47else
48 gcc_werror=""
49fi
50
e2f0c461
RK
51AC_ARG_WITH([alsa],
52 [AS_HELP_STRING([--without-alsa],
53 [do not build with ALSA support])],
54 [want_alsa=$withval])
55AC_ARG_WITH([oss],
56 [AS_HELP_STRING([--without-oss],
57 [do not build with OSS support])],
58 [want_oss=$withval])
59AC_ARG_WITH([coreaudio],
60 [AS_HELP_STRING([--without-coreaudio],
61 [do not build with Core Audio support])],
62 [want_coreaudio=$withval])
63
a9f0ad12 64AC_MSG_CHECKING([for a known target platform])
dea8f8aa 65case "$host" in
a9f0ad12 66*empeg* )
e3426f7b 67 AC_MSG_RESULT([empeg car stereo])
a9f0ad12
RK
68 AC_DEFINE([EMPEG_HOST],[1],[define if host is an empeg car stereo])
69 # work around broken toolchain
70 AC_CHECK_LIB([gpg-error], [gpg_strerror])
e3426f7b 71 AC_CHECK_LIB([pthread], [pthread_create])
a9f0ad12 72 want_server=no
a9f0ad12 73 ;;
dea8f8aa 74*linux* | *Linux* )
a9f0ad12 75 AC_MSG_RESULT([Linux])
e3426f7b 76 want_server=yes
dea8f8aa 77 ;;
9086a105 78*-apple-darwin* )
e3426f7b 79 AC_MSG_RESULT([Mac OS X])
e2f0c461
RK
80 want_server=yes
81 if test $want_coreaudio = yes; then
82 COREAUDIO="-framework CoreAudio"
83 fi
0ec4c5e6 84 browser=open
8fcf5c48
RK
85 AC_MSG_CHECKING([Mac OS X target version])
86 # We honor MACOSX_DEPLOYMENT_TARGET in the environment, emulating gcc's
87 # behaviour. But we provide a command line option to override it and
88 # we default to wide support instead of supporting only the build platform.
89 #
90 # Currently if you ask for 10.5 you will get a deprecation warning
91 # when building the CoreAudio support code. For the time being the
92 # answer to this is "don't do that then". If a good reason to ask
93 # for a 10.5 deployment target emerges then this will be fixed.
94 if test -z "$MACOSX_DEPLOYMENT_TARGET"; then
95 MACOSX_DEPLOYMENT_TARGET=10.0
96 fi
97 AC_ARG_WITH([deployment-target],
98 [AS_HELP_STRING([--with-deployment-target=TARGET],
99 [set target OS X version])],
100 [MACOSX_DEPLOYMENT_TARGET=$withval])
101 # Convert to desired format
102 underscored=`echo $MACOSX_DEPLOYMENT_TARGET|sed 's/\./_/'`
103 minver="MAC_OS_X_VERSION_$underscored"
104 AC_MSG_RESULT([$minver])
105 AC_DEFINE_UNQUOTED([MAC_OS_X_VERSION_MIN_REQUIRED], [$minver],
106 [define to minimum version of Mac OS X to support])
9086a105 107 ;;
70f47acd
RK
108*-freebsd* )
109 AC_MSG_RESULT([FreeBSD])
110 want_server=yes
edbd470f 111 # Ports install to /usr/local but the compiler stupidly doesn't look
112 # there by default
70f47acd 113 LDFLAGS="${LDFLAGS} -L/usr/local/lib"
e6ea27d8 114 CPPFLAGS="${CPPFLAGS} -isystem /usr/local/include"
42f43a11
RK
115 # Look for a suitable version of libdb among the versions found in FreeBSD 7.0
116 AC_CACHE_CHECK([looking for a libdb install],[rjk_cv_libdb],[
117 rjk_cv_libdb="none"
118 for db in db43 db44 db45 db46; do
119 if test -e /usr/local/lib/$db; then
120 rjk_cv_libdb=$db
121 break
122 fi
123 done
124 ])
125 if test $rjk_cv_libdb != none; then
126 LDFLAGS="${LDFLAGS} -L/usr/local/lib/$rjk_cv_libdb"
127 CPPFLAGS="${CPPFLAGS} -isystem /usr/local/include/$rjk_cv_libdb"
128 fi
70f47acd 129 ;;
dea8f8aa 130* )
a9f0ad12 131 AC_MSG_RESULT([unknown, winging it])
e3426f7b 132 want_server=no
dea8f8aa
RK
133 ;;
134esac
9086a105 135AC_SUBST([COREAUDIO])
dea8f8aa 136
f486ea18
RK
137AC_ARG_WITH([browser],
138 [AS_HELP_STRING([--with-browser=BROWSER],
139 [use BROWSER to display HTML])],
140 [browser=$withval])
141
142AC_CACHE_CHECK([default HTML viewer],[rjk_cv_browser],[
143 rjk_cv_browser=UNKNOWN
58d97da4 144 for candidate in x-www-browser sensible-browser firefox mozilla konqueror netscape; do
f486ea18
RK
145 if type $candidate >/dev/null 2>&1; then
146 rjk_cv_browser="$candidate"
147 break
148 fi
149 done
150])
151if test -z "$browser"; then
152 browser="$rjk_cv_browser"
153fi
154AC_DEFINE_UNQUOTED([BROWSER],["$browser"],[HTML viewer])
155
460b9539 156AC_ARG_WITH([server],
157 [AS_HELP_STRING([--without-server],
158 [do not build server])],
159 [want_server=$withval])
160AC_ARG_WITH([gtk],
161 [AS_HELP_STRING([--without-gtk],
162 [do not build GTK+ client])],
163 [want_gtk=$withval])
164AC_ARG_WITH([python],
165 [AS_HELP_STRING([--without-python],
166 [do not build Python support])],
167 [want_python=$withval])
168
1798e51d 169subdirs="scripts lib clients doc examples debian"
460b9539 170
171if test $want_server = yes; then
172 subdirs="${subdirs} server plugins driver templates sounds images"
173fi
460b9539 174if test $want_gtk = yes; then
175 subdirs="${subdirs} disobedience"
176 if test $want_server = no; then
177 subdirs="${subdirs} images"
178 fi
179fi
56fac00d
RK
180if test $want_python = yes; then
181 AM_PATH_PYTHON([2.4])
182 subdirs="${subdirs} python tests"
183fi
460b9539 184AC_SUBST([subdirs])
185
186# libtool config
187AC_LIBTOOL_DLOPEN
188AC_DISABLE_STATIC
189
190AC_PROG_LIBTOOL
191
edbd470f 192AC_CACHE_CHECK([for GNU sed],[rjk_cv_gnused],[
193 rjk_cv_gnused="not found"
194 for candidate in sed gsed; do
195 if $candidate --version >/dev/null 2>&1; then
196 rjk_cv_gnused=$candidate
197 fi
198 done
199])
200GNUSED="${GNUSED:-$rjk_cv_gnused}"
201if test "$GNUSED" = "not found"; then
202 AC_MSG_ERROR([GNU sed is required to build this program])
203fi
204AC_SUBST([GNUSED])
205
460b9539 206missing_libraries=""
207missing_headers=""
208missing_functions=""
209
210AC_DEFINE(_GNU_SOURCE, 1, [required for e.g. strsignal])
211
212# Macs might have libraries under fink's root
213AC_PATH_PROG([FINK],[fink],[none],[$PATH:/sw/bin])
214if test "x$FINK" != xnone; then
215 AC_CACHE_CHECK([fink install directory],[rjk_cv_finkprefix],[
216 rjk_cv_finkprefix="`echo "$FINK" | sed 's,/bin/fink$,,'`"
217 ])
f9592fe7 218 finkdir="${rjk_cv_finkprefix}"
e83d0967 219 finkbindir="${rjk_cv_finkprefix}/bin"
762f2539 220 CPPFLAGS="${CPPFLAGS} -I${rjk_cv_finkprefix}/include/gc -I${rjk_cv_finkprefix}/include"
460b9539 221 if test $want_server = yes; then
222 CPPFLAGS="${CPPFLAGS} -I${rjk_cv_finkprefix}/include/db4"
223 fi
224 LDFLAGS="${LDFLAGS} -L${rjk_cv_finkprefix}/lib"
e83d0967
RK
225else
226 finkbindir=""
460b9539 227fi
f9592fe7 228AC_SUBST([finkdir])
e83d0967 229AC_SUBST([finkbindir])
460b9539 230
231# Checks for libraries.
232# We save up a list of missing libraries that we can't do without
233# and report them all at once.
234AC_CHECK_LIB(gc, GC_malloc, [AC_SUBST(LIBGC,[-lgc])],
235 [missing_libraries="$missing_libraries libgc"])
236AC_CHECK_LIB(gcrypt, gcry_md_open,
237 [AC_SUBST(LIBGCRYPT,[-lgcrypt])],
238 [missing_libraries="$missing_libraries libgcrypt"])
239AC_CHECK_LIB(pcre, pcre_compile,
240 [AC_SUBST(LIBPCRE,[-lpcre])],
241 [missing_libraries="$missing_libraries libpcre"])
e2f0c461
RK
242if test $want_alsa = yes; then
243 AC_CHECK_LIB([asound], [snd_pcm_open],
244 [AC_SUBST(LIBASOUND,[-lasound])])
245fi
460b9539 246if test $want_server = yes; then
247 RJK_CHECK_LIB(db, db_create, [#include <db.h>],
248 [AC_SUBST(LIBDB,[-ldb])],
249 [missing_libraries="$missing_libraries libdb"])
250 AC_CHECK_LIB(vorbis, vorbis_info_clear,
251 [:],
252 [missing_libraries="$missing_libraries libvorbis"])
253 AC_CHECK_LIB(vorbisfile, ov_open,
254 [AC_SUBST(LIBVORBISFILE,["-lvorbisfile -lvorbis"])],
255 [missing_libraries="$missing_libraries libvorbisfile"],
256 [-lvorbis])
257 AC_CHECK_LIB(mad, mad_stream_init,
258 [AC_SUBST(LIBMAD,[-lmad])],
259 [missing_libraries="$missing_libraries libmad"])
260 AC_CHECK_LIB([ao], [ao_initialize],
261 [AC_SUBST(LIBAO,[-lao])],
262 [missing_libraries="$missing_libraries libao"])
c57f1201 263 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new],
264 [AC_SUBST(LIBFLAC,[-lFLAC])],
265 [missing_libraries="$missing_libraries libFLAC"])
d19ccd72 266fi
edbd470f 267AC_CHECK_LIB([pthread], [pthread_create],
268 [AC_SUBST(LIBPTHREAD,[-lpthread])],
269 [missing_libraries="$missing_libraries libpthread"])
460b9539 270
271if test $want_gtk = yes; then
272 AM_PATH_GLIB_2_0([],[],[missing_libraries="$missing_libraries libglib"])
273 AM_PATH_GTK_2_0([],[],[missing_libraries="$missing_libraries libgtk"])
274fi
275
276# Some platforms have iconv already
277AC_CHECK_FUNC(iconv_open, [:],
278 [RJK_CHECK_LIB(iconv, iconv_open, [#include <iconv.h>],
279 [AC_SUBST(LIBICONV,[-liconv])],
280 [missing_functions="$missing_functions iconv_open"])])
281AC_CHECK_FUNC([gethostbyname],[:],[
282 AC_CHECK_LIB(nsl,gethostbyname,
283 [AC_SUBST(LIBNSL,[-lnsl])],
284 [missing_functions="$missing_functions gethostbyname"])])
285AC_CHECK_FUNC([socket],[:],[
286 AC_CHECK_LIB(socket,socket,
287 [AC_SUBST(LIBSOCKET,[-lsocket])],
288 [missing_functions="$missing_functions socket"])])
289AC_CHECK_FUNC([dlopen],[:],[
290 AC_CHECK_LIB(dl,dlopen,
291 [AC_SUBST(LIBDL,[-ldl])],
292 [missing_functions="$missing_functions dlopen"])])
293
294if test ! -z "$missing_libraries"; then
295 AC_MSG_ERROR([missing libraries:$missing_libraries])
296fi
297
460b9539 298# Checks for header files.
299RJK_FIND_GC_H
e2f0c461
RK
300if test $want_oss = yes; then
301 AC_CHECK_HEADERS([sys/soundcard.h])
302fi
303if test $want_alsa = yes; then
304 AC_CHECK_HEADERS([alsa/asoundlib.h])
305fi
306if test $want_coreaudio = yes; then
307 AC_CHECK_HEADERS([CoreAudio/AudioHardware.h])
308fi
309AC_CHECK_HEADERS([inttypes.h])
146e86fb 310# We don't bother checking very standard stuff
460b9539 311# Compilation will fail if any of these headers are missing, so we
312# check for them here and fail early.
460b9539 313if test $want_server = yes; then
314 AC_CHECK_HEADERS([db.h],[:],[
315 missing_headers="$missing_headers $ac_header"
316 ])
762806f1 317 AC_CHECK_HEADERS([FLAC/file_decoder.h])
460b9539 318fi
319AC_CHECK_HEADERS([dlfcn.h gcrypt.h \
320 getopt.h iconv.h langinfo.h \
321 pcre.h sys/ioctl.h \
322 syslog.h unistd.h],[:],[
323 missing_headers="$missing_headers $ac_header"
324])
325
326if test ! -z "$missing_headers"; then
327 AC_MSG_ERROR([missing headers:$missing_headers])
328fi
329
70f47acd
RK
330# We require that libpcre support UTF-8
331RJK_REQUIRE_PCRE_UTF8([-lpcre])
332
460b9539 333# Checks for typedefs, structures, and compiler characteristics.
334AC_C_CONST
335AC_TYPE_SIZE_T
336AC_C_INLINE
5330d674 337AC_C_BIGENDIAN
460b9539 338AC_CHECK_TYPES([struct sockaddr_in6],,,[AC_INCLUDES_DEFAULT
339#include <netinet/in.h>])
340
341# enable -Werror when we check for certain characteristics:
342
343old_CFLAGS="${CFLAGS}"
344CFLAGS="${CFLAGS} $gcc_werror"
345AC_CHECK_TYPES([long long,uint32_t,uint8_t,intmax_t,uintmax_t])
346
347# Some GCC invocations warn for converting function pointers to void *.
348# This is fair enough, as it's technically forbidden, but we use dlsym()
349# which can pretty much only exist if object and function pointers are
350# interconvertable. So we disable -Werror if need be.
351if test ! -z "$gcc_werror"; then
352 AC_CACHE_CHECK([whether function pointers can be converted to void * without a warning],
353 [rjk_cv_function_pointer_cast],[
354 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
355 void somefunction(void);],
356 [(void *)somefunction])],
357 [rjk_cv_function_pointer_cast=yes],
358 [rjk_cv_function_pointer_cast=no])])
359 if test $rjk_cv_function_pointer_cast = no; then
360 gcc_werror=""
361 fi
362fi
363
364CFLAGS="${old_CFLAGS}"
365
366# gcrypt maintainers keep changing everything. Design your interface
367# first, then implement it once, rather than getting it wrong three or
368# four times and shipping between each attempt.
369AC_CACHE_CHECK([for hash handle type in <grypt.h>],
370 [rjk_cv_gcrypt_hash_handle],[
371 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
372#include <gcrypt.h>
373],
374 [gcry_md_hd_t h;])],
375 [rjk_cv_gcrypt_hash_handle=gcry_md_hd_t],[
376 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
377#include <gcrypt.h>
378],
379 [GcryMDHd h;])],
380 [rjk_cv_gcrypt_hash_handle=GcryMDHd],
381 [rjk_cv_gcrypt_hash_handle=GCRY_MD_HD])])])
382AC_DEFINE_UNQUOTED([gcrypt_hash_handle],[$rjk_cv_gcrypt_hash_handle],
383 [libgcrypt hash handle type])
384
385AC_CACHE_CHECK([for gcry_error_t in <grypt.h>],
386 [rjk_cv_have_gcry_error_t],[
387 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
388#include <gcrypt.h>
389],
390 [gcry_error_t e;])],
391 [rjk_cv_have_gcry_error_t=yes],
392 [rjk_cv_have_gcry_error_t=no])])
393if test $rjk_cv_have_gcry_error_t = yes; then
394 AC_DEFINE([HAVE_GCRY_ERROR_T],1,[define if <gcrypt.h> defines gcry_error_t])
395fi
396
397# Checks for functions
398if test $ac_cv_type_long_long = yes; then
399 AC_CHECK_FUNCS([atoll strtoll],[:],[
400 missing_functions="$missing_functions $ac_func"
401 ])
402 # Darwin sometimes fails to declare strtoll (e.g. if you ask for -std=c99)
403 AC_CACHE_CHECK([whether strtoll is declared in <stdlib.h>],
404 [rjk_cv_strtoll_declared],[
405 AC_EGREP_HEADER([strtoll], [stdlib.h],
406 [rjk_cv_strtoll_declared=yes],
407 [rjk_cv_strtoll_declared=no])])
408 if test $rjk_cv_strtoll_declared = yes; then
409 AC_DEFINE([DECLARES_STRTOLL],[1],[define if <stdlib.h> declares strtoll])
410 fi
411 AC_CACHE_CHECK([whether atoll is declared in <stdlib.h>],
412 [rjk_cv_atoll_declared],[
413 AC_EGREP_HEADER([atoll], [stdlib.h],
414 [rjk_cv_atoll_declared=yes],
415 [rjk_cv_atoll_declared=no])])
416 if test $rjk_cv_atoll_declared = yes; then
417 AC_DEFINE([DECLARES_ATOLL],[1],[define if <stdlib.h> declares atoll])
418 fi
419fi
5b708e0c 420AC_CHECK_FUNCS([ioctl nl_langinfo strsignal setenv unsetenv],[:],[
460b9539 421 missing_functions="$missing_functions $ac_func"
422])
423# fsync will do if fdatasync not available
424AC_CHECK_FUNCS([fdatasync],[:],[
425 AC_CHECK_FUNCS([fsync],
426 [AC_DEFINE([fdatasync],[fsync],[define fdatasync to fsync if not available])],
427 [missing_functions="$missing_functions fdatasync"])])
428if test ! -z "$missing_functions"; then
429 AC_MSG_ERROR([missing functions:$missing_functions])
430fi
7c8c2fc9
RK
431
432# Functions we can take or leave
433AC_CHECK_FUNCS([fls])
434
460b9539 435if test $want_server = yes; then
436 # <db.h> had better be version 3 or later
437 AC_CACHE_CHECK([db.h version],[rjk_cv_db_version],[
438 AC_PREPROC_IFELSE([
439 #include <db.h>
440 #ifndef DB_VERSION_MAJOR
441 # error cannot determine db version
442 #endif
443 #if DB_VERSION_MAJOR < 4
444 # error inadequate db version
445 #endif
f4687532 446 #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR <= 2
460b9539 447 # error inadequate db version
448 #endif
449 ],
450 [rjk_cv_db_version=ok],
451 [rjk_cv_db_version=inadequate])
452 ])
453 if test $rjk_cv_db_version != ok; then
454 AC_MSG_ERROR([need db.h version at least 4.2])
455 fi
456fi
457
e63c38e8 458AM_CONDITIONAL([SERVER], [test x$want_server = xyes])
588b2763
RK
459if test $want_gtk = yes; then
460 AC_DEFINE([WITH_GTK], [1], [define if using GTK+])
461fi
e63c38e8 462
460b9539 463if test "x$GCC" = xyes; then
e84ca290
RK
464 # We need LLONG_MAX and annoyingly GCC doesn't always give it to us
465 # by default.
466 AC_CACHE_CHECK([what C version to ask for],[rjk_cv_cstd],[
467 AC_TRY_COMPILE([#include <limits.h>],[
468 long long n = LLONG_MAX;
469 ],[rjk_cv_cstd=default],[
470 old_CC="$CC"
471 CC="${CC} -std=gnu99"
472 AC_TRY_COMPILE([#include <limits.h>],[
473 long long n = LLONG_MAX;
474 ],[rjk_cv_cstd=gnu99],[rjk_cv_cstd=unknown])
475 CC="$old_CC"
476 ])
477 ])
478 case $rjk_cv_cstd in
479 default | unknown )
480 ;;
481 * )
482 CC="${CC} -std=${rjk_cv_cstd}"
483 ;;
484 esac
485
f368d6c7
RK
486 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29478
487 AC_CACHE_CHECK([checking for GCC bug 29478],[rjk_cv_pr29478],[
488 old_CC="$CC"
489 if test $GCC = yes; then
490 CC="$CC -Wall -Werror"
491 fi
492 AC_COMPILE_IFELSE([
493 static int x(char *f) {
494 return *f;
495 }
496 int z(const char *g) {
497 return x((char *)g);
498 }],
499 [rjk_cv_pr29478=no],
500 [rjk_cv_pr29478=yes]
501 )
502 CC="$old_CC"
503 ])
504 if test $rjk_cv_pr29478 = yes; then
505 gcc_werror=''
506 fi
507
460b9539 508 # a reasonable default set of warnings
509 CC="${CC} -Wall -W -Wpointer-arith -Wbad-function-cast \
510 -Wwrite-strings -Wmissing-prototypes \
511 -Wmissing-declarations -Wnested-externs"
512
513 # Fix up GTK+ and GLib compiler flags
514 GTK_CFLAGS="`echo \"$GTK_CFLAGS\"|sed 's/-I/-isystem /g'`"
515 GLIB_CFLAGS="`echo \"$GLIB_CFLAGS\"|sed 's/-I/-isystem /g'`"
516
f368d6c7
RK
517 if test "$gcc_werror" != ''; then
518 # GCC 2.95 doesn't know to ignore warnings from system headers
519 AC_CACHE_CHECK([whether -Werror is usable],
520 rjk_cv_werror, [
521 save_CFLAGS="${CFLAGS}"
522 CFLAGS="${CFLAGS} ${GTK_CFLAGS} -Werror"
588b2763
RK
523 AC_TRY_COMPILE([#if WITH_GTK
524 #include <gtk/gtk.h>
525#endif
526
527struct s { int a, b; };
528const struct s sv = { .a = 1 };],
f368d6c7
RK
529 [],
530 [rjk_cv_werror=yes],
531 [rjk_cv_werror=no])
532 CFLAGS="${save_CFLAGS}"
533 ])
534 if test $rjk_cv_werror = no; then
535 gcc_werror=''
536 fi
460b9539 537 fi
538 CC="${CC} $gcc_werror"
539
540 # for older GCCs that don't know %ju (etc)
9a5f7aba 541 AC_CACHE_CHECK([whether -Wno-format is required],
460b9539 542 rjk_cv_noformat,
543 AC_TRY_COMPILE([#include <stdio.h>
544#include <stdint.h>
545],
546 [printf("%ju", (uintmax_t)0);],
547 [rjk_cv_noformat=no],
548 [rjk_cv_noformat=yes]))
549 if test $rjk_cv_noformat = yes; then
550 CC="${CC} -Wno-format"
551 fi
552
9a5f7aba 553 AC_CACHE_CHECK([whether -Wshadow is OK],
460b9539 554 rjk_cv_shadow,
555 oldCC="${CC}"
556 CC="${CC} -Wshadow"
557 [AC_TRY_COMPILE([
558#include <unistd.h>
559#include <vorbis/vorbisfile.h>
560],
561 [],
562 [rjk_cv_shadow=yes],
563 [rjk_cv_shadow=no])
564 CC="${oldCC}"])
565 if test $rjk_cv_shadow = yes; then
566 CC="${CC} -Wshadow"
567 fi
460b9539 568fi
569
1a00f590
RK
570RJK_GCOV
571
460b9539 572AH_BOTTOM([#ifdef __GNUC__
573# define attribute(x) __attribute__(x)
574#else
575# define attribute(x)
576#endif])
577
578AC_CONFIG_FILES([Makefile
579 templates/Makefile
580 images/Makefile
581 scripts/Makefile
582 lib/Makefile
583 server/Makefile
584 clients/Makefile
585 disobedience/Makefile
586 doc/Makefile
587 plugins/Makefile
588 driver/Makefile
589 debian/Makefile
590 sounds/Makefile
591 python/Makefile
c5dbcd79
RK
592 examples/Makefile
593 tests/Makefile])
460b9539 594AC_OUTPUT
f368d6c7
RK
595
596if test $GCC = yes && test "$gcc_werror" = ''; then
597 AC_MSG_WARN([building without -Werror])
598fi
56fac00d
RK
599if test $want_python = no; then
600 AC_MSG_WARN([cannot run the test suit without Python])
601fi