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

View File

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