LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / m4 / libo_externals.m4
blobb2b314fec933609e8325dd66750dabac015cbff7
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 # <lowercase check>,<variable prefix>,<pkg-config query>,
10 #     <internal CFLAGS>,<internal LIBS>,<external (default: FALSE)>
11 AC_DEFUN([libo_CHECK_SYSTEM_MODULE], [
12 AC_ARG_WITH(system-$1,
13     AS_HELP_STRING([m4_ifnblank([$6],[--without-system-$1],[--with-system-$1])],
14         [m4_ifnblank([$6],
15             Build and bundle the internal $1 instead of using the operating system one.,
16             Use $1 from the operating system instead of building and bundling it.)]),
17 ,[m4_ifnblank([$6],[with_system_$1="yes"],[with_system_$1="$with_system_libs"])])
18 AC_MSG_CHECKING([which $1 to use])
19 if test "$test_$1" != "no"; then
20     ENABLE_$2=TRUE
21     if test "$with_system_$1" = yes -a "$test_system_$1" != no; then
22         AC_MSG_RESULT([external])
23         SYSTEM_$2=TRUE
24         PKG_CHECK_MODULES([$2], [$3])
25         $2_CFLAGS=$(printf '%s' "${$2_CFLAGS}" | sed -e "s/-I/${ISYSTEM?}/g")
26         FilterLibs "${$2_LIBS}"
27         $2_LIBS="$filteredlibs"
28     else
29         AC_MSG_RESULT([internal])
30         SYSTEM_$2=
31         $2_CFLAGS=$4
32         $2_LIBS=$5
33         BUILD_TYPE="$BUILD_TYPE $2"
34     fi
35 else
36     AC_MSG_RESULT([ignored])
38 AC_SUBST([ENABLE_$2])
39 AC_SUBST([SYSTEM_$2])
40 AC_SUBST([$2_CFLAGS])
41 AC_SUBST([$2_LIBS])
44 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: