summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac26
-rw-r--r--src/Makefile.am8
-rw-r--r--src/sqlite/SQLiteWrapper.cpp1
-rw-r--r--src/sqlite/SQLiteWrapper.h1
-rw-r--r--src/storage.h2
5 files changed, 26 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 29a898b1..93ac8d95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,14 +3,27 @@ AC_INIT([TMW Server], [0.0.1], [b_lindeijer@users.sourceforge.net])
AC_CONFIG_HEADERS([config.h:config.h.in])
AM_INIT_AUTOMAKE
-# Check with pkg-config
-PKG_CHECK_MODULES(SQLITE, [sqlite3 >= 3.0.6],
+# Check if with sqlite
+AC_ARG_WITH(sqlite,[ --with-sqlite support SQLite ] )
+if test "x$with_sqlite" == "xyes"; then
+ with_sqlite=yes
+
+ # Check with pkg-config
+ PKG_CHECK_MODULES(SQLITE, [sqlite3 >= 3.0.6],
[],
[AC_MSG_ERROR([Cannot find SQLite 3])]
-)
+ )
+
+ # Add define
+ SQLITE_CFLAGS=" -DSQLITE_SUPPORT $SQLITE_SUPPORT"
+
+ AC_SUBST(SQLITE_CFLAGS)
+ AC_SUBST(SQLITE_LIBS)
+else
+ with_sqlite=no
+fi
-AC_SUBST(SQLITE_CFLAGS)
-AC_SUBST(SQLITE_LIBS)
+AM_CONDITIONAL(BUILD_SQLITE, test x$with_sqlite = xyes)
# Checks for programs.
AC_PROG_CXX
@@ -35,7 +48,6 @@ else
with_scripting=no
fi
-
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([string.h])
@@ -53,3 +65,5 @@ AC_OUTPUT
echo
echo "Building with scripting support: $with_scripting"
+echo "Building with SQLite support: $with_sqlite"
+echo
diff --git a/src/Makefile.am b/src/Makefile.am
index 7d4a512b..8c3a9271 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,8 +19,6 @@ tmwserv_SOURCES = main.cpp \
netsession.cpp \
packet.h \
packet.cpp \
- sqlite/SQLiteWrapper.cpp \
- sqlite/SQLiteWrapper.h \
log.h \
log.cpp \
skill.h \
@@ -31,6 +29,12 @@ tmwserv_SOURCES = main.cpp \
script-squirrel.cpp \
storage.cpp storage.h
+
+if BUILD_SQLITE
+tmwserv_SOURCES += sqlite/SQLiteWrapper.cpp \
+ sqlite/SQLiteWrapper.h
+endif
+
# set the include path found by configure
INCLUDES= $(all_includes) $(SQLITE_CFLAGS)
LIBS = $(SQLITE_LIBS)
diff --git a/src/sqlite/SQLiteWrapper.cpp b/src/sqlite/SQLiteWrapper.cpp
index eef2498f..f5b484b7 100644
--- a/src/sqlite/SQLiteWrapper.cpp
+++ b/src/sqlite/SQLiteWrapper.cpp
@@ -263,4 +263,3 @@ bool SQLiteWrapper::Commit() {
bool SQLiteWrapper::Rollback() {
return DirectStatement("rollback");
}
-
diff --git a/src/sqlite/SQLiteWrapper.h b/src/sqlite/SQLiteWrapper.h
index 324fdb66..419e3d50 100644
--- a/src/sqlite/SQLiteWrapper.h
+++ b/src/sqlite/SQLiteWrapper.h
@@ -137,4 +137,3 @@ class SQLiteWrapper {
};
#endif
-
diff --git a/src/storage.h b/src/storage.h
index da30c083..8fd981a0 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -23,8 +23,6 @@
#ifndef STORAGE_H
#define STORAGE_H
-#define SQLITE_SUPPORT // For now
-
#ifdef SQLITE_SUPPORT
#include "sqlite/SQLiteWrapper.h"
#endif