Index: configure
--- configure.orig	2004-06-18 11:34:27 +0200
+++ configure	2006-10-24 12:35:57 +0200
@@ -20124,7 +20124,7 @@
 echo "${ECHO_T}$ac_cv_lib_readline_add_history" >&6
 if test $ac_cv_lib_readline_add_history = yes; then
 
-	READLINE_LIBS="$READLINE_LIBS -lreadline"
+	READLINE_LIBS="-lreadline $READLINE_LIBS"
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_READLINE 1
Index: include/mdbsql.h
--- include/mdbsql.h.orig	2004-03-07 00:59:54 +0100
+++ include/mdbsql.h	2006-10-24 12:35:57 +0200
@@ -6,6 +6,10 @@
 #ifndef _mdbsql_h_
 #define _mdbsql_h_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct {
 	MdbHandle *mdb;
 	int all_columns;
@@ -78,4 +82,7 @@
 extern void mdb_sql_bind_column(MdbSQL *sql, int colnum, char *varaddr);
 extern void mdb_sql_bind_len(MdbSQL *sql, int colnum, int *len_ptr);
 
+#ifdef __cplusplus
+}
+#endif
 #endif
Index: include/mdbtools.h
--- include/mdbtools.h.orig	2004-06-17 01:42:19 +0200
+++ include/mdbtools.h	2006-10-24 12:35:57 +0200
@@ -41,6 +41,10 @@
 #define MDB_MEMO_OVERHEAD 12
 #define MDB_BIND_SIZE 16384
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum {
 	MDB_PAGE_DB = 0,
 	MDB_PAGE_DATA,
@@ -146,9 +150,6 @@
 #define IS_JET4(mdb) (mdb->f->jet_version==MDB_VER_JET4)
 #define IS_JET3(mdb) (mdb->f->jet_version==MDB_VER_JET3)
 
-/* hash to store registered backends */
-extern GHashTable	*mdb_backends;
-
 /* forward declarations */
 typedef struct mdbindex MdbIndex;
 typedef struct mdbsargtree MdbSargNode;
@@ -517,4 +518,7 @@
 extern int mdb_unicode2ascii(MdbHandle *mdb, unsigned char *buf, int offset, int len, char *dest);
 extern int mdb_ascii2unicode(MdbHandle *mdb, unsigned char *buf, int offset, int len, char *dest);
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* _mdbtools_h_ */
Index: src/libmdb/mem.c
--- src/libmdb/mem.c.orig	2004-05-30 07:06:27 +0200
+++ src/libmdb/mem.c	2006-10-24 12:36:22 +0200
@@ -18,7 +18,6 @@
  */
 
 #include "mdbtools.h"
-#include <locale.h>
 
 #ifdef DMALLOC
 #include "dmalloc.h"
Index: src/util/Makefile.in
--- src/util/Makefile.in.orig	2004-06-18 11:34:23 +0200
+++ src/util/Makefile.in	2006-10-24 12:35:57 +0200
@@ -156,7 +156,7 @@
 bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql mdb-ver mdb-prop mdb-import prtable prcat prdata prkkd prdump prole updrow prindex
 AM_CPPFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)
 LDADD = ../libmdb/libmdb.la 
-@SQL_TRUE@mdb_sql_LDADD = ../libmdb/libmdb.la ../sql/libmdbsql.la
+@SQL_TRUE@mdb_sql_LDADD = ../sql/libmdbsql.la ../libmdb/libmdb.la
 subdir = src/util
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
Index: src/util/mdb-ver.c
--- src/util/mdb-ver.c.orig	2004-04-14 07:58:53 +0200
+++ src/util/mdb-ver.c	2006-10-24 12:36:14 +0200
@@ -20,7 +20,6 @@
 #include "mdbtools.h"
 #include "mdbver.h"
 #include "mdbprivate.h"
-#include <locale.h>
 
 #ifdef DMALLOC
 #include "dmalloc.h"
Index: src/sql/lexer.l
--- src/sql/lexer.l.orig	2004-03-13 16:07:19 +0100
+++ src/sql/lexer.l	2008-01-02 11:43:40 +0100
@@ -43,18 +43,18 @@
 (>=)		{ return GTEQ; }
 like		{ return LIKE; }
 [ \t\r]	;
-\"[A-z][A-z0-9 _#@]*\"   {
+\"[A-Za-z][A-Za-z0-9 _#@]*\"   {
 				yylval.name = strdup(&yytext[1]);
 				yylval.name[strlen(yylval.name)-1]='\0';
 				return IDENT;
 			}
-[A-z][A-z0-9_#@]*		{ yylval.name = strdup(yytext); return NAME; }
+[A-Za-z][A-Za-z0-9_#@]*		{ yylval.name = strdup(yytext); return NAME; }
 
-'[A-z0-9 !@#$%^&*()-_+={}[\];:",.<>/?`~|\\]*'			{ yylval.name = strdup(yytext); return STRING; }
-(-*[0-9]+|([0-9]*\.[0-9]+)([eE][-+]?[0-9]+)?) { 
+'[A-Za-z0-9 !@#$%^&*()_+={}[\];:",.<>/?`~|\\-]*'			{ yylval.name = strdup(yytext); return STRING; }
+(-*[0-9]+|(([0-9]*\.[0-9]+)((e|E)[-+]?[0-9]+)?)) { 
 				yylval.name = strdup(yytext); return NUMBER; 
 			}
-~?(\/?[A-z0-9\.]+)+		{ yylval.name = strdup(yytext); return PATH; }
+~?(\/?[A-Za-z0-9\.]+)+		{ yylval.name = strdup(yytext); return PATH; }
 .	{ return yytext[0]; }
 %%
 
