[Libreoffice-commits] core.git: Branch 'feature/unitver' - config_host.mk.in configure.ac external/udunits2 RepositoryExternal.mk sc/CppunitTest_sc_ucalc.mk sc/CppunitTest_sc_units.mk sc/Library_sc.mk sc/source

Andrzej Hunt andrzej at ahunt.org
Tue Jun 2 05:54:30 PDT 2015


 RepositoryExternal.mk                         |   11 +++---
 config_host.mk.in                             |    3 +
 configure.ac                                  |   46 ++++++--------------------
 external/udunits2/ExternalProject_udunits2.mk |    5 ++
 sc/CppunitTest_sc_ucalc.mk                    |    2 -
 sc/CppunitTest_sc_units.mk                    |    2 -
 sc/Library_sc.mk                              |    2 -
 sc/source/core/units/unitsimpl.cxx            |    2 -
 sc/source/core/units/unitsimpl.hxx            |    2 -
 sc/source/core/units/util.cxx                 |    2 -
 sc/source/core/units/utunit.hxx               |    2 -
 11 files changed, 33 insertions(+), 46 deletions(-)

New commits:
commit d54cb9df9c81a0cc0d66b34eeb24ca163b1b0da6
Author: Andrzej Hunt <andrzej at ahunt.org>
Date:   Tue Jun 2 13:53:55 2015 +0100

    Enable --with-system-udunits2
    
    We also have to move udunits2 headers to match the default system
    installation location of ududnits2/udunits2.h (whereas udunits2 bundled
    build puts the headers in lib/udunits2.h by default).
    
    Change-Id: I1d314f6b3e016f90cfb8e19a143bb77ae98e7734

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 0bfc8bb..2f633bd 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -151,18 +151,21 @@ ifeq ($(ENABLE_CALC_UNITVERIFICATION),TRUE)
 
 ifneq ($(SYSTEM_UDUNITS2),)
 
-define gb_LinkTarget__use_libudunits2
+define gb_LinkTarget__use_udunits2
+$(call gb_LinkTarget_add_defs,$(1),\
+	-DSYSTEM_UDUNITS2 \
+)
 $(call gb_LinkTarget_set_include,$(1),\
 	$(UDUNITS2_CFLAGS) \
 	$$(INCLUDE) \
 )
-$(call gb_LinkTarget_add_libs,$(1),$(UDUNIT2_LIBS))
+$(call gb_LinkTarget_add_libs,$(1),$(UDUNITS2_LIBS))
 
 endef
 
 else # !SYSTEM_UDUNITS2
 
-define gb_LinkTarget__use_libudunits2
+define gb_LinkTarget__use_udunits2
 $(call gb_LinkTarget_use_package,$(1),udunits2)
 $(call gb_LinkTarget_set_include,$(1),\
 	$$(INCLUDE) \
@@ -184,7 +187,7 @@ endif # !SYSTEM_UDUNITS2
 
 else # !ENABLE_CALC_UNITVERIFICATION
 
-gb_LinkTarget__use_libudunits2 :=
+gb_LinkTarget__use_udunits2 :=
 
 endif # ENABLE_CALC_UNITVERIFICATION
 
diff --git a/config_host.mk.in b/config_host.mk.in
index 3e129c9..6f18d07 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -179,6 +179,9 @@ export ENABLE_TDE=@ENABLE_TDE@
 export ENABLE_TDEAB=@ENABLE_TDEAB@
 export ENABLE_TELEPATHY=@ENABLE_TELEPATHY@
 export ENABLE_CALC_UNITVERIFICATION=@ENABLE_CALC_UNITVERIFICATION@
+export SYSTEM_UDUNITS2=@SYSTEM_UDUNITS2@
+export UDUNITS2_CFLAGS=@UDUNITS2_CFLAGS@
+export UDUNITS2_LIBS=@UDUNITS2_LIBS@
 export ENABLE_VALGRIND=@ENABLE_VALGRIND@
 export ENABLE_VLC=@ENABLE_VLC@
 export ENABLE_WERROR=@ENABLE_WERROR@
diff --git a/configure.ac b/configure.ac
index d363ac5..e273f0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1693,7 +1693,7 @@ AC_ARG_WITH(system-firebird,
 
 AC_ARG_WITH(system-udunits2,
     AS_HELP_STRING([--with-system-udunits2],
-        [Use udunits libraries already on system, for building calc unit-verification it.]),,
+        [Use udunits libraries already on system, for building calc unit-verification with it.]),,
     [with_system_udunits2="$with_system_libs"])
 
 AC_ARG_WITH(system-hsqldb,
@@ -8643,48 +8643,26 @@ if test "x$enable_calc_unitverification" = "xyes"; then
     if test "$with_system_udunits2" = "yes"; then
         AC_MSG_RESULT([external])
         SYSTEM_UDUNITS2=TRUE
-        AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
-        if test -z "$FIREBIRDCONFIG"; then
-            AC_MSG_NOTICE([No fb_config -- using pkg-config])
-            PKG_CHECK_MODULES(FIREBIRD, fbembed)
-            FIREBIRD_VERSION=`pkg-config --modversion fbembed`
-        else
-            AC_MSG_NOTICE([fb_config found])
-            FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
-            AC_MSG_CHECKING([for Firebird Client library])
-            FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
-            FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
-        fi
-        AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
-        AC_MSG_CHECKING([Firebird version])
-        if test -n "${FIREBIRD_VERSION}"; then
-            FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
-            FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
-            if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
-                AC_MSG_RESULT([OK])
-            else
-                AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
-            fi
-        else
-            __save_CFLAGS="${CFLAGS}"
-            CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
-            AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
-#if defined(FB_API_VER) && FB_API_VER == 25
-#else
-#error "Wrong Firebird API version"
-#endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
-            CFLAGS="${__save_CFLAGS}"
+
+        PKG_CHECK_MODULES(UDUNITS2, udunits >= 2.2.1, UDUNITS2_PKGCONFIG=yes, UDUNITS2_PKGCONFIG=no)
+
+        if test "x$UDUNITS2_PKGCONFIG" = "xno"; then
+            AC_CHECK_HEADER(udunits2/udunits2.h, [],
+                [AC_MSG_ERROR(udunits2/ududunits2.h not found. install udunits2)], [])
+            AC_CHECK_LIB([udunits2], [ut_read_xml], [:], [AC_MSG_ERROR(udunits2 lib not found or functional)], [])
         fi
-        ENABLE_FIREBIRD_SDBC="TRUE"
+
+        ENABLE_CALC_UNITVERIFICATION="TRUE"
     else
         AC_MSG_RESULT([internal])
         SYSTEM_UDUNITS2=
         UDUNITS2_CFLAGS="-I${WORKDIR}/UnpackedTarball/udunits2/lib"
-        UDUNITS2_LIBS="-ludunits2"
 
         BUILD_TYPE="$BUILD_TYPE UDUNITS2"
         ENABLE_CALC_UNITVERIFICATION="TRUE"
     fi
+
+    UDUNITS2_LIBS="-ludunits2"
 fi
 AC_SUBST(ENABLE_CALC_UNITVERIFICATION)
 AC_SUBST(SYSTEM_UDUNITS2)
diff --git a/external/udunits2/ExternalProject_udunits2.mk b/external/udunits2/ExternalProject_udunits2.mk
index fd54fc4..ba6479e 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -20,7 +20,10 @@ $(eval $(call gb_ExternalProject_register_targets,udunits2,\
 
 $(call gb_ExternalProject_get_state_target,udunits2,build) : $(call gb_ExternalProject_get_state_target,udunits2,configure)
 	+$(call gb_ExternalProject_run,build,\
-		cd lib && $(MAKE) libudunits2.la \
+		cd lib && \
+	    $(MAKE) libudunits2.la && \
+		mkdir udunits2 && \
+		cp udunits2.h udunits2/ \
 	)
 
 $(call gb_ExternalProject_get_state_target,udunits2,configure) :
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index 4d35f78..db3ecdf 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -35,7 +35,7 @@ $(eval $(call gb_CppunitTest_use_externals,sc_ucalc,\
     icui18n \
     icuuc \
     $(if $(ENABLE_CALC_UNITVERIFICATION), \
-        libudunits2 \
+        udunits2 \
     ) \
 	libxml2 \
 	mdds_headers \
diff --git a/sc/CppunitTest_sc_units.mk b/sc/CppunitTest_sc_units.mk
index 241836b..9af3d7e 100644
--- a/sc/CppunitTest_sc_units.mk
+++ b/sc/CppunitTest_sc_units.mk
@@ -29,7 +29,7 @@ $(eval $(call gb_CppunitTest_use_externals,sc_units,\
     icu_headers \
     icui18n \
     icuuc \
-	libudunits2 \
+	udunits2 \
 	libxml2 \
 	mdds_headers \
 	orcus \
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 5d96108..db8f2f9 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -48,7 +48,7 @@ $(eval $(call gb_Library_use_externals,sc,\
     icuuc \
     libxml2 \
     $(if $(ENABLE_CALC_UNITVERIFICATION), \
-        libudunits2 \
+        udunits2 \
     ) \
     mdds_headers \
 ))
diff --git a/sc/source/core/units/unitsimpl.cxx b/sc/source/core/units/unitsimpl.cxx
index 6332747..c440df6 100644
--- a/sc/source/core/units/unitsimpl.cxx
+++ b/sc/source/core/units/unitsimpl.cxx
@@ -55,7 +55,7 @@ UnitsImpl::UnitsImpl() {
     // System udunits will (/should) be able to find it's unit database
     // itself -- however for bundled udunits we always need to find the
     // correct relative path within our LO installation.
-#ifdef USING_SYSTEM_UDUNITS
+#ifdef SYSTEM_UDUNITS2
     const sal_Char* pPath = 0;
 #else
     OUString sDBURL("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/udunits2/udunits2.xml");
diff --git a/sc/source/core/units/unitsimpl.hxx b/sc/source/core/units/unitsimpl.hxx
index 934bb26..f3e2cb8 100644
--- a/sc/source/core/units/unitsimpl.hxx
+++ b/sc/source/core/units/unitsimpl.hxx
@@ -19,7 +19,7 @@
 #include <osl/mutex.hxx>
 #include <rtl/ustring.hxx>
 
-#include <udunits2.h>
+#include <udunits2/udunits2.h>
 
 #include "rangelst.hxx"
 #include "units.hxx"
diff --git a/sc/source/core/units/util.cxx b/sc/source/core/units/util.cxx
index 2146c43..b536e99 100644
--- a/sc/source/core/units/util.cxx
+++ b/sc/source/core/units/util.cxx
@@ -9,7 +9,7 @@
  */
 #include "util.hxx"
 
-#include <udunits2.h>
+#include <udunits2/udunits2.h>
 
 namespace sc {
 namespace units {
diff --git a/sc/source/core/units/utunit.hxx b/sc/source/core/units/utunit.hxx
index 5d1442a..8508f93 100644
--- a/sc/source/core/units/utunit.hxx
+++ b/sc/source/core/units/utunit.hxx
@@ -15,7 +15,7 @@
 #include <boost/optional.hpp>
 #include <boost/shared_ptr.hpp>
 
-#include <udunits2.h>
+#include <udunits2/udunits2.h>
 
 namespace sc {
 namespace units {


More information about the Libreoffice-commits mailing list