[Libreoffice] [PATCH] Use the correct db includes and obey LDFLAGS

Thomas Klausner wiz at NetBSD.org
Fri Nov 5 06:52:33 PDT 2010


On Fri, Nov 05, 2010 at 12:22:37PM +0100, Robert Nagy wrote:
> diff --git a/configure.in b/configure.in
> index aab3995..6f72931 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -4368,11 +4368,16 @@ 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 ],
> +    if test "$_os" = "OpenBSD" ; then
> +        DBDIR=/usr/local/include/db4
> +    else
> +        DBDIR=/usr/include/db4
> +    fi
> +    CFLAGS=-I$DBDIR
> +    AC_CHECK_HEADER(db4/db.h, [ DB_INCLUDES=$DBDIR ],

This is not good, it will check for /usr/{local/,}include/db4/db4/db.h

>          [
> -             CFLAGS=-I/usr/include/db4
> -             AC_CHECK_HEADER(db4/db.h,
> -             [ DB_INCLUDES=/usr/include/db4 ],
> +             AC_CHECK_HEADER(db.h,
> +             [ DB_INCLUDES=/usr/include ],
>               [ AC_MSG_ERROR(no. install the db4 libraries) ], []+             )
>          ], []
>      )
> @@ -5383,7 +5388,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", [])

Here, probably also the CFLAGS should be kept.

I've used the attached patch so far, but it needs to be much improved
before it can be committed, so I didn't commit it yet. The db4 library
is called libdb4 in pkgsrc, so it contains an additional chunk.

This patch is far from final though:
. the configure check should honor C{,PP}FLAGS instead of hardcoding paths
. checking for db4/db.h and finding it just makes the build fail
  later, since ${PREFIX}/include/db4 isn't added to the C{,PP}FLAGS
  and the source code only includes <db.h>, not <db4/db.h>
. the library name detection should be improved
So it needs much more work which I didn't want to spend right now.
 Thomas
-------------- next part --------------
diff --git a/configure.in b/configure.in
index 9855b3b..4a32d79 100644
--- a/configure.in
+++ b/configure.in
@@ -4357,24 +4357,24 @@ 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 ],
+    AC_CHECK_HEADER(db.h, [ DB_INCLUDES=/usr/pkg/include ],
         [
-             CFLAGS=-I/usr/include/db4
+             CFLAGS=-I/usr/pkg/include/db4
              AC_CHECK_HEADER(db4/db.h,
-             [ DB_INCLUDES=/usr/include/db4 ],
+             [ DB_INCLUDES=/usr/pkg/include/db4 ],
              [ AC_MSG_ERROR(no. install the db4 libraries) ], []+             )
         ], []
     )
     AC_MSG_CHECKING([whether db is at least 4.1])
     AC_TRY_RUN([
-#include <db.h>
+#include <db4/db.h>
 
 int main(int argc, char **argv) {
        if(DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)) return 0;
        else return 1;
 }
     ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no. you need at least db 4.1])])
-    AC_HAVE_LIBRARY(db, [],
+    AC_HAVE_LIBRARY(db4, [],
       [AC_MSG_ERROR([db not installed or functional])], [])
     SCPDEFS="$SCPDEFS -DSYSTEM_DB"
 else
@@ -5371,8 +5371,8 @@ elif test "$_os" != "WINNT" ; then
    if test -z "$x_includes"; then
       AC_MSG_ERROR([No X includes found]) # Exit
    fi
-   CFLAGS=$X_CFLAGS
-   LDFLAGS="$X_LDFLAGS $X_LIBS"
+   CFLAGS="$CFLAGS $X_CFLAGS"
+   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", [])


More information about the LibreOffice mailing list