[Libreoffice-commits] core.git: config_host/config_box2d.h.in configure.ac slideshow/source

Rene Engelhard (via logerrit) logerrit at kemper.freedesktop.org
Sat Oct 17 12:20:20 UTC 2020


 config_host/config_box2d.h.in          |    7 +++++++
 configure.ac                           |   21 ++++++++++++++++-----
 slideshow/source/engine/box2dtools.cxx |    3 ++-
 3 files changed, 25 insertions(+), 6 deletions(-)

New commits:
commit d0601cd3812cbcdaa0decf81c81d73d41a6ccb91
Author:     Rene Engelhard <rene at debian.org>
AuthorDate: Sat Oct 17 11:24:42 2020 +0200
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Oct 17 14:19:44 2020 +0200

    fix build with box2d 2.4.0
    
    Change-Id: I60f25f04e2bfcdabf832f42b44ba3d945f4ec169
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104456
    Tested-by: Jenkins
    Tested-by: René Engelhard <rene at debian.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/config_host/config_box2d.h.in b/config_host/config_box2d.h.in
new file mode 100644
index 000000000000..cc761536dc04
--- /dev/null
+++ b/config_host/config_box2d.h.in
@@ -0,0 +1,7 @@
+#ifndef CONFIG_BOX2D_H
+#define CONFIG_BOX2D_H
+
+/* Box2D/Box2D.h is 2.3, 2.4 has box2d/box2d.h */
+#define BOX2D_HEADER <Box2D/Box2D.h>
+
+#endif
diff --git a/configure.ac b/configure.ac
index 08c4e39cbe64..894efc1b7eaa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10724,11 +10724,21 @@ if test "$with_system_box2d" = "yes"; then
     AC_MSG_RESULT([external])
     SYSTEM_BOX2D=TRUE
     AC_LANG_PUSH([C++])
-    AC_CHECK_HEADER(Box2D/Box2D.h, [],
-        [AC_MSG_ERROR(box2d headers not found.)], [])
-    AC_CHECK_LIB([Box2D], [main], [:],
-        [ AC_MSG_ERROR(box2d library not found.) ], [])
-    BOX2D_LIBS=-lBox2D
+    AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
+        [BOX2D_H_FOUND='FALSE'])
+    if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
+    	_BOX2D_LIB=box2d
+    	AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
+    else
+	# fail this. there's no other alternative to check when we are here.
+    	AC_CHECK_HEADER([Box2D/Box2D.h], [],
+		[AC_MSG_ERROR(box2d headers not found.)])
+    	_BOX2D_LIB=Box2D
+    	AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
+    fi
+    AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
+    	[ AC_MSG_ERROR(box2d library not found.) ], [])
+    BOX2D_LIBS=-l$_BOX2D_LIB
     AC_LANG_POP([C++])
     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
     FilterLibs "${BOX2D_LIBS}"
@@ -13946,6 +13956,7 @@ AC_CONFIG_FILES([config_host.mk
                  instsetoo_native/util/openoffice.lst
                  sysui/desktop/macosx/Info.plist])
 AC_CONFIG_HEADERS([config_host/config_buildid.h])
+AC_CONFIG_HEADERS([config_host/config_box2d.h])
 AC_CONFIG_HEADERS([config_host/config_clang.h])
 AC_CONFIG_HEADERS([config_host/config_dconf.h])
 AC_CONFIG_HEADERS([config_host/config_eot.h])
diff --git a/slideshow/source/engine/box2dtools.cxx b/slideshow/source/engine/box2dtools.cxx
index db91ccbb57e7..c822f564a008 100644
--- a/slideshow/source/engine/box2dtools.cxx
+++ b/slideshow/source/engine/box2dtools.cxx
@@ -8,7 +8,8 @@
  */
 
 #include <box2dtools.hxx>
-#include <Box2D/Box2D.h>
+#include <config_box2d.h>
+#include BOX2D_HEADER
 
 #include <shapemanager.hxx>
 #include <attributableshape.hxx>


More information about the Libreoffice-commits mailing list