diff -r f5f0877e4bdf acinclude.m4
--- a/acinclude.m4	Sat Jul 26 21:51:54 2008 +0200
+++ b/acinclude.m4	Sun Jul 27 00:19:09 2008 +0200
@@ -254,6 +254,75 @@
 ])
 
 dnl ---------------------------------------------------------------------------
+dnl Macro: AC_CHECK_FIREBIRD
+dnl First check for custom Firebird RDBMS paths in --with-firebird-* options.
+dnl If some paths are missing,  check if fb_config exists. 
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_CHECK_FIREBIRD],[
+
+# Check for custom includes path
+if test [ -z "$ac_cv_firebird_includes" ] 
+then 
+	AC_ARG_WITH([firebird-includes], 
+		AC_HELP_STRING([--with-firebird-includes], [path to Firebird RDBMS header files]),
+		[ac_cv_firebird_includes=$withval])
+fi
+if test [ -n "$ac_cv_firebird_includes" ]
+then
+	AC_CACHE_CHECK([Firebird RDBMS includes], [ac_cv_firebird_includes], [ac_cv_firebird_includes=""])
+	FIREBIRD_CFLAGS="-I$ac_cv_firebird_includes"
+fi
+
+# Check for custom library path
+if test [ -z "$ac_cv_firebird_libs" ]
+then
+	AC_ARG_WITH([firebird-libs], 
+		AC_HELP_STRING([--with-firebird-libs], [path to Firebird RDBMS libraries]),
+		[ac_cv_firebird_libs=$withval])
+fi
+if test [ -n "$ac_cv_firebird_libs" ]
+then
+	AC_CACHE_CHECK([Firebird RDBMS libraries], [ac_cv_firebird_libs], [ac_cv_firebird_libs=""])
+	FIREBIRD_LIBS="-L$ac_cv_firebird_libs -lfbclient"
+fi
+
+# If some path is missing, try to autodetermine with fb_config
+if test [ -z "$ac_cv_firebird_includes" -o -z "$ac_cv_firebird_libs" ]
+then
+    if test [ -z "$fbconfig" ]
+    then 
+        AC_PATH_PROG(fbconfig,fb_config)
+    fi
+    if test [ -z "$fbconfig" ]
+    then
+        AC_MSG_ERROR([fb_config executable not found
+********************************************************************************
+ERROR: cannot find Firebird RDBMS libraries. If you want to compile with 
+       Firebird RDBMS support, you must either specify file locations explicitly 
+       using --with-firebird-includes and --with-firebird-libs options, or make 
+       sure path to fb_config is listed in your PATH environment variable. If you
+       want to disable Firebird RDBMS support, use --without-firebird option.
+********************************************************************************
+])
+    else
+        if test [ -z "$ac_cv_firebird_includes" ]
+        then
+            AC_MSG_CHECKING(Firebird RDBMS C flags)
+            FIREBIRD_CFLAGS="`${fbconfig} --cflags`"
+            AC_MSG_RESULT($FIREBIRD_CFLAGS)
+        fi
+        if test [ -z "$ac_cv_firebird_libs" ]
+        then
+            AC_MSG_CHECKING(Firebird RDBMS linker flags)
+            FIREBIRD_LIBS="`${fbconfig} --libs`"
+            AC_MSG_RESULT($FIREBIRD_LIBS)
+        fi
+    fi
+fi
+])
+
+dnl ---------------------------------------------------------------------------
 dnl Macro: SPHINX_CONFIGURE_PART
 dnl
 dnl Tells what stage is ./configure running now, nicely formatted
diff -r f5f0877e4bdf configure.ac
--- a/configure.ac	Sat Jul 26 21:51:54 2008 +0200
+++ b/configure.ac	Sun Jul 27 00:19:09 2008 +0200
@@ -123,7 +123,6 @@
 fi
 AM_CONDITIONAL(USE_MYSQL, test x$ac_cv_use_mysql != xno)
 
-
 # check if we should compile with PostgreSQL support
 AC_ARG_WITH([pgsql],
             AC_HELP_STRING([--with-pgsql], [compile with PostgreSQL support (default is disabled)]),
@@ -141,9 +140,25 @@
 fi
 AM_CONDITIONAL(USE_PGSQL, test x$ac_cv_use_pgsql != xno)
 
+# Check if we should compile with Firebird support
+AC_ARG_WITH([firebird],
+            AC_HELP_STRING([--with-firebird], [compile with Firebird RDMS support (default is disabled)]),
+            [ac_cv_use_firebird=$withval], [ac_cv_use_firebird=no]
+)
+AC_MSG_CHECKING([whether to compile with Firebird RDMS support])
+if test x$ac_cv_use_firebird != xno; then
+	AC_MSG_RESULT([yes])
+    AC_CHECK_FIREBIRD([$ac_cv_use_firebird])
+    AC_DEFINE(USE_FIREBIRD,1,[Define to 1 if you want to compile with Firebird RDMS support])
+    AC_SUBST([FIREBIRD_LIBS])
+    AC_SUBST([FIREBIRD_CFLAGS])
+else
+	AC_MSG_RESULT([no])
+fi
+AM_CONDITIONAL(USE_FIREBIRD, test x$ac_cv_use_firebird != xno)
 
 # we can now set preprocessor flags for both C and C++ compilers
-CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS $PGSQL_CFLAGS"
+CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS $PGSQL_CFLAGS $FIREBIRD_CFLAGS"
 
 dnl ---
 
diff -r f5f0877e4bdf src/Makefile.am
--- a/src/Makefile.am	Sat Jul 26 21:51:54 2008 +0200
+++ b/src/Makefile.am	Sun Jul 27 00:19:09 2008 +0200
@@ -27,7 +27,7 @@
 AM_CPPFLAGS = -DSYSCONFDIR="\"$(sysconfdir)\""
 endif
 
-COMMON_LIBS = libsphinx.a $(LIBSTEMMER_LIBS) $(MYSQL_LIBS) $(PGSQL_LIBS)
+COMMON_LIBS = libsphinx.a $(LIBSTEMMER_LIBS) $(MYSQL_LIBS) $(PGSQL_LIBS) $(FIREBIRD_LIBS)
 LDADD = $(COMMON_LIBS)
 
 EXTRA_DIST = indexer.vcproj libsphinx.vcproj searchd.vcproj search.vcproj
