aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-12-27 14:33:41 +0100
committerMax Kellermann <max@duempel.org>2008-12-27 14:33:41 +0100
commit0fe0425dee555027c94a39ca0bca5bac947f4702 (patch)
treeb56c3d787c766cda67b29dcd7664dbd516835373
parent4c13a276c4340752fe955057cbb8cae82163292d (diff)
downloadmpd-0fe0425dee555027c94a39ca0bca5bac947f4702.tar.gz
mpd-0fe0425dee555027c94a39ca0bca5bac947f4702.tar.xz
mpd-0fe0425dee555027c94a39ca0bca5bac947f4702.zip
disable archive API without plugins
When there are no archive plugins, we do not need the archive API at all. Drop all its overhead.
Diffstat (limited to '')
-rw-r--r--configure.ac10
-rw-r--r--src/Makefile.am13
-rw-r--r--src/input_stream.c5
-rw-r--r--src/ls.c2
-rw-r--r--src/main.c11
-rw-r--r--src/update.c7
6 files changed, 43 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 9bfccafaf..16189a07a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,6 +217,16 @@ if test x$enable_iso = xyes; then
AC_DEFINE(HAVE_ISO, 1, [Define to have iso archive support])
fi
+dnl archive API
+if test x$enable_bz2 = xyes || test x$enable_zip = xyes || test x$enable_iso = xyes; then
+ enable_archive=yes
+ AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
+else
+ enable_archive=no
+fi
+
+AM_CONDITIONAL(ENABLE_ARCHIVE, test x$enable_archive = xyes)
+
dnl
dnl decoder plugins
diff --git a/src/Makefile.am b/src/Makefile.am
index 38ba8b223..b327a8f93 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -158,10 +158,7 @@ mpd_SOURCES = \
volume.c \
locate.c \
stored_playlist.c \
- timer.c \
- archive_api.c \
- archive_list.c \
- input_archive.c
+ timer.c
if HAVE_LIBSAMPLERATE
mpd_SOURCES += pcm_resample_libsamplerate.c
@@ -187,6 +184,14 @@ if HAVE_ISO
mpd_SOURCES += archive/iso_plugin.c
endif
+if ENABLE_ARCHIVE
+mpd_SOURCES += \
+ archive_api.c \
+ archive_list.c \
+ input_archive.c
+endif
+
+
# decoder plugins
if HAVE_MAD
diff --git a/src/input_stream.c b/src/input_stream.c
index 45b7ec5e9..3df8fe006 100644
--- a/src/input_stream.c
+++ b/src/input_stream.c
@@ -20,7 +20,10 @@
#include "config.h"
#include "input_file.h"
+
+#ifdef ENABLE_ARCHIVE
#include "input_archive.h"
+#endif
#ifdef HAVE_CURL
#include "input_curl.h"
@@ -31,7 +34,9 @@
static const struct input_plugin *const input_plugins[] = {
&input_plugin_file,
+#ifdef ENABLE_ARCHIVE
&input_plugin_archive,
+#endif
#ifdef HAVE_CURL
&input_plugin_curl,
#endif
diff --git a/src/ls.c b/src/ls.c
index f0f403f44..22b2fc9fc 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -84,6 +84,7 @@ hasMusicSuffix(const char *utf8file, unsigned int next)
return ret;
}
+#ifdef ENABLE_ARCHIVE
const struct archive_plugin *
get_archive_by_suffix(const char *utf8file)
{
@@ -98,3 +99,4 @@ get_archive_by_suffix(const char *utf8file)
}
return ret;
}
+#endif
diff --git a/src/main.c b/src/main.c
index 199d76471..79c9dfa08 100644
--- a/src/main.c
+++ b/src/main.c
@@ -40,7 +40,6 @@
#include "permission.h"
#include "replay_gain.h"
#include "decoder_list.h"
-#include "archive_list.h"
#include "audioOutput.h"
#include "input_stream.h"
#include "state_file.h"
@@ -52,6 +51,10 @@
#include "main_notify.h"
#include "os_compat.h"
+#ifdef ENABLE_ARCHIVE
+#include "archive_list.h"
+#endif
+
#include <glib.h>
#ifdef HAVE_LOCALE
@@ -147,10 +150,12 @@ static void version(void)
"Supported outputs:\n");
printAllOutputPluginTypes(stdout);
+#ifdef ENABLE_ARCHIVE
puts("\n"
"Supported archives:\n");
archive_plugin_init_all();
archive_plugin_print_all_suffixes(stdout);
+#endif
}
static void parseOptions(int argc, char **argv, Options * options)
@@ -421,7 +426,9 @@ int main(int argc, char *argv[])
mapper_init();
initPermissions();
initPlaylist();
+#ifdef ENABLE_ARCHIVE
archive_plugin_init_all();
+#endif
decoder_plugin_init_all();
update_global_init();
@@ -507,7 +514,9 @@ int main(int argc, char *argv[])
command_finish();
update_global_finish();
decoder_plugin_deinit_all();
+#ifdef ENABLE_ARCHIVE
archive_plugin_deinit_all();
+#endif
music_pipe_free();
cleanUpPidFile();
finishConf();
diff --git a/src/update.c b/src/update.c
index c7ad71c7b..307d198f3 100644
--- a/src/update.c
+++ b/src/update.c
@@ -276,6 +276,7 @@ make_subdir(struct directory *parent, const char *name)
return directory;
}
+#ifdef ENABLE_ARCHIVE
static void
update_archive_tree(struct directory *directory, char *name)
{
@@ -308,6 +309,7 @@ update_archive_tree(struct directory *directory, char *name)
}
}
}
+#endif
static bool
updateDirectory(struct directory *directory, const struct stat *st);
@@ -316,7 +318,10 @@ static void
updateInDirectory(struct directory *directory,
const char *name, const struct stat *st)
{
+#ifdef ENABLE_ARCHIVE
const struct archive_plugin *archive;
+#endif
+
assert(strchr(name, '/') == NULL);
if (S_ISREG(st->st_mode) && hasMusicSuffix(name, 0)) {
@@ -351,6 +356,7 @@ updateInDirectory(struct directory *directory,
ret = updateDirectory(subdir, st);
if (!ret)
delete_directory(subdir);
+#ifdef ENABLE_ARCHIVE
} else if (S_ISREG(st->st_mode) && (archive = get_archive_by_suffix(name))) {
struct archive_file *archfile;
char pathname[MPD_PATH_MAX];
@@ -380,6 +386,7 @@ updateInDirectory(struct directory *directory,
} else {
g_warning("unable to open archive %s\n", pathname);
}
+#endif
} else {
g_debug("update: %s is not a directory, archive or music\n", name);
}