--- config_office/configure.in.orig.port	Wed Apr 18 03:46:23 2007
+++ config_office/configure.in	Wed Apr 18 03:46:24 2007
@@ -808,6 +808,16 @@ case "$build_os" in
 		AC_MSG_RESULT([$PTHREAD_LIBS])
 		_os=FreeBSD
 		;;
+        openbsd*)
+                test_x=yes
+                test_gtk=yes
+                build_cairo=yes
+                test_kde=yes
+                test_cups=yes
+                PTHREAD_CFLAGS="-pthread -D_THREAD_SAFE"
+                PTHREAD_LIBS="-pthread"
+                _os=OpenBSD
+                ;;
 	osf)
 		test_cups=no
 		_os=OSF1
@@ -2469,11 +2479,11 @@ dnl ==================================================
 dnl Checks for programs.
 dnl ===================================================================
 dnl Check whether there's a C pre-processor.
-if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "NetBSD" ; then
+if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" ; then
    AC_PROG_CPP
 fi
 dnl Check whether there's a C++ pre-processor.
-if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "NetBSD" ; then
+if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" ; then
    AC_PROG_CXXCPP
 fi
 
@@ -2603,6 +2613,9 @@ if test "$_os" != "WINNT" -a \( "z$enable_epm" = "z" -
 	AIX)
 		PKGFORMAT=aix
 		;;
+	OpenBSD)
+		PKGFORMAT=portable
+		;;
 	*BSD)
 		PKGFORMAT=bsd
 		;;
@@ -2932,7 +2945,7 @@ if test -n "$with_system_libwpd" -o -n "$with_system_l
         test "$with_system_libwpd" != "no"; then
     AC_MSG_RESULT([external])
     SYSTEM_LIBWPD=YES
-    PKG_CHECK_MODULES( LIBWPD, libwpd-0.8 )
+    PKG_CHECK_MODULES( LIBWPD, libwpd )
 else
     AC_MSG_RESULT([internal])
     SYSTEM_LIBWPD=NO
@@ -2996,12 +3009,13 @@ if test -n "$with_system_python" && test "$with_system
 
    python_include=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('INCLUDEPY');"`
    python_version=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('VERSION');"`
+   python_libs=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBS');"`
    PYTHON_CFLAGS="-I$python_include"
 
    if test "$_os" = "Darwin"; then
       PYTHON_LIBS="-framework Python"
    else
-      PYTHON_LIBS="-lpython$python_version"
+      PYTHON_LIBS="-lpython$python_version $python_libs"
    fi
    
    dnl check if the headers really work:
@@ -3031,16 +3045,13 @@ if test -n "$with_system_db" -o -n "$with_system_libs"
 	test "$with_system_db" != "no"; then
     SYSTEM_DB=YES
     AC_MSG_RESULT([external])
-    AC_CHECK_HEADER(db.h, [ DB_INCLUDES=/usr/include ],
-        [
-             CFLAGS=-I/usr/include/db4
-             AC_CHECK_HEADER(db4/db.h,
-             [ DB_INCLUDES=/usr/include/db4 ],
-             [ AC_MSG_ERROR(no. install the db4 libraries) ], []+             )
-        ], []
+    AC_CHECK_HEADER(db4/db.h, [ DB_INCLUDES=${prefix}/include/db4 ],
+             [ AC_MSG_ERROR(no. install the db4 libraries) ], []
     )
     AC_MSG_CHECKING([whether db is at least 4.1])
     # FIXME: Will db 4.3 work? Can't test it since the 4.3 java bindings are not packaged :/
+    save_CXXFLAGS=$CXXFLAGS
+    CXXFLAGS=-I$DB_INCLUDES
     for v in 1 2; do
        AC_TRY_RUN([
 #include <db.h>
@@ -3051,6 +3062,7 @@ int main(int argc, char **argv) {
 }
        ], [DB_VERSION_MINOR=$v], [])
     done
+    CXXFLAGS=$save_CXXFLAGS
     if test "$DB_VERSION_MINOR" -gt "1"; then
        AC_MSG_RESULT([OK])
        DB_VERSION=4.$DB_VERSION_MINOR
@@ -3776,7 +3788,7 @@ elif test "$_os" != "WINNT" ; then
       AC_MSG_ERROR([No X includes found]) # Exit
    fi
    CFLAGS=$X_CFLAGS
-   LDFLAGS="$X_LDFLAGS $X_LIBS"
+   LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
    AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
    dnl Check if the XauDisposeAuth symbol is provided by libXau.
    AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
@@ -3969,7 +3981,6 @@ if test -n "$with_system_neon" -o -n "$with_system_lib
 	test "$with_system_neon" != "no"; then
         AC_MSG_RESULT([external])
         PKG_CHECK_MODULES(NEON, neon >= 0.24.0)
-        PKG_CHECK_MODULES(NEON, neon < 0.27.0, , AC_MSG_ERROR([you need neon 0.24.x to 0.26.x for system-neon]))
         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
         NEON_CFLAGS="$NEON_CFLAGS -DSYSTEM_NEON -DUSE_DAV_LOCKS=1"
         SYSTEM_NEON=YES
@@ -4731,7 +4742,7 @@ if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" 
 
     dnl What to test
     qt_test_include="qstyle.h"
-    qt_test_library="libqt-mt.so"
+    qt_test_library="libqt-mt.so*"
     kde_test_include="ksharedptr.h"
     kde_test_library="libkdeui.la"
 
@@ -4754,7 +4765,7 @@ your Qt installation by exporting QTDIR before running
     AC_MSG_CHECKING([for Qt libraries])
     qt_libdir="no"
     for qt_check in $qt_libdirs ; do
-        if test -r "$qt_check/$qt_test_library" ; then
+        if test -r "`ls $qt_check/$qt_test_library | head -1`" ; then
             qt_libdir="$qt_check"
             break
         fi
