Commit 94592c14 authored by Max Kellermann's avatar Max Kellermann

build with Meson instead of autotools

So long, autotools! This is my last MPD related project to migrate away from it. It has its strengths, but also very obvious weaknesses and weirdnesses. Today, many of its quirks are not needed anymore, and are cumbersome and slow. Now welcome our new Meson overlords!
parent 13ce142d
......@@ -33,7 +33,7 @@ tags
/libtool
/ltmain.sh
/mkinstalldirs
/build
/output/
/src/mpd
/systemd/system/mpd.service
/systemd/user/mpd.service
......
......@@ -9,12 +9,23 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:mhier/libboost-latest'
- sourceline: 'ppa:saiarcot895/chromium-dev' # for ninja-build
- sourceline: 'ppa:deadsnakes/ppa' # for Python 3.7 (required by Meson)
packages:
- g++-6
- libcppunit-dev
- boost1.67
- python3.6
- python3-urllib3
- ninja-build
before_install:
- wget https://bootstrap.pypa.io/get-pip.py
- /usr/bin/python3.6 get-pip.py --user
install:
- /usr/bin/python3.6 $HOME/.local/bin/pip install --user meson
env:
- MATRIX_EVAL="export CC=gcc-6 CXX=g++-6"
# use gold as workaround for https://sourceware.org/bugzilla/show_bug.cgi?id=17068
- MATRIX_EVAL="export CC=gcc-6 CXX=g++-6 LDFLAGS=-fuse-ld=gold PATH=$HOME/.local/bin:$PATH"
- os: linux
dist: trusty
......@@ -23,22 +34,29 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:mhier/libboost-latest'
- sourceline: 'ppa:saiarcot895/chromium-dev' # for ninja-build
- sourceline: 'ppa:deadsnakes/ppa' # for Python 3.7 (required by Meson)
packages:
- g++-8
- libcppunit-dev
- boost1.67
- python3.6
- python3-urllib3
- ninja-build
before_install:
- wget https://bootstrap.pypa.io/get-pip.py
- /usr/bin/python3.6 get-pip.py --user
install:
- /usr/bin/python3.6 $HOME/.local/bin/pip install --user meson
env:
- MATRIX_EVAL="export CC=gcc-8 CXX=g++-8"
# use gold as workaround for https://sourceware.org/bugzilla/show_bug.cgi?id=17068
- MATRIX_EVAL="export CC=gcc-8 CXX=g++-8 LDFLAGS=-fuse-ld=gold PATH=$HOME/.local/bin:$PATH"
- os: osx
osx_image: xcode9.3beta
env:
- MATRIX_EVAL=""
env:
global:
- MAKEFLAGS="-j2"
cache:
- apt
- ccache
......@@ -50,16 +68,14 @@ before_install:
install:
# C++14
- test "$TRAVIS_OS_NAME" != "osx" || brew install cppunit ccache
- test "$TRAVIS_OS_NAME" != "osx" || brew install cppunit ccache meson
before_script:
- ccache -s
script:
- OPTIONS="--enable-test"
- test "$TRAVIS_OS_NAME" != "osx" || OPTIONS="$OPTIONS --enable-osx"
- ./autogen.sh
- ./configure CC="ccache $CC" CXX="ccache $CXX" --disable-silent-rules --disable-dependency-tracking $OPTIONS
- make
- make check
- eval "${MATRIX_EVAL}"
- OPTIONS="-Dtest=true"
- meson . output --werror $OPTIONS
- ninja -C output -v test
- ccache -s
......@@ -46,6 +46,7 @@ ver 0.21 (not yet released)
- opus: support for sending metadata using ogg stream chaining
* systemd watchdog support
* require GCC 6
* build with Meson instead of autotools
ver 0.20.22 (not yet released)
* storage
......
#!/bin/sh -e
S=`dirname "$0"`
ANDROID_ABI=$1
STRIP=$2
ZIP=$3
UNSIGNED_APK=$4
LIBMPD_SO=$5
CLASSES_DEX=$6
RESOURCES_APK=$7
D=`dirname "$UNSIGNED_APK"`
rm -rf "$D/apk"
mkdir -p "$D/apk/lib/$ANDROID_ABI"
"$STRIP" "$LIBMPD_SO" -o "$D/apk/lib/$ANDROID_ABI/`basename $LIBMPD_SO`"
cp "$CLASSES_DEX" "$D/apk/"
cp "$RESOURCES_APK" "$UNSIGNED_APK"
cd "$D/apk"
exec zip -q -r "../`basename $UNSIGNED_APK`" .
unsigned_apk = custom_target(
'mpd-unsigned.apk',
output: 'mpd-unsigned.apk',
input: [mpd, classes_dex, resources_apk[0]],
command: [
join_paths(meson.current_source_dir(), 'make-unsigned-apk.sh'),
android_abi,
get_option('android_strip'),
zip,
'@OUTPUT0@',
'@INPUT@',
],
)
if get_option('android_debug_keystore') != ''
debug_apk = custom_target(
'mpd-debug.apk',
output: 'mpd-debug.apk',
input: unsigned_apk,
command: [
jarsigner,
'-keystore', get_option('android_debug_keystore'),
'-storepass', 'android',
'-signedjar', '@OUTPUT@',
'@INPUT@',
'androiddebugkey',
],
build_by_default: true
)
endif
if get_option('android_keystore') != '' and get_option('android_keyalias') != '' and get_option('android_keypass') != ''
unaligned_apk = custom_target(
'mpd-unaligned.apk',
output: 'mpd-unaligned.apk',
input: unsigned_apk,
command: [
jarsigner,
'-digestalg', 'SHA1', '-sigalg', 'MD5withRSA',
'-keystore', get_option('android_keystore'),
'-storepass', get_option('android_keypass'),
'-signedjar', '@OUTPUT@',
'@INPUT@',
get_option('android_keyalias'),
],
)
apk = custom_target(
'mpd.apk',
output: 'mpd.apk',
input: unaligned_apk,
command: [
android_zipalign,
'-f', '4',
'@INPUT@', '@OUTPUT@',
],
build_by_default: true
)
endif
......@@ -57,6 +57,7 @@ sys.path[0] = os.path.join(mpd_path, 'python')
# output directories
from build.dirs import lib_path, tarball_path, src_path
from build.meson import configure as run_meson
arch_path = os.path.join(lib_path, arch)
build_path = os.path.join(arch_path, 'build')
......@@ -144,7 +145,15 @@ class AndroidNdkToolchain:
# redirect pkg-config to use our root directory instead of the
# default one on the build host
self.env['PKG_CONFIG_LIBDIR'] = os.path.join(install_prefix, 'lib/pkgconfig')
import shutil
bin_dir = os.path.join(install_prefix, 'bin')
try:
os.makedirs(bin_dir)
except:
pass
self.pkg_config = shutil.copy(os.path.join(mpd_path, 'build', 'pkg-config.sh'),
os.path.join(bin_dir, 'pkg-config'))
self.env['PKG_CONFIG'] = self.pkg_config
# a list of third-party libraries to be used by MPD on Android
from build.libs import *
......@@ -173,32 +182,13 @@ for x in thirdparty_libs:
toolchain = AndroidNdkToolchain(tarball_path, src_path, build_path,
use_cxx=True)
configure = [
os.path.join(mpd_path, 'configure'),
'CC=' + toolchain.cc,
'CXX=' + toolchain.cxx,
'CFLAGS=' + toolchain.cflags,
'CXXFLAGS=' + toolchain.cxxflags,
'CPPFLAGS=' + toolchain.cppflags,
'LDFLAGS=' + toolchain.ldflags,
'LIBS=' + toolchain.libs,
'AR=' + toolchain.ar,
'RANLIB=' + toolchain.ranlib,
'STRIP=' + toolchain.strip,
'--host=' + toolchain.arch,
'--prefix=' + toolchain.install_prefix,
'--with-sysroot=' + toolchain.sysroot,
'--with-android-sdk=' + sdk_path,
'--enable-silent-rules',
'--disable-icu',
] + configure_args
from build.cmdline import concatenate_cmdline_variables
configure = concatenate_cmdline_variables(configure,
set(('CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'LIBS')))
subprocess.check_call(configure, env=toolchain.env)
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], env=toolchain.env)
configure_args += [
'-Dandroid_sdk=' + sdk_path,
'-Dandroid_ndk=' + ndk_path,
'-Dandroid_abi=' + android_abi,
'-Dandroid_strip=' + toolchain.strip,
]
from build.meson import configure as run_meson
run_meson(toolchain, mpd_path, '.', configure_args)
subprocess.check_call(['/usr/bin/ninja'], env=toolchain.env)
#!/bin/sh -e
S=`dirname "$0"`
AAPT=$1
BASE_JAR=$2
JAVA_PKG=$3
JAVA_PKG_PATH=$4
APK_FILE="$5"
D=`dirname "$APK_FILE"`
rm -rf "$D/res"
mkdir -p "$D/res/drawable" "$D/src"
cp "$D/icon.png" "$D/notification_icon.png" "$D/res/drawable/"
"$AAPT" package -f -m --auto-add-overlay \
--custom-package "$JAVA_PKG" \
-M "$S/AndroidManifest.xml" \
-S "$D/res" \
-S "$S/res" \
-J "$D/src" \
-I "$BASE_JAR" \
-F "$D/resources.apk"
cp "$D/src/$JAVA_PKG_PATH/R.java" "$D/"
android_package = 'org.musicpd'
android_package_path = join_paths(android_package.split('.'))
android_ndk = get_option('android_ndk')
android_sdk = get_option('android_sdk')
android_abi = get_option('android_abi')
android_sdk_build_tools_version = '27.0.0'
android_sdk_platform = 'android-21'
android_build_tools_dir = join_paths(android_sdk, 'build-tools', android_sdk_build_tools_version)
android_sdk_platform_dir = join_paths(android_sdk, 'platforms', android_sdk_platform)
android_aidl = join_paths(android_build_tools_dir, 'aidl')
android_aapt = join_paths(android_build_tools_dir, 'aapt')
android_dx = join_paths(android_build_tools_dir, 'dx')
android_zipalign = join_paths(android_build_tools_dir, 'zipalign')
javac = find_program('javac')
jarsigner = find_program('jarsigner')
rsvg_convert = find_program('rsvg-convert')
convert = find_program('convert')
zip = find_program('zip')
common_cppflags += '-I' + join_paths(meson.current_build_dir(), 'include')
#
# AIDL
#
IMainCallback_java = custom_target(
'IMainCallback.java',
output: 'IMainCallback.java',
input: join_paths(meson.current_source_dir(), 'src', 'IMainCallback.aidl'),
command: [
join_paths(meson.current_source_dir(), 'run-aidl.sh'),
android_aidl,
'@INPUT@',
'@OUTPUT@',
join_paths(meson.current_build_dir(), 'src'),
android_package_path,
],
)
IMain_java = custom_target(
'IMain.java',
output: 'IMain.java',
input: join_paths(meson.current_source_dir(), 'src', 'IMain.aidl'),
depends: IMainCallback_java,
command: [
join_paths(meson.current_source_dir(), 'run-aidl.sh'),
android_aidl,
'@INPUT@',
'@OUTPUT@',
join_paths(meson.current_build_dir(), 'src'),
android_package_path,
],
)
#
# Resources
#
android_icon = custom_target(
'Android icon',
output: 'icon.png',
input: '../mpd.svg',
command: [
rsvg_convert, '--width=48', '--height=48', '@INPUT@', '-o', '@OUTPUT@',
],
)
android_notification_icon = custom_target(
'Android notification icon',
output: 'notification_icon.png',
input: android_icon,
command: [
convert, '@INPUT@', '-colorspace', 'Gray', '-gamma', '2.2', '@OUTPUT@',
],
)
resources_apk = custom_target(
'resources.apk',
output: ['resources.apk', 'R.java'],
input: [
'res/layout/custom_notification_gb.xml',
'res/layout/log_item.xml',
'res/layout/settings.xml',
'res/values/strings.xml',
android_icon,
android_notification_icon,
],
command: [
join_paths(meson.current_source_dir(), 'make-resources-apk.sh'),
android_aapt,
join_paths(android_sdk_platform_dir, 'android.jar'),
android_package,
android_package_path,
'@OUTPUT0@',
],
)
#
# Compile Java
#
classes_jar = custom_target(
'classes.jar',
output: 'classes.jar',
input: [
'src/Bridge.java',
'src/Loader.java',
'src/Main.java',
'src/Receiver.java',
'src/Settings.java',
IMain_java,
IMainCallback_java,
resources_apk[1],
],
command: [
join_paths(meson.current_source_dir(), 'run-javac.sh'),
javac,
join_paths(android_sdk_platform_dir, 'android.jar'),
android_package_path,
zip,
'@OUTPUT@',
'@INPUT@',
],
)
classes_dex = custom_target(
'classes.dex',
output: 'classes.dex',
input: classes_jar,
command: [
android_dx,
'--dex', '--output', '@OUTPUT@',
'@INPUT@',
],
)
#!/bin/sh -e
AIDL=$1
SRC=$2
DST=$3
GENSRC=$4
JAVA_PKG_PATH=$5
mkdir -p "$GENSRC/$JAVA_PKG_PATH"
cp "$SRC" "$GENSRC/$JAVA_PKG_PATH/"
"$AIDL" -I"$GENSRC" -o"$GENSRC" "$GENSRC/$JAVA_PKG_PATH/`basename $SRC`"
exec cp "$GENSRC/$JAVA_PKG_PATH/`basename $DST`" "$DST"
#!/bin/sh -e
JAVAC=$1
CLASSPATH=$2
JAVA_PKG_PATH=$3
ZIP=$4
JARFILE=`realpath "$5"`
shift 5
D=`dirname "$JARFILE"`
GENSRC="$D/src"
GENCLASS="$D/classes"
GENINCLUDE="$D/include"
mkdir -p "$GENSRC/$JAVA_PKG_PATH"
"$JAVAC" -source 1.6 -target 1.6 -Xlint:-options \
-cp "$CLASSPATH" \
-h "$GENINCLUDE" \
-d "$GENCLASS" \
"$@"
cd "$GENCLASS"
zip -q -r "$JARFILE" .
#!/bin/sh -e
BIN=`dirname $0`
ROOT=`dirname "$BIN"`
export PKG_CONFIG_DIR=
export PKG_CONFIG_LIBDIR="${ROOT}/lib/pkgconfig:${ROOT}/share/pkgconfig"
exec /usr/bin/pkg-config "$@"
......@@ -53,7 +53,8 @@ If you already have a clone, update it:
You can do without :option:`--rebase`, but we recommend that you rebase your repository on the "master" repository all the time.
Configure with the options :option:`--enable-debug --enable-werror`. Enable as many plugins as possible, to be sure that you don't break any disabled code.
Configure with the option :option:`--werror`. Enable as many plugins
as possible, to be sure that you don't break any disabled code.
Don't mix several changes in one single patch. Create a separate patch for every change. Tools like :program:`stgit` help you with that. This way, we can review your patches more easily, and we can pick the patches we like most first.
......
install_man(['mpd.1', 'mpd.conf.5'])
sphinx = find_program('sphinx-build')
sphinx_output = custom_target(
'HTML documentation',
output: 'html',
input: [
'index.rst', 'user.rst', 'developer.rst',
'conf.py',
],
command: [sphinx, '-q', '-b', 'html', '-d', '@OUTDIR@/doctrees', meson.current_source_dir(), '@OUTPUT@'],
build_by_default: true,
install: true,
install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()),
)
xmlto = find_program('xmlto')
xmlto_output = custom_target(
'Protocol documentation',
output: 'protocol',
input: 'protocol.xml',
command: [
xmlto, '-o', '@OUTPUT@',
'--stringparam=chunker.output.encoding=utf-8',
'html',
'--stringparam=use.id.as.filename=1',
'@INPUT@',
],
build_by_default: true,
install: true,
install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()),
)
custom_target(
'upload',
input: [sphinx_output, xmlto_output],
output: 'upload',
build_always_stale: true,
command: [
'rsync', '-vpruz', '--delete', meson.current_source_dir(),
'www.musicpd.org:/var/www/mpd/doc/',
'--chmod=Dug+rwx,Do+rx,Fug+rw,Fo+r',
'--include=protocol', '--include=protocol/**',
'--include=html', '--include=html/**',
'--exclude=*',
],
)
......@@ -47,6 +47,8 @@ Download the source tarball from the `MPD home page <https://musicpd.org>`_ and
In any case, you need:
* a C++14 compiler (e.g. gcc 6.0 or clang 3.9)
* `Meson 0.47 <http://mesonbuild.com/>`__ and `Ninja
<https://ninja-build.org/>`__
* Boost 1.58
* pkg-config
......@@ -87,44 +89,54 @@ Now configure the source tree:
.. code-block:: none
./configure
meson . output/release --buildtype=debugpotimized -Db_ndebug=true
The :option:`--help` argument shows a list of compile-time options. When everything is ready and configured, compile:
The following command shows a list of compile-time options:
.. code-block:: none
make
meson configure output/release
When everything is ready and configured, compile:
.. code-block:: none
ninja -C output/release
And install:
.. code-block:: none
make install
ninja -C output/release install
Compiling for Windows
---------------------
Even though it does not "feel" like a Windows application, :program:`MPD` works well under Windows. Its build process follows the "Linux style" and may seem awkward for Windows people (who are not used to compiling their software, anyway).
Basically, there are three ways to compile :program:`MPD` for Windows:
* Build on Windows for Windows. All you need to do is described above already: configure and make.
For Windows users, this is kind of unusual, because few Windows users have a GNU toolchain and a UNIX shell installed.
Basically, there are two ways to compile :program:`MPD` for Windows:
* Build on Linux for Windows. This is described above already: configure and make. You need the :program:`mingw-w64` cross compiler. Pass :option:`--host=i686-w64-mingw32` (32 bit) or :option:`--host=x86_64-w64-mingw32` (64 bit) to configure.
* Build as described above: with :program:`meson` and
:program:`ninja`. To cross-compile from Linux, you need `a Meson
cross file <https://mesonbuild.com/Cross-compilation.html>`__.
This is somewhat natural for Linux users. Many distributions have mingw-w64 packages. The remaining difficulty here is installing all the external libraries. And :program:`MPD` usually needs many, making this method cumbersome for the casual user.
The remaining difficulty is installing all the external libraries.
And :program:`MPD` usually needs many, making this method cumbersome
for the casual user.
* Build on Linux for Windows using :program:`MPD`'s library build script.
This section is about the latter.
Just like with the native build, unpack the :program:`MPD` source tarball and change into the directory. Then, instead of ./configure, type:
Just like with the native build, unpack the :program:`MPD` source
tarball and change into the directory. Then, instead of
:program:`meson`, type:
.. code-block:: none
./win32/build.py --64
mkdir -p output/win64
cd output/win64
../../win32/build.py --64
This downloads various library sources, and then configures and builds :program:`MPD` (for x64; to build a 32 bit binary, pass :option:`--32`). The resulting EXE files is linked statically, i.e. it contains all the libraries already and you do not need carry DLLs around. It is large, but easy to use. If you wish to have a small mpd.exe with DLLs, you need to compile manually, without the :file:`build.py` script.
......@@ -138,12 +150,17 @@ You need:
* Android SDK
* Android NDK
Just like with the native build, unpack the :program:`MPD` source tarball and change into the directory. Then, instead of ./configure, type:
Just like with the native build, unpack the :program:`MPD` source
tarball and change into the directory. Then, instead of
:program:`meson`, type:
.. code-block:: none
./android/build.py SDK_PATH NDK_PATH ABI
make android/build/mpd-debug.apk
mkdir -p output/android
cd output/android
../../android/build.py SDK_PATH NDK_PATH ABI
meson configure -Dandroid_debug_keystore=$HOME/.android/debug.keystore
ninja android/apk/mpd-debug.apk
:envvar:`SDK_PATH` is the absolute path where you installed the Android SDK; :envvar:`NDK_PATH` is the Android NDK installation path; ABI is the Android ABI to be built, e.g. "armeabi-v7a".
......@@ -154,7 +171,10 @@ systemd socket activation
Using systemd, you can launch :program:`MPD` on demand when the first client attempts to connect.
:program:`MPD` comes with two systemd unit files: a "service" unit and a "socket" unit. These will only be installed when :program:`MPD` was configured with :option:`--with-systemdsystemunitdir=/lib/systemd/system`.
:program:`MPD` comes with two systemd unit files: a "service" unit and
a "socket" unit. These will be installed to the directory specified
with :option:`-Dsystemd_system_unit_dir=...`,
e.g. :file:`/lib/systemd/system`.
To enable socket activation, type:
......@@ -168,7 +188,11 @@ In this configuration, :program:`MPD` will ignore the :dfn:`bind_to_address` and
systemd user unit
-----------------
You can launch :program:`MPD` as a systemd user unit. The service file will only be installed when :program:`MPD` was configured with :option:`--with-systemduserunitdir=/usr/lib/systemd/user` or :option:`--with-systemduserunitdir=$HOME/.local/share/systemd/user`.
You can launch :program:`MPD` as a systemd user unit. These will be
installed to the directory specified with
:option:`-Dsystemd_user_unit_dir=...`,
e.g. :file:`/usr/lib/systemd/user` or
:file:`$HOME/.local/share/systemd/user`.
Once the user unit is installed, you can start and stop :program:`MPD` like any other service:
......@@ -529,7 +553,10 @@ The State File
The Sticker Database
~~~~~~~~~~~~~~~~~~~~
"Stickers" are pieces of information attached to songs. Some clients use them to store ratings and other volatile data. This feature requires :program:`SQLite`, compile-time configure option :option:`--enable-sqlite.`
"Stickers" are pieces of information attached to songs. Some clients
use them to store ratings and other volatile data. This feature
requires :program:`SQLite`, compile-time configure option
:option:`-Dsqlite`.
.. list-table::
:widths: 20 80
......@@ -579,7 +606,10 @@ Do not change these unless you know what you are doing.
Zeroconf
~~~~~~~~
If Zeroconf support (`Avahi <http://avahi.org/>`_ or Apple's Bonjour) was enabled at compile time with :option:`--with-zeroconf=...`, :program:`MPD` can announce its presence on the network. The following settings control this feature:
If Zeroconf support (`Avahi <http://avahi.org/>`_ or Apple's Bonjour)
was enabled at compile time with :option:`-Dzeroconf=...`,
:program:`MPD` can announce its presence on the network. The following
settings control this feature:
.. list-table::
:widths: 20 80
......
# ============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
# ============================================================================
#
# SYNOPSIS
#
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# For every FLAG1, FLAG2 it is checked whether the compiler works with the
# flag. If it does, the flag is added FLAGS-VARIABLE
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. During the check the flag is always added to the
# current language's flags.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: This macro depends on the AX_APPEND_FLAG and
# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
# AX_APPEND_LINK_FLAGS.
#
# LICENSE
#
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 6
AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
for flag in $1; do
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
done
])dnl AX_APPEND_COMPILE_FLAGS
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
#
# DESCRIPTION
#
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
# added in between.
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
# FLAG.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 7
AC_DEFUN([AX_APPEND_FLAG],
[dnl
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
AS_VAR_SET_IF(FLAGS,[
AS_CASE([" AS_VAR_GET(FLAGS) "],
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
[
AS_VAR_APPEND(FLAGS,[" $1"])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
],
[
AS_VAR_SET(FLAGS,[$1])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
AS_VAR_POPDEF([FLAGS])dnl
])dnl AX_APPEND_FLAG
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# For every FLAG1, FLAG2 it is checked whether the linker works with the
# flag. If it does, the flag is added FLAGS-VARIABLE
#
# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
# used. During the check the flag is always added to the linker's flags.
#
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
# when the check is done. The check is thus made with the flags: "LDFLAGS
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
# issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
#
# LICENSE
#
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 6
AC_DEFUN([AX_APPEND_LINK_FLAGS],
[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
for flag in $1; do
AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4])
done
])dnl AX_APPEND_LINK_FLAGS
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 5
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the linker or gives an error.
# (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
# when the check is done. The check is thus made with the flags: "LDFLAGS
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
# issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_LINK_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 5
AC_DEFUN([AX_CHECK_LINK_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
ax_check_save_flags=$LDFLAGS
LDFLAGS="$LDFLAGS $4 $1"
AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
LDFLAGS=$ax_check_save_flags])
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_LINK_FLAGS
# =============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html
# =============================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the C++14
# standard; if necessary, add switches to CXX and CXXCPP to enable
# support.
#
# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
# macro with the version set to C++14. The two optional arguments are
# forwarded literally as the second and third argument respectively.
# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
# more information. If you want to use this macro, you also need to
# download the ax_cxx_compile_stdcxx.m4 file.
#
# LICENSE
#
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 5
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])])
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_REQUIRE_DEFINED(MACRO)
#
# DESCRIPTION
#
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
# been defined and thus are available for use. This avoids random issues
# where a macro isn't expanded. Instead the configure script emits a
# non-fatal:
#
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
#
# It's like AC_REQUIRE except it doesn't expand the required macro.
#
# Here's an example:
#
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
#
# LICENSE
#
# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 2
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
])dnl AX_REQUIRE_DEFINED
# libgcrypt.m4 - Autoconf macros to detect libgcrypt
# Copyright (C) 2002, 2003, 2004, 2011, 2014 g10 Code GmbH
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Last-changed: 2014-10-02
dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
dnl with the API version to also check the API compatibility. Example:
dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed
dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
dnl this features allows to prevent build against newer versions of libgcrypt
dnl with a changed API.
dnl
dnl If a prefix option is not used, the config script is first
dnl searched in $SYSROOT/bin and then along $PATH. If the used
dnl config script does not match the host specification the script
dnl is added to the gpg_config_script_warn variable.
dnl
AC_DEFUN([AM_PATH_LIBGCRYPT],
[ AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_WITH(libgcrypt-prefix,
AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
[prefix where LIBGCRYPT is installed (optional)]),
libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
if test x"${LIBGCRYPT_CONFIG}" = x ; then
if test x"${libgcrypt_config_prefix}" != x ; then
LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config"
else
case "${SYSROOT}" in
/*)
if test -x "${SYSROOT}/bin/libgcrypt-config" ; then
LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config"
fi
;;
'')
;;
*)
AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
;;
esac
fi
fi
AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
tmp=ifelse([$1], ,1:1.2.0,$1)
if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
else
req_libgcrypt_api=0
min_libgcrypt_version="$tmp"
fi
AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
ok=no
if test "$LIBGCRYPT_CONFIG" != "no" ; then
req_major=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
major=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
micro=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
ok=yes
else
if test "$major" -eq "$req_major"; then
if test "$minor" -gt "$req_minor"; then
ok=yes
else
if test "$minor" -eq "$req_minor"; then
if test "$micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
fi
if test $ok = yes; then
AC_MSG_RESULT([yes ($libgcrypt_config_version)])
else
AC_MSG_RESULT(no)
fi
if test $ok = yes; then
# If we have a recent libgcrypt, we should also check that the
# API is compatible
if test "$req_libgcrypt_api" -gt 0 ; then
tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
if test "$tmp" -gt 0 ; then
AC_MSG_CHECKING([LIBGCRYPT API version])
if test "$req_libgcrypt_api" -eq "$tmp" ; then
AC_MSG_RESULT([okay])
else
ok=no
AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp])
fi
fi
fi
fi
if test $ok = yes; then
LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
ifelse([$2], , :, [$2])
libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
if test x"$libgcrypt_config_host" != xnone ; then
if test x"$libgcrypt_config_host" != x"$host" ; then
AC_MSG_WARN([[
***
*** The config script $LIBGCRYPT_CONFIG was
*** built for $libgcrypt_config_host and thus may not match the
*** used host $host.
*** You may want to use the configure option --with-libgcrypt-prefix
*** to specify a matching config script or use \$SYSROOT.
***]])
gpg_config_script_warn="$gpg_config_script_warn libgcrypt"
fi
fi
else
LIBGCRYPT_CFLAGS=""
LIBGCRYPT_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(LIBGCRYPT_CFLAGS)
AC_SUBST(LIBGCRYPT_LIBS)
])
dnl
dnl Usage:
dnl AC_CHECK_LIBWRAP([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl
AC_DEFUN([AC_CHECK_LIBWRAP],[
AC_CHECK_HEADERS([tcpd.h],
AC_CHECK_LIB([wrap], [request_init],
[LIBWRAP_CFLAGS=""
LIBWRAP_LDFLAGS="-lwrap"
$1],
$2),
$2)
])
dnl Parameters: varname1, description
AC_DEFUN([MPD_AUTO_ENABLED], [
if test x$[]enable_$1 = xauto; then
AC_MSG_NOTICE([auto-detected $2])
enable_$1=yes
fi
])
dnl Parameters: varname1, description, errmsg
AC_DEFUN([MPD_AUTO_DISABLED], [
if test x$[]enable_$1 = xauto; then
AC_MSG_WARN([$3 -- disabling $2])
enable_$1=no
elif test x$[]enable_$1 = xyes; then
AC_MSG_ERROR([$2: $3])
fi
])
dnl Check whether a prerequisite for a feature was found. This is
dnl very similar to MPD_AUTO_RESULT, but does not finalize the
dnl detection; it assumes that more checks will follow.
AC_DEFUN([MPD_AUTO_PRE], [
if test x$[]enable_$1 != xno && test x$[]found_$1 = xno; then
MPD_AUTO_DISABLED([$1], [$2], [$3])
fi
])
dnl Evaluate a check's result. Abort if the feature was requested
dnl explicitly but is unavailable.
dnl
dnl Parameters: varname1, description, errmsg
AC_DEFUN([MPD_AUTO_RESULT], [
if test x$[]enable_$1 = xno; then
found_$1=no
fi
if test x$[]found_$1 = xyes; then
MPD_AUTO_ENABLED([$1], [$2])
else
MPD_AUTO_DISABLED([$1], [$2], [$3])
fi
])
dnl Invoke a check if its configuration is "yes" or "auto" and call
dnl MPD_AUTO_RESULT.
dnl
dnl Parameters: varname1, description, errmsg, check
AC_DEFUN([MPD_AUTO], [
if test x$[]enable_$1 != xno; then
$4
fi
MPD_AUTO_RESULT([$1], [$2], [$3])
])
dnl Wrapper for MPD_AUTO and PKG_CHECK_MODULES.
dnl
dnl Parameters: varname1, varname2, pkgname, description, errmsg
AC_DEFUN([MPD_AUTO_PKG], [
MPD_AUTO([$1], [$4], [$5],
[PKG_CHECK_MODULES([$2], [$3],
[found_$1=yes],
[found_$1=no])])
])
dnl Check with pkg-config first, fall back to AC_CHECK_LIB.
dnl
dnl Parameters: varname1, varname2, pkgname, libname, symname, libs, cflags, description, errmsg
AC_DEFUN([MPD_AUTO_PKG_LIB], [
MPD_AUTO([$1], [$8], [$9],
[PKG_CHECK_MODULES([$2], [$3],
[found_$1=yes],
AC_CHECK_LIB($4, $5,
[found_$1=yes $2_LIBS='$6' $2_CFLAGS='$7'],
[found_$1=no],
[$6]))])
])
dnl Wrapper for AC_CHECK_LIB.
dnl
dnl Parameters: varname1, varname2, libname, symname, libs, cflags, description, errmsg
AC_DEFUN([MPD_AUTO_LIB], [
AC_SUBST([$2_LIBS], [])
AC_SUBST([$2_CFLAGS], [])
MPD_AUTO([$1], [$7], [$8],
[AC_CHECK_LIB($3, $4,
[found_$1=yes $2_LIBS='$5' $2_CFLAGS='$6'],
[found_$1=no],
[$5])])
])
dnl Wrapper for AC_CHECK_HEADER.
dnl
dnl Parameters: varname1, varname2, header, libs, cflags, description, errmsg
AC_DEFUN([MPD_AUTO_HEADER], [
AC_SUBST([$2_LIBS], [])
AC_SUBST([$2_CFLAGS], [])
MPD_AUTO([$1], [$6], [$7],
[AC_CHECK_HEADER([$3],
[found_$1=yes $2_LIBS='$4' $2_CFLAGS='$5'],
[found_$1=no])])
])
dnl Convert the given string into a string for the "default value" in
dnl the help text. If the string is a literal, then it is returned
dnl as-is; if it contains a variable reference, just "auto" is
dnl emitted.
dnl
dnl Parameters: varname1
AC_DEFUN([MPD_FORMAT_DEFAULT],
[ifelse([$1], [], [auto],
index([$1], [$]), [-1], [$1],
[auto])])
dnl Wrapper for AC_ARG_ENABLE, AC_DEFINE and AM_CONDITIONAL
dnl
dnl Parameters: varname1, varname2, description, default, check
AC_DEFUN([MPD_ARG_ENABLE], [
AC_ARG_ENABLE(translit([$1], [_], [-]),
AS_HELP_STRING([--enable-]translit([$1], [_], [-]),
[enable $3 (default: ]MPD_FORMAT_DEFAULT([$4])[)]),,
[enable_$1=]ifelse([$4], [], [auto], [$4]))
$5
MPD_DEFINE_CONDITIONAL(enable_$1, ENABLE_$2, [$3])
])
dnl Wrapper for MPD_ARG_ENABLE and MPD_AUTO
dnl
dnl Parameters: varname1, varname2, description, errmsg, default, check
AC_DEFUN([MPD_ENABLE_AUTO], [
MPD_ARG_ENABLE([$1], [$2], [$3], [$5], [
MPD_AUTO([$1], [$3], [$4], [$6])
])
])
dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_PKG
dnl
dnl Parameters: varname1, varname2, pkg, description, errmsg, default, pre
AC_DEFUN([MPD_ENABLE_AUTO_PKG], [
MPD_ARG_ENABLE([$1], [$2], [$4], [$6], [
$7
MPD_AUTO_PKG($1, $2, $3, $4, $5)
])
])
dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_PKG_LIB
dnl
dnl Parameters: varname1, varname2, pkg, libname, symname, libs, cflags, description, errmsg, default, pre
AC_DEFUN([MPD_ENABLE_AUTO_PKG_LIB], [
MPD_ARG_ENABLE([$1], [$2], [$8], [$10], [
$11
MPD_AUTO_PKG_LIB($1, $2, $3, $4, $5, $6, $7, $8, $9)
])
])
dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_LIB
dnl
dnl Parameters: varname1, varname2, libname, symname, libs, cflags, description, errmsg, default, pre
AC_DEFUN([MPD_ENABLE_AUTO_LIB], [
MPD_ARG_ENABLE([$1], [$2], [$7], [$9], [
$10
MPD_AUTO_LIB($1, $2, $3, $4, $5, $6, $7, $8)
])
])
dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_HEADER
dnl
dnl Parameters: varname1, varname2, header, libs, cflags, description, errmsg, default, pre
AC_DEFUN([MPD_ENABLE_AUTO_HEADER], [
MPD_ARG_ENABLE([$1], [$2], [$6], [$8], [
$9
MPD_AUTO_HEADER($1, $2, $3, $4, $5, $6, $7)
])
])
dnl Wrapper for MPD_ENABLE_AUTO_PKG and MPD_DEPENDS
dnl
dnl Parameters: varname1, varname2, pkg, description, errmsg, default, dep_variable, dep_errmsg, pre
AC_DEFUN([MPD_ENABLE_AUTO_PKG_DEPENDS], [
MPD_ENABLE_AUTO_PKG([$1], [$2], [$3], [$4], [$5], [$6], [
$9
MPD_DEPENDS([enable_$1], [$7], [$4], [$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])
dnl Declare a dependency of one feature on another. If the depending
dnl feature is disabled, the former must be disabled as well. If the
dnl former was explicitly enabled, abort with an error message.
dnl
dnl Parameters: varname1, varname2 (=dependency), description, errmsg
AC_DEFUN([MPD_DEPENDS], [
if test x$$2 = xno; then
if test x$$1 = xauto; then
AC_MSG_WARN([$4: disabling $3])
$1=no
elif test x$$1 = xyes; then
AC_MSG_ERROR([$3: $4])
fi
fi
])
dnl MPD_OPTIONAL_FUNC(name, func, macro)
dnl
dnl Allow the user to enable or disable the use of a function. If the
dnl option is not specified, the function is auto-detected.
AC_DEFUN([MPD_OPTIONAL_FUNC], [
AC_ARG_ENABLE([$1],
AS_HELP_STRING([--enable-$1],
[use the function "$1" (default: auto)]),
[test x$[]enable_$1 = xyes && AC_DEFINE([$3], 1, [Define to use $1])],
[AC_CHECK_FUNC([$2],
[AC_DEFINE([$3], 1, [Define to use $1])],)])
])
dnl MPD_OPTIONAL_FUNC_NODEF(name, func)
dnl
dnl Allow the user to enable or disable the use of a function.
dnl Works similar to MPD_OPTIONAL_FUNC, however MPD_OPTIONAL_FUNC_NODEF
dnl does not invoke AC_DEFINE when function is enabled. Shell variable
dnl enable_$name is set to "yes" instead.
AC_DEFUN([MPD_OPTIONAL_FUNC_NODEF], [
AC_ARG_ENABLE([$1],
AS_HELP_STRING([--enable-$1],
[use the function "$1" (default: auto)]),,
[AC_CHECK_FUNC([$2], [enable_$1=yes],)])
])
dnl Run code with the specified CFLAGS/CXXFLAGS and LIBS appended.
dnl Restores the old values afterwards.
dnl
dnl Parameters: cflags, libs, code
AC_DEFUN([MPD_WITH_FLAGS], [
ac_save_CFLAGS="$[]CFLAGS"
ac_save_CXXFLAGS="$[]CXXFLAGS"
ac_save_LIBS="$[]LIBS"
CFLAGS="$[]CFLAGS $1"
CXXFLAGS="$[]CXXFLAGS $1"
LIBS="$[]LIBS $2"
$3
CFLAGS="$[]ac_save_CFLAGS"
CXXFLAGS="$[]ac_save_CXXFLAGS"
LIBS="$[]ac_save_LIBS"
])
dnl Run code with the specified library's CFLAGS/CXXFLAGS and LIBS
dnl appended. Restores the old values afterwards.
dnl
dnl Parameters: libname, code
AC_DEFUN([MPD_WITH_LIBRARY],
[MPD_WITH_FLAGS([$[]$1_CFLAGS], [$[]$1_LIBS], [$2])])
AC_DEFUN([results], [
printf '('
if test x$[]enable_$1 = xyes; then
printf '+'
else
printf '-'
fi
printf '%s) ' "$2"
])
# Check if "struct ucred" is available.
#
# Author: Max Kellermann <max.kellermann@gmail.com>
AC_DEFUN([STRUCT_UCRED],[
AC_MSG_CHECKING([for struct ucred])
AC_CACHE_VAL(mpd_cv_have_struct_ucred, [
AC_TRY_COMPILE([#include <sys/socket.h>],
[struct ucred cred;],
mpd_cv_have_struct_ucred=yes,
mpd_cv_have_struct_ucred=no)
])
AC_MSG_RESULT($mpd_cv_have_struct_ucred)
if test x$mpd_cv_have_struct_ucred = xyes; then
AC_DEFINE(HAVE_STRUCT_UCRED, 1, [Define if struct ucred is present from sys/socket.h])
fi
])
This diff is collapsed. Click to expand it.
option('documentation', type: 'boolean', value: false, description: 'Build documentation')
option('test', type: 'boolean', value: false, description: 'Build the unit tests and debug programs')
option('syslog', type: 'feature', description: 'syslog support')
option('inotify', type: 'boolean', value: true, description: 'inotify support (for automatic database update)')
option('daemon', type: 'boolean', value: true, description: 'enable daemonization')
option('systemd', type: 'feature', description: 'systemd support')
option('systemd_system_unit_dir', type: 'string', description: 'systemd system service directory')
option('systemd_user_unit_dir', type: 'string', description: 'systemd user service directory')
#
# Android
#
option('android_sdk', type: 'string', description: 'The path where Android SDK is installed')
option('android_ndk', type: 'string', description: 'The path where Android NDK is installed')
option('android_abi', type: 'string', value: 'armeabi-v7a', description: 'The Android ABI to be built')
option('android_strip', type: 'string', value: 'strip', description: 'The "strip" tool from the NDK')
option('android_debug_keystore', type: 'string', description: 'The keystore file used to sign debug APK files')
option('android_keystore', type: 'string', description: 'The keystore file used to sign APK files')
option('android_keyalias', type: 'string', description: 'The key alias used to sign APK files')
option('android_keypass', type: 'string', description: 'The password of the keystore used to sign APK files')
#
# System call support
#
option('epoll', type: 'boolean', value: true, description: 'Use epoll on Linux')
option('eventfd', type: 'boolean', value: true, description: 'Use eventfd() on Linux')
option('signalfd', type: 'boolean', value: true, description: 'Use signalfd() on Linux')
#
# Network support
#
option('tcp', type: 'boolean', value: true, description: 'Support for clients connecting via TCP')
option('ipv6', type: 'feature', description: 'Support for IPv6')
option('local_socket', type: 'boolean', value: true, description: 'Support for clients connecting via local sockets')
#
# Audio formats
#
option('dsd', type: 'boolean', value: true, description: 'Support the DSD audio format')
#
# Database plugins
#
option('database', type: 'boolean', value: true, description: 'enable support for the music database')
option('upnp', type: 'feature', description: 'UPnP client support')
option('libmpdclient', type: 'feature', description: 'libmpdclient support (for the proxy database plugin)')
#
# Neighbor plugins
#
option('neighbor', type: 'boolean', value: true, description: 'enable support for neighbor discovery')
#
# Storage plugins
#
option('udisks', type: 'feature', description: 'Support for removable media using udisks2')
option('webdav', type: 'feature', description: 'WebDAV support using CURL and Expat')
#
# Playlist plugins
#
option('cue', type: 'boolean', value: true, description: 'CUE sheet support')
#
# Input plugins
#
option('cdio_paranoia', type: 'feature', description: 'libcdio_paranoia input plugin')
option('curl', type: 'feature', description: 'HTTP client using CURL')
option('mms', type: 'feature', description: 'MMS protocol support using libmms')
option('nfs', type: 'feature', description: 'NFS protocol support using libnfs')
option('smbclient', type: 'feature', description: 'SMB support using libsmbclient')
#
# Commercial services
#
option('qobuz', type: 'feature', description: 'Qobuz client')
option('soundcloud', type: 'feature', description: 'SoundCloud client')
option('tidal', type: 'feature', description: 'Tidal client')
#
# Archive plugins
#
option('bzip2', type: 'feature', description: 'bzip2 support using libbz2')
option('iso9660', type: 'feature', description: 'ISO9660 support using libiso9660')
option('zzip', type: 'feature', description: 'ZIP support using zziplib')
#
# Tag plugins
#
option('id3tag', type: 'feature', description: 'ID3 support using libid3tag')
#
# Decoder plugins
#
option('adplug', type: 'feature', description: 'AdPlug decoder plugin')
option('audiofile', type: 'feature', description: 'libaudiofile decoder plugin')
option('faad', type: 'feature', description: 'AAC decoder using libfaad')
option('ffmpeg', type: 'feature', description: 'FFmpeg codec support')
option('flac', type: 'feature', description: 'FLAC decoder plugin')
option('fluidsynth', type: 'feature', description: 'fluidsynth MIDI decoder plugin')
option('gme', type: 'feature', description: 'Game Music Emulator decoder plugin')
option('mad', type: 'feature', description: 'MP3 decoder using libmad')
option('mikmod', type: 'feature', description: 'MikMod decoder plugin')
option('modplug', type: 'feature', description: 'Modplug decoder plugin')
option('mpcdec', type: 'feature', description: 'Musepack decoder plugin')
option('mpg123', type: 'feature', description: 'MP3 decoder using libmpg123')
option('opus', type: 'feature', description: 'Opus decoder plugin')
option('sidplay', type: 'feature', description: 'C64 SID support via libsidplayfp or libsidplay2')
option('sndfile', type: 'feature', description: 'libsndfile decoder plugin')
option('vorbis', type: 'feature', description: 'Vorbis decoder plugin')
option('wavpack', type: 'feature', description: 'WavPack decoder plugin')
option('wildmidi', type: 'feature', description: 'WildMidi decoder plugin')
#
# Decoder plugins
#
option('vorbisenc', type: 'feature', description: 'Vorbis encoder plugin')
option('lame', type: 'feature', description: 'LAME MP3 encoder plugin')
option('twolame', type: 'feature', description: 'TwoLAME MP2 encoder plugin')
option('shine', type: 'feature', description: 'shine MP3 encoder plugin')
option('wave_encoder', type: 'boolean', value: true, description: 'PCM wave encoder encoder plugin')
#
# Filter plugins
#
option('libsamplerate', type: 'feature', description: 'libsamplerate resampler')
option('soxr', type: 'feature', description: 'libsoxr resampler')
#
# Output plugins
#
option('alsa', type: 'feature', description: 'ALSA support')
option('ao', type: 'feature', description: 'libao output plugin')
option('fifo', type: 'boolean', value: true, description: 'FIFO output plugin')
option('httpd', type: 'boolean', value: true, description: 'HTTP streaming output plugin')
option('jack', type: 'feature', description: 'JACK output plugin')
option('openal', type: 'feature', description: 'OpenAL output plugin')
option('oss', type: 'feature', description: 'Open Sound System support')
option('pipe', type: 'boolean', value: true, description: 'Pipe output plugin')
option('pulse', type: 'feature', description: 'PulseAudio support')
option('recorder', type: 'boolean', value: true, description: 'Recorder output plugin')
option('roar', type: 'feature', description: 'Roar output plugin')
option('shout', type: 'feature', description: 'Shoutcast streaming support using libshout')
option('sndio', type: 'feature', description: 'sndio output plugin')
option('solaris_output', type: 'feature', description: 'Solaris /dev/audio support')
#
# Misc libraries
#
option('dbus', type: 'feature', description: 'D-Bus support')
option('expat', type: 'feature', description: 'Expat XML support')
option('icu', type: 'feature', description: 'Use libicu for Unicode')
option('iconv', type: 'feature', description: 'Use iconv() for character set conversion')
option('libwrap', type: 'feature', description: 'libwrap support')
option('sqlite', type: 'feature', description: 'SQLite database support (for stickers)')
option('yajl', type: 'feature', description: 'libyajl for YAML support')
option('zlib', type: 'feature', description: 'zlib support (for database compression)')
option('zeroconf', type: 'combo',
choices: ['auto', 'avahi', 'bonjour', 'disabled'],
value: 'auto',
description: 'Zeroconf support')
def concatenate_cmdline_variables(src, names):
"""Find duplicate variable declarations on the given source list, and
concatenate the values of those in the 'names' list."""
# the result list being constructed
dest = []
# a map of variable name to destination list index
positions = {}
for item in src:
i = item.find('=')
if i > 0:
# it's a variable
name = item[:i]
if name in names:
# it's a known variable
if name in positions:
# already specified: concatenate instead of
# appending it
dest[positions[name]] += ' ' + item[i + 1:]
continue
else:
# not yet seen: append it and remember the list
# index
positions[name] = len(dest)
dest.append(item)
return dest
......@@ -40,6 +40,7 @@ c = '%s'
cpp = '%s'
ar = '%s'
strip = '%s'
pkgconfig = '%s'
%s
[properties]
......@@ -60,6 +61,7 @@ cpu_family = '%s'
cpu = '%s'
endian = '%s'
""" % (toolchain.cc, toolchain.cxx, toolchain.ar, toolchain.strip,
toolchain.pkg_config,
windres,
toolchain.install_prefix,
repr((toolchain.cppflags + ' ' + toolchain.cflags).split()),
......
......@@ -19,6 +19,7 @@
#include "config.h"
#include "CommandLine.hxx"
#include "GitVersion.hxx"
#include "ls.hxx"
#include "LogInit.hxx"
#include "Log.hxx"
......@@ -107,11 +108,7 @@ static constexpr Domain cmdline_domain("cmdline");
gcc_noreturn
static void version(void)
{
printf("Music Player Daemon " VERSION
#ifdef GIT_COMMIT
" (" GIT_COMMIT ")"
#endif
"\n"
printf("Music Player Daemon " VERSION " (%s)\n"
"\n"
"Copyright (C) 2003-2007 Warren Dukes <warren.dukes@gmail.com>\n"
"Copyright 2008-2017 Max Kellermann <max.kellermann@gmail.com>\n"
......@@ -120,7 +117,8 @@ static void version(void)
#ifdef ENABLE_DATABASE
"\n"
"Database plugins:\n");
"Database plugins:\n",
GIT_VERSION);
for (auto i = database_plugins; *i != nullptr; ++i)
printf(" %s", (*i)->name);
......
/*
* Copyright 2003-2017 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "GitVersion.hxx"
char GIT_VERSION[] = "@VCS_TAG@";
/*
* Copyright 2003-2017 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_GIT_VERSION_HXX
#define MPD_GIT_VERSION_HXX
extern char GIT_VERSION[];
#endif
archive_api = static_library(
'archive_api',
'ArchiveDomain.cxx',
'ArchiveLookup.cxx',
'ArchiveList.cxx',
include_directories: inc,
)
archive_api_dep = declare_dependency(
link_with: archive_api,
)
subdir('plugins')
conf.set('ENABLE_ARCHIVE', found_archive_plugin)
if not found_archive_plugin
archive_glue_dep = dependency('', required: false)
subdir_done()
endif
archive_glue = static_library(
'archive_glue',
'ArchivePlugin.cxx',
'../input/plugins/ArchiveInputPlugin.cxx',
include_directories: inc,
)
archive_glue_dep = declare_dependency(
link_with: archive_glue,
dependencies: [
archive_plugins_dep,
],
)
archive_plugins_sources = []
found_archive_plugin = false
libiso9660_dep = dependency('libiso9660', required: get_option('iso9660'))
conf.set('ENABLE_ISO9660', libiso9660_dep.found())
if libiso9660_dep.found()
archive_plugins_sources += 'Iso9660ArchivePlugin.cxx'
found_archive_plugin = true
endif
libbz2_dep = c_compiler.find_library('bz2', required: get_option('bzip2'))
conf.set('ENABLE_BZ2', libbz2_dep.found())
if libbz2_dep.found()
archive_plugins_sources += 'Bzip2ArchivePlugin.cxx'
found_archive_plugin = true
endif
libzzip_dep = dependency('zziplib', version: '>= 0.13', required: get_option('zzip'))
conf.set('ENABLE_ZZIP', libzzip_dep.found())
if libzzip_dep.found()
archive_plugins_sources += 'ZzipArchivePlugin.cxx'
found_archive_plugin = true
endif
archive_plugins = static_library(
'archive_plugins',
archive_plugins_sources,
include_directories: inc,
dependencies: [
libbz2_dep,
libiso9660_dep,
libzzip_dep,
],
)
archive_plugins_dep = declare_dependency(
link_with: archive_plugins,
dependencies: [
archive_api_dep,
input_glue_dep,
],
)
config = static_library(
'fs',
'Path.cxx',
'Check.cxx',
'Data.cxx',
'Block.cxx',
'Param.cxx',
'Parser.cxx',
'File.cxx',
'Migrate.cxx',
'Templates.cxx',
'Domain.cxx',
'Net.cxx',
include_directories: inc,
)
config_dep = declare_dependency(
link_with: config,
dependencies: [
fs_dep,
],
)
db_api = static_library(
'db_api',
'DatabaseLock.cxx',
'Selection.cxx',
include_directories: inc,
)
db_api_dep = declare_dependency(
link_with: db_api,
)
subdir('plugins')
db_glue_sources = [
'Count.cxx',
'update/UpdateDomain.cxx',
'update/Config.cxx',
'update/Service.cxx',
'update/Queue.cxx',
'update/UpdateIO.cxx',
'update/Editor.cxx',
'update/Walk.cxx',
'update/UpdateSong.cxx',
'update/Container.cxx',
'update/Remove.cxx',
'update/ExcludeList.cxx',
'DatabaseGlue.cxx',
'Configured.cxx',
'DatabaseSong.cxx',
'DatabasePrint.cxx',
'DatabaseQueue.cxx',
'DatabasePlaylist.cxx',
]
if enable_inotify
db_glue_sources += [
'update/InotifyDomain.cxx',
'update/InotifySource.cxx',
'update/InotifyQueue.cxx',
'update/InotifyUpdate.cxx',
]
endif
db_glue = static_library(
'db_glue',
db_glue_sources,
include_directories: inc,
)
db_glue_dep = declare_dependency(
link_with: db_glue,
dependencies: [
db_plugins_dep,
],
)
db_plugins_sources = [
'../../PlaylistDatabase.cxx',
'../Registry.cxx',
'../Helpers.cxx',
'../VHelper.cxx',
'../UniqueTags.cxx',
'simple/DatabaseSave.cxx',
'simple/DirectorySave.cxx',
'simple/Directory.cxx',
'simple/Song.cxx',
'simple/SongSort.cxx',
'simple/Mount.cxx',
'simple/SimpleDatabasePlugin.cxx',
]
if upnp_dep.found()
db_plugins_sources += [
'upnp/UpnpDatabasePlugin.cxx',
'upnp/Tags.cxx',
'upnp/ContentDirectoryService.cxx',
'upnp/Directory.cxx',
'upnp/Object.cxx',
]
endif
libmpdclient_dep = dependency('libmpdclient', version: '>= 2.9', required: get_option('libmpdclient'))
conf.set('ENABLE_LIBMPDCLIENT', libmpdclient_dep.found())
if libmpdclient_dep.found()
db_plugins_sources += 'ProxyDatabasePlugin.cxx'
endif
db_plugins = static_library(
'db_plugins',
db_plugins_sources,
include_directories: inc,
dependencies: [
upnp_dep,
libmpdclient_dep,
],
)
db_plugins_dep = declare_dependency(
link_with: db_plugins,
dependencies: [
db_api_dep,
storage_api_dep,
config_dep,
],
)
decoder_api = static_library(
'decoder_api',
'DecoderAPI.cxx',
'Reader.cxx',
'DecoderBuffer.cxx',
'DecoderPlugin.cxx',
include_directories: inc,
)
decoder_api_dep = declare_dependency(
link_with: decoder_api,
dependencies: [
tag_dep,
config_dep,
input_api_dep,
],
)
subdir('plugins')
decoder_glue = static_library(
'decoder_glue',
'DecoderList.cxx',
include_directories: inc,
)
decoder_glue_dep = declare_dependency(
link_with: decoder_glue,
dependencies: [
decoder_plugins_dep,
],
)
decoder_plugins_sources = [
'PcmDecoderPlugin.cxx',
]
if get_option('dsd')
decoder_plugins_sources += [
'HybridDsdDecoderPlugin.cxx',
'DsdiffDecoderPlugin.cxx',
'DsfDecoderPlugin.cxx',
'DsdLib.cxx',
]
endif
if ffmpeg_dep.found()
decoder_plugins_sources += [
'FfmpegIo.cxx',
'FfmpegMetaData.cxx',
'FfmpegDecoderPlugin.cxx',
]
endif
adplug_dep = dependency('adplug', required: get_option('adplug'))
conf.set('ENABLE_ADPLUG', adplug_dep.found())
if adplug_dep.found()
decoder_plugins_sources += 'AdPlugDecoderPlugin.cxx'
endif
conf.set('ENABLE_FLAC', flac_dep.found())
if flac_dep.found()
decoder_plugins_sources += [
'FlacDecoderPlugin.cxx',
'FlacInput.cxx',
'FlacPcm.cxx',
'FlacDomain.cxx',
'FlacCommon.cxx',
]
endif
conf.set('ENABLE_VORBIS_DECODER', libvorbis_dep.found())
if libvorbis_dep.found()
decoder_plugins_sources += [
'VorbisDecoderPlugin.cxx',
'VorbisDomain.cxx',
]
endif
conf.set('ENABLE_OPUS', libopus_dep.found())
if libopus_dep.found()
decoder_plugins_sources += [
'OpusDecoderPlugin.cxx',
'OpusDomain.cxx',
'OpusHead.cxx',
'OpusTags.cxx',
]
endif
if ogg_dep.found()
decoder_plugins_sources += 'OggDecoder.cxx'
endif
if xiph_dep.found()
decoder_plugins_sources += 'OggCodec.cxx'
endif
fluidsynth_dep = dependency('fluidsynth', version: '>= 1.1', required: get_option('fluidsynth'))
conf.set('ENABLE_FLUIDSYNTH', fluidsynth_dep.found())
if fluidsynth_dep.found()
decoder_plugins_sources += 'FluidsynthDecoderPlugin.cxx'
endif
libaudiofile_dep = dependency('audiofile', version: '>= 0.3', required: get_option('audiofile'))
conf.set('ENABLE_AUDIOFILE', libaudiofile_dep.found())
if libaudiofile_dep.found()
decoder_plugins_sources += 'AudiofileDecoderPlugin.cxx'
endif
libfaad_dep = c_compiler.find_library('faad', required: get_option('faad'))
conf.set('ENABLE_FAAD', libfaad_dep.found())
if libfaad_dep.found()
decoder_plugins_sources += 'FaadDecoderPlugin.cxx'
endif
libgme_dep = c_compiler.find_library('gme', required: get_option('gme'))
conf.set('ENABLE_GME', libgme_dep.found())
if libgme_dep.found()
decoder_plugins_sources += 'GmeDecoderPlugin.cxx'
endif
libmad_dep = c_compiler.find_library('mad', required: get_option('mad'))
conf.set('ENABLE_MAD', libmad_dep.found())
if libmad_dep.found()
decoder_plugins_sources += 'MadDecoderPlugin.cxx'
endif
libmikmod_dep = dependency('libmikmod', version: '>= 3.2', required: get_option('mikmod'))
conf.set('ENABLE_LIBMIKMOD', libmikmod_dep.found())
if libmikmod_dep.found()
decoder_plugins_sources += 'MikmodDecoderPlugin.cxx'
endif
libmodplug_dep = dependency('libmodplug', required: get_option('modplug'))
conf.set('ENABLE_MODPLUG', libmodplug_dep.found())
if libmodplug_dep.found()
decoder_plugins_sources += 'ModplugDecoderPlugin.cxx'
endif
libmpcdec_dep = c_compiler.find_library('mpcdec', required: get_option('mpcdec'))
conf.set('ENABLE_MPCDEC', libmpcdec_dep.found())
if libmpcdec_dep.found()
decoder_plugins_sources += 'MpcdecDecoderPlugin.cxx'
endif
libmpg123_dep = dependency('libmpg123', required: get_option('mpg123'))
conf.set('ENABLE_MPG123', libmpg123_dep.found())
if libmpg123_dep.found()
decoder_plugins_sources += 'Mpg123DecoderPlugin.cxx'
endif
libsndfile_dep = dependency('sndfile', required: get_option('sndfile'))
conf.set('ENABLE_SNDFILE', libsndfile_dep.found())
if libsndfile_dep.found()
decoder_plugins_sources += 'SndfileDecoderPlugin.cxx'
endif
wavpack_dep = dependency('wavpack', required: get_option('wavpack'))
conf.set('ENABLE_WAVPACK', wavpack_dep.found())
if wavpack_dep.found()
decoder_plugins_sources += 'WavpackDecoderPlugin.cxx'
endif
wildmidi_dep = c_compiler.find_library('WildMidi', required: get_option('wildmidi'))
conf.set('ENABLE_WILDMIDI', wildmidi_dep.found())
if wildmidi_dep.found()
decoder_plugins_sources += 'WildmidiDecoderPlugin.cxx'
endif
if not get_option('sidplay').disabled()
libsidplayfp_dep = dependency('libsidplayfp', required: false)
conf.set('HAVE_SIDPLAYFP', libsidplayfp_dep.found())
if libsidplayfp_dep.found()
libsidplay_dep = libsidplayfp_dep
else
libsidplay2_dep = dependency('libsidplay2', required: false)
if libsidplay2_dep.found()
libsidutils_dep = dependency('libsidutils')
libresid_builder_dep = compiler.find_library('resid-builder')
libsidplay_dep = declare_dependency(dependencies: [libsidplay2_dep, libsidutils_dep, libresid_builder_dep])
elif get_option('sidplay').enabled()
error('Neither libsidplayfp nor libsidplay2 found')
else
libsidplay_dep = libsidplay2_dep
endif
endif
else
libsidplay_dep = dependency('', required: false)
endif
conf.set('ENABLE_SIDPLAY', libsidplay_dep.found())
if libsidplay_dep.found()
decoder_plugins_sources += 'SidplayDecoderPlugin.cxx'
endif
decoder_plugins = static_library(
'decoder_plugins',
decoder_plugins_sources,
include_directories: inc,
dependencies: [
adplug_dep,
ffmpeg_dep,
flac_dep,
fluidsynth_dep,
libaudiofile_dep,
libfaad_dep,
libgme_dep,
libmad_dep,
libmikmod_dep,
libmodplug_dep,
libmpcdec_dep,
libmpg123_dep,
libopus_dep,
libsidplay_dep,
libsndfile_dep,
libvorbis_dep,
ogg_dep,
wavpack_dep,
wildmidi_dep,
],
)
decoder_plugins_dep = declare_dependency(
link_with: decoder_plugins,
dependencies: [
decoder_api_dep,
pcm_dep,
],
)
conf.set('ENABLE_ENCODER', need_encoder)
if not need_encoder
encoder_glue_dep = dependency('', required: false)
subdir_done()
endif
encoder_api_dep = declare_dependency()
subdir('plugins')
encoder_glue = static_library(
'encoder_glue',
'Configured.cxx',
'ToOutputStream.cxx',
'EncoderList.cxx',
include_directories: inc,
)
encoder_glue_dep = declare_dependency(
link_with: encoder_glue,
dependencies: [
encoder_plugins_dep,
],
)
encoder_plugins_sources = [
'NullEncoderPlugin.cxx',
]
conf.set('ENABLE_FLAC_ENCODER', flac_dep.found())
if flac_dep.found()
encoder_plugins_sources += 'FlacEncoderPlugin.cxx'
endif
if libopus_dep.found()
encoder_plugins_sources += 'OpusEncoderPlugin.cxx'
endif
conf.set('ENABLE_VORBISENC', libvorbisenc_dep.found())
if libvorbisenc_dep.found()
encoder_plugins_sources += 'VorbisEncoderPlugin.cxx'
endif
liblame_dep = c_compiler.find_library('mp3lame', required: get_option('lame'))
conf.set('ENABLE_LAME', liblame_dep.found())
if liblame_dep.found()
encoder_plugins_sources += 'LameEncoderPlugin.cxx'
endif
libtwolame_dep = dependency('twolame', required: get_option('twolame'))
conf.set('ENABLE_TWOLAME', libtwolame_dep.found())
if libtwolame_dep.found()
encoder_plugins_sources += 'TwolameEncoderPlugin.cxx'
endif
libshine_dep = dependency('shine', version: '>= 3.1', required: get_option('shine'))
conf.set('ENABLE_SHINE', libshine_dep.found())
if libshine_dep.found()
encoder_plugins_sources += 'ShineEncoderPlugin.cxx'
endif
conf.set('ENABLE_WAVE_ENCODER', get_option('wave_encoder'))
if get_option('wave_encoder')
encoder_plugins_sources += 'WaveEncoderPlugin.cxx'
endif
encoder_plugins = static_library(
'encoder_plugins',
encoder_plugins_sources,
include_directories: inc,
dependencies: [
flac_dep,
ogg_dep,
libopus_dep,
libvorbisenc_dep,
libvorbis_dep,
liblame_dep,
libtwolame_dep,
libshine_dep,
],
)
encoder_plugins_dep = declare_dependency(
link_with: encoder_plugins,
dependencies: [
encoder_api_dep,
tag_dep,
pcm_dep,
config_dep,
],
)
event = static_library(
'event',
'PollGroupPoll.cxx',
'PollGroupWinSelect.cxx',
'SignalMonitor.cxx',
'TimerEvent.cxx',
'IdleMonitor.cxx',
'DeferEvent.cxx',
'MaskMonitor.cxx',
'SocketMonitor.cxx',
'BufferedSocket.cxx',
'FullyBufferedSocket.cxx',
'MultiSocketMonitor.cxx',
'ServerSocket.cxx',
'Call.cxx',
'Thread.cxx',
'Loop.cxx',
include_directories: inc,
)
event_dep = declare_dependency(
link_with: event,
dependencies: [
thread_dep,
system_dep,
boost_dep,
],
)
filter_api = static_library(
'filter_api',
'Observer.cxx',
'Filter.cxx',
include_directories: inc,
)
filter_api_dep = declare_dependency(
link_with: filter_api,
)
subdir('plugins')
filter_glue = static_library(
'filter_glue',
'FilterRegistry.cxx',
'Factory.cxx',
'LoadOne.cxx',
'LoadChain.cxx',
include_directories: inc,
)
filter_glue_dep = declare_dependency(
link_with: filter_glue,
dependencies: [
filter_plugins_dep,
],
)
filter_plugins = static_library(
'filter_plugins',
'../../AudioCompress/compress.c',
'NullFilterPlugin.cxx',
'ChainFilterPlugin.cxx',
'AutoConvertFilterPlugin.cxx',
'ConvertFilterPlugin.cxx',
'RouteFilterPlugin.cxx',
'NormalizeFilterPlugin.cxx',
'ReplayGainFilterPlugin.cxx',
'VolumeFilterPlugin.cxx',
include_directories: inc,
)
filter_plugins_dep = declare_dependency(
link_with: filter_plugins,
dependencies: [
filter_api_dep,
pcm_dep,
config_dep,
],
)
fs_sources = [
'Domain.cxx',
'Traits.cxx',
'Config.cxx',
'Charset.cxx',
'Path.cxx',
'Path2.cxx',
'AllocatedPath.cxx',
'FileSystem.cxx',
'List.cxx',
'StandardDirectory.cxx',
'CheckFile.cxx',
'DirectoryReader.cxx',
'io/PeekReader.cxx',
'io/FileReader.cxx',
'io/BufferedReader.cxx',
'io/TextFile.cxx',
'io/FileOutputStream.cxx',
'io/BufferedOutputStream.cxx',
]
if is_windows
shlwapi_dep = c_compiler.find_library('shlwapi')
else
shlwapi_dep = dependency('', required: false)
endif
if zlib_dep.found()
fs_sources += [
'io/GunzipReader.cxx',
'io/AutoGunzipReader.cxx',
'io/GzipOutputStream.cxx',
]
endif
fs = static_library(
'fs',
fs_sources,
include_directories: inc,
dependencies: [
zlib_dep,
],
)
fs_dep = declare_dependency(
link_with: fs,
dependencies: [
system_dep,
icu_dep,
shlwapi_dep,
],
)
rc = meson.find_program('rc')
xres = meson.find_program('xres')
rsrc = custom_target(
'mpd.rsrc',
output: 'mpd.rsrc',
input: 'mpd.rdef',
command: [rc, '-o', '@OUTPUT@', '@INPUT@'],
)
custom_target(
'mpd.rsrc',
output: 'mpd',
input: [mpd, rsrc],
command: [xres, '-o', '@OUTPUT@', '--', '@INPUT@'],
install: true,
install_dir: get_option('bindir'),
)
input_api = static_library(
'input_api',
'Error.cxx',
'InputStream.cxx',
'ThreadInputStream.cxx',
'AsyncInputStream.cxx',
'ProxyInputStream.cxx',
include_directories: inc,
)
input_api_dep = declare_dependency(
link_with: input_api,
dependencies: [
event_dep,
],
)
subdir('plugins')
input_glue = static_library(
'input_glue',
'Init.cxx',
'Registry.cxx',
'Open.cxx',
'LocalOpen.cxx',
'ScanTags.cxx',
'Reader.cxx',
'TextInputStream.cxx',
'ProxyInputStream.cxx',
'RewindInputStream.cxx',
'BufferedInputStream.cxx',
'MaybeBufferedInputStream.cxx',
include_directories: inc,
)
input_glue_dep = declare_dependency(
link_with: input_glue,
dependencies: [
input_plugins_dep,
fs_dep,
config_dep,
tag_dep,
],
)
input_plugins_sources = [
'FileInputPlugin.cxx',
]
if alsa_dep.found()
input_plugins_sources += 'AlsaInputPlugin.cxx'
endif
libcdio_paranoia_dep = dependency('libcdio_paranoia', version: '>= 0.4', required: get_option('cdio_paranoia'))
conf.set('ENABLE_CDIO_PARANOIA', libcdio_paranoia_dep.found())
if libcdio_paranoia_dep.found()
input_plugins_sources += 'CdioParanoiaInputPlugin.cxx'
conf.set('HAVE_CDIO_PARANOIA_PARANOIA_H',
compiler.has_header('cdio/paranoia/paranoia.h',
dependencies: libcdio_paranoia_dep))
endif
if curl_dep.found()
input_plugins_sources += [
'CurlInputPlugin.cxx',
'../IcyInputStream.cxx',
'../../IcyMetaDataParser.cxx',
]
endif
if ffmpeg_dep.found()
input_plugins_sources += 'FfmpegInputPlugin.cxx'
endif
libmms_dep = dependency('libmms', version: '>= 0.4', required: get_option('mms'))
conf.set('ENABLE_MMS', libmms_dep.found())
if libmms_dep.found()
input_plugins_sources += 'MmsInputPlugin.cxx'
endif
if nfs_dep.found()
input_plugins_sources += 'NfsInputPlugin.cxx'
endif
if smbclient_dep.found()
input_plugins_sources += 'SmbclientInputPlugin.cxx'
endif
qobuz_feature = get_option('qobuz')
if qobuz_feature.disabled()
enable_qobuz = false
else
enable_qobuz = curl_dep.found() and yajl_dep.found() and gcrypt_dep.found()
if not enable_qobuz and qobuz_feature.enabled()
error('Qobuz requires CURL, libyajl and libgcrypt')
endif
endif
conf.set('ENABLE_QOBUZ', enable_qobuz)
if enable_qobuz
input_plugins_sources += [
'QobuzClient.cxx',
'QobuzErrorParser.cxx',
'QobuzLoginRequest.cxx',
'QobuzTrackRequest.cxx',
'QobuzTagScanner.cxx',
'QobuzInputPlugin.cxx',
]
endif
tidal_feature = get_option('tidal')
if tidal_feature.disabled()
enable_tidal = false
else
enable_tidal = curl_dep.found() and yajl_dep.found()
if not enable_tidal and tidal_feature.enabled()
error('Tidal requires CURL and libyajl')
endif
endif
conf.set('ENABLE_TIDAL', enable_tidal)
if enable_tidal
input_plugins_sources += [
'TidalErrorParser.cxx',
'TidalLoginRequest.cxx',
'TidalSessionManager.cxx',
'TidalTrackRequest.cxx',
'TidalTagScanner.cxx',
'TidalInputPlugin.cxx',
]
endif
input_plugins = static_library(
'input_plugins',
input_plugins_sources,
include_directories: inc,
dependencies: [
alsa_dep,
curl_dep,
ffmpeg_dep,
libcdio_paranoia_dep,
libmms_dep,
nfs_dep,
smbclient_dep,
yajl_dep,
gcrypt_dep,
],
)
input_plugins_dep = declare_dependency(
link_with: input_plugins,
dependencies: [
input_api_dep,
pcm_dep,
],
)
java = static_library(
'java',
'Global.cxx',
'File.cxx',
'String.cxx',
include_directories: inc,
dependencies: [
],
)
java_dep = declare_dependency(
link_with: java,
dependencies: [
util_dep,
fs_dep,
],
)
if not is_linux
alsa_dep = dependency('', required: false)
subdir_done()
endif
libasound_dep = dependency('alsa', version: '>= 0.9.0', required: get_option('alsa'))
if not libasound_dep.found()
alsa_dep = dependency('', required: false)
subdir_done()
endif
conf.set('ENABLE_ALSA', true)
alsa = static_library(
'alsa',
'Version.cxx',
'AllowedFormat.cxx',
'HwSetup.cxx',
'NonBlock.cxx',
include_directories: inc,
dependencies: [
libasound_dep,
],
)
alsa_dep = declare_dependency(
link_with: alsa,
dependencies: [
event_dep,
],
)
curl_dep = dependency('libcurl', version: '>= 7.18', required: get_option('curl'))
conf.set('ENABLE_CURL', curl_dep.found())
if not curl_dep.found()
subdir_done()
endif
curl = static_library(
'curl',
'Delegate.cxx',
'Version.cxx',
'Init.cxx',
'Global.cxx',
'Request.cxx',
'Form.cxx',
include_directories: inc,
dependencies: [
curl_dep,
],
)
curl_dep = declare_dependency(
link_with: curl,
dependencies: [
event_dep,
util_dep,
curl_dep,
],
)
dbus_dep = dependency('dbus-1', required: get_option('dbus'))
conf.set('ENABLE_DBUS', dbus_dep.found())
if not dbus_dep.found()
if get_option('udisks').enabled()
error('udisks2 requires D-Bus')
endif
enable_udisks = false
conf.set('ENABLE_UDISKS', enable_udisks)
subdir_done()
endif
enable_udisks = not get_option('udisks').disabled()
conf.set('ENABLE_UDISKS', enable_udisks)
dbus = static_library(
'dbus',
'Connection.cxx',
'Error.cxx',
'Message.cxx',
'UDisks2.cxx',
'ScopeMatch.cxx',
'Glue.cxx',
'Watch.cxx',
include_directories: inc,
dependencies: [
dbus_dep,
],
)
dbus_dep = declare_dependency(
link_with: dbus,
dependencies: [
dbus_dep,
event_dep,
],
)
expat_dep = dependency('expat', required: get_option('expat'))
conf.set('ENABLE_EXPAT', expat_dep.found())
if not expat_dep.found()
subdir_done()
endif
expat = static_library(
'expat',
'ExpatParser.cxx',
'StreamExpatParser.cxx',
include_directories: inc,
dependencies: [
expat_dep,
],
)
expat_dep = declare_dependency(
link_with: expat,
)
libavformat_dep = dependency('libavformat', version: '>= 56.1', required: get_option('ffmpeg'))
libavcodec_dep = dependency('libavcodec', version: '>= 56.1', required: get_option('ffmpeg'))
libavutil_dep = dependency('libavutil', version: '>= 54.3', required: get_option('ffmpeg'))
enable_ffmpeg = libavformat_dep.found() and libavcodec_dep.found() and libavutil_dep.found()
conf.set('ENABLE_FFMPEG', enable_ffmpeg)
if not enable_ffmpeg
ffmpeg_dep = dependency('', required: false)
subdir_done()
endif
ffmpeg = static_library(
'ffmpeg',
'Init.cxx',
'LogError.cxx',
'LogCallback.cxx',
'Error.cxx',
'Domain.cxx',
include_directories: inc,
dependencies: [
libavformat_dep,
libavcodec_dep,
libavutil_dep,
],
)
ffmpeg_dep = declare_dependency(
link_with: ffmpeg,
)
gcrypt_dep = c_compiler.find_library('gcrypt', required: get_option('qobuz'))
if not gcrypt_dep.found()
subdir_done()
endif
gcrypt = static_library(
'gcrypt',
'MD5.cxx',
include_directories: inc,
dependencies: [
gcrypt_dep,
],
)
gcrypt_dep = declare_dependency(
link_with: gcrypt,
dependencies: [
gcrypt_dep,
],
)
icu_dep = dependency('icu-i18n', version: '>= 50', required: get_option('icu'))
conf.set('HAVE_ICU', icu_dep.found())
icu_sources = [
'CaseFold.cxx',
'Compare.cxx',
'Collate.cxx',
'Converter.cxx',
]
if is_windows
icu_sources += 'Win32.cxx'
endif
if icu_dep.found()
icu_sources += [
'Util.cxx',
'Init.cxx',
]
elif not get_option('iconv').disabled()
have_iconv = compiler.has_function('iconv')
conf.set('HAVE_ICONV', have_iconv)
if get_option('iconv').enabled()
error('iconv() not available')
endif
endif
icu = static_library(
'icu',
icu_sources,
include_directories: inc,
dependencies: [
icu_dep,
],
)
icu_dep = declare_dependency(
link_with: icu,
dependencies: [
util_dep,
],
)
nfs_dep = dependency('libnfs', version: '>= 1.11', required: get_option('nfs'))
conf.set('ENABLE_NFS', nfs_dep.found())
if not nfs_dep.found()
subdir_done()
endif
nfs = static_library(
'nfs',
'Connection.cxx',
'Error.cxx',
'Manager.cxx',
'Glue.cxx',
'Base.cxx',
'FileReader.cxx',
'Blocking.cxx',
include_directories: inc,
dependencies: [
nfs_dep,
],
)
nfs_dep = declare_dependency(
link_with: nfs,
dependencies: [
nfs_dep,
],
)
enable_oss = get_option('oss')
if enable_oss.disabled()
enable_oss = false
elif enable_oss.auto() and alsa_dep.found()
# don't bother auto-enabling OSS if ALSA is available
enable_oss = false
elif compiler.has_header('sys/soundcard.h') or compiler.has_header('soundcard.h')
enable_oss = true
elif enable_oss.auto()
enable_oss = false
else
error('sys/soundcard.h not found')
endif
conf.set('HAVE_OSS', enable_oss)
pulse_dep = dependency('libpulse', version: '>= 0.9.16', required: get_option('pulse'))
conf.set('ENABLE_PULSE', pulse_dep.found())
if not pulse_dep.found()
subdir_done()
endif
pulse = static_library(
'pulse',
'LogError.cxx',
'Error.cxx',
'Domain.cxx',
include_directories: inc,
dependencies: [
pulse_dep,
],
)
pulse_dep = declare_dependency(
link_with: pulse,
dependencies: [
pulse_dep,
],
)
libroar_dep = dependency('libroar', version: '>= 0.4.0', required: get_option('roar'))
conf.set('ENABLE_ROAR', libroar_dep.found())
smbclient_dep = dependency('smbclient', version: '>= 0.2', required: get_option('smbclient'))
conf.set('ENABLE_SMBCLIENT', smbclient_dep.found())
if not smbclient_dep.found()
subdir_done()
endif
smbclient = static_library(
'smbclient',
'Domain.cxx',
'Mutex.cxx',
'Init.cxx',
include_directories: inc,
dependencies: [
smbclient_dep,
],
)
smbclient_dep = declare_dependency(
link_with: smbclient,
dependencies: [
smbclient_dep,
],
)
libsndio_dep = c_compiler.find_library('sndio', required: get_option('sndio'))
if libsndio_dep.found()
if c_compiler.has_header_symbol('sndio.h', 'ROAR_VERSION')
if get_option('sndio').enabled()
error('Found libroarsndio, which is known to be broken.')
else
warning('Found libroarsndio, which is known to be broken; ignoring it.')
libsndio_dep = dependency('', required: false)
endif
endif
endif
conf.set('ENABLE_SNDIO', libsndio_dep.found())
sqlite_dep = dependency('sqlite3', version: '>= 3.7.3', required: get_option('sqlite'))
conf.set('ENABLE_SQLITE', sqlite_dep.found())
if not sqlite_dep.found()
subdir_done()
endif
sqlite = static_library(
'sqlite',
'Error.cxx',
include_directories: inc,
dependencies: [
sqlite_dep,
],
)
sqlite_dep = declare_dependency(
link_with: sqlite,
)
if not is_linux or is_android
systemd_dep = dependency('', required: false)
subdir_done()
endif
systemd_dep = dependency('libsystemd', required: get_option('systemd'))
conf.set('ENABLE_SYSTEMD_DAEMON', systemd_dep.found())
if not systemd_dep.found()
subdir_done()
endif
systemd = static_library(
'systemd',
'Watchdog.cxx',
include_directories: inc,
dependencies: [
systemd_dep,
],
)
systemd_dep = declare_dependency(
link_with: systemd,
)
upnp_dep = dependency('libupnp', required: get_option('upnp'))
conf.set('ENABLE_UPNP', upnp_dep.found())
if not upnp_dep.found()
subdir_done()
endif
if not curl_dep.found()
error('UPnP requires CURL')
endif
if not expat_dep.found()
error('UPnP requires expat')
endif
upnp = static_library(
'upnp',
'Init.cxx',
'ClientInit.cxx',
'Device.cxx',
'ContentDirectoryService.cxx',
'Discovery.cxx',
'ixmlwrap.cxx',
'Util.cxx',
include_directories: inc,
dependencies: [
upnp_dep,
curl_dep,
expat_dep,
],
)
upnp_dep = declare_dependency(
link_with: upnp,
dependencies: [
upnp_dep,
curl_dep,
expat_dep,
event_dep,
],
)
libwrap_option = get_option('libwrap')
enable_libwrap = false
if not libwrap_option.disabled() and compiler.has_header('tcpd.h') and compiler.compiles('''
#include <tcpd.h>
bool CheckLibWrap(int fd, const char &progname) {
struct request_info req;
request_init(&req, RQ_FILE, fd, RQ_DAEMON, progname, 0);
fromhost(&req);
return hosts_access(&req);
}
''')
libwrap_dep = compiler.find_library('wrap', required: libwrap_option)
else
libwrap_dep = dependency('', required: libwrap_option)
endif
if not libwrap_dep.found() and libwrap_option.enabled()
error('libwrap not found')
endif
conf.set('HAVE_LIBWRAP', libwrap_dep.found())
libflac_dep = dependency('flac', version: '>= 1.2', required: get_option('flac'))
libopus_dep = dependency('opus', required: get_option('opus'))
libvorbis_dep = dependency('vorbis', required: get_option('vorbis'))
if need_encoder
libvorbisenc_dep = dependency('vorbisenc', required: get_option('vorbisenc'))
else
libvorbisenc_dep = dependency('', required: false)
endif
if libopus_dep.found() or libvorbis_dep.found() or libvorbisenc_dep.found()
libogg_dep = dependency('ogg')
else
libogg_dep = dependency('', required: false)
endif
if not libogg_dep.found() or not libflac_dep.found()
xiph_dep = dependency('', required: false)
ogg_dep = dependency('', required: false)
flac_dep = dependency('', required: false)
subdir_done()
endif
xiph = static_library(
'xiph',
'VorbisComments.cxx',
'XiphTags.cxx',
include_directories: inc,
)
xiph_dep = declare_dependency(
link_with: xiph,
)
if libogg_dep.found()
ogg = static_library(
'ogg',
'OggVisitor.cxx',
'OggSerial.cxx',
'OggSyncState.cxx',
'OggFind.cxx',
'OggPacket.cxx',
include_directories: inc,
dependencies: [
libogg_dep,
],
)
ogg_dep = declare_dependency(
link_with: ogg,
dependencies: [
xiph_dep,
libogg_dep,
],
)
else
ogg_dep = dependency('', required: false)
endif
if libflac_dep.found()
flac = static_library(
'flac',
'FlacIOHandle.cxx',
'FlacMetadataChain.cxx',
'FlacStreamMetadata.cxx',
include_directories: inc,
dependencies: [
libflac_dep,
],
)
flac_dep = declare_dependency(
link_with: flac,
dependencies: [
xiph_dep,
libflac_dep,
],
)
else
flac_dep = dependency('', required: false)
endif
yajl_dep = dependency('yajl', required: get_option('yajl'))
if not yajl_dep.found()
subdir_done()
endif
yajl = static_library(
'yajl',
'ResponseParser.cxx',
'ParseInputStream.cxx',
include_directories: inc,
dependencies: [
yajl_dep,
],
)
yajl_dep = declare_dependency(
link_with: yajl,
dependencies: [
yajl_dep,
],
)
zlib_dep = dependency('zlib', required: get_option('zlib'))
if not zlib_dep.found()
subdir_done()
endif
zlib = static_library(
'zlib',
'Error.cxx',
include_directories: inc,
dependencies: [
zlib_dep,
],
)
zlib_dep = declare_dependency(
link_with: zlib,
)
mixer_api_dep = declare_dependency()
subdir('plugins')
mixer_glue = static_library(
'mixer_glue',
'MixerControl.cxx',
'MixerType.cxx',
'MixerAll.cxx',
include_directories: inc,
)
mixer_glue_dep = declare_dependency(
link_with: mixer_glue,
dependencies: [
mixer_plugins_dep,
],
)
mixer_plugins_sources = [
'NullMixerPlugin.cxx',
'SoftwareMixerPlugin.cxx',
]
if alsa_dep.found()
mixer_plugins_sources += [
'AlsaMixerPlugin.cxx',
'volume_mapping.c',
]
endif
if is_haiku
mixer_plugins_sources += 'HaikuMixerPlugin.cxx'
endif
if enable_oss
mixer_plugins_sources += 'OssMixerPlugin.cxx'
endif
if is_darwin
mixer_plugins_sources += 'OSXMixerPlugin.cxx'
endif
if pulse_dep.found()
mixer_plugins_sources += 'PulseMixerPlugin.cxx'
endif
if libroar_dep.found()
mixer_plugins_sources += 'RoarMixerPlugin.cxx'
endif
if libsndio_dep.found()
mixer_plugins_sources += 'SndioMixerPlugin.cxx'
endif
if is_windows
mixer_plugins_sources += 'WinmmMixerPlugin.cxx'
endif
mixer_plugins = static_library(
'mixer_plugins',
mixer_plugins_sources,
include_directories: inc,
dependencies: [
alsa_dep,
pulse_dep,
libroar_dep,
libsndio_dep,
]
)
mixer_plugins_dep = declare_dependency(
link_with: mixer_plugins,
dependencies: [
config_dep,
],
)
if not get_option('neighbor')
conf.set('ENABLE_NEIGHBOR_PLUGINS', false)
neighbor_glue_dep = dependency('', required: false)
subdir_done()
endif
neighbor_api_dep = declare_dependency()
subdir('plugins')
conf.set('ENABLE_NEIGHBOR_PLUGINS', found_neighbor_plugin)
if not found_neighbor_plugin
neighbor_glue_dep = dependency('', required: false)
subdir_done()
endif
neighbor_glue = static_library(
'neighbor_glue',
'Glue.cxx',
'Registry.cxx',
include_directories: inc,
)
neighbor_glue_dep = declare_dependency(
link_with: neighbor_glue,
dependencies: [
neighbor_plugins_dep,
config_dep,
],
)
neighbor_plugins_sources = []
found_neighbor_plugin = false
if smbclient_dep.found()
neighbor_plugins_sources += 'SmbclientNeighborPlugin.cxx'
found_neighbor_plugin = true
endif
if enable_udisks
neighbor_plugins_sources += 'UdisksNeighborPlugin.cxx'
found_neighbor_plugin = true
endif
if upnp_dep.found()
neighbor_plugins_sources += 'UpnpNeighborPlugin.cxx'
found_neighbor_plugin = true
endif
if not found_neighbor_plugin
subdir_done()
endif
neighbor_plugins = static_library(
'neighbor_plugins',
neighbor_plugins_sources,
include_directories: inc,
dependencies: [
dbus_dep,
smbclient_dep,
upnp_dep,
],
)
neighbor_plugins_dep = declare_dependency(
link_with: neighbor_plugins,
dependencies: [
neighbor_api_dep,
event_dep,
],
)
have_tcp = get_option('tcp')
conf.set('HAVE_TCP', have_tcp)
if have_tcp and not get_option('ipv6').disabled()
if is_windows
have_ipv6 = c_compiler.has_header_symbol('winsock2.h', 'AF_INET6')
else
have_ipv6 = c_compiler.has_header_symbol('sys/socket.h', 'AF_INET6')
endif
if not have_ipv6 and get_option('ipv6').enabled()
error('IPv6 not supported by OS')
endif
conf.set('HAVE_STRUCT_SOCKADDR_IN_SIN_LEN', c_compiler.has_member('struct sockaddr_in', 'sin_len', prefix: '''
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <netinet/in.h>
#endif'''))
else
have_ipv6 = false
endif
conf.set('HAVE_IPV6', have_ipv6)
have_local_socket = not is_windows and get_option('local_socket')
conf.set('HAVE_UN', have_local_socket)
if have_local_socket
conf.set('HAVE_STRUCT_UCRED', compiler.has_header_symbol('sys/socket.h', 'struct ucred') and compiler.has_header_symbol('sys/socket.h', 'SO_PEERCRED'))
conf.set('HAVE_GETPEEREID', compiler.has_function('getpeereid'))
endif
if not have_tcp and not have_local_socket
error('Must enable either "tcp" or "local_socket"')
endif
net = static_library(
'net',
'ToString.cxx',
'HostParser.cxx',
'Resolver.cxx',
'AddressInfo.cxx',
'StaticSocketAddress.cxx',
'AllocatedSocketAddress.cxx',
'IPv4Address.cxx',
'IPv6Address.cxx',
'SocketAddress.cxx',
'SocketUtil.cxx',
'SocketDescriptor.cxx',
'SocketError.cxx',
include_directories: inc,
)
net_dep = declare_dependency(
link_with: net,
dependencies: [
system_dep,
],
)
output_api = static_library(
'output_api',
'Interface.cxx',
'Timer.cxx',
include_directories: inc,
)
output_api_dep = declare_dependency(
link_with: output_api,
dependencies: [
filter_plugins_dep,
mixer_plugins_dep,
],
)
subdir('plugins')
output_glue = static_library(
'output_glue',
'Defaults.cxx',
'Filtered.cxx',
'Registry.cxx',
'MultipleOutputs.cxx',
'SharedPipeConsumer.cxx',
'Source.cxx',
'Thread.cxx',
'Domain.cxx',
'Control.cxx',
'State.cxx',
'Print.cxx',
'OutputCommand.cxx',
'OutputPlugin.cxx',
'Finish.cxx',
'Init.cxx',
include_directories: inc,
)
output_glue_dep = declare_dependency(
link_with: output_glue,
dependencies: [
filter_glue_dep,
mixer_plugins_dep,
output_plugins_dep,
],
)
output_plugins_sources = [
'NullOutputPlugin.cxx',
]
output_plugins_deps = [
output_api_dep,
config_dep,
tag_dep,
]
need_encoder = false
if alsa_dep.found()
output_plugins_sources += 'AlsaOutputPlugin.cxx'
endif
libao_dep = dependency('ao', required: get_option('ao'))
conf.set('ENABLE_AO', libao_dep.found())
if libao_dep.found()
output_plugins_sources += 'AoOutputPlugin.cxx'
endif
enable_fifo_output = get_option('fifo') and not is_windows
conf.set('HAVE_FIFO', enable_fifo_output)
if enable_fifo_output
output_plugins_sources += 'FifoOutputPlugin.cxx'
endif
if is_haiku
output_plugins_sources += 'HaikuOutputPlugin.cxx'
endif
conf.set('ENABLE_HTTPD_OUTPUT', get_option('httpd'))
if get_option('httpd')
output_plugins_sources += [
'httpd/IcyMetaDataServer.cxx',
'httpd/Page.cxx',
'httpd/HttpdClient.cxx',
'httpd/HttpdOutputPlugin.cxx',
]
output_plugins_deps += [ event_dep, net_dep, libwrap_dep ]
need_encoder = true
endif
libjack_dep = dependency('jack', version: '>= 0.100', required: get_option('jack'))
conf.set('ENABLE_JACK', libjack_dep.found())
if libjack_dep.found()
output_plugins_sources += 'JackOutputPlugin.cxx'
conf.set('HAVE_JACK_SET_INFO_FUNCTION', compiler.has_header_symbol('jack/jack.h', 'jack_set_info_function'))
endif
openal_dep = dependency('', required: false)
if not get_option('openal').disabled()
if is_darwin
if compiler.has_header('OpenAL/al.h')
openal_dep = declare_dependency(link_args: ['-framework', 'OpenAL'])
endif
else
openal_dep = dependency('openal', required: false)
endif
if openal_dep.found()
output_plugins_sources += 'OpenALOutputPlugin.cxx'
elif get_option('openal').enabled()
error('OpenAL not available')
endif
endif
conf.set('HAVE_OPENAL', openal_dep.found())
if enable_oss
output_plugins_sources += 'OssOutputPlugin.cxx'
endif
if is_darwin
output_plugins_sources += 'OSXOutputPlugin.cxx'
audiounit_dep = declare_dependency(
link_args: [
'-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreServices',
]
)
else
audiounit_dep = dependency('', required: false)
endif
conf.set('HAVE_OSX', is_darwin)
enable_pipe_output = get_option('pipe') and not is_windows
conf.set('ENABLE_PIPE_OUTPUT', enable_pipe_output)
if enable_pipe_output
output_plugins_sources += 'PipeOutputPlugin.cxx'
endif
if pulse_dep.found()
output_plugins_sources += 'PulseOutputPlugin.cxx'
endif
conf.set('ENABLE_RECORDER_OUTPUT', get_option('recorder'))
if get_option('recorder')
output_plugins_sources += 'RecorderOutputPlugin.cxx'
need_encoder = true
endif
if libroar_dep.found()
output_plugins_sources += 'RoarOutputPlugin.cxx'
endif
libshout_dep = dependency('shout', required: get_option('shout'))
conf.set('HAVE_SHOUT', libshout_dep.found())
if libshout_dep.found()
output_plugins_sources += 'ShoutOutputPlugin.cxx'
need_encoder = true
endif
if is_android
sles_dep = c_compiler.find_library('OpenSLES')
output_plugins_sources += 'sles/SlesOutputPlugin.cxx'
else
sles_dep = dependency('', required: false)
endif
if libsndio_dep.found()
output_plugins_sources += 'SndioOutputPlugin.cxx'
endif
enable_solaris_output = get_option('solaris_output')
if enable_solaris_output.auto()
enable_solaris_output = host_machine.system() == 'sunos' or host_machine.system() == 'solaris'
else
enable_solaris_output = enable_solaris_output.enabled()
endif
conf.set('ENABLE_SOLARIS_OUTPUT', enable_solaris_output)
if enable_solaris_output
output_plugins_sources += 'SolarisOutputPlugin.cxx'
endif
conf.set('ENABLE_WINMM_OUTPUT', is_windows)
if is_windows
output_plugins_sources += 'WinmmOutputPlugin.cxx'
winmm_dep = c_compiler.find_library('winmm')
else
winmm_dep = dependency('', required: false)
endif
output_plugins = static_library(
'output_plugins',
output_plugins_sources,
include_directories: inc,
dependencies: [
alsa_dep,
audiounit_dep,
libao_dep,
libjack_dep,
pulse_dep,
libroar_dep,
libshout_dep,
libsndio_dep,
openal_dep,
sles_dep,
winmm_dep,
],
)
output_plugins_dep = declare_dependency(
link_with: output_plugins,
dependencies: output_plugins_deps,
)
pcm_sources = [
'../CheckAudioFormat.cxx',
'../AudioFormat.cxx',
'../AudioParser.cxx',
'SampleFormat.cxx',
'Interleave.cxx',
'PcmBuffer.cxx',
'PcmExport.cxx',
'PcmConvert.cxx',
'PcmDop.cxx',
'Volume.cxx',
'Silence.cxx',
'PcmMix.cxx',
'PcmChannels.cxx',
'PcmPack.cxx',
'PcmFormat.cxx',
'FormatConverter.cxx',
'ChannelsConverter.cxx',
'Order.cxx',
'GlueResampler.cxx',
'FallbackResampler.cxx',
'ConfiguredResampler.cxx',
'PcmDither.cxx',
]
if get_option('dsd')
pcm_sources += [
'Dsd16.cxx',
'Dsd32.cxx',
'PcmDsd.cxx',
'dsd2pcm/dsd2pcm.c',
]
executable(
'dsd2pcm',
'dsd2pcm/main.cpp',
'dsd2pcm/dsd2pcm.c',
'dsd2pcm/noiseshape.c',
include_directories: inc,
dependencies: [
util_dep,
],
install: false,
)
endif
libsamplerate_dep = dependency('samplerate', version: '>= 0.1.3', required: get_option('libsamplerate'))
if libsamplerate_dep.found()
conf.set('ENABLE_LIBSAMPLERATE', true)
pcm_sources += 'LibsamplerateResampler.cxx'
endif
soxr_dep = dependency('soxr', required: get_option('soxr'))
if soxr_dep.found()
conf.set('ENABLE_SOXR', true)
pcm_sources += 'SoxrResampler.cxx'
endif
pcm = static_library(
'pcm',
pcm_sources,
include_directories: inc,
dependencies: [
util_dep,
libsamplerate_dep,
soxr_dep,
],
)
pcm_dep = declare_dependency(
link_with: pcm,
)
playlist_api = static_library(
'playlist_api',
'MemorySongEnumerator.cxx',
include_directories: inc,
)
playlist_api_dep = declare_dependency(
link_with: playlist_api,
)
subdir('plugins')
playlist_glue = static_library(
'playlist_glue',
'PlaylistRegistry.cxx',
include_directories: inc,
)
playlist_glue_dep = declare_dependency(
link_with: playlist_glue,
dependencies: [
playlist_plugins_dep,
],
)
playlist_plugins_sources = [
'ExtM3uPlaylistPlugin.cxx',
'M3uPlaylistPlugin.cxx',
'PlsPlaylistPlugin.cxx',
]
playlist_plugins_deps = [
expat_dep,
flac_dep,
]
conf.set('ENABLE_CUE', get_option('cue'))
if get_option('cue')
playlist_plugins_sources += [
'../cue/CueParser.cxx',
'CuePlaylistPlugin.cxx',
'EmbeddedCuePlaylistPlugin.cxx',
]
endif
if expat_dep.found()
playlist_plugins_sources += [
'XspfPlaylistPlugin.cxx',
'AsxPlaylistPlugin.cxx',
'RssPlaylistPlugin.cxx',
]
endif
if flac_dep.found()
playlist_plugins_sources += 'FlacPlaylistPlugin.cxx'
endif
soundcloud_feature = get_option('soundcloud')
if soundcloud_feature.disabled()
enable_soundcloud = false
else
enable_soundcloud = curl_dep.found() and yajl_dep.found()
if not enable_soundcloud and soundcloud_feature.enabled()
error('SoundCloud requires CURL and libyajl')
endif
endif
conf.set('ENABLE_SOUNDCLOUD', enable_soundcloud)
if enable_soundcloud
playlist_plugins_sources += 'SoundCloudPlaylistPlugin.cxx'
playlist_plugins_deps += yajl_dep
endif
playlist_plugins = static_library(
'playlist_plugins',
playlist_plugins_sources,
include_directories: inc,
dependencies: playlist_plugins_deps,
)
playlist_plugins_dep = declare_dependency(
link_with: playlist_plugins,
dependencies: [
playlist_api_dep,
tag_dep,
],
)
song = static_library(
'song',
'DetachedSong.cxx',
'StringFilter.cxx',
'UriSongFilter.cxx',
'BaseSongFilter.cxx',
'TagSongFilter.cxx',
'ModifiedSinceSongFilter.cxx',
'AudioFormatSongFilter.cxx',
'AndSongFilter.cxx',
'OptimizeFilter.cxx',
'Filter.cxx',
'LightSong.cxx',
include_directories: inc,
)
song_dep = declare_dependency(
link_with: song,
dependencies: [
icu_dep,
tag_dep,
util_dep,
],
)
storage_api = static_library(
'storage_api',
'StorageInterface.cxx',
include_directories: inc,
)
storage_api_dep = declare_dependency(
link_with: storage_api,
)
subdir('plugins')
storage_glue = static_library(
'storage_glue',
'Registry.cxx',
'CompositeStorage.cxx',
'MemoryDirectoryReader.cxx',
'Configured.cxx',
'StorageState.cxx',
include_directories: inc,
)
storage_glue_dep = declare_dependency(
link_with: storage_glue,
dependencies: [
storage_plugins_dep,
],
)
storage_plugins_sources = [
'LocalStorage.cxx',
]
webdav_option = get_option('webdav')
enable_webdav = false
if not webdav_option.disabled()
enable_webdav = true
if not curl_dep.found()
if webdav_option.enabled()
error('WebDAV requires CURL')
endif
enable_webdav = false
endif
if not expat_dep.found()
if webdav_option.enabled()
error('WebDAV requires Expat')
endif
enable_webdav = false
endif
if enable_webdav
storage_plugins_sources += 'CurlStorage.cxx'
endif
endif
conf.set('ENABLE_WEBDAV', enable_webdav)
if nfs_dep.found()
storage_plugins_sources += 'NfsStorage.cxx'
endif
if smbclient_dep.found()
storage_plugins_sources += 'SmbclientStorage.cxx'
endif
if enable_udisks
storage_plugins_sources += 'UdisksStorage.cxx'
endif
storage_plugins = static_library(
'storage_plugins',
storage_plugins_sources,
include_directories: inc,
dependencies: [
curl_dep,
dbus_dep,
expat_dep,
nfs_dep,
smbclient_dep,
],
)
storage_plugins_dep = declare_dependency(
link_with: storage_plugins,
dependencies: [
storage_api_dep,
fs_dep,
],
)
system_sources = [
'FatalError.cxx',
'FileDescriptor.cxx',
'Open.cxx',
'EventPipe.cxx',
'Clock.cxx',
]
if host_machine.system() == 'linux'
system_sources += [
'EventFD.cxx',
'SignalFD.cxx',
'EpollFD.cxx',
]
endif
system = static_library(
'system',
system_sources,
include_directories: inc,
)
if is_windows
winsock_dep = c_compiler.find_library('ws2_32')
else
winsock_dep = dependency('', required: false)
endif
system_dep = declare_dependency(
link_with: system,
dependencies: [
winsock_dep,
],
)
tag_sources = [
'Tag.cxx',
'Builder.cxx',
'Handler.cxx',
'Settings.cxx',
'Config.cxx',
'ParseName.cxx',
'Names.c',
'FixString.cxx',
'Pool.cxx',
'Table.cxx',
'Set.cxx',
'Format.cxx',
'VorbisComment.cxx',
'ReplayGain.cxx',
'MixRamp.cxx',
'Generic.cxx',
'Id3MusicBrainz.cxx',
'ApeLoader.cxx',
'ApeReplayGain.cxx',
'ApeTag.cxx',
]
libid3tag_dep = dependency('id3tag', required: get_option('id3tag'))
conf.set('ENABLE_ID3TAG', libid3tag_dep.found())
if libid3tag_dep.found()
tag_sources += [
'Id3Load.cxx',
'Id3Scan.cxx',
'Rva2.cxx',
'Riff.cxx',
'Aiff.cxx',
]
endif
tag = static_library(
'tag',
tag_sources,
include_directories: inc,
dependencies: [
libid3tag_dep,
],
)
tag_dep = declare_dependency(
link_with: tag,
dependencies: [
util_dep,
],
)
thread = static_library(
'thread',
'Util.cxx',
'Thread.cxx',
include_directories: inc,
dependencies: [
dependency('threads')
],
)
thread_dep = declare_dependency(
link_with: thread,
)
util = static_library(
'util',
'Exception.cxx',
'Alloc.cxx',
'UTF8.cxx',
'HexFormat.cxx',
'MimeType.cxx',
'StringView.cxx',
'AllocatedString.cxx',
'TruncateString.cxx',
'StringStrip.cxx',
'StringUtil.cxx',
'StringCompare.cxx',
'WStringCompare.cxx',
'DivideString.cxx',
'SplitString.cxx',
'FormatString.cxx',
'Tokenizer.cxx',
'TimeParser.cxx',
'TimeConvert.cxx',
'TimeISO8601.cxx',
'UriUtil.cxx',
'LazyRandomEngine.cxx',
'HugeAllocator.cxx',
'PeakBuffer.cxx',
'PrintException.cxx',
'SparseBuffer.cxx',
'OptionParser.cxx',
'ByteReverse.cxx',
'format.c',
'bit_reverse.c',
include_directories: inc,
)
util_dep = declare_dependency(
link_with: util,
)
zeroconf_option = get_option('zeroconf')
libavahi_client_dep = dependency('', required: false)
if zeroconf_option == 'auto'
if is_darwin
# Bonjour disabled for now because its build is broken
#zeroconf_option = 'bonjour'
zeroconf_option = 'disabled'
elif is_android or is_windows
zeroconf_option = 'disabled'
elif dbus_dep.found()
libavahi_client_dep = dependency('avahi-client', required: false)
if libavahi_client_dep.found()
zeroconf_option = 'avahi'
else
zeroconf_option = 'disabled'
endif
else
zeroconf_option = 'disabled'
endif
endif
if zeroconf_option == 'disabled'
zeroconf_dep = dependency('', required: false)
subdir_done()
endif
if zeroconf_option == 'bonjour'
if not compiler.has_header('dns_sd.h')
error('dns_sd.h not found')
endif
bonjour_dep = declare_dependency(link_args: ['-framework', 'dnssd'])
conf.set('HAVE_BONJOUR', true)
zeroconf = static_library(
'zeroconf_bonjour',
'ZeroconfGlue.cxx',
'ZeroconfBonjour.cxx',
include_directories: inc,
)
zeroconf_dep = declare_dependency(
link_with: zeroconf,
dependencies: [
bonjour_dep,
],
)
else
if not libavahi_client_dep.found()
libavahi_client_dep = dependency('avahi-client')
endif
conf.set('HAVE_AVAHI', true)
zeroconf = static_library(
'zeroconf_bonjour',
'ZeroconfGlue.cxx',
'ZeroconfAvahi.cxx',
'AvahiPoll.cxx',
include_directories: inc,
dependencies: [
libavahi_client_dep,
dbus_dep,
],
)
zeroconf_dep = declare_dependency(
link_with: zeroconf,
)
endif
conf.set('HAVE_ZEROCONF', true)
systemd_unit_conf = configuration_data()
systemd_unit_conf.set('prefix', get_option('prefix'))
subdir('system')
subdir('user')
systemd_system_unit_dir = get_option('systemd_system_unit_dir')
if systemd_system_unit_dir == ''
systemd_system_unit_dir = join_paths(get_option('prefix'), 'lib', 'systemd', 'system')
endif
install_data(
'mpd.socket',
install_dir: systemd_system_unit_dir,
)
configure_file(
input: 'mpd.service.in',
output: 'mpd.service',
configuration: systemd_unit_conf,
install_dir: systemd_system_unit_dir,
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment