1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552
|
AC_INIT([Music On Console],[2.6-alpha3],[mocmaint@daper.net],[moc],
[http://moc.daper.net/])
AC_CONFIG_SRCDIR([main.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([dist-xz no-dist-gzip])
AC_PREREQ([2.64])
AC_CANONICAL_HOST
AC_PROG_CC_C99
AC_PROG_CXX
AC_PROG_INSTALL
if test "x$ac_cv_prog_cc_c99" = "xno"
then
AC_MSG_ERROR([You need an ISO C99 capable compiler.])
fi
dnl Test for POSIX.1-2001 or better.
AC_EGREP_CPP(posix_2001_compatible,
[#define _POSIX_C_SOURCE 200112L
#include <unistd.h>
#ifdef _POSIX_VERSION
#if _POSIX_VERSION >= 200112L
posix_2001_compatible
#endif
#endif
],
[true],
[AC_MSG_ERROR([A POSIX.1-2001 compatible system is required.])])
AC_PROG_AWK
AC_LIBTOOL_DLOPEN
AC_DISABLE_STATIC
AC_ENABLE_SHARED
AC_PROG_LIBTOOL
AC_LIB_LTDL
AC_SUBST([EXTRA_OBJS])
plugindir=$libdir/moc
AC_SUBST([plugindir])
PLUGIN_LDFLAGS='-module -avoid-version'
AC_SUBST([PLUGIN_LDFLAGS])
case "$host_os" in
linux*)
AC_DEFINE([LINUX], 1, [Define if your system is GNU/Linux])
;;
openbsd*)
AC_DEFINE([OPENBSD], 1, [Define if your system is OpenBSD])
;;
freebsd*)
AC_DEFINE([FREEBSD], 1, [Define if your system is FreeBSD])
;;
esac
dnl Check that a function pointer is the same size as a data pointer.
AC_MSG_CHECKING([if function and data pointer sizes match])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[], [[if (sizeof(void *) != sizeof(void (*)())) return 1;]]
)],
[AC_MSG_RESULT([yes])],
[WARN_POINTER_MISMATCH=yes
AC_MSG_RESULT([no])],
[AC_MSG_RESULT([unknown])
AC_MSG_WARN([Cross-compilation means pointer size test couldn't be run])])
AC_DEFINE([_FILE_OFFSET_BITS], 64, [Use 64bit IO])
dnl required X/Open SUS standard headers
AC_CHECK_HEADERS([strings.h sys/un.h],,
AC_MSG_ERROR([Required X/Open SUS header files are not present.]))
dnl required OS provided headers
AC_CHECK_HEADERS([sys/ioctl.h sys/param.h],,
AC_MSG_ERROR([Required OS header files are not present.]))
dnl optional headers
AC_CHECK_HEADERS([byteswap.h])
dnl langinfo
AC_CHECK_HEADERS([langinfo.h])
AC_CHECK_HEADERS([nl_types.h])
AC_CHECK_FUNCS([nl_langinfo])
dnl CODESET (taken from vim)
AC_MSG_CHECKING(for nl_langinfo(CODESET))
AC_TRY_LINK([
#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#endif
], [char *cs = nl_langinfo(CODESET);],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_NL_LANGINFO_CODESET], 1,
[Define if you have CODESET constant]),
AC_MSG_RESULT(no))
AC_C_BIGENDIAN
AC_C_CONST
AC_TYPE_INTPTR_T
AX_CFLAGS_GCC_OPTION(-Wall)
AX_CFLAGS_GCC_OPTION(-Wextra)
dnl Overly-enthusiastic warning suppression.
save_CFLAGS="$CFLAGS"
AX_CFLAGS_GCC_OPTION([-Wgnu-zero-variadic-macro-arguments], ,
AC_DEFINE([HAVE_VARIADIC_MACRO_WARNING], 1,
[Define if compiler recognises warning option]))
AX_CFLAGS_GCC_OPTION([-Werror=unknown-warning-option])
AX_CFLAGS_GCC_OPTION([-Wformat-truncation], ,
AC_DEFINE([HAVE_FORMAT_TRUNCATION_WARNING], 1,
[Define if compiler recognises warning option]))
CFLAGS="$save_CFLAGS"
PKG_PROG_PKG_CONFIG([0.20])
if test "x$PKG_CONFIG" = "x"
then
AC_MSG_WARN([No pkg-config utility found or it's too old, I will have trouble finding installed libraries.])
fi
AC_ARG_ENABLE(cache, AS_HELP_STRING([--enable-cache],
[Enable tags caching code]))
if test "x$enable_cache" != "xno"
then
save_CFLAGS="$CFLAGS"
CFLAGS=
AX_PATH_BDB([4.1], [], AC_MSG_ERROR([BerkeleyDB (libdb) not found.]))
CPPFLAGS="$CPPFLAGS $BDB_CPPFLAGS"
CFLAGS="$save_CFLAGS"
LDFLAGS="$LDFLAGS $BDB_LDFLAGS"
EXTRA_LIBS="$EXTRA_LIBS $BDB_LIBS"
AC_CHECK_TYPES([u_int], , , [[#include "${srcdir}/compiler.h"]
[#include <sys/types.h>]
[#include <db.h>]])
fi
AC_ARG_WITH(oss, AS_HELP_STRING([--without-oss],
[Compile without OSS support]))
if test "x$with_oss" != "xno"
then
OSSLIBDIR="$with_oss"
if test "x$with_oss" = "x" || test "x$with_oss" = "xyes"
then
OSSLIBDIR="/usr/lib/oss"
if test -f "/etc/oss.conf"
then
. /etc/oss.conf
fi
fi
if test -d "$OSSLIBDIR/include"
then
OSS_CFLAGS="-I$OSSLIBDIR/include"
fi
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $OSS_CFLAGS"
AC_CHECK_HEADERS([sys/soundcard.h soundcard.h])
CPPFLAGS="$save_CPPFLAGS"
if test "$ac_cv_header_sys_soundcard_h" = "yes" -o \
"$ac_cv_header_soundcard_h" = "yes"
then
AC_DEFINE([HAVE_OSS], 1, [Define if you have OSS.])
EXTRA_OBJS="$EXTRA_OBJS oss.o"
CFLAGS="$CFLAGS $OSS_CFLAGS"
SOUND_DRIVERS="$SOUND_DRIVERS OSS"
AC_CHECK_LIB([ossaudio], [_oss_ioctl],
[EXTRA_LIBS="$EXTRA_LIBS -lossaudio"])
fi
fi
AC_ARG_WITH(sndio, AS_HELP_STRING([--without-sndio],
[Compile without SNDIO support]))
if test "x$with_sndio" != "xno"
then
AC_CHECK_HEADERS([sndio.h])
if test "$ac_cv_header_sndio_h" = "yes"
then
AC_DEFINE([HAVE_SNDIO], 1, [Define if you have SNDIO.])
EXTRA_OBJS="$EXTRA_OBJS sndio_out.o"
SOUND_DRIVERS="$SOUND_DRIVERS SNDIO"
AC_CHECK_LIB([sndio], [sio_open],
[EXTRA_LIBS="$EXTRA_LIBS -lsndio"])
fi
fi
AC_ARG_WITH(alsa, AS_HELP_STRING([--without-alsa],
[Compile without ALSA support]))
COMPILE_ALSA="no"
if test "x$with_alsa" != "xno"
then
PKG_CHECK_MODULES(ALSA, [alsa >= 1.0.11],
[SOUND_DRIVERS="$SOUND_DRIVERS ALSA"
EXTRA_OBJS="$EXTRA_OBJS alsa.o"
AC_DEFINE([HAVE_ALSA], 1, [Define if you have ALSA.])
EXTRA_LIBS="$EXTRA_LIBS $ALSA_LIBS"
COMPILE_ALSA="yes"
CFLAGS="$CFLAGS $ALSA_CFLAGS"],
[true])
fi
AC_ARG_WITH(jack, AS_HELP_STRING([--without-jack],
[Compile without JACK support]))
if test "x$with_jack" != "xno"
then
PKG_CHECK_MODULES(JACK, [jack >= 0.4],
[SOUND_DRIVERS="$SOUND_DRIVERS JACK"
EXTRA_OBJS="$EXTRA_OBJS jack.o"
AC_DEFINE([HAVE_JACK], 1, [Define if you have JACK.])
EXTRA_LIBS="$EXTRA_LIBS $JACK_LIBS"
CFLAGS="$CFLAGS $JACK_CFLAGS"
AC_SEARCH_LIBS(jack_client_open, jack,
[AC_DEFINE([HAVE_JACK_CLIENT_OPEN], 1,
[Define to 1 if you have the `jack_client_open' function.])])],
[true])
fi
AC_SUBST([SOUNDDRIVER])
case "$host_os" in
openbsd*) SOUNDDRIVER="SNDIO:JACK:OSS";;
*) SOUNDDRIVER="JACK:ALSA:OSS";;
esac
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
[Enable debugging code]))
if test "x$enable_debug" = "xno"
then
AC_DEFINE([NDEBUG], 1, [Define if you don't want debugging code])
COMPILE_DEBUG='no'
else
if test "x$enable_debug" = "xgdb"
then
AX_CFLAGS_GCC_OPTION([-ggdb])
AX_CFLAGS_GCC_OPTION([-O0])
COMPILE_DEBUG='gdb'
fi
if test "x$ac_cv_cflags_gcc_option__ggdb" = "x"
then
AX_CFLAGS_GCC_OPTION([-g])
COMPILE_DEBUG='yes'
fi
EXTRA_OBJS="$EXTRA_OBJS null_out.o md5.o"
fi
AC_FUNC_MALLOC
dnl required POSIX (TMR/TSF/XSI) functions
AC_CHECK_FUNCS([localtime_r nanosleep strcasecmp \
strdup strncasecmp wcswidth],,
AC_MSG_ERROR([Required POSIX functions are not present.]))
dnl optional functions
AC_FUNC_STRERROR_R
AC_CHECK_FUNCS([sched_get_priority_max syslog])
dnl OSX / MacOS doesn't provide clock_gettime(3) prior to darwin-16.0.0
dnl so fall back to gettimeofday(2).
case "$host_os" in
[*darwin[1-9].*] | [*darwin1[0-5].*])
HAVE_CLOCK_GETTIME="no"
;;
*darwin*)
HAVE_CLOCK_GETTIME="yes"
;;
*)
AC_CHECK_LIB([rt], [clock_gettime],
[HAVE_CLOCK_GETTIME="yes"],
[HAVE_CLOCK_GETTIME="no"])
;;
esac
if test "$HAVE_CLOCK_GETTIME" = "yes"
then
AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Define if you have clock_gettime(3)])
else
AC_CHECK_FUNCS([gettimeofday],
[AC_MSG_WARN([Using the obsolete gettimeofday(2) function.])],
[AC_MSG_ERROR([No suitable current time function found.])])
fi
dnl strcasestr(3) is a GNU extension
AC_CHECK_DECLS([strcasestr], , , [[#include "${srcdir}/compiler.h"]
[#include <string.h>]])
AC_CHECK_FUNCS([strcasestr])
dnl MIME magic
AC_ARG_WITH(magic, AS_HELP_STRING([--without-magic],
[Compile without MIME magic support]))
COMPILE_MAGIC="no"
if test "x$with_magic" != "xno"
then
AC_CHECK_LIB(magic, magic_open,
[COMPILE_MAGIC="yes"
AC_DEFINE([HAVE_LIBMAGIC], 1, [Define if you have libmagic.])
EXTRA_LIBS="$EXTRA_LIBS -lmagic"])
fi
AC_FUNC_MMAP
dnl POSIX threads
AX_PTHREAD
if test "$ax_pthread_ok" != "yes"
then
AC_MSG_ERROR([[I don't know how to compile pthreads code on this system.]])
fi
CC="$PTHREAD_CC"
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
EXTRA_LIBS="$EXTRA_LIBS $PTHREAD_LIBS"
AC_CHECK_FUNCS([getrlimit])
AC_CHECK_LIB([pthread], [pthread_attr_getstacksize],
[AC_DEFINE([HAVE_PTHREAD_ATTR_GETSTACKSIZE], 1,
[Define if you have pthread_attr_getstacksize(3).])])
dnl __attribute__
AX_C___ATTRIBUTE__
if test "x$ax_cv___attribute__" = "xyes"
then
AX_GCC_FUNC_ATTRIBUTE(format)
AX_GCC_FUNC_ATTRIBUTE(noreturn)
AX_GCC_VAR_ATTRIBUTE(aligned)
AX_GCC_VAR_ATTRIBUTE(unused)
fi
dnl popt
AC_SEARCH_LIBS([poptGetContext], [popt], ,
AC_MSG_ERROR([POPT (libpopt) not found.]))
dnl ncurses
dnl This 'unset' circumvents a notified bug in AX_WITH_CURSES when
dnl _PKG_CONFIG succeeds but a stale 'pkg_failed' value is checked.
dnl It can be removed once an updated 'ax_with_curses.m4' is committed.
unset pkg_failed
AX_WITH_CURSES
if test "x$ax_cv_curses" != "xyes"
then
AC_MSG_ERROR([You need curses/ncurses library and header files.])
fi
EXTRA_LIBS="$EXTRA_LIBS $CURSES_LIBS"
dnl Remove -D_GNU_SOURCE as it causes problems when defined mid-configure.
for flag in $CURSES_CFLAGS
do
if test "x$flag" != "x-D_GNU_SOURCE"
then
CPPFLAGS="$CPPFLAGS $flag"
fi
done
AC_RUN_LOG([: The test below is actually for set_escdelay in curses library.])
AC_RUN_LOG([: Using 'm' avoids unpacking CURSES_LIBS.])
AC_CHECK_LIB([m], [set_escdelay],
AC_DEFINE([HAVE_SET_ESCDELAY], 1, [Define if you have set_escdelay.]),
[], [$CURSES_LIBS])
dnl samplerate
AC_ARG_WITH(samplerate, AS_HELP_STRING([--without-samplerate],
[Compile without libsamplerate]))
COMPILE_SAMPLERATE="no"
if test "x$with_samplerate" != "xno"
then
PKG_CHECK_MODULES(samplerate, samplerate >= 0.1.0,
[EXTRA_LIBS="$EXTRA_LIBS $samplerate_LIBS"
CFLAGS="$CFLAGS $samplerate_CFLAGS"
AC_DEFINE([HAVE_SAMPLERATE], 1,
[Define if you have libsamplerate])
COMPILE_SAMPLERATE="yes"],
[true])
fi
dnl Decoder plugins
m4_include(decoder_plugins/decoders.m4)
dnl Require with iconv for charset translation.
AM_ICONV
if test "x$am_cv_func_iconv" != xyes; then
AC_MSG_ERROR([No iconv library found.])
fi
EXTRA_LIBS="$EXTRA_LIBS $LIBICONV"
dnl librcc
COMPILE_RCC=no
AC_ARG_WITH(rcc, AS_HELP_STRING([--without-rcc],
[Compile without LIBRCC support]))
if test "x$with_rcc" != "xno"
then
AC_CHECK_HEADERS([librcc.h],
[AC_DEFINE([HAVE_RCC], 1, [Define if you have librcc.h])
AC_CHECK_LIB(rcc, rccInit,
[RCC_LIBS="-lrcc"
AC_SUBST([RCC_LIBS])
COMPILE_RCC=yes])
])
if ! $PKG_CONFIG --atleast-version 0.2.10 librcc
then
UPGRADE_LIBRCC="yes"
fi
fi
dnl curl
COMPILE_CURL="no"
AC_ARG_WITH(curl, AS_HELP_STRING([--without-curl],
[Compile without Network streams support]))
if test "x$with_curl" != "xno"
then
PKG_CHECK_MODULES(CURL, [libcurl >= 7.15.1],
[EXTRA_OBJS="$EXTRA_OBJS io_curl.o"
AC_DEFINE([HAVE_CURL], 1, [Define if you have libcurl])
EXTRA_LIBS="$EXTRA_LIBS $CURL_LIBS"
CFLAGS="$CFLAGS $CURL_CFLAGS"
COMPILE_CURL="yes"
if ! $PKG_CONFIG --atleast-version 7.15.4 libcurl
then
UPGRADE_LIBCURL="yes"
fi],
[true])
fi
dnl Capture configuration options for this build.
AC_DEFINE_UNQUOTED([CONFIGURATION], ["$ac_configure_args"],
[Define to the configuration used to build MOC.])
dnl Capture SVN revision number for this build.
AC_PATH_PROG(SVNVERSION, [svnversion])
if test -n "$SVNVERSION"
then
SVNREVN=`$SVNVERSION -n $srcdir`
SVNREVN=`expr "$SVNREVN" : '\([[^:]]*\)'`
if test "x$SVNREVN" = "xexported"
then
unset SVNREVN
else
echo -n $SVNREVN > REVISION
EXTRA_DISTS="$EXTRA_DISTS REVISION"
fi
fi
if test -z "$SVNREVN" && test -f $srcdir/REVISION
then
SVNREVN=`cat $srcdir/REVISION`
EXTRA_DISTS="$EXTRA_DISTS REVISION"
fi
if test -n "$SVNREVN"
then
AC_DEFINE_UNQUOTED([PACKAGE_REVISION], ["$SVNREVN"],
[The SVN revision of this build.])
fi
AC_SUBST(EXTRA_LIBS)
AC_SUBST(EXTRA_DISTS)
AH_BOTTOM([#include "compiler.h"])
AC_OUTPUT([Makefile
themes/Makefile
config.example
])
echo
echo "-----------------------------------------------------------------------"
echo "MOC will be compiled with:"
echo
if test ${#DECODER_PLUGINS} -le 50
then
echo "Decoder plugins: $DECODER_PLUGINS"
else
DECODERS_IX=`echo $DECODER_PLUGINS | $AWK '{match(substr($0, 1, 51), /.* /);print(RLENGTH)}'`
DECODERS_1=`echo $DECODER_PLUGINS | $AWK "{print(substr(\\$0, 1, $DECODERS_IX - 1))}"`
DECODERS_2=`echo $DECODER_PLUGINS | $AWK "{print(substr(\\$0, $DECODERS_IX + 1))}"`
echo "Decoder plugins: $DECODERS_1"
echo " $DECODERS_2"
fi
echo "Sound Drivers: "$SOUND_DRIVERS
echo "DEBUG: "$COMPILE_DEBUG
echo "RCC: "$COMPILE_RCC
echo "Network streams: "$COMPILE_CURL
echo "Resampling: "$COMPILE_SAMPLERATE
echo "MIME magic: "$COMPILE_MAGIC
echo "-----------------------------------------------------------------------"
echo
if test "x$UPGRADE_TAGLIB" = "xyes"
then
echo "WARNING: MOC will soon require TagLib version 1.5 or later;"
echo " plan to upgrade your TagLib soon."
echo
fi
if test "x$UPGRADE_MUSEPACK" = "xyes"
then
echo "WARNING: MOC will soon require Musepack libmpc (rather than libmpcdec);"
echo " plan to upgrade your Musepack soon."
echo
fi
if test "x$UPGRADE_LIBRCC" = "xyes"
then
echo "WARNING: MOC will soon require librcc version 0.2.10 or later;"
echo " plan to upgrade your RCC library soon."
echo
fi
if test "x$UPGRADE_LIBCURL" = "xyes"
then
echo "WARNING: MOC will soon require libcurl version 7.15.4 or later;"
echo " plan to upgrade your cURL library soon."
echo
fi
if test "x$DECODER_PLUGINS" = "x"
then
echo "WARNING: No decoder plugins are to be compiled;"
echo " you will have to provide them separately."
echo
fi
if test "x$SOUND_DRIVERS" = "x"
then
echo "WARNING: No sound output methods are to be compiled;"
echo " you will not hear any sound!"
echo
fi
if test "x$cross_compiling" = "xyes"
then
echo "WARNING: Because of cross-compilation, some tests could not be run"
echo " and MOC may fail with memory access or illegal instruction"
echo " errors when loading plug-ins."
echo
fi
if test "x$WARN_POINTER_MISMATCH" = "xyes"
then
echo "WARNING: Because the sizes of data and function pointers are not"
echo " the same on this architecture, MOC may fail with memory"
echo " access or illegal instruction errors when loading plug-ins."
echo
fi
if test "x$COMPILE_SAMPLERATE" = "xno" -a "x$COMPILE_ALSA" = "xyes"
then
echo "WARNING: Without libsamplerate, the 'ALSAStutterDefeat' option"
echo " may severely restrict the number of audios playable."
echo
fi
|