configure.ac                  |   23 +++++++++++++++++++++++
 tools/Library_tl.mk           |   13 ++++++++++++-
 vcl/Library_vcl.mk            |    1 +
 vcl/source/fontsubset/sft.cxx |    4 ++++
 4 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 90babff28406d5366df153e2d3c6d4206f06d614
Author:     Rene Engelhard <r...@rene-engelhard.de>
AuthorDate: Sun Mar 20 14:45:28 2022 +0100
Commit:     René Engelhard <r...@debian.org>
CommitDate: Sun Mar 20 22:26:29 2022 +0100

    add system-libfixmath
    
    Change-Id: Ia0bd884d6fefde77c75889bf2ea831ebf1b401cd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131876
    Tested-by: Jenkins
    Tested-by: René Engelhard <r...@debian.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: René Engelhard <r...@debian.org>

diff --git a/configure.ac b/configure.ac
index 1e26c8be4225..250de34971ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2439,6 +2439,11 @@ AC_ARG_WITH(system-dragonbox,
         [Use dragonbox already on system.]),,
     [with_system_dragonbox="$with_system_headers"])
 
+AC_ARG_WITH(system-libfixmath,
+    AS_HELP_STRING([--with-system-libfixmath],
+        [Use libfixmath already on system.]),,
+    [with_system_libfixmath="$with_system_libs"])
+
 AC_ARG_WITH(system-glm,
     AS_HELP_STRING([--with-system-glm],
         [Use glm already on system.]),,
@@ -10578,6 +10583,24 @@ fi
 AC_SUBST([SYSTEM_DRAGONBOX])
 AC_SUBST([DRAGONBOX_CFLAGS])
 
+dnl ===================================================================
+dnl Check for system libfixmath
+dnl ===================================================================
+AC_MSG_CHECKING([which libfixmath to use])
+if test "$with_system_libfixmath" = "yes"; then
+    AC_MSG_RESULT([external])
+    SYSTEM_LIBFIXMATH=TRUE
+    AC_LANG_PUSH([C++])
+    AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
+       [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], 
[])
+    AC_CHECK_LIB([libfixmath], [fix16_mul], [:], [AC_MSG_ERROR(libfixmath lib 
not found or functional)], [])
+    AC_LANG_POP([C++])
+else
+    AC_MSG_RESULT([internal])
+    SYSTEM_LIBFIXMATH=
+fi
+AC_SUBST([SYSTEM_LIBFIXMATH])
+
 dnl ===================================================================
 dnl Check for system glm
 dnl ===================================================================
diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk
index 63a048aa565d..bccbf95a2a01 100644
--- a/tools/Library_tl.mk
+++ b/tools/Library_tl.mk
@@ -69,7 +69,6 @@ $(eval $(call gb_Library_add_exception_objects,tl,\
     tools/source/memtools/multisel \
     tools/source/misc/cpuid \
     tools/source/misc/extendapplicationenvironment \
-    tools/source/misc/fix16 \
     tools/source/misc/json_writer \
     tools/source/ref/globname \
     tools/source/ref/ref \
@@ -82,6 +81,12 @@ $(eval $(call gb_Library_add_exception_objects,tl,\
     tools/source/xml/XmlWalker \
 ))
 
+ifneq ($(SYSTEM_LIBFIXMATH),TRUE)
+$(eval $(call gb_Library_add_exception_objects,tl,\
+    tools/source/misc/fix16 \
+))
+endif
+
 ifeq ($(OS),WNT)
 $(eval $(call gb_Library_add_exception_objects,tl, \
     tools/source/stream/strmwnt \
@@ -108,6 +113,12 @@ $(eval $(call gb_Library_add_libs,tl,\
 ))
 endif
 
+ifeq ($(SYSTEM_LIBFIXMATH),TRUE)
+$(eval $(call gb_Library_add_libs,tl,\
+       -llibfixmath \
+))
+endif
+
 ifeq ($(OS),WNT)
 
 $(eval $(call gb_Library_use_system_win32_libs,tl,\
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index d580ff3d2f6a..31cf81c8bd0d 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_Library_add_defs,vcl,\
     -DDESKTOP_DETECTOR_DLL_NAME=\"$(call 
gb_Library_get_runtime_filename,$(call 
gb_Library__get_name,desktop_detector))\" \
     -DTK_DLL_NAME=\"$(call gb_Library_get_runtime_filename,$(call 
gb_Library__get_name,tk))\" \
     $(if $(SYSTEM_GLM),-DGLM_ENABLE_EXPERIMENTAL) \
+    $(if $(SYSTEM_LIBFIXMATH),-DSYSTEM_LIBFIXMATH) \
 ))
 
 $(eval $(call gb_Library_use_sdk_api,vcl))
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 800f161a744a..a164757a886d 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -36,7 +36,11 @@
 #endif
 #include <sft.hxx>
 #include <impfontcharmap.hxx>
+#ifdef SYSTEM_LIBFIXMATH
+#include <libfixmath/fix16.hpp>
+#else
 #include <tools/fix16.hxx>
+#endif
 #include "ttcr.hxx"
 #include "xlat.hxx"
 #include <rtl/crc.h>

Reply via email to