tdf#103829 ods export: output <text:tab/> when CELLTYPE_EDIT
[LibreOffice.git] / m4 / libo_externals.m4
blob7f2b04305c4795a82d6e70d15a1bdf7149eb0954
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # <$1 lowercase variable part - used for variables and configure switches>
10 # <$2 uppercase variable part - used for configure.ac and make variables>
11 # <$3 pkg-config query string>
12 # [$4 if optional, default to: enabled, disabled or fixed (default: fixed)]
13 # [$5 which is preferred: (fixed-|test-)system or (fixed-)internal or system-if-linux (default: internal)]
14 # [$6 ignore $with_system_libs: TRUE or blank (default: blank/false)]
16 # $4 fixed: fixed-enabled, as fixed-disabled makes no sense.
17 # $5 test-system: follows $test_system_$1, ignores $with_system_libs; no configure switch
19 # Used configure.ac variables:
20 #  - $2_(CFLAGS|LIBS)_internal: must be filled to match the internal build
21 #  - enable_$1: should normally not be set manually; use test_$1 instead
22 #  - found_$1: other tests already provided external $2_CFLAGS and $2_LIBS
23 #  - test_$1: set to no, if the feature shouldn't be tested at all
24 #  - test_system_$1: set to no, if the system library should not be used
26 # There is currently the AC_SUBST redundancy of
27 #   (SYSTEM_$2,TRUE) == (,$(filter $2,$(BUILD_TYPE)))
30 m4_define([csm_default_with], [
31     if test "${with_system_$1+set}" != set -a "${with_system_libs+set}" = set -a "$3" != TRUE; then
32         with_system_$1="$with_system_libs";
33     else
34         with_system_$1="$2"
35     fi
38 m4_define([csm_check_required], [
39     m4_ifblank([$2],[m4_fatal([$][$1 ($2) must not be blank and $4])])
40     m4_if([$2],[$3],,[m4_fatal([$][$1 ($2) $3 must be $4])])
43 AC_DEFUN([libo_CHECK_SYSTEM_MODULE], [
44 # validate arguments as possible
45 csm_check_required([1],[$1],m4_tolower([$1]),[lowercase])
46 csm_check_required([2],[$2],m4_toupper([$2]),[uppercase])
47 m4_ifblank([$3],[m4_fatal([$][3 is the pkg-config query and must not be blank])])
48 m4_if([$6],[TRUE],[],[m4_ifnblank([$6],[m4_fatal([$][6 must be TRUE or blank])])])
49 m4_if(
50     [$4],[enabled],[
51         AC_ARG_ENABLE([$1],
52             AS_HELP_STRING([--disable-$1],[Disable $1 support.]),
53         ,[enable_$1="yes"])
54     ],[$4],[disabled],[
55         AC_ARG_ENABLE([$1],
56             AS_HELP_STRING([--enable-$1],[Enable $1 support.]),
57         ,[enable_$1="no"])
58     ],[
59         m4_if([$4],[fixed],,[m4_ifnblank([$4],
60               [m4_fatal([$$4 ($4) must be "enabled", "disabled", "fixed" or empty (=fixed)])])])
61         enable_$1="yes";
63 m4_if(
64     [$5],[system],[
65         AC_ARG_WITH(system-$1,
66             AS_HELP_STRING([--without-system-$1],[Build and bundle the internal $1.]),
67         ,[csm_default_with($1,yes,$6)])
68     ],[$5],[test-system],[
69         with_system_$1="$test_system_$1"
70     ],[$5],[fixed-system],[
71         with_system_$1=yes
72     ],[$5],[fixed-internal],[
73         with_system_$1=no
74     ],[$5],[system-if-linux],[
75         AC_ARG_WITH(system-$1,
76             AS_HELP_STRING([--with-system-$1],[Use $1 from the operating system.]),
77         ,[case "$_os" in
78             Linux)
79                 with_system_nss=yes
80             ;;
81             *)
82                 with_system_nss=no
83             ;;
84           esac])
85     ],[
86         m4_if([$5],[internal],,[m4_ifnblank([$5],
87               [m4_fatal([$$5 ($5) must be "(fixed-|test-)system", "(fixed-)internal", "system-if-linux" or empty (=internal)])])])
88         AC_ARG_WITH(system-$1,
89             AS_HELP_STRING([--with-system-$1],[Use $1 from the operating system.]),
90         ,[csm_default_with($1,no,$6)])
93 AC_MSG_CHECKING([which $1 to use])
94 if test "$test_$1" != no -a "$found_$1" != yes -a "$enable_$1" != no; then
95     ENABLE_$2=TRUE
96     if test "$with_system_$1" = yes -a "$test_system_$1" != no; then
97         AC_MSG_RESULT([external])
98         SYSTEM_$2=TRUE
99         PKG_CHECK_MODULES([$2], [$3])
100         $2_CFLAGS=$(printf '%s' "${$2_CFLAGS}" | sed -e "s/-I/${ISYSTEM?}/g")
101         FilterLibs "${$2_LIBS}"
102         $2_LIBS="$filteredlibs"
103     else
104         AC_MSG_RESULT([internal])
105         SYSTEM_$2=
106         $2_CFLAGS="${$2_CFLAGS_internal}"
107         $2_LIBS="${$2_LIBS_internal}"
108         BUILD_TYPE="$BUILD_TYPE $2"
109     fi
110 else
111     if test "$found_$1" = yes -a "$enable_$1" != no -a "$with_system_$1" = yes; then
112         AC_MSG_RESULT([external])
113         ENABLE_$2=TRUE
114         SYSTEM_$2=TRUE
115     else
116         ENABLE_$2=
117         SYSTEM_$2=
118         $2_CFLAGS=
119         $2_LIBS=
120         if test "$test_$1" != no -a "$enable_$1" = no; then
121             AC_MSG_RESULT([disabled])
122         else
123             AC_MSG_RESULT([not tested])
124         fi
125     fi
127 AC_SUBST([ENABLE_$2])
128 AC_SUBST([SYSTEM_$2])
129 AC_SUBST([$2_CFLAGS])
130 AC_SUBST([$2_LIBS])
133 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: