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