bump product version to 6.4.0.3
[LibreOffice.git] / configure.ac
blob1e4724a6062209a10576594b5dac81d74d34bb38
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.4.0.3],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
336 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
338 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
339     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
342 # need sed in os checks...
343 AC_PATH_PROGS(SED, sed)
344 if test -z "$SED"; then
345     AC_MSG_ERROR([install sed to run this script])
348 # Set the ENABLE_LTO variable
349 # ===================================================================
350 AC_MSG_CHECKING([whether to use link-time optimization])
351 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
352     ENABLE_LTO="TRUE"
353     AC_MSG_RESULT([yes])
354     AC_DEFINE(STATIC_LINKING)
355 else
356     ENABLE_LTO=""
357     AC_MSG_RESULT([no])
359 AC_SUBST(ENABLE_LTO)
361 AC_ARG_ENABLE(fuzz-options,
362     AS_HELP_STRING([--enable-fuzz-options],
363         [Randomly enable or disable each of those configurable options
364          that are supposed to be freely selectable without interdependencies,
365          or where bad interaction from interdependencies is automatically avoided.])
368 dnl ===================================================================
369 dnl When building for Android, --with-android-ndk,
370 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
371 dnl mandatory
372 dnl ===================================================================
374 AC_ARG_WITH(android-ndk,
375     AS_HELP_STRING([--with-android-ndk],
376         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
379 AC_ARG_WITH(android-ndk-toolchain-version,
380     AS_HELP_STRING([--with-android-ndk-toolchain-version],
381         [Specify which toolchain version to use, of those present in the
382         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
383         with_android_ndk_toolchain_version=clang5.0)
385 AC_ARG_WITH(android-sdk,
386     AS_HELP_STRING([--with-android-sdk],
387         [Specify location of the Android SDK. Mandatory when building for Android.]),
390 AC_ARG_WITH(android-api-level,
391     AS_HELP_STRING([--with-android-api-level],
392         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
395 ANDROID_NDK_HOME=
396 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
397     with_android_ndk="$SRC_ROOT/external/android-ndk"
399 if test -n "$with_android_ndk"; then
400     eval ANDROID_NDK_HOME=$with_android_ndk
402     # Set up a lot of pre-canned defaults
404     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
405         if test ! -f $ANDROID_NDK_HOME/source.properties; then
406             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
407         fi
408         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
409     else
410         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
411     fi
412     if test -z "$ANDROID_NDK_VERSION";  then
413         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
414     fi
415     case $ANDROID_NDK_VERSION in
416     r9*|r10*)
417         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
418         ;;
419     11.1.*|12.1.*|13.1.*|14.1.*)
420         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
421         ;;
422     16.*|17.*|18.*|19.*|20.*)
423         ;;
424     *)
425         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
426         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
427         ;;
428     esac
430     ANDROID_API_LEVEL=16
431     if test -n "$with_android_api_level" ; then
432         ANDROID_API_LEVEL="$with_android_api_level"
433     fi
435     android_cpu=$host_cpu
436     if test $host_cpu = arm; then
437         android_platform_prefix=arm-linux-androideabi
438         android_gnu_prefix=$android_platform_prefix
439         LLVM_TRIPLE=armv7a-linux-androideabi
440         ANDROID_APP_ABI=armeabi-v7a
441         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
442     elif test $host_cpu = aarch64; then
443         android_platform_prefix=aarch64-linux-android
444         android_gnu_prefix=$android_platform_prefix
445         LLVM_TRIPLE=$android_platform_prefix
446         # minimum android version that supports aarch64
447         if test "$ANDROID_API_LEVEL" -lt "21" ; then
448             ANDROID_API_LEVEL=21
449         fi
450         ANDROID_APP_ABI=arm64-v8a
451     elif test $host_cpu = x86_64; then
452         android_platform_prefix=x86_64-linux-android
453         android_gnu_prefix=$android_platform_prefix
454         LLVM_TRIPLE=$android_platform_prefix
455         # minimum android version that supports x86_64
456         ANDROID_API_LEVEL=21
457         ANDROID_APP_ABI=x86_64
458     else
459         # host_cpu is something like "i386" or "i686" I guess, NDK uses
460         # "x86" in some contexts
461         android_cpu=x86
462         android_platform_prefix=$android_cpu
463         android_gnu_prefix=i686-linux-android
464         LLVM_TRIPLE=$android_gnu_prefix
465         ANDROID_APP_ABI=x86
466     fi
468     case "$with_android_ndk_toolchain_version" in
469     clang5.0)
470         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
471         ;;
472     *)
473         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
474     esac
476     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
478     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
479     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
480     # manage to link the (app-specific) single huge .so that is built for the app in
481     # android/source/ if there is debug information in a significant part of the object files.
482     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
483     # all objects have been built with debug information.)
484     case $build_os in
485     linux-gnu*)
486         android_HOST_TAG=linux-x86_64
487         ;;
488     darwin*)
489         android_HOST_TAG=darwin-x86_64
490         ;;
491     *)
492         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
493         # ndk would also support windows and windows-x86_64
494         ;;
495     esac
496     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
497     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
498     dnl TODO: NSS build uses it...
499     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
500     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
502     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
503     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
504     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
505     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
506     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
508     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
510     if test "$ENABLE_LTO" = TRUE; then
511         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
512         # $CC and $CXX when building external libraries
513         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
514     fi
516     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
518     if test -z "$CC"; then
519         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
520         CC_BASE="clang"
521     fi
522     if test -z "$CXX"; then
523         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
524         CXX_BASE="clang++"
525     fi
527     # remember to download the ownCloud Android library later
528     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
530 AC_SUBST(ANDROID_NDK_HOME)
531 AC_SUBST(ANDROID_APP_ABI)
532 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
534 dnl ===================================================================
535 dnl --with-android-sdk
536 dnl ===================================================================
537 ANDROID_SDK_HOME=
538 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
539     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
541 if test -n "$with_android_sdk"; then
542     eval ANDROID_SDK_HOME=$with_android_sdk
543     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
545 AC_SUBST(ANDROID_SDK_HOME)
547 libo_FUZZ_ARG_ENABLE([android-editing],
548     AS_HELP_STRING([--enable-android-editing],
549         [Enable the experimental editing feature on Android.])
551 ENABLE_ANDROID_EDITING=
552 if test "$enable_android_editing" = yes; then
553     ENABLE_ANDROID_EDITING=TRUE
555 AC_SUBST([ENABLE_ANDROID_EDITING])
557 dnl ===================================================================
558 dnl The following is a list of supported systems.
559 dnl Sequential to keep the logic very simple
560 dnl These values may be checked and reset later.
561 dnl ===================================================================
562 #defaults unless the os test overrides this:
563 test_randr=yes
564 test_xrender=yes
565 test_cups=yes
566 test_dbus=yes
567 test_fontconfig=yes
568 test_cairo=no
569 test_gdb_index=no
570 test_split_debug=no
572 # Default values, as such probably valid just for Linux, set
573 # differently below just for Mac OSX, but at least better than
574 # hardcoding these as we used to do. Much of this is duplicated also
575 # in solenv for old build system and for gbuild, ideally we should
576 # perhaps define stuff like this only here in configure.ac?
578 LINKFLAGSSHL="-shared"
579 PICSWITCH="-fpic"
580 DLLPOST=".so"
582 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
584 INSTROOTBASESUFFIX=
585 INSTROOTCONTENTSUFFIX=
586 SDKDIRNAME=sdk
588 case "$host_os" in
590 solaris*)
591     build_gstreamer_1_0=yes
592     test_freetype=yes
593     _os=SunOS
595     dnl ===========================================================
596     dnl Check whether we're using Solaris 10 - SPARC or Intel.
597     dnl ===========================================================
598     AC_MSG_CHECKING([the Solaris operating system release])
599     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
600     if test "$_os_release" -lt "10"; then
601         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
602     else
603         AC_MSG_RESULT([ok ($_os_release)])
604     fi
606     dnl Check whether we're using a SPARC or i386 processor
607     AC_MSG_CHECKING([the processor type])
608     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
609         AC_MSG_RESULT([ok ($host_cpu)])
610     else
611         AC_MSG_ERROR([only SPARC and i386 processors are supported])
612     fi
613     ;;
615 linux-gnu*|k*bsd*-gnu*)
616     build_gstreamer_1_0=yes
617     test_kf5=yes
618     test_gtk3_kde5=yes
619     test_gdb_index=yes
620     test_split_debug=yes
621     if test "$enable_fuzzers" != yes; then
622         test_freetype=yes
623         test_fontconfig=yes
624     else
625         test_freetype=no
626         test_fontconfig=no
627         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
628     fi
629     _os=Linux
630     ;;
632 gnu)
633     test_randr=no
634     test_xrender=no
635     _os=GNU
636      ;;
638 cygwin*|interix*)
640     # When building on Windows normally with MSVC under Cygwin,
641     # configure thinks that the host platform (the platform the
642     # built code will run on) is Cygwin, even if it obviously is
643     # Windows, which in Autoconf terminology is called
644     # "mingw32". (Which is misleading as MinGW is the name of the
645     # tool-chain, not an operating system.)
647     # Somewhat confusing, yes. But this configure script doesn't
648     # look at $host etc that much, it mostly uses its own $_os
649     # variable, set here in this case statement.
651     test_cups=no
652     test_dbus=no
653     test_randr=no
654     test_xrender=no
655     test_freetype=no
656     test_fontconfig=no
657     _os=WINNT
659     DLLPOST=".dll"
660     LINKFLAGSNOUNDEFS=
661     ;;
663 darwin*) # macOS or iOS
664     test_randr=no
665     test_xrender=no
666     test_freetype=no
667     test_fontconfig=no
668     test_dbus=no
669     if test -n "$LODE_HOME" ; then
670         mac_sanitize_path
671         AC_MSG_NOTICE([sanitized the PATH to $PATH])
672     fi
673     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
674         build_for_ios=YES
675         _os=iOS
676         test_cups=no
677         enable_mpl_subset=yes
678         enable_lotuswordpro=no
679         enable_coinmp=no
680         enable_lpsolve=no
681         enable_postgresql_sdbc=no
682         enable_extension_integration=no
683         enable_report_builder=no
684         with_ppds=no
685         if test "$enable_ios_simulator" = "yes"; then
686             host=x86_64-apple-darwin
687         fi
688     else
689         _os=Darwin
690         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
691         INSTROOTCONTENTSUFFIX=/Contents
692         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
693     fi
694     # See comment above the case "$host_os"
695     LINKFLAGSSHL="-dynamiclib -single_module"
697     # -fPIC is default
698     PICSWITCH=""
700     DLLPOST=".dylib"
702     # -undefined error is the default
703     LINKFLAGSNOUNDEFS=""
706 freebsd*)
707     build_gstreamer_1_0=yes
708     test_kf5=yes
709     test_gtk3_kde5=yes
710     test_freetype=yes
711     AC_MSG_CHECKING([the FreeBSD operating system release])
712     if test -n "$with_os_version"; then
713         OSVERSION="$with_os_version"
714     else
715         OSVERSION=`/sbin/sysctl -n kern.osreldate`
716     fi
717     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
718     AC_MSG_CHECKING([which thread library to use])
719     if test "$OSVERSION" -lt "500016"; then
720         PTHREAD_CFLAGS="-D_THREAD_SAFE"
721         PTHREAD_LIBS="-pthread"
722     elif test "$OSVERSION" -lt "502102"; then
723         PTHREAD_CFLAGS="-D_THREAD_SAFE"
724         PTHREAD_LIBS="-lc_r"
725     else
726         PTHREAD_CFLAGS=""
727         PTHREAD_LIBS="-pthread"
728     fi
729     AC_MSG_RESULT([$PTHREAD_LIBS])
730     _os=FreeBSD
731     ;;
733 *netbsd*)
734     build_gstreamer_1_0=yes
735     test_kf5=yes
736     test_gtk3_kde5=yes
737     test_freetype=yes
738     PTHREAD_LIBS="-pthread -lpthread"
739     _os=NetBSD
740     ;;
742 aix*)
743     test_randr=no
744     test_freetype=yes
745     PTHREAD_LIBS=-pthread
746     _os=AIX
747     ;;
749 openbsd*)
750     test_freetype=yes
751     PTHREAD_CFLAGS="-D_THREAD_SAFE"
752     PTHREAD_LIBS="-pthread"
753     _os=OpenBSD
754     ;;
756 dragonfly*)
757     build_gstreamer_1_0=yes
758     test_kf5=yes
759     test_gtk3_kde5=yes
760     test_freetype=yes
761     PTHREAD_LIBS="-pthread"
762     _os=DragonFly
763     ;;
765 linux-android*)
766     build_gstreamer_1_0=no
767     enable_lotuswordpro=no
768     enable_mpl_subset=yes
769     enable_coinmp=yes
770     enable_lpsolve=no
771     enable_report_builder=no
772     enable_odk=no
773     enable_postgresql_sdbc=no
774     enable_python=no
775     test_cups=no
776     test_dbus=no
777     test_fontconfig=no
778     test_freetype=no
779     test_kf5=no
780     test_qt5=no
781     test_gtk3_kde5=no
782     test_randr=no
783     test_xrender=no
784     _os=Android
786     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
787     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
788     ;;
790 haiku*)
791     test_cups=no
792     test_dbus=no
793     test_randr=no
794     test_xrender=no
795     test_freetype=yes
796     enable_odk=no
797     enable_gstreamer_1_0=no
798     enable_vlc=no
799     enable_coinmp=no
800     enable_pdfium=no
801     enable_sdremote=no
802     enable_postgresql_sdbc=no
803     enable_firebird_sdbc=no
804     _os=Haiku
805     ;;
808     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
809     ;;
810 esac
812 if test "$_os" = "Android" ; then
813     # Verify that the NDK and SDK options are proper
814     if test -z "$with_android_ndk"; then
815         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
816     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
817         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
818     fi
820     if test -z "$ANDROID_SDK_HOME"; then
821         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
822     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
823         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
824     fi
826     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
827     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
828         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
829                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
830                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
831         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
832         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
833         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
834     fi
835     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
836         AC_MSG_WARN([android support repository not found - install with
837                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
838                      to allow the build to download the specified version of the android support libraries])
839         add_warning "android support repository not found - install with"
840         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
841         add_warning "to allow the build to download the specified version of the android support libraries"
842     fi
845 if test "$_os" = "AIX"; then
846     AC_PATH_PROG(GAWK, gawk)
847     if test -z "$GAWK"; then
848         AC_MSG_ERROR([gawk not found in \$PATH])
849     fi
852 AC_SUBST(SDKDIRNAME)
854 AC_SUBST(PTHREAD_CFLAGS)
855 AC_SUBST(PTHREAD_LIBS)
857 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
858 # By default use the ones specified by our build system,
859 # but explicit override is possible.
860 AC_MSG_CHECKING(for explicit AFLAGS)
861 if test -n "$AFLAGS"; then
862     AC_MSG_RESULT([$AFLAGS])
863     x_AFLAGS=
864 else
865     AC_MSG_RESULT(no)
866     x_AFLAGS=[\#]
868 AC_MSG_CHECKING(for explicit CFLAGS)
869 if test -n "$CFLAGS"; then
870     AC_MSG_RESULT([$CFLAGS])
871     x_CFLAGS=
872 else
873     AC_MSG_RESULT(no)
874     x_CFLAGS=[\#]
876 AC_MSG_CHECKING(for explicit CXXFLAGS)
877 if test -n "$CXXFLAGS"; then
878     AC_MSG_RESULT([$CXXFLAGS])
879     x_CXXFLAGS=
880 else
881     AC_MSG_RESULT(no)
882     x_CXXFLAGS=[\#]
884 AC_MSG_CHECKING(for explicit OBJCFLAGS)
885 if test -n "$OBJCFLAGS"; then
886     AC_MSG_RESULT([$OBJCFLAGS])
887     x_OBJCFLAGS=
888 else
889     AC_MSG_RESULT(no)
890     x_OBJCFLAGS=[\#]
892 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
893 if test -n "$OBJCXXFLAGS"; then
894     AC_MSG_RESULT([$OBJCXXFLAGS])
895     x_OBJCXXFLAGS=
896 else
897     AC_MSG_RESULT(no)
898     x_OBJCXXFLAGS=[\#]
900 AC_MSG_CHECKING(for explicit LDFLAGS)
901 if test -n "$LDFLAGS"; then
902     AC_MSG_RESULT([$LDFLAGS])
903     x_LDFLAGS=
904 else
905     AC_MSG_RESULT(no)
906     x_LDFLAGS=[\#]
908 AC_SUBST(AFLAGS)
909 AC_SUBST(CFLAGS)
910 AC_SUBST(CXXFLAGS)
911 AC_SUBST(OBJCFLAGS)
912 AC_SUBST(OBJCXXFLAGS)
913 AC_SUBST(LDFLAGS)
914 AC_SUBST(x_AFLAGS)
915 AC_SUBST(x_CFLAGS)
916 AC_SUBST(x_CXXFLAGS)
917 AC_SUBST(x_OBJCFLAGS)
918 AC_SUBST(x_OBJCXXFLAGS)
919 AC_SUBST(x_LDFLAGS)
921 dnl These are potentially set for MSVC, in the code checking for UCRT below:
922 my_original_CFLAGS=$CFLAGS
923 my_original_CXXFLAGS=$CXXFLAGS
924 my_original_CPPFLAGS=$CPPFLAGS
926 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
927 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
928 dnl AC_PROG_CC internally.
929 if test "$_os" != "WINNT"; then
930     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
931     save_CFLAGS=$CFLAGS
932     AC_PROG_CC
933     CFLAGS=$save_CFLAGS
934     if test -z "$CC_BASE"; then
935         CC_BASE=`first_arg_basename "$CC"`
936     fi
939 if test "$_os" != "WINNT"; then
940     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
941 else
942     ENDIANNESS=little
944 AC_SUBST(ENDIANNESS)
946 if test $_os != "WINNT"; then
947     save_LIBS="$LIBS"
948     AC_SEARCH_LIBS([dlsym], [dl],
949         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
950         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
951     LIBS="$save_LIBS"
953 AC_SUBST(DLOPEN_LIBS)
955 AC_ARG_ENABLE(ios-simulator,
956     AS_HELP_STRING([--enable-ios-simulator],
957         [build i386 or x86_64 for ios simulator])
960 AC_ARG_ENABLE(ios-libreofficelight-app,
961     AS_HELP_STRING([--enable-ios-libreofficelight-app],
962         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
963          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
964          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
967 ENABLE_IOS_LIBREOFFICELIGHT_APP=
968 if test "$enable_ios_libreofficelight_app" = yes; then
969     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
971 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
973 ###############################################################################
974 # Extensions switches --enable/--disable
975 ###############################################################################
976 # By default these should be enabled unless having extra dependencies.
977 # If there is extra dependency over configure options then the enable should
978 # be automagic based on whether the requiring feature is enabled or not.
979 # All this options change anything only with --enable-extension-integration.
981 # The name of this option and its help string makes it sound as if
982 # extensions are built anyway, just not integrated in the installer,
983 # if you use --disable-extension-integration. Is that really the
984 # case?
986 libo_FUZZ_ARG_ENABLE(extension-integration,
987     AS_HELP_STRING([--disable-extension-integration],
988         [Disable integration of the built extensions in the installer of the
989          product. Use this switch to disable the integration.])
992 AC_ARG_ENABLE(avmedia,
993     AS_HELP_STRING([--disable-avmedia],
994         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
997 AC_ARG_ENABLE(database-connectivity,
998     AS_HELP_STRING([--disable-database-connectivity],
999         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1002 # This doesn't mean not building (or "integrating") extensions
1003 # (although it probably should; i.e. it should imply
1004 # --disable-extension-integration I guess), it means not supporting
1005 # any extension mechanism at all
1006 libo_FUZZ_ARG_ENABLE(extensions,
1007     AS_HELP_STRING([--disable-extensions],
1008         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1011 AC_ARG_ENABLE(scripting,
1012     AS_HELP_STRING([--disable-scripting],
1013         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1016 # This is mainly for Android and iOS, but could potentially be used in some
1017 # special case otherwise, too, so factored out as a separate setting
1019 AC_ARG_ENABLE(dynamic-loading,
1020     AS_HELP_STRING([--disable-dynamic-loading],
1021         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1024 libo_FUZZ_ARG_ENABLE(report-builder,
1025     AS_HELP_STRING([--disable-report-builder],
1026         [Disable the Report Builder.])
1029 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1030     AS_HELP_STRING([--enable-ext-wiki-publisher],
1031         [Enable the Wiki Publisher extension.])
1034 libo_FUZZ_ARG_ENABLE(lpsolve,
1035     AS_HELP_STRING([--disable-lpsolve],
1036         [Disable compilation of the lp solve solver ])
1038 libo_FUZZ_ARG_ENABLE(coinmp,
1039     AS_HELP_STRING([--disable-coinmp],
1040         [Disable compilation of the CoinMP solver ])
1043 libo_FUZZ_ARG_ENABLE(pdfimport,
1044     AS_HELP_STRING([--disable-pdfimport],
1045         [Disable building the PDF import feature.])
1048 libo_FUZZ_ARG_ENABLE(pdfium,
1049     AS_HELP_STRING([--disable-pdfium],
1050         [Disable building PDFium.])
1053 ###############################################################################
1055 dnl ---------- *** ----------
1057 libo_FUZZ_ARG_ENABLE(mergelibs,
1058     AS_HELP_STRING([--enable-mergelibs],
1059         [Merge several of the smaller libraries into one big, "merged", one.])
1062 libo_FUZZ_ARG_ENABLE(breakpad,
1063     AS_HELP_STRING([--enable-breakpad],
1064         [Enables breakpad for crash reporting.])
1067 libo_FUZZ_ARG_ENABLE(crashdump,
1068     AS_HELP_STRING([--disable-crashdump],
1069         [Disable dump.ini and dump-file, when --enable-breakpad])
1072 AC_ARG_ENABLE(fetch-external,
1073     AS_HELP_STRING([--disable-fetch-external],
1074         [Disables fetching external tarballs from web sources.])
1077 AC_ARG_ENABLE(fuzzers,
1078     AS_HELP_STRING([--enable-fuzzers],
1079         [Enables building libfuzzer targets for fuzz testing.])
1082 libo_FUZZ_ARG_ENABLE(pch,
1083     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1084         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1085          Using 'system' will include only external headers, 'base' will add also headers
1086          from base modules, 'normal' will also add all headers except from the module built,
1087          'full' will use all suitable headers even from a module itself.])
1090 libo_FUZZ_ARG_ENABLE(epm,
1091     AS_HELP_STRING([--enable-epm],
1092         [LibreOffice includes self-packaging code, that requires epm, however epm is
1093          useless for large scale package building.])
1096 libo_FUZZ_ARG_ENABLE(odk,
1097     AS_HELP_STRING([--disable-odk],
1098         [LibreOffice includes an ODK, office development kit which some packagers may
1099          wish to build without.])
1102 AC_ARG_ENABLE(mpl-subset,
1103     AS_HELP_STRING([--enable-mpl-subset],
1104         [Don't compile any pieces which are not MPL or more liberally licensed])
1107 libo_FUZZ_ARG_ENABLE(evolution2,
1108     AS_HELP_STRING([--enable-evolution2],
1109         [Allows the built-in evolution 2 addressbook connectivity build to be
1110          enabled.])
1113 AC_ARG_ENABLE(avahi,
1114     AS_HELP_STRING([--enable-avahi],
1115         [Determines whether to use Avahi to advertise Impress to remote controls.])
1118 libo_FUZZ_ARG_ENABLE(werror,
1119     AS_HELP_STRING([--enable-werror],
1120         [Turn warnings to errors. (Has no effect in modules where the treating
1121          of warnings as errors is disabled explicitly.)]),
1124 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1125     AS_HELP_STRING([--enable-assert-always-abort],
1126         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1129 libo_FUZZ_ARG_ENABLE(dbgutil,
1130     AS_HELP_STRING([--enable-dbgutil],
1131         [Provide debugging support from --enable-debug and include additional debugging
1132          utilities such as object counting or more expensive checks.
1133          This is the recommended option for developers.
1134          Note that this makes the build ABI incompatible, it is not possible to mix object
1135          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1137 libo_FUZZ_ARG_ENABLE(debug,
1138     AS_HELP_STRING([--enable-debug],
1139         [Include debugging information, disable compiler optimization and inlining plus
1140          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1142 libo_FUZZ_ARG_ENABLE(split-debug,
1143     AS_HELP_STRING([--disable-split-debug],
1144         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1145          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1147 libo_FUZZ_ARG_ENABLE(gdb-index,
1148     AS_HELP_STRING([--disable-gdb-index],
1149         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1150          The feature requires the gold or lld linker.]))
1152 libo_FUZZ_ARG_ENABLE(sal-log,
1153     AS_HELP_STRING([--enable-sal-log],
1154         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1156 libo_FUZZ_ARG_ENABLE(symbols,
1157     AS_HELP_STRING([--enable-symbols],
1158         [Generate debug information.
1159          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1160          otherwise. It is possible to explicitly specify gbuild build targets
1161          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1162          everything in the directory; there is no ordering, more specific overrides
1163          more general, and disabling takes precedence).
1164          Example: --enable-symbols="all -sw/ -Library_sc".]))
1166 libo_FUZZ_ARG_ENABLE(optimized,
1167     AS_HELP_STRING([--disable-optimized],
1168         [Whether to compile with optimization flags.
1169          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1170          otherwise.]))
1172 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1173     AS_HELP_STRING([--disable-runtime-optimizations],
1174         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1175          JVM JIT) that are known to interact badly with certain dynamic analysis
1176          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1177          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1178          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1180 AC_ARG_WITH(valgrind,
1181     AS_HELP_STRING([--with-valgrind],
1182         [Make availability of Valgrind headers a hard requirement.]))
1184 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1185     AS_HELP_STRING([--enable-compiler-plugins],
1186         [Enable compiler plugins that will perform additional checks during
1187          building. Enabled automatically by --enable-dbgutil.
1188          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1189 COMPILER_PLUGINS_DEBUG=
1190 if test "$enable_compiler_plugins" = debug; then
1191     enable_compiler_plugins=yes
1192     COMPILER_PLUGINS_DEBUG=TRUE
1195 libo_FUZZ_ARG_ENABLE(ooenv,
1196     AS_HELP_STRING([--disable-ooenv],
1197         [Disable ooenv for the instdir installation.]))
1199 libo_FUZZ_ARG_ENABLE(libnumbertext,
1200     AS_HELP_STRING([--disable-libnumbertext],
1201         [Disable use of numbertext external library.]))
1203 AC_ARG_ENABLE(lto,
1204     AS_HELP_STRING([--enable-lto],
1205         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1206          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1207          linker. For MSVC, this option is broken at the moment. This is experimental work
1208          in progress that shouldn't be used unless you are working on it.)]))
1210 AC_ARG_ENABLE(python,
1211     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1212         [Enables or disables Python support at run-time.
1213          Also specifies what Python to use. 'auto' is the default.
1214          'fully-internal' even forces the internal version for uses of Python
1215          during the build.]))
1217 libo_FUZZ_ARG_ENABLE(gtk3,
1218     AS_HELP_STRING([--disable-gtk3],
1219         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1220 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1222 AC_ARG_ENABLE(introspection,
1223     AS_HELP_STRING([--enable-introspection],
1224         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1225          Linux distributions.)]))
1227 AC_ARG_ENABLE(split-app-modules,
1228     AS_HELP_STRING([--enable-split-app-modules],
1229         [Split file lists for app modules, e.g. base, calc.
1230          Has effect only with make distro-pack-install]),
1233 AC_ARG_ENABLE(split-opt-features,
1234     AS_HELP_STRING([--enable-split-opt-features],
1235         [Split file lists for some optional features, e.g. pyuno, testtool.
1236          Has effect only with make distro-pack-install]),
1239 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1240     AS_HELP_STRING([--disable-cairo-canvas],
1241         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1244 libo_FUZZ_ARG_ENABLE(dbus,
1245     AS_HELP_STRING([--disable-dbus],
1246         [Determines whether to enable features that depend on dbus.
1247          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1248 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1250 libo_FUZZ_ARG_ENABLE(sdremote,
1251     AS_HELP_STRING([--disable-sdremote],
1252         [Determines whether to enable Impress remote control (i.e. the server component).]),
1253 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1255 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1256     AS_HELP_STRING([--disable-sdremote-bluetooth],
1257         [Determines whether to build sdremote with bluetooth support.
1258          Requires dbus on Linux.]))
1260 libo_FUZZ_ARG_ENABLE(gio,
1261     AS_HELP_STRING([--disable-gio],
1262         [Determines whether to use the GIO support.]),
1263 ,test "${enable_gio+set}" = set || enable_gio=yes)
1265 AC_ARG_ENABLE(qt5,
1266     AS_HELP_STRING([--enable-qt5],
1267         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1268          available.]),
1271 AC_ARG_ENABLE(kf5,
1272     AS_HELP_STRING([--enable-kf5],
1273         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1274          KF5 are available.]),
1277 AC_ARG_ENABLE(kde5,
1278     AS_HELP_STRING([--enable-kde5],
1279         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1282 AC_ARG_ENABLE(gtk3_kde5,
1283     AS_HELP_STRING([--enable-gtk3-kde5],
1284         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1285          platforms where Gtk3, Qt5 and Plasma is available.]),
1288 AC_ARG_ENABLE(gui,
1289     AS_HELP_STRING([--disable-gui],
1290         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1291 ,enable_gui=yes)
1293 libo_FUZZ_ARG_ENABLE(randr,
1294     AS_HELP_STRING([--disable-randr],
1295         [Disable RandR support in the vcl project.]),
1296 ,test "${enable_randr+set}" = set || enable_randr=yes)
1298 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1299     AS_HELP_STRING([--disable-gstreamer-1-0],
1300         [Disable building with the gstreamer 1.0 avmedia backend.]),
1301 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1303 libo_FUZZ_ARG_ENABLE(vlc,
1304     AS_HELP_STRING([--enable-vlc],
1305         [Enable building with the (experimental) VLC avmedia backend.]),
1306 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1308 libo_FUZZ_ARG_ENABLE(neon,
1309     AS_HELP_STRING([--disable-neon],
1310         [Disable neon and the compilation of webdav binding.]),
1313 libo_FUZZ_ARG_ENABLE([eot],
1314     [AS_HELP_STRING([--enable-eot],
1315         [Enable support for Embedded OpenType fonts.])],
1316 ,test "${enable_eot+set}" = set || enable_eot=no)
1318 libo_FUZZ_ARG_ENABLE(cve-tests,
1319     AS_HELP_STRING([--disable-cve-tests],
1320         [Prevent CVE tests to be executed]),
1323 libo_FUZZ_ARG_ENABLE(chart-tests,
1324     AS_HELP_STRING([--enable-chart-tests],
1325         [Executes chart XShape tests. In a perfect world these tests would be
1326          stable and everyone could run them, in reality it is best to run them
1327          only on a few machines that are known to work and maintained by people
1328          who can judge if a test failure is a regression or not.]),
1331 AC_ARG_ENABLE(build-unowinreg,
1332     AS_HELP_STRING([--enable-build-unowinreg],
1333         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1334          compiler is needed on Linux.]),
1337 AC_ARG_ENABLE(build-opensymbol,
1338     AS_HELP_STRING([--enable-build-opensymbol],
1339         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1340          fontforge installed.]),
1343 AC_ARG_ENABLE(dependency-tracking,
1344     AS_HELP_STRING([--enable-dependency-tracking],
1345         [Do not reject slow dependency extractors.])[
1346   --disable-dependency-tracking
1347                           Disables generation of dependency information.
1348                           Speed up one-time builds.],
1351 AC_ARG_ENABLE(icecream,
1352     AS_HELP_STRING([--enable-icecream],
1353         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1354          It defaults to /opt/icecream for the location of the icecream gcc/g++
1355          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1358 AC_ARG_ENABLE(ld,
1359     AS_HELP_STRING([--enable-ld=<linker>],
1360         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1361          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1364 libo_FUZZ_ARG_ENABLE(cups,
1365     AS_HELP_STRING([--disable-cups],
1366         [Do not build cups support.])
1369 AC_ARG_ENABLE(ccache,
1370     AS_HELP_STRING([--disable-ccache],
1371         [Do not try to use ccache automatically.
1372          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1373          CC/CXX are not yet set, and --enable-icecream is not given, we
1374          attempt to use ccache. --disable-ccache disables ccache completely.
1375          Additionally ccache's depend mode is enabled if possible,
1376          use --enable-ccache=nodepend to enable ccache without depend mode.
1380 AC_ARG_ENABLE(64-bit,
1381     AS_HELP_STRING([--enable-64-bit],
1382         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1383          At the moment meaningful only for Windows.]), ,)
1385 libo_FUZZ_ARG_ENABLE(online-update,
1386     AS_HELP_STRING([--enable-online-update],
1387         [Enable the online update service that will check for new versions of
1388          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1389          If the value is "mar", the experimental Mozilla-like update will be
1390          enabled instead of the traditional update mechanism.]),
1393 AC_ARG_WITH(update-config,
1394     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1395                    [Path to the update config ini file]))
1397 libo_FUZZ_ARG_ENABLE(extension-update,
1398     AS_HELP_STRING([--disable-extension-update],
1399         [Disable possibility to update installed extensions.]),
1402 libo_FUZZ_ARG_ENABLE(release-build,
1403     AS_HELP_STRING([--enable-release-build],
1404         [Enable release build. Note that the "release build" choice is orthogonal to
1405          whether symbols are present, debug info is generated, or optimization
1406          is done.
1407          See http://wiki.documentfoundation.org/Development/DevBuild]),
1410 AC_ARG_ENABLE(windows-build-signing,
1411     AS_HELP_STRING([--enable-windows-build-signing],
1412         [Enable signing of windows binaries (*.exe, *.dll)]),
1415 AC_ARG_ENABLE(silent-msi,
1416     AS_HELP_STRING([--enable-silent-msi],
1417         [Enable MSI with LIMITUI=1 (silent install).]),
1420 AC_ARG_ENABLE(macosx-code-signing,
1421     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1422         [Sign executables, dylibs, frameworks and the app bundle. If you
1423          don't provide an identity the first suitable certificate
1424          in your keychain is used.]),
1427 AC_ARG_ENABLE(macosx-package-signing,
1428     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1429         [Create a .pkg suitable for uploading to the Mac App Store and sign
1430          it. If you don't provide an identity the first suitable certificate
1431          in your keychain is used.]),
1434 AC_ARG_ENABLE(macosx-sandbox,
1435     AS_HELP_STRING([--enable-macosx-sandbox],
1436         [Make the app bundle run in a sandbox. Requires code signing.
1437          Is required by apps distributed in the Mac App Store, and implies
1438          adherence to App Store rules.]),
1441 AC_ARG_WITH(macosx-bundle-identifier,
1442     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1443         [Define the macOS bundle identifier. Default is the somewhat weird
1444          org.libreoffice.script ("script", huh?).]),
1445 ,with_macosx_bundle_identifier=org.libreoffice.script)
1447 AC_ARG_WITH(product-name,
1448     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1449         [Define the product name. Default is AC_PACKAGE_NAME.]),
1450 ,with_product_name=$PRODUCTNAME)
1452 AC_ARG_WITH(package-version,
1453     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1454         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1457 libo_FUZZ_ARG_ENABLE(readonly-installset,
1458     AS_HELP_STRING([--enable-readonly-installset],
1459         [Prevents any attempts by LibreOffice to write into its installation. That means
1460          at least that no "system-wide" extensions can be added. Partly experimental work in
1461          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1464 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1465     AS_HELP_STRING([--disable-postgresql-sdbc],
1466         [Disable the build of the PostgreSQL-SDBC driver.])
1469 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1470     AS_HELP_STRING([--disable-lotuswordpro],
1471         [Disable the build of the Lotus Word Pro filter.]),
1472 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1474 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1475     AS_HELP_STRING([--disable-firebird-sdbc],
1476         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1477 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1479 AC_ARG_ENABLE(bogus-pkg-config,
1480     AS_HELP_STRING([--enable-bogus-pkg-config],
1481         [MACOSX only: on MacOSX pkg-config can cause trouble. by default if one is found in the PATH, an error is issued. This flag turn that error into a warning.]),
1484 AC_ARG_ENABLE(openssl,
1485     AS_HELP_STRING([--disable-openssl],
1486         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1487          components will either use GNUTLS or NSS. Work in progress,
1488          use only if you are hacking on it.]),
1489 ,enable_openssl=yes)
1491 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1492     AS_HELP_STRING([--enable-cipher-openssl-backend],
1493         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1494          Requires --enable-openssl.]))
1496 AC_ARG_ENABLE(library-bin-tar,
1497     AS_HELP_STRING([--enable-library-bin-tar],
1498         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1499         Some libraries can save their build result in a tarball
1500         stored in TARFILE_LOCATION. That binary tarball is
1501         uniquely identified by the source tarball,
1502         the content of the config_host.mk file and the content
1503         of the top-level directory in core for that library
1504         If this option is enabled, then if such a tarfile exist, it will be untarred
1505         instead of the source tarfile, and the build step will be skipped for that
1506         library.
1507         If a proper tarfile does not exist, then the normal source-based
1508         build is done for that library and a proper binary tarfile is created
1509         for the next time.]),
1512 AC_ARG_ENABLE(dconf,
1513     AS_HELP_STRING([--disable-dconf],
1514         [Disable the dconf configuration backend (enabled by default where
1515          available).]))
1517 libo_FUZZ_ARG_ENABLE(formula-logger,
1518     AS_HELP_STRING(
1519         [--enable-formula-logger],
1520         [Enable formula logger for logging formula calculation flow in Calc.]
1521     )
1524 AC_ARG_ENABLE(ldap,
1525     AS_HELP_STRING([--disable-ldap],
1526         [Disable LDAP support.]),
1527 ,enable_ldap=yes)
1529 dnl ===================================================================
1530 dnl Optional Packages (--with/without-)
1531 dnl ===================================================================
1533 AC_ARG_WITH(gcc-home,
1534     AS_HELP_STRING([--with-gcc-home],
1535         [Specify the location of gcc/g++ manually. This can be used in conjunction
1536          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1537          non-default path.]),
1540 AC_ARG_WITH(gnu-patch,
1541     AS_HELP_STRING([--with-gnu-patch],
1542         [Specify location of GNU patch on Solaris or FreeBSD.]),
1545 AC_ARG_WITH(build-platform-configure-options,
1546     AS_HELP_STRING([--with-build-platform-configure-options],
1547         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1550 AC_ARG_WITH(gnu-cp,
1551     AS_HELP_STRING([--with-gnu-cp],
1552         [Specify location of GNU cp on Solaris or FreeBSD.]),
1555 AC_ARG_WITH(external-tar,
1556     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1557         [Specify an absolute path of where to find (and store) tarfiles.]),
1558     TARFILE_LOCATION=$withval ,
1561 AC_ARG_WITH(referenced-git,
1562     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1563         [Specify another checkout directory to reference. This makes use of
1564                  git submodule update --reference, and saves a lot of diskspace
1565                  when having multiple trees side-by-side.]),
1566     GIT_REFERENCE_SRC=$withval ,
1569 AC_ARG_WITH(linked-git,
1570     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1571         [Specify a directory where the repositories of submodules are located.
1572          This uses a method similar to git-new-workdir to get submodules.]),
1573     GIT_LINK_SRC=$withval ,
1576 AC_ARG_WITH(galleries,
1577     AS_HELP_STRING([--with-galleries],
1578         [Specify how galleries should be built. It is possible either to
1579          build these internally from source ("build"),
1580          or to disable them ("no")]),
1583 AC_ARG_WITH(theme,
1584     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1585         [Choose which themes to include. By default those themes with an '*' are included.
1586          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1587          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sif_svg, *sifr_dark, *tango.]),
1590 libo_FUZZ_ARG_WITH(helppack-integration,
1591     AS_HELP_STRING([--without-helppack-integration],
1592         [It will not integrate the helppacks to the installer
1593          of the product. Please use this switch to use the online help
1594          or separate help packages.]),
1597 libo_FUZZ_ARG_WITH(fonts,
1598     AS_HELP_STRING([--without-fonts],
1599         [LibreOffice includes some third-party fonts to provide a reliable basis for
1600          help content, templates, samples, etc. When these fonts are already
1601          known to be available on the system then you should use this option.]),
1604 AC_ARG_WITH(epm,
1605     AS_HELP_STRING([--with-epm],
1606         [Decides which epm to use. Default is to use the one from the system if
1607          one is built. When either this is not there or you say =internal epm
1608          will be built.]),
1611 AC_ARG_WITH(package-format,
1612     AS_HELP_STRING([--with-package-format],
1613         [Specify package format(s) for LibreOffice installation sets. The
1614          implicit --without-package-format leads to no installation sets being
1615          generated. Possible values: aix, archive, bsd, deb, dmg,
1616          installed, msi, pkg, and rpm.
1617          Example: --with-package-format='deb rpm']),
1620 AC_ARG_WITH(tls,
1621     AS_HELP_STRING([--with-tls],
1622         [Decides which TLS/SSL and cryptographic implementations to use for
1623          LibreOffice's code. Notice that this doesn't apply for depending
1624          libraries like "neon", for example. Default is to use OpenSSL
1625          although NSS is also possible. Notice that selecting NSS restricts
1626          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1627          restrict by now the usage of NSS in LO's code. Possible values:
1628          openssl, nss. Example: --with-tls="nss"]),
1631 AC_ARG_WITH(system-libs,
1632     AS_HELP_STRING([--with-system-libs],
1633         [Use libraries already on system -- enables all --with-system-* flags.]),
1636 AC_ARG_WITH(system-bzip2,
1637     AS_HELP_STRING([--with-system-bzip2],
1638         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1639     [with_system_bzip2="$with_system_libs"])
1641 AC_ARG_WITH(system-headers,
1642     AS_HELP_STRING([--with-system-headers],
1643         [Use headers already on system -- enables all --with-system-* flags for
1644          external packages whose headers are the only entities used i.e.
1645          boost/odbc/sane-header(s).]),,
1646     [with_system_headers="$with_system_libs"])
1648 AC_ARG_WITH(system-jars,
1649     AS_HELP_STRING([--without-system-jars],
1650         [When building with --with-system-libs, also the needed jars are expected
1651          on the system. Use this to disable that]),,
1652     [with_system_jars="$with_system_libs"])
1654 AC_ARG_WITH(system-cairo,
1655     AS_HELP_STRING([--with-system-cairo],
1656         [Use cairo libraries already on system.  Happens automatically for
1657          (implicit) --enable-gtk3.]))
1659 AC_ARG_WITH(system-epoxy,
1660     AS_HELP_STRING([--with-system-epoxy],
1661         [Use epoxy libraries already on system.  Happens automatically for
1662          (implicit) --enable-gtk3.]),,
1663        [with_system_epoxy="$with_system_libs"])
1665 AC_ARG_WITH(myspell-dicts,
1666     AS_HELP_STRING([--with-myspell-dicts],
1667         [Adds myspell dictionaries to the LibreOffice installation set]),
1670 AC_ARG_WITH(system-dicts,
1671     AS_HELP_STRING([--without-system-dicts],
1672         [Do not use dictionaries from system paths.]),
1675 AC_ARG_WITH(external-dict-dir,
1676     AS_HELP_STRING([--with-external-dict-dir],
1677         [Specify external dictionary dir.]),
1680 AC_ARG_WITH(external-hyph-dir,
1681     AS_HELP_STRING([--with-external-hyph-dir],
1682         [Specify external hyphenation pattern dir.]),
1685 AC_ARG_WITH(external-thes-dir,
1686     AS_HELP_STRING([--with-external-thes-dir],
1687         [Specify external thesaurus dir.]),
1690 AC_ARG_WITH(system-zlib,
1691     AS_HELP_STRING([--with-system-zlib],
1692         [Use zlib already on system.]),,
1693     [with_system_zlib=auto])
1695 AC_ARG_WITH(system-jpeg,
1696     AS_HELP_STRING([--with-system-jpeg],
1697         [Use jpeg already on system.]),,
1698     [with_system_jpeg="$with_system_libs"])
1700 AC_ARG_WITH(system-clucene,
1701     AS_HELP_STRING([--with-system-clucene],
1702         [Use clucene already on system.]),,
1703     [with_system_clucene="$with_system_libs"])
1705 AC_ARG_WITH(system-expat,
1706     AS_HELP_STRING([--with-system-expat],
1707         [Use expat already on system.]),,
1708     [with_system_expat="$with_system_libs"])
1710 AC_ARG_WITH(system-libxml,
1711     AS_HELP_STRING([--with-system-libxml],
1712         [Use libxml/libxslt already on system.]),,
1713     [with_system_libxml=auto])
1715 AC_ARG_WITH(system-icu,
1716     AS_HELP_STRING([--with-system-icu],
1717         [Use icu already on system.]),,
1718     [with_system_icu="$with_system_libs"])
1720 AC_ARG_WITH(system-ucpp,
1721     AS_HELP_STRING([--with-system-ucpp],
1722         [Use ucpp already on system.]),,
1723     [])
1725 AC_ARG_WITH(system-openldap,
1726     AS_HELP_STRING([--with-system-openldap],
1727         [Use the OpenLDAP LDAP SDK already on system.]),,
1728     [with_system_openldap="$with_system_libs"])
1730 libo_FUZZ_ARG_ENABLE(poppler,
1731     AS_HELP_STRING([--disable-poppler],
1732         [Disable building Poppler.])
1735 AC_ARG_WITH(system-poppler,
1736     AS_HELP_STRING([--with-system-poppler],
1737         [Use system poppler (only needed for PDF import).]),,
1738     [with_system_poppler="$with_system_libs"])
1740 AC_ARG_WITH(system-gpgmepp,
1741     AS_HELP_STRING([--with-system-gpgmepp],
1742         [Use gpgmepp already on system]),,
1743     [with_system_gpgmepp="$with_system_libs"])
1745 AC_ARG_WITH(system-apache-commons,
1746     AS_HELP_STRING([--with-system-apache-commons],
1747         [Use Apache commons libraries already on system.]),,
1748     [with_system_apache_commons="$with_system_jars"])
1750 AC_ARG_WITH(system-mariadb,
1751     AS_HELP_STRING([--with-system-mariadb],
1752         [Use MariaDB/MySQL libraries already on system.]),,
1753     [with_system_mariadb="$with_system_libs"])
1755 AC_ARG_ENABLE(bundle-mariadb,
1756     AS_HELP_STRING([--enable-bundle-mariadb],
1757         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1760 AC_ARG_WITH(system-postgresql,
1761     AS_HELP_STRING([--with-system-postgresql],
1762         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1763          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1764     [with_system_postgresql="$with_system_libs"])
1766 AC_ARG_WITH(libpq-path,
1767     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1768         [Use this PostgreSQL C interface (libpq) installation for building
1769          the PostgreSQL-SDBC extension.]),
1772 AC_ARG_WITH(system-firebird,
1773     AS_HELP_STRING([--with-system-firebird],
1774         [Use Firebird libraries already on system, for building the Firebird-SDBC
1775          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1776     [with_system_firebird="$with_system_libs"])
1778 AC_ARG_WITH(system-libtommath,
1779             AS_HELP_STRING([--with-system-libtommath],
1780                            [Use libtommath already on system]),,
1781             [with_system_libtommath="$with_system_libs"])
1783 AC_ARG_WITH(system-hsqldb,
1784     AS_HELP_STRING([--with-system-hsqldb],
1785         [Use hsqldb already on system.]))
1787 AC_ARG_WITH(hsqldb-jar,
1788     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1789         [Specify path to jarfile manually.]),
1790     HSQLDB_JAR=$withval)
1792 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1793     AS_HELP_STRING([--disable-scripting-beanshell],
1794         [Disable support for scripts in BeanShell.]),
1798 AC_ARG_WITH(system-beanshell,
1799     AS_HELP_STRING([--with-system-beanshell],
1800         [Use beanshell already on system.]),,
1801     [with_system_beanshell="$with_system_jars"])
1803 AC_ARG_WITH(beanshell-jar,
1804     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1805         [Specify path to jarfile manually.]),
1806     BSH_JAR=$withval)
1808 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1809     AS_HELP_STRING([--disable-scripting-javascript],
1810         [Disable support for scripts in JavaScript.]),
1814 AC_ARG_WITH(system-rhino,
1815     AS_HELP_STRING([--with-system-rhino],
1816         [Use rhino already on system.]),,)
1817 #    [with_system_rhino="$with_system_jars"])
1818 # Above is not used as we have different debug interface
1819 # patched into internal rhino. This code needs to be fixed
1820 # before we can enable it by default.
1822 AC_ARG_WITH(rhino-jar,
1823     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1824         [Specify path to jarfile manually.]),
1825     RHINO_JAR=$withval)
1827 AC_ARG_WITH(commons-logging-jar,
1828     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1829         [Specify path to jarfile manually.]),
1830     COMMONS_LOGGING_JAR=$withval)
1832 AC_ARG_WITH(system-jfreereport,
1833     AS_HELP_STRING([--with-system-jfreereport],
1834         [Use JFreeReport already on system.]),,
1835     [with_system_jfreereport="$with_system_jars"])
1837 AC_ARG_WITH(sac-jar,
1838     AS_HELP_STRING([--with-sac-jar=JARFILE],
1839         [Specify path to jarfile manually.]),
1840     SAC_JAR=$withval)
1842 AC_ARG_WITH(libxml-jar,
1843     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1844         [Specify path to jarfile manually.]),
1845     LIBXML_JAR=$withval)
1847 AC_ARG_WITH(flute-jar,
1848     AS_HELP_STRING([--with-flute-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     FLUTE_JAR=$withval)
1852 AC_ARG_WITH(jfreereport-jar,
1853     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     JFREEREPORT_JAR=$withval)
1857 AC_ARG_WITH(liblayout-jar,
1858     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     LIBLAYOUT_JAR=$withval)
1862 AC_ARG_WITH(libloader-jar,
1863     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     LIBLOADER_JAR=$withval)
1867 AC_ARG_WITH(libformula-jar,
1868     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     LIBFORMULA_JAR=$withval)
1872 AC_ARG_WITH(librepository-jar,
1873     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     LIBREPOSITORY_JAR=$withval)
1877 AC_ARG_WITH(libfonts-jar,
1878     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     LIBFONTS_JAR=$withval)
1882 AC_ARG_WITH(libserializer-jar,
1883     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     LIBSERIALIZER_JAR=$withval)
1887 AC_ARG_WITH(libbase-jar,
1888     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBBASE_JAR=$withval)
1892 AC_ARG_WITH(system-odbc,
1893     AS_HELP_STRING([--with-system-odbc],
1894         [Use the odbc headers already on system.]),,
1895     [with_system_odbc="auto"])
1897 AC_ARG_WITH(system-sane,
1898     AS_HELP_STRING([--with-system-sane],
1899         [Use sane.h already on system.]),,
1900     [with_system_sane="$with_system_headers"])
1902 AC_ARG_WITH(system-bluez,
1903     AS_HELP_STRING([--with-system-bluez],
1904         [Use bluetooth.h already on system.]),,
1905     [with_system_bluez="$with_system_headers"])
1907 AC_ARG_WITH(system-curl,
1908     AS_HELP_STRING([--with-system-curl],
1909         [Use curl already on system.]),,
1910     [with_system_curl=auto])
1912 AC_ARG_WITH(system-boost,
1913     AS_HELP_STRING([--with-system-boost],
1914         [Use boost already on system.]),,
1915     [with_system_boost="$with_system_headers"])
1917 AC_ARG_WITH(system-glm,
1918     AS_HELP_STRING([--with-system-glm],
1919         [Use glm already on system.]),,
1920     [with_system_glm="$with_system_headers"])
1922 AC_ARG_WITH(system-hunspell,
1923     AS_HELP_STRING([--with-system-hunspell],
1924         [Use libhunspell already on system.]),,
1925     [with_system_hunspell="$with_system_libs"])
1927 AC_ARG_WITH(system-qrcodegen,
1928     AS_HELP_STRING([--with-system-qrcodegen],
1929         [Use libqrcodegen already on system.]),,
1930     [with_system_qrcodegen="$with_system_libs"])
1932 AC_ARG_WITH(system-mythes,
1933     AS_HELP_STRING([--with-system-mythes],
1934         [Use mythes already on system.]),,
1935     [with_system_mythes="$with_system_libs"])
1937 AC_ARG_WITH(system-altlinuxhyph,
1938     AS_HELP_STRING([--with-system-altlinuxhyph],
1939         [Use ALTLinuxhyph already on system.]),,
1940     [with_system_altlinuxhyph="$with_system_libs"])
1942 AC_ARG_WITH(system-lpsolve,
1943     AS_HELP_STRING([--with-system-lpsolve],
1944         [Use lpsolve already on system.]),,
1945     [with_system_lpsolve="$with_system_libs"])
1947 AC_ARG_WITH(system-coinmp,
1948     AS_HELP_STRING([--with-system-coinmp],
1949         [Use CoinMP already on system.]),,
1950     [with_system_coinmp="$with_system_libs"])
1952 AC_ARG_WITH(system-liblangtag,
1953     AS_HELP_STRING([--with-system-liblangtag],
1954         [Use liblangtag library already on system.]),,
1955     [with_system_liblangtag="$with_system_libs"])
1957 AC_ARG_WITH(webdav,
1958     AS_HELP_STRING([--with-webdav],
1959         [Specify which library to use for webdav implementation.
1960          Possible values: "neon", "serf", "no". The default value is "neon".
1961          Example: --with-webdav="serf"]),
1962     WITH_WEBDAV=$withval,
1963     WITH_WEBDAV="neon")
1965 AC_ARG_WITH(linker-hash-style,
1966     AS_HELP_STRING([--with-linker-hash-style],
1967         [Use linker with --hash-style=<style> when linking shared objects.
1968          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1969          if supported on the build system, and "sysv" otherwise.]))
1971 AC_ARG_WITH(jdk-home,
1972     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1973         [If you have installed JDK 8 or later on your system please supply the
1974          path here. Note that this is not the location of the java command but the
1975          location of the entire distribution.]),
1978 AC_ARG_WITH(help,
1979     AS_HELP_STRING([--with-help],
1980         [Enable the build of help. There is a special parameter "common" that
1981          can be used to bundle only the common part, .e.g help-specific icons.
1982          This is useful when you build the helpcontent separately.])
1983     [
1984                           Usage:     --with-help    build the old local help
1985                                  --without-help     no local help (default)
1986                                  --with-help=html   build the new HTML local help
1987                                  --with-help=online build the new HTML online help
1988     ],
1991 AC_ARG_WITH(omindex,
1992    AS_HELP_STRING([--with-omindex],
1993         [Enable the support of xapian-omega index for online help.])
1994    [
1995                          Usage: --with-omindex=server prepare the pages for omindex
1996                                 but let xapian-omega be built in server.
1997                                 --with-omindex=noxap do not prepare online pages
1998                                 for xapian-omega
1999   ],
2002 libo_FUZZ_ARG_WITH(java,
2003     AS_HELP_STRING([--with-java=<java command>],
2004         [Specify the name of the Java interpreter command. Typically "java"
2005          which is the default.
2007          To build without support for Java components, applets, accessibility
2008          or the XML filters written in Java, use --without-java or --with-java=no.]),
2009     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2010     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2013 AC_ARG_WITH(jvm-path,
2014     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2015         [Use a specific JVM search path at runtime.
2016          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2019 AC_ARG_WITH(ant-home,
2020     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2021         [If you have installed Apache Ant on your system, please supply the path here.
2022          Note that this is not the location of the Ant binary but the location
2023          of the entire distribution.]),
2026 AC_ARG_WITH(symbol-config,
2027     AS_HELP_STRING([--with-symbol-config],
2028         [Configuration for the crashreport symbol upload]),
2029         [],
2030         [with_symbol_config=no])
2032 AC_ARG_WITH(export-validation,
2033     AS_HELP_STRING([--without-export-validation],
2034         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2035 ,with_export_validation=auto)
2037 AC_ARG_WITH(bffvalidator,
2038     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2039         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2040          Requires installed Microsoft Office Binary File Format Validator.
2041          Note: export-validation (--with-export-validation) is required to be turned on.
2042          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2043 ,with_bffvalidator=no)
2045 libo_FUZZ_ARG_WITH(junit,
2046     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2047         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2048          --without-junit disables those tests. Not relevant in the --without-java case.]),
2049 ,with_junit=yes)
2051 AC_ARG_WITH(hamcrest,
2052     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2053         [Specifies the hamcrest jar file to use for JUnit-based tests.
2054          --without-junit disables those tests. Not relevant in the --without-java case.]),
2055 ,with_hamcrest=yes)
2057 AC_ARG_WITH(perl-home,
2058     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2059         [If you have installed Perl 5 Distribution, on your system, please
2060          supply the path here. Note that this is not the location of the Perl
2061          binary but the location of the entire distribution.]),
2064 libo_FUZZ_ARG_WITH(doxygen,
2065     AS_HELP_STRING(
2066         [--with-doxygen=<absolute path to doxygen executable>],
2067         [Specifies the doxygen executable to use when generating ODK C/C++
2068          documentation. --without-doxygen disables generation of ODK C/C++
2069          documentation. Not relevant in the --disable-odk case.]),
2070 ,with_doxygen=yes)
2072 AC_ARG_WITH(visual-studio,
2073     AS_HELP_STRING([--with-visual-studio=<2017>],
2074         [Specify which Visual Studio version to use in case several are
2075          installed. Currently only 2017 is supported.]),
2078 AC_ARG_WITH(windows-sdk,
2079     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2080         [Specify which Windows SDK, or "Windows Kit", version to use
2081          in case the one that came with the selected Visual Studio
2082          is not what you want for some reason. Note that not all compiler/SDK
2083          combinations are supported. The intent is that this option should not
2084          be needed.]),
2087 AC_ARG_WITH(lang,
2088     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2089         [Use this option to build LibreOffice with additional UI language support.
2090          English (US) is always included by default.
2091          Separate multiple languages with space.
2092          For all languages, use --with-lang=ALL.]),
2095 AC_ARG_WITH(locales,
2096     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2097         [Use this option to limit the locale information built in.
2098          Separate multiple locales with space.
2099          Very experimental and might well break stuff.
2100          Just a desperate measure to shrink code and data size.
2101          By default all the locales available is included.
2102          This option is completely unrelated to --with-lang.])
2103     [
2104                           Affects also our character encoding conversion
2105                           tables for encodings mainly targeted for a
2106                           particular locale, like EUC-CN and EUC-TW for
2107                           zh, ISO-2022-JP for ja.
2109                           Affects also our add-on break iterator data for
2110                           some languages.
2112                           For the default, all locales, don't use this switch at all.
2113                           Specifying just the language part of a locale means all matching
2114                           locales will be included.
2115     ],
2118 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2119 libo_FUZZ_ARG_WITH(krb5,
2120     AS_HELP_STRING([--with-krb5],
2121         [Enable MIT Kerberos 5 support in modules that support it.
2122          By default automatically enabled on platforms
2123          where a good system Kerberos 5 is available.]),
2126 libo_FUZZ_ARG_WITH(gssapi,
2127     AS_HELP_STRING([--with-gssapi],
2128         [Enable GSSAPI support in modules that support it.
2129          By default automatically enabled on platforms
2130          where a good system GSSAPI is available.]),
2133 AC_ARG_WITH(iwyu,
2134     AS_HELP_STRING([--with-iwyu],
2135         [Use given IWYU binary path to check unneeded includes instead of building.
2136          Use only if you are hacking on it.]),
2139 libo_FUZZ_ARG_WITH(lxml,
2140     AS_HELP_STRING([--without-lxml],
2141         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2142          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2143          report widget classes and ids.]),
2146 dnl ===================================================================
2147 dnl Branding
2148 dnl ===================================================================
2150 AC_ARG_WITH(branding,
2151     AS_HELP_STRING([--with-branding=/path/to/images],
2152         [Use given path to retrieve branding images set.])
2153     [
2154                           Search for intro.png about.svg and flat_logo.svg.
2155                           If any is missing, default ones will be used instead.
2157                           Search also progress.conf for progress
2158                           settings on intro screen :
2160                           PROGRESSBARCOLOR="255,255,255" Set color of
2161                           progress bar. Comma separated RGB decimal values.
2162                           PROGRESSSIZE="407,6" Set size of progress bar.
2163                           Comma separated decimal values (width, height).
2164                           PROGRESSPOSITION="61,317" Set position of progress
2165                           bar from left,top. Comma separated decimal values.
2166                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2167                           bar frame. Comma separated RGB decimal values.
2168                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2169                           bar text. Comma separated RGB decimal values.
2170                           PROGRESSTEXTBASELINE="287" Set vertical position of
2171                           progress bar text from top. Decimal value.
2173                           Default values will be used if not found.
2174     ],
2178 AC_ARG_WITH(extra-buildid,
2179     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2180         [Show addition build identification in about dialog.]),
2184 AC_ARG_WITH(vendor,
2185     AS_HELP_STRING([--with-vendor="John the Builder"],
2186         [Set vendor of the build.]),
2189 AC_ARG_WITH(android-package-name,
2190     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2191         [Set Android package name of the build.]),
2194 AC_ARG_WITH(compat-oowrappers,
2195     AS_HELP_STRING([--with-compat-oowrappers],
2196         [Install oo* wrappers in parallel with
2197          lo* ones to keep backward compatibility.
2198          Has effect only with make distro-pack-install]),
2201 AC_ARG_WITH(os-version,
2202     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2203         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2206 AC_ARG_WITH(mingw-cross-compiler,
2207     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2208         [Specify the MinGW cross-compiler to use.
2209          When building on the ODK on Unix and building unowinreg.dll,
2210          specify the MinGW C++ cross-compiler.]),
2213 AC_ARG_WITH(idlc-cpp,
2214     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2215         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2218 AC_ARG_WITH(build-version,
2219     AS_HELP_STRING([--with-build-version="Built by Jim"],
2220         [Allows the builder to add a custom version tag that will appear in the
2221          Help/About box for QA purposes.]),
2222 with_build_version=$withval,
2225 AC_ARG_WITH(parallelism,
2226     AS_HELP_STRING([--with-parallelism],
2227         [Number of jobs to run simultaneously during build. Parallel builds can
2228         save a lot of time on multi-cpu machines. Defaults to the number of
2229         CPUs on the machine, unless you configure --enable-icecream - then to
2230         40.]),
2233 AC_ARG_WITH(all-tarballs,
2234     AS_HELP_STRING([--with-all-tarballs],
2235         [Download all external tarballs unconditionally]))
2237 AC_ARG_WITH(gdrive-client-id,
2238     AS_HELP_STRING([--with-gdrive-client-id],
2239         [Provides the client id of the application for OAuth2 authentication
2240         on Google Drive. If either this or --with-gdrive-client-secret is
2241         empty, the feature will be disabled]),
2244 AC_ARG_WITH(gdrive-client-secret,
2245     AS_HELP_STRING([--with-gdrive-client-secret],
2246         [Provides the client secret of the application for OAuth2
2247         authentication on Google Drive. If either this or
2248         --with-gdrive-client-id is empty, the feature will be disabled]),
2251 AC_ARG_WITH(alfresco-cloud-client-id,
2252     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2253         [Provides the client id of the application for OAuth2 authentication
2254         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2255         empty, the feature will be disabled]),
2258 AC_ARG_WITH(alfresco-cloud-client-secret,
2259     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2260         [Provides the client secret of the application for OAuth2
2261         authentication on Alfresco Cloud. If either this or
2262         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2265 AC_ARG_WITH(onedrive-client-id,
2266     AS_HELP_STRING([--with-onedrive-client-id],
2267         [Provides the client id of the application for OAuth2 authentication
2268         on OneDrive. If either this or --with-onedrive-client-secret is
2269         empty, the feature will be disabled]),
2272 AC_ARG_WITH(onedrive-client-secret,
2273     AS_HELP_STRING([--with-onedrive-client-secret],
2274         [Provides the client secret of the application for OAuth2
2275         authentication on OneDrive. If either this or
2276         --with-onedrive-client-id is empty, the feature will be disabled]),
2278 dnl ===================================================================
2279 dnl Do we want to use pre-build binary tarball for recompile
2280 dnl ===================================================================
2282 if test "$enable_library_bin_tar" = "yes" ; then
2283     USE_LIBRARY_BIN_TAR=TRUE
2284 else
2285     USE_LIBRARY_BIN_TAR=
2287 AC_SUBST(USE_LIBRARY_BIN_TAR)
2289 dnl ===================================================================
2290 dnl Test whether build target is Release Build
2291 dnl ===================================================================
2292 AC_MSG_CHECKING([whether build target is Release Build])
2293 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2294     AC_MSG_RESULT([no])
2295     ENABLE_RELEASE_BUILD=
2296 else
2297     AC_MSG_RESULT([yes])
2298     ENABLE_RELEASE_BUILD=TRUE
2300 AC_SUBST(ENABLE_RELEASE_BUILD)
2302 dnl ===================================================================
2303 dnl Test whether to sign Windows Build
2304 dnl ===================================================================
2305 AC_MSG_CHECKING([whether to sign windows build])
2306 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2307     AC_MSG_RESULT([yes])
2308     WINDOWS_BUILD_SIGNING="TRUE"
2309 else
2310     AC_MSG_RESULT([no])
2311     WINDOWS_BUILD_SIGNING="FALSE"
2313 AC_SUBST(WINDOWS_BUILD_SIGNING)
2315 dnl ===================================================================
2316 dnl MacOSX build and runtime environment options
2317 dnl ===================================================================
2319 AC_ARG_WITH(macosx-sdk,
2320     AS_HELP_STRING([--with-macosx-sdk=<version>],
2321         [Prefer a specific SDK for building.])
2322     [
2323                           If the requested SDK is not available, a search for the oldest one will be done.
2324                           With current Xcode versions, only the latest SDK is included, so this option is
2325                           not terribly useful. It works fine to build with a new SDK and run the result
2326                           on an older OS.
2328                           e. g.: --with-macosx-sdk=10.10
2330                           there are 3 options to control the MacOSX build:
2331                           --with-macosx-sdk (referred as 'sdk' below)
2332                           --with-macosx-version-min-required (referred as 'min' below)
2333                           --with-macosx-version-max-allowed (referred as 'max' below)
2335                           the connection between these value and the default they take is as follow:
2336                           ( ? means not specified on the command line, s means the SDK version found,
2337                           constraint: 8 <= x <= y <= z)
2339                           ==========================================
2340                            command line      || config result
2341                           ==========================================
2342                           min  | max  | sdk  || min   | max  | sdk  |
2343                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2344                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2345                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2346                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2347                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2348                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2349                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2350                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2353                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2354                           for a detailed technical explanation of these variables
2356                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2357     ],
2360 AC_ARG_WITH(macosx-version-min-required,
2361     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2362         [set the minimum OS version needed to run the built LibreOffice])
2363     [
2364                           e. g.: --with-macos-version-min-required=10.10
2365                           see --with-macosx-sdk for more info
2366     ],
2369 AC_ARG_WITH(macosx-version-max-allowed,
2370     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2371         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2372     [
2373                           e. g.: --with-macos-version-max-allowed=10.10
2374                           see --with-macosx-sdk for more info
2375     ],
2379 dnl ===================================================================
2380 dnl options for stuff used during cross-compilation build
2381 dnl Not quite superseded by --with-build-platform-configure-options.
2382 dnl TODO: check, if the "force" option is still needed anywhere.
2383 dnl ===================================================================
2385 AC_ARG_WITH(system-icu-for-build,
2386     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2387         [Use icu already on system for build tools (cross-compilation only).]))
2390 dnl ===================================================================
2391 dnl Check for incompatible options set by fuzzing, and reset those
2392 dnl automatically to working combinations
2393 dnl ===================================================================
2395 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2396         "$enable_dbus" != "$enable_avahi"; then
2397     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2398     enable_avahi=$enable_dbus
2401 add_lopath_after ()
2403     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2404         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2405     fi
2408 add_lopath_before ()
2410     local IFS=${P_SEP}
2411     local path_cleanup
2412     local dir
2413     for dir in $LO_PATH ; do
2414         if test "$dir" != "$1" ; then
2415             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2416         fi
2417     done
2418     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2421 dnl ===================================================================
2422 dnl check for required programs (grep, awk, sed, bash)
2423 dnl ===================================================================
2425 pathmunge ()
2427     if test -n "$1"; then
2428         if test "$build_os" = "cygwin"; then
2429             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2430                 PathFormat "$1"
2431                 new_path=`cygpath -sm "$formatted_path"`
2432             else
2433                 PathFormat "$1"
2434                 new_path=`cygpath -u "$formatted_path"`
2435             fi
2436         else
2437             new_path="$1"
2438         fi
2439         if test "$2" = "after"; then
2440             add_lopath_after "$new_path"
2441         else
2442             add_lopath_before "$new_path"
2443         fi
2444         unset new_path
2445     fi
2448 AC_PROG_AWK
2449 AC_PATH_PROG( AWK, $AWK)
2450 if test -z "$AWK"; then
2451     AC_MSG_ERROR([install awk to run this script])
2454 AC_PATH_PROG(BASH, bash)
2455 if test -z "$BASH"; then
2456     AC_MSG_ERROR([bash not found in \$PATH])
2458 AC_SUBST(BASH)
2460 AC_MSG_CHECKING([for GNU or BSD tar])
2461 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2462     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2463     if test $? -eq 0;  then
2464         GNUTAR=$a
2465         break
2466     fi
2467 done
2468 AC_MSG_RESULT($GNUTAR)
2469 if test -z "$GNUTAR"; then
2470     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2472 AC_SUBST(GNUTAR)
2474 AC_MSG_CHECKING([for tar's option to strip components])
2475 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2476 if test $? -eq 0; then
2477     STRIP_COMPONENTS="--strip-components"
2478 else
2479     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2480     if test $? -eq 0; then
2481         STRIP_COMPONENTS="--strip-path"
2482     else
2483         STRIP_COMPONENTS="unsupported"
2484     fi
2486 AC_MSG_RESULT($STRIP_COMPONENTS)
2487 if test x$STRIP_COMPONENTS = xunsupported; then
2488     AC_MSG_ERROR([you need a tar that is able to strip components.])
2490 AC_SUBST(STRIP_COMPONENTS)
2492 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2493 dnl desktop OSes from "mobile" ones.
2495 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2496 dnl In other words, that when building for an OS that is not a
2497 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2499 dnl Note the direction of the implication; there is no assumption that
2500 dnl cross-compiling would imply a non-desktop OS.
2502 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2503     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2504     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2505     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2508 # Whether to build "avmedia" functionality or not.
2510 if test -z "$enable_avmedia"; then
2511     enable_avmedia=yes
2514 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2515 if test "$enable_avmedia" = yes; then
2516     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2517 else
2518     USE_AVMEDIA_DUMMY='TRUE'
2520 AC_SUBST(USE_AVMEDIA_DUMMY)
2522 # Decide whether to build database connectivity stuff (including
2523 # Base) or not. We probably don't want to on non-desktop OSes.
2524 if test -z "$enable_database_connectivity"; then
2525     # --disable-database-connectivity is unfinished work in progress
2526     # and the iOS test app doesn't link if we actually try to use it.
2527     # if test $_os != iOS -a $_os != Android; then
2528     if test $_os != iOS; then
2529         enable_database_connectivity=yes
2530     fi
2533 if test "$enable_database_connectivity" = yes; then
2534     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2535     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2538 if test -z "$enable_extensions"; then
2539     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2540     if test $_os != iOS -a $_os != Android; then
2541         enable_extensions=yes
2542     fi
2545 if test "$enable_extensions" = yes; then
2546     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2547     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2550 if test -z "$enable_scripting"; then
2551     # Disable scripting for iOS unless specifically overridden
2552     # with --enable-scripting.
2553     if test $_os != iOS; then
2554         enable_scripting=yes
2555     fi
2558 DISABLE_SCRIPTING=''
2559 if test "$enable_scripting" = yes; then
2560     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2561     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2562 else
2563     DISABLE_SCRIPTING='TRUE'
2564     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2567 if test $_os = iOS -o $_os = Android; then
2568     # Disable dynamic_loading always for iOS and Android
2569     enable_dynamic_loading=no
2570 elif test -z "$enable_dynamic_loading"; then
2571     # Otherwise enable it unless specifically disabled
2572     enable_dynamic_loading=yes
2575 DISABLE_DYNLOADING=''
2576 if test "$enable_dynamic_loading" = yes; then
2577     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2578 else
2579     DISABLE_DYNLOADING='TRUE'
2581 AC_SUBST(DISABLE_DYNLOADING)
2583 # remember SYSBASE value
2584 AC_SUBST(SYSBASE)
2586 dnl ===================================================================
2587 dnl  Sort out various gallery compilation options
2588 dnl ===================================================================
2589 AC_MSG_CHECKING([how to build and package galleries])
2590 if test -n "${with_galleries}"; then
2591     if test "$with_galleries" = "build"; then
2592         WITH_GALLERY_BUILD=TRUE
2593         AC_MSG_RESULT([build from source images internally])
2594     elif test "$with_galleries" = "no"; then
2595         WITH_GALLERY_BUILD=
2596         AC_MSG_RESULT([disable non-internal gallery build])
2597     else
2598         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2599     fi
2600 else
2601     if test $_os != iOS -a $_os != Android; then
2602         WITH_GALLERY_BUILD=TRUE
2603         AC_MSG_RESULT([internal src images for desktop])
2604     else
2605         WITH_GALLERY_BUILD=
2606         AC_MSG_RESULT([disable src image build])
2607     fi
2609 AC_SUBST(WITH_GALLERY_BUILD)
2611 dnl ===================================================================
2612 dnl  Checks if ccache is available
2613 dnl ===================================================================
2614 CCACHE_DEPEND_MODE=
2615 if test "$_os" = "WINNT"; then
2616     # on windows/VC build do not use ccache
2617     CCACHE=""
2618 elif test "$enable_ccache" = "no"; then
2619     CCACHE=""
2620 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2621     case "%$CC%$CXX%" in
2622     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2623     # assume that's good then
2624     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2625         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2626         CCACHE_DEPEND_MODE=1
2627         ;;
2628     *)
2629         AC_PATH_PROG([CCACHE],[ccache],[not found])
2630         if test "$CCACHE" = "not found"; then
2631             CCACHE=""
2632         else
2633             CCACHE_DEPEND_MODE=1
2634             # Need to check for ccache version: otherwise prevents
2635             # caching of the results (like "-x objective-c++" for Mac)
2636             if test $_os = Darwin -o $_os = iOS; then
2637                 # Check ccache version
2638                 AC_MSG_CHECKING([whether version of ccache is suitable])
2639                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2640                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2641                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2642                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2643                 else
2644                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2645                     CCACHE=""
2646                     CCACHE_DEPEND_MODE=
2647                 fi
2648             fi
2649         fi
2650         ;;
2651     esac
2652 else
2653     CCACHE=""
2655 if test "$enable_ccache" = "nodepend"; then
2656     CCACHE_DEPEND_MODE=""
2658 AC_SUBST(CCACHE_DEPEND_MODE)
2660 if test "$CCACHE" != ""; then
2661     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2662     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2663     if test "$ccache_size" = ""; then
2664         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2665         if test "$ccache_size" = ""; then
2666             ccache_size=0
2667         fi
2668         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2669         if test $ccache_size -lt 1024; then
2670             CCACHE=""
2671             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2672             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2673         else
2674             # warn that ccache may be too small for debug build
2675             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2676             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2677         fi
2678     else
2679         if test $ccache_size -lt 5; then
2680             #warn that ccache may be too small for debug build
2681             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2682             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2683         fi
2684     fi
2687 dnl ===================================================================
2688 dnl  Checks for C compiler,
2689 dnl  The check for the C++ compiler is later on.
2690 dnl ===================================================================
2691 if test "$_os" != "WINNT"; then
2692     GCC_HOME_SET="true"
2693     AC_MSG_CHECKING([gcc home])
2694     if test -z "$with_gcc_home"; then
2695         if test "$enable_icecream" = "yes"; then
2696             if test -d "/usr/lib/icecc/bin"; then
2697                 GCC_HOME="/usr/lib/icecc/"
2698             elif test -d "/usr/libexec/icecc/bin"; then
2699                 GCC_HOME="/usr/libexec/icecc/"
2700             elif test -d "/opt/icecream/bin"; then
2701                 GCC_HOME="/opt/icecream/"
2702             else
2703                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2705             fi
2706         else
2707             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2708             GCC_HOME_SET="false"
2709         fi
2710     else
2711         GCC_HOME="$with_gcc_home"
2712     fi
2713     AC_MSG_RESULT($GCC_HOME)
2714     AC_SUBST(GCC_HOME)
2716     if test "$GCC_HOME_SET" = "true"; then
2717         if test -z "$CC"; then
2718             CC="$GCC_HOME/bin/gcc"
2719             CC_BASE="gcc"
2720         fi
2721         if test -z "$CXX"; then
2722             CXX="$GCC_HOME/bin/g++"
2723             CXX_BASE="g++"
2724         fi
2725     fi
2728 COMPATH=`dirname "$CC"`
2729 if test "$COMPATH" = "."; then
2730     AC_PATH_PROGS(COMPATH, $CC)
2731     dnl double square bracket to get single because of M4 quote...
2732     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2734 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2736 dnl ===================================================================
2737 dnl Java support
2738 dnl ===================================================================
2739 AC_MSG_CHECKING([whether to build with Java support])
2740 if test "$with_java" != "no"; then
2741     if test "$DISABLE_SCRIPTING" = TRUE; then
2742         AC_MSG_RESULT([no, overridden by --disable-scripting])
2743         ENABLE_JAVA=""
2744         with_java=no
2745     else
2746         AC_MSG_RESULT([yes])
2747         ENABLE_JAVA="TRUE"
2748         AC_DEFINE(HAVE_FEATURE_JAVA)
2749     fi
2750 else
2751     AC_MSG_RESULT([no])
2752     ENABLE_JAVA=""
2755 AC_SUBST(ENABLE_JAVA)
2757 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2759 dnl ENABLE_JAVA="" indicate no Java support at all
2761 dnl ===================================================================
2762 dnl Check macOS SDK and compiler
2763 dnl ===================================================================
2765 if test $_os = Darwin; then
2767     # If no --with-macosx-sdk option is given, look for one
2769     # The intent is that for "most" Mac-based developers, a suitable
2770     # SDK will be found automatically without any configure options.
2772     # For developers with a current Xcode, the lowest-numbered SDK
2773     # higher than or equal to the minimum required should be found.
2775     AC_MSG_CHECKING([what macOS SDK to use])
2776     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2777         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2778         if test -d "$MACOSX_SDK_PATH"; then
2779             with_macosx_sdk="${_macosx_sdk}"
2780             break
2781         else
2782             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2783             if test -d "$MACOSX_SDK_PATH"; then
2784                 with_macosx_sdk="${_macosx_sdk}"
2785                 break
2786             fi
2787         fi
2788     done
2789     if test ! -d "$MACOSX_SDK_PATH"; then
2790         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2791     fi
2793     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2795     case $with_macosx_sdk in
2796     10.12)
2797         MACOSX_SDK_VERSION=101200
2798         ;;
2799     10.13)
2800         MACOSX_SDK_VERSION=101300
2801         ;;
2802     10.14)
2803         MACOSX_SDK_VERSION=101400
2804         ;;
2805     10.15)
2806         MACOSX_SDK_VERSION=101500
2807         ;;
2808     *)
2809         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2810         ;;
2811     esac
2813     if test "$with_macosx_version_min_required" = "" ; then
2814         with_macosx_version_min_required="10.10";
2815     fi
2817     if test "$with_macosx_version_max_allowed" = "" ; then
2818         with_macosx_version_max_allowed="$with_macosx_sdk"
2819     fi
2821     # export this so that "xcrun" invocations later return matching values
2822     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2823     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2824     export DEVELOPER_DIR
2825     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2826     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2828     AC_MSG_CHECKING([whether Xcode is new enough])
2829     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2830     my_xcode_ver2=${my_xcode_ver1#Xcode }
2831     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2832     if test "$my_xcode_ver3" -ge 903; then
2833         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2834     else
2835         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2836     fi
2838     case "$with_macosx_version_min_required" in
2839     10.10)
2840         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2841         ;;
2842     10.11)
2843         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2844         ;;
2845     10.12)
2846         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2847         ;;
2848     10.13)
2849         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2850         ;;
2851     10.14)
2852         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2853         ;;
2854     10.15)
2855         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2856         ;;
2857     *)
2858         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2859         ;;
2860     esac
2861     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2863     LIBTOOL=/usr/bin/libtool
2864     INSTALL_NAME_TOOL=install_name_tool
2865     if test -z "$save_CC"; then
2866         stdlib=-stdlib=libc++
2867         if test "$ENABLE_LTO" = TRUE; then
2868             lto=-flto
2869         fi
2871         AC_MSG_CHECKING([what C compiler to use])
2872         CC="`xcrun -find clang`"
2873         CC_BASE=`first_arg_basename "$CC"`
2874         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2875         AC_MSG_RESULT([$CC])
2877         AC_MSG_CHECKING([what C++ compiler to use])
2878         CXX="`xcrun -find clang++`"
2879         CXX_BASE=`first_arg_basename "$CXX"`
2880         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2881         AC_MSG_RESULT([$CXX])
2883         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2884         AR=`xcrun -find ar`
2885         NM=`xcrun -find nm`
2886         STRIP=`xcrun -find strip`
2887         LIBTOOL=`xcrun -find libtool`
2888         RANLIB=`xcrun -find ranlib`
2889     fi
2891     case "$with_macosx_version_max_allowed" in
2892     10.10)
2893         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2894         ;;
2895     10.11)
2896         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2897         ;;
2898     10.12)
2899         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2900         ;;
2901     10.13)
2902         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2903         ;;
2904     10.14)
2905         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2906         ;;
2907     10.15)
2908         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2909         ;;
2910     *)
2911         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2912         ;;
2913     esac
2915     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2916     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2917         AC_MSG_ERROR([the version minimum required, $MAC_OS_X_VERSION_MIN_REQUIRED, must be <= the version maximum allowed, $MAC_OS_X_VERSION_MAX_ALLOWED])
2918     else
2919         AC_MSG_RESULT([ok])
2920     fi
2922     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2923     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2924         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2925     else
2926         AC_MSG_RESULT([ok])
2927     fi
2928     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2929     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2931     AC_MSG_CHECKING([whether to do code signing])
2933     if test "$enable_macosx_code_signing" = yes; then
2934         # By default use the first suitable certificate (?).
2936         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2937         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2938         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2939         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2940         # "Developer ID Application" one.
2942         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2943         if test -n "$identity"; then
2944             MACOSX_CODESIGNING_IDENTITY=$identity
2945             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2946             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2947         else
2948             AC_MSG_ERROR([cannot determine identity to use])
2949         fi
2950     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2951         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2952         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2953         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2954     else
2955         AC_MSG_RESULT([no])
2956     fi
2958     AC_MSG_CHECKING([whether to create a Mac App Store package])
2960     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2961         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2962     elif test "$enable_macosx_package_signing" = yes; then
2963         # By default use the first suitable certificate.
2964         # It should be a "3rd Party Mac Developer Installer" one
2966         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2967         if test -n "$identity"; then
2968             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2969             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2970             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2971         else
2972             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2973         fi
2974     elif test -n "$enable_macosx_package_signing"; then
2975         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2976         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2977         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2978     else
2979         AC_MSG_RESULT([no])
2980     fi
2982     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2983         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2984     fi
2986     AC_MSG_CHECKING([whether to sandbox the application])
2988     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2989         AC_MSG_ERROR([macOS sandboxing requires code signing])
2990     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2991         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2992     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2993         ENABLE_MACOSX_SANDBOX=TRUE
2994         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2995         AC_MSG_RESULT([yes])
2996     else
2997         AC_MSG_RESULT([no])
2998     fi
3000     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3001     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3002     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3004 AC_SUBST(MACOSX_SDK_PATH)
3005 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3006 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3007 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3008 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3009 AC_SUBST(INSTALL_NAME_TOOL)
3010 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3011 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3012 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3013 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3014 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3016 dnl ===================================================================
3017 dnl Check iOS SDK and compiler
3018 dnl ===================================================================
3020 if test $_os = iOS; then
3021     AC_MSG_CHECKING([what iOS SDK to use])
3022     current_sdk_ver=13.2
3023     older_sdk_vers="13.1 13.0 12.4 12.2"
3024     if test "$enable_ios_simulator" = "yes"; then
3025         platform=iPhoneSimulator
3026         versionmin=-mios-simulator-version-min=12.2
3027     else
3028         platform=iPhoneOS
3029         versionmin=-miphoneos-version-min=12.2
3030     fi
3031     xcode_developer=`xcode-select -print-path`
3033     for sdkver in $current_sdk_ver $older_sdk_vers; do
3034         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3035         if test -d $t; then
3036             sysroot=$t
3037             break
3038         fi
3039     done
3041     if test -z "$sysroot"; then
3042         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3043     fi
3045     AC_MSG_RESULT($sysroot)
3047     # LTO is not really recommended for iOS builds,
3048     # the link time will be astronomical
3049     if test "$ENABLE_LTO" = TRUE; then
3050         lto=-flto
3051     fi
3053     stdlib="-stdlib=libc++"
3055     AC_MSG_CHECKING([what C compiler to use])
3056     CC="`xcrun -find clang`"
3057     CC_BASE=`first_arg_basename "$CC"`
3058     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3059     AC_MSG_RESULT([$CC])
3061     AC_MSG_CHECKING([what C++ compiler to use])
3062     CXX="`xcrun -find clang++`"
3063     CXX_BASE=`first_arg_basename "$CXX"`
3064     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3065     AC_MSG_RESULT([$CXX])
3067     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3068     AR=`xcrun -find ar`
3069     NM=`xcrun -find nm`
3070     STRIP=`xcrun -find strip`
3071     LIBTOOL=`xcrun -find libtool`
3072     RANLIB=`xcrun -find ranlib`
3075 AC_MSG_CHECKING([whether to treat the installation as read-only])
3077 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3078         "$enable_extensions" != yes; then
3079     enable_readonly_installset=yes
3081 if test "$enable_readonly_installset" = yes; then
3082     AC_MSG_RESULT([yes])
3083     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3084 else
3085     AC_MSG_RESULT([no])
3088 dnl ===================================================================
3089 dnl Structure of install set
3090 dnl ===================================================================
3092 if test $_os = Darwin; then
3093     LIBO_BIN_FOLDER=MacOS
3094     LIBO_ETC_FOLDER=Resources
3095     LIBO_LIBEXEC_FOLDER=MacOS
3096     LIBO_LIB_FOLDER=Frameworks
3097     LIBO_LIB_PYUNO_FOLDER=Resources
3098     LIBO_SHARE_FOLDER=Resources
3099     LIBO_SHARE_HELP_FOLDER=Resources/help
3100     LIBO_SHARE_JAVA_FOLDER=Resources/java
3101     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3102     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3103     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3104     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3105     LIBO_URE_BIN_FOLDER=MacOS
3106     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3107     LIBO_URE_LIB_FOLDER=Frameworks
3108     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3109     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3110 elif test $_os = WINNT; then
3111     LIBO_BIN_FOLDER=program
3112     LIBO_ETC_FOLDER=program
3113     LIBO_LIBEXEC_FOLDER=program
3114     LIBO_LIB_FOLDER=program
3115     LIBO_LIB_PYUNO_FOLDER=program
3116     LIBO_SHARE_FOLDER=share
3117     LIBO_SHARE_HELP_FOLDER=help
3118     LIBO_SHARE_JAVA_FOLDER=program/classes
3119     LIBO_SHARE_PRESETS_FOLDER=presets
3120     LIBO_SHARE_READMES_FOLDER=readmes
3121     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3122     LIBO_SHARE_SHELL_FOLDER=program/shell
3123     LIBO_URE_BIN_FOLDER=program
3124     LIBO_URE_ETC_FOLDER=program
3125     LIBO_URE_LIB_FOLDER=program
3126     LIBO_URE_MISC_FOLDER=program
3127     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3128 else
3129     LIBO_BIN_FOLDER=program
3130     LIBO_ETC_FOLDER=program
3131     LIBO_LIBEXEC_FOLDER=program
3132     LIBO_LIB_FOLDER=program
3133     LIBO_LIB_PYUNO_FOLDER=program
3134     LIBO_SHARE_FOLDER=share
3135     LIBO_SHARE_HELP_FOLDER=help
3136     LIBO_SHARE_JAVA_FOLDER=program/classes
3137     LIBO_SHARE_PRESETS_FOLDER=presets
3138     LIBO_SHARE_READMES_FOLDER=readmes
3139     if test "$enable_fuzzers" != yes; then
3140         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3141     else
3142         LIBO_SHARE_RESOURCE_FOLDER=resource
3143     fi
3144     LIBO_SHARE_SHELL_FOLDER=program/shell
3145     LIBO_URE_BIN_FOLDER=program
3146     LIBO_URE_ETC_FOLDER=program
3147     LIBO_URE_LIB_FOLDER=program
3148     LIBO_URE_MISC_FOLDER=program
3149     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3151 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3152 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3153 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3154 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3155 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3156 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3157 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3158 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3159 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3160 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3161 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3162 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3163 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3164 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3165 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3166 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3168 # Not all of them needed in config_host.mk, add more if need arises
3169 AC_SUBST(LIBO_BIN_FOLDER)
3170 AC_SUBST(LIBO_ETC_FOLDER)
3171 AC_SUBST(LIBO_LIB_FOLDER)
3172 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3173 AC_SUBST(LIBO_SHARE_FOLDER)
3174 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3175 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3176 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3177 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3178 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3179 AC_SUBST(LIBO_URE_BIN_FOLDER)
3180 AC_SUBST(LIBO_URE_ETC_FOLDER)
3181 AC_SUBST(LIBO_URE_LIB_FOLDER)
3182 AC_SUBST(LIBO_URE_MISC_FOLDER)
3183 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3185 dnl ===================================================================
3186 dnl Windows specific tests and stuff
3187 dnl ===================================================================
3189 reg_get_value()
3191     # Return value: $regvalue
3192     unset regvalue
3194     local _regentry="/proc/registry${1}/${2}"
3195     if test -f "$_regentry"; then
3196         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3197         # Registry keys read via /proc/registry* are always \0 terminated!
3198         local _regvalue=$(tr -d '\0' < "$_regentry")
3199         if test $? -eq 0; then
3200             regvalue=$_regvalue
3201         fi
3202     fi
3205 # Get a value from the 32-bit side of the Registry
3206 reg_get_value_32()
3208     reg_get_value "32" "$1"
3211 # Get a value from the 64-bit side of the Registry
3212 reg_get_value_64()
3214     reg_get_value "64" "$1"
3217 if test "$_os" = "WINNT"; then
3218     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3219     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3220         AC_MSG_RESULT([no])
3221         WINDOWS_SDK_ARCH="x86"
3222     else
3223         AC_MSG_RESULT([yes])
3224         WINDOWS_SDK_ARCH="x64"
3225         BITNESS_OVERRIDE=64
3226     fi
3228 if test "$_os" = "iOS"; then
3229     cross_compiling="yes"
3232 if test "$cross_compiling" = "yes"; then
3233     export CROSS_COMPILING=TRUE
3234 else
3235     CROSS_COMPILING=
3236     BUILD_TYPE="$BUILD_TYPE NATIVE"
3238 AC_SUBST(CROSS_COMPILING)
3240 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3241 # NOTE: must _not_ be used for bundled external libraries!
3242 ISYSTEM=
3243 if test "$GCC" = "yes"; then
3244     AC_MSG_CHECKING( for -isystem )
3245     save_CFLAGS=$CFLAGS
3246     CFLAGS="$CFLAGS -Werror"
3247     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3248     CFLAGS=$save_CFLAGS
3249     if test -n "$ISYSTEM"; then
3250         AC_MSG_RESULT(yes)
3251     else
3252         AC_MSG_RESULT(no)
3253     fi
3255 if test -z "$ISYSTEM"; then
3256     # fall back to using -I
3257     ISYSTEM=-I
3259 AC_SUBST(ISYSTEM)
3261 dnl ===================================================================
3262 dnl  Check which Visual Studio compiler is used
3263 dnl ===================================================================
3265 map_vs_year_to_version()
3267     # Return value: $vsversion
3269     unset vsversion
3271     case $1 in
3272     2017)
3273         vsversion=15;;
3274     2019)
3275         vsversion=16;;
3276     *)
3277         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3278     esac
3281 vs_versions_to_check()
3283     # Args: $1 (optional) : versions to check, in the order of preference
3284     # Return value: $vsversions
3286     unset vsversions
3288     if test -n "$1"; then
3289         map_vs_year_to_version "$1"
3290         vsversions=$vsversion
3291     else
3292         # We accept only 2017
3293         vsversions="15"
3294     fi
3297 win_get_env_from_vsvars32bat()
3299     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3300     # Also seems to be located in another directory under the same name: vsvars32.bat
3301     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3302     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3303     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3304     chmod +x $WRAPPERBATCHFILEPATH
3305     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3306     rm -f $WRAPPERBATCHFILEPATH
3307     printf '%s' "$_win_get_env_from_vsvars32bat"
3310 find_ucrt()
3312     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3313     if test -n "$regvalue"; then
3314         PathFormat "$regvalue"
3315         UCRTSDKDIR=$formatted_path
3316         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3317         UCRTVERSION=$regvalue
3318         # Rest if not exist
3319         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3320           UCRTSDKDIR=
3321         fi
3322     fi
3323     if test -z "$UCRTSDKDIR"; then
3324         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3325         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3326         if test -f "$ide_env_file"; then
3327             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3328             UCRTSDKDIR=$formatted_path
3329             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3330             dnl Hack needed at least by tml:
3331             if test "$UCRTVERSION" = 10.0.15063.0 \
3332                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3333                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3334             then
3335                 UCRTVERSION=10.0.14393.0
3336             fi
3337         else
3338           AC_MSG_ERROR([No UCRT found])
3339         fi
3340     fi
3343 find_msvc()
3345     # Find Visual C++ 2017/2019
3346     # Args: $1 (optional) : The VS version year
3347     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3349     unset vctest vcnum vcnumwithdot vcbuildnumber
3351     vs_versions_to_check "$1"
3352     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3353     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3354     PathFormat "$vswhere"
3355     vswhere=$formatted_path
3356     for ver in $vsversions; do
3357         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3358         if test -n "$vswhereoutput"; then
3359             PathFormat "$vswhereoutput"
3360             vctest=$formatted_path
3361             break
3362         fi
3363     done
3365     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3366     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3367     # should be removed when upgrading baseline.
3368     if ! test -n "$vctest"; then
3369         for ver in $vsversions; do
3370             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3371             if test -n "$regvalue"; then
3372                 vctest=$regvalue
3373                 break
3374             fi
3375             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3376             if test -n "$regvalue"; then
3377                 AC_MSG_RESULT([found: $regvalue])
3378                 PathFormat "$regvalue"
3379                 vctest=$formatted_path
3380                 break
3381             fi
3382         done
3383     fi
3385     if test -n "$vctest"; then
3386         vcnumwithdot="$ver.0"
3387         case "$vcnumwithdot" in
3388         15.0)
3389             vcyear=2017
3390             vcnum=150
3391             ;;
3392         16.0)
3393             vcyear=2019
3394             vcnum=160
3395             ;;
3396         esac
3397         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3399     fi
3402 SOLARINC=
3403 MSBUILD_PATH=
3404 DEVENV=
3405 if test "$_os" = "WINNT"; then
3406     AC_MSG_CHECKING([Visual C++])
3407     find_msvc "$with_visual_studio"
3408     if test -z "$vctest"; then
3409         if test -n "$with_visual_studio"; then
3410             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3411         else
3412             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3413         fi
3414     fi
3416     if test "$BITNESS_OVERRIDE" = ""; then
3417         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3418             VC_PRODUCT_DIR=$vctest/VC
3419         else
3420             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3421         fi
3422     else
3423         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3424             VC_PRODUCT_DIR=$vctest/VC
3425         else
3426             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3427         fi
3428     fi
3429     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3431     AC_MSG_CHECKING([for short pathname of VC product directory])
3432     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3433     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3435     UCRTSDKDIR=
3436     UCRTVERSION=
3438     AC_MSG_CHECKING([for UCRT location])
3439     find_ucrt
3440     # find_ucrt errors out if it doesn't find it
3441     AC_MSG_RESULT([found])
3442     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3443     ucrtincpath_formatted=$formatted_path
3444     # SOLARINC is used for external modules and must be set too.
3445     # And no, it's not sufficient to set SOLARINC only, as configure
3446     # itself doesn't honour it.
3447     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3448     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3449     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3450     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3452     AC_SUBST(UCRTSDKDIR)
3453     AC_SUBST(UCRTVERSION)
3455     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3456     # Find the proper version of MSBuild.exe to use based on the VS version
3457     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3458     if test -n "$regvalue" ; then
3459         AC_MSG_RESULT([found: $regvalue])
3460         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3461     else
3462         if test "$vcnumwithdot" = "16.0"; then
3463             if test "$BITNESS_OVERRIDE" = ""; then
3464                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3465             else
3466                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3467             fi
3468         else
3469             if test "$BITNESS_OVERRIDE" = ""; then
3470                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3471             else
3472                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3473             fi
3474         fi
3475         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3476         AC_MSG_RESULT([$regvalue])
3477     fi
3479     # Find the version of devenv.exe
3480     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3481     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3482     if test ! -e "$DEVENV"; then
3483         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3484     fi
3486     dnl ===========================================================
3487     dnl  Check for the corresponding mspdb*.dll
3488     dnl ===========================================================
3490     VC_HOST_DIR=
3491     MSPDB_PATH=
3492     CL_PATH=
3494     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3495         VC_HOST_DIR="HostX64"
3496         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3497     else
3498         VC_HOST_DIR="HostX86"
3499         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3500     fi
3502     if test "$BITNESS_OVERRIDE" = ""; then
3503         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3504     else
3505         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3506     fi
3508     # MSVC 15.0 has libraries from 14.0?
3509     mspdbnum="140"
3511     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3512         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3513     fi
3515     dnl The path needs to be added before cl is called
3516     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3517     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3519     AC_MSG_CHECKING([cl.exe])
3521     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3522     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3523     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3524     # is not enough?
3526     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3527     dnl needed when building CLR code:
3528     if test -z "$MSVC_CXX"; then
3529         if test -f "$CL_PATH/cl.exe"; then
3530             MSVC_CXX="$CL_PATH/cl.exe"
3531         fi
3533         # This gives us a posix path with 8.3 filename restrictions
3534         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3535     fi
3537     if test -z "$CC"; then
3538         CC=$MSVC_CXX
3539         CC_BASE=`first_arg_basename "$CC"`
3540     fi
3541     if test "$BITNESS_OVERRIDE" = ""; then
3542         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3543         MSVC_CXX="$MSVC_CXX -arch:SSE"
3544     fi
3545     if test -z "$CXX"; then
3546         CXX=$MSVC_CXX
3547         CXX_BASE=`first_arg_basename "$CXX"`
3548     fi
3550     if test -n "$CC"; then
3551         # Remove /cl.exe from CC case insensitive
3552         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3553         if test "$BITNESS_OVERRIDE" = ""; then
3554            COMPATH="$VC_PRODUCT_DIR"
3555         else
3556             if test -n "$VC_PRODUCT_DIR"; then
3557                 COMPATH=$VC_PRODUCT_DIR
3558             fi
3559         fi
3560         if test "$BITNESS_OVERRIDE" = ""; then
3561             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3562             CC="$CC -arch:SSE"
3563         fi
3565         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3567         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3569         PathFormat "$COMPATH"
3570         COMPATH=`win_short_path_for_make "$formatted_path"`
3572         VCVER=$vcnum
3573         MSVSVER=$vcyear
3575         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3576         # are always "better", we list them in reverse chronological order.
3578         case "$vcnum" in
3579         150|160)
3580             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3581             ;;
3582         esac
3584         # The expectation is that --with-windows-sdk should not need to be used
3585         if test -n "$with_windows_sdk"; then
3586             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3587             *" "$with_windows_sdk" "*)
3588                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3589                 ;;
3590             *)
3591                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3592                 ;;
3593             esac
3594         fi
3596         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3597         ac_objext=obj
3598         ac_exeext=exe
3600     else
3601         AC_MSG_ERROR([Visual C++ not found after all, huh])
3602     fi
3604     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3605     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3606         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3607         // between Visual Studio versions and _MSC_VER:
3608         #if _MSC_VER < 1914
3609         #error
3610         #endif
3611     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3613     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3614     # version of the Explorer extension (and maybe other small
3615     # bits, too) needed when installing a 32-bit LibreOffice on a
3616     # 64-bit OS. The 64-bit Explorer extension is a feature that
3617     # has been present since long in OOo. Don't confuse it with
3618     # building LibreOffice itself as 64-bit code.
3620     BUILD_X64=
3621     CXX_X64_BINARY=
3623     if test "$BITNESS_OVERRIDE" = ""; then
3624         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3625         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3626              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3627             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3628                 BUILD_X64=TRUE
3629                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3630             fi
3631         fi
3632         if test "$BUILD_X64" = TRUE; then
3633             AC_MSG_RESULT([found])
3634         else
3635             AC_MSG_RESULT([not found])
3636             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3637         fi
3638     else
3639         CXX_X64_BINARY=$CXX
3640     fi
3641     AC_SUBST(BUILD_X64)
3643     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3644     AC_SUBST(CXX_X64_BINARY)
3646     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3647     # needed to support TWAIN scan on both 32- and 64-bit systems
3649     BUILD_X86=
3651     if test "$BITNESS_OVERRIDE" = "64"; then
3652         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3653         if test -n "$CXX_X86_BINARY"; then
3654             BUILD_X86=TRUE
3655             AC_MSG_RESULT([preset])
3656         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3657             BUILD_X86=TRUE
3658             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3659             CXX_X86_BINARY+=" /arch:SSE"
3660             AC_MSG_RESULT([found])
3661         else
3662             CXX_X86_BINARY=
3663             AC_MSG_RESULT([not found])
3664             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3665         fi
3666     else
3667         BUILD_X86=TRUE
3668         CXX_X86_BINARY=$MSVC_CXX
3669     fi
3670     AC_SUBST(BUILD_X86)
3671     AC_SUBST(CXX_X86_BINARY)
3673 AC_SUBST(VCVER)
3674 AC_SUBST(DEVENV)
3675 AC_SUBST(MSVC_CXX)
3678 # unowinreg.dll
3680 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3681 AC_SUBST(UNOWINREG_DLL)
3683 COM_IS_CLANG=
3684 AC_MSG_CHECKING([whether the compiler is actually Clang])
3685 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3686     #ifndef __clang__
3687     you lose
3688     #endif
3689     int foo=42;
3690     ]])],
3691     [AC_MSG_RESULT([yes])
3692      COM_IS_CLANG=TRUE],
3693     [AC_MSG_RESULT([no])])
3694 AC_SUBST(COM_IS_CLANG)
3696 CC_PLAIN=$CC
3697 CLANGVER=
3698 if test "$COM_IS_CLANG" = TRUE; then
3699     AC_MSG_CHECKING([whether Clang is new enough])
3700     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3701         #if !defined __apple_build_version__
3702         #error
3703         #endif
3704         ]])],
3705         [my_apple_clang=yes],[my_apple_clang=])
3706     if test "$my_apple_clang" = yes; then
3707         AC_MSG_RESULT([assumed yes (Apple Clang)])
3708     else
3709         if test "$_os" = WINNT; then
3710             dnl In which case, assume clang-cl:
3711             my_args="/EP /TC"
3712             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3713             dnl clang-cl:
3714             CC_PLAIN=
3715             for i in $CC; do
3716                 case $i in
3717                 -FIIntrin.h)
3718                     ;;
3719                 *)
3720                     CC_PLAIN="$CC_PLAIN $i"
3721                     ;;
3722                 esac
3723             done
3724         else
3725             my_args="-E -P"
3726         fi
3727         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3728         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3729         CLANGVER=`echo $clang_version \
3730             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3731         if test "$CLANGVER" -ge 50002; then
3732             AC_MSG_RESULT([yes ($clang_version)])
3733         else
3734             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3735         fi
3736         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3737         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3738     fi
3741 SHOWINCLUDES_PREFIX=
3742 if test "$_os" = WINNT; then
3743     dnl We need to guess the prefix of the -showIncludes output, it can be
3744     dnl localized
3745     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3746     echo "#include <stdlib.h>" > conftest.c
3747     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3748         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3749     rm -f conftest.c conftest.obj
3750     if test -z "$SHOWINCLUDES_PREFIX"; then
3751         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3752     else
3753         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3754     fi
3756 AC_SUBST(SHOWINCLUDES_PREFIX)
3759 # prefix C with ccache if needed
3761 if test "$CCACHE" != ""; then
3762     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3764     AC_LANG_PUSH([C])
3765     save_CFLAGS=$CFLAGS
3766     CFLAGS="$CFLAGS --ccache-skip -O2"
3767     dnl an empty program will do, we're checking the compiler flags
3768     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3769                       [use_ccache=yes], [use_ccache=no])
3770     if test $use_ccache = yes; then
3771         AC_MSG_RESULT([yes])
3772     else
3773         CC="$CCACHE $CC"
3774         CC_BASE="ccache $CC_BASE"
3775         AC_MSG_RESULT([no])
3776     fi
3777     CFLAGS=$save_CFLAGS
3778     AC_LANG_POP([C])
3781 # ===================================================================
3782 # check various GCC options that Clang does not support now but maybe
3783 # will somewhen in the future, check them even for GCC, so that the
3784 # flags are set
3785 # ===================================================================
3787 HAVE_GCC_GGDB2=
3788 if test "$GCC" = "yes"; then
3789     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3790     save_CFLAGS=$CFLAGS
3791     CFLAGS="$CFLAGS -Werror -ggdb2"
3792     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3793     CFLAGS=$save_CFLAGS
3794     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3795         AC_MSG_RESULT([yes])
3796     else
3797         AC_MSG_RESULT([no])
3798     fi
3800     if test "$host_cpu" = "m68k"; then
3801         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3802         save_CFLAGS=$CFLAGS
3803         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3804         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3805         CFLAGS=$save_CFLAGS
3806         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3807             AC_MSG_RESULT([yes])
3808         else
3809             AC_MSG_ERROR([no])
3810         fi
3811     fi
3813 AC_SUBST(HAVE_GCC_GGDB2)
3815 dnl ===================================================================
3816 dnl  Test the gcc version
3817 dnl ===================================================================
3818 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3819     AC_MSG_CHECKING([the GCC version])
3820     _gcc_version=`$CC -dumpversion`
3821     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3822         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3823     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3825     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3827     if test "$gcc_full_version" -lt 70000; then
3828         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3829     fi
3830 else
3831     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3832     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3833     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3834     # (which reports itself as GCC 4.2.1).
3835     GCC_VERSION=
3837 AC_SUBST(GCC_VERSION)
3839 dnl Set the ENABLE_DBGUTIL variable
3840 dnl ===================================================================
3841 AC_MSG_CHECKING([whether to build with additional debug utilities])
3842 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3843     ENABLE_DBGUTIL="TRUE"
3844     # this is an extra var so it can have different default on different MSVC
3845     # versions (in case there are version specific problems with it)
3846     MSVC_USE_DEBUG_RUNTIME="TRUE"
3848     AC_MSG_RESULT([yes])
3849     # cppunit and graphite expose STL in public headers
3850     if test "$with_system_cppunit" = "yes"; then
3851         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3852     else
3853         with_system_cppunit=no
3854     fi
3855     if test "$with_system_graphite" = "yes"; then
3856         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3857     else
3858         with_system_graphite=no
3859     fi
3860     if test "$with_system_orcus" = "yes"; then
3861         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3862     else
3863         with_system_orcus=no
3864     fi
3865     if test "$with_system_libcmis" = "yes"; then
3866         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3867     else
3868         with_system_libcmis=no
3869     fi
3870     if test "$with_system_hunspell" = "yes"; then
3871         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3872     else
3873         with_system_hunspell=no
3874     fi
3875     if test "$with_system_gpgmepp" = "yes"; then
3876         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3877     else
3878         with_system_gpgmepp=no
3879     fi
3880     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3881     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3882     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3883     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3884     # of those two is using the system variant:
3885     if test "$with_system_libnumbertext" = "yes"; then
3886         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3887     else
3888         with_system_libnumbertext=no
3889     fi
3890     if test "$with_system_libwps" = "yes"; then
3891         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3892     else
3893         with_system_libwps=no
3894     fi
3895 else
3896     ENABLE_DBGUTIL=""
3897     MSVC_USE_DEBUG_RUNTIME=""
3898     AC_MSG_RESULT([no])
3900 AC_SUBST(ENABLE_DBGUTIL)
3901 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3903 dnl Set the ENABLE_DEBUG variable.
3904 dnl ===================================================================
3905 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3906     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3908 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3909     if test -z "$libo_fuzzed_enable_debug"; then
3910         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3911     else
3912         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3913         enable_debug=yes
3914     fi
3917 AC_MSG_CHECKING([whether to do a debug build])
3918 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3919     ENABLE_DEBUG="TRUE"
3920     if test -n "$ENABLE_DBGUTIL" ; then
3921         AC_MSG_RESULT([yes (dbgutil)])
3922     else
3923         AC_MSG_RESULT([yes])
3924     fi
3925 else
3926     ENABLE_DEBUG=""
3927     AC_MSG_RESULT([no])
3929 AC_SUBST(ENABLE_DEBUG)
3931 dnl ===================================================================
3932 dnl Select the linker to use (gold/lld/ld.bfd).
3933 dnl This is done only after compiler checks (need to know if Clang is
3934 dnl used, for different defaults) and after checking if a debug build
3935 dnl is wanted (non-debug builds get the default linker if not explicitly
3936 dnl specified otherwise).
3937 dnl All checks for linker features/options should come after this.
3938 dnl ===================================================================
3939 check_use_ld()
3941     use_ld=$1
3942     use_ld_fail_if_error=$2
3943     use_ld_ok=
3944     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3945     use_ld_ldflags_save="$LDFLAGS"
3946     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3947     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3948 #include <stdio.h>
3949         ],[
3950 printf ("hello world\n");
3951         ])], USE_LD=$use_ld, [])
3952     if test -n "$USE_LD"; then
3953         AC_MSG_RESULT( yes )
3954         use_ld_ok=yes
3955     else
3956         if test -n "$use_ld_fail_if_error"; then
3957             AC_MSG_ERROR( no )
3958         else
3959             AC_MSG_RESULT( no )
3960         fi
3961     fi
3962     if test -n "$use_ld_ok"; then
3963         dnl keep the value of LDFLAGS
3964         return 0
3965     fi
3966     LDFLAGS="$use_ld_ldflags_save"
3967     return 1
3969 USE_LD=
3970 if test "$enable_ld" != "no"; then
3971     if test "$GCC" = "yes"; then
3972         if test -n "$enable_ld"; then
3973             check_use_ld "$enable_ld" fail_if_error
3974         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3975             dnl non-debug builds default to the default linker
3976             true
3977         elif test -n "$COM_IS_CLANG"; then
3978             check_use_ld lld
3979             if test $? -ne 0; then
3980                 check_use_ld gold
3981             fi
3982         else
3983             # For gcc first try gold, new versions also support lld.
3984             check_use_ld gold
3985             if test $? -ne 0; then
3986                 check_use_ld lld
3987             fi
3988         fi
3989         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
3990         rm conftest.out
3991         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
3992         if test -z "$ld_used"; then
3993             ld_used="unknown"
3994         fi
3995         AC_MSG_CHECKING([for linker that is used])
3996         AC_MSG_RESULT([$ld_used])
3997         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3998             if echo "$ld_used" | grep -q "^GNU ld"; then
3999                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4000                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4001             fi
4002         fi
4003     else
4004         if test "$enable_ld" = "yes"; then
4005             AC_MSG_ERROR([--enable-ld not supported])
4006         fi
4007     fi
4009 AC_SUBST(USE_LD)
4011 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4012 if test "$GCC" = "yes"; then
4013     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4014     bsymbolic_functions_ldflags_save=$LDFLAGS
4015     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4016     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4017 #include <stdio.h>
4018         ],[
4019 printf ("hello world\n");
4020         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4021     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4022         AC_MSG_RESULT( found )
4023     else
4024         AC_MSG_RESULT( not found )
4025     fi
4026     LDFLAGS=$bsymbolic_functions_ldflags_save
4028 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4031 HAVE_GSPLIT_DWARF=
4032 if test "$enable_split_debug" != no; then
4033     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4034     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4035         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4036         save_CFLAGS=$CFLAGS
4037         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4038         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4039         CFLAGS=$save_CFLAGS
4040         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4041             AC_MSG_RESULT([yes])
4042         else
4043             if test "$enable_split_debug" = yes; then
4044                 AC_MSG_ERROR([no])
4045             else
4046                 AC_MSG_RESULT([no])
4047             fi
4048         fi
4049     fi
4050     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4051         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4052         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4053     fi
4055 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4057 ENABLE_GDB_INDEX=
4058 if test "$enable_gdb_index" != "no"; then
4059     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4060     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4061         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4062         save_CFLAGS=$CFLAGS
4063         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4064         have_ggnu_pubnames=
4065         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4066         if test "$have_ggnu_pubnames" != "TRUE"; then
4067             if test "$enable_gdb_index" = "yes"; then
4068                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4069             else
4070                 AC_MSG_RESULT( no )
4071             fi
4072         else
4073             AC_MSG_RESULT( yes )
4074             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4075             ldflags_save=$LDFLAGS
4076             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4077             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4078 #include <stdio.h>
4079                 ],[
4080 printf ("hello world\n");
4081                 ])], ENABLE_GDB_INDEX=TRUE, [])
4082             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4083                 AC_MSG_RESULT( yes )
4084             else
4085                 if test "$enable_gdb_index" = "yes"; then
4086                     AC_MSG_ERROR( no )
4087                 else
4088                     AC_MSG_RESULT( no )
4089                 fi
4090             fi
4091             LDFLAGS=$ldflags_save
4092         fi
4093         CFLAGS=$save_CFLAGS
4094         fi
4095     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4096         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4097         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4098     fi
4100 AC_SUBST(ENABLE_GDB_INDEX)
4102 if test "$enable_sal_log" = yes; then
4103     ENABLE_SAL_LOG=TRUE
4105 AC_SUBST(ENABLE_SAL_LOG)
4107 dnl Check for enable symbols option
4108 dnl ===================================================================
4109 AC_MSG_CHECKING([whether to generate debug information])
4110 if test -z "$enable_symbols"; then
4111     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4112         enable_symbols=yes
4113     else
4114         enable_symbols=no
4115     fi
4117 if test "$enable_symbols" = yes; then
4118     ENABLE_SYMBOLS_FOR=all
4119     AC_MSG_RESULT([yes])
4120 elif test "$enable_symbols" = no; then
4121     ENABLE_SYMBOLS_FOR=
4122     AC_MSG_RESULT([no])
4123 else
4124     # Selective debuginfo.
4125     ENABLE_SYMBOLS_FOR="$enable_symbols"
4126     AC_MSG_RESULT([for "$enable_symbols"])
4128 AC_SUBST(ENABLE_SYMBOLS_FOR)
4130 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4131     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4132     AC_MSG_CHECKING([whether enough memory is available for linking])
4133     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4134     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4135     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4136         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4137     else
4138         AC_MSG_RESULT([yes])
4139     fi
4142 AC_MSG_CHECKING([whether to compile with optimization flags])
4143 if test -z "$enable_optimized"; then
4144     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4145         enable_optimized=no
4146     else
4147         enable_optimized=yes
4148     fi
4150 if test "$enable_optimized" != no; then
4151     ENABLE_OPTIMIZED=TRUE
4152     AC_MSG_RESULT([yes])
4153 else
4154     ENABLE_OPTIMIZED=
4155     AC_MSG_RESULT([no])
4157 AC_SUBST(ENABLE_OPTIMIZED)
4160 # determine CPUNAME, OS, ...
4161 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4163 case "$host_os" in
4165 aix*)
4166     COM=GCC
4167     CPUNAME=POWERPC
4168     USING_X11=TRUE
4169     OS=AIX
4170     RTL_OS=AIX
4171     RTL_ARCH=PowerPC
4172     PLATFORMID=aix_powerpc
4173     P_SEP=:
4174     ;;
4176 cygwin*)
4177     COM=MSC
4178     USING_X11=
4179     OS=WNT
4180     RTL_OS=Windows
4181     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4182         P_SEP=";"
4183     else
4184         P_SEP=:
4185     fi
4186     case "$host_cpu" in
4187     i*86|x86_64)
4188         if test "$BITNESS_OVERRIDE" = 64; then
4189             CPUNAME=X86_64
4190             RTL_ARCH=X86_64
4191             PLATFORMID=windows_x86_64
4192             WINDOWS_X64=1
4193             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4194         else
4195             CPUNAME=INTEL
4196             RTL_ARCH=x86
4197             PLATFORMID=windows_x86
4198         fi
4199         ;;
4200     *)
4201         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4202         ;;
4203     esac
4204     SCPDEFS="$SCPDEFS -D_MSC_VER"
4205     ;;
4207 darwin*)
4208     COM=GCC
4209     USING_X11=
4210     OS=MACOSX
4211     RTL_OS=MacOSX
4212     P_SEP=:
4214     case "$host_cpu" in
4215     arm)
4216         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4217         ;;
4218     arm64)
4219         OS=iOS
4220         RTL_OS=iOS
4221         if test "$enable_ios_simulator" = "yes"; then
4222             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4223         else
4224             CPUNAME=ARM64
4225             RTL_ARCH=ARM_EABI
4226             PLATFORMID=ios_arm64
4227         fi
4228         ;;
4229     i*86)
4230         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4231         ;;
4232     x86_64)
4233         if test "$enable_ios_simulator" = "yes"; then
4234             OS=iOS
4235         fi
4236         CPUNAME=X86_64
4237         RTL_ARCH=X86_64
4238         PLATFORMID=macosx_x86_64
4239         ;;
4240     *)
4241         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4242         ;;
4243     esac
4244     ;;
4246 dragonfly*)
4247     COM=GCC
4248     USING_X11=TRUE
4249     OS=DRAGONFLY
4250     RTL_OS=DragonFly
4251     P_SEP=:
4253     case "$host_cpu" in
4254     i*86)
4255         CPUNAME=INTEL
4256         RTL_ARCH=x86
4257         PLATFORMID=dragonfly_x86
4258         ;;
4259     x86_64)
4260         CPUNAME=X86_64
4261         RTL_ARCH=X86_64
4262         PLATFORMID=dragonfly_x86_64
4263         ;;
4264     *)
4265         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4266         ;;
4267     esac
4268     ;;
4270 freebsd*)
4271     COM=GCC
4272     USING_X11=TRUE
4273     RTL_OS=FreeBSD
4274     OS=FREEBSD
4275     P_SEP=:
4277     case "$host_cpu" in
4278     i*86)
4279         CPUNAME=INTEL
4280         RTL_ARCH=x86
4281         PLATFORMID=freebsd_x86
4282         ;;
4283     x86_64|amd64)
4284         CPUNAME=X86_64
4285         RTL_ARCH=X86_64
4286         PLATFORMID=freebsd_x86_64
4287         ;;
4288     *)
4289         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4290         ;;
4291     esac
4292     ;;
4294 haiku*)
4295     COM=GCC
4296     USING_X11=
4297     GUIBASE=haiku
4298     RTL_OS=Haiku
4299     OS=HAIKU
4300     P_SEP=:
4302     case "$host_cpu" in
4303     i*86)
4304         CPUNAME=INTEL
4305         RTL_ARCH=x86
4306         PLATFORMID=haiku_x86
4307         ;;
4308     x86_64|amd64)
4309         CPUNAME=X86_64
4310         RTL_ARCH=X86_64
4311         PLATFORMID=haiku_x86_64
4312         ;;
4313     *)
4314         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4315         ;;
4316     esac
4317     ;;
4319 kfreebsd*)
4320     COM=GCC
4321     USING_X11=TRUE
4322     OS=LINUX
4323     RTL_OS=kFreeBSD
4324     P_SEP=:
4326     case "$host_cpu" in
4328     i*86)
4329         CPUNAME=INTEL
4330         RTL_ARCH=x86
4331         PLATFORMID=kfreebsd_x86
4332         ;;
4333     x86_64)
4334         CPUNAME=X86_64
4335         RTL_ARCH=X86_64
4336         PLATFORMID=kfreebsd_x86_64
4337         ;;
4338     *)
4339         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4340         ;;
4341     esac
4342     ;;
4344 linux-gnu*)
4345     COM=GCC
4346     USING_X11=TRUE
4347     OS=LINUX
4348     RTL_OS=Linux
4349     P_SEP=:
4351     case "$host_cpu" in
4353     aarch64)
4354         CPUNAME=AARCH64
4355         PLATFORMID=linux_aarch64
4356         RTL_ARCH=AARCH64
4357         ;;
4358     alpha)
4359         CPUNAME=AXP
4360         RTL_ARCH=ALPHA
4361         PLATFORMID=linux_alpha
4362         ;;
4363     arm*)
4364         CPUNAME=ARM
4365         EPM_FLAGS="-a arm"
4366         RTL_ARCH=ARM_EABI
4367         PLATFORMID=linux_arm_eabi
4368         case "$host_cpu" in
4369         arm*-linux)
4370             RTL_ARCH=ARM_OABI
4371             PLATFORMID=linux_arm_oabi
4372             ;;
4373         esac
4374         ;;
4375     hppa)
4376         CPUNAME=HPPA
4377         RTL_ARCH=HPPA
4378         EPM_FLAGS="-a hppa"
4379         PLATFORMID=linux_hppa
4380         ;;
4381     i*86)
4382         CPUNAME=INTEL
4383         RTL_ARCH=x86
4384         PLATFORMID=linux_x86
4385         ;;
4386     ia64)
4387         CPUNAME=IA64
4388         RTL_ARCH=IA64
4389         PLATFORMID=linux_ia64
4390         ;;
4391     mips)
4392         CPUNAME=GODSON
4393         RTL_ARCH=MIPS_EB
4394         EPM_FLAGS="-a mips"
4395         PLATFORMID=linux_mips_eb
4396         ;;
4397     mips64)
4398         CPUNAME=GODSON64
4399         RTL_ARCH=MIPS64_EB
4400         EPM_FLAGS="-a mips64"
4401         PLATFORMID=linux_mips64_eb
4402         ;;
4403     mips64el)
4404         CPUNAME=GODSON64
4405         RTL_ARCH=MIPS64_EL
4406         EPM_FLAGS="-a mips64el"
4407         PLATFORMID=linux_mips64_el
4408         ;;
4409     mipsel)
4410         CPUNAME=GODSON
4411         RTL_ARCH=MIPS_EL
4412         EPM_FLAGS="-a mipsel"
4413         PLATFORMID=linux_mips_el
4414         ;;
4415     m68k)
4416         CPUNAME=M68K
4417         RTL_ARCH=M68K
4418         PLATFORMID=linux_m68k
4419         ;;
4420     powerpc)
4421         CPUNAME=POWERPC
4422         RTL_ARCH=PowerPC
4423         PLATFORMID=linux_powerpc
4424         ;;
4425     powerpc64)
4426         CPUNAME=POWERPC64
4427         RTL_ARCH=PowerPC_64
4428         PLATFORMID=linux_powerpc64
4429         ;;
4430     powerpc64le)
4431         CPUNAME=POWERPC64
4432         RTL_ARCH=PowerPC_64_LE
4433         PLATFORMID=linux_powerpc64_le
4434         ;;
4435     sparc)
4436         CPUNAME=SPARC
4437         RTL_ARCH=SPARC
4438         PLATFORMID=linux_sparc
4439         ;;
4440     sparc64)
4441         CPUNAME=SPARC64
4442         RTL_ARCH=SPARC64
4443         PLATFORMID=linux_sparc64
4444         ;;
4445     s390)
4446         CPUNAME=S390
4447         RTL_ARCH=S390
4448         PLATFORMID=linux_s390
4449         ;;
4450     s390x)
4451         CPUNAME=S390X
4452         RTL_ARCH=S390x
4453         PLATFORMID=linux_s390x
4454         ;;
4455     x86_64)
4456         CPUNAME=X86_64
4457         RTL_ARCH=X86_64
4458         PLATFORMID=linux_x86_64
4459         ;;
4460     *)
4461         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4462         ;;
4463     esac
4464     ;;
4466 linux-android*)
4467     COM=GCC
4468     USING_X11=
4469     OS=ANDROID
4470     RTL_OS=Android
4471     P_SEP=:
4473     case "$host_cpu" in
4475     arm|armel)
4476         CPUNAME=ARM
4477         RTL_ARCH=ARM_EABI
4478         PLATFORMID=android_arm_eabi
4479         ;;
4480     aarch64)
4481         CPUNAME=AARCH64
4482         RTL_ARCH=AARCH64
4483         PLATFORMID=android_aarch64
4484         ;;
4485     i*86)
4486         CPUNAME=INTEL
4487         RTL_ARCH=x86
4488         PLATFORMID=android_x86
4489         ;;
4490     x86_64)
4491         CPUNAME=X86_64
4492         RTL_ARCH=X86_64
4493         PLATFORMID=android_x86_64
4494         ;;
4495     *)
4496         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4497         ;;
4498     esac
4499     ;;
4501 *netbsd*)
4502     COM=GCC
4503     USING_X11=TRUE
4504     OS=NETBSD
4505     RTL_OS=NetBSD
4506     P_SEP=:
4508     case "$host_cpu" in
4509     i*86)
4510         CPUNAME=INTEL
4511         RTL_ARCH=x86
4512         PLATFORMID=netbsd_x86
4513         ;;
4514     powerpc)
4515         CPUNAME=POWERPC
4516         RTL_ARCH=PowerPC
4517         PLATFORMID=netbsd_powerpc
4518         ;;
4519     sparc)
4520         CPUNAME=SPARC
4521         RTL_ARCH=SPARC
4522         PLATFORMID=netbsd_sparc
4523         ;;
4524     x86_64)
4525         CPUNAME=X86_64
4526         RTL_ARCH=X86_64
4527         PLATFORMID=netbsd_x86_64
4528         ;;
4529     *)
4530         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4531         ;;
4532     esac
4533     ;;
4535 openbsd*)
4536     COM=GCC
4537     USING_X11=TRUE
4538     OS=OPENBSD
4539     RTL_OS=OpenBSD
4540     P_SEP=:
4542     case "$host_cpu" in
4543     i*86)
4544         CPUNAME=INTEL
4545         RTL_ARCH=x86
4546         PLATFORMID=openbsd_x86
4547         ;;
4548     x86_64)
4549         CPUNAME=X86_64
4550         RTL_ARCH=X86_64
4551         PLATFORMID=openbsd_x86_64
4552         ;;
4553     *)
4554         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4555         ;;
4556     esac
4557     SOLARINC="$SOLARINC -I/usr/local/include"
4558     ;;
4560 solaris*)
4561     COM=GCC
4562     USING_X11=TRUE
4563     OS=SOLARIS
4564     RTL_OS=Solaris
4565     P_SEP=:
4567     case "$host_cpu" in
4568     i*86)
4569         CPUNAME=INTEL
4570         RTL_ARCH=x86
4571         PLATFORMID=solaris_x86
4572         ;;
4573     sparc)
4574         CPUNAME=SPARC
4575         RTL_ARCH=SPARC
4576         PLATFORMID=solaris_sparc
4577         ;;
4578     sparc64)
4579         CPUNAME=SPARC64
4580         RTL_ARCH=SPARC64
4581         PLATFORMID=solaris_sparc64
4582         ;;
4583     *)
4584         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4585         ;;
4586     esac
4587     SOLARINC="$SOLARINC -I/usr/local/include"
4588     ;;
4591     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4592     ;;
4593 esac
4595 if test "$with_x" = "no"; then
4596     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4599 DISABLE_GUI=""
4600 if test "$enable_gui" = "no"; then
4601     if test "$USING_X11" != TRUE; then
4602         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4603     fi
4604     USING_X11=
4605     DISABLE_GUI=TRUE
4606     AC_DEFINE(HAVE_FEATURE_UI,0)
4607     test_cairo=yes
4609 AC_SUBST(DISABLE_GUI)
4611 WORKDIR="${BUILDDIR}/workdir"
4612 INSTDIR="${BUILDDIR}/instdir"
4613 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4614 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4615 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4616 AC_SUBST(COM)
4617 AC_SUBST(CPUNAME)
4618 AC_SUBST(RTL_OS)
4619 AC_SUBST(RTL_ARCH)
4620 AC_SUBST(EPM_FLAGS)
4621 AC_SUBST(USING_X11)
4622 AC_SUBST([INSTDIR])
4623 AC_SUBST([INSTROOT])
4624 AC_SUBST([INSTROOTBASE])
4625 AC_SUBST(OS)
4626 AC_SUBST(P_SEP)
4627 AC_SUBST(WORKDIR)
4628 AC_SUBST(PLATFORMID)
4629 AC_SUBST(WINDOWS_X64)
4630 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4632 dnl ===================================================================
4633 dnl Test which package format to use
4634 dnl ===================================================================
4635 AC_MSG_CHECKING([which package format to use])
4636 if test -n "$with_package_format" -a "$with_package_format" != no; then
4637     for i in $with_package_format; do
4638         case "$i" in
4639         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4640             ;;
4641         *)
4642             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4643 aix - AIX software distribution
4644 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4645 deb - Debian software distribution
4646 pkg - Solaris software distribution
4647 rpm - RedHat software distribution
4649 LibreOffice additionally supports:
4650 archive - .tar.gz or .zip
4651 dmg - macOS .dmg
4652 installed - installation tree
4653 msi - Windows .msi
4654         ])
4655             ;;
4656         esac
4657     done
4658     # fakeroot is needed to ensure correct file ownerships/permissions
4659     # inside deb packages and tar archives created on Linux and Solaris.
4660     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4661         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4662         if test "$FAKEROOT" = "no"; then
4663             AC_MSG_ERROR(
4664                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4665         fi
4666     fi
4667     PKGFORMAT="$with_package_format"
4668     AC_MSG_RESULT([$PKGFORMAT])
4669 else
4670     PKGFORMAT=
4671     AC_MSG_RESULT([none])
4673 AC_SUBST(PKGFORMAT)
4675 dnl ===================================================================
4676 dnl Set up a different compiler to produce tools to run on the build
4677 dnl machine when doing cross-compilation
4678 dnl ===================================================================
4680 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4681 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4682 if test "$cross_compiling" = "yes"; then
4683     AC_MSG_CHECKING([for BUILD platform configuration])
4684     echo
4685     rm -rf CONF-FOR-BUILD config_build.mk
4686     mkdir CONF-FOR-BUILD
4687     # Here must be listed all files needed when running the configure script. In particular, also
4688     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4689     # keep them in the same order as there.
4690     (cd $SRC_ROOT && tar cf - \
4691         config.guess \
4692         bin/get_config_variables \
4693         solenv/bin/getcompver.awk \
4694         solenv/inc/langlist.mk \
4695         download.lst \
4696         config_host.mk.in \
4697         config_host_lang.mk.in \
4698         Makefile.in \
4699         bin/bffvalidator.sh.in \
4700         bin/odfvalidator.sh.in \
4701         bin/officeotron.sh.in \
4702         instsetoo_native/util/openoffice.lst.in \
4703         config_host/*.in \
4704         sysui/desktop/macosx/Info.plist.in) \
4705     | (cd CONF-FOR-BUILD && tar xf -)
4706     cp configure CONF-FOR-BUILD
4707     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4708     (
4709     unset COM USING_X11 OS CPUNAME
4710     unset CC CXX SYSBASE CFLAGS
4711     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4712     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4713     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4714     if test -n "$CC_FOR_BUILD"; then
4715         export CC="$CC_FOR_BUILD"
4716         CC_BASE=`first_arg_basename "$CC"`
4717     fi
4718     if test -n "$CXX_FOR_BUILD"; then
4719         export CXX="$CXX_FOR_BUILD"
4720         CXX_BASE=`first_arg_basename "$CXX"`
4721     fi
4722     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4723     cd CONF-FOR-BUILD
4724     sub_conf_opts=""
4725     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4726     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4727     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4728     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4729     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4730     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4731     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4732     # Don't bother having configure look for stuff not needed for the build platform anyway
4733     ./configure \
4734         --disable-cups \
4735         --disable-gstreamer-1-0 \
4736         --disable-gtk3 \
4737         --disable-pdfimport \
4738         --disable-postgresql-sdbc \
4739         --with-parallelism="$with_parallelism" \
4740         --without-doxygen \
4741         --without-java \
4742         $sub_conf_opts \
4743         --srcdir=$srcdir \
4744         2>&1 | sed -e 's/^/    /'
4745     test -f ./config_host.mk 2>/dev/null || exit
4746     cp config_host.mk ../config_build.mk
4747     cp config_host_lang.mk ../config_build_lang.mk
4748     mv config.log ../config.Build.log
4749     mkdir -p ../config_build
4750     mv config_host/*.h ../config_build
4751     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT WORKDIR
4753     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
4754         VV='$'$V
4755         VV=`eval "echo $VV"`
4756         if test -n "$VV"; then
4757             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4758             echo "$line" >>build-config
4759         fi
4760     done
4762     for V in INSTDIR INSTROOT WORKDIR; do
4763         VV='$'$V
4764         VV=`eval "echo $VV"`
4765         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4766         if test -n "$VV"; then
4767             line="${V}_FOR_BUILD='$VV'"
4768             echo "$line" >>build-config
4769         fi
4770     done
4772     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4773     echo "$line" >>build-config
4775     )
4776     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4777     test -f config_build.mk || AC_MSG_ERROR([A file called config_build.mk was supposed to have been copied here, but it isn't found])
4778     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4779              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4781     eval `cat CONF-FOR-BUILD/build-config`
4783     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4785     rm -rf CONF-FOR-BUILD
4786 else
4787     OS_FOR_BUILD="$OS"
4788     CC_FOR_BUILD="$CC"
4789     CXX_FOR_BUILD="$CXX"
4790     INSTDIR_FOR_BUILD="$INSTDIR"
4791     INSTROOT_FOR_BUILD="$INSTROOT"
4792     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4793     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4794     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4795     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4796     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4797     WORKDIR_FOR_BUILD="$WORKDIR"
4799 AC_SUBST(OS_FOR_BUILD)
4800 AC_SUBST(INSTDIR_FOR_BUILD)
4801 AC_SUBST(INSTROOT_FOR_BUILD)
4802 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4803 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4804 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4805 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4806 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4807 AC_SUBST(WORKDIR_FOR_BUILD)
4809 dnl ===================================================================
4810 dnl Check for syslog header
4811 dnl ===================================================================
4812 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4814 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4815 dnl ===================================================================
4816 AC_MSG_CHECKING([whether to turn warnings to errors])
4817 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4818     ENABLE_WERROR="TRUE"
4819     AC_MSG_RESULT([yes])
4820 else
4821     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4822         ENABLE_WERROR="TRUE"
4823         AC_MSG_RESULT([yes])
4824     else
4825         AC_MSG_RESULT([no])
4826     fi
4828 AC_SUBST(ENABLE_WERROR)
4830 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4831 dnl ===================================================================
4832 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4833 if test -z "$enable_assert_always_abort"; then
4834    if test "$ENABLE_DEBUG" = TRUE; then
4835        enable_assert_always_abort=yes
4836    else
4837        enable_assert_always_abort=no
4838    fi
4840 if test "$enable_assert_always_abort" = "yes"; then
4841     ASSERT_ALWAYS_ABORT="TRUE"
4842     AC_MSG_RESULT([yes])
4843 else
4844     ASSERT_ALWAYS_ABORT="FALSE"
4845     AC_MSG_RESULT([no])
4847 AC_SUBST(ASSERT_ALWAYS_ABORT)
4849 # Determine whether to use ooenv for the instdir installation
4850 # ===================================================================
4851 if test $_os != "WINNT" -a $_os != "Darwin"; then
4852     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4853     if test "$enable_ooenv" = "no"; then
4854         AC_MSG_RESULT([no])
4855     else
4856         ENABLE_OOENV="TRUE"
4857         AC_MSG_RESULT([yes])
4858     fi
4860 AC_SUBST(ENABLE_OOENV)
4862 if test "$USING_X11" != TRUE; then
4863     # be sure to do not mess with unneeded stuff
4864     test_randr=no
4865     test_xrender=no
4866     test_cups=no
4867     test_dbus=no
4868     build_gstreamer_1_0=no
4869     test_kf5=no
4870     test_qt5=no
4871     test_gtk3_kde5=no
4872     enable_cairo_canvas=no
4875 if test "$OS" = "HAIKU"; then
4876     enable_cairo_canvas=yes
4877     test_kf5=yes
4880 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4881     AC_MSG_WARN([The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!])
4882     add_warning "The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!"
4883     enable_kf5=yes
4886 if test "$test_kf5" = "yes"; then
4887     test_qt5=yes
4890 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4891     if test "$enable_qt5" = "no"; then
4892         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4893     else
4894         enable_qt5=yes
4895     fi
4898 dnl ===================================================================
4899 dnl check for cups support
4900 dnl ===================================================================
4901 ENABLE_CUPS=""
4903 if test "$enable_cups" = "no"; then
4904     test_cups=no
4907 AC_MSG_CHECKING([whether to enable CUPS support])
4908 if test "$test_cups" = "yes"; then
4909     ENABLE_CUPS="TRUE"
4910     AC_MSG_RESULT([yes])
4912     AC_MSG_CHECKING([whether cups support is present])
4913     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4914     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4915     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4916         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4917     fi
4919 else
4920     AC_MSG_RESULT([no])
4923 AC_SUBST(ENABLE_CUPS)
4925 # fontconfig checks
4926 if test "$test_fontconfig" = "yes"; then
4927     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4928     SYSTEM_FONTCONFIG=TRUE
4929     FilterLibs "${FONTCONFIG_LIBS}"
4930     FONTCONFIG_LIBS="${filteredlibs}"
4932 AC_SUBST(FONTCONFIG_CFLAGS)
4933 AC_SUBST(FONTCONFIG_LIBS)
4934 AC_SUBST([SYSTEM_FONTCONFIG])
4936 dnl whether to find & fetch external tarballs?
4937 dnl ===================================================================
4938 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4939    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4940        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4941    else
4942        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4943    fi
4945 if test -z "$TARFILE_LOCATION"; then
4946     if test -d "$SRC_ROOT/src" ; then
4947         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4948         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4949     fi
4950     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4951 else
4952     AbsolutePath "$TARFILE_LOCATION"
4953     PathFormat "${absolute_path}"
4954     TARFILE_LOCATION="${formatted_path}"
4956 AC_SUBST(TARFILE_LOCATION)
4958 AC_MSG_CHECKING([whether we want to fetch tarballs])
4959 if test "$enable_fetch_external" != "no"; then
4960     if test "$with_all_tarballs" = "yes"; then
4961         AC_MSG_RESULT([yes, all of them])
4962         DO_FETCH_TARBALLS="ALL"
4963     else
4964         AC_MSG_RESULT([yes, if we use them])
4965         DO_FETCH_TARBALLS="TRUE"
4966     fi
4967 else
4968     AC_MSG_RESULT([no])
4969     DO_FETCH_TARBALLS=
4971 AC_SUBST(DO_FETCH_TARBALLS)
4973 AC_MSG_CHECKING([whether to build help])
4974 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4975     BUILD_TYPE="$BUILD_TYPE HELP"
4976     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4977     case "$with_help" in
4978     "html")
4979         ENABLE_HTMLHELP=TRUE
4980         SCPDEFS="$SCPDEFS -DWITH_HELP"
4981         AC_MSG_RESULT([HTML])
4982         ;;
4983     "online")
4984         ENABLE_HTMLHELP=TRUE
4985         HELP_ONLINE=TRUE
4986         AC_MSG_RESULT([HTML])
4987         ;;
4988     yes)
4989         SCPDEFS="$SCPDEFS -DWITH_HELP"
4990         AC_MSG_RESULT([yes])
4991         ;;
4992     *)
4993         AC_MSG_ERROR([Unknown --with-help=$with_help])
4994         ;;
4995     esac
4996 else
4997     AC_MSG_RESULT([no])
4999 AC_SUBST([ENABLE_HTMLHELP])
5000 AC_SUBST([HELP_ONLINE])
5002 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5003 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5004     BUILD_TYPE="$BUILD_TYPE HELP"
5005     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5006     case "$with_omindex" in
5007     "server")
5008         ENABLE_HTMLHELP=TRUE
5009         HELP_ONLINE=TRUE
5010         HELP_OMINDEX_PAGE=TRUE
5011         AC_MSG_RESULT([SERVER])
5012         ;;
5013     "noxap")
5014         ENABLE_HTMLHELP=TRUE
5015         HELP_ONLINE=TRUE
5016         HELP_OMINDEX_PAGE=FALSE
5017         AC_MSG_RESULT([NOXAP])
5018         ;;
5019     *)
5020         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5021         ;;
5022     esac
5023 else
5024     HELP_OMINDEX_PAGE=FALSE
5025     AC_MSG_RESULT([no])
5027 AC_SUBST([ENABLE_HTMLHELP])
5028 AC_SUBST([HELP_OMINDEX_PAGE])
5029 AC_SUBST([HELP_ONLINE])
5032 dnl Test whether to include MySpell dictionaries
5033 dnl ===================================================================
5034 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5035 if test "$with_myspell_dicts" = "yes"; then
5036     AC_MSG_RESULT([yes])
5037     WITH_MYSPELL_DICTS=TRUE
5038     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5039     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5040 else
5041     AC_MSG_RESULT([no])
5042     WITH_MYSPELL_DICTS=
5044 AC_SUBST(WITH_MYSPELL_DICTS)
5046 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5047 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5048     if test "$with_system_dicts" = yes; then
5049         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5050     fi
5051     with_system_dicts=no
5054 AC_MSG_CHECKING([whether to use dicts from external paths])
5055 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5056     AC_MSG_RESULT([yes])
5057     SYSTEM_DICTS=TRUE
5058     AC_MSG_CHECKING([for spelling dictionary directory])
5059     if test -n "$with_external_dict_dir"; then
5060         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5061     else
5062         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5063         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5064             DICT_SYSTEM_DIR=file:///usr/share/myspell
5065         fi
5066     fi
5067     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5068     AC_MSG_CHECKING([for hyphenation patterns directory])
5069     if test -n "$with_external_hyph_dir"; then
5070         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5071     else
5072         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5073     fi
5074     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5075     AC_MSG_CHECKING([for thesaurus directory])
5076     if test -n "$with_external_thes_dir"; then
5077         THES_SYSTEM_DIR=file://$with_external_thes_dir
5078     else
5079         THES_SYSTEM_DIR=file:///usr/share/mythes
5080     fi
5081     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5082 else
5083     AC_MSG_RESULT([no])
5084     SYSTEM_DICTS=
5086 AC_SUBST(SYSTEM_DICTS)
5087 AC_SUBST(DICT_SYSTEM_DIR)
5088 AC_SUBST(HYPH_SYSTEM_DIR)
5089 AC_SUBST(THES_SYSTEM_DIR)
5091 dnl ===================================================================
5092 dnl Precompiled headers.
5093 ENABLE_PCH=""
5094 AC_MSG_CHECKING([whether to enable pch feature])
5095 if test -z "$enable_pch"; then
5096     if test "$_os" = "WINNT"; then
5097         # Enabled by default on Windows.
5098         enable_pch=yes
5099     else
5100         enable_pch=no
5101     fi
5103 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5104     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5106 if test "$enable_pch" = "system"; then
5107     ENABLE_PCH="1"
5108     AC_MSG_RESULT([yes (system headers)])
5109 elif test "$enable_pch" = "base"; then
5110     ENABLE_PCH="2"
5111     AC_MSG_RESULT([yes (system and base headers)])
5112 elif test "$enable_pch" = "normal"; then
5113     ENABLE_PCH="3"
5114     AC_MSG_RESULT([yes (normal)])
5115 elif test "$enable_pch" = "full"; then
5116     ENABLE_PCH="4"
5117     AC_MSG_RESULT([yes (full)])
5118 elif test "$enable_pch" = "yes"; then
5119     # Pick a suitable default.
5120     if test "$GCC" = "yes"; then
5121         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5122         # while making the PCHs larger and rebuilds more likely.
5123         ENABLE_PCH="2"
5124         AC_MSG_RESULT([yes (system and base headers)])
5125     else
5126         # With MSVC the highest level makes a significant difference,
5127         # and it was the default when there used to be no PCH levels.
5128         ENABLE_PCH="4"
5129         AC_MSG_RESULT([yes (full)])
5130     fi
5131 elif test "$enable_pch" = "no"; then
5132     AC_MSG_RESULT([no])
5133 else
5134     AC_MSG_ERROR([Unknown value for --enable-pch])
5136 AC_SUBST(ENABLE_PCH)
5137 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5138 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5139     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5140     if test "$CCACHE_BIN" != "not found"; then
5141         AC_MSG_CHECKING([ccache version])
5142         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5143         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5144         AC_MSG_RESULT([$CCACHE_VERSION])
5145         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5146         if test "$CCACHE_NUMVER" -gt "030701"; then
5147             AC_MSG_RESULT([yes])
5148         else
5149             AC_MSG_RESULT([no (not newer than 3.7.1)])
5150             CCACHE_DEPEND_MODE=
5151         fi
5152     fi
5155 TAB=`printf '\t'`
5157 AC_MSG_CHECKING([the GNU Make version])
5158 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5159 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5160 if test "$_make_longver" -ge "038200"; then
5161     AC_MSG_RESULT([$GNUMAKE $_make_version])
5163 elif test "$_make_longver" -ge "038100"; then
5164     if test "$build_os" = "cygwin"; then
5165         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5166     fi
5167     AC_MSG_RESULT([$GNUMAKE $_make_version])
5169     dnl ===================================================================
5170     dnl Search all the common names for sha1sum
5171     dnl ===================================================================
5172     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5173     if test -z "$SHA1SUM"; then
5174         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5175     elif test "$SHA1SUM" = "openssl"; then
5176         SHA1SUM="openssl sha1"
5177     fi
5178     AC_MSG_CHECKING([for GNU Make bug 20033])
5179     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5180     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5181 A := \$(wildcard *.a)
5183 .PHONY: all
5184 all: \$(A:.a=.b)
5185 <TAB>@echo survived bug20033.
5187 .PHONY: setup
5188 setup:
5189 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5191 define d1
5192 @echo lala \$(1)
5193 @sleep 1
5194 endef
5196 define d2
5197 @echo tyty \$(1)
5198 @sleep 1
5199 endef
5201 %.b : %.a
5202 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5203 <TAB>\$(call d1,\$(CHECKSUM)),\
5204 <TAB>\$(call d2,\$(CHECKSUM)))
5206     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5207         no_parallelism_make="YES"
5208         AC_MSG_RESULT([yes, disable parallelism])
5209     else
5210         AC_MSG_RESULT([no, keep parallelism enabled])
5211     fi
5212     rm -rf $TESTGMAKEBUG20033
5213 else
5214     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5217 # find if gnumake support file function
5218 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5219 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5220 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5221     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5223 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5224 \$(file >test.txt,Success )
5226 .PHONY: all
5227 all:
5228 <TAB>@cat test.txt
5231 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5232 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5233     HAVE_GNUMAKE_FILE_FUNC=TRUE
5234     AC_MSG_RESULT([yes])
5235 else
5236     AC_MSG_RESULT([no])
5238 rm -rf $TESTGMAKEFILEFUNC
5239 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5240 AC_SUBST(GNUMAKE_WIN_NATIVE)
5242 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5243 STALE_MAKE=
5244 if test "$_make_ver_check" = ""; then
5245    STALE_MAKE=TRUE
5248 HAVE_LD_HASH_STYLE=FALSE
5249 WITH_LINKER_HASH_STYLE=
5250 AC_MSG_CHECKING([for --hash-style gcc linker support])
5251 if test "$GCC" = "yes"; then
5252     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5253         hash_styles="gnu sysv"
5254     elif test "$with_linker_hash_style" = "no"; then
5255         hash_styles=
5256     else
5257         hash_styles="$with_linker_hash_style"
5258     fi
5260     for hash_style in $hash_styles; do
5261         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5262         hash_style_ldflags_save=$LDFLAGS
5263         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5265         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5266             [
5267 #include <stdio.h>
5268             ],[
5269 printf ("");
5270             ])],
5271             [
5272                   HAVE_LD_HASH_STYLE=TRUE
5273                   WITH_LINKER_HASH_STYLE=$hash_style
5274             ],
5275             [HAVE_LD_HASH_STYLE=FALSE],
5276             [HAVE_LD_HASH_STYLE=FALSE])
5277         LDFLAGS=$hash_style_ldflags_save
5278     done
5280     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5281         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5282     else
5283         AC_MSG_RESULT( no )
5284     fi
5285     LDFLAGS=$hash_style_ldflags_save
5286 else
5287     AC_MSG_RESULT( no )
5289 AC_SUBST(HAVE_LD_HASH_STYLE)
5290 AC_SUBST(WITH_LINKER_HASH_STYLE)
5292 dnl ===================================================================
5293 dnl Check whether there's a Perl version available.
5294 dnl ===================================================================
5295 if test -z "$with_perl_home"; then
5296     AC_PATH_PROG(PERL, perl)
5297 else
5298     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5299     _perl_path="$with_perl_home/bin/perl"
5300     if test -x "$_perl_path"; then
5301         PERL=$_perl_path
5302     else
5303         AC_MSG_ERROR([$_perl_path not found])
5304     fi
5307 dnl ===================================================================
5308 dnl Testing for Perl version 5 or greater.
5309 dnl $] is the Perl version variable, it is returned as an integer
5310 dnl ===================================================================
5311 if test "$PERL"; then
5312     AC_MSG_CHECKING([the Perl version])
5313     ${PERL} -e "exit($]);"
5314     _perl_version=$?
5315     if test "$_perl_version" -lt 5; then
5316         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5317     fi
5318     AC_MSG_RESULT([Perl $_perl_version])
5319 else
5320     AC_MSG_ERROR([Perl not found, install Perl 5])
5323 dnl ===================================================================
5324 dnl Testing for required Perl modules
5325 dnl ===================================================================
5327 AC_MSG_CHECKING([for required Perl modules])
5328 perl_use_string="use Cwd ; use Digest::MD5"
5329 if test "$_os" = "WINNT"; then
5330     if test -n "$PKGFORMAT"; then
5331         for i in $PKGFORMAT; do
5332             case "$i" in
5333             msi)
5334                 # for getting fonts versions to use in MSI
5335                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5336                 ;;
5337             esac
5338         done
5339     fi
5341 if test "$with_system_hsqldb" = "yes"; then
5342     perl_use_string="$perl_use_string ; use Archive::Zip"
5344 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5345     AC_MSG_RESULT([all modules found])
5346 else
5347     AC_MSG_RESULT([failed to find some modules])
5348     # Find out which modules are missing.
5349     for i in $perl_use_string; do
5350         if test "$i" != "use" -a "$i" != ";"; then
5351             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5352                 missing_perl_modules="$missing_perl_modules $i"
5353             fi
5354         fi
5355     done
5356     AC_MSG_ERROR([
5357     The missing Perl modules are: $missing_perl_modules
5358     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5361 dnl ===================================================================
5362 dnl Check for pkg-config
5363 dnl ===================================================================
5364 if test "$_os" != "WINNT"; then
5365     PKG_PROG_PKG_CONFIG
5368 if test "$_os" != "WINNT"; then
5370     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5371     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5372     # explicitly. Or put /path/to/compiler in PATH yourself.
5374     # Use wrappers for LTO
5375     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5376         AC_CHECK_TOOL(AR,gcc-ar)
5377         AC_CHECK_TOOL(NM,gcc-nm)
5378         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5379     else
5380         AC_CHECK_TOOL(AR,ar)
5381         AC_CHECK_TOOL(NM,nm)
5382         AC_CHECK_TOOL(RANLIB,ranlib)
5383     fi
5384     AC_CHECK_TOOL(OBJDUMP,objdump)
5385     AC_CHECK_TOOL(READELF,readelf)
5386     AC_CHECK_TOOL(STRIP,strip)
5387     if test "$_os" = "WINNT"; then
5388         AC_CHECK_TOOL(DLLTOOL,dlltool)
5389         AC_CHECK_TOOL(WINDRES,windres)
5390     fi
5392 AC_SUBST(AR)
5393 AC_SUBST(DLLTOOL)
5394 AC_SUBST(NM)
5395 AC_SUBST(OBJDUMP)
5396 AC_SUBST(PKG_CONFIG)
5397 AC_SUBST(RANLIB)
5398 AC_SUBST(READELF)
5399 AC_SUBST(STRIP)
5400 AC_SUBST(WINDRES)
5402 dnl ===================================================================
5403 dnl pkg-config checks on macOS
5404 dnl ===================================================================
5406 if test $_os = Darwin; then
5407     AC_MSG_CHECKING([for bogus pkg-config])
5408     if test -n "$PKG_CONFIG"; then
5409         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5410             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5411         else
5412             if test "$enable_bogus_pkg_config" = "yes"; then
5413                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5414             else
5415                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please modify your PATH variable so that $PKG_CONFIG is no longer found by configure scripts.])
5416             fi
5417         fi
5418     else
5419         AC_MSG_RESULT([no, good])
5420     fi
5423 find_csc()
5425     # Return value: $csctest
5427     unset csctest
5429     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5430     if test -n "$regvalue"; then
5431         csctest=$regvalue
5432         return
5433     fi
5436 find_al()
5438     # Return value: $altest
5440     unset altest
5442     # We need this check to detect 4.6.1 or above.
5443     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5444         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5445         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5446             altest=$regvalue
5447             return
5448         fi
5449     done
5451     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5452         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5453         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5454             altest=$regvalue
5455             return
5456         fi
5457     done
5462 find_dotnetsdk46()
5464     unset frametest
5466     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5467         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5468         if test -n "$regvalue"; then
5469             frametest=$regvalue
5470             return
5471         fi
5472     done
5475 find_winsdk_version()
5477     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5478     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5480     unset winsdktest winsdkbinsubdir winsdklibsubdir
5482     case "$1" in
5483     8.0|8.0A)
5484         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5485         if test -n "$regvalue"; then
5486             winsdktest=$regvalue
5487             winsdklibsubdir=win8
5488             return
5489         fi
5490         ;;
5491     8.1|8.1A)
5492         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5493         if test -n "$regvalue"; then
5494             winsdktest=$regvalue
5495             winsdklibsubdir=winv6.3
5496             return
5497         fi
5498         ;;
5499     10.0)
5500         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5501         if test -n "$regvalue"; then
5502             winsdktest=$regvalue
5503             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5504             if test -n "$regvalue"; then
5505                 winsdkbinsubdir="$regvalue".0
5506                 winsdklibsubdir=$winsdkbinsubdir
5507                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5508                 # test exist the SDK path
5509                 if test -d "$tmppath"; then
5510                    # when path is convertible to a short path then path is okay
5511                    cygpath -d "$tmppath" >/dev/null 2>&1
5512                    if test $? -ne 0; then
5513                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5514                    fi
5515                 else
5516                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5517                 fi
5518             fi
5519             return
5520         fi
5521         ;;
5522     esac
5525 find_winsdk()
5527     # Return value: From find_winsdk_version
5529     unset winsdktest
5531     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5532         find_winsdk_version $ver
5533         if test -n "$winsdktest"; then
5534             return
5535         fi
5536     done
5539 find_msms()
5541     AC_MSG_CHECKING([for MSVC merge modules directory])
5542     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5543     case "$VCVER" in
5544         150|160)
5545         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5546         ;;
5547     esac
5548     for f in $my_msm_files; do
5549         echo "$as_me:$LINENO: searching for $f" >&5
5550     done
5552     msmdir=
5553     for ver in 14.0 15.0; do
5554         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5555         if test -n "$regvalue"; then
5556             for f in ${my_msm_files}; do
5557                 if test -e "$regvalue/${f}"; then
5558                     msmdir=$regvalue
5559                     break
5560                 fi
5561             done
5562         fi
5563     done
5564     dnl Is the following fallback really necessary, or was it added in response
5565     dnl to never having started Visual Studio on a given machine, so the
5566     dnl registry keys checked above had presumably not yet been created?
5567     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5568     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5569     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5570     dnl expanding to "C:\Program Files\Common Files"), which would need
5571     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5572     dnl obtain its value from cygwin:
5573     if test -z "$msmdir"; then
5574         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5575         for f in ${my_msm_files}; do
5576             if test -e "$my_msm_dir/${f}"; then
5577                 msmdir=$my_msm_dir
5578             fi
5579         done
5580     fi
5582     dnl Starting from MSVC 15.0, merge modules are located in different directory
5583     case "$VCVER" in
5584     150|160)
5585         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5586             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5587             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5588             for f in ${my_msm_files}; do
5589                 if test -e "$my_msm_dir/${f}"; then
5590                     msmdir=$my_msm_dir
5591                     break
5592                 fi
5593             done
5594         done
5595         ;;
5596     esac
5598     if test -n "$msmdir"; then
5599         msmdir=`cygpath -m "$msmdir"`
5600         AC_MSG_RESULT([$msmdir])
5601     else
5602         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5603             AC_MSG_FAILURE([not found])
5604         else
5605             AC_MSG_WARN([not found (check config.log)])
5606             add_warning "MSM none of ${my_msm_files} found"
5607         fi
5608     fi
5611 find_msvc_x64_dlls()
5613     AC_MSG_CHECKING([for MSVC x64 DLL path])
5614     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5615     case "$VCVER" in
5616     150|160)
5617         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5618             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5619             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5620                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5621                 break
5622             fi
5623             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5624             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5625                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5626                 break
5627             fi
5628             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5629             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5630                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5631                 break
5632             fi
5633         done
5634         ;;
5635     esac
5636     AC_MSG_RESULT([$msvcdllpath])
5637     AC_MSG_CHECKING([for MSVC x64 DLLs])
5638     msvcdlls="msvcp140.dll vcruntime140.dll"
5639     for dll in $msvcdlls; do
5640         if ! test -f "$msvcdllpath/$dll"; then
5641             AC_MSG_FAILURE([missing $dll])
5642         fi
5643     done
5644     AC_MSG_RESULT([found all ($msvcdlls)])
5647 dnl =========================================
5648 dnl Check for the Windows  SDK.
5649 dnl =========================================
5650 if test "$_os" = "WINNT"; then
5651     AC_MSG_CHECKING([for Windows SDK])
5652     if test "$build_os" = "cygwin"; then
5653         find_winsdk
5654         WINDOWS_SDK_HOME=$winsdktest
5656         # normalize if found
5657         if test -n "$WINDOWS_SDK_HOME"; then
5658             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5659             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5660         fi
5662         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5663     fi
5665     if test -n "$WINDOWS_SDK_HOME"; then
5666         # Remove a possible trailing backslash
5667         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5669         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5670              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5671              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5672             have_windows_sdk_headers=yes
5673         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5674              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5675              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5676             have_windows_sdk_headers=yes
5677         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5678              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5679              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5680             have_windows_sdk_headers=yes
5681         else
5682             have_windows_sdk_headers=no
5683         fi
5685         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5686             have_windows_sdk_libs=yes
5687         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5688             have_windows_sdk_libs=yes
5689         else
5690             have_windows_sdk_libs=no
5691         fi
5693         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5694             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5695 the  Windows SDK are installed.])
5696         fi
5697     fi
5699     if test -z "$WINDOWS_SDK_HOME"; then
5700         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5701     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5702         WINDOWS_SDK_VERSION=80
5703         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5704     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5705         WINDOWS_SDK_VERSION=81
5706         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5707     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5708         WINDOWS_SDK_VERSION=10
5709         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5710     else
5711         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5712     fi
5713     PathFormat "$WINDOWS_SDK_HOME"
5714     WINDOWS_SDK_HOME="$formatted_path"
5715     if test "$build_os" = "cygwin"; then
5716         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5717         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5718             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5719         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5720             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5721         fi
5722     fi
5724     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5725     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5726     dnl but not in v8.0), so allow this to be overridden with a
5727     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5728     dnl and configuration error if no WiLangId.vbs is found would arguably be
5729     dnl better, but I do not know under which conditions exactly it is needed by
5730     dnl msiglobal.pm:
5731     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5732         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5733         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5734             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5735         fi
5736         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5737             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5738         fi
5739         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5740             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5741         fi
5742     fi
5743     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5744         if test -n "$with_package_format" -a "$with_package_format" != no; then
5745             for i in "$with_package_format"; do
5746                 if test "$i" = "msi"; then
5747                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5748                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5749                     fi
5750                 fi
5751             done
5752         fi
5753     fi
5755 AC_SUBST(WINDOWS_SDK_HOME)
5756 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5757 AC_SUBST(WINDOWS_SDK_VERSION)
5758 AC_SUBST(WINDOWS_SDK_WILANGID)
5760 if test "$build_os" = "cygwin"; then
5761     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5762     dnl dir, it also determines that dir's path w/o an arch segment if any,
5763     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5764     AC_MSG_CHECKING([for midl.exe])
5766     find_winsdk
5767     if test -n "$winsdkbinsubdir" \
5768         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5769     then
5770         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5771         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5772     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5773         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5774         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5775     elif test -f "$winsdktest/Bin/midl.exe"; then
5776         MIDL_PATH=$winsdktest/Bin
5777         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5778     fi
5779     if test ! -f "$MIDL_PATH/midl.exe"; then
5780         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5781     else
5782         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5783     fi
5785     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5786     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5788     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5789          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5790          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5791          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5792     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5793          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5794          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5795          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5796     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5797          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5798          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5799          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5800     else
5801         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5802     fi
5804     dnl Check csc.exe
5805     AC_MSG_CHECKING([for csc.exe])
5806     find_csc
5807     if test -f "$csctest/csc.exe"; then
5808         CSC_PATH="$csctest"
5809     fi
5810     if test ! -f "$CSC_PATH/csc.exe"; then
5811         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5812     else
5813         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5814     fi
5816     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5818     dnl Check al.exe
5819     AC_MSG_CHECKING([for al.exe])
5820     find_winsdk
5821     if test -n "$winsdkbinsubdir" \
5822         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5823     then
5824         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5825     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5826         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5827     elif test -f "$winsdktest/Bin/al.exe"; then
5828         AL_PATH="$winsdktest/Bin"
5829     fi
5831     if test -z "$AL_PATH"; then
5832         find_al
5833         if test -f "$altest/bin/al.exe"; then
5834             AL_PATH="$altest/bin"
5835         elif test -f "$altest/al.exe"; then
5836             AL_PATH="$altest"
5837         fi
5838     fi
5839     if test ! -f "$AL_PATH/al.exe"; then
5840         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5841     else
5842         AC_MSG_RESULT([$AL_PATH/al.exe])
5843     fi
5845     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5847     dnl Check mscoree.lib / .NET Framework dir
5848     AC_MSG_CHECKING(.NET Framework)
5849     find_dotnetsdk46
5850     PathFormat "$frametest"
5851     frametest="$formatted_path"
5852     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5853         DOTNET_FRAMEWORK_HOME="$frametest"
5854     else
5855         find_winsdk
5856         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5857             DOTNET_FRAMEWORK_HOME="$winsdktest"
5858         fi
5859     fi
5860     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5861         AC_MSG_ERROR([mscoree.lib not found])
5862     fi
5863     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5865     PathFormat "$MIDL_PATH"
5866     MIDL_PATH="$formatted_path"
5868     PathFormat "$AL_PATH"
5869     AL_PATH="$formatted_path"
5871     PathFormat "$DOTNET_FRAMEWORK_HOME"
5872     DOTNET_FRAMEWORK_HOME="$formatted_path"
5874     PathFormat "$CSC_PATH"
5875     CSC_PATH="$formatted_path"
5878 dnl ===================================================================
5879 dnl Check if stdc headers are available excluding MSVC.
5880 dnl ===================================================================
5881 if test "$_os" != "WINNT"; then
5882     AC_HEADER_STDC
5885 dnl ===================================================================
5886 dnl Testing for C++ compiler and version...
5887 dnl ===================================================================
5889 if test "$_os" != "WINNT"; then
5890     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5891     save_CXXFLAGS=$CXXFLAGS
5892     AC_PROG_CXX
5893     CXXFLAGS=$save_CXXFLAGS
5894     if test -z "$CXX_BASE"; then
5895         CXX_BASE=`first_arg_basename "$CXX"`
5896     fi
5899 dnl check for GNU C++ compiler version
5900 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5901     AC_MSG_CHECKING([the GNU C++ compiler version])
5903     _gpp_version=`$CXX -dumpversion`
5904     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5906     if test "$_gpp_majmin" -lt "700"; then
5907         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5908     else
5909         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5910     fi
5912     dnl see https://code.google.com/p/android/issues/detail?id=41770
5913         glibcxx_threads=no
5914         AC_LANG_PUSH([C++])
5915         AC_REQUIRE_CPP
5916         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5917         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5918             #include <bits/c++config.h>]],[[
5919             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5920             && !defined(_GLIBCXX__PTHREADS) \
5921             && !defined(_GLIBCXX_HAS_GTHREADS)
5922             choke me
5923             #endif
5924         ]])],[AC_MSG_RESULT([yes])
5925         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5926         AC_LANG_POP([C++])
5927         if test $glibcxx_threads = yes; then
5928             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5929         fi
5931 AC_SUBST(BOOST_CXXFLAGS)
5934 # prefx CXX with ccache if needed
5936 if test "$CCACHE" != ""; then
5937     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5938     AC_LANG_PUSH([C++])
5939     save_CXXFLAGS=$CXXFLAGS
5940     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5941     dnl an empty program will do, we're checking the compiler flags
5942     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5943                       [use_ccache=yes], [use_ccache=no])
5944     if test $use_ccache = yes; then
5945         AC_MSG_RESULT([yes])
5946     else
5947         CXX="$CCACHE $CXX"
5948         CXX_BASE="ccache $CXX_BASE"
5949         AC_MSG_RESULT([no])
5950     fi
5951     CXXFLAGS=$save_CXXFLAGS
5952     AC_LANG_POP([C++])
5955 dnl ===================================================================
5956 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5957 dnl ===================================================================
5959 if test "$_os" != "WINNT"; then
5960     AC_PROG_CXXCPP
5962     dnl Check whether there's a C pre-processor.
5963     AC_PROG_CPP
5967 dnl ===================================================================
5968 dnl Find integral type sizes and alignments
5969 dnl ===================================================================
5971 if test "$_os" != "WINNT"; then
5973 if test "$_os" = "iOS"; then
5974     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5975     ac_cv_sizeof_long=8
5976     ac_cv_sizeof_short=2
5977     ac_cv_sizeof_int=4
5978     ac_cv_sizeof_long_long=8
5979     ac_cv_sizeof_double=8
5980     ac_cv_sizeof_voidp=8
5981 else
5982     AC_CHECK_SIZEOF(long)
5983     AC_CHECK_SIZEOF(short)
5984     AC_CHECK_SIZEOF(int)
5985     AC_CHECK_SIZEOF(long long)
5986     AC_CHECK_SIZEOF(double)
5987     AC_CHECK_SIZEOF(void*)
5990     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5991     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5992     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5993     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5994     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5996     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5997     m4_pattern_allow([AC_CHECK_ALIGNOF])
5998     m4_ifdef([AC_CHECK_ALIGNOF],
5999         [
6000             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6001             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6002             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6003             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6004         ],
6005         [
6006             case "$_os-$host_cpu" in
6007             Linux-i686)
6008                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6009                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6010                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6011                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6012                 ;;
6013             Linux-x86_64)
6014                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6015                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6016                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6017                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6018                 ;;
6019             *)
6020                 if test -z "$ac_cv_alignof_short" -o \
6021                         -z "$ac_cv_alignof_int" -o \
6022                         -z "$ac_cv_alignof_long" -o \
6023                         -z "$ac_cv_alignof_double"; then
6024                    AC_MSG_ERROR([Your Autoconf doesn't have [AC_][CHECK_ALIGNOF]. You need to set the environment variables ac_cv_alignof_short, ac_cv_alignof_int, ac_cv_alignof_long and ac_cv_alignof_double.])
6025                 fi
6026                 ;;
6027             esac
6028         ])
6030     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6031     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6032     if test $ac_cv_sizeof_long -eq 8; then
6033         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6034     elif test $ac_cv_sizeof_double -eq 8; then
6035         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6036     else
6037         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6038     fi
6040     dnl Check for large file support
6041     AC_SYS_LARGEFILE
6042     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6043         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6044     fi
6045     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6046         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6047     fi
6048 else
6049     # Hardcode for MSVC
6050     SAL_TYPES_SIZEOFSHORT=2
6051     SAL_TYPES_SIZEOFINT=4
6052     SAL_TYPES_SIZEOFLONG=4
6053     SAL_TYPES_SIZEOFLONGLONG=8
6054     if test "$BITNESS_OVERRIDE" = ""; then
6055         SAL_TYPES_SIZEOFPOINTER=4
6056     else
6057         SAL_TYPES_SIZEOFPOINTER=8
6058     fi
6059     SAL_TYPES_ALIGNMENT2=2
6060     SAL_TYPES_ALIGNMENT4=4
6061     SAL_TYPES_ALIGNMENT8=8
6062     LFS_CFLAGS=''
6064 AC_SUBST(LFS_CFLAGS)
6066 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6067 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6068 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6069 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6070 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6071 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6072 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6073 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6075 dnl ===================================================================
6076 dnl Check whether to enable runtime optimizations
6077 dnl ===================================================================
6078 ENABLE_RUNTIME_OPTIMIZATIONS=
6079 AC_MSG_CHECKING([whether to enable runtime optimizations])
6080 if test -z "$enable_runtime_optimizations"; then
6081     for i in $CC; do
6082         case $i in
6083         -fsanitize=*)
6084             enable_runtime_optimizations=no
6085             break
6086             ;;
6087         esac
6088     done
6090 if test "$enable_runtime_optimizations" != no; then
6091     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6092     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6093     AC_MSG_RESULT([yes])
6094 else
6095     AC_MSG_RESULT([no])
6097 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6099 dnl ===================================================================
6100 dnl Check if valgrind headers are available
6101 dnl ===================================================================
6102 ENABLE_VALGRIND=
6103 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6104     prev_cppflags=$CPPFLAGS
6105     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6106     # or where does it come from?
6107     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6108     AC_CHECK_HEADER([valgrind/valgrind.h],
6109         [ENABLE_VALGRIND=TRUE])
6110     CPPFLAGS=$prev_cppflags
6112 AC_SUBST([ENABLE_VALGRIND])
6113 if test -z "$ENABLE_VALGRIND"; then
6114     if test "$with_valgrind" = yes; then
6115         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6116     fi
6117     VALGRIND_CFLAGS=
6119 AC_SUBST([VALGRIND_CFLAGS])
6122 dnl ===================================================================
6123 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6124 dnl ===================================================================
6126 # We need at least the sys/sdt.h include header.
6127 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6128 if test "$SDT_H_FOUND" = "TRUE"; then
6129     # Found sys/sdt.h header, now make sure the c++ compiler works.
6130     # Old g++ versions had problems with probes in constructors/destructors.
6131     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6132     AC_LANG_PUSH([C++])
6133     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6134     #include <sys/sdt.h>
6135     class ProbeClass
6136     {
6137     private:
6138       int& ref;
6139       const char *name;
6141     public:
6142       ProbeClass(int& v, const char *n) : ref(v), name(n)
6143       {
6144         DTRACE_PROBE2(_test_, cons, name, ref);
6145       }
6147       void method(int min)
6148       {
6149         DTRACE_PROBE3(_test_, meth, name, ref, min);
6150         ref -= min;
6151       }
6153       ~ProbeClass()
6154       {
6155         DTRACE_PROBE2(_test_, dest, name, ref);
6156       }
6157     };
6158     ]],[[
6159     int i = 64;
6160     DTRACE_PROBE1(_test_, call, i);
6161     ProbeClass inst = ProbeClass(i, "call");
6162     inst.method(24);
6163     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6164           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6165     AC_LANG_POP([C++])
6167 AC_CONFIG_HEADERS([config_host/config_probes.h])
6169 dnl ===================================================================
6170 dnl GCC features
6171 dnl ===================================================================
6172 HAVE_GCC_STACK_CLASH_PROTECTION=
6173 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6174     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6175     save_CFLAGS=$CFLAGS
6176     CFLAGS="$CFLAGS -fstack-clash-protection"
6177     AC_LINK_IFELSE(
6178         [AC_LANG_PROGRAM(, [[return 0;]])],
6179         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6180         [AC_MSG_RESULT([no])])
6181     CFLAGS=$save_CFLAGS
6183     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6184     save_CFLAGS=$CFLAGS
6185     CFLAGS="$CFLAGS -Werror -mno-avx"
6186     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6187     CFLAGS=$save_CFLAGS
6188     if test "$HAVE_GCC_AVX" = "TRUE"; then
6189         AC_MSG_RESULT([yes])
6190     else
6191         AC_MSG_RESULT([no])
6192     fi
6194     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6195     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6196     int v = 0;
6197     if (__sync_add_and_fetch(&v, 1) != 1 ||
6198         __sync_sub_and_fetch(&v, 1) != 0)
6199         return 1;
6200     __sync_synchronize();
6201     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6202         v != 1)
6203         return 1;
6204     return 0;
6205 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6206     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6207         AC_MSG_RESULT([yes])
6208         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6209     else
6210         AC_MSG_RESULT([no])
6211     fi
6213     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6214     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6215     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6216         AC_MSG_RESULT([yes])
6217         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6218     else
6219         AC_MSG_RESULT([no])
6220     fi
6222     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6223     save_CFLAGS=$CFLAGS
6224     CFLAGS="$CFLAGS -Werror"
6225     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6226             __attribute__((deprecated("test"))) void f();
6227         ])], [
6228             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6229             AC_MSG_RESULT([yes])
6230         ], [AC_MSG_RESULT([no])])
6231     CFLAGS=$save_CFLAGS
6233     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6234     AC_LANG_PUSH([C++])
6235     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6236             #include <cstddef>
6237             #include <cxxabi.h>
6238             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6239         ])], [
6240             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6241             AC_MSG_RESULT([yes])
6242         ], [AC_MSG_RESULT([no])])
6243     AC_LANG_POP([C++])
6245     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6246     AC_LANG_PUSH([C++])
6247     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6248             #include <cstddef>
6249             #include <cxxabi.h>
6250             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6251         ])], [
6252             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6253             AC_MSG_RESULT([yes])
6254         ], [AC_MSG_RESULT([no])])
6255     AC_LANG_POP([C++])
6257     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6258     AC_LANG_PUSH([C++])
6259     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6260             #include <cxxabi.h>
6261             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6262         ])], [
6263             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6264             AC_MSG_RESULT([yes])
6265         ], [AC_MSG_RESULT([no])])
6266     AC_LANG_POP([C++])
6268     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6269     AC_LANG_PUSH([C++])
6270     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6271             #include <cstddef>
6272             #include <cxxabi.h>
6273             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6274         ])], [
6275             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6276             AC_MSG_RESULT([yes])
6277         ], [AC_MSG_RESULT([no])])
6278     AC_LANG_POP([C++])
6280     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6281     AC_LANG_PUSH([C++])
6282     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6283             #include <cstddef>
6284             #include <cxxabi.h>
6285             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6286         ])], [
6287             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6288             AC_MSG_RESULT([yes])
6289         ], [AC_MSG_RESULT([no])])
6290     AC_LANG_POP([C++])
6292     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6293     AC_LANG_PUSH([C++])
6294     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6295             #include <cxxabi.h>
6296             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6297         ])], [
6298             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6299             AC_MSG_RESULT([yes])
6300         ], [AC_MSG_RESULT([no])])
6301     AC_LANG_POP([C++])
6303     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6304     AC_LANG_PUSH([C++])
6305     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6306             #include <cxxabi.h>
6307             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6308         ])], [
6309             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6310             AC_MSG_RESULT([yes])
6311         ], [AC_MSG_RESULT([no])])
6312     AC_LANG_POP([C++])
6314     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6315     AC_LANG_PUSH([C++])
6316     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6317             #include <cxxabi.h>
6318             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6319         ])], [
6320             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6321             AC_MSG_RESULT([yes])
6322         ], [AC_MSG_RESULT([no])])
6323     AC_LANG_POP([C++])
6325     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6326     AC_LANG_PUSH([C++])
6327     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6328             #include <cstddef>
6329             #include <cxxabi.h>
6330             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6331         ])], [
6332             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6333             AC_MSG_RESULT([yes])
6334         ], [AC_MSG_RESULT([no])])
6335     AC_LANG_POP([C++])
6337     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6338     AC_LANG_PUSH([C++])
6339     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6340             #include <cstddef>
6341             #include <cxxabi.h>
6342             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6343         ])], [
6344             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6345             AC_MSG_RESULT([yes])
6346         ], [AC_MSG_RESULT([no])])
6347     AC_LANG_POP([C++])
6349     dnl Available in GCC 4.9 and at least since Clang 3.4:
6350     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6351     AC_LANG_PUSH([C++])
6352     save_CXXFLAGS=$CXXFLAGS
6353     CXXFLAGS="$CXXFLAGS -Werror"
6354     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6355             struct __attribute__((warn_unused)) dummy {};
6356         ])], [
6357             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6358             AC_MSG_RESULT([yes])
6359         ], [AC_MSG_RESULT([no])])
6360     CXXFLAGS=$save_CXXFLAGS
6361 AC_LANG_POP([C++])
6364 AC_SUBST(HAVE_GCC_AVX)
6365 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6366 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6367 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6369 dnl ===================================================================
6370 dnl Identify the C++ library
6371 dnl ===================================================================
6373 AC_MSG_CHECKING([what the C++ library is])
6374 AC_LANG_PUSH([C++])
6375 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6376 #include <utility>
6377 #ifndef __GLIBCXX__
6378 foo bar
6379 #endif
6380 ]])],
6381     [CPP_LIBRARY=GLIBCXX
6382      cpp_library_name="GNU libstdc++"
6383     ],
6384     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6385 #include <utility>
6386 #ifndef _LIBCPP_VERSION
6387 foo bar
6388 #endif
6389 ]])],
6390     [CPP_LIBRARY=LIBCPP
6391      cpp_library_name="LLVM libc++"
6392      AC_DEFINE([HAVE_LIBCXX])
6393     ],
6394     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6395 #include <utility>
6396 #ifndef _MSC_VER
6397 foo bar
6398 #endif
6399 ]])],
6400     [CPP_LIBRARY=MSVCRT
6401      cpp_library_name="Microsoft"
6402     ],
6403     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6404 AC_MSG_RESULT([$cpp_library_name])
6405 AC_LANG_POP([C++])
6407 dnl ===================================================================
6408 dnl Check for gperf
6409 dnl ===================================================================
6410 AC_PATH_PROG(GPERF, gperf)
6411 if test -z "$GPERF"; then
6412     AC_MSG_ERROR([gperf not found but needed. Install it.])
6414 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6415     GPERF=`cygpath -m $GPERF`
6417 AC_MSG_CHECKING([whether gperf is new enough])
6418 my_gperf_ver1=$($GPERF --version | head -n 1)
6419 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6420 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6421 if test "$my_gperf_ver3" -ge 301; then
6422     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6423 else
6424     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6426 AC_SUBST(GPERF)
6428 dnl ===================================================================
6429 dnl Check for system libcmis
6430 dnl ===================================================================
6431 # libcmis requires curl and we can't build curl for iOS
6432 if test $_os != iOS; then
6433     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6434     ENABLE_LIBCMIS=TRUE
6435 else
6436     ENABLE_LIBCMIS=
6438 AC_SUBST(ENABLE_LIBCMIS)
6440 dnl ===================================================================
6441 dnl C++11
6442 dnl ===================================================================
6444 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6445 CXXFLAGS_CXX11=
6446 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6447     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6448 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6449     my_flags='-std=c++2a -std=c++17 -std=c++1z'
6450     for flag in $my_flags; do
6451         if test "$COM" = MSC; then
6452             flag="-Xclang $flag"
6453         fi
6454         save_CXXFLAGS=$CXXFLAGS
6455         CXXFLAGS="$CXXFLAGS $flag -Werror"
6456         if test "$SYSTEM_LIBCMIS" = TRUE; then
6457             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6458         fi
6459         AC_LANG_PUSH([C++])
6460         dnl Clang 3.9 supports __float128 since
6461         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6462         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6463         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6464         dnl $flag is supported below, so check this first):
6465         my_float128hack=
6466         my_float128hack_impl=-D__float128=void
6467         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6468             #include <vector>
6469             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6470             // (__float128)
6471             ]])
6472         ],,[
6473             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6474             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6475             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6476             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6477             dnl place where __float128 is used is in a template specialization, -D__float128=void
6478             dnl will avoid the problem there while still causing a problem if somebody actually uses
6479             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6480             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6481             dnl "fixed" with this hack):
6482             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6483             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6484                 #include <vector>
6485                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6486                 // (__float128)
6487                 ]])
6488             ],[my_float128hack=$my_float128hack_impl])
6489         ])
6490         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6491             #include <algorithm>
6492             #include <functional>
6493             #include <vector>
6495             #if defined SYSTEM_LIBCMIS
6496             // See ucb/source/ucp/cmis/auth_provider.hxx:
6497             #if !defined __clang__
6498             #pragma GCC diagnostic push
6499             #pragma GCC diagnostic ignored "-Wdeprecated"
6500             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6501             #endif
6502             #include <libcmis/libcmis.hxx>
6503             #if !defined __clang__
6504             #pragma GCC diagnostic pop
6505             #endif
6506             #endif
6508             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6509                 std::sort(v.begin(), v.end(), fn);
6510             }
6511             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6512         AC_LANG_POP([C++])
6513         CXXFLAGS=$save_CXXFLAGS
6514         if test -n "$CXXFLAGS_CXX11"; then
6515             break
6516         fi
6517     done
6519 if test -n "$CXXFLAGS_CXX11"; then
6520     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6521 else
6522     AC_MSG_ERROR(no)
6524 AC_SUBST(CXXFLAGS_CXX11)
6526 if test "$GCC" = "yes"; then
6527     save_CXXFLAGS=$CXXFLAGS
6528     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6529     CHECK_L_ATOMIC
6530     CXXFLAGS=$save_CXXFLAGS
6531     AC_SUBST(ATOMIC_LIB)
6534 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6535 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6536 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6537 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6538 dnl again towards 4.7.2:
6539 if test $CPP_LIBRARY = GLIBCXX; then
6540     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6541     AC_LANG_PUSH([C++])
6542     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6543 #include <list>
6544 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6545     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6546     //   GCC 4.7.0: 20120322
6547     //   GCC 4.7.1: 20120614
6548     // and using a range check is not possible as the mapping between
6549     // __GLIBCXX__ values and GCC versions is not monotonic
6550 /* ok */
6551 #else
6552 abi broken
6553 #endif
6554         ]])], [AC_MSG_RESULT(no, ok)],
6555         [AC_MSG_ERROR(yes)])
6556     AC_LANG_POP([C++])
6559 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6560 save_CXXFLAGS=$CXXFLAGS
6561 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6562 AC_LANG_PUSH([C++])
6564 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6565 #include <stddef.h>
6567 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6569 namespace
6571         struct b
6572         {
6573                 int i;
6574                 int j;
6575         };
6577 ]], [[
6578 struct a
6580         int i;
6581         int j;
6583 a thinga[]={{0,0}, {1,1}};
6584 b thingb[]={{0,0}, {1,1}};
6585 size_t i = sizeof(sal_n_array_size(thinga));
6586 size_t j = sizeof(sal_n_array_size(thingb));
6587 return !(i != 0 && j != 0);
6589     ], [ AC_MSG_RESULT(yes) ],
6590     [ AC_MSG_ERROR(no)])
6591 AC_LANG_POP([C++])
6592 CXXFLAGS=$save_CXXFLAGS
6594 dnl _Pragma support (may require C++11)
6595 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6596     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6597     AC_LANG_PUSH([C++])
6598     save_CXXFLAGS=$CXXFLAGS
6599     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6600     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6601             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6602         ])], [
6603             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6604             AC_MSG_RESULT([yes])
6605         ], [AC_MSG_RESULT([no])])
6606     AC_LANG_POP([C++])
6607     CXXFLAGS=$save_CXXFLAGS
6610 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6611 if test "$GCC" = yes; then
6612     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6613     AC_LANG_PUSH([C++])
6614     save_CXXFLAGS=$CXXFLAGS
6615     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6616     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6617     CXXFLAGS=$save_CXXFLAGS
6618     AC_LANG_POP([C++])
6619     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6620         AC_MSG_RESULT([yes])
6621     else
6622         AC_MSG_RESULT([no])
6623     fi
6625 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6627 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6628 AC_LANG_PUSH([C++])
6629 save_CXXFLAGS=$CXXFLAGS
6630 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6631 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6632         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6633         // supporting it:
6634         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6635         struct S {
6636         private:
6637             S(S const &);
6638         public:
6639             S();
6640             ~S();
6641         };
6642         S copy();
6643         void f() { S c(copy()); }
6644         #endif
6645     ])], [
6646         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6647         AC_MSG_RESULT([yes])
6648     ], [AC_MSG_RESULT([no])])
6649 CXXFLAGS=$save_CXXFLAGS
6650 AC_LANG_POP([C++])
6652 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6653 AC_LANG_PUSH([C++])
6654 save_CXXFLAGS=$CXXFLAGS
6655 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6656 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6657         #include <algorithm>
6658         #include <initializer_list>
6659         #include <vector>
6660         template<typename T> class S {
6661         private:
6662             std::vector<T> v_;
6663         public:
6664             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6665         };
6666         constinit S<int> s{3, 2, 1};
6667     ])], [
6668         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6669         AC_MSG_RESULT([yes])
6670     ], [AC_MSG_RESULT([no])])
6671 CXXFLAGS=$save_CXXFLAGS
6672 AC_LANG_POP([C++])
6674 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6675 AC_LANG_PUSH([C++])
6676 save_CXXFLAGS=$CXXFLAGS
6677 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6678 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6679         struct S1 { S1(S1 &&); };
6680         struct S2: S1 {};
6681         S1 f(S2 s) { return s; }
6682     ])], [
6683         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6684         AC_MSG_RESULT([yes])
6685     ], [AC_MSG_RESULT([no])])
6686 CXXFLAGS=$save_CXXFLAGS
6687 AC_LANG_POP([C++])
6689 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6690 dnl uninitialized warning for code like
6692 dnl   OString f();
6693 dnl   boost::optional<OString> * g(bool b) {
6694 dnl       boost::optional<OString> o;
6695 dnl       if (b) o = f();
6696 dnl       return new boost::optional<OString>(o);
6697 dnl   }
6699 dnl (as is e.g. present, in a slightly more elaborate form, in
6700 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6701 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6702 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6703 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6704     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6705     AC_LANG_PUSH([C++])
6706     save_CXXFLAGS=$CXXFLAGS
6707     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6708     if test "$ENABLE_OPTIMIZED" = TRUE; then
6709         CXXFLAGS="$CXXFLAGS -O2"
6710     else
6711         CXXFLAGS="$CXXFLAGS -O0"
6712     fi
6713     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6714             #include <new>
6715             void f1(int);
6716             struct S1 {
6717                 ~S1() { f1(n); }
6718                 int n = 0;
6719             };
6720             struct S2 {
6721                 S2() {}
6722                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6723                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6724                 void set(S1 s) {
6725                     new (stg) S1(s);
6726                     init = true;
6727                 }
6728                 bool init = false;
6729                 char stg[sizeof (S1)];
6730             } ;
6731             S1 f2();
6732             S2 * f3(bool b) {
6733                 S2 o;
6734                 if (b) o.set(f2());
6735                 return new S2(o);
6736             }
6737         ]])], [AC_MSG_RESULT([no])], [
6738             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6739             AC_MSG_RESULT([yes])
6740         ])
6741     CXXFLAGS=$save_CXXFLAGS
6742     AC_LANG_POP([C++])
6744 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6746 dnl ===================================================================
6747 dnl CPU Intrinsics support - SSE, AVX
6748 dnl ===================================================================
6750 INTRINSICS_CXXFLAGS=""
6752 if test "$GCC" = "yes"; then
6753     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6754     AC_LANG_PUSH([C++])
6755     save_CXXFLAGS=$CXXFLAGS
6756     CXXFLAGS="$CXXFLAGS -msse2"
6757     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6758         #include <emmintrin.h>
6759         int main () {
6760             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6761             c = _mm_xor_si128 (a, b);
6762             return 0;
6763         }
6764         ])],
6765         [can_compile_sse2=yes],
6766         [can_compile_sse2=no])
6767     AC_LANG_POP([C++])
6768     CXXFLAGS=$save_CXXFLAGS
6769     AC_MSG_RESULT([${can_compile_sse2}])
6770     if test "${can_compile_sse2}" = "yes" ; then
6771         INTRINSICS_CXXFLAGS="-msse2"
6772     else
6773         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6774     fi
6776     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6777     AC_LANG_PUSH([C++])
6778     save_CXXFLAGS=$CXXFLAGS
6779     CXXFLAGS="$CXXFLAGS -mssse3"
6780     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6781         #include <tmmintrin.h>
6782         int main () {
6783             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6784             c = _mm_maddubs_epi16 (a, b);
6785             return 0;
6786         }
6787         ])],
6788         [can_compile_ssse3=yes],
6789         [can_compile_ssse3=no])
6790     AC_LANG_POP([C++])
6791     CXXFLAGS=$save_CXXFLAGS
6792     AC_MSG_RESULT([${can_compile_ssse3}])
6793     if test "${can_compile_ssse3}" = "yes" ; then
6794         INTRINSICS_CXXFLAGS="-mssse3"
6795     else
6796         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6797     fi
6799     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6800     AC_LANG_PUSH([C++])
6801     save_CXXFLAGS=$CXXFLAGS
6802     CXXFLAGS="$CXXFLAGS -mavx"
6803     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6804         #include <immintrin.h>
6805         int main () {
6806             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6807             c = _mm256_xor_ps(a, b);
6808             return 0;
6809         }
6810         ])],
6811         [can_compile_avx=yes],
6812         [can_compile_avx=no])
6813     AC_LANG_POP([C++])
6814     CXXFLAGS=$save_CXXFLAGS
6815     AC_MSG_RESULT([${can_compile_avx}])
6816     if test "${can_compile_avx}" = "yes" ; then
6817         INTRINSICS_CXXFLAGS="-mavx"
6818     else
6819         AC_MSG_WARN([cannot compile AVX intrinsics])
6820     fi
6822     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6823     AC_LANG_PUSH([C++])
6824     save_CXXFLAGS=$CXXFLAGS
6825     CXXFLAGS="$CXXFLAGS -mavx2"
6826     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6827         #include <immintrin.h>
6828         int main () {
6829             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6830             c = _mm256_maddubs_epi16(a, b);
6831             return 0;
6832         }
6833         ])],
6834         [can_compile_avx2=yes],
6835         [can_compile_avx2=no])
6836     AC_LANG_POP([C++])
6837     CXXFLAGS=$save_CXXFLAGS
6838     AC_MSG_RESULT([${can_compile_avx2}])
6839     if test "${can_compile_avx2}" = "yes" ; then
6840         INTRINSICS_CXXFLAGS="-mavx2"
6841     else
6842         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6843     fi
6846 AC_SUBST([INTRINSICS_CXXFLAGS])
6848 dnl ===================================================================
6849 dnl system stl sanity tests
6850 dnl ===================================================================
6851 if test "$_os" != "WINNT"; then
6853     AC_LANG_PUSH([C++])
6855     save_CPPFLAGS="$CPPFLAGS"
6856     if test -n "$MACOSX_SDK_PATH"; then
6857         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6858     fi
6860     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6861     # only.
6862     if test "$CPP_LIBRARY" = GLIBCXX; then
6863         dnl gcc#19664, gcc#22482, rhbz#162935
6864         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6865         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6866         AC_MSG_RESULT([$stlvisok])
6867         if test "$stlvisok" = "no"; then
6868             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6869         fi
6870     fi
6872     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6873     # when we don't make any dynamic libraries?
6874     if test "$DISABLE_DYNLOADING" = ""; then
6875         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6876         cat > conftestlib1.cc <<_ACEOF
6877 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6878 struct S2: S1<int> { virtual ~S2(); };
6879 S2::~S2() {}
6880 _ACEOF
6881         cat > conftestlib2.cc <<_ACEOF
6882 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6883 struct S2: S1<int> { virtual ~S2(); };
6884 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6885 _ACEOF
6886         gccvisinlineshiddenok=yes
6887         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6888             gccvisinlineshiddenok=no
6889         else
6890             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6891             dnl known to not work with -z defs (unsetting which makes the test
6892             dnl moot, though):
6893             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6894             if test "$COM_IS_CLANG" = TRUE; then
6895                 for i in $CXX $CXXFLAGS; do
6896                     case $i in
6897                     -fsanitize=*)
6898                         my_linkflagsnoundefs=
6899                         break
6900                         ;;
6901                     esac
6902                 done
6903             fi
6904             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6905                 gccvisinlineshiddenok=no
6906             fi
6907         fi
6909         rm -fr libconftest*
6910         AC_MSG_RESULT([$gccvisinlineshiddenok])
6911         if test "$gccvisinlineshiddenok" = "no"; then
6912             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6913         fi
6914     fi
6916    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6917     cat >visibility.cxx <<_ACEOF
6918 #pragma GCC visibility push(hidden)
6919 struct __attribute__ ((visibility ("default"))) TestStruct {
6920   static void Init();
6922 __attribute__ ((visibility ("default"))) void TestFunc() {
6923   TestStruct::Init();
6925 _ACEOF
6926     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6927         gccvisbroken=yes
6928     else
6929         case "$host_cpu" in
6930         i?86|x86_64)
6931             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6932                 gccvisbroken=no
6933             else
6934                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6935                     gccvisbroken=no
6936                 else
6937                     gccvisbroken=yes
6938                 fi
6939             fi
6940             ;;
6941         *)
6942             gccvisbroken=no
6943             ;;
6944         esac
6945     fi
6946     rm -f visibility.s visibility.cxx
6948     AC_MSG_RESULT([$gccvisbroken])
6949     if test "$gccvisbroken" = "yes"; then
6950         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6951     fi
6953     CPPFLAGS="$save_CPPFLAGS"
6955     AC_LANG_POP([C++])
6958 dnl ===================================================================
6959 dnl  Clang++ tests
6960 dnl ===================================================================
6962 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6963 if test "$GCC" = "yes"; then
6964     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
6965     AC_LANG_PUSH([C++])
6966     save_CXXFLAGS=$CXXFLAGS
6967     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6968     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6969     CXXFLAGS=$save_CXXFLAGS
6970     AC_LANG_POP([C++])
6971     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6972         AC_MSG_RESULT([yes])
6973     else
6974         AC_MSG_RESULT([no])
6975     fi
6977 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6979 dnl ===================================================================
6980 dnl Compiler plugins
6981 dnl ===================================================================
6983 COMPILER_PLUGINS=
6984 # currently only Clang
6986 if test "$COM_IS_CLANG" != "TRUE"; then
6987     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6988         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6989         enable_compiler_plugins=no
6990     fi
6993 if test "$COM_IS_CLANG" = "TRUE"; then
6994     if test -n "$enable_compiler_plugins"; then
6995         compiler_plugins="$enable_compiler_plugins"
6996     elif test -n "$ENABLE_DBGUTIL"; then
6997         compiler_plugins=test
6998     else
6999         compiler_plugins=no
7000     fi
7001     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7002         if test "$CLANGVER" -lt 50002; then
7003             if test "$compiler_plugins" = yes; then
7004                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7005             else
7006                 compiler_plugins=no
7007             fi
7008         fi
7009     fi
7010     if test "$compiler_plugins" != "no"; then
7011         dnl The prefix where Clang resides, override to where Clang resides if
7012         dnl using a source build:
7013         if test -z "$CLANGDIR"; then
7014             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7015         fi
7016         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7017         if test -z "$COMPILER_PLUGINS_CXX"; then
7018             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7019         fi
7020         clangbindir=$CLANGDIR/bin
7021         if test "$build_os" = "cygwin"; then
7022             clangbindir=$(cygpath -u "$clangbindir")
7023         fi
7024         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7025         if test -n "$LLVM_CONFIG"; then
7026             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7027             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7028             if test -z "$CLANGLIBDIR"; then
7029                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7030             fi
7031             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7032             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7033             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7034             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7035                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7036             fi
7037             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7038             clangobjdir=$($LLVM_CONFIG --obj-root)
7039             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7040                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7041             fi
7042         fi
7043         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7044         AC_LANG_PUSH([C++])
7045         save_CXX=$CXX
7046         save_CXXCPP=$CXXCPP
7047         save_CPPFLAGS=$CPPFLAGS
7048         save_CXXFLAGS=$CXXFLAGS
7049         save_LDFLAGS=$LDFLAGS
7050         save_LIBS=$LIBS
7051         CXX=$COMPILER_PLUGINS_CXX
7052         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7053         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7054         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7055         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7056             [COMPILER_PLUGINS=TRUE],
7057             [
7058             if test "$compiler_plugins" = "yes"; then
7059                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7060             else
7061                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7062                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7063             fi
7064             ])
7065         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7066         dnl comment in compilerplugins/Makefile-clang.mk:
7067         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7068             LDFLAGS=""
7069             AC_MSG_CHECKING([for clang libraries to use])
7070             if test -z "$CLANGTOOLLIBS"; then
7071                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7072  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7073                 AC_LINK_IFELSE([
7074                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7075                         [[ clang::FullSourceLoc().dump(); ]])
7076                 ],[CLANGTOOLLIBS="$LIBS"],[])
7077             fi
7078             if test -z "$CLANGTOOLLIBS"; then
7079                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7080                 AC_LINK_IFELSE([
7081                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7082                         [[ clang::FullSourceLoc().dump(); ]])
7083                 ],[CLANGTOOLLIBS="$LIBS"],[])
7084             fi
7085             AC_MSG_RESULT([$CLANGTOOLLIBS])
7086             if test -z "$CLANGTOOLLIBS"; then
7087                 if test "$compiler_plugins" = "yes"; then
7088                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7089                 else
7090                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7091                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7092                 fi
7093                 COMPILER_PLUGINS=
7094             fi
7095             if test -n "$COMPILER_PLUGINS"; then
7096                 if test -z "$CLANGSYSINCLUDE"; then
7097                     if test -n "$LLVM_CONFIG"; then
7098                         # Path to the clang system headers (no idea if there's a better way to get it).
7099                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7100                     fi
7101                 fi
7102             fi
7103         fi
7104         CXX=$save_CXX
7105         CXXCPP=$save_CXXCPP
7106         CPPFLAGS=$save_CPPFLAGS
7107         CXXFLAGS=$save_CXXFLAGS
7108         LDFLAGS=$save_LDFLAGS
7109         LIBS="$save_LIBS"
7110         AC_LANG_POP([C++])
7111     fi
7112 else
7113     if test "$enable_compiler_plugins" = "yes"; then
7114         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7115     fi
7117 AC_SUBST(COMPILER_PLUGINS)
7118 AC_SUBST(COMPILER_PLUGINS_CXX)
7119 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7120 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7121 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7122 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7123 AC_SUBST(CLANGDIR)
7124 AC_SUBST(CLANGLIBDIR)
7125 AC_SUBST(CLANGTOOLLIBS)
7126 AC_SUBST(CLANGSYSINCLUDE)
7128 # Plugin to help linker.
7129 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7130 # This makes --enable-lto build with clang work.
7131 AC_SUBST(LD_PLUGIN)
7133 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7134 AC_SUBST(HAVE_POSIX_FALLOCATE)
7136 dnl ===================================================================
7137 dnl Custom build version
7138 dnl ===================================================================
7140 AC_MSG_CHECKING([whether to add custom build version])
7141 if test "$with_build_version" != ""; then
7142     BUILD_VER_STRING=$with_build_version
7143     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7144 else
7145     BUILD_VER_STRING=
7146     AC_MSG_RESULT([no])
7148 AC_SUBST(BUILD_VER_STRING)
7150 JITC_PROCESSOR_TYPE=""
7151 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7152     # IBMs JDK needs this...
7153     JITC_PROCESSOR_TYPE=6
7154     export JITC_PROCESSOR_TYPE
7156 AC_SUBST([JITC_PROCESSOR_TYPE])
7158 # Misc Windows Stuff
7159 AC_ARG_WITH(ucrt-dir,
7160     AS_HELP_STRING([--with-ucrt-dir],
7161         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7162         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7163         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7164             Windows6.1-KB2999226-x64.msu
7165             Windows6.1-KB2999226-x86.msu
7166             Windows8.1-KB2999226-x64.msu
7167             Windows8.1-KB2999226-x86.msu
7168             Windows8-RT-KB2999226-x64.msu
7169             Windows8-RT-KB2999226-x86.msu
7170         A zip archive including those files is available from Microsoft site:
7171         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7173 UCRT_REDISTDIR="$with_ucrt_dir"
7174 if test $_os = "WINNT"; then
7175     find_msvc_x64_dlls
7176     find_msms
7177     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7178     MSVC_DLLS="$msvcdlls"
7179     MSM_PATH=`win_short_path_for_make "$msmdir"`
7180     # MSVC 15.3 changed it to VC141
7181     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7182         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7183     else
7184         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7185     fi
7187     if test "$UCRT_REDISTDIR" = "no"; then
7188         dnl explicitly disabled
7189         UCRT_REDISTDIR=""
7190     else
7191         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7192                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7193                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7194                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7195                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7196                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7197             UCRT_REDISTDIR=""
7198             if test -n "$PKGFORMAT"; then
7199                for i in $PKGFORMAT; do
7200                    case "$i" in
7201                    msi)
7202                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7203                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7204                        ;;
7205                    esac
7206                done
7207             fi
7208         fi
7209     fi
7212 AC_SUBST(UCRT_REDISTDIR)
7213 AC_SUBST(MSVC_DLL_PATH)
7214 AC_SUBST(MSVC_DLLS)
7215 AC_SUBST(MSM_PATH)
7217 dnl ===================================================================
7218 dnl Checks for Java
7219 dnl ===================================================================
7220 if test "$ENABLE_JAVA" != ""; then
7222     # Windows-specific tests
7223     if test "$build_os" = "cygwin"; then
7224         if test "$BITNESS_OVERRIDE" = 64; then
7225             bitness=64
7226         else
7227             bitness=32
7228         fi
7230         if test -z "$with_jdk_home"; then
7231             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7232             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7233             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7234             if test -n "$regvalue"; then
7235                 ver=$regvalue
7236                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7237                 _jdk_home=$regvalue
7238             fi
7239             if test -z "$with_jdk_home"; then
7240                 for ver in 1.8; do
7241                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7242                     if test -n "$regvalue"; then
7243                         _jdk_home=$regvalue
7244                         break
7245                     fi
7246                 done
7247             fi
7248             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7249                 with_jdk_home="$_jdk_home"
7250                 howfound="found automatically"
7251             else
7252                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7253             fi
7254         else
7255             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7256             howfound="you passed"
7257         fi
7258     fi
7260     # macOS: /usr/libexec/java_home helps to set the current JDK_HOME. Actually JDK_HOME should NOT be set where java (/usr/bin/java) is located.
7261     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7262     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7263         with_jdk_home=`/usr/libexec/java_home`
7264     fi
7266     JAVA_HOME=; export JAVA_HOME
7267     if test -z "$with_jdk_home"; then
7268         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7269     else
7270         _java_path="$with_jdk_home/bin/$with_java"
7271         dnl Check if there is a Java interpreter at all.
7272         if test -x "$_java_path"; then
7273             JAVAINTERPRETER=$_java_path
7274         else
7275             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7276         fi
7277     fi
7279     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7280     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7281     dnl loaded by java to run JunitTests:
7282     if test "$build_os" = "cygwin"; then
7283         shortjdkhome=`cygpath -d "$with_jdk_home"`
7284         if test "$BITNESS_OVERRIDE" = 64 -a -f "$with_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7285             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7286             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7287         elif test "$BITNESS_OVERRIDE" = "" -a -f "$_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7288             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7289             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7290         fi
7292         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7293             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7294         fi
7295         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7296     elif test "$cross_compiling" != "yes"; then
7297         case $CPUNAME in
7298             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7299                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7300                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7301                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7302                 fi
7303                 ;;
7304             *) # assumption: everything else 32-bit
7305                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7306                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7307                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7308                 fi
7309                 ;;
7310         esac
7311     fi
7314 dnl ===================================================================
7315 dnl Checks for JDK.
7316 dnl ===================================================================
7318 # Note that JAVA_HOME as for now always means the *build* platform's
7319 # JAVA_HOME. Whether all the complexity here actually is needed any
7320 # more or not, no idea.
7322 if test "$ENABLE_JAVA" != ""; then
7323     _gij_longver=0
7324     AC_MSG_CHECKING([the installed JDK])
7325     if test -n "$JAVAINTERPRETER"; then
7326         dnl java -version sends output to stderr!
7327         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7328             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7329         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7330             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7331         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7332             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7333         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7334             JDK=ibm
7336             dnl IBM JDK specific tests
7337             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7338             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7340             if test "$_jdk_ver" -lt 10800; then
7341                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7342             fi
7344             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7346             if test "$with_jdk_home" = ""; then
7347                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7348 you must use the "--with-jdk-home" configure option explicitly])
7349             fi
7351             JAVA_HOME=$with_jdk_home
7352         else
7353             JDK=sun
7355             dnl Sun JDK specific tests
7356             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7357             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7359             if test "$_jdk_ver" -lt 10800; then
7360                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7361             fi
7362             if test "$_jdk_ver" -gt 10800; then
7363                 JAVA_CLASSPATH_NOT_SET=TRUE
7364             fi
7366             AC_MSG_RESULT([found (JDK $_jdk)])
7367             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7368             if test "$_os" = "WINNT"; then
7369                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7370             fi
7372             # set to limit VM usage for JunitTests
7373             JAVAIFLAGS=-Xmx64M
7374             # set to limit VM usage for javac
7375             JAVAFLAGS=-J-Xmx128M
7376         fi
7377     else
7378         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7379     fi
7380 else
7381     dnl Java disabled
7382     JAVA_HOME=
7383     export JAVA_HOME
7386 dnl ===================================================================
7387 dnl Checks for javac
7388 dnl ===================================================================
7389 if test "$ENABLE_JAVA" != ""; then
7390     javacompiler="javac"
7391     : ${JAVA_SOURCE_VER=8}
7392     : ${JAVA_TARGET_VER=8}
7393     if test -z "$with_jdk_home"; then
7394         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7395     else
7396         _javac_path="$with_jdk_home/bin/$javacompiler"
7397         dnl Check if there is a Java compiler at all.
7398         if test -x "$_javac_path"; then
7399             JAVACOMPILER=$_javac_path
7400         fi
7401     fi
7402     if test -z "$JAVACOMPILER"; then
7403         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7404     fi
7405     if test "$build_os" = "cygwin"; then
7406         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7407             JAVACOMPILER="${JAVACOMPILER}.exe"
7408         fi
7409         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7410     fi
7413 dnl ===================================================================
7414 dnl Checks for javadoc
7415 dnl ===================================================================
7416 if test "$ENABLE_JAVA" != ""; then
7417     if test -z "$with_jdk_home"; then
7418         AC_PATH_PROG(JAVADOC, javadoc)
7419     else
7420         _javadoc_path="$with_jdk_home/bin/javadoc"
7421         dnl Check if there is a javadoc at all.
7422         if test -x "$_javadoc_path"; then
7423             JAVADOC=$_javadoc_path
7424         else
7425             AC_PATH_PROG(JAVADOC, javadoc)
7426         fi
7427     fi
7428     if test -z "$JAVADOC"; then
7429         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7430     fi
7431     if test "$build_os" = "cygwin"; then
7432         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7433             JAVADOC="${JAVADOC}.exe"
7434         fi
7435         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7436     fi
7438     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7439     JAVADOCISGJDOC="yes"
7440     fi
7442 AC_SUBST(JAVADOCISGJDOC)
7444 if test "$ENABLE_JAVA" != ""; then
7445     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7446     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7447         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7448            # try to recover first by looking whether we have an alternative
7449            # system as in Debian or newer SuSEs where following /usr/bin/javac
7450            # over /etc/alternatives/javac leads to the right bindir where we
7451            # just need to strip a bit away to get a valid JAVA_HOME
7452            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7453         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7454             # maybe only one level of symlink (e.g. on Mac)
7455             JAVA_HOME=$(readlink $JAVACOMPILER)
7456             if test "$(dirname $JAVA_HOME)" = "."; then
7457                 # we've got no path to trim back
7458                 JAVA_HOME=""
7459             fi
7460         else
7461             # else warn
7462             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7463             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7464             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7465             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7466         fi
7467         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7468         if test "$JAVA_HOME" != "/usr"; then
7469             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7470                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7471                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7472                 dnl Tiger already returns a JDK path...
7473                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7474             else
7475                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7476                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7477                 dnl that checks which version to run
7478                 if test -f "$JAVA_HOME"; then
7479                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7480                 fi
7481             fi
7482         fi
7483     fi
7484     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7486     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7487     if test -z "$JAVA_HOME"; then
7488         if test "x$with_jdk_home" = "x"; then
7489             cat > findhome.java <<_ACEOF
7490 [import java.io.File;
7492 class findhome
7494     public static void main(String args[])
7495     {
7496         String jrelocation = System.getProperty("java.home");
7497         File jre = new File(jrelocation);
7498         System.out.println(jre.getParent());
7499     }
7501 _ACEOF
7502             AC_MSG_CHECKING([if javac works])
7503             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7504             AC_TRY_EVAL(javac_cmd)
7505             if test $? = 0 -a -f ./findhome.class; then
7506                 AC_MSG_RESULT([javac works])
7507             else
7508                 echo "configure: javac test failed" >&5
7509                 cat findhome.java >&5
7510                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7511             fi
7512             AC_MSG_CHECKING([if gij knows its java.home])
7513             JAVA_HOME=`$JAVAINTERPRETER findhome`
7514             if test $? = 0 -a "$JAVA_HOME" != ""; then
7515                 AC_MSG_RESULT([$JAVA_HOME])
7516             else
7517                 echo "configure: java test failed" >&5
7518                 cat findhome.java >&5
7519                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7520             fi
7521             # clean-up after ourselves
7522             rm -f ./findhome.java ./findhome.class
7523         else
7524             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7525         fi
7526     fi
7528     # now check if $JAVA_HOME is really valid
7529     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7530         case "${JAVA_HOME}" in
7531             /Library/Java/JavaVirtualMachines/*)
7532                 ;;
7533             *)
7534                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7535                 ;;
7536         esac
7537         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7538             JAVA_HOME_OK="NO"
7539         fi
7540     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7541         JAVA_HOME_OK="NO"
7542     fi
7543     if test "$JAVA_HOME_OK" = "NO"; then
7544         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7545         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7546         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7547         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7548         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7549         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7550     fi
7551     PathFormat "$JAVA_HOME"
7552     JAVA_HOME="$formatted_path"
7555 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7556     "$_os" != Darwin
7557 then
7558     AC_MSG_CHECKING([for JAWT lib])
7559     if test "$_os" = WINNT; then
7560         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7561         JAWTLIB=jawt.lib
7562     else
7563         case "$host_cpu" in
7564         arm*)
7565             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7566             JAVA_ARCH=$my_java_arch
7567             ;;
7568         i*86)
7569             my_java_arch=i386
7570             ;;
7571         m68k)
7572             my_java_arch=m68k
7573             ;;
7574         powerpc)
7575             my_java_arch=ppc
7576             ;;
7577         powerpc64)
7578             my_java_arch=ppc64
7579             ;;
7580         powerpc64le)
7581             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7582             JAVA_ARCH=$my_java_arch
7583             ;;
7584         sparc64)
7585             my_java_arch=sparcv9
7586             ;;
7587         x86_64)
7588             my_java_arch=amd64
7589             ;;
7590         *)
7591             my_java_arch=$host_cpu
7592             ;;
7593         esac
7594         # This is where JDK9 puts the library
7595         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7596             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7597         else
7598             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7599         fi
7600         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7601     fi
7602     AC_MSG_RESULT([$JAWTLIB])
7604 AC_SUBST(JAWTLIB)
7606 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7607     case "$host_os" in
7609     aix*)
7610         JAVAINC="-I$JAVA_HOME/include"
7611         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7612         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7613         ;;
7615     cygwin*)
7616         JAVAINC="-I$JAVA_HOME/include/win32"
7617         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7618         ;;
7620     darwin*)
7621         if test -d "$JAVA_HOME/include/darwin"; then
7622             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7623         else
7624             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7625         fi
7626         ;;
7628     dragonfly*)
7629         JAVAINC="-I$JAVA_HOME/include"
7630         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7631         ;;
7633     freebsd*)
7634         JAVAINC="-I$JAVA_HOME/include"
7635         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7636         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7637         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7638         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7639         ;;
7641     k*bsd*-gnu*)
7642         JAVAINC="-I$JAVA_HOME/include"
7643         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7644         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7645         ;;
7647     linux-gnu*)
7648         JAVAINC="-I$JAVA_HOME/include"
7649         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7650         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7651         ;;
7653     *netbsd*)
7654         JAVAINC="-I$JAVA_HOME/include"
7655         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7656         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7657        ;;
7659     openbsd*)
7660         JAVAINC="-I$JAVA_HOME/include"
7661         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7662         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7663         ;;
7665     solaris*)
7666         JAVAINC="-I$JAVA_HOME/include"
7667         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7668         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7669         ;;
7670     esac
7672 SOLARINC="$SOLARINC $JAVAINC"
7674 AC_SUBST(JAVACOMPILER)
7675 AC_SUBST(JAVADOC)
7676 AC_SUBST(JAVAINTERPRETER)
7677 AC_SUBST(JAVAIFLAGS)
7678 AC_SUBST(JAVAFLAGS)
7679 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7680 AC_SUBST(JAVA_HOME)
7681 AC_SUBST(JAVA_SOURCE_VER)
7682 AC_SUBST(JAVA_TARGET_VER)
7683 AC_SUBST(JDK)
7686 dnl ===================================================================
7687 dnl Export file validation
7688 dnl ===================================================================
7689 AC_MSG_CHECKING([whether to enable export file validation])
7690 if test "$with_export_validation" != "no"; then
7691     if test -z "$ENABLE_JAVA"; then
7692         if test "$with_export_validation" = "yes"; then
7693             AC_MSG_ERROR([requested, but Java is disabled])
7694         else
7695             AC_MSG_RESULT([no, as Java is disabled])
7696         fi
7697     elif ! test -d "${SRC_ROOT}/schema"; then
7698         if test "$with_export_validation" = "yes"; then
7699             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7700         else
7701             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7702         fi
7703     else
7704         AC_MSG_RESULT([yes])
7705         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7707         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7708         if test -z "$ODFVALIDATOR"; then
7709             # remember to download the ODF toolkit with validator later
7710             AC_MSG_NOTICE([no odfvalidator found, will download it])
7711             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7712             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7714             # and fetch name of odfvalidator jar name from download.lst
7715             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7716             AC_SUBST(ODFVALIDATOR_JAR)
7718             if test -z "$ODFVALIDATOR_JAR"; then
7719                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7720             fi
7721         fi
7722         if test "$build_os" = "cygwin"; then
7723             # In case of Cygwin it will be executed from Windows,
7724             # so we need to run bash and absolute path to validator
7725             # so instead of "odfvalidator" it will be
7726             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7727             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7728         else
7729             ODFVALIDATOR="sh $ODFVALIDATOR"
7730         fi
7731         AC_SUBST(ODFVALIDATOR)
7734         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7735         if test -z "$OFFICEOTRON"; then
7736             # remember to download the officeotron with validator later
7737             AC_MSG_NOTICE([no officeotron found, will download it])
7738             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7739             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7741             # and fetch name of officeotron jar name from download.lst
7742             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7743             AC_SUBST(OFFICEOTRON_JAR)
7745             if test -z "$OFFICEOTRON_JAR"; then
7746                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7747             fi
7748         else
7749             # check version of existing officeotron
7750             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7751             if test 0"$OFFICEOTRON_VER" -lt 704; then
7752                 AC_MSG_ERROR([officeotron too old])
7753             fi
7754         fi
7755         if test "$build_os" = "cygwin"; then
7756             # In case of Cygwin it will be executed from Windows,
7757             # so we need to run bash and absolute path to validator
7758             # so instead of "odfvalidator" it will be
7759             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7760             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7761         else
7762             OFFICEOTRON="sh $OFFICEOTRON"
7763         fi
7764     fi
7765     AC_SUBST(OFFICEOTRON)
7766 else
7767     AC_MSG_RESULT([no])
7770 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7771 if test "$with_bffvalidator" != "no"; then
7772     AC_DEFINE(HAVE_BFFVALIDATOR)
7774     if test "$with_export_validation" = "no"; then
7775         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7776     fi
7778     if test "$with_bffvalidator" = "yes"; then
7779         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7780     else
7781         BFFVALIDATOR="$with_bffvalidator"
7782     fi
7784     if test "$build_os" = "cygwin"; then
7785         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7786             AC_MSG_RESULT($BFFVALIDATOR)
7787         else
7788             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7789         fi
7790     elif test -n "$BFFVALIDATOR"; then
7791         # We are not in Cygwin but need to run Windows binary with wine
7792         AC_PATH_PROGS(WINE, wine)
7794         # so swap in a shell wrapper that converts paths transparently
7795         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7796         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7797         AC_SUBST(BFFVALIDATOR_EXE)
7798         AC_MSG_RESULT($BFFVALIDATOR)
7799     else
7800         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7801     fi
7802     AC_SUBST(BFFVALIDATOR)
7803 else
7804     AC_MSG_RESULT([no])
7807 dnl ===================================================================
7808 dnl Check for C preprocessor to use
7809 dnl ===================================================================
7810 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7811 if test -n "$with_idlc_cpp"; then
7812     AC_MSG_RESULT([$with_idlc_cpp])
7813     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7814 else
7815     AC_MSG_RESULT([ucpp])
7816     AC_MSG_CHECKING([which ucpp tp use])
7817     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7818         AC_MSG_RESULT([external])
7819         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7820     else
7821         AC_MSG_RESULT([internal])
7822         BUILD_TYPE="$BUILD_TYPE UCPP"
7823     fi
7825 AC_SUBST(SYSTEM_UCPP)
7827 dnl ===================================================================
7828 dnl Check for epm (not needed for Windows)
7829 dnl ===================================================================
7830 AC_MSG_CHECKING([whether to enable EPM for packing])
7831 if test "$enable_epm" = "yes"; then
7832     AC_MSG_RESULT([yes])
7833     if test "$_os" != "WINNT"; then
7834         if test $_os = Darwin; then
7835             EPM=internal
7836         elif test -n "$with_epm"; then
7837             EPM=$with_epm
7838         else
7839             AC_PATH_PROG(EPM, epm, no)
7840         fi
7841         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7842             AC_MSG_NOTICE([EPM will be built.])
7843             BUILD_TYPE="$BUILD_TYPE EPM"
7844             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7845         else
7846             # Gentoo has some epm which is something different...
7847             AC_MSG_CHECKING([whether the found epm is the right epm])
7848             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7849                 AC_MSG_RESULT([yes])
7850             else
7851                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7852             fi
7853             AC_MSG_CHECKING([epm version])
7854             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7855             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7856                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7857                 AC_MSG_RESULT([OK, >= 3.7])
7858             else
7859                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7860                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7861             fi
7862         fi
7863     fi
7865     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7866         AC_MSG_CHECKING([for rpm])
7867         for a in "$RPM" rpmbuild rpm; do
7868             $a --usage >/dev/null 2> /dev/null
7869             if test $? -eq 0; then
7870                 RPM=$a
7871                 break
7872             else
7873                 $a --version >/dev/null 2> /dev/null
7874                 if test $? -eq 0; then
7875                     RPM=$a
7876                     break
7877                 fi
7878             fi
7879         done
7880         if test -z "$RPM"; then
7881             AC_MSG_ERROR([not found])
7882         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7883             RPM_PATH=`which $RPM`
7884             AC_MSG_RESULT([$RPM_PATH])
7885             SCPDEFS="$SCPDEFS -DWITH_RPM"
7886         else
7887             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7888         fi
7889     fi
7890     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7891         AC_PATH_PROG(DPKG, dpkg, no)
7892         if test "$DPKG" = "no"; then
7893             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7894         fi
7895     fi
7896     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7897        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7898         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7899             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7900                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7901                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7902                     AC_MSG_RESULT([yes])
7903                 else
7904                     AC_MSG_RESULT([no])
7905                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7906                         _pt="rpm"
7907                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7908                         add_warning "the rpms will need to be installed with --nodeps"
7909                     else
7910                         _pt="pkg"
7911                     fi
7912                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7913                     add_warning "the ${_pt}s will not be relocatable"
7914                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7915                                  relocation will work, you need to patch your epm with the
7916                                  patch in epm/epm-3.7.patch or build with
7917                                  --with-epm=internal which will build a suitable epm])
7918                 fi
7919             fi
7920         fi
7921     fi
7922     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7923         AC_PATH_PROG(PKGMK, pkgmk, no)
7924         if test "$PKGMK" = "no"; then
7925             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7926         fi
7927     fi
7928     AC_SUBST(RPM)
7929     AC_SUBST(DPKG)
7930     AC_SUBST(PKGMK)
7931 else
7932     for i in $PKGFORMAT; do
7933         case "$i" in
7934         aix | bsd | deb | pkg | rpm | native | portable)
7935             AC_MSG_ERROR(
7936                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7937             ;;
7938         esac
7939     done
7940     AC_MSG_RESULT([no])
7941     EPM=NO
7943 AC_SUBST(EPM)
7945 ENABLE_LWP=
7946 if test "$enable_lotuswordpro" = "yes"; then
7947     ENABLE_LWP="TRUE"
7949 AC_SUBST(ENABLE_LWP)
7951 dnl ===================================================================
7952 dnl Check for building ODK
7953 dnl ===================================================================
7954 if test "$enable_odk" = no; then
7955     unset DOXYGEN
7956 else
7957     if test "$with_doxygen" = no; then
7958         AC_MSG_CHECKING([for doxygen])
7959         unset DOXYGEN
7960         AC_MSG_RESULT([no])
7961     else
7962         if test "$with_doxygen" = yes; then
7963             AC_PATH_PROG([DOXYGEN], [doxygen])
7964             if test -z "$DOXYGEN"; then
7965                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7966             fi
7967             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7968                 if ! dot -V 2>/dev/null; then
7969                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7970                 fi
7971             fi
7972         else
7973             AC_MSG_CHECKING([for doxygen])
7974             DOXYGEN=$with_doxygen
7975             AC_MSG_RESULT([$DOXYGEN])
7976         fi
7977         if test -n "$DOXYGEN"; then
7978             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7979             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7980             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7981                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7982             fi
7983         fi
7984     fi
7986 AC_SUBST([DOXYGEN])
7988 AC_MSG_CHECKING([whether to build the ODK])
7989 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7990     AC_MSG_RESULT([yes])
7992     if test "$with_java" != "no"; then
7993         AC_MSG_CHECKING([whether to build unowinreg.dll])
7994         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7995             # build on Win by default
7996             enable_build_unowinreg=yes
7997         fi
7998         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7999             AC_MSG_RESULT([no])
8000             BUILD_UNOWINREG=
8001         else
8002             AC_MSG_RESULT([yes])
8003             BUILD_UNOWINREG=TRUE
8004         fi
8005         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8006             if test -z "$with_mingw_cross_compiler"; then
8007                 dnl Guess...
8008                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8009             elif test -x "$with_mingw_cross_compiler"; then
8010                  MINGWCXX="$with_mingw_cross_compiler"
8011             else
8012                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8013             fi
8015             if test "$MINGWCXX" = "false"; then
8016                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8017             fi
8019             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8020             if test -x "$mingwstrip_test"; then
8021                 MINGWSTRIP="$mingwstrip_test"
8022             else
8023                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8024             fi
8026             if test "$MINGWSTRIP" = "false"; then
8027                 AC_MSG_ERROR(MinGW32 binutils not found.)
8028             fi
8029         fi
8030     fi
8031     BUILD_TYPE="$BUILD_TYPE ODK"
8032 else
8033     AC_MSG_RESULT([no])
8034     BUILD_UNOWINREG=
8036 AC_SUBST(BUILD_UNOWINREG)
8037 AC_SUBST(MINGWCXX)
8038 AC_SUBST(MINGWSTRIP)
8040 dnl ===================================================================
8041 dnl Check for system zlib
8042 dnl ===================================================================
8043 if test "$with_system_zlib" = "auto"; then
8044     case "$_os" in
8045     WINNT)
8046         with_system_zlib="$with_system_libs"
8047         ;;
8048     *)
8049         if test "$enable_fuzzers" != "yes"; then
8050             with_system_zlib=yes
8051         else
8052             with_system_zlib=no
8053         fi
8054         ;;
8055     esac
8058 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8059 dnl and has no pkg-config for it at least on some tinderboxes,
8060 dnl so leaving that out for now
8061 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8062 AC_MSG_CHECKING([which zlib to use])
8063 if test "$with_system_zlib" = "yes"; then
8064     AC_MSG_RESULT([external])
8065     SYSTEM_ZLIB=TRUE
8066     AC_CHECK_HEADER(zlib.h, [],
8067         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8068     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8069         [AC_MSG_ERROR(zlib not found or functional)], [])
8070 else
8071     AC_MSG_RESULT([internal])
8072     SYSTEM_ZLIB=
8073     BUILD_TYPE="$BUILD_TYPE ZLIB"
8074     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8075     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8077 AC_SUBST(ZLIB_CFLAGS)
8078 AC_SUBST(ZLIB_LIBS)
8079 AC_SUBST(SYSTEM_ZLIB)
8081 dnl ===================================================================
8082 dnl Check for system jpeg
8083 dnl ===================================================================
8084 AC_MSG_CHECKING([which libjpeg to use])
8085 if test "$with_system_jpeg" = "yes"; then
8086     AC_MSG_RESULT([external])
8087     SYSTEM_LIBJPEG=TRUE
8088     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8089         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8090     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8091         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8092 else
8093     SYSTEM_LIBJPEG=
8094     AC_MSG_RESULT([internal, libjpeg-turbo])
8095     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8096     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8097     if test "$COM" = "MSC"; then
8098         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8099     else
8100         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8101     fi
8103     case "$host_cpu" in
8104     x86_64 | amd64 | i*86 | x86 | ia32)
8105         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8106         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8107             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8108                 NASM="$LODE_HOME/opt/bin/nasm"
8109             elif test -x "/opt/lo/bin/nasm"; then
8110                 NASM="/opt/lo/bin/nasm"
8111             fi
8112         fi
8114         if test -n "$NASM"; then
8115             AC_MSG_CHECKING([for object file format of host system])
8116             case "$host_os" in
8117               cygwin* | mingw* | pw32* | interix*)
8118                 case "$host_cpu" in
8119                   x86_64)
8120                     objfmt='Win64-COFF'
8121                     ;;
8122                   *)
8123                     objfmt='Win32-COFF'
8124                     ;;
8125                 esac
8126               ;;
8127               msdosdjgpp* | go32*)
8128                 objfmt='COFF'
8129               ;;
8130               os2-emx*) # not tested
8131                 objfmt='MSOMF' # obj
8132               ;;
8133               linux*coff* | linux*oldld*)
8134                 objfmt='COFF' # ???
8135               ;;
8136               linux*aout*)
8137                 objfmt='a.out'
8138               ;;
8139               linux*)
8140                 case "$host_cpu" in
8141                   x86_64)
8142                     objfmt='ELF64'
8143                     ;;
8144                   *)
8145                     objfmt='ELF'
8146                     ;;
8147                 esac
8148               ;;
8149               kfreebsd* | freebsd* | netbsd* | openbsd*)
8150                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8151                   objfmt='BSD-a.out'
8152                 else
8153                   case "$host_cpu" in
8154                     x86_64 | amd64)
8155                       objfmt='ELF64'
8156                       ;;
8157                     *)
8158                       objfmt='ELF'
8159                       ;;
8160                   esac
8161                 fi
8162               ;;
8163               solaris* | sunos* | sysv* | sco*)
8164                 case "$host_cpu" in
8165                   x86_64)
8166                     objfmt='ELF64'
8167                     ;;
8168                   *)
8169                     objfmt='ELF'
8170                     ;;
8171                 esac
8172               ;;
8173               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8174                 case "$host_cpu" in
8175                   x86_64)
8176                     objfmt='Mach-O64'
8177                     ;;
8178                   *)
8179                     objfmt='Mach-O'
8180                     ;;
8181                 esac
8182               ;;
8183               *)
8184                 objfmt='ELF ?'
8185               ;;
8186             esac
8188             AC_MSG_RESULT([$objfmt])
8189             if test "$objfmt" = 'ELF ?'; then
8190               objfmt='ELF'
8191               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8192             fi
8194             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8195             case "$objfmt" in
8196               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8197               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8198               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8199               COFF)       NAFLAGS='-fcoff -DCOFF';;
8200               a.out)      NAFLAGS='-faout -DAOUT';;
8201               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8202               ELF)        NAFLAGS='-felf -DELF';;
8203               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8204               RDF)        NAFLAGS='-frdf -DRDF';;
8205               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8206               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8207             esac
8208             AC_MSG_RESULT([$NAFLAGS])
8210             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8211             cat > conftest.asm << EOF
8212             [%line __oline__ "configure"
8213                     section .text
8214                     global  _main,main
8215             _main:
8216             main:   xor     eax,eax
8217                     ret
8218             ]
8220             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8221             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8222               AC_MSG_RESULT(yes)
8223             else
8224               echo "configure: failed program was:" >&AC_FD_CC
8225               cat conftest.asm >&AC_FD_CC
8226               rm -rf conftest*
8227               AC_MSG_RESULT(no)
8228               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8229               NASM=""
8230             fi
8232         fi
8234         if test -z "$NASM"; then
8235 cat << _EOS
8236 ****************************************************************************
8237 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8238 To get one please:
8240 _EOS
8241             if test "$build_os" = "cygwin"; then
8242 cat << _EOS
8243 install a pre-compiled binary for Win32
8245 mkdir -p /opt/lo/bin
8246 cd /opt/lo/bin
8247 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8248 chmod +x nasm
8250 or get and install one from http://www.nasm.us/
8252 Then re-run autogen.sh
8254 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8255 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8257 _EOS
8258             else
8259 cat << _EOS
8260 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8262 _EOS
8263             fi
8264             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8265             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8266         fi
8267       ;;
8268     esac
8271 AC_SUBST(NASM)
8272 AC_SUBST(LIBJPEG_CFLAGS)
8273 AC_SUBST(LIBJPEG_LIBS)
8274 AC_SUBST(SYSTEM_LIBJPEG)
8276 dnl ===================================================================
8277 dnl Check for system clucene
8278 dnl ===================================================================
8279 dnl we should rather be using
8280 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8281 dnl but the contribs-lib check seems tricky
8282 AC_MSG_CHECKING([which clucene to use])
8283 if test "$with_system_clucene" = "yes"; then
8284     AC_MSG_RESULT([external])
8285     SYSTEM_CLUCENE=TRUE
8286     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8287     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8288     FilterLibs "${CLUCENE_LIBS}"
8289     CLUCENE_LIBS="${filteredlibs}"
8290     AC_LANG_PUSH([C++])
8291     save_CXXFLAGS=$CXXFLAGS
8292     save_CPPFLAGS=$CPPFLAGS
8293     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8294     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8295     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8296     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8297     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8298                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8299     CXXFLAGS=$save_CXXFLAGS
8300     CPPFLAGS=$save_CPPFLAGS
8301     AC_LANG_POP([C++])
8303     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8304 else
8305     AC_MSG_RESULT([internal])
8306     SYSTEM_CLUCENE=
8307     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8309 AC_SUBST(SYSTEM_CLUCENE)
8310 AC_SUBST(CLUCENE_CFLAGS)
8311 AC_SUBST(CLUCENE_LIBS)
8313 dnl ===================================================================
8314 dnl Check for system expat
8315 dnl ===================================================================
8316 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8318 dnl ===================================================================
8319 dnl Check for system xmlsec
8320 dnl ===================================================================
8321 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8323 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8324 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8325     ENABLE_EOT="TRUE"
8326     AC_DEFINE([ENABLE_EOT])
8327     AC_MSG_RESULT([yes])
8329     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8330 else
8331     ENABLE_EOT=
8332     AC_MSG_RESULT([no])
8334 AC_SUBST([ENABLE_EOT])
8336 dnl ===================================================================
8337 dnl Check for DLP libs
8338 dnl ===================================================================
8339 AS_IF([test "$COM" = "MSC"],
8340       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8341       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8343 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8345 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8347 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8349 AS_IF([test "$COM" = "MSC"],
8350       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8351       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8353 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8355 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8357 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8358 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8360 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8362 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8364 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8366 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8367 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8369 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8370 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8372 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8374 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8375 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8377 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8379 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8381 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8383 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8385 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8386 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8388 dnl ===================================================================
8389 dnl Check for system lcms2
8390 dnl ===================================================================
8391 if test "$with_system_lcms2" != "yes"; then
8392     SYSTEM_LCMS2=
8394 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8395 if test "$GCC" = "yes"; then
8396     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8398 if test "$COM" = "MSC"; then # override the above
8399     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8402 dnl ===================================================================
8403 dnl Check for system cppunit
8404 dnl ===================================================================
8405 if test "$_os" != "Android" ; then
8406     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8409 dnl ===================================================================
8410 dnl Check whether freetype is available
8411 dnl ===================================================================
8412 if test  "$test_freetype" = "yes"; then
8413     AC_MSG_CHECKING([whether freetype is available])
8414     # FreeType has 3 different kinds of versions
8415     # * release, like 2.4.10
8416     # * libtool, like 13.0.7 (this what pkg-config returns)
8417     # * soname
8418     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8419     #
8420     # 9.9.3 is 2.2.0
8421     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8422     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8423     FilterLibs "${FREETYPE_LIBS}"
8424     FREETYPE_LIBS="${filteredlibs}"
8425     SYSTEM_FREETYPE=TRUE
8426 else
8427     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8428     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8430 AC_SUBST(FREETYPE_CFLAGS)
8431 AC_SUBST(FREETYPE_LIBS)
8432 AC_SUBST([SYSTEM_FREETYPE])
8434 # ===================================================================
8435 # Check for system libxslt
8436 # to prevent incompatibilities between internal libxml2 and external libxslt,
8437 # or vice versa, use with_system_libxml here
8438 # ===================================================================
8439 if test "$with_system_libxml" = "auto"; then
8440     case "$_os" in
8441     WINNT|iOS|Android)
8442         with_system_libxml="$with_system_libs"
8443         ;;
8444     *)
8445         if test "$enable_fuzzers" != "yes"; then
8446             with_system_libxml=yes
8447         else
8448             with_system_libxml=no
8449         fi
8450         ;;
8451     esac
8454 AC_MSG_CHECKING([which libxslt to use])
8455 if test "$with_system_libxml" = "yes"; then
8456     AC_MSG_RESULT([external])
8457     SYSTEM_LIBXSLT=TRUE
8458     if test "$_os" = "Darwin"; then
8459         dnl make sure to use SDK path
8460         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8461         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8462         dnl omit -L/usr/lib
8463         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8464         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8465     else
8466         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8467         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8468         FilterLibs "${LIBXSLT_LIBS}"
8469         LIBXSLT_LIBS="${filteredlibs}"
8470         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8471         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8472         FilterLibs "${LIBEXSLT_LIBS}"
8473         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8474     fi
8476     dnl Check for xsltproc
8477     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8478     if test "$XSLTPROC" = "no"; then
8479         AC_MSG_ERROR([xsltproc is required])
8480     fi
8481 else
8482     AC_MSG_RESULT([internal])
8483     SYSTEM_LIBXSLT=
8484     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8486     if test "$cross_compiling" = "yes"; then
8487         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8488         if test "$XSLTPROC" = "no"; then
8489             AC_MSG_ERROR([xsltproc is required])
8490         fi
8491     fi
8493 AC_SUBST(SYSTEM_LIBXSLT)
8494 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8495     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8497 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8499 AC_SUBST(LIBEXSLT_CFLAGS)
8500 AC_SUBST(LIBEXSLT_LIBS)
8501 AC_SUBST(LIBXSLT_CFLAGS)
8502 AC_SUBST(LIBXSLT_LIBS)
8503 AC_SUBST(XSLTPROC)
8505 # ===================================================================
8506 # Check for system libxml
8507 # ===================================================================
8508 AC_MSG_CHECKING([which libxml to use])
8509 if test "$with_system_libxml" = "yes"; then
8510     AC_MSG_RESULT([external])
8511     SYSTEM_LIBXML=TRUE
8512     if test "$_os" = "Darwin"; then
8513         dnl make sure to use SDK path
8514         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8515         dnl omit -L/usr/lib
8516         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8517     elif test $_os = iOS; then
8518         dnl make sure to use SDK path
8519         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8520         LIBXML_CFLAGS="-I$usr/include/libxml2"
8521         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8522     else
8523         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8524         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8525         FilterLibs "${LIBXML_LIBS}"
8526         LIBXML_LIBS="${filteredlibs}"
8527     fi
8529     dnl Check for xmllint
8530     AC_PATH_PROG(XMLLINT, xmllint, no)
8531     if test "$XMLLINT" = "no"; then
8532         AC_MSG_ERROR([xmllint is required])
8533     fi
8534 else
8535     AC_MSG_RESULT([internal])
8536     SYSTEM_LIBXML=
8537     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8538     if test "$COM" = "MSC"; then
8539         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8540     fi
8541     if test "$COM" = "MSC"; then
8542         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8543     else
8544         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8545     fi
8546     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8548 AC_SUBST(SYSTEM_LIBXML)
8549 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8550     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8552 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8553 AC_SUBST(LIBXML_CFLAGS)
8554 AC_SUBST(LIBXML_LIBS)
8555 AC_SUBST(XMLLINT)
8557 # =====================================================================
8558 # Checking for a Python interpreter with version >= 2.7.
8559 # Build and runtime requires Python 3 compatible version (>= 2.7).
8560 # Optionally user can pass an option to configure, i. e.
8561 # ./configure PYTHON=/usr/bin/python
8562 # =====================================================================
8563 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8564     if test -n "$PYTHON"; then
8565         PYTHON_FOR_BUILD=$PYTHON
8566     else
8567         # This allows a lack of system python with no error, we use internal one in that case.
8568         AM_PATH_PYTHON([2.7],, [:])
8569         # Clean PYTHON_VERSION checked below if cross-compiling
8570         PYTHON_VERSION=""
8571         if test "$PYTHON" != ":"; then
8572             PYTHON_FOR_BUILD=$PYTHON
8573         fi
8574     fi
8576 AC_SUBST(PYTHON_FOR_BUILD)
8578 # Checks for Python to use for Pyuno
8579 AC_MSG_CHECKING([which Python to use for Pyuno])
8580 case "$enable_python" in
8581 no|disable)
8582     if test -z $PYTHON_FOR_BUILD; then
8583         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8584         # requirement from the choice whether to include Python stuff in the installer, but why
8585         # bother?
8586         AC_MSG_ERROR([Python is required at build time.])
8587     fi
8588     enable_python=no
8589     AC_MSG_RESULT([none])
8590     ;;
8591 ""|yes|auto)
8592     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8593         AC_MSG_RESULT([no, overridden by --disable-scripting])
8594         enable_python=no
8595     elif test $build_os = cygwin; then
8596         dnl When building on Windows we don't attempt to use any installed
8597         dnl "system"  Python.
8598         AC_MSG_RESULT([fully internal])
8599         enable_python=internal
8600     elif test "$cross_compiling" = yes; then
8601         AC_MSG_RESULT([system])
8602         enable_python=system
8603     else
8604         # Unset variables set by the above AM_PATH_PYTHON so that
8605         # we actually do check anew.
8606         AC_MSG_RESULT([])
8607         unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON am_cv_python_version am_cv_python_platform am_cv_python_pythondir am_cv_python_pyexecdir
8608         AM_PATH_PYTHON([3.3],, [:])
8609         AC_MSG_CHECKING([which Python to use for Pyuno])
8610         if test "$PYTHON" = ":"; then
8611             if test -z "$PYTHON_FOR_BUILD"; then
8612                 AC_MSG_RESULT([fully internal])
8613             else
8614                 AC_MSG_RESULT([internal])
8615             fi
8616             enable_python=internal
8617         else
8618             AC_MSG_RESULT([system])
8619             enable_python=system
8620         fi
8621     fi
8622     ;;
8623 internal)
8624     AC_MSG_RESULT([internal])
8625     ;;
8626 fully-internal)
8627     AC_MSG_RESULT([fully internal])
8628     enable_python=internal
8629     ;;
8630 system)
8631     AC_MSG_RESULT([system])
8632     if test "$_os" = Darwin; then
8633         AC_MSG_ERROR([--enable-python=system doesn't work on macOS: /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h is known to contain uses of "register", which is removed from C++17])
8634     fi
8635     ;;
8637     AC_MSG_ERROR([Incorrect --enable-python option])
8638     ;;
8639 esac
8641 if test $enable_python != no; then
8642     BUILD_TYPE="$BUILD_TYPE PYUNO"
8645 if test $enable_python = system; then
8646     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8647         # Fallback: Accept these in the environment, or as set above
8648         # for MacOSX.
8649         :
8650     elif test "$cross_compiling" != yes; then
8651         # Unset variables set by the above AM_PATH_PYTHON so that
8652         # we actually do check anew.
8653         unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON am_cv_python_version am_cv_python_platform am_cv_python_pythondir am_cv_python_pyexecdir
8654         # This causes an error if no python command is found
8655         AM_PATH_PYTHON([3.3])
8656         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8657         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8658         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8659         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8660         if test -z "$PKG_CONFIG"; then
8661             PYTHON_CFLAGS="-I$python_include"
8662             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8663         elif $PKG_CONFIG --exists python-$python_version-embed; then
8664             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8665             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8666         elif $PKG_CONFIG --exists python-$python_version; then
8667             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8668             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8669         else
8670             PYTHON_CFLAGS="-I$python_include"
8671             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8672         fi
8673         FilterLibs "${PYTHON_LIBS}"
8674         PYTHON_LIBS="${filteredlibs}"
8675     else
8676         dnl How to find out the cross-compilation Python installation path?
8677         AC_MSG_CHECKING([for python version])
8678         AS_IF([test -n "$PYTHON_VERSION"],
8679               [AC_MSG_RESULT([$PYTHON_VERSION])],
8680               [AC_MSG_RESULT([not found])
8681                AC_MSG_ERROR([no usable python found])])
8682         test -n "$PYTHON_CFLAGS" && break
8683     fi
8685     dnl Check if the headers really work
8686     save_CPPFLAGS="$CPPFLAGS"
8687     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8688     AC_CHECK_HEADER(Python.h)
8689     CPPFLAGS="$save_CPPFLAGS"
8691     # let the PYTHON_FOR_BUILD match the same python installation that
8692     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8693     # better for PythonTests.
8694     PYTHON_FOR_BUILD=$PYTHON
8697 if test "$with_lxml" != no; then
8698     if test -z "$PYTHON_FOR_BUILD"; then
8699         case $build_os in
8700             cygwin)
8701                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8702                 ;;
8703             *)
8704                 if test "$cross_compiling" != yes ; then
8705                     BUILD_TYPE="$BUILD_TYPE LXML"
8706                 fi
8707                 ;;
8708         esac
8709     else
8710         AC_MSG_CHECKING([for python lxml])
8711         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8712             AC_MSG_RESULT([yes])
8713         else
8714             case $build_os in
8715                 cygwin)
8716                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8717                     ;;
8718                 *)
8719                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8720                         BUILD_TYPE="$BUILD_TYPE LXML"
8721                         AC_MSG_RESULT([no, using internal lxml])
8722                     else
8723                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8724                     fi
8725                     ;;
8726             esac
8727         fi
8728     fi
8731 dnl By now enable_python should be "system", "internal" or "no"
8732 case $enable_python in
8733 system)
8734     SYSTEM_PYTHON=TRUE
8736     if test "x$ac_cv_header_Python_h" != "xyes"; then
8737        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8738     fi
8740     AC_LANG_PUSH(C)
8741     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8742     AC_MSG_CHECKING([for correct python library version])
8743        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8744 #include <Python.h>
8746 int main(int argc, char **argv) {
8747    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8748        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8749    else return 1;
8751        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.7 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8752     CFLAGS=$save_CFLAGS
8753     AC_LANG_POP(C)
8755     dnl FIXME Check if the Python library can be linked with, too?
8756     ;;
8758 internal)
8759     SYSTEM_PYTHON=
8760     PYTHON_VERSION_MAJOR=3
8761     PYTHON_VERSION_MINOR=7
8762     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.6
8763     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8764         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8765     fi
8766     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8767     BUILD_TYPE="$BUILD_TYPE PYTHON"
8768     if test "$OS" = LINUX; then
8769         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8770     fi
8771     # Embedded Python dies without Home set
8772     if test "$HOME" = ""; then
8773         export HOME=""
8774     fi
8775     ;;
8777     DISABLE_PYTHON=TRUE
8778     SYSTEM_PYTHON=
8779     ;;
8781     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8782     ;;
8783 esac
8785 AC_SUBST(DISABLE_PYTHON)
8786 AC_SUBST(SYSTEM_PYTHON)
8787 AC_SUBST(PYTHON_CFLAGS)
8788 AC_SUBST(PYTHON_LIBS)
8789 AC_SUBST(PYTHON_VERSION)
8790 AC_SUBST(PYTHON_VERSION_MAJOR)
8791 AC_SUBST(PYTHON_VERSION_MINOR)
8793 ENABLE_MARIADBC=TRUE
8794 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8795     ENABLE_MARIADBC=
8797 MARIADBC_MAJOR=1
8798 MARIADBC_MINOR=0
8799 MARIADBC_MICRO=2
8800 if test "$ENABLE_MARIADBC" = "TRUE"; then
8801     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8804 AC_SUBST(ENABLE_MARIADBC)
8805 AC_SUBST(MARIADBC_MAJOR)
8806 AC_SUBST(MARIADBC_MINOR)
8807 AC_SUBST(MARIADBC_MICRO)
8809 if test "$ENABLE_MARIADBC" = "TRUE"; then
8810     dnl ===================================================================
8811     dnl Check for system MariaDB
8812     dnl ===================================================================
8813     AC_MSG_CHECKING([which MariaDB to use])
8814     if test "$with_system_mariadb" = "yes"; then
8815         AC_MSG_RESULT([external])
8816         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8817         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8818         if test -z "$MARIADBCONFIG"; then
8819             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8820             if test -z "$MARIADBCONFIG"; then
8821                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8822                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8823             fi
8824         fi
8825         AC_MSG_CHECKING([MariaDB version])
8826         MARIADB_VERSION=`$MARIADBCONFIG --version`
8827         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8828         if test "$MARIADB_MAJOR" -ge "5"; then
8829             AC_MSG_RESULT([OK])
8830         else
8831             AC_MSG_ERROR([too old, use 5.0.x or later])
8832         fi
8833         AC_MSG_CHECKING([for MariaDB Client library])
8834         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8835         if test "$COM_IS_CLANG" = TRUE; then
8836             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8837         fi
8838         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8839         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8840         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8841         dnl linux32:
8842         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8843             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8844             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8845                 | sed -e 's|/lib64/|/lib/|')
8846         fi
8847         FilterLibs "${MARIADB_LIBS}"
8848         MARIADB_LIBS="${filteredlibs}"
8849         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8850         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8851         if test "$enable_bundle_mariadb" = "yes"; then
8852             AC_MSG_RESULT([yes])
8853             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8854             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8856 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8858 /g' | grep -E '(mysqlclient|mariadb)')
8859             if test "$_os" = "Darwin"; then
8860                 LIBMARIADB=${LIBMARIADB}.dylib
8861             elif test "$_os" = "WINNT"; then
8862                 LIBMARIADB=${LIBMARIADB}.dll
8863             else
8864                 LIBMARIADB=${LIBMARIADB}.so
8865             fi
8866             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8867             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8868             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8869                 AC_MSG_RESULT([found.])
8870                 PathFormat "$LIBMARIADB_PATH"
8871                 LIBMARIADB_PATH="$formatted_path"
8872             else
8873                 AC_MSG_ERROR([not found.])
8874             fi
8875         else
8876             AC_MSG_RESULT([no])
8877             BUNDLE_MARIADB_CONNECTOR_C=
8878         fi
8879     else
8880         AC_MSG_RESULT([internal])
8881         SYSTEM_MARIADB_CONNECTOR_C=
8882         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8883         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8884         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8885     fi
8887     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8888     AC_SUBST(MARIADB_CFLAGS)
8889     AC_SUBST(MARIADB_LIBS)
8890     AC_SUBST(LIBMARIADB)
8891     AC_SUBST(LIBMARIADB_PATH)
8892     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8895 dnl ===================================================================
8896 dnl Check for system hsqldb
8897 dnl ===================================================================
8898 if test "$with_java" != "no"; then
8899     HSQLDB_USE_JDBC_4_1=
8900     AC_MSG_CHECKING([which hsqldb to use])
8901     if test "$with_system_hsqldb" = "yes"; then
8902         AC_MSG_RESULT([external])
8903         SYSTEM_HSQLDB=TRUE
8904         if test -z $HSQLDB_JAR; then
8905             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8906         fi
8907         if ! test -f $HSQLDB_JAR; then
8908                AC_MSG_ERROR(hsqldb.jar not found.)
8909         fi
8910         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8911         export HSQLDB_JAR
8912         if $PERL -e \
8913            'use Archive::Zip;
8914             my $file = "$ENV{'HSQLDB_JAR'}";
8915             my $zip = Archive::Zip->new( $file );
8916             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8917             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8918             {
8919                 push @l, split(/\n/, $mf);
8920                 foreach my $line (@l)
8921                 {
8922                     if ($line =~ m/Specification-Version:/)
8923                     {
8924                         ($t, $version) = split (/:/,$line);
8925                         $version =~ s/^\s//;
8926                         ($a, $b, $c, $d) = split (/\./,$version);
8927                         if ($c == "0" && $d > "8")
8928                         {
8929                             exit 0;
8930                         }
8931                         else
8932                         {
8933                             exit 1;
8934                         }
8935                     }
8936                 }
8937             }
8938             else
8939             {
8940                 exit 1;
8941             }'; then
8942             AC_MSG_RESULT([yes])
8943         else
8944             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8945         fi
8946     else
8947         AC_MSG_RESULT([internal])
8948         SYSTEM_HSQLDB=
8949         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8950         NEED_ANT=TRUE
8951         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8952         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8953         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8954             AC_MSG_RESULT([yes])
8955             HSQLDB_USE_JDBC_4_1=TRUE
8956         else
8957             AC_MSG_RESULT([no])
8958         fi
8959     fi
8960     AC_SUBST(SYSTEM_HSQLDB)
8961     AC_SUBST(HSQLDB_JAR)
8962     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8965 dnl ===================================================================
8966 dnl Check for PostgreSQL stuff
8967 dnl ===================================================================
8968 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8969 if test "x$enable_postgresql_sdbc" != "xno"; then
8970     AC_MSG_RESULT([yes])
8971     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8973     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8974         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8975     fi
8976     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8977         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8978     fi
8980     postgres_interface=""
8981     if test "$with_system_postgresql" = "yes"; then
8982         postgres_interface="external PostgreSQL"
8983         SYSTEM_POSTGRESQL=TRUE
8984         if test "$_os" = Darwin; then
8985             supp_path=''
8986             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8987                 pg_supp_path="$P_SEP$d$pg_supp_path"
8988             done
8989         fi
8990         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8991         if test -n "$PGCONFIG"; then
8992             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8993             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8994         else
8995             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
8996               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
8997               POSTGRESQL_LIB=$POSTGRESQL_LIBS
8998             ],[
8999               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9000             ])
9001         fi
9002         FilterLibs "${POSTGRESQL_LIB}"
9003         POSTGRESQL_LIB="${filteredlibs}"
9004     else
9005         # if/when anything else than PostgreSQL uses Kerberos,
9006         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9007         WITH_KRB5=
9008         WITH_GSSAPI=
9009         case "$_os" in
9010         Darwin)
9011             # macOS has system MIT Kerberos 5 since 10.4
9012             if test "$with_krb5" != "no"; then
9013                 WITH_KRB5=TRUE
9014                 save_LIBS=$LIBS
9015                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9016                 # that the libraries where these functions are located on macOS will change, is it?
9017                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9018                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9019                 KRB5_LIBS=$LIBS
9020                 LIBS=$save_LIBS
9021                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9022                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9023                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9024                 LIBS=$save_LIBS
9025             fi
9026             if test "$with_gssapi" != "no"; then
9027                 WITH_GSSAPI=TRUE
9028                 save_LIBS=$LIBS
9029                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9030                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9031                 GSSAPI_LIBS=$LIBS
9032                 LIBS=$save_LIBS
9033             fi
9034             ;;
9035         WINNT)
9036             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9037                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9038             fi
9039             ;;
9040         Linux|GNU|*BSD|DragonFly)
9041             if test "$with_krb5" != "no"; then
9042                 WITH_KRB5=TRUE
9043                 save_LIBS=$LIBS
9044                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9045                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9046                 KRB5_LIBS=$LIBS
9047                 LIBS=$save_LIBS
9048                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9049                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9050                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9051                 LIBS=$save_LIBS
9052             fi
9053             if test "$with_gssapi" != "no"; then
9054                 WITH_GSSAPI=TRUE
9055                 save_LIBS=$LIBS
9056                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9057                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9058                 GSSAPI_LIBS=$LIBS
9059                 LIBS=$save_LIBS
9060             fi
9061             ;;
9062         *)
9063             if test "$with_krb5" = "yes"; then
9064                 WITH_KRB5=TRUE
9065                 save_LIBS=$LIBS
9066                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9067                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9068                 KRB5_LIBS=$LIBS
9069                 LIBS=$save_LIBS
9070                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9071                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9072                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9073                 LIBS=$save_LIBS
9074             fi
9075             if test "$with_gssapi" = "yes"; then
9076                 WITH_GSSAPI=TRUE
9077                 save_LIBS=$LIBS
9078                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9079                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9080                 LIBS=$save_LIBS
9081                 GSSAPI_LIBS=$LIBS
9082             fi
9083         esac
9085         if test -n "$with_libpq_path"; then
9086             SYSTEM_POSTGRESQL=TRUE
9087             postgres_interface="external libpq"
9088             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9089             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9090         else
9091             SYSTEM_POSTGRESQL=
9092             postgres_interface="internal"
9093             POSTGRESQL_LIB=""
9094             POSTGRESQL_INC="%OVERRIDE_ME%"
9095             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9096         fi
9097     fi
9099     AC_MSG_CHECKING([PostgreSQL C interface])
9100     AC_MSG_RESULT([$postgres_interface])
9102     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9103         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9104         save_CFLAGS=$CFLAGS
9105         save_CPPFLAGS=$CPPFLAGS
9106         save_LIBS=$LIBS
9107         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9108         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9109         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9110         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9111             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9112         CFLAGS=$save_CFLAGS
9113         CPPFLAGS=$save_CPPFLAGS
9114         LIBS=$save_LIBS
9115     fi
9116     BUILD_POSTGRESQL_SDBC=TRUE
9117 else
9118     AC_MSG_RESULT([no])
9120 AC_SUBST(WITH_KRB5)
9121 AC_SUBST(WITH_GSSAPI)
9122 AC_SUBST(GSSAPI_LIBS)
9123 AC_SUBST(KRB5_LIBS)
9124 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9125 AC_SUBST(SYSTEM_POSTGRESQL)
9126 AC_SUBST(POSTGRESQL_INC)
9127 AC_SUBST(POSTGRESQL_LIB)
9129 dnl ===================================================================
9130 dnl Check for Firebird stuff
9131 dnl ===================================================================
9132 ENABLE_FIREBIRD_SDBC=
9133 if test "$enable_firebird_sdbc" = "yes" ; then
9134     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9136     dnl ===================================================================
9137     dnl Check for system Firebird
9138     dnl ===================================================================
9139     AC_MSG_CHECKING([which Firebird to use])
9140     if test "$with_system_firebird" = "yes"; then
9141         AC_MSG_RESULT([external])
9142         SYSTEM_FIREBIRD=TRUE
9143         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9144         if test -z "$FIREBIRDCONFIG"; then
9145             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9146             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9147                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9148             ])
9149             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9150         else
9151             AC_MSG_NOTICE([fb_config found])
9152             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9153             AC_MSG_CHECKING([for Firebird Client library])
9154             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9155             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9156             FilterLibs "${FIREBIRD_LIBS}"
9157             FIREBIRD_LIBS="${filteredlibs}"
9158         fi
9159         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9160         AC_MSG_CHECKING([Firebird version])
9161         if test -n "${FIREBIRD_VERSION}"; then
9162             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9163             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9164             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9165                 AC_MSG_RESULT([OK])
9166             else
9167                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9168             fi
9169         else
9170             __save_CFLAGS="${CFLAGS}"
9171             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9172             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9173 #if defined(FB_API_VER) && FB_API_VER == 30
9174 int fb_api_is_30(void) { return 0; }
9175 #else
9176 #error "Wrong Firebird API version"
9177 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9178             CFLAGS="${__save_CFLAGS}"
9179         fi
9180         ENABLE_FIREBIRD_SDBC=TRUE
9181         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9182     elif test "$enable_database_connectivity" != yes; then
9183         AC_MSG_RESULT([none])
9184     elif test "$cross_compiling" = "yes"; then
9185         AC_MSG_RESULT([none])
9186     else
9187         dnl Embedded Firebird has version 3.0
9188         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9189         dnl We need libatomic_ops for any non X86/X64 system
9190         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9191             dnl ===================================================================
9192             dnl Check for system libatomic_ops
9193             dnl ===================================================================
9194             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9195             if test "$with_system_libatomic_ops" = "yes"; then
9196                 SYSTEM_LIBATOMIC_OPS=TRUE
9197                 AC_CHECK_HEADERS(atomic_ops.h, [],
9198                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9199             else
9200                 SYSTEM_LIBATOMIC_OPS=
9201                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9202                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9203                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9204             fi
9205         fi
9207         AC_MSG_RESULT([internal])
9208         SYSTEM_FIREBIRD=
9209         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9210         FIREBIRD_LIBS="-lfbclient"
9212         if test "$with_system_libtommath" = "yes"; then
9213             SYSTEM_LIBTOMMATH=TRUE
9214             dnl check for tommath presence
9215             save_LIBS=$LIBS
9216             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9217             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9218             LIBS=$save_LIBS
9219         else
9220             SYSTEM_LIBTOMMATH=
9221             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9222             LIBTOMMATH_LIBS="-ltommath"
9223             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9224         fi
9226         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9227         ENABLE_FIREBIRD_SDBC=TRUE
9228         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9229     fi
9231 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9232 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9233 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9234 AC_SUBST(LIBATOMIC_OPS_LIBS)
9235 AC_SUBST(SYSTEM_FIREBIRD)
9236 AC_SUBST(FIREBIRD_CFLAGS)
9237 AC_SUBST(FIREBIRD_LIBS)
9238 AC_SUBST([TOMMATH_CFLAGS])
9239 AC_SUBST([TOMMATH_LIBS])
9241 dnl ===================================================================
9242 dnl Check for system curl
9243 dnl ===================================================================
9244 AC_MSG_CHECKING([which libcurl to use])
9245 if test "$with_system_curl" = "auto"; then
9246     with_system_curl="$with_system_libs"
9249 if test "$with_system_curl" = "yes"; then
9250     AC_MSG_RESULT([external])
9251     SYSTEM_CURL=TRUE
9253     # First try PKGCONFIG and then fall back
9254     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9256     if test -n "$CURL_PKG_ERRORS"; then
9257         AC_PATH_PROG(CURLCONFIG, curl-config)
9258         if test -z "$CURLCONFIG"; then
9259             AC_MSG_ERROR([curl development files not found])
9260         fi
9261         CURL_LIBS=`$CURLCONFIG --libs`
9262         FilterLibs "${CURL_LIBS}"
9263         CURL_LIBS="${filteredlibs}"
9264         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9265         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9267         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9268         case $curl_version in
9269         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9270         dnl so they need to be doubled to end up in the configure script
9271         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9272             AC_MSG_RESULT([yes])
9273             ;;
9274         *)
9275             AC_MSG_ERROR([no, you have $curl_version])
9276             ;;
9277         esac
9278     fi
9280     ENABLE_CURL=TRUE
9281 elif test $_os = iOS; then
9282     # Let's see if we need curl, I think not?
9283     AC_MSG_RESULT([none])
9284     ENABLE_CURL=
9285 else
9286     AC_MSG_RESULT([internal])
9287     SYSTEM_CURL=
9288     BUILD_TYPE="$BUILD_TYPE CURL"
9289     ENABLE_CURL=TRUE
9291 AC_SUBST(SYSTEM_CURL)
9292 AC_SUBST(CURL_CFLAGS)
9293 AC_SUBST(CURL_LIBS)
9294 AC_SUBST(ENABLE_CURL)
9296 dnl ===================================================================
9297 dnl Check for system boost
9298 dnl ===================================================================
9299 AC_MSG_CHECKING([which boost to use])
9300 if test "$with_system_boost" = "yes"; then
9301     AC_MSG_RESULT([external])
9302     SYSTEM_BOOST=TRUE
9303     AX_BOOST_BASE(1.47)
9304     AX_BOOST_DATE_TIME
9305     AX_BOOST_FILESYSTEM
9306     AX_BOOST_IOSTREAMS
9307     AX_BOOST_LOCALE
9308     AC_LANG_PUSH([C++])
9309     save_CXXFLAGS=$CXXFLAGS
9310     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9311     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9312        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9313     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9314        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9315     CXXFLAGS=$save_CXXFLAGS
9316     AC_LANG_POP([C++])
9317     # this is in m4/ax_boost_base.m4
9318     FilterLibs "${BOOST_LDFLAGS}"
9319     BOOST_LDFLAGS="${filteredlibs}"
9320 else
9321     AC_MSG_RESULT([internal])
9322     BUILD_TYPE="$BUILD_TYPE BOOST"
9323     SYSTEM_BOOST=
9324     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9325         # use warning-suppressing wrapper headers
9326         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9327     else
9328         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9329     fi
9331 AC_SUBST(SYSTEM_BOOST)
9333 dnl ===================================================================
9334 dnl Check for system mdds
9335 dnl ===================================================================
9336 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9338 dnl ===================================================================
9339 dnl Check for system glm
9340 dnl ===================================================================
9341 AC_MSG_CHECKING([which glm to use])
9342 if test "$with_system_glm" = "yes"; then
9343     AC_MSG_RESULT([external])
9344     SYSTEM_GLM=TRUE
9345     AC_LANG_PUSH([C++])
9346     AC_CHECK_HEADER([glm/glm.hpp], [],
9347        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9348     AC_LANG_POP([C++])
9349 else
9350     AC_MSG_RESULT([internal])
9351     BUILD_TYPE="$BUILD_TYPE GLM"
9352     SYSTEM_GLM=
9353     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9355 AC_SUBST([GLM_CFLAGS])
9356 AC_SUBST([SYSTEM_GLM])
9358 dnl ===================================================================
9359 dnl Check for system odbc
9360 dnl ===================================================================
9361 AC_MSG_CHECKING([which odbc headers to use])
9362 if test "$with_system_odbc" = "yes" -o '(' "$with_system_headers" = "yes" -a "$with_system_odbc" = "auto" ')' -o '(' "$_os" = "WINNT" -a  "$with_system_odbc" != "no" ')'; then
9363     AC_MSG_RESULT([external])
9364     SYSTEM_ODBC_HEADERS=TRUE
9366     if test "$build_os" = "cygwin"; then
9367         save_CPPFLAGS=$CPPFLAGS
9368         find_winsdk
9369         PathFormat "$winsdktest"
9370         CPPFLAGS="$CPPFLAGS -I$formatted_path/include/um -I$formatted_path/Include/$winsdklibsubdir/um -I$formatted_path/include -I$formatted_path/include/shared -I$formatted_path/include/$winsdklibsubdir/shared"
9371         AC_CHECK_HEADER(sqlext.h, [],
9372             [AC_MSG_ERROR(odbc not found. install odbc)],
9373             [#include <windows.h>])
9374         CPPFLAGS=$save_CPPFLAGS
9375     else
9376         AC_CHECK_HEADER(sqlext.h, [],
9377             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9378     fi
9379 elif test "$enable_database_connectivity" != yes; then
9380     AC_MSG_RESULT([none])
9381 else
9382     AC_MSG_RESULT([internal])
9383     SYSTEM_ODBC_HEADERS=
9385 AC_SUBST(SYSTEM_ODBC_HEADERS)
9387 dnl ===================================================================
9388 dnl Enable LDAP support
9389 dnl ===================================================================
9391 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9392 AC_MSG_CHECKING([whether to enable LDAP support])
9393     if test "$enable_ldap" != "yes"; then
9394         AC_MSG_RESULT([no])
9395         ENABLE_LDAP=""
9396         enable_ldap=no
9397     else
9398         AC_MSG_RESULT([yes])
9399         ENABLE_LDAP="TRUE"
9400         AC_DEFINE(HAVE_FEATURE_LDAP)
9401     fi
9403 AC_SUBST(ENABLE_LDAP)
9405 dnl ===================================================================
9406 dnl Check for system openldap
9407 dnl ===================================================================
9409 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9410 AC_MSG_CHECKING([which openldap library to use])
9411 if test "$with_system_openldap" = "yes"; then
9412     AC_MSG_RESULT([external])
9413     SYSTEM_OPENLDAP=TRUE
9414     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9415     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9416     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9417 else
9418     AC_MSG_RESULT([internal])
9419     SYSTEM_OPENLDAP=
9420     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9423 AC_SUBST(SYSTEM_OPENLDAP)
9425 dnl ===================================================================
9426 dnl Check for system NSS
9427 dnl ===================================================================
9428 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9429     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9430     AC_DEFINE(HAVE_FEATURE_NSS)
9431     ENABLE_NSS="TRUE"
9432     AC_DEFINE(ENABLE_NSS)
9433 elif test $_os != iOS ; then
9434     with_tls=openssl
9436 AC_SUBST(ENABLE_NSS)
9438 dnl ===================================================================
9439 dnl Check for TLS/SSL and cryptographic implementation to use
9440 dnl ===================================================================
9441 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9442 if test -n "$with_tls"; then
9443     case $with_tls in
9444     openssl)
9445         AC_DEFINE(USE_TLS_OPENSSL)
9446         TLS=OPENSSL
9448         if test "$enable_openssl" != "yes"; then
9449             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9450         fi
9452         # warn that OpenSSL has been selected but not all TLS code has this option
9453         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9454         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9455         ;;
9456     nss)
9457         AC_DEFINE(USE_TLS_NSS)
9458         TLS=NSS
9459         ;;
9460     no)
9461         AC_MSG_WARN([Skipping TLS/SSL])
9462         ;;
9463     *)
9464         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9465 openssl - OpenSSL
9466 nss - Mozilla's Network Security Services (NSS)
9467     ])
9468         ;;
9469     esac
9470 else
9471     # default to using NSS, it results in smaller oox lib
9472     AC_DEFINE(USE_TLS_NSS)
9473     TLS=NSS
9475 AC_MSG_RESULT([$TLS])
9476 AC_SUBST(TLS)
9478 dnl ===================================================================
9479 dnl Check for system sane
9480 dnl ===================================================================
9481 AC_MSG_CHECKING([which sane header to use])
9482 if test "$with_system_sane" = "yes"; then
9483     AC_MSG_RESULT([external])
9484     AC_CHECK_HEADER(sane/sane.h, [],
9485       [AC_MSG_ERROR(sane not found. install sane)], [])
9486 else
9487     AC_MSG_RESULT([internal])
9488     BUILD_TYPE="$BUILD_TYPE SANE"
9491 dnl ===================================================================
9492 dnl Check for system icu
9493 dnl ===================================================================
9494 SYSTEM_GENBRK=
9495 SYSTEM_GENCCODE=
9496 SYSTEM_GENCMN=
9498 ICU_MAJOR=65
9499 ICU_MINOR=1
9500 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9501 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9502 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9503 AC_MSG_CHECKING([which icu to use])
9504 if test "$with_system_icu" = "yes"; then
9505     AC_MSG_RESULT([external])
9506     SYSTEM_ICU=TRUE
9507     AC_LANG_PUSH([C++])
9508     AC_MSG_CHECKING([for unicode/rbbi.h])
9509     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9510     AC_LANG_POP([C++])
9512     if test "$cross_compiling" != "yes"; then
9513         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9514         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9515         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9516         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9517     fi
9519     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9520         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9521         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9522         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9523         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9524         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9525             AC_MSG_RESULT([yes])
9526         else
9527             AC_MSG_RESULT([no])
9528             if test "$with_system_icu_for_build" != "force"; then
9529                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9530 You can use --with-system-icu-for-build=force to use it anyway.])
9531             fi
9532         fi
9533     fi
9535     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9536         # using the system icu tools can lead to version confusion, use the
9537         # ones from the build environment when cross-compiling
9538         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9539         if test -z "$SYSTEM_GENBRK"; then
9540             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9541         fi
9542         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9543         if test -z "$SYSTEM_GENCCODE"; then
9544             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9545         fi
9546         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9547         if test -z "$SYSTEM_GENCMN"; then
9548             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9549         fi
9550         if test "$ICU_MAJOR" -ge "49"; then
9551             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9552             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9553             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9554         else
9555             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9556             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9557             ICU_RECLASSIFIED_HEBREW_LETTER=
9558         fi
9559     fi
9561     if test "$cross_compiling" = "yes"; then
9562         if test "$ICU_MAJOR" -ge "50"; then
9563             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9564             ICU_MINOR=""
9565         fi
9566     fi
9567 else
9568     AC_MSG_RESULT([internal])
9569     SYSTEM_ICU=
9570     BUILD_TYPE="$BUILD_TYPE ICU"
9571     # surprisingly set these only for "internal" (to be used by various other
9572     # external libs): the system icu-config is quite unhelpful and spits out
9573     # dozens of weird flags and also default path -I/usr/include
9574     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9575     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9577 if test "$ICU_MAJOR" -ge "59"; then
9578     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9579     # with -std=c++11 but not all external libraries can be built with that,
9580     # for those use a bit-compatible typedef uint16_t UChar; see
9581     # icu/source/common/unicode/umachine.h
9582     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9583 else
9584     ICU_UCHAR_TYPE=""
9586 AC_SUBST(SYSTEM_ICU)
9587 AC_SUBST(SYSTEM_GENBRK)
9588 AC_SUBST(SYSTEM_GENCCODE)
9589 AC_SUBST(SYSTEM_GENCMN)
9590 AC_SUBST(ICU_MAJOR)
9591 AC_SUBST(ICU_MINOR)
9592 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9593 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9594 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9595 AC_SUBST(ICU_CFLAGS)
9596 AC_SUBST(ICU_LIBS)
9597 AC_SUBST(ICU_UCHAR_TYPE)
9599 dnl ==================================================================
9600 dnl Breakpad
9601 dnl ==================================================================
9602 DEFAULT_CRASHDUMP_VALUE="true"
9603 AC_MSG_CHECKING([whether to enable breakpad])
9604 if test "$enable_breakpad" != yes; then
9605     AC_MSG_RESULT([no])
9606 else
9607     AC_MSG_RESULT([yes])
9608     ENABLE_BREAKPAD="TRUE"
9609     AC_DEFINE(ENABLE_BREAKPAD)
9610     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9611     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9613     AC_MSG_CHECKING([for disable crash dump])
9614     if test "$enable_crashdump" = no; then
9615         DEFAULT_CRASHDUMP_VALUE="false"
9616         AC_MSG_RESULT([yes])
9617     else
9618        AC_MSG_RESULT([no])
9619     fi
9621     AC_MSG_CHECKING([for crashreport config])
9622     if test "$with_symbol_config" = "no"; then
9623         BREAKPAD_SYMBOL_CONFIG="invalid"
9624         AC_MSG_RESULT([no])
9625     else
9626         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9627         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9628         AC_MSG_RESULT([yes])
9629     fi
9630     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9632 AC_SUBST(ENABLE_BREAKPAD)
9633 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9635 dnl ==================================================================
9636 dnl libfuzzer
9637 dnl ==================================================================
9638 AC_MSG_CHECKING([whether to enable fuzzers])
9639 if test "$enable_fuzzers" != yes; then
9640     AC_MSG_RESULT([no])
9641 else
9642     AC_MSG_RESULT([yes])
9643     ENABLE_FUZZERS="TRUE"
9644     AC_DEFINE([ENABLE_FUZZERS],1)
9645     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9647 AC_SUBST(ENABLE_FUZZERS)
9649 dnl ===================================================================
9650 dnl Orcus
9651 dnl ===================================================================
9652 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9653 if test "$with_system_orcus" != "yes"; then
9654     if test "$SYSTEM_BOOST" = "TRUE"; then
9655         # ===========================================================
9656         # Determine if we are going to need to link with Boost.System
9657         # ===========================================================
9658         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9659         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9660         dnl in documentation has no effect.
9661         AC_MSG_CHECKING([if we need to link with Boost.System])
9662         AC_LANG_PUSH([C++])
9663         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9664                 @%:@include <boost/version.hpp>
9665             ]],[[
9666                 #if BOOST_VERSION >= 105000
9667                 #   error yes, we need to link with Boost.System
9668                 #endif
9669             ]])],[
9670                 AC_MSG_RESULT([no])
9671             ],[
9672                 AC_MSG_RESULT([yes])
9673                 AX_BOOST_SYSTEM
9674         ])
9675         AC_LANG_POP([C++])
9676     fi
9678 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9679 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9680 AC_SUBST([BOOST_SYSTEM_LIB])
9681 AC_SUBST(SYSTEM_LIBORCUS)
9683 dnl ===================================================================
9684 dnl HarfBuzz
9685 dnl ===================================================================
9686 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9687                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9688                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9690 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9691                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9692                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9694 if test "$COM" = "MSC"; then # override the above
9695     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9696     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9699 if test "$with_system_harfbuzz" = "yes"; then
9700     if test "$with_system_graphite" = "no"; then
9701         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9702     fi
9703     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9704     _save_libs="$LIBS"
9705     _save_cflags="$CFLAGS"
9706     LIBS="$LIBS $HARFBUZZ_LIBS"
9707     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9708     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9709     LIBS="$_save_libs"
9710     CFLAGS="$_save_cflags"
9711 else
9712     if test "$with_system_graphite" = "yes"; then
9713         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9714     fi
9717 AC_MSG_CHECKING([whether to use X11])
9718 dnl ***************************************
9719 dnl testing for X libraries and includes...
9720 dnl ***************************************
9721 if test "$USING_X11" = TRUE; then
9722     AC_DEFINE(HAVE_FEATURE_X11)
9724 AC_MSG_RESULT([$USING_X11])
9726 if test "$USING_X11" = TRUE; then
9727     AC_PATH_X
9728     AC_PATH_XTRA
9729     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9731     if test -z "$x_includes"; then
9732         x_includes="default_x_includes"
9733     fi
9734     if test -z "$x_libraries"; then
9735         x_libraries="default_x_libraries"
9736     fi
9737     CFLAGS="$CFLAGS $X_CFLAGS"
9738     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9739     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9740 else
9741     x_includes="no_x_includes"
9742     x_libraries="no_x_libraries"
9745 if test "$USING_X11" = TRUE; then
9746     dnl ===================================================================
9747     dnl Check for extension headers
9748     dnl ===================================================================
9749     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9750      [#include <X11/extensions/shape.h>])
9752     # vcl needs ICE and SM
9753     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9754     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9755         [AC_MSG_ERROR(ICE library not found)])
9756     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9757     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9758         [AC_MSG_ERROR(SM library not found)])
9761 dnl ===================================================================
9762 dnl Check for system Xrender
9763 dnl ===================================================================
9764 AC_MSG_CHECKING([whether to use Xrender])
9765 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9766     AC_MSG_RESULT([yes])
9767     PKG_CHECK_MODULES(XRENDER, xrender)
9768     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9769     FilterLibs "${XRENDER_LIBS}"
9770     XRENDER_LIBS="${filteredlibs}"
9771     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9772       [AC_MSG_ERROR(libXrender not found or functional)], [])
9773     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9774       [AC_MSG_ERROR(Xrender not found. install X)], [])
9775 else
9776     AC_MSG_RESULT([no])
9778 AC_SUBST(XRENDER_CFLAGS)
9779 AC_SUBST(XRENDER_LIBS)
9781 dnl ===================================================================
9782 dnl Check for XRandr
9783 dnl ===================================================================
9784 AC_MSG_CHECKING([whether to enable RandR support])
9785 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9786     AC_MSG_RESULT([yes])
9787     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9788     if test "$ENABLE_RANDR" != "TRUE"; then
9789         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9790                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9791         XRANDR_CFLAGS=" "
9792         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9793           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9794         XRANDR_LIBS="-lXrandr "
9795         ENABLE_RANDR="TRUE"
9796     fi
9797     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9798     FilterLibs "${XRANDR_LIBS}"
9799     XRANDR_LIBS="${filteredlibs}"
9800 else
9801     ENABLE_RANDR=""
9802     AC_MSG_RESULT([no])
9804 AC_SUBST(XRANDR_CFLAGS)
9805 AC_SUBST(XRANDR_LIBS)
9806 AC_SUBST(ENABLE_RANDR)
9808 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9809     WITH_WEBDAV="serf"
9811 if test $_os = iOS -o $_os = Android; then
9812     WITH_WEBDAV="no"
9814 AC_MSG_CHECKING([for webdav library])
9815 case "$WITH_WEBDAV" in
9816 serf)
9817     AC_MSG_RESULT([serf])
9818     # Check for system apr-util
9819     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9820                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9821                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9822     if test "$COM" = "MSC"; then
9823         APR_LIB_DIR="LibR"
9824         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9825         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9826     fi
9828     # Check for system serf
9829     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9830                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9831     if test "$COM" = "MSC"; then
9832         SERF_LIB_DIR="Release"
9833         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9834         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9835     fi
9836     ;;
9837 neon)
9838     AC_MSG_RESULT([neon])
9839     # Check for system neon
9840     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9841     if test "$with_system_neon" = "yes"; then
9842         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9843     else
9844         NEON_VERSION=0295
9845     fi
9846     AC_SUBST(NEON_VERSION)
9847     ;;
9849     AC_MSG_RESULT([none, disabled])
9850     WITH_WEBDAV=""
9851     ;;
9852 esac
9853 AC_SUBST(WITH_WEBDAV)
9855 dnl ===================================================================
9856 dnl Check for disabling cve_tests
9857 dnl ===================================================================
9858 AC_MSG_CHECKING([whether to execute CVE tests])
9859 # If not explicitly enabled or disabled, default
9860 if test -z "$enable_cve_tests"; then
9861     case "$OS" in
9862     WNT)
9863         # Default cves off for Windows with its wild and wonderful
9864         # variety of AV software kicking in and panicking
9865         enable_cve_tests=no
9866         ;;
9867     *)
9868         # otherwise yes
9869         enable_cve_tests=yes
9870         ;;
9871     esac
9873 if test "$enable_cve_tests" = "no"; then
9874     AC_MSG_RESULT([no])
9875     DISABLE_CVE_TESTS=TRUE
9876     AC_SUBST(DISABLE_CVE_TESTS)
9877 else
9878     AC_MSG_RESULT([yes])
9881 dnl ===================================================================
9882 dnl Check for enabling chart XShape tests
9883 dnl ===================================================================
9884 AC_MSG_CHECKING([whether to execute chart XShape tests])
9885 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9886     AC_MSG_RESULT([yes])
9887     ENABLE_CHART_TESTS=TRUE
9888     AC_SUBST(ENABLE_CHART_TESTS)
9889 else
9890     AC_MSG_RESULT([no])
9893 dnl ===================================================================
9894 dnl Check for system openssl
9895 dnl ===================================================================
9896 DISABLE_OPENSSL=
9897 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9898 if test "$enable_openssl" = "yes"; then
9899     AC_MSG_RESULT([no])
9900     if test "$_os" = Darwin ; then
9901         # OpenSSL is deprecated when building for 10.7 or later.
9902         #
9903         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9904         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9906         with_system_openssl=no
9907         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9908     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9909             && test "$with_system_openssl" != "no"; then
9910         with_system_openssl=yes
9911         SYSTEM_OPENSSL=TRUE
9912         OPENSSL_CFLAGS=
9913         OPENSSL_LIBS="-lssl -lcrypto"
9914     else
9915         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9916     fi
9917     if test "$with_system_openssl" = "yes"; then
9918         AC_MSG_CHECKING([whether openssl supports SHA512])
9919         AC_LANG_PUSH([C])
9920         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9921             SHA512_CTX context;
9922 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9923         AC_LANG_POP(C)
9924     fi
9925 else
9926     AC_MSG_RESULT([yes])
9927     DISABLE_OPENSSL=TRUE
9929     # warn that although OpenSSL is disabled, system libraries may depend on it
9930     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
9931     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
9934 AC_SUBST([DISABLE_OPENSSL])
9936 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9937     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9938         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9939         enable_cipher_openssl_backend=no
9940     else
9941         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9942     fi
9944 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9945 ENABLE_CIPHER_OPENSSL_BACKEND=
9946 if test "$enable_cipher_openssl_backend" = yes; then
9947     AC_MSG_RESULT([yes])
9948     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9949 else
9950     AC_MSG_RESULT([no])
9952 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9954 dnl ===================================================================
9955 dnl Check for building gnutls
9956 dnl ===================================================================
9957 AC_MSG_CHECKING([whether to use gnutls])
9958 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9959     AC_MSG_RESULT([yes])
9960     AM_PATH_LIBGCRYPT()
9961     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9962         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9963                       available in the system to use as replacement.]]))
9964     FilterLibs "${LIBGCRYPT_LIBS}"
9965     LIBGCRYPT_LIBS="${filteredlibs}"
9966 else
9967     AC_MSG_RESULT([no])
9970 AC_SUBST([LIBGCRYPT_CFLAGS])
9971 AC_SUBST([LIBGCRYPT_LIBS])
9973 dnl ===================================================================
9974 dnl Check for system redland
9975 dnl ===================================================================
9976 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9977 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9978 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9979 if test "$with_system_redland" = "yes"; then
9980     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9981             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9982 else
9983     RAPTOR_MAJOR="0"
9984     RASQAL_MAJOR="3"
9985     REDLAND_MAJOR="0"
9987 AC_SUBST(RAPTOR_MAJOR)
9988 AC_SUBST(RASQAL_MAJOR)
9989 AC_SUBST(REDLAND_MAJOR)
9991 dnl ===================================================================
9992 dnl Check for system hunspell
9993 dnl ===================================================================
9994 AC_MSG_CHECKING([which libhunspell to use])
9995 if test "$with_system_hunspell" = "yes"; then
9996     AC_MSG_RESULT([external])
9997     SYSTEM_HUNSPELL=TRUE
9998     AC_LANG_PUSH([C++])
9999     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10000     if test "$HUNSPELL_PC" != "TRUE"; then
10001         AC_CHECK_HEADER(hunspell.hxx, [],
10002             [
10003             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10004             [AC_MSG_ERROR(hunspell headers not found.)], [])
10005             ], [])
10006         AC_CHECK_LIB([hunspell], [main], [:],
10007            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10008         HUNSPELL_LIBS=-lhunspell
10009     fi
10010     AC_LANG_POP([C++])
10011     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10012     FilterLibs "${HUNSPELL_LIBS}"
10013     HUNSPELL_LIBS="${filteredlibs}"
10014 else
10015     AC_MSG_RESULT([internal])
10016     SYSTEM_HUNSPELL=
10017     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10018     if test "$COM" = "MSC"; then
10019         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10020     else
10021         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10022     fi
10023     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10025 AC_SUBST(SYSTEM_HUNSPELL)
10026 AC_SUBST(HUNSPELL_CFLAGS)
10027 AC_SUBST(HUNSPELL_LIBS)
10029 dnl ===================================================================
10030 dnl Check for system qrcodegen
10031 dnl ===================================================================
10032 AC_MSG_CHECKING([which libqrcodegen to use])
10033 if test "$with_system_qrcodegen" = "yes"; then
10034     AC_MSG_RESULT([external])
10035     SYSTEM_QRCODEGEN=TRUE
10036     AC_LANG_PUSH([C++])
10037     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10038         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10039     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10040         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10041     QRCODEGEN_LIBS=-lqrcodegencpp
10042     AC_LANG_POP([C++])
10043     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10044     FilterLibs "${QRCODEGEN_LIBS}"
10045     QRCODEGEN_LIBS="${filteredlibs}"
10046 else
10047     AC_MSG_RESULT([internal])
10048     SYSTEM_QRCODEGEN=
10049     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10051 AC_SUBST(SYSTEM_QRCODEGEN)
10052 AC_SUBST(QRCODEGEN_CFLAGS)
10053 AC_SUBST(QRCODEGEN_LIBS)
10055 dnl ===================================================================
10056 dnl Checking for altlinuxhyph
10057 dnl ===================================================================
10058 AC_MSG_CHECKING([which altlinuxhyph to use])
10059 if test "$with_system_altlinuxhyph" = "yes"; then
10060     AC_MSG_RESULT([external])
10061     SYSTEM_HYPH=TRUE
10062     AC_CHECK_HEADER(hyphen.h, [],
10063        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10064     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10065        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10066        [#include <hyphen.h>])
10067     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10068         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10069     if test -z "$HYPHEN_LIB"; then
10070         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10071            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10072     fi
10073     if test -z "$HYPHEN_LIB"; then
10074         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10075            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10076     fi
10077 else
10078     AC_MSG_RESULT([internal])
10079     SYSTEM_HYPH=
10080     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10081     if test "$COM" = "MSC"; then
10082         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10083     else
10084         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10085     fi
10087 AC_SUBST(SYSTEM_HYPH)
10088 AC_SUBST(HYPHEN_LIB)
10090 dnl ===================================================================
10091 dnl Checking for mythes
10092 dnl ===================================================================
10093 AC_MSG_CHECKING([which mythes to use])
10094 if test "$with_system_mythes" = "yes"; then
10095     AC_MSG_RESULT([external])
10096     SYSTEM_MYTHES=TRUE
10097     AC_LANG_PUSH([C++])
10098     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10099     if test "$MYTHES_PKGCONFIG" = "no"; then
10100         AC_CHECK_HEADER(mythes.hxx, [],
10101             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10102         AC_CHECK_LIB([mythes-1.2], [main], [:],
10103             [ MYTHES_FOUND=no], [])
10104     if test "$MYTHES_FOUND" = "no"; then
10105         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10106                 [ MYTHES_FOUND=no], [])
10107     fi
10108     if test "$MYTHES_FOUND" = "no"; then
10109         AC_MSG_ERROR([mythes library not found!.])
10110     fi
10111     fi
10112     AC_LANG_POP([C++])
10113     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10114     FilterLibs "${MYTHES_LIBS}"
10115     MYTHES_LIBS="${filteredlibs}"
10116 else
10117     AC_MSG_RESULT([internal])
10118     SYSTEM_MYTHES=
10119     BUILD_TYPE="$BUILD_TYPE MYTHES"
10120     if test "$COM" = "MSC"; then
10121         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10122     else
10123         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10124     fi
10126 AC_SUBST(SYSTEM_MYTHES)
10127 AC_SUBST(MYTHES_CFLAGS)
10128 AC_SUBST(MYTHES_LIBS)
10130 dnl ===================================================================
10131 dnl How should we build the linear programming solver ?
10132 dnl ===================================================================
10134 ENABLE_COINMP=
10135 AC_MSG_CHECKING([whether to build with CoinMP])
10136 if test "$enable_coinmp" != "no"; then
10137     ENABLE_COINMP=TRUE
10138     AC_MSG_RESULT([yes])
10139     if test "$with_system_coinmp" = "yes"; then
10140         SYSTEM_COINMP=TRUE
10141         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10142         FilterLibs "${COINMP_LIBS}"
10143         COINMP_LIBS="${filteredlibs}"
10144     else
10145         BUILD_TYPE="$BUILD_TYPE COINMP"
10146     fi
10147 else
10148     AC_MSG_RESULT([no])
10150 AC_SUBST(ENABLE_COINMP)
10151 AC_SUBST(SYSTEM_COINMP)
10152 AC_SUBST(COINMP_CFLAGS)
10153 AC_SUBST(COINMP_LIBS)
10155 ENABLE_LPSOLVE=
10156 AC_MSG_CHECKING([whether to build with lpsolve])
10157 if test "$enable_lpsolve" != "no"; then
10158     ENABLE_LPSOLVE=TRUE
10159     AC_MSG_RESULT([yes])
10160 else
10161     AC_MSG_RESULT([no])
10163 AC_SUBST(ENABLE_LPSOLVE)
10165 if test "$ENABLE_LPSOLVE" = TRUE; then
10166     AC_MSG_CHECKING([which lpsolve to use])
10167     if test "$with_system_lpsolve" = "yes"; then
10168         AC_MSG_RESULT([external])
10169         SYSTEM_LPSOLVE=TRUE
10170         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10171            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10172         save_LIBS=$LIBS
10173         # some systems need this. Like Ubuntu...
10174         AC_CHECK_LIB(m, floor)
10175         AC_CHECK_LIB(dl, dlopen)
10176         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10177             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10178         LIBS=$save_LIBS
10179     else
10180         AC_MSG_RESULT([internal])
10181         SYSTEM_LPSOLVE=
10182         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10183     fi
10185 AC_SUBST(SYSTEM_LPSOLVE)
10187 dnl ===================================================================
10188 dnl Checking for libexttextcat
10189 dnl ===================================================================
10190 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10191 if test "$with_system_libexttextcat" = "yes"; then
10192     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10194 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10196 dnl ===================================================================
10197 dnl Checking for libnumbertext
10198 dnl ===================================================================
10199 AC_MSG_CHECKING([whether to use libnumbertext])
10200 if test "$enable_libnumbertext" = "no"; then
10201     AC_MSG_RESULT([no])
10202     ENABLE_LIBNUMBERTEXT=
10203     SYSTEM_LIBNUMBERTEXT=
10204 else
10205     AC_MSG_RESULT([yes])
10206     ENABLE_LIBNUMBERTEXT=TRUE
10207     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10208     if test "$with_system_libnumbertext" = "yes"; then
10209         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10210         SYSTEM_LIBNUMBERTEXT=YES
10211     else
10212         SYSTEM_LIBNUMBERTEXT=
10213         AC_LANG_PUSH([C++])
10214         save_CPPFLAGS=$CPPFLAGS
10215         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10216         AC_CHECK_HEADERS([codecvt regex])
10217         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10218                 [ ENABLE_LIBNUMBERTEXT=''
10219                   LIBNUMBERTEXT_CFLAGS=''
10220                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10221                                Enable libnumbertext fallback (missing number to number name conversion).])
10222                 ])
10223         CPPFLAGS=$save_CPPFLAGS
10224         AC_LANG_POP([C++])
10225     fi
10226     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10227         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10228     fi
10230 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10231 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10232 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10233 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10235 dnl ***************************************
10236 dnl testing libc version for Linux...
10237 dnl ***************************************
10238 if test "$_os" = "Linux"; then
10239     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10240     exec 6>/dev/null # no output
10241     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10242     exec 6>&1 # output on again
10243     if test "$HAVE_LIBC"; then
10244         AC_MSG_RESULT([yes])
10245     else
10246         AC_MSG_ERROR([no, upgrade libc])
10247     fi
10250 dnl =========================================
10251 dnl Check for uuidgen
10252 dnl =========================================
10253 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10254     # presence is already tested above in the WINDOWS_SDK_HOME check
10255     UUIDGEN=uuidgen.exe
10256     AC_SUBST(UUIDGEN)
10257 else
10258     AC_PATH_PROG([UUIDGEN], [uuidgen])
10259     if test -z "$UUIDGEN"; then
10260         AC_MSG_WARN([uuid is needed for building installation sets])
10261     fi
10264 dnl ***************************************
10265 dnl Checking for bison and flex
10266 dnl ***************************************
10267 AC_PATH_PROG(BISON, bison)
10268 if test -z "$BISON"; then
10269     AC_MSG_ERROR([no bison found in \$PATH, install it])
10270 else
10271     AC_MSG_CHECKING([the bison version])
10272     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10273     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10274     # Accept newer than 2.0
10275     if test "$_bison_longver" -lt 2000; then
10276         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10277     fi
10280 AC_PATH_PROG(FLEX, flex)
10281 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10282     FLEX=`cygpath -m $FLEX`
10284 if test -z "$FLEX"; then
10285     AC_MSG_ERROR([no flex found in \$PATH, install it])
10286 else
10287     AC_MSG_CHECKING([the flex version])
10288     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10289     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10290         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10291     fi
10293 AC_SUBST([FLEX])
10294 dnl ***************************************
10295 dnl Checking for patch
10296 dnl ***************************************
10297 AC_PATH_PROG(PATCH, patch)
10298 if test -z "$PATCH"; then
10299     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10302 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10303 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10304     if test -z "$with_gnu_patch"; then
10305         GNUPATCH=$PATCH
10306     else
10307         if test -x "$with_gnu_patch"; then
10308             GNUPATCH=$with_gnu_patch
10309         else
10310             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10311         fi
10312     fi
10314     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10315     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10316         AC_MSG_RESULT([yes])
10317     else
10318         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10319     fi
10320 else
10321     GNUPATCH=$PATCH
10324 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10325     GNUPATCH=`cygpath -m $GNUPATCH`
10328 dnl We also need to check for --with-gnu-cp
10330 if test -z "$with_gnu_cp"; then
10331     # check the place where the good stuff is hidden on Solaris...
10332     if test -x /usr/gnu/bin/cp; then
10333         GNUCP=/usr/gnu/bin/cp
10334     else
10335         AC_PATH_PROGS(GNUCP, gnucp cp)
10336     fi
10337     if test -z $GNUCP; then
10338         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10339     fi
10340 else
10341     if test -x "$with_gnu_cp"; then
10342         GNUCP=$with_gnu_cp
10343     else
10344         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10345     fi
10348 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10349     GNUCP=`cygpath -m $GNUCP`
10352 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10353 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10354     AC_MSG_RESULT([yes])
10355 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10356     AC_MSG_RESULT([yes])
10357 else
10358     case "$build_os" in
10359     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10360         x_GNUCP=[\#]
10361         GNUCP=''
10362         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10363         ;;
10364     *)
10365         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10366         ;;
10367     esac
10370 AC_SUBST(GNUPATCH)
10371 AC_SUBST(GNUCP)
10372 AC_SUBST(x_GNUCP)
10374 dnl ***************************************
10375 dnl testing assembler path
10376 dnl ***************************************
10377 ML_EXE=""
10378 if test "$_os" = "WINNT"; then
10379     if test "$BITNESS_OVERRIDE" = ""; then
10380         assembler=ml.exe
10381     else
10382         assembler=ml64.exe
10383     fi
10385     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10386     if test -f "$CL_PATH/$assembler"; then
10387         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10388         AC_MSG_RESULT([$ML_EXE])
10389     else
10390         AC_MSG_ERROR([not found])
10391     fi
10394 AC_SUBST(ML_EXE)
10396 dnl ===================================================================
10397 dnl We need zip and unzip
10398 dnl ===================================================================
10399 AC_PATH_PROG(ZIP, zip)
10400 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10401 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10402     AC_MSG_ERROR([Zip version 3.0 or newer is required to build, please install it and make sure it is the one found first in PATH],,)
10405 AC_PATH_PROG(UNZIP, unzip)
10406 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10408 dnl ===================================================================
10409 dnl Zip must be a specific type for different build types.
10410 dnl ===================================================================
10411 if test $build_os = cygwin; then
10412     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10413         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10414     fi
10417 dnl ===================================================================
10418 dnl We need touch with -h option support.
10419 dnl ===================================================================
10420 AC_PATH_PROG(TOUCH, touch)
10421 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10422 touch warn
10423 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10424     AC_MSG_ERROR([touch version with -h option support is required to build, please install it and make sure it is the one found first in PATH],,)
10427 dnl ===================================================================
10428 dnl Check for system epoxy
10429 dnl ===================================================================
10430 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10432 dnl ===================================================================
10433 dnl Set vcl option: coordinate device in double or sal_Int32
10434 dnl ===================================================================
10436 dnl disabled for now, we don't want subtle differences between OSs
10437 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10438 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10439 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10440 dnl     AC_MSG_RESULT([double])
10441 dnl else
10442 dnl     AC_MSG_RESULT([sal_Int32])
10443 dnl fi
10445 dnl ===================================================================
10446 dnl Test which vclplugs have to be built.
10447 dnl ===================================================================
10448 R=""
10449 if test "$USING_X11" != TRUE; then
10450     enable_gtk3=no
10452 GTK3_CFLAGS=""
10453 GTK3_LIBS=""
10454 ENABLE_GTK3=""
10455 if test "x$enable_gtk3" = "xyes"; then
10456     if test "$with_system_cairo" = no; then
10457         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10458     fi
10459     : ${with_system_cairo:=yes}
10460     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.18 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
10461     if test "x$ENABLE_GTK3" = "xTRUE"; then
10462         AC_DEFINE(ENABLE_GTK3)
10463         R="gtk3"
10464     else
10465         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10466     fi
10467     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10468     FilterLibs "${GTK3_LIBS}"
10469     GTK3_LIBS="${filteredlibs}"
10471     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10472     if test "$with_system_epoxy" != "yes"; then
10473         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10474         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10475                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10476     fi
10478 AC_SUBST(GTK3_LIBS)
10479 AC_SUBST(GTK3_CFLAGS)
10480 AC_SUBST(ENABLE_GTK3)
10482 if test "$enable_introspection" = yes; then
10483     if test "$ENABLE_GTK3" = TRUE; then
10484         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10485     else
10486         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10487     fi
10490 ENABLE_QT5=""
10491 if test "x$enable_qt5" = "xyes"; then
10492     ENABLE_QT5="TRUE"
10493     AC_DEFINE(ENABLE_QT5)
10494     R="$R qt5"
10496 AC_SUBST(ENABLE_QT5)
10498 ENABLE_KF5=""
10499 if test "x$enable_kf5" = "xyes"; then
10500     ENABLE_KF5="TRUE"
10501     AC_DEFINE(ENABLE_KF5)
10502     R="$R kf5"
10504 AC_SUBST(ENABLE_KF5)
10506 ENABLE_GTK3_KDE5=""
10507 if test "x$enable_gtk3_kde5" = "xyes"; then
10508     ENABLE_GTK3_KDE5="TRUE"
10509     AC_DEFINE(ENABLE_GTK3_KDE5)
10510     R="$R gtk3_kde5"
10512 AC_SUBST(ENABLE_GTK3_KDE5)
10514 if test "$_os" = "WINNT"; then
10515     R="$R win"
10516 elif test "$_os" = "Darwin"; then
10517     R="$R osx"
10518 elif test "$_os" = "iOS"; then
10519     R="ios (builtin)"
10522 build_vcl_plugins="$R"
10523 if test -z "$build_vcl_plugins"; then
10524     build_vcl_plugins="none"
10526 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10528 dnl ===================================================================
10529 dnl check for dbus support
10530 dnl ===================================================================
10531 ENABLE_DBUS=""
10532 DBUS_CFLAGS=""
10533 DBUS_LIBS=""
10534 DBUS_GLIB_CFLAGS=""
10535 DBUS_GLIB_LIBS=""
10536 DBUS_HAVE_GLIB=""
10538 if test "$enable_dbus" = "no"; then
10539     test_dbus=no
10542 AC_MSG_CHECKING([whether to enable DBUS support])
10543 if test "$test_dbus" = "yes"; then
10544     ENABLE_DBUS="TRUE"
10545     AC_MSG_RESULT([yes])
10546     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10547     AC_DEFINE(ENABLE_DBUS)
10548     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10549     FilterLibs "${DBUS_LIBS}"
10550     DBUS_LIBS="${filteredlibs}"
10552     # Glib is needed for BluetoothServer
10553     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10554     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10555         [
10556             DBUS_HAVE_GLIB="TRUE"
10557             AC_DEFINE(DBUS_HAVE_GLIB,1)
10558         ],
10559         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10560     )
10561 else
10562     AC_MSG_RESULT([no])
10565 AC_SUBST(ENABLE_DBUS)
10566 AC_SUBST(DBUS_CFLAGS)
10567 AC_SUBST(DBUS_LIBS)
10568 AC_SUBST(DBUS_GLIB_CFLAGS)
10569 AC_SUBST(DBUS_GLIB_LIBS)
10570 AC_SUBST(DBUS_HAVE_GLIB)
10572 AC_MSG_CHECKING([whether to enable Impress remote control])
10573 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10574     AC_MSG_RESULT([yes])
10575     ENABLE_SDREMOTE=TRUE
10576     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10578     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10579         # The Bluetooth code doesn't compile with macOS SDK 10.15
10580         enable_sdremote_bluetooth=no
10581     fi
10582     # If not explicitly enabled or disabled, default
10583     if test -z "$enable_sdremote_bluetooth"; then
10584         case "$OS" in
10585         LINUX|MACOSX|WNT)
10586             # Default to yes for these
10587             enable_sdremote_bluetooth=yes
10588             ;;
10589         *)
10590             # otherwise no
10591             enable_sdremote_bluetooth=no
10592             ;;
10593         esac
10594     fi
10595     # $enable_sdremote_bluetooth is guaranteed non-empty now
10597     if test "$enable_sdremote_bluetooth" != "no"; then
10598         if test "$OS" = "LINUX"; then
10599             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10600                 AC_MSG_RESULT([yes])
10601                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10602                 dnl ===================================================================
10603                 dnl Check for system bluez
10604                 dnl ===================================================================
10605                 AC_MSG_CHECKING([which Bluetooth header to use])
10606                 if test "$with_system_bluez" = "yes"; then
10607                     AC_MSG_RESULT([external])
10608                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10609                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10610                     SYSTEM_BLUEZ=TRUE
10611                 else
10612                     AC_MSG_RESULT([internal])
10613                     SYSTEM_BLUEZ=
10614                 fi
10615             else
10616                 AC_MSG_RESULT([no, dbus disabled])
10617                 ENABLE_SDREMOTE_BLUETOOTH=
10618                 SYSTEM_BLUEZ=
10619             fi
10620         else
10621             AC_MSG_RESULT([yes])
10622             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10623             SYSTEM_BLUEZ=
10624         fi
10625     else
10626         AC_MSG_RESULT([no])
10627         ENABLE_SDREMOTE_BLUETOOTH=
10628         SYSTEM_BLUEZ=
10629     fi
10630 else
10631     ENABLE_SDREMOTE=
10632     SYSTEM_BLUEZ=
10633     AC_MSG_RESULT([no])
10635 AC_SUBST(ENABLE_SDREMOTE)
10636 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10637 AC_SUBST(SYSTEM_BLUEZ)
10639 dnl ===================================================================
10640 dnl Check whether to enable GIO support
10641 dnl ===================================================================
10642 if test "$ENABLE_GTK3" = "TRUE"; then
10643     AC_MSG_CHECKING([whether to enable GIO support])
10644     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10645         dnl Need at least 2.26 for the dbus support.
10646         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10647                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10648         if test "$ENABLE_GIO" = "TRUE"; then
10649             AC_DEFINE(ENABLE_GIO)
10650             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10651             FilterLibs "${GIO_LIBS}"
10652             GIO_LIBS="${filteredlibs}"
10653         fi
10654     else
10655         AC_MSG_RESULT([no])
10656     fi
10658 AC_SUBST(ENABLE_GIO)
10659 AC_SUBST(GIO_CFLAGS)
10660 AC_SUBST(GIO_LIBS)
10663 dnl ===================================================================
10665 SPLIT_APP_MODULES=""
10666 if test "$enable_split_app_modules" = "yes"; then
10667     SPLIT_APP_MODULES="TRUE"
10669 AC_SUBST(SPLIT_APP_MODULES)
10671 SPLIT_OPT_FEATURES=""
10672 if test "$enable_split_opt_features" = "yes"; then
10673     SPLIT_OPT_FEATURES="TRUE"
10675 AC_SUBST(SPLIT_OPT_FEATURES)
10677 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10678     if test "$enable_cairo_canvas" = yes; then
10679         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10680     fi
10681     enable_cairo_canvas=no
10682 elif test -z "$enable_cairo_canvas"; then
10683     enable_cairo_canvas=yes
10686 ENABLE_CAIRO_CANVAS=""
10687 if test "$enable_cairo_canvas" = "yes"; then
10688     test_cairo=yes
10689     ENABLE_CAIRO_CANVAS="TRUE"
10690     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10692 AC_SUBST(ENABLE_CAIRO_CANVAS)
10694 dnl ===================================================================
10695 dnl Check whether the GStreamer libraries are available.
10696 dnl ===================================================================
10698 ENABLE_GSTREAMER_1_0=""
10700 if test "$build_gstreamer_1_0" = "yes"; then
10702     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10703     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10704         ENABLE_GSTREAMER_1_0="TRUE"
10705         AC_MSG_RESULT([yes])
10706         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10707         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10708         FilterLibs "${GSTREAMER_1_0_LIBS}"
10709         GSTREAMER_1_0_LIBS="${filteredlibs}"
10710         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10711     else
10712         AC_MSG_RESULT([no])
10713     fi
10715 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10716 AC_SUBST(GSTREAMER_1_0_LIBS)
10717 AC_SUBST(ENABLE_GSTREAMER_1_0)
10719 dnl ===================================================================
10720 dnl Check whether to build the VLC avmedia backend
10721 dnl ===================================================================
10723 ENABLE_VLC=""
10725 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10726 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10727     ENABLE_VLC="TRUE"
10728     AC_MSG_RESULT([yes])
10729 else
10730     AC_MSG_RESULT([no])
10732 AC_SUBST(ENABLE_VLC)
10734 ENABLE_OPENGL_TRANSITIONS=
10735 ENABLE_OPENGL_CANVAS=
10736 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10737    : # disable
10738 elif test "$_os" = "Darwin"; then
10739     # We use frameworks on macOS, no need for detail checks
10740     ENABLE_OPENGL_TRANSITIONS=TRUE
10741     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10742     ENABLE_OPENGL_CANVAS=TRUE
10743 elif test $_os = WINNT; then
10744     ENABLE_OPENGL_TRANSITIONS=TRUE
10745     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10746     ENABLE_OPENGL_CANVAS=TRUE
10747 else
10748     if test "$USING_X11" = TRUE; then
10749         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10750         ENABLE_OPENGL_TRANSITIONS=TRUE
10751         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10752         ENABLE_OPENGL_CANVAS=TRUE
10753     fi
10756 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10757 AC_SUBST(ENABLE_OPENGL_CANVAS)
10759 dnl =================================================
10760 dnl Check whether to build with OpenCL support.
10761 dnl =================================================
10763 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10764     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10765     # platform (optional at run-time, used through clew).
10766     BUILD_TYPE="$BUILD_TYPE OPENCL"
10767     AC_DEFINE(HAVE_FEATURE_OPENCL)
10770 dnl =================================================
10771 dnl Check whether to build with dconf support.
10772 dnl =================================================
10774 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10775     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10776         if test "$enable_dconf" = yes; then
10777             AC_MSG_ERROR([dconf not found])
10778         else
10779             enable_dconf=no
10780         fi])
10782 AC_MSG_CHECKING([whether to enable dconf])
10783 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10784     DCONF_CFLAGS=
10785     DCONF_LIBS=
10786     ENABLE_DCONF=
10787     AC_MSG_RESULT([no])
10788 else
10789     ENABLE_DCONF=TRUE
10790     AC_DEFINE(ENABLE_DCONF)
10791     AC_MSG_RESULT([yes])
10793 AC_SUBST([DCONF_CFLAGS])
10794 AC_SUBST([DCONF_LIBS])
10795 AC_SUBST([ENABLE_DCONF])
10797 # pdf import?
10798 AC_MSG_CHECKING([whether to build the PDF import feature])
10799 ENABLE_PDFIMPORT=
10800 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10801     AC_MSG_RESULT([yes])
10802     ENABLE_PDFIMPORT=TRUE
10803     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10804 else
10805     AC_MSG_RESULT([no])
10808 # Pdfium?
10809 AC_MSG_CHECKING([whether to build PDFium])
10810 ENABLE_PDFIUM=
10811 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10812     AC_MSG_RESULT([yes])
10813     ENABLE_PDFIUM=TRUE
10814     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10815     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10816 else
10817     AC_MSG_RESULT([no])
10819 AC_SUBST(ENABLE_PDFIUM)
10821 dnl ===================================================================
10822 dnl Check for poppler
10823 dnl ===================================================================
10824 ENABLE_POPPLER=
10825 AC_MSG_CHECKING([whether to build Poppler])
10826 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
10827     AC_MSG_RESULT([yes])
10828     ENABLE_POPPLER=TRUE
10829     AC_DEFINE(HAVE_FEATURE_POPPLER)
10830 else
10831     AC_MSG_RESULT([no])
10833 AC_SUBST(ENABLE_POPPLER)
10835 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10836     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10839 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
10840     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10843 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
10844     dnl ===================================================================
10845     dnl Check for system poppler
10846     dnl ===================================================================
10847     AC_MSG_CHECKING([which PDF import poppler to use])
10848     if test "$with_system_poppler" = "yes"; then
10849         AC_MSG_RESULT([external])
10850         SYSTEM_POPPLER=TRUE
10851         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10852         AC_LANG_PUSH([C++])
10853         save_CXXFLAGS=$CXXFLAGS
10854         save_CPPFLAGS=$CPPFLAGS
10855         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10856         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10857         AC_CHECK_HEADER([cpp/poppler-version.h],
10858             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10859             [])
10860         CXXFLAGS=$save_CXXFLAGS
10861         CPPFLAGS=$save_CPPFLAGS
10862         AC_LANG_POP([C++])
10863         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10865         FilterLibs "${POPPLER_LIBS}"
10866         POPPLER_LIBS="${filteredlibs}"
10867     else
10868         AC_MSG_RESULT([internal])
10869         SYSTEM_POPPLER=
10870         BUILD_TYPE="$BUILD_TYPE POPPLER"
10871         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10872     fi
10873     AC_DEFINE([ENABLE_PDFIMPORT],1)
10875 AC_SUBST(ENABLE_PDFIMPORT)
10876 AC_SUBST(SYSTEM_POPPLER)
10877 AC_SUBST(POPPLER_CFLAGS)
10878 AC_SUBST(POPPLER_LIBS)
10880 SYSTEM_GPGMEPP=
10882 if test "$build_for_ios" = "YES"; then
10883     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10884     AC_MSG_RESULT([yes])
10885 elif test "$enable_mpl_subset" = "yes"; then
10886     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10887     AC_MSG_RESULT([yes])
10888 elif test "$enable_fuzzers" = "yes"; then
10889     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10890     AC_MSG_RESULT([yes])
10891 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10892     dnl ===================================================================
10893     dnl Check for system gpgme
10894     dnl ===================================================================
10895     AC_MSG_CHECKING([which gpgmepp to use])
10896     if test "$with_system_gpgmepp" = "yes"; then
10897         AC_MSG_RESULT([external])
10898         SYSTEM_GPGMEPP=TRUE
10900         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10901         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10902             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10903         # progress_callback is the only func with plain C linkage
10904         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10905         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10906             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10907         AC_CHECK_HEADER(gpgme.h, [],
10908             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10909     else
10910         AC_MSG_RESULT([internal])
10911         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10912         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10914         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10915         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10916         if test "$_os" != "WINNT"; then
10917             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10918             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10919         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10920             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10921         fi
10922     fi
10923     ENABLE_GPGMEPP=TRUE
10924     AC_DEFINE([HAVE_FEATURE_GPGME])
10925     AC_PATH_PROG(GPG, gpg)
10926     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10927     # so let's exclude that manually for the moment
10928     if test -n "$GPG" -a "$_os" != "WINNT"; then
10929         # make sure we not only have a working gpgme, but a full working
10930         # gpg installation to run OpenPGP signature verification
10931         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10932     fi
10933     if test "$_os" = "Linux"; then
10934       uid=`id -u`
10935       AC_MSG_CHECKING([for /run/user/$uid])
10936       if test -d /run/user/$uid; then
10937         AC_MSG_RESULT([yes])
10938         AC_PATH_PROG(GPGCONF, gpgconf)
10940         # Older versions of gpgconf are not working as expected, since
10941         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10942         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10943         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10944         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10945         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10946         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10947         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10948           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10949           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10950           if $GPGCONF --dump-options > /dev/null ; then
10951             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10952               AC_MSG_RESULT([yes])
10953               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10954               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10955             else
10956               AC_MSG_RESULT([no])
10957             fi
10958           else
10959             AC_MSG_RESULT([no. missing or broken gpgconf?])
10960           fi
10961         else
10962           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10963         fi
10964       else
10965         AC_MSG_RESULT([no])
10966      fi
10967    fi
10969 AC_SUBST(ENABLE_GPGMEPP)
10970 AC_SUBST(SYSTEM_GPGMEPP)
10971 AC_SUBST(GPG_ERROR_CFLAGS)
10972 AC_SUBST(GPG_ERROR_LIBS)
10973 AC_SUBST(LIBASSUAN_CFLAGS)
10974 AC_SUBST(LIBASSUAN_LIBS)
10975 AC_SUBST(GPGMEPP_CFLAGS)
10976 AC_SUBST(GPGMEPP_LIBS)
10978 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10979 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10980     AC_MSG_RESULT([yes])
10981     ENABLE_MEDIAWIKI=TRUE
10982     BUILD_TYPE="$BUILD_TYPE XSLTML"
10983     if test  "x$with_java" = "xno"; then
10984         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10985     fi
10986 else
10987     AC_MSG_RESULT([no])
10988     ENABLE_MEDIAWIKI=
10989     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10991 AC_SUBST(ENABLE_MEDIAWIKI)
10993 AC_MSG_CHECKING([whether to build the Report Builder])
10994 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10995     AC_MSG_RESULT([yes])
10996     ENABLE_REPORTBUILDER=TRUE
10997     AC_MSG_CHECKING([which jfreereport libs to use])
10998     if test "$with_system_jfreereport" = "yes"; then
10999         SYSTEM_JFREEREPORT=TRUE
11000         AC_MSG_RESULT([external])
11001         if test -z $SAC_JAR; then
11002             SAC_JAR=/usr/share/java/sac.jar
11003         fi
11004         if ! test -f $SAC_JAR; then
11005              AC_MSG_ERROR(sac.jar not found.)
11006         fi
11008         if test -z $LIBXML_JAR; then
11009             if test -f /usr/share/java/libxml-1.0.0.jar; then
11010                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11011             elif test -f /usr/share/java/libxml.jar; then
11012                 LIBXML_JAR=/usr/share/java/libxml.jar
11013             else
11014                 AC_MSG_ERROR(libxml.jar replacement not found.)
11015             fi
11016         elif ! test -f $LIBXML_JAR; then
11017             AC_MSG_ERROR(libxml.jar not found.)
11018         fi
11020         if test -z $FLUTE_JAR; then
11021             if test -f/usr/share/java/flute-1.3.0.jar; then
11022                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11023             elif test -f /usr/share/java/flute.jar; then
11024                 FLUTE_JAR=/usr/share/java/flute.jar
11025             else
11026                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11027             fi
11028         elif ! test -f $FLUTE_JAR; then
11029             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11030         fi
11032         if test -z $JFREEREPORT_JAR; then
11033             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11034                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11035             elif test -f /usr/share/java/flow-engine.jar; then
11036                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11037             else
11038                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11039             fi
11040         elif ! test -f  $JFREEREPORT_JAR; then
11041                 AC_MSG_ERROR(jfreereport.jar not found.)
11042         fi
11044         if test -z $LIBLAYOUT_JAR; then
11045             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11046                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11047             elif test -f /usr/share/java/liblayout.jar; then
11048                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11049             else
11050                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11051             fi
11052         elif ! test -f $LIBLAYOUT_JAR; then
11053                 AC_MSG_ERROR(liblayout.jar not found.)
11054         fi
11056         if test -z $LIBLOADER_JAR; then
11057             if test -f /usr/share/java/libloader-1.0.0.jar; then
11058                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11059             elif test -f /usr/share/java/libloader.jar; then
11060                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11061             else
11062                 AC_MSG_ERROR(libloader.jar replacement not found.)
11063             fi
11064         elif ! test -f  $LIBLOADER_JAR; then
11065             AC_MSG_ERROR(libloader.jar not found.)
11066         fi
11068         if test -z $LIBFORMULA_JAR; then
11069             if test -f /usr/share/java/libformula-0.2.0.jar; then
11070                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11071             elif test -f /usr/share/java/libformula.jar; then
11072                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11073             else
11074                 AC_MSG_ERROR(libformula.jar replacement not found.)
11075             fi
11076         elif ! test -f $LIBFORMULA_JAR; then
11077                 AC_MSG_ERROR(libformula.jar not found.)
11078         fi
11080         if test -z $LIBREPOSITORY_JAR; then
11081             if test -f /usr/share/java/librepository-1.0.0.jar; then
11082                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11083             elif test -f /usr/share/java/librepository.jar; then
11084                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11085             else
11086                 AC_MSG_ERROR(librepository.jar replacement not found.)
11087             fi
11088         elif ! test -f $LIBREPOSITORY_JAR; then
11089             AC_MSG_ERROR(librepository.jar not found.)
11090         fi
11092         if test -z $LIBFONTS_JAR; then
11093             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11094                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11095             elif test -f /usr/share/java/libfonts.jar; then
11096                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11097             else
11098                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11099             fi
11100         elif ! test -f $LIBFONTS_JAR; then
11101                 AC_MSG_ERROR(libfonts.jar not found.)
11102         fi
11104         if test -z $LIBSERIALIZER_JAR; then
11105             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11106                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11107             elif test -f /usr/share/java/libserializer.jar; then
11108                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11109             else
11110                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11111             fi
11112         elif ! test -f $LIBSERIALIZER_JAR; then
11113                 AC_MSG_ERROR(libserializer.jar not found.)
11114         fi
11116         if test -z $LIBBASE_JAR; then
11117             if test -f /usr/share/java/libbase-1.0.0.jar; then
11118                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11119             elif test -f /usr/share/java/libbase.jar; then
11120                 LIBBASE_JAR=/usr/share/java/libbase.jar
11121             else
11122                 AC_MSG_ERROR(libbase.jar replacement not found.)
11123             fi
11124         elif ! test -f $LIBBASE_JAR; then
11125             AC_MSG_ERROR(libbase.jar not found.)
11126         fi
11128     else
11129         AC_MSG_RESULT([internal])
11130         SYSTEM_JFREEREPORT=
11131         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11132         NEED_ANT=TRUE
11133     fi
11134 else
11135     AC_MSG_RESULT([no])
11136     ENABLE_REPORTBUILDER=
11137     SYSTEM_JFREEREPORT=
11139 AC_SUBST(ENABLE_REPORTBUILDER)
11140 AC_SUBST(SYSTEM_JFREEREPORT)
11141 AC_SUBST(SAC_JAR)
11142 AC_SUBST(LIBXML_JAR)
11143 AC_SUBST(FLUTE_JAR)
11144 AC_SUBST(JFREEREPORT_JAR)
11145 AC_SUBST(LIBBASE_JAR)
11146 AC_SUBST(LIBLAYOUT_JAR)
11147 AC_SUBST(LIBLOADER_JAR)
11148 AC_SUBST(LIBFORMULA_JAR)
11149 AC_SUBST(LIBREPOSITORY_JAR)
11150 AC_SUBST(LIBFONTS_JAR)
11151 AC_SUBST(LIBSERIALIZER_JAR)
11153 # this has to be here because both the Wiki Publisher and the SRB use
11154 # commons-logging
11155 COMMONS_LOGGING_VERSION=1.2
11156 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11157     AC_MSG_CHECKING([which Apache commons-* libs to use])
11158     if test "$with_system_apache_commons" = "yes"; then
11159         SYSTEM_APACHE_COMMONS=TRUE
11160         AC_MSG_RESULT([external])
11161         if test -z $COMMONS_LOGGING_JAR; then
11162             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11163                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11164            elif test -f /usr/share/java/commons-logging.jar; then
11165                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11166             else
11167                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11168             fi
11169         elif ! test -f $COMMONS_LOGGING_JAR; then
11170             AC_MSG_ERROR(commons-logging.jar not found.)
11171         fi
11172     else
11173         AC_MSG_RESULT([internal])
11174         SYSTEM_APACHE_COMMONS=
11175         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11176         NEED_ANT=TRUE
11177     fi
11179 AC_SUBST(SYSTEM_APACHE_COMMONS)
11180 AC_SUBST(COMMONS_LOGGING_JAR)
11181 AC_SUBST(COMMONS_LOGGING_VERSION)
11183 # scripting provider for BeanShell?
11184 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11185 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11186     AC_MSG_RESULT([yes])
11187     ENABLE_SCRIPTING_BEANSHELL=TRUE
11189     dnl ===================================================================
11190     dnl Check for system beanshell
11191     dnl ===================================================================
11192     AC_MSG_CHECKING([which beanshell to use])
11193     if test "$with_system_beanshell" = "yes"; then
11194         AC_MSG_RESULT([external])
11195         SYSTEM_BSH=TRUE
11196         if test -z $BSH_JAR; then
11197             BSH_JAR=/usr/share/java/bsh.jar
11198         fi
11199         if ! test -f $BSH_JAR; then
11200             AC_MSG_ERROR(bsh.jar not found.)
11201         fi
11202     else
11203         AC_MSG_RESULT([internal])
11204         SYSTEM_BSH=
11205         BUILD_TYPE="$BUILD_TYPE BSH"
11206     fi
11207 else
11208     AC_MSG_RESULT([no])
11209     ENABLE_SCRIPTING_BEANSHELL=
11210     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11212 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11213 AC_SUBST(SYSTEM_BSH)
11214 AC_SUBST(BSH_JAR)
11216 # scripting provider for JavaScript?
11217 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11218 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11219     AC_MSG_RESULT([yes])
11220     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11222     dnl ===================================================================
11223     dnl Check for system rhino
11224     dnl ===================================================================
11225     AC_MSG_CHECKING([which rhino to use])
11226     if test "$with_system_rhino" = "yes"; then
11227         AC_MSG_RESULT([external])
11228         SYSTEM_RHINO=TRUE
11229         if test -z $RHINO_JAR; then
11230             RHINO_JAR=/usr/share/java/js.jar
11231         fi
11232         if ! test -f $RHINO_JAR; then
11233             AC_MSG_ERROR(js.jar not found.)
11234         fi
11235     else
11236         AC_MSG_RESULT([internal])
11237         SYSTEM_RHINO=
11238         BUILD_TYPE="$BUILD_TYPE RHINO"
11239         NEED_ANT=TRUE
11240     fi
11241 else
11242     AC_MSG_RESULT([no])
11243     ENABLE_SCRIPTING_JAVASCRIPT=
11244     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11246 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11247 AC_SUBST(SYSTEM_RHINO)
11248 AC_SUBST(RHINO_JAR)
11250 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11251 # paths should be added to library search path. So lets put all 64-bit
11252 # platforms there.
11253 supports_multilib=
11254 case "$host_cpu" in
11255 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11256     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11257         supports_multilib="yes"
11258     fi
11259     ;;
11261     ;;
11262 esac
11264 dnl ===================================================================
11265 dnl QT5 Integration
11266 dnl ===================================================================
11268 QT5_CFLAGS=""
11269 QT5_LIBS=""
11270 QMAKE5="qmake"
11271 MOC5="moc"
11272 QT5_GOBJECT_CFLAGS=""
11273 QT5_GOBJECT_LIBS=""
11274 QT5_HAVE_GOBJECT=""
11275 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11276         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11277         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11278 then
11279     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11280     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11282     if test -n "$supports_multilib"; then
11283         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11284     fi
11286     qt5_test_include="QtWidgets/qapplication.h"
11287     qt5_test_library="libQt5Widgets.so"
11289     dnl Check for qmake5
11290     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11291     if test "$QMAKE5" = "no"; then
11292         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11293     else
11294         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11295         if test -z "$qmake5_test_ver"; then
11296             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11297         fi
11298         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11299         qt5_minimal_minor="6"
11300         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11301             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11302         else
11303             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11304         fi
11305     fi
11307     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11308     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11310     AC_MSG_CHECKING([for Qt5 headers])
11311     qt5_incdir="no"
11312     for inc_dir in $qt5_incdirs; do
11313         if test -r "$inc_dir/$qt5_test_include"; then
11314             qt5_incdir="$inc_dir"
11315             break
11316         fi
11317     done
11318     AC_MSG_RESULT([$qt5_incdir])
11319     if test "x$qt5_incdir" = "xno"; then
11320         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11321     fi
11323     AC_MSG_CHECKING([for Qt5 libraries])
11324     qt5_libdir="no"
11325     for lib_dir in $qt5_libdirs; do
11326         if test -r "$lib_dir/$qt5_test_library"; then
11327             qt5_libdir="$lib_dir"
11328             break
11329         fi
11330     done
11331     AC_MSG_RESULT([$qt5_libdir])
11332     if test "x$qt5_libdir" = "xno"; then
11333         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11334     fi
11336     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11337     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11338     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11340     if test "$USING_X11" = TRUE; then
11341         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11342         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11343             QT5_HAVE_XCB_ICCCM=1
11344             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11345         ],[
11346             AC_MSG_WARN([XCB ICCCM not found, which is needed for old Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)])
11347             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11348         ])
11349         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11350         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11351         QT5_USING_X11=1
11352         AC_DEFINE(QT5_USING_X11)
11353     fi
11355     dnl Check for Meta Object Compiler
11357     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11358     if test "$MOC5" = "no"; then
11359         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11360 the root of your Qt installation by exporting QT5DIR before running "configure".])
11361     fi
11363     if test "$build_gstreamer_1_0" = "yes"; then
11364         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11365                 QT5_HAVE_GOBJECT=1
11366                 AC_DEFINE(QT5_HAVE_GOBJECT)
11367             ],
11368             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11369         )
11370     fi
11372 AC_SUBST(QT5_CFLAGS)
11373 AC_SUBST(QT5_LIBS)
11374 AC_SUBST(MOC5)
11375 AC_SUBST(QT5_GOBJECT_CFLAGS)
11376 AC_SUBST(QT5_GOBJECT_LIBS)
11377 AC_SUBST(QT5_HAVE_GOBJECT)
11379 dnl ===================================================================
11380 dnl KF5 Integration
11381 dnl ===================================================================
11383 KF5_CFLAGS=""
11384 KF5_LIBS=""
11385 KF5_CONFIG="kf5-config"
11386 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11387         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11388 then
11389     if test "$OS" = "HAIKU"; then
11390         haiku_arch="`echo $RTL_ARCH | tr X x`"
11391         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11392         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11393     fi
11395     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11396     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11397     if test -n "$supports_multilib"; then
11398         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11399     fi
11401     kf5_test_include="KF5/kcoreaddons_version.h"
11402     kf5_test_library="libKF5CoreAddons.so"
11403     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11405     dnl kf5 KDE4 support compatibility installed
11406     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11407     if test "$KF5_CONFIG" != "no"; then
11408         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11409         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11410     fi
11412     dnl Check for KF5 headers
11413     AC_MSG_CHECKING([for KF5 headers])
11414     kf5_incdir="no"
11415     for kf5_check in $kf5_incdirs; do
11416         if test -r "$kf5_check/$kf5_test_include"; then
11417             kf5_incdir="$kf5_check/KF5"
11418             break
11419         fi
11420     done
11421     AC_MSG_RESULT([$kf5_incdir])
11422     if test "x$kf5_incdir" = "xno"; then
11423         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11424     fi
11426     dnl Check for KF5 libraries
11427     AC_MSG_CHECKING([for KF5 libraries])
11428     kf5_libdir="no"
11429     for kf5_check in $kf5_libdirs; do
11430         if test -r "$kf5_check/$kf5_test_library"; then
11431             kf5_libdir="$kf5_check"
11432             break
11433         fi
11434     done
11436     AC_MSG_RESULT([$kf5_libdir])
11437     if test "x$kf5_libdir" = "xno"; then
11438         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11439     fi
11441     KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$kf5_incdir/KIOWidgets -I$kf5_incdir/KIOFileWidgets -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11442     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11443     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11445     if test "$USING_X11" = TRUE; then
11446         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11447     fi
11449     AC_LANG_PUSH([C++])
11450     save_CXXFLAGS=$CXXFLAGS
11451     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11452     AC_MSG_CHECKING([whether KDE is >= 5.0])
11453        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11454 #include <kcoreaddons_version.h>
11456 int main(int argc, char **argv) {
11457        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11458        else return 1;
11460        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11461     CXXFLAGS=$save_CXXFLAGS
11462     AC_LANG_POP([C++])
11464 AC_SUBST(KF5_CFLAGS)
11465 AC_SUBST(KF5_LIBS)
11467 dnl ===================================================================
11468 dnl Test whether to include Evolution 2 support
11469 dnl ===================================================================
11470 AC_MSG_CHECKING([whether to enable evolution 2 support])
11471 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11472     AC_MSG_RESULT([yes])
11473     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11474     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11475     FilterLibs "${GOBJECT_LIBS}"
11476     GOBJECT_LIBS="${filteredlibs}"
11477     ENABLE_EVOAB2="TRUE"
11478 else
11479     ENABLE_EVOAB2=""
11480     AC_MSG_RESULT([no])
11482 AC_SUBST(ENABLE_EVOAB2)
11483 AC_SUBST(GOBJECT_CFLAGS)
11484 AC_SUBST(GOBJECT_LIBS)
11486 dnl ===================================================================
11487 dnl Test which themes to include
11488 dnl ===================================================================
11489 AC_MSG_CHECKING([which themes to include])
11490 # if none given use default subset of available themes
11491 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11492     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark tango"
11495 WITH_THEMES=""
11496 if test "x$with_theme" != "xno"; then
11497     for theme in $with_theme; do
11498         case $theme in
11499         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|tango) real_theme="$theme" ;;
11500         default) real_theme=colibre ;;
11501         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11502         esac
11503         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11504     done
11506 AC_MSG_RESULT([$WITH_THEMES])
11507 AC_SUBST([WITH_THEMES])
11508 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11509 for theme in $with_theme; do
11510     case $theme in
11511     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11512     *) ;;
11513     esac
11514 done
11516 dnl ===================================================================
11517 dnl Test whether to integrate helppacks into the product's installer
11518 dnl ===================================================================
11519 AC_MSG_CHECKING([for helppack integration])
11520 if test "$with_helppack_integration" = "no"; then
11521     AC_MSG_RESULT([no integration])
11522 else
11523     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11524     AC_MSG_RESULT([integration])
11527 ###############################################################################
11528 # Extensions checking
11529 ###############################################################################
11530 AC_MSG_CHECKING([for extensions integration])
11531 if test "x$enable_extension_integration" != "xno"; then
11532     WITH_EXTENSION_INTEGRATION=TRUE
11533     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11534     AC_MSG_RESULT([yes, use integration])
11535 else
11536     WITH_EXTENSION_INTEGRATION=
11537     AC_MSG_RESULT([no, do not integrate])
11539 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11541 dnl Should any extra extensions be included?
11542 dnl There are standalone tests for each of these below.
11543 WITH_EXTRA_EXTENSIONS=
11544 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11546 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11547 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11548 if test "x$with_java" != "xno"; then
11549     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11550     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11553 AC_MSG_CHECKING([whether to build opens___.ttf])
11554 if test "$enable_build_opensymbol" = "yes"; then
11555     AC_MSG_RESULT([yes])
11556     AC_PATH_PROG(FONTFORGE, fontforge)
11557     if test -z "$FONTFORGE"; then
11558         AC_MSG_ERROR([fontforge not installed])
11559     fi
11560 else
11561     AC_MSG_RESULT([no])
11562     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11563     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11565 AC_SUBST(OPENSYMBOL_TTF)
11566 AC_SUBST(FONTFORGE)
11568 dnl ===================================================================
11569 dnl Test whether to include fonts
11570 dnl ===================================================================
11571 AC_MSG_CHECKING([whether to include third-party fonts])
11572 if test "$with_fonts" != "no"; then
11573     AC_MSG_RESULT([yes])
11574     WITH_FONTS=TRUE
11575     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11576     AC_DEFINE(HAVE_MORE_FONTS)
11577 else
11578     AC_MSG_RESULT([no])
11579     WITH_FONTS=
11580     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11582 AC_SUBST(WITH_FONTS)
11585 dnl ===================================================================
11586 dnl Test whether to enable online update service
11587 dnl ===================================================================
11588 AC_MSG_CHECKING([whether to enable online update])
11589 ENABLE_ONLINE_UPDATE=
11590 ENABLE_ONLINE_UPDATE_MAR=
11591 UPDATE_CONFIG=
11592 if test "$enable_online_update" = ""; then
11593     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11594         AC_MSG_RESULT([yes])
11595         ENABLE_ONLINE_UPDATE="TRUE"
11596     else
11597         AC_MSG_RESULT([no])
11598     fi
11599 else
11600     if test "$enable_online_update" = "mar"; then
11601         AC_MSG_RESULT([yes - MAR-based online update])
11602         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11603         if test "$with_update_config" = ""; then
11604             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11605         fi
11606         UPDATE_CONFIG="$with_update_config"
11607         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11608     elif test "$enable_online_update" = "yes"; then
11609         AC_MSG_RESULT([yes])
11610         ENABLE_ONLINE_UPDATE="TRUE"
11611     else
11612         AC_MSG_RESULT([no])
11613     fi
11615 AC_SUBST(ENABLE_ONLINE_UPDATE)
11616 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11617 AC_SUBST(UPDATE_CONFIG)
11619 dnl ===================================================================
11620 dnl Test whether we need bzip2
11621 dnl ===================================================================
11622 SYSTEM_BZIP2=
11623 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11624     AC_MSG_CHECKING([whether to use system bzip2])
11625     if test "$with_system_bzip2" = yes; then
11626         SYSTEM_BZIP2=TRUE
11627         AC_MSG_RESULT([yes])
11628         PKG_CHECK_MODULES(BZIP2, bzip2)
11629         FilterLibs "${BZIP2_LIBS}"
11630         BZIP2_LIBS="${filteredlibs}"
11631     else
11632         AC_MSG_RESULT([no])
11633         BUILD_TYPE="$BUILD_TYPE BZIP2"
11634     fi
11636 AC_SUBST(SYSTEM_BZIP2)
11637 AC_SUBST(BZIP2_CFLAGS)
11638 AC_SUBST(BZIP2_LIBS)
11640 dnl ===================================================================
11641 dnl Test whether to enable extension update
11642 dnl ===================================================================
11643 AC_MSG_CHECKING([whether to enable extension update])
11644 ENABLE_EXTENSION_UPDATE=
11645 if test "x$enable_extension_update" = "xno"; then
11646     AC_MSG_RESULT([no])
11647 else
11648     AC_MSG_RESULT([yes])
11649     ENABLE_EXTENSION_UPDATE="TRUE"
11650     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11651     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11653 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11656 dnl ===================================================================
11657 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11658 dnl ===================================================================
11659 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11660 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11661     AC_MSG_RESULT([no])
11662     ENABLE_SILENT_MSI=
11663 else
11664     AC_MSG_RESULT([yes])
11665     ENABLE_SILENT_MSI=TRUE
11666     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11668 AC_SUBST(ENABLE_SILENT_MSI)
11670 AC_MSG_CHECKING([whether and how to use Xinerama])
11671 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11672     if test "$x_libraries" = "default_x_libraries"; then
11673         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11674         if test "x$XINERAMALIB" = x; then
11675            XINERAMALIB="/usr/lib"
11676         fi
11677     else
11678         XINERAMALIB="$x_libraries"
11679     fi
11680     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11681         # we have both versions, let the user decide but use the dynamic one
11682         # per default
11683         USE_XINERAMA=TRUE
11684         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11685             XINERAMA_LINK=dynamic
11686         else
11687             XINERAMA_LINK=static
11688         fi
11689     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11690         # we have only the dynamic version
11691         USE_XINERAMA=TRUE
11692         XINERAMA_LINK=dynamic
11693     elif test -e "$XINERAMALIB/libXinerama.a"; then
11694         # static version
11695         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11696             USE_XINERAMA=TRUE
11697             XINERAMA_LINK=static
11698         else
11699             USE_XINERAMA=
11700             XINERAMA_LINK=none
11701         fi
11702     else
11703         # no Xinerama
11704         USE_XINERAMA=
11705         XINERAMA_LINK=none
11706     fi
11707     if test "$USE_XINERAMA" = "TRUE"; then
11708         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11709         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11710             [AC_MSG_ERROR(Xinerama header not found.)], [])
11711         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11712         if test "x$XEXTLIB" = x; then
11713            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11714         fi
11715         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11716         if test "$_os" = "FreeBSD"; then
11717             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11718         fi
11719         if test "$_os" = "Linux"; then
11720             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11721         fi
11722         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11723             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11724     else
11725         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11726     fi
11727 else
11728     USE_XINERAMA=
11729     XINERAMA_LINK=none
11730     AC_MSG_RESULT([no])
11732 AC_SUBST(USE_XINERAMA)
11733 AC_SUBST(XINERAMA_LINK)
11735 dnl ===================================================================
11736 dnl Test whether to build cairo or rely on the system version
11737 dnl ===================================================================
11739 if test "$USING_X11" = TRUE; then
11740     # Used in vcl/Library_vclplug_gen.mk
11741     test_cairo=yes
11744 if test "$test_cairo" = "yes"; then
11745     AC_MSG_CHECKING([whether to use the system cairo])
11747     : ${with_system_cairo:=$with_system_libs}
11748     if test "$with_system_cairo" = "yes"; then
11749         SYSTEM_CAIRO=TRUE
11750         AC_MSG_RESULT([yes])
11752         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11753         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11754         FilterLibs "${CAIRO_LIBS}"
11755         CAIRO_LIBS="${filteredlibs}"
11757         if test "$test_xrender" = "yes"; then
11758             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11759             AC_LANG_PUSH([C])
11760             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11761 #ifdef PictStandardA8
11762 #else
11763       return fail;
11764 #endif
11765 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11767             AC_LANG_POP([C])
11768         fi
11769     else
11770         SYSTEM_CAIRO=
11771         AC_MSG_RESULT([no])
11773         BUILD_TYPE="$BUILD_TYPE CAIRO"
11774     fi
11777 AC_SUBST(SYSTEM_CAIRO)
11778 AC_SUBST(CAIRO_CFLAGS)
11779 AC_SUBST(CAIRO_LIBS)
11781 dnl ===================================================================
11782 dnl Test whether to use avahi
11783 dnl ===================================================================
11784 if test "$_os" = "WINNT"; then
11785     # Windows uses bundled mDNSResponder
11786     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11787 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11788     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11789                       [ENABLE_AVAHI="TRUE"])
11790     AC_DEFINE(HAVE_FEATURE_AVAHI)
11791     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11792     FilterLibs "${AVAHI_LIBS}"
11793     AVAHI_LIBS="${filteredlibs}"
11796 AC_SUBST(ENABLE_AVAHI)
11797 AC_SUBST(AVAHI_CFLAGS)
11798 AC_SUBST(AVAHI_LIBS)
11800 dnl ===================================================================
11801 dnl Test whether to use liblangtag
11802 dnl ===================================================================
11803 SYSTEM_LIBLANGTAG=
11804 AC_MSG_CHECKING([whether to use system liblangtag])
11805 if test "$with_system_liblangtag" = yes; then
11806     SYSTEM_LIBLANGTAG=TRUE
11807     AC_MSG_RESULT([yes])
11808     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11809     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11810     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11811     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11812     FilterLibs "${LIBLANGTAG_LIBS}"
11813     LIBLANGTAG_LIBS="${filteredlibs}"
11814 else
11815     SYSTEM_LIBLANGTAG=
11816     AC_MSG_RESULT([no])
11817     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11818     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11819     if test "$COM" = "MSC"; then
11820         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11821     else
11822         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11823     fi
11825 AC_SUBST(SYSTEM_LIBLANGTAG)
11826 AC_SUBST(LIBLANGTAG_CFLAGS)
11827 AC_SUBST(LIBLANGTAG_LIBS)
11829 dnl ===================================================================
11830 dnl Test whether to build libpng or rely on the system version
11831 dnl ===================================================================
11833 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11835 dnl ===================================================================
11836 dnl Check for runtime JVM search path
11837 dnl ===================================================================
11838 if test "$ENABLE_JAVA" != ""; then
11839     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11840     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11841         AC_MSG_RESULT([yes])
11842         if ! test -d "$with_jvm_path"; then
11843             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11844         fi
11845         if ! test -d "$with_jvm_path"jvm; then
11846             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11847         fi
11848         JVM_ONE_PATH_CHECK="$with_jvm_path"
11849         AC_SUBST(JVM_ONE_PATH_CHECK)
11850     else
11851         AC_MSG_RESULT([no])
11852     fi
11855 dnl ===================================================================
11856 dnl Test for the presence of Ant and that it works
11857 dnl ===================================================================
11859 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11860     ANT_HOME=; export ANT_HOME
11861     WITH_ANT_HOME=; export WITH_ANT_HOME
11862     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11863         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11864             if test "$_os" = "WINNT"; then
11865                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11866             else
11867                 with_ant_home="$LODE_HOME/opt/ant"
11868             fi
11869         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11870             with_ant_home="$LODE_HOME/opt/ant"
11871         fi
11872     fi
11873     if test -z "$with_ant_home"; then
11874         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11875     else
11876         if test "$_os" = "WINNT"; then
11877             # AC_PATH_PROGS needs unix path
11878             with_ant_home=`cygpath -u "$with_ant_home"`
11879         fi
11880         AbsolutePath "$with_ant_home"
11881         with_ant_home=$absolute_path
11882         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11883         WITH_ANT_HOME=$with_ant_home
11884         ANT_HOME=$with_ant_home
11885     fi
11887     if test -z "$ANT"; then
11888         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11889     else
11890         # resolve relative or absolute symlink
11891         while test -h "$ANT"; do
11892             a_cwd=`pwd`
11893             a_basename=`basename "$ANT"`
11894             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11895             cd "`dirname "$ANT"`"
11896             cd "`dirname "$a_script"`"
11897             ANT="`pwd`"/"`basename "$a_script"`"
11898             cd "$a_cwd"
11899         done
11901         AC_MSG_CHECKING([if $ANT works])
11902         mkdir -p conftest.dir
11903         a_cwd=$(pwd)
11904         cd conftest.dir
11905         cat > conftest.java << EOF
11906         public class conftest {
11907             int testmethod(int a, int b) {
11908                     return a + b;
11909             }
11910         }
11913         cat > conftest.xml << EOF
11914         <project name="conftest" default="conftest">
11915         <target name="conftest">
11916             <javac srcdir="." includes="conftest.java">
11917             </javac>
11918         </target>
11919         </project>
11922         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11923         if test $? = 0 -a -f ./conftest.class; then
11924             AC_MSG_RESULT([Ant works])
11925             if test -z "$WITH_ANT_HOME"; then
11926                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11927                 if test -z "$ANT_HOME"; then
11928                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11929                 fi
11930             else
11931                 ANT_HOME="$WITH_ANT_HOME"
11932             fi
11933         else
11934             echo "configure: Ant test failed" >&5
11935             cat conftest.java >&5
11936             cat conftest.xml >&5
11937             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11938         fi
11939         cd "$a_cwd"
11940         rm -fr conftest.dir
11941     fi
11942     if test -z "$ANT_HOME"; then
11943         ANT_HOME="NO_ANT_HOME"
11944     else
11945         PathFormat "$ANT_HOME"
11946         ANT_HOME="$formatted_path"
11947         PathFormat "$ANT"
11948         ANT="$formatted_path"
11949     fi
11950     AC_SUBST(ANT_HOME)
11951     AC_SUBST(ANT)
11953     dnl Checking for ant.jar
11954     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11955         AC_MSG_CHECKING([Ant lib directory])
11956         if test -f $ANT_HOME/lib/ant.jar; then
11957             ANT_LIB="$ANT_HOME/lib"
11958         else
11959             if test -f $ANT_HOME/ant.jar; then
11960                 ANT_LIB="$ANT_HOME"
11961             else
11962                 if test -f /usr/share/java/ant.jar; then
11963                     ANT_LIB=/usr/share/java
11964                 else
11965                     if test -f /usr/share/ant-core/lib/ant.jar; then
11966                         ANT_LIB=/usr/share/ant-core/lib
11967                     else
11968                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11969                             ANT_LIB="$ANT_HOME/lib/ant"
11970                         else
11971                             if test -f /usr/share/lib/ant/ant.jar; then
11972                                 ANT_LIB=/usr/share/lib/ant
11973                             else
11974                                 AC_MSG_ERROR([Ant libraries not found!])
11975                             fi
11976                         fi
11977                     fi
11978                 fi
11979             fi
11980         fi
11981         PathFormat "$ANT_LIB"
11982         ANT_LIB="$formatted_path"
11983         AC_MSG_RESULT([Ant lib directory found.])
11984     fi
11985     AC_SUBST(ANT_LIB)
11987     ant_minver=1.6.0
11988     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11990     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11991     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
11992     ant_version_major=`echo $ant_version | cut -d. -f1`
11993     ant_version_minor=`echo $ant_version | cut -d. -f2`
11994     echo "configure: ant_version $ant_version " >&5
11995     echo "configure: ant_version_major $ant_version_major " >&5
11996     echo "configure: ant_version_minor $ant_version_minor " >&5
11997     if test "$ant_version_major" -ge "2"; then
11998         AC_MSG_RESULT([yes, $ant_version])
11999     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12000         AC_MSG_RESULT([yes, $ant_version])
12001     else
12002         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12003     fi
12005     rm -f conftest* core core.* *.core
12008 OOO_JUNIT_JAR=
12009 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12010     AC_MSG_CHECKING([for JUnit 4])
12011     if test "$with_junit" = "yes"; then
12012         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12013             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12014         elif test -e /usr/share/java/junit4.jar; then
12015             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12016         else
12017            if test -e /usr/share/lib/java/junit.jar; then
12018               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12019            else
12020               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12021            fi
12022         fi
12023     else
12024         OOO_JUNIT_JAR=$with_junit
12025     fi
12026     if test "$_os" = "WINNT"; then
12027         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12028     fi
12029     printf 'import org.junit.Before;' > conftest.java
12030     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12031         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12032     else
12033         AC_MSG_ERROR(
12034 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12035  specify its pathname via --with-junit=..., or disable it via --without-junit])
12036     fi
12037     rm -f conftest.class conftest.java
12038     if test $OOO_JUNIT_JAR != ""; then
12039     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12040     fi
12042 AC_SUBST(OOO_JUNIT_JAR)
12044 HAMCREST_JAR=
12045 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12046     AC_MSG_CHECKING([for included Hamcrest])
12047     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12048     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12049         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12050     else
12051         AC_MSG_RESULT([Not included])
12052         AC_MSG_CHECKING([for standalone hamcrest jar.])
12053         if test "$with_hamcrest" = "yes"; then
12054             if test -e /usr/share/lib/java/hamcrest.jar; then
12055                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12056             elif test -e /usr/share/java/hamcrest/core.jar; then
12057                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12058             else
12059                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12060             fi
12061         else
12062             HAMCREST_JAR=$with_hamcrest
12063         fi
12064         if test "$_os" = "WINNT"; then
12065             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12066         fi
12067         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12068             AC_MSG_RESULT([$HAMCREST_JAR])
12069         else
12070             AC_MSG_ERROR([junit does not contain hamcrest; please use a junit jar that includes hamcrest, install a hamcrest jar in the default location (/usr/share/java),
12071                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12072         fi
12073     fi
12074     rm -f conftest.class conftest.java
12076 AC_SUBST(HAMCREST_JAR)
12079 AC_SUBST(SCPDEFS)
12082 # check for wget and curl
12084 WGET=
12085 CURL=
12087 if test "$enable_fetch_external" != "no"; then
12089 CURL=`which curl 2>/dev/null`
12091 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12092     # wget new enough?
12093     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12094     if test $? -eq 0; then
12095         WGET=$i
12096         break
12097     fi
12098 done
12100 if test -z "$WGET" -a -z "$CURL"; then
12101     AC_MSG_ERROR([neither wget nor curl found!])
12106 AC_SUBST(WGET)
12107 AC_SUBST(CURL)
12110 # check for sha256sum
12112 SHA256SUM=
12114 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12115     eval "$i -a 256 --version" > /dev/null 2>&1
12116     ret=$?
12117     if test $ret -eq 0; then
12118         SHA256SUM="$i -a 256"
12119         break
12120     fi
12121 done
12123 if test -z "$SHA256SUM"; then
12124     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12125         eval "$i --version" > /dev/null 2>&1
12126         ret=$?
12127         if test $ret -eq 0; then
12128             SHA256SUM=$i
12129             break
12130         fi
12131     done
12134 if test -z "$SHA256SUM"; then
12135     AC_MSG_ERROR([no sha256sum found!])
12138 AC_SUBST(SHA256SUM)
12140 dnl ===================================================================
12141 dnl Dealing with l10n options
12142 dnl ===================================================================
12143 AC_MSG_CHECKING([which languages to be built])
12144 # get list of all languages
12145 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12146 # the sed command does the following:
12147 #   + if a line ends with a backslash, append the next line to it
12148 #   + adds " on the beginning of the value (after =)
12149 #   + adds " at the end of the value
12150 #   + removes en-US; we want to put it on the beginning
12151 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12152 [eval $(sed -e :a -e '/\\$/N; s/\\\n//; ta' -n -e 's/=/="/;s/\([^\\]\)$/\1"/;s/en-US//;/^completelangiso/p' $SRC_ROOT/solenv/inc/langlist.mk)]
12153 ALL_LANGS="en-US $completelangiso"
12154 # check the configured localizations
12155 WITH_LANG="$with_lang"
12157 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12158 # (Norwegian is "nb" and "nn".)
12159 if test "$WITH_LANG" = "no"; then
12160     WITH_LANG=
12163 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12164     AC_MSG_RESULT([en-US])
12165 else
12166     AC_MSG_RESULT([$WITH_LANG])
12167     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12168     if test -z "$MSGFMT"; then
12169         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12170             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12171         elif test -x "/opt/lo/bin/msgfmt"; then
12172             MSGFMT="/opt/lo/bin/msgfmt"
12173         else
12174             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12175             if test -z "$MSGFMT"; then
12176                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12177             fi
12178         fi
12179     fi
12180     if test -z "$MSGUNIQ"; then
12181         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12182             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12183         elif test -x "/opt/lo/bin/msguniq"; then
12184             MSGUNIQ="/opt/lo/bin/msguniq"
12185         else
12186             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12187             if test -z "$MSGUNIQ"; then
12188                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12189             fi
12190         fi
12191     fi
12193 AC_SUBST(MSGFMT)
12194 AC_SUBST(MSGUNIQ)
12195 # check that the list is valid
12196 for lang in $WITH_LANG; do
12197     test "$lang" = "ALL" && continue
12198     # need to check for the exact string, so add space before and after the list of all languages
12199     for vl in $ALL_LANGS; do
12200         if test "$vl" = "$lang"; then
12201            break
12202         fi
12203     done
12204     if test "$vl" != "$lang"; then
12205         # if you're reading this - you prolly quoted your languages remove the quotes ...
12206         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12207     fi
12208 done
12209 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12210     echo $WITH_LANG | grep -q en-US
12211     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12213 # list with substituted ALL
12214 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12215 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12216 test "$WITH_LANG" = "en-US" && WITH_LANG=
12217 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12218     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12219     ALL_LANGS=`echo $ALL_LANGS qtz`
12221 AC_SUBST(ALL_LANGS)
12222 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12223 AC_SUBST(WITH_LANG)
12224 AC_SUBST(WITH_LANG_LIST)
12225 AC_SUBST(GIT_NEEDED_SUBMODULES)
12227 WITH_POOR_HELP_LOCALIZATIONS=
12228 if test -d "$SRC_ROOT/translations/source"; then
12229     for l in `ls -1 $SRC_ROOT/translations/source`; do
12230         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12231             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12232         fi
12233     done
12235 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12237 if test -n "$with_locales"; then
12238     WITH_LOCALES="$with_locales"
12240     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12241     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12242     # config_host/config_locales.h.in
12243     for locale in $WITH_LOCALES; do
12244         lang=${locale%_*}
12246         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12248         case $lang in
12249         hi|mr*ne)
12250             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12251             ;;
12252         bg|ru)
12253             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12254             ;;
12255         esac
12256     done
12257 else
12258     AC_DEFINE(WITH_LOCALE_ALL)
12260 AC_SUBST(WITH_LOCALES)
12262 dnl git submodule update --reference
12263 dnl ===================================================================
12264 if test -n "${GIT_REFERENCE_SRC}"; then
12265     for repo in ${GIT_NEEDED_SUBMODULES}; do
12266         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12267             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12268         fi
12269     done
12271 AC_SUBST(GIT_REFERENCE_SRC)
12273 dnl git submodules linked dirs
12274 dnl ===================================================================
12275 if test -n "${GIT_LINK_SRC}"; then
12276     for repo in ${GIT_NEEDED_SUBMODULES}; do
12277         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12278             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12279         fi
12280     done
12282 AC_SUBST(GIT_LINK_SRC)
12284 dnl branding
12285 dnl ===================================================================
12286 AC_MSG_CHECKING([for alternative branding images directory])
12287 # initialize mapped arrays
12288 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12289 brand_files="$BRAND_INTRO_IMAGES about.svg"
12291 if test -z "$with_branding" -o "$with_branding" = "no"; then
12292     AC_MSG_RESULT([none])
12293     DEFAULT_BRAND_IMAGES="$brand_files"
12294 else
12295     if ! test -d $with_branding ; then
12296         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12297     else
12298         AC_MSG_RESULT([$with_branding])
12299         CUSTOM_BRAND_DIR="$with_branding"
12300         for lfile in $brand_files
12301         do
12302             if ! test -f $with_branding/$lfile ; then
12303                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12304                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12305             else
12306                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12307             fi
12308         done
12309         check_for_progress="yes"
12310     fi
12312 AC_SUBST([BRAND_INTRO_IMAGES])
12313 AC_SUBST([CUSTOM_BRAND_DIR])
12314 AC_SUBST([CUSTOM_BRAND_IMAGES])
12315 AC_SUBST([DEFAULT_BRAND_IMAGES])
12318 AC_MSG_CHECKING([for 'intro' progress settings])
12319 PROGRESSBARCOLOR=
12320 PROGRESSSIZE=
12321 PROGRESSPOSITION=
12322 PROGRESSFRAMECOLOR=
12323 PROGRESSTEXTCOLOR=
12324 PROGRESSTEXTBASELINE=
12326 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12327     source "$with_branding/progress.conf"
12328     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12329 else
12330     AC_MSG_RESULT([none])
12333 AC_SUBST(PROGRESSBARCOLOR)
12334 AC_SUBST(PROGRESSSIZE)
12335 AC_SUBST(PROGRESSPOSITION)
12336 AC_SUBST(PROGRESSFRAMECOLOR)
12337 AC_SUBST(PROGRESSTEXTCOLOR)
12338 AC_SUBST(PROGRESSTEXTBASELINE)
12341 AC_MSG_CHECKING([for extra build ID])
12342 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12343     EXTRA_BUILDID="$with_extra_buildid"
12345 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12346 if test -n "$EXTRA_BUILDID" ; then
12347     AC_MSG_RESULT([$EXTRA_BUILDID])
12348 else
12349     AC_MSG_RESULT([not set])
12351 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12353 OOO_VENDOR=
12354 AC_MSG_CHECKING([for vendor])
12355 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12356     OOO_VENDOR="$USERNAME"
12358     if test -z "$OOO_VENDOR"; then
12359         OOO_VENDOR="$USER"
12360     fi
12362     if test -z "$OOO_VENDOR"; then
12363         OOO_VENDOR="`id -u -n`"
12364     fi
12366     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12367 else
12368     OOO_VENDOR="$with_vendor"
12369     AC_MSG_RESULT([$OOO_VENDOR])
12371 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12372 AC_SUBST(OOO_VENDOR)
12374 if test "$_os" = "Android" ; then
12375     ANDROID_PACKAGE_NAME=
12376     AC_MSG_CHECKING([for Android package name])
12377     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12378         if test -n "$ENABLE_DEBUG"; then
12379             # Default to the package name that makes ndk-gdb happy.
12380             ANDROID_PACKAGE_NAME="org.libreoffice"
12381         else
12382             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12383         fi
12385         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12386     else
12387         ANDROID_PACKAGE_NAME="$with_android_package_name"
12388         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12389     fi
12390     AC_SUBST(ANDROID_PACKAGE_NAME)
12393 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12394 if test "$with_compat_oowrappers" = "yes"; then
12395     WITH_COMPAT_OOWRAPPERS=TRUE
12396     AC_MSG_RESULT(yes)
12397 else
12398     WITH_COMPAT_OOWRAPPERS=
12399     AC_MSG_RESULT(no)
12401 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12403 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12404 AC_MSG_CHECKING([for install dirname])
12405 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12406     INSTALLDIRNAME="$with_install_dirname"
12408 AC_MSG_RESULT([$INSTALLDIRNAME])
12409 AC_SUBST(INSTALLDIRNAME)
12411 AC_MSG_CHECKING([for prefix])
12412 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12413 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12414 PREFIXDIR="$prefix"
12415 AC_MSG_RESULT([$PREFIXDIR])
12416 AC_SUBST(PREFIXDIR)
12418 LIBDIR=[$(eval echo $(eval echo $libdir))]
12419 AC_SUBST(LIBDIR)
12421 DATADIR=[$(eval echo $(eval echo $datadir))]
12422 AC_SUBST(DATADIR)
12424 MANDIR=[$(eval echo $(eval echo $mandir))]
12425 AC_SUBST(MANDIR)
12427 DOCDIR=[$(eval echo $(eval echo $docdir))]
12428 AC_SUBST(DOCDIR)
12430 BINDIR=[$(eval echo $(eval echo $bindir))]
12431 AC_SUBST(BINDIR)
12433 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12434 AC_SUBST(INSTALLDIR)
12436 TESTINSTALLDIR="${BUILDDIR}/test-install"
12437 AC_SUBST(TESTINSTALLDIR)
12440 # ===================================================================
12441 # OAuth2 id and secrets
12442 # ===================================================================
12444 AC_MSG_CHECKING([for Google Drive client id and secret])
12445 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12446     AC_MSG_RESULT([not set])
12447     GDRIVE_CLIENT_ID="\"\""
12448     GDRIVE_CLIENT_SECRET="\"\""
12449 else
12450     AC_MSG_RESULT([set])
12451     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12452     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12454 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12455 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12457 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12458 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12459     AC_MSG_RESULT([not set])
12460     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12461     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12462 else
12463     AC_MSG_RESULT([set])
12464     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12465     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12467 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12468 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12470 AC_MSG_CHECKING([for OneDrive client id and secret])
12471 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12472     AC_MSG_RESULT([not set])
12473     ONEDRIVE_CLIENT_ID="\"\""
12474     ONEDRIVE_CLIENT_SECRET="\"\""
12475 else
12476     AC_MSG_RESULT([set])
12477     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12478     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12480 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12481 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12484 dnl ===================================================================
12485 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12486 dnl --enable-dependency-tracking configure option
12487 dnl ===================================================================
12488 AC_MSG_CHECKING([whether to enable dependency tracking])
12489 if test "$enable_dependency_tracking" = "no"; then
12490     nodep=TRUE
12491     AC_MSG_RESULT([no])
12492 else
12493     AC_MSG_RESULT([yes])
12495 AC_SUBST(nodep)
12497 dnl ===================================================================
12498 dnl Number of CPUs to use during the build
12499 dnl ===================================================================
12500 AC_MSG_CHECKING([for number of processors to use])
12501 # plain --with-parallelism is just the default
12502 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12503     if test "$with_parallelism" = "no"; then
12504         PARALLELISM=0
12505     else
12506         PARALLELISM=$with_parallelism
12507     fi
12508 else
12509     if test "$enable_icecream" = "yes"; then
12510         PARALLELISM="40"
12511     else
12512         case `uname -s` in
12514         Darwin|FreeBSD|NetBSD|OpenBSD)
12515             PARALLELISM=`sysctl -n hw.ncpu`
12516             ;;
12518         Linux)
12519             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12520         ;;
12521         # what else than above does profit here *and* has /proc?
12522         *)
12523             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12524             ;;
12525         esac
12527         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12528         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12529     fi
12532 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12533     if test -z "$with_parallelism"; then
12534             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12535             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12536             PARALLELISM="1"
12537     else
12538         add_warning "make 3.81 is prone to crashes with parallelism > 1. Since --with-parallelism was explicitly given, it is honored, but do not complain when make segfaults on you."
12539     fi
12542 if test $PARALLELISM -eq 0; then
12543     AC_MSG_RESULT([explicit make -j option needed])
12544 else
12545     AC_MSG_RESULT([$PARALLELISM])
12547 AC_SUBST(PARALLELISM)
12549 IWYU_PATH="$with_iwyu"
12550 AC_SUBST(IWYU_PATH)
12551 if test ! -z "$IWYU_PATH"; then
12552     if test ! -f "$IWYU_PATH"; then
12553         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12554     fi
12558 # Set up ILIB for MSVC build
12560 ILIB1=
12561 if test "$build_os" = "cygwin"; then
12562     ILIB="."
12563     if test -n "$JAVA_HOME"; then
12564         ILIB="$ILIB;$JAVA_HOME/lib"
12565     fi
12566     ILIB1=-link
12567     if test "$BITNESS_OVERRIDE" = 64; then
12568         ILIB="$ILIB;$COMPATH/lib/x64"
12569         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12570         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12571         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12572         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12573             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12574             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12575         fi
12576         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12577         ucrtlibpath_formatted=$formatted_path
12578         ILIB="$ILIB;$ucrtlibpath_formatted"
12579         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12580     else
12581         ILIB="$ILIB;$COMPATH/lib/x86"
12582         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12583         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12584         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12585         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12586             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12587             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12588         fi
12589         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12590         ucrtlibpath_formatted=$formatted_path
12591         ILIB="$ILIB;$ucrtlibpath_formatted"
12592         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12593     fi
12594     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12595         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12596     else
12597         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12598     fi
12600     AC_SUBST(ILIB)
12603 # ===================================================================
12604 # Creating bigger shared library to link against
12605 # ===================================================================
12606 AC_MSG_CHECKING([whether to create huge library])
12607 MERGELIBS=
12609 if test $_os = iOS -o $_os = Android; then
12610     # Never any point in mergelibs for these as we build just static
12611     # libraries anyway...
12612     enable_mergelibs=no
12615 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12616     if test $_os != Linux -a $_os != WINNT; then
12617         add_warning "--enable-mergelibs is not tested for this platform"
12618     fi
12619     MERGELIBS="TRUE"
12620     AC_MSG_RESULT([yes])
12621 else
12622     AC_MSG_RESULT([no])
12624 AC_SUBST([MERGELIBS])
12626 dnl ===================================================================
12627 dnl icerun is a wrapper that stops us spawning tens of processes
12628 dnl locally - for tools that can't be executed on the compile cluster
12629 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12630 dnl ===================================================================
12631 AC_MSG_CHECKING([whether to use icerun wrapper])
12632 ICECREAM_RUN=
12633 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12634     ICECREAM_RUN=icerun
12635     AC_MSG_RESULT([yes])
12636 else
12637     AC_MSG_RESULT([no])
12639 AC_SUBST(ICECREAM_RUN)
12641 dnl ===================================================================
12642 dnl Setup the ICECC_VERSION for the build the same way it was set for
12643 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12644 dnl ===================================================================
12645 x_ICECC_VERSION=[\#]
12646 if test -n "$ICECC_VERSION" ; then
12647     x_ICECC_VERSION=
12649 AC_SUBST(x_ICECC_VERSION)
12650 AC_SUBST(ICECC_VERSION)
12652 dnl ===================================================================
12654 AC_MSG_CHECKING([MPL subset])
12655 MPL_SUBSET=
12657 if test "$enable_mpl_subset" = "yes"; then
12658     warn_report=false
12659     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12660         warn_report=true
12661     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12662         warn_report=true
12663     fi
12664     if test "$warn_report" = "true"; then
12665         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12666     fi
12667     if test "x$enable_postgresql_sdbc" != "xno"; then
12668         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12669     fi
12670     if test "$enable_lotuswordpro" = "yes"; then
12671         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12672     fi
12673     if test "$WITH_WEBDAV" = "neon"; then
12674         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12675     fi
12676     if test -n "$ENABLE_POPPLER"; then
12677         if test "x$SYSTEM_POPPLER" = "x"; then
12678             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12679         fi
12680     fi
12681     # cf. m4/libo_check_extension.m4
12682     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12683         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12684     fi
12685     for theme in $WITH_THEMES; do
12686         case $theme in
12687         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12688             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12689         *) : ;;
12690         esac
12691     done
12693     ENABLE_OPENGL_TRANSITIONS=
12695     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12696         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12697     fi
12699     MPL_SUBSET="TRUE"
12700     AC_DEFINE(MPL_HAVE_SUBSET)
12701     AC_MSG_RESULT([only])
12702 else
12703     AC_MSG_RESULT([no restrictions])
12705 AC_SUBST(MPL_SUBSET)
12707 dnl ===================================================================
12709 AC_MSG_CHECKING([formula logger])
12710 ENABLE_FORMULA_LOGGER=
12712 if test "x$enable_formula_logger" = "xyes"; then
12713     AC_MSG_RESULT([yes])
12714     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12715     ENABLE_FORMULA_LOGGER=TRUE
12716 elif test -n "$ENABLE_DBGUTIL" ; then
12717     AC_MSG_RESULT([yes])
12718     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12719     ENABLE_FORMULA_LOGGER=TRUE
12720 else
12721     AC_MSG_RESULT([no])
12724 AC_SUBST(ENABLE_FORMULA_LOGGER)
12726 dnl ===================================================================
12727 dnl Setting up the environment.
12728 dnl ===================================================================
12729 AC_MSG_NOTICE([setting up the build environment variables...])
12731 AC_SUBST(COMPATH)
12733 if test "$build_os" = "cygwin"; then
12734     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12735         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12736         ATL_INCLUDE="$COMPATH/atlmfc/include"
12737     elif test -d "$COMPATH/atlmfc/lib"; then
12738         ATL_LIB="$COMPATH/atlmfc/lib"
12739         ATL_INCLUDE="$COMPATH/atlmfc/include"
12740     else
12741         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12742         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12743     fi
12744     if test "$BITNESS_OVERRIDE" = 64; then
12745         ATL_LIB="$ATL_LIB/x64"
12746     else
12747         ATL_LIB="$ATL_LIB/x86"
12748     fi
12749     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12750     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12752     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12753     PathFormat "/usr/bin/find.exe"
12754     FIND="$formatted_path"
12755     PathFormat "/usr/bin/sort.exe"
12756     SORT="$formatted_path"
12757     PathFormat "/usr/bin/grep.exe"
12758     WIN_GREP="$formatted_path"
12759     PathFormat "/usr/bin/ls.exe"
12760     WIN_LS="$formatted_path"
12761     PathFormat "/usr/bin/touch.exe"
12762     WIN_TOUCH="$formatted_path"
12763 else
12764     FIND=find
12765     SORT=sort
12768 AC_SUBST(ATL_INCLUDE)
12769 AC_SUBST(ATL_LIB)
12770 AC_SUBST(FIND)
12771 AC_SUBST(SORT)
12772 AC_SUBST(WIN_GREP)
12773 AC_SUBST(WIN_LS)
12774 AC_SUBST(WIN_TOUCH)
12776 AC_SUBST(BUILD_TYPE)
12778 AC_SUBST(SOLARINC)
12780 PathFormat "$PERL"
12781 PERL="$formatted_path"
12782 AC_SUBST(PERL)
12784 if test -n "$TMPDIR"; then
12785     TEMP_DIRECTORY="$TMPDIR"
12786 else
12787     TEMP_DIRECTORY="/tmp"
12789 if test "$build_os" = "cygwin"; then
12790     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12792 AC_SUBST(TEMP_DIRECTORY)
12794 # setup the PATH for the environment
12795 if test -n "$LO_PATH_FOR_BUILD"; then
12796     LO_PATH="$LO_PATH_FOR_BUILD"
12797 else
12798     LO_PATH="$PATH"
12800     case "$host_os" in
12802     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12803         if test "$ENABLE_JAVA" != ""; then
12804             pathmunge "$JAVA_HOME/bin" "after"
12805         fi
12806         ;;
12808     cygwin*)
12809         # Win32 make needs native paths
12810         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12811             LO_PATH=`cygpath -p -m "$PATH"`
12812         fi
12813         if test "$BITNESS_OVERRIDE" = 64; then
12814             # needed for msi packaging
12815             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12816         fi
12817         # .NET 4.6 and higher don't have bin directory
12818         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12819             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12820         fi
12821         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12822         pathmunge "$CSC_PATH" "before"
12823         pathmunge "$MIDL_PATH" "before"
12824         pathmunge "$AL_PATH" "before"
12825         pathmunge "$MSPDB_PATH" "before"
12826         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12827             pathmunge "$CL_PATH" "before"
12828         fi
12829         if test -n "$MSBUILD_PATH" ; then
12830             pathmunge "$MSBUILD_PATH" "before"
12831         fi
12832         if test "$BITNESS_OVERRIDE" = 64; then
12833             pathmunge "$COMPATH/bin/amd64" "before"
12834             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12835         else
12836             pathmunge "$COMPATH/bin" "before"
12837             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12838         fi
12839         if test "$ENABLE_JAVA" != ""; then
12840             if test -d "$JAVA_HOME/jre/bin/client"; then
12841                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12842             fi
12843             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12844                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12845             fi
12846             pathmunge "$JAVA_HOME/bin" "before"
12847         fi
12848         ;;
12850     solaris*)
12851         pathmunge "/usr/css/bin" "before"
12852         if test "$ENABLE_JAVA" != ""; then
12853             pathmunge "$JAVA_HOME/bin" "after"
12854         fi
12855         ;;
12856     esac
12859 AC_SUBST(LO_PATH)
12861 libo_FUZZ_SUMMARY
12863 # Generate a configuration sha256 we can use for deps
12864 if test -f config_host.mk; then
12865     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12867 if test -f config_host_lang.mk; then
12868     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12871 CFLAGS=$my_original_CFLAGS
12872 CXXFLAGS=$my_original_CXXFLAGS
12873 CPPFLAGS=$my_original_CPPFLAGS
12875 AC_CONFIG_FILES([config_host.mk
12876                  config_host_lang.mk
12877                  Makefile
12878                  bin/bffvalidator.sh
12879                  bin/odfvalidator.sh
12880                  bin/officeotron.sh
12881                  instsetoo_native/util/openoffice.lst
12882                  sysui/desktop/macosx/Info.plist])
12883 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12884 AC_CONFIG_HEADERS([config_host/config_clang.h])
12885 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12886 AC_CONFIG_HEADERS([config_host/config_eot.h])
12887 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12888 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12889 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12890 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12891 AC_CONFIG_HEADERS([config_host/config_features.h])
12892 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
12893 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
12894 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12895 AC_CONFIG_HEADERS([config_host/config_folders.h])
12896 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12897 AC_CONFIG_HEADERS([config_host/config_gio.h])
12898 AC_CONFIG_HEADERS([config_host/config_global.h])
12899 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12900 AC_CONFIG_HEADERS([config_host/config_java.h])
12901 AC_CONFIG_HEADERS([config_host/config_langs.h])
12902 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12903 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12904 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12905 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12906 AC_CONFIG_HEADERS([config_host/config_locales.h])
12907 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12908 AC_CONFIG_HEADERS([config_host/config_oox.h])
12909 AC_CONFIG_HEADERS([config_host/config_options.h])
12910 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12911 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12912 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12913 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12914 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12915 AC_CONFIG_HEADERS([config_host/config_version.h])
12916 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12917 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12918 AC_CONFIG_HEADERS([config_host/config_python.h])
12919 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12920 AC_OUTPUT
12922 if test "$CROSS_COMPILING" = TRUE; then
12923     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12926 # touch the config timestamp file
12927 if test ! -f config_host.mk.stamp; then
12928     echo > config_host.mk.stamp
12929 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12930     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12931 else
12932     echo > config_host.mk.stamp
12935 # touch the config lang timestamp file
12936 if test ! -f config_host_lang.mk.stamp; then
12937     echo > config_host_lang.mk.stamp
12938 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12939     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12940 else
12941     echo > config_host_lang.mk.stamp
12945 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12946         -a "$build_os" = "cygwin"; then
12948 cat << _EOS
12949 ****************************************************************************
12950 WARNING:
12951 Your make version is known to be horribly slow, and hard to debug
12952 problems with. To get a reasonably functional make please do:
12954 to install a pre-compiled binary make for Win32
12956  mkdir -p /opt/lo/bin
12957  cd /opt/lo/bin
12958  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12959  cp make-4.2.1-msvc.exe make
12960  chmod +x make
12962 to install from source:
12963 place yourself in a working directory of you choice.
12965  git clone git://git.savannah.gnu.org/make.git
12967  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12968  set PATH=%PATH%;C:\Cygwin\bin
12969  [or Cygwin64, if that is what you have]
12970  cd path-to-make-repo-you-cloned-above
12971  build_w32.bat --without-guile
12973 should result in a WinRel/gnumake.exe.
12974 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12976 Then re-run autogen.sh
12978 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12979 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12981 _EOS
12982 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
12983     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
12988 cat << _EOF
12989 ****************************************************************************
12991 To build, run:
12992 $GNUMAKE
12994 To view some help, run:
12995 $GNUMAKE help
12997 _EOF
12999 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13000     cat << _EOF
13001 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13002 _EOF
13004     if test $_os = Darwin; then
13005         echo open instdir/$PRODUCTNAME.app
13006     else
13007         echo instdir/program/soffice
13008     fi
13009     cat << _EOF
13011 If you want to run the smoketest, run:
13012 $GNUMAKE check
13014 _EOF
13017 if test -f warn; then
13018     cat warn
13019     rm warn
13022 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: