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