configure.ac: add macro MPD_DEFINE_CONDITIONAL

This commit is contained in:
Max Kellermann 2014-12-21 23:25:48 +01:00
parent 7afe63aa06
commit 373706c92b
3 changed files with 46 additions and 86 deletions

View File

@ -287,10 +287,10 @@ AC_ARG_ENABLE(database,
AS_HELP_STRING([--enable-database],
[enable support for the music database]),,
enable_database=yes)
AM_CONDITIONAL(ENABLE_DATABASE, test x$enable_database = xyes)
MPD_DEFINE_CONDITIONAL(enable_database, ENABLE_DATABASE,
[the music database])
if test x$enable_database = xyes; then
database_auto=auto
AC_DEFINE(ENABLE_DATABASE, 1, [Define to enable the music database])
else
database_auto=no
fi
@ -303,10 +303,7 @@ AC_ARG_ENABLE(daemon,
AS_HELP_STRING([--enable-daemon],
[enable daemonization (default: enabled)]),,
enable_daemon=$default_enable_daemon)
AM_CONDITIONAL([ENABLE_DAEMON], [test x$enable_daemon = xyes])
if test x$enable_daemon = xyes; then
AC_DEFINE([ENABLE_DAEMON], 1, [Enable daemonization?])
fi
MPD_DEFINE_CONDITIONAL(enable_daemon, ENABLE_DAEMON, [Enable daemonization?])
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
@ -467,10 +464,9 @@ AC_ARG_ENABLE(icu,
if test x$enable_icu = xyes; then
PKG_CHECK_MODULES([ICU], [icu-i18n],,
[AC_MSG_ERROR([libicu not found])])
AC_DEFINE(HAVE_ICU, 1, [Define if libicu is used])
fi
AM_CONDITIONAL(HAVE_ICU, test x$enable_icu = xyes)
MPD_DEFINE_CONDITIONAL(enable_icu, HAVE_ICU, [libicu])
AC_ARG_ENABLE(glib,
AS_HELP_STRING([--enable-glib],
@ -490,11 +486,9 @@ if test x$enable_glib = xyes; then
# suppress warnings in the GLib headers
GLIB_CFLAGS=`echo $GLIB_CFLAGS |sed -e 's,-I/,-isystem /,g'`
fi
AC_DEFINE(HAVE_GLIB, 1, [Define if GLib is used])
fi
AM_CONDITIONAL(HAVE_GLIB, test x$enable_glib = xyes)
MPD_DEFINE_CONDITIONAL(enable_glib, HAVE_GLIB, [GLib])
dnl ---------------------------------------------------------------------------
dnl Protocol Options
@ -577,10 +571,7 @@ if test x$ac_cv_func_inotify_init = xno; then
enable_inotify=no
fi
if test x$enable_inotify = xyes; then
AC_DEFINE([ENABLE_INOTIFY], 1, [Define to enable inotify support])
fi
AM_CONDITIONAL(ENABLE_INOTIFY, test x$enable_inotify = xyes)
MPD_DEFINE_CONDITIONAL(enable_inotify, ENABLE_INOTIFY, [inotify support])
dnl --------------------------------- libwrap ---------------------------------
if test x$enable_libwrap != xno; then
@ -648,11 +639,10 @@ esac
MPD_AUTO_PKG(avahi, AVAHI, [avahi-client dbus-1],
[avahi client library], [avahi-client not found])
if test x$enable_avahi = xyes; then
AC_DEFINE([HAVE_AVAHI], 1, [Define to enable Avahi Zeroconf support])
with_zeroconf=avahi
fi
AM_CONDITIONAL(HAVE_AVAHI, test x$enable_avahi = xyes)
MPD_DEFINE_CONDITIONAL(enable_avahi, HAVE_AVAHI, [Avahi Zeroconf])
enable_bounjour=no
if test x$with_zeroconf != xno; then
@ -727,10 +717,8 @@ MPD_AUTO([soundcloud], [soundcloud.com support], [libyajl not found],
[PKG_CHECK_MODULES([YAJL], [yajl >= 2.0],
[found_soundcloud=yes],
[found_soundcloud=no])])
if test x$enable_soundcloud = xyes; then
AC_DEFINE(ENABLE_SOUNDCLOUD, 1, [Define when soundcloud is enabled])
fi
AM_CONDITIONAL(ENABLE_SOUNDCLOUD, test x$enable_soundcloud = xyes)
MPD_DEFINE_CONDITIONAL(enable_soundcloud, ENABLE_SOUNDCLOUD,
[soundcloud.com support])
dnl ---------------------------------- cdio ---------------------------------
MPD_ENABLE_AUTO_PKG(cdio_paranoia, CDIO_PARANOIA, [libcdio_paranoia],
@ -766,11 +754,8 @@ if test x$enable_neighbor_plugins = xauto; then
fi
fi
if test x$enable_neighbor_plugins = xyes; then
AC_DEFINE(ENABLE_NEIGHBOR_PLUGINS, 1,
[Define to enable support for neighbor discovery])
fi
AM_CONDITIONAL(ENABLE_NEIGHBOR_PLUGINS, test x$enable_neighbor_plugins = xyes)
MPD_DEFINE_CONDITIONAL(enable_neighbor_plugins, ENABLE_NEIGHBOR_PLUGINS,
[neighbor discovery])
dnl ---------------------------------------------------------------------------
dnl Archive Plugins
@ -840,12 +825,11 @@ if
test x$enable_zzip = xyes ||
test x$enable_iso9660 = xyes; then
enable_archive=yes
AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
else
enable_archive=no
fi
AM_CONDITIONAL(ENABLE_ARCHIVE, test x$enable_archive = xyes)
MPD_DEFINE_CONDITIONAL(enable_archive, ENABLE_ARCHIVE, [the archive API])
dnl ---------------------------------------------------------------------------
dnl Decoder Plugins
@ -861,11 +845,7 @@ MPD_ENABLE_AUTO_PKG(audiofile, AUDIOFILE, [audiofile >= 0.3],
dnl ----------------------------------- DSD -----------------------------------
if test x$enable_dsd = xyes; then
AC_DEFINE(ENABLE_DSD, 1, [Define for the DSD decoder])
fi
AM_CONDITIONAL(ENABLE_DSD, test x$enable_dsd = xyes)
MPD_DEFINE_CONDITIONAL(enable_dsd, ENABLE_DSD, [DSD decoder])
dnl ----------------------------------- FAAD ----------------------------------
MPD_ENABLE_AUTO_LIB(aac, FAAD, faad, NeAACDecOpen, [-lfaad], [],
@ -1078,11 +1058,8 @@ else
fi
dnl ------------------------------- FLAC Encoder ------------------------------
if test x$enable_flac_encoder = xyes; then
AC_DEFINE(ENABLE_FLAC_ENCODER, 1,
[Define to enable the FLAC encoder plugin])
fi
AM_CONDITIONAL(ENABLE_FLAC_ENCODER, test x$enable_flac_encoder = xyes)
MPD_DEFINE_CONDITIONAL(enable_flac_encoder, ENABLE_FLAC_ENCODER,
[FLAC encoder plugin])
dnl ------------------------------- Shine Encoder ------------------------------
@ -1103,11 +1080,8 @@ MPD_ENABLE_AUTO_PKG(twolame_encoder, TWOLAME, [twolame],
[TwoLAME encoder plugin], [libtwolame not found])
dnl ------------------------------- WAVE Encoder ------------------------------
AM_CONDITIONAL(ENABLE_WAVE_ENCODER, test x$enable_wave_encoder = xyes)
if test x$enable_wave_encoder = xyes; then
AC_DEFINE(ENABLE_WAVE_ENCODER, 1,
[Define to enable the PCM wave encoder plugin])
fi
MPD_DEFINE_CONDITIONAL(enable_wave_encoder, ENABLE_WAVE_ENCODER,
[PCM wave encoder plugin])
dnl --------------------------- encoder plugins test --------------------------
if test x$enable_vorbis_encoder != xno ||
@ -1128,11 +1102,9 @@ else
fi
fi
if test x$enable_encoder = xyes; then
AC_DEFINE(ENABLE_ENCODER, 1,
[Define to enable the encoder plugins])
fi
AM_CONDITIONAL(ENABLE_ENCODER, test x$enable_encoder = xyes)
MPD_DEFINE_CONDITIONAL(enable_encoder, ENABLE_ENCODER,
[the encoder plugins])
AM_CONDITIONAL(HAVE_OGG_ENCODER, test x$enable_vorbis_encoder = xyes || test x$enable_opus = xyes)
dnl ---------------------------------------------------------------------------
@ -1151,12 +1123,12 @@ MPD_ENABLE_AUTO_PKG(roar, ROAR, [libroar >= 0.4.0],
dnl ----------------------------------- FIFO ----------------------------------
if test x$enable_fifo = xyes; then
AC_CHECK_FUNC([mkfifo],
[enable_fifo=yes;AC_DEFINE([HAVE_FIFO], 1,
[Define to enable support for writing audio to a FIFO])],
[enable_fifo=yes],
[enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
fi
AM_CONDITIONAL(HAVE_FIFO, test x$enable_fifo = xyes)
MPD_DEFINE_CONDITIONAL(enable_fifo, HAVE_FIFO,
[support for writing audio to a FIFO])
dnl ------------------------------- HTTPD Output ------------------------------
if test x$enable_httpd_output = xauto; then
@ -1170,10 +1142,8 @@ if test x$enable_httpd_output = xauto; then
fi
fi
if test x$enable_httpd_output = xyes; then
AC_DEFINE(ENABLE_HTTPD_OUTPUT, 1, [Define to enable the HTTP server output])
fi
AM_CONDITIONAL(ENABLE_HTTPD_OUTPUT, test x$enable_httpd_output = xyes)
MPD_DEFINE_CONDITIONAL(enable_httpd_output, ENABLE_HTTPD_OUTPUT,
[the HTTP server output])
dnl ----------------------------------- JACK ----------------------------------
MPD_ENABLE_AUTO_PKG(jack, JACK, [jack >= 0.100],
@ -1213,21 +1183,17 @@ else
[OpenAL output plugin], [OpenAL not found])
fi
if test x$enable_openal = xyes; then
AC_DEFINE(HAVE_OPENAL, 1, [Define for OpenAL support])
fi
AM_CONDITIONAL(HAVE_OPENAL, test x$enable_openal = xyes)
MPD_DEFINE_CONDITIONAL(enable_openal, HAVE_OPENAL, [OpenAL support])
dnl ---------------------------- Open Sound System ----------------------------
if test x$enable_oss = xyes; then
AC_CHECK_HEADER(sys/soundcard.h,
[enable_oss=yes;AC_DEFINE(HAVE_OSS,1,[Define to enable OSS])],
[enable_oss=yes],
[AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);
enable_oss=no])
fi
AM_CONDITIONAL(HAVE_OSS, test x$enable_oss = xyes)
MPD_DEFINE_CONDITIONAL(enable_oss, HAVE_OSS, [Open Sound System])
dnl ----------------------------------- OSX -----------------------------------
if test x$enable_osx = xyes; then
@ -1238,11 +1204,8 @@ fi
AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)
dnl ------------------------------- Pipe Output -------------------------------
if test x$enable_pipe_output = xyes; then
AC_DEFINE([ENABLE_PIPE_OUTPUT], 1,
[Define to enable support for writing audio to a pipe])
fi
AM_CONDITIONAL(ENABLE_PIPE_OUTPUT, test x$enable_pipe_output = xyes)
MPD_DEFINE_CONDITIONAL(enable_pipe_output, ENABLE_PIPE_OUTPUT,
[support for writing audio to a pipe])
dnl -------------------------------- PulseAudio -------------------------------
MPD_ENABLE_AUTO_PKG(pulse, PULSE, [libpulse >= 0.9.16],
@ -1260,10 +1223,8 @@ if test x$enable_recorder_output = xauto; then
fi
fi
if test x$enable_recorder_output = xyes; then
AC_DEFINE(ENABLE_RECORDER_OUTPUT, 1, [Define to enable the recorder output])
fi
AM_CONDITIONAL(ENABLE_RECORDER_OUTPUT, test x$enable_recorder_output = xyes)
MPD_DEFINE_CONDITIONAL(enable_recorder_output, ENABLE_RECORDER_OUTPUT,
[the recorder output])
dnl -------------------------------- SHOUTcast --------------------------------
if test x$enable_shout = xauto; then
@ -1277,18 +1238,13 @@ if test x$enable_shout = xauto; then
fi
fi
if test x$enable_shout = xyes; then
AC_DEFINE(HAVE_SHOUT, 1, [Define to enable the shoutcast output])
fi
AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)
MPD_DEFINE_CONDITIONAL(enable_shout, HAVE_SHOUT,
[shoutcast output])
dnl --------------------------------- Solaris ---------------------------------
if test x$enable_solaris_output = xyes; then
AC_DEFINE(ENABLE_SOLARIS_OUTPUT, 1, [Define to enable Solaris /dev/audio support])
fi
AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)
MPD_DEFINE_CONDITIONAL(enable_solaris_output, ENABLE_SOLARIS_OUTPUT,
[Solaris /dev/audio support])
dnl --------------------------------- WinMM ---------------------------------

View File

@ -93,11 +93,7 @@ AC_DEFUN([MPD_ARG_ENABLE], [
$5
if test x$[]enable_$1 = xyes; then
AC_DEFINE(ENABLE_$2, 1,
[Define to enable $3])
fi
AM_CONDITIONAL(ENABLE_$2, test x$[]enable_$1 = xyes)
MPD_DEFINE_CONDITIONAL(enable_$1, ENABLE_$2, [$3])
])
dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_PKG

View File

@ -0,0 +1,8 @@
dnl Wrapper for AC_DEFINE and AM_CONDITIONAL
dnl
dnl Parameters: varname1, varname2, description
AC_DEFUN([MPD_DEFINE_CONDITIONAL], [dnl
AM_CONDITIONAL($2, test x$[]$1 = xyes)
if test x$[]$1 = xyes; then
AC_DEFINE($2, 1, [Define to enable $3])
fi])