Make SQL mandatory and sqlite3 the default (and only) backend

This commit is contained in:
Julien BLACHE 2009-04-01 16:59:50 +02:00
parent c0d395b7f9
commit 098ab7d736
6 changed files with 11 additions and 76 deletions

View File

@ -38,7 +38,6 @@ fi
AC_DEFINE_UNQUOTED(CONFFILE,"${CONFFILE}",Where the config file is)
db_sqlite3=false
use_ffmpeg=false;
use_upnp=false;
use_ssl=false
@ -59,13 +58,6 @@ AC_ARG_ENABLE(iconv, [ --enable-iconv Enable iconv conversion],
*) AC_MSG_ERROR(bad value ${enableval} for --enable-iconv);;
esac ])
AC_ARG_ENABLE(sqlite3,[ --enable-sqlite3 Enable sqlite3 db backend],
[ case "${enableval}" in
yes) db_sqlite3=true; have_sql=true;;
no) db_sqlite3=false;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-sqlite3);;
esac ])
AC_ARG_ENABLE(oggvorbis,[ --enable-oggvorbis Enable Ogg/Vorbis support],
[ case "${enableval}" in
yes) use_oggvorbis=true;
@ -94,7 +86,6 @@ AC_ARG_ENABLE(ssl,[ --enable-ssl Enable SSL support in web server],
AM_CONDITIONAL(COND_OGGVORBIS, test x$use_oggvorbis = xtrue)
AM_CONDITIONAL(COND_FLAC, test x$use_flac = xtrue)
AM_CONDITIONAL(COND_MUSEPACK, test x$use_musepack = xtrue)
AM_CONDITIONAL(COND_SQLITE3,test x$db_sqlite3 = xtrue)
AM_CONDITIONAL(COND_FFMPEG,test x$use_ffmpeg = xtrue)
AM_CONDITIONAL(COND_UPNP,test x$use_upnp = xtrue)
AM_CONDITIONAL(COND_SSL,test x$use_ssl = xtrue)
@ -103,26 +94,14 @@ AM_CONDITIONAL(COND_SSL,test x$use_ssl = xtrue)
#AM_CONDITIONAL(COND_NEED_STRSEP,false)
AC_CHECK_FUNCS(strcasestr strsep)
if test x$have_sql = xtrue; then
CPPFLAGS="${CPPFLAGS} -DHAVE_SQL"
fi
if test x$db_sqlite3 = xtrue; then
AM_CONDITIONAL(COND_SQL,true)
fi
if test x$db_sqlite3 = xfalse; then
echo "Must use --enable-sqlite3"
exit;
fi
dnl Darwin's stupid cpp preprocessor....
echo Host type is $host
CPPFLAGS="$CPPFLAGS -DHOST='\"$host\"'"
dnl Checks for libraries.
PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6.24 ])
PKG_CHECK_MODULES(SQLITE3, [ sqlite3 ],
AC_DEFINE(HAVE_SQLITE3, 1, [define if sqlite3 is available]))
AC_ARG_WITH(static-libs,
[--with-static-libs[[=DIR]] use static libs in DIR],[
@ -148,22 +127,6 @@ AC_ARG_WITH(ssl-libs,
fi
])
AC_ARG_WITH(sqlite3-includes,
[--with-sqlite3-includes[[=DIR]] use sqlite3 include files in DIR],[
if test "$withval" != "no" -a "$withval" != "yes"; then
Z_DIR=$withval
CPPFLAGS="${CPPFLAGS} -I$withval"
fi
])
AC_ARG_WITH(sqlite3-libs,
[--with-sqlite3-libs[[=DIR]] use sqlite3 lib files in DIR],[
if test "$withval" != "no" -a "$withval" != "yes"; then
Z_DIR=$withval
LDFLAGS="${LDFLAGS} -L$withval -R$withval"
fi
])
AC_ARG_WITH(ffmpeg-includes,
[--with-ffmpeg-includes[[=DIR]] use ffmpeg include files in DIR],[
if test "$withval" != "no" -a "$withval" != "yes"; then
@ -221,20 +184,6 @@ if test x$use_ssl = xtrue; then
fi
fi
OLDLIBS=$LIBS
if test x$db_sqlite3 = xtrue; then
AC_CHECK_HEADERS(sqlite3.h,, [
AC_MSG_ERROR([sqlite3.h not found... Must have sqlite3 headers installed])])
AC_CHECK_LIB(sqlite3,sqlite3_open,,echo "Must have sqlite3 libraries installed";exit)
LIBS=$OLDLIBS
if test x"$STATIC_LIBS" != x"no"; then
LIBS="${LIBS} ${STATIC_LIBS}/libsqlite3.a"
else
LIBS="${LIBS} -lsqlite3"
fi
fi
if test x$use_oggvorbis = xtrue; then
AC_CHECK_HEADERS(ogg/ogg.h,, [
AC_MSG_ERROR([ogg/ogg.h not found... Must have libogg installed for Ogg/Vorbis support])])

View File

@ -17,14 +17,6 @@ if COND_MUSEPACK
MUSEPACKSRC=scan-mpc.c
endif
if COND_SQLITE3
SQLITE3DB=db-sql-sqlite3.c db-sql-sqlite3.h
endif
if COND_SQL
SQLDB=db-sql.c db-sql.h
endif
if COND_UPNP
UPNP=upnp.c upnp.h
endif
@ -32,8 +24,8 @@ endif
wavstreamer_SOURCES = wavstreamer.c
mt_daapd_CPPFLAGS = @AVAHI_CFLAGS@
mt_daapd_LDADD = @AVAHI_LIBS@
mt_daapd_CPPFLAGS = @AVAHI_CFLAGS@ @SQLITE3_CFLAGS@
mt_daapd_LDADD = @AVAHI_LIBS@ @SQLITE3_LIBS@
mt_daapd_SOURCES = main.c daapd.h rend.h webserver.c \
webserver.h configfile.c configfile.h err.c err.h restart.c restart.h \
mp3-scanner.h mp3-scanner.c \
@ -46,11 +38,11 @@ mt_daapd_SOURCES = main.c daapd.h rend.h webserver.c \
ssl.h io.h io.c io-errors.h io-plugin.h \
bsd-snprintf.c bsd-snprintf.h \
rend-avahi.c \
db-sql.c db-sql.h db-sql-sqlite3.c db-sql-sqlite3.h\
$(OGGVORBISSRC) \
$(FLACSRC) $(MUSEPACKSRC) $(SQLITE3DB) $(SQLDB) \
$(FLACSRC) $(MUSEPACKSRC) \
$(UPNP)
EXTRA_DIST = scan-mpc.c \
scan-ogg.c scan-flac.c db-sql.c db-sql.h \
db-sql-sqlite3.h db-sql-sqlite3.c \
scan-ogg.c scan-flac.c \
ff-plugins.h ff-dbstruct.h upnp.c upnp.h ff-plugin-events.h

View File

@ -80,7 +80,7 @@ typedef struct tag_db_functions {
/** All supported backend databases, and pointers to the db specific implementations */
DB_FUNCTIONS db_functions[] = {
#ifdef HAVE_LIBSQLITE3
#ifdef HAVE_SQLITE3
{
"sqlite3",
db_sql_open_sqlite3,

View File

@ -48,7 +48,7 @@
#include "plugin.h"
#include "conf.h" /* FIXME */
#ifdef HAVE_LIBSQLITE3
#ifdef HAVE_SQLITE3
#include "db-sql-sqlite3.h"
#endif
@ -92,7 +92,7 @@ int (*db_sql_enum_restart_fn)(char **pe);
int (*db_sql_event_fn)(int event_type);
int (*db_sql_insert_id_fn)(void);
#ifdef HAVE_LIBSQLITE3
#ifdef HAVE_SQLITE3
int db_sql_open_sqlite3(char **pe, char *parameters) {
/* first, set our external links to sqlite3 */
db_sql_open_fn = db_sqlite3_open;

View File

@ -24,7 +24,7 @@
typedef char** SQL_ROW;
#ifdef HAVE_LIBSQLITE3
#ifdef HAVE_SQLITE3
extern int db_sql_open_sqlite3(char **pe, char *parameters);
#endif

View File

@ -22,10 +22,7 @@
#include "daapd.h"
#include "err.h"
#ifdef HAVE_SQL
extern int db_sql_escape(char *buffer, int *size, char *fmt, ...);
#endif
typedef struct tag_token {
int token_id;
@ -1338,7 +1335,6 @@ int sp_dispose(PARSETREE tree) {
return 1;
}
#ifdef HAVE_SQL
/**
* calculate the size required to render the tree as a
* sql query.
@ -1476,8 +1472,6 @@ char *sp_sql_clause(PARSETREE tree) {
return sql;
}
#endif /* HAVE_SQL */
/**
* if there was an error in a previous action (parsing?)