UITest_writer_tests7: Wait for async events (blind fix)
[LibreOffice.git] / configure.ac
blob1b43e189bcb7f19ff75dbf78194ed508fec80bdd
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],[7.1.0.0.alpha0+],[],[],[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 LIBO_VERSION_SUFFIX=$5
212 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
213 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
214 # they get undoubled before actually passed to sed.
215 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
216 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
217 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
218 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
220 AC_SUBST(LIBO_VERSION_MAJOR)
221 AC_SUBST(LIBO_VERSION_MINOR)
222 AC_SUBST(LIBO_VERSION_MICRO)
223 AC_SUBST(LIBO_VERSION_PATCH)
224 AC_SUBST(LIBO_VERSION_SUFFIX)
225 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
227 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
228 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
229 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
230 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
232 LIBO_THIS_YEAR=`date +%Y`
233 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
235 dnl ===================================================================
236 dnl Product version
237 dnl ===================================================================
238 AC_MSG_CHECKING([for product version])
239 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
240 AC_MSG_RESULT([$PRODUCTVERSION])
241 AC_SUBST(PRODUCTVERSION)
243 AC_PROG_EGREP
244 # AC_PROG_EGREP doesn't set GREP on all systems as well
245 AC_PATH_PROG(GREP, grep)
247 BUILDDIR=`pwd`
248 cd $srcdir
249 SRC_ROOT=`pwd`
250 cd $BUILDDIR
251 x_Cygwin=[\#]
253 dnl ======================================
254 dnl Required GObject introspection version
255 dnl ======================================
256 INTROSPECTION_REQUIRED_VERSION=1.32.0
258 dnl ===================================================================
259 dnl Search all the common names for GNU Make
260 dnl ===================================================================
261 AC_MSG_CHECKING([for GNU Make])
263 # try to use our own make if it is available and GNUMAKE was not already defined
264 if test -z "$GNUMAKE"; then
265     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
266         GNUMAKE="$LODE_HOME/opt/bin/make"
267     elif test -x "/opt/lo/bin/make"; then
268         GNUMAKE="/opt/lo/bin/make"
269     fi
272 GNUMAKE_WIN_NATIVE=
273 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
274     if test -n "$a"; then
275         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
276         if test $? -eq 0;  then
277             if test "$build_os" = "cygwin"; then
278                 if test -n "$($a -v | grep 'Built for Windows')" ; then
279                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
280                     GNUMAKE_WIN_NATIVE="TRUE"
281                 else
282                     GNUMAKE=`which $a`
283                 fi
284             else
285                 GNUMAKE=`which $a`
286             fi
287             break
288         fi
289     fi
290 done
291 AC_MSG_RESULT($GNUMAKE)
292 if test -z "$GNUMAKE"; then
293     AC_MSG_ERROR([not found. install GNU Make.])
294 else
295     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
296         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
297     fi
300 win_short_path_for_make()
302     local_short_path="$1"
303     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
304         cygpath -sm "$local_short_path"
305     else
306         cygpath -u "$(cygpath -d "$local_short_path")"
307     fi
311 if test "$build_os" = "cygwin"; then
312     PathFormat "$SRC_ROOT"
313     SRC_ROOT="$formatted_path"
314     PathFormat "$BUILDDIR"
315     BUILDDIR="$formatted_path"
316     x_Cygwin=
317     AC_MSG_CHECKING(for explicit COMSPEC)
318     if test -z "$COMSPEC"; then
319         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
320     else
321         AC_MSG_RESULT([found: $COMSPEC])
322     fi
325 AC_SUBST(SRC_ROOT)
326 AC_SUBST(BUILDDIR)
327 AC_SUBST(x_Cygwin)
328 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
329 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
330 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
332 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
333     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
336 # need sed in os checks...
337 AC_PATH_PROGS(SED, sed)
338 if test -z "$SED"; then
339     AC_MSG_ERROR([install sed to run this script])
342 # Set the ENABLE_LTO variable
343 # ===================================================================
344 AC_MSG_CHECKING([whether to use link-time optimization])
345 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
346     ENABLE_LTO="TRUE"
347     AC_MSG_RESULT([yes])
348 else
349     ENABLE_LTO=""
350     AC_MSG_RESULT([no])
352 AC_SUBST(ENABLE_LTO)
354 AC_ARG_ENABLE(fuzz-options,
355     AS_HELP_STRING([--enable-fuzz-options],
356         [Randomly enable or disable each of those configurable options
357          that are supposed to be freely selectable without interdependencies,
358          or where bad interaction from interdependencies is automatically avoided.])
361 dnl ===================================================================
362 dnl When building for Android, --with-android-ndk,
363 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
364 dnl mandatory
365 dnl ===================================================================
367 AC_ARG_WITH(android-ndk,
368     AS_HELP_STRING([--with-android-ndk],
369         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
372 AC_ARG_WITH(android-ndk-toolchain-version,
373     AS_HELP_STRING([--with-android-ndk-toolchain-version],
374         [Specify which toolchain version to use, of those present in the
375         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
376         with_android_ndk_toolchain_version=clang5.0)
378 AC_ARG_WITH(android-sdk,
379     AS_HELP_STRING([--with-android-sdk],
380         [Specify location of the Android SDK. Mandatory when building for Android.]),
383 AC_ARG_WITH(android-api-level,
384     AS_HELP_STRING([--with-android-api-level],
385         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
388 ANDROID_NDK_HOME=
389 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
390     with_android_ndk="$SRC_ROOT/external/android-ndk"
392 if test -n "$with_android_ndk"; then
393     eval ANDROID_NDK_HOME=$with_android_ndk
395     # Set up a lot of pre-canned defaults
397     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
398         if test ! -f $ANDROID_NDK_HOME/source.properties; then
399             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
400         fi
401         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
402     else
403         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
404     fi
405     if test -z "$ANDROID_NDK_VERSION";  then
406         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
407     fi
408     case $ANDROID_NDK_VERSION in
409     r9*|r10*)
410         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
411         ;;
412     11.1.*|12.1.*|13.1.*|14.1.*)
413         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
414         ;;
415     16.*|17.*|18.*|19.*|20.*)
416         ;;
417     *)
418         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
419         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
420         ;;
421     esac
423     ANDROID_API_LEVEL=16
424     if test -n "$with_android_api_level" ; then
425         ANDROID_API_LEVEL="$with_android_api_level"
426     fi
428     android_cpu=$host_cpu
429     if test $host_cpu = arm; then
430         android_platform_prefix=arm-linux-androideabi
431         android_gnu_prefix=$android_platform_prefix
432         LLVM_TRIPLE=armv7a-linux-androideabi
433         ANDROID_APP_ABI=armeabi-v7a
434         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
435     elif test $host_cpu = aarch64; then
436         android_platform_prefix=aarch64-linux-android
437         android_gnu_prefix=$android_platform_prefix
438         LLVM_TRIPLE=$android_platform_prefix
439         # minimum android version that supports aarch64
440         if test "$ANDROID_API_LEVEL" -lt "21" ; then
441             ANDROID_API_LEVEL=21
442         fi
443         ANDROID_APP_ABI=arm64-v8a
444     elif test $host_cpu = x86_64; then
445         android_platform_prefix=x86_64-linux-android
446         android_gnu_prefix=$android_platform_prefix
447         LLVM_TRIPLE=$android_platform_prefix
448         # minimum android version that supports x86_64
449         ANDROID_API_LEVEL=21
450         ANDROID_APP_ABI=x86_64
451     else
452         # host_cpu is something like "i386" or "i686" I guess, NDK uses
453         # "x86" in some contexts
454         android_cpu=x86
455         android_platform_prefix=$android_cpu
456         android_gnu_prefix=i686-linux-android
457         LLVM_TRIPLE=$android_gnu_prefix
458         ANDROID_APP_ABI=x86
459     fi
461     case "$with_android_ndk_toolchain_version" in
462     clang5.0)
463         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
464         ;;
465     *)
466         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
467     esac
469     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
471     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
472     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
473     # manage to link the (app-specific) single huge .so that is built for the app in
474     # android/source/ if there is debug information in a significant part of the object files.
475     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
476     # all objects have been built with debug information.)
477     case $build_os in
478     linux-gnu*)
479         android_HOST_TAG=linux-x86_64
480         ;;
481     darwin*)
482         android_HOST_TAG=darwin-x86_64
483         ;;
484     *)
485         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
486         # ndk would also support windows and windows-x86_64
487         ;;
488     esac
489     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
490     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
491     dnl TODO: NSS build uses it...
492     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
493     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
495     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
496     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
497     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
498     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
499     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
501     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
502     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
503     if test "$ENABLE_LTO" = TRUE; then
504         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
505         # $CC and $CXX when building external libraries
506         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
507     fi
509     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
511     if test -z "$CC"; then
512         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
513         CC_BASE="clang"
514     fi
515     if test -z "$CXX"; then
516         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
517         CXX_BASE="clang++"
518     fi
520     # remember to download the ownCloud Android library later
521     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
523 AC_SUBST(ANDROID_NDK_HOME)
524 AC_SUBST(ANDROID_APP_ABI)
525 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
527 dnl ===================================================================
528 dnl --with-android-sdk
529 dnl ===================================================================
530 ANDROID_SDK_HOME=
531 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
532     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
534 if test -n "$with_android_sdk"; then
535     eval ANDROID_SDK_HOME=$with_android_sdk
536     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
538 AC_SUBST(ANDROID_SDK_HOME)
540 AC_ARG_ENABLE([android-lok],
541     AS_HELP_STRING([--enable-android-lok],
542         [The Android app from the android/ subdir needs several tweaks all
543          over the place that break the LOK when used in the Online-based
544          Android app.  This switch indicates that the intent of this build is
545          actually the Online-based, non-modified LOK.])
547 ENABLE_ANDROID_LOK=
548 if test -n "$ANDROID_NDK_HOME" ; then
549     if test "$enable_android_lok" = yes; then
550         ENABLE_ANDROID_LOK=TRUE
551         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
552         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
553     else
554         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
555     fi
557 AC_SUBST([ENABLE_ANDROID_LOK])
559 libo_FUZZ_ARG_ENABLE([android-editing],
560     AS_HELP_STRING([--enable-android-editing],
561         [Enable the experimental editing feature on Android.])
563 ENABLE_ANDROID_EDITING=
564 if test "$enable_android_editing" = yes; then
565     ENABLE_ANDROID_EDITING=TRUE
567 AC_SUBST([ENABLE_ANDROID_EDITING])
569 dnl ===================================================================
570 dnl The following is a list of supported systems.
571 dnl Sequential to keep the logic very simple
572 dnl These values may be checked and reset later.
573 dnl ===================================================================
574 #defaults unless the os test overrides this:
575 test_randr=yes
576 test_xrender=yes
577 test_cups=yes
578 test_dbus=yes
579 test_fontconfig=yes
580 test_cairo=no
581 test_gdb_index=no
582 test_split_debug=no
584 # Default values, as such probably valid just for Linux, set
585 # differently below just for Mac OSX, but at least better than
586 # hardcoding these as we used to do. Much of this is duplicated also
587 # in solenv for old build system and for gbuild, ideally we should
588 # perhaps define stuff like this only here in configure.ac?
590 LINKFLAGSSHL="-shared"
591 PICSWITCH="-fpic"
592 DLLPOST=".so"
594 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
596 INSTROOTBASESUFFIX=
597 INSTROOTCONTENTSUFFIX=
598 SDKDIRNAME=sdk
600 case "$host_os" in
602 solaris*)
603     build_gstreamer_1_0=yes
604     test_freetype=yes
605     build_skia=yes
606     _os=SunOS
608     dnl ===========================================================
609     dnl Check whether we're using Solaris 10 - SPARC or Intel.
610     dnl ===========================================================
611     AC_MSG_CHECKING([the Solaris operating system release])
612     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
613     if test "$_os_release" -lt "10"; then
614         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
615     else
616         AC_MSG_RESULT([ok ($_os_release)])
617     fi
619     dnl Check whether we're using a SPARC or i386 processor
620     AC_MSG_CHECKING([the processor type])
621     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
622         AC_MSG_RESULT([ok ($host_cpu)])
623     else
624         AC_MSG_ERROR([only SPARC and i386 processors are supported])
625     fi
626     ;;
628 linux-gnu*|k*bsd*-gnu*)
629     build_gstreamer_1_0=yes
630     test_kf5=yes
631     test_gtk3_kde5=yes
632     build_skia=yes
633     test_gdb_index=yes
634     test_split_debug=yes
635     if test "$enable_fuzzers" != yes; then
636         test_freetype=yes
637         test_fontconfig=yes
638     else
639         test_freetype=no
640         test_fontconfig=no
641         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
642     fi
643     _os=Linux
644     ;;
646 gnu)
647     test_randr=no
648     test_xrender=no
649     _os=GNU
650      ;;
652 cygwin*|interix*)
654     # When building on Windows normally with MSVC under Cygwin,
655     # configure thinks that the host platform (the platform the
656     # built code will run on) is Cygwin, even if it obviously is
657     # Windows, which in Autoconf terminology is called
658     # "mingw32". (Which is misleading as MinGW is the name of the
659     # tool-chain, not an operating system.)
661     # Somewhat confusing, yes. But this configure script doesn't
662     # look at $host etc that much, it mostly uses its own $_os
663     # variable, set here in this case statement.
665     test_cups=no
666     test_dbus=no
667     test_randr=no
668     test_xrender=no
669     test_freetype=no
670     test_fontconfig=no
671     build_skia=yes
672     _os=WINNT
674     DLLPOST=".dll"
675     LINKFLAGSNOUNDEFS=
676     ;;
678 darwin*) # macOS or iOS
679     test_randr=no
680     test_xrender=no
681     test_freetype=no
682     test_fontconfig=no
683     test_dbus=no
684     if test -n "$LODE_HOME" ; then
685         mac_sanitize_path
686         AC_MSG_NOTICE([sanitized the PATH to $PATH])
687     fi
688     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
689         build_for_ios=YES
690         _os=iOS
691         test_cups=no
692         enable_mpl_subset=yes
693         enable_lotuswordpro=no
694         enable_coinmp=no
695         enable_lpsolve=no
696         enable_postgresql_sdbc=no
697         enable_extension_integration=no
698         enable_report_builder=no
699         with_ppds=no
700         if test "$enable_ios_simulator" = "yes"; then
701             host=x86_64-apple-darwin
702         fi
703     else
704         _os=Darwin
705         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
706         INSTROOTCONTENTSUFFIX=/Contents
707         SDKDIRNAME=${PRODUCTNAME}${PRODUCTVERSION}_SDK
708     fi
709     # See comment above the case "$host_os"
710     LINKFLAGSSHL="-dynamiclib -single_module"
712     # -fPIC is default
713     PICSWITCH=""
715     DLLPOST=".dylib"
717     # -undefined error is the default
718     LINKFLAGSNOUNDEFS=""
721 freebsd*)
722     build_gstreamer_1_0=yes
723     test_kf5=yes
724     test_gtk3_kde5=yes
725     test_freetype=yes
726     build_skia=yes
727     AC_MSG_CHECKING([the FreeBSD operating system release])
728     if test -n "$with_os_version"; then
729         OSVERSION="$with_os_version"
730     else
731         OSVERSION=`/sbin/sysctl -n kern.osreldate`
732     fi
733     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
734     AC_MSG_CHECKING([which thread library to use])
735     if test "$OSVERSION" -lt "500016"; then
736         PTHREAD_CFLAGS="-D_THREAD_SAFE"
737         PTHREAD_LIBS="-pthread"
738     elif test "$OSVERSION" -lt "502102"; then
739         PTHREAD_CFLAGS="-D_THREAD_SAFE"
740         PTHREAD_LIBS="-lc_r"
741     else
742         PTHREAD_CFLAGS=""
743         PTHREAD_LIBS="-pthread"
744     fi
745     AC_MSG_RESULT([$PTHREAD_LIBS])
746     _os=FreeBSD
747     ;;
749 *netbsd*)
750     build_gstreamer_1_0=yes
751     test_kf5=yes
752     test_gtk3_kde5=yes
753     test_freetype=yes
754     build_skia=yes
755     PTHREAD_LIBS="-pthread -lpthread"
756     _os=NetBSD
757     ;;
759 aix*)
760     test_randr=no
761     test_freetype=yes
762     PTHREAD_LIBS=-pthread
763     _os=AIX
764     ;;
766 openbsd*)
767     test_freetype=yes
768     PTHREAD_CFLAGS="-D_THREAD_SAFE"
769     PTHREAD_LIBS="-pthread"
770     _os=OpenBSD
771     ;;
773 dragonfly*)
774     build_gstreamer_1_0=yes
775     test_kf5=yes
776     test_gtk3_kde5=yes
777     test_freetype=yes
778     build_skia=yes
779     PTHREAD_LIBS="-pthread"
780     _os=DragonFly
781     ;;
783 linux-android*)
784     build_gstreamer_1_0=no
785     enable_lotuswordpro=no
786     enable_mpl_subset=yes
787     enable_coinmp=yes
788     enable_lpsolve=no
789     enable_report_builder=no
790     enable_odk=no
791     enable_postgresql_sdbc=no
792     enable_python=no
793     test_cups=no
794     test_dbus=no
795     test_fontconfig=no
796     test_freetype=no
797     test_kf5=no
798     test_qt5=no
799     test_gtk3_kde5=no
800     test_randr=no
801     test_xrender=no
802     _os=Android
804     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
805     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
806     ;;
808 haiku*)
809     test_cups=no
810     test_dbus=no
811     test_randr=no
812     test_xrender=no
813     test_freetype=yes
814     enable_odk=no
815     enable_gstreamer_1_0=no
816     enable_vlc=no
817     enable_coinmp=no
818     enable_pdfium=no
819     enable_sdremote=no
820     enable_postgresql_sdbc=no
821     enable_firebird_sdbc=no
822     _os=Haiku
823     ;;
826     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
827     ;;
828 esac
830 if test "$_os" = "Android" ; then
831     # Verify that the NDK and SDK options are proper
832     if test -z "$with_android_ndk"; then
833         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
834     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
835         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
836     fi
838     if test -z "$ANDROID_SDK_HOME"; then
839         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
840     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
841         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
842     fi
844     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
845     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
846         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
847                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
848                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
849         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
850         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
851         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
852     fi
853     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
854         AC_MSG_WARN([android support repository not found - install with
855                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
856                      to allow the build to download the specified version of the android support libraries])
857         add_warning "android support repository not found - install with"
858         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
859         add_warning "to allow the build to download the specified version of the android support libraries"
860     fi
863 if test "$_os" = "AIX"; then
864     AC_PATH_PROG(GAWK, gawk)
865     if test -z "$GAWK"; then
866         AC_MSG_ERROR([gawk not found in \$PATH])
867     fi
870 AC_SUBST(SDKDIRNAME)
872 AC_SUBST(PTHREAD_CFLAGS)
873 AC_SUBST(PTHREAD_LIBS)
875 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
876 # By default use the ones specified by our build system,
877 # but explicit override is possible.
878 AC_MSG_CHECKING(for explicit AFLAGS)
879 if test -n "$AFLAGS"; then
880     AC_MSG_RESULT([$AFLAGS])
881     x_AFLAGS=
882 else
883     AC_MSG_RESULT(no)
884     x_AFLAGS=[\#]
886 AC_MSG_CHECKING(for explicit CFLAGS)
887 if test -n "$CFLAGS"; then
888     AC_MSG_RESULT([$CFLAGS])
889     x_CFLAGS=
890 else
891     AC_MSG_RESULT(no)
892     x_CFLAGS=[\#]
894 AC_MSG_CHECKING(for explicit CXXFLAGS)
895 if test -n "$CXXFLAGS"; then
896     AC_MSG_RESULT([$CXXFLAGS])
897     x_CXXFLAGS=
898 else
899     AC_MSG_RESULT(no)
900     x_CXXFLAGS=[\#]
902 AC_MSG_CHECKING(for explicit OBJCFLAGS)
903 if test -n "$OBJCFLAGS"; then
904     AC_MSG_RESULT([$OBJCFLAGS])
905     x_OBJCFLAGS=
906 else
907     AC_MSG_RESULT(no)
908     x_OBJCFLAGS=[\#]
910 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
911 if test -n "$OBJCXXFLAGS"; then
912     AC_MSG_RESULT([$OBJCXXFLAGS])
913     x_OBJCXXFLAGS=
914 else
915     AC_MSG_RESULT(no)
916     x_OBJCXXFLAGS=[\#]
918 AC_MSG_CHECKING(for explicit LDFLAGS)
919 if test -n "$LDFLAGS"; then
920     AC_MSG_RESULT([$LDFLAGS])
921     x_LDFLAGS=
922 else
923     AC_MSG_RESULT(no)
924     x_LDFLAGS=[\#]
926 AC_SUBST(AFLAGS)
927 AC_SUBST(CFLAGS)
928 AC_SUBST(CXXFLAGS)
929 AC_SUBST(OBJCFLAGS)
930 AC_SUBST(OBJCXXFLAGS)
931 AC_SUBST(LDFLAGS)
932 AC_SUBST(x_AFLAGS)
933 AC_SUBST(x_CFLAGS)
934 AC_SUBST(x_CXXFLAGS)
935 AC_SUBST(x_OBJCFLAGS)
936 AC_SUBST(x_OBJCXXFLAGS)
937 AC_SUBST(x_LDFLAGS)
939 dnl These are potentially set for MSVC, in the code checking for UCRT below:
940 my_original_CFLAGS=$CFLAGS
941 my_original_CXXFLAGS=$CXXFLAGS
942 my_original_CPPFLAGS=$CPPFLAGS
944 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
945 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
946 dnl AC_PROG_CC internally.
947 if test "$_os" != "WINNT"; then
948     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
949     save_CFLAGS=$CFLAGS
950     AC_PROG_CC
951     CFLAGS=$save_CFLAGS
952     if test -z "$CC_BASE"; then
953         CC_BASE=`first_arg_basename "$CC"`
954     fi
957 if test "$_os" != "WINNT"; then
958     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
959 else
960     ENDIANNESS=little
962 AC_SUBST(ENDIANNESS)
964 if test $_os != "WINNT"; then
965     save_LIBS="$LIBS"
966     AC_SEARCH_LIBS([dlsym], [dl],
967         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
968         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
969     LIBS="$save_LIBS"
971 AC_SUBST(DLOPEN_LIBS)
973 AC_ARG_ENABLE(ios-simulator,
974     AS_HELP_STRING([--enable-ios-simulator],
975         [build i386 or x86_64 for ios simulator])
978 AC_ARG_ENABLE(ios-libreofficelight-app,
979     AS_HELP_STRING([--enable-ios-libreofficelight-app],
980         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
981          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
982          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
985 ENABLE_IOS_LIBREOFFICELIGHT_APP=
986 if test "$enable_ios_libreofficelight_app" = yes; then
987     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
989 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
991 ###############################################################################
992 # Extensions switches --enable/--disable
993 ###############################################################################
994 # By default these should be enabled unless having extra dependencies.
995 # If there is extra dependency over configure options then the enable should
996 # be automagic based on whether the requiring feature is enabled or not.
997 # All this options change anything only with --enable-extension-integration.
999 # The name of this option and its help string makes it sound as if
1000 # extensions are built anyway, just not integrated in the installer,
1001 # if you use --disable-extension-integration. Is that really the
1002 # case?
1004 libo_FUZZ_ARG_ENABLE(extension-integration,
1005     AS_HELP_STRING([--disable-extension-integration],
1006         [Disable integration of the built extensions in the installer of the
1007          product. Use this switch to disable the integration.])
1010 AC_ARG_ENABLE(avmedia,
1011     AS_HELP_STRING([--disable-avmedia],
1012         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1015 AC_ARG_ENABLE(database-connectivity,
1016     AS_HELP_STRING([--disable-database-connectivity],
1017         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1020 # This doesn't mean not building (or "integrating") extensions
1021 # (although it probably should; i.e. it should imply
1022 # --disable-extension-integration I guess), it means not supporting
1023 # any extension mechanism at all
1024 libo_FUZZ_ARG_ENABLE(extensions,
1025     AS_HELP_STRING([--disable-extensions],
1026         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1029 AC_ARG_ENABLE(scripting,
1030     AS_HELP_STRING([--disable-scripting],
1031         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1034 # This is mainly for Android and iOS, but could potentially be used in some
1035 # special case otherwise, too, so factored out as a separate setting
1037 AC_ARG_ENABLE(dynamic-loading,
1038     AS_HELP_STRING([--disable-dynamic-loading],
1039         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1042 libo_FUZZ_ARG_ENABLE(report-builder,
1043     AS_HELP_STRING([--disable-report-builder],
1044         [Disable the Report Builder.])
1047 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1048     AS_HELP_STRING([--enable-ext-wiki-publisher],
1049         [Enable the Wiki Publisher extension.])
1052 libo_FUZZ_ARG_ENABLE(lpsolve,
1053     AS_HELP_STRING([--disable-lpsolve],
1054         [Disable compilation of the lp solve solver ])
1056 libo_FUZZ_ARG_ENABLE(coinmp,
1057     AS_HELP_STRING([--disable-coinmp],
1058         [Disable compilation of the CoinMP solver ])
1061 libo_FUZZ_ARG_ENABLE(pdfimport,
1062     AS_HELP_STRING([--disable-pdfimport],
1063         [Disable building the PDF import feature.])
1066 libo_FUZZ_ARG_ENABLE(pdfium,
1067     AS_HELP_STRING([--disable-pdfium],
1068         [Disable building PDFium.])
1071 libo_FUZZ_ARG_ENABLE(skia,
1072     AS_HELP_STRING([--disable-skia],
1073         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1076 ###############################################################################
1078 dnl ---------- *** ----------
1080 libo_FUZZ_ARG_ENABLE(mergelibs,
1081     AS_HELP_STRING([--enable-mergelibs],
1082         [Merge several of the smaller libraries into one big, "merged", one.])
1085 libo_FUZZ_ARG_ENABLE(breakpad,
1086     AS_HELP_STRING([--enable-breakpad],
1087         [Enables breakpad for crash reporting.])
1090 libo_FUZZ_ARG_ENABLE(crashdump,
1091     AS_HELP_STRING([--disable-crashdump],
1092         [Disable dump.ini and dump-file, when --enable-breakpad])
1095 AC_ARG_ENABLE(fetch-external,
1096     AS_HELP_STRING([--disable-fetch-external],
1097         [Disables fetching external tarballs from web sources.])
1100 AC_ARG_ENABLE(fuzzers,
1101     AS_HELP_STRING([--enable-fuzzers],
1102         [Enables building libfuzzer targets for fuzz testing.])
1105 libo_FUZZ_ARG_ENABLE(pch,
1106     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1107         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1108          Using 'system' will include only external headers, 'base' will add also headers
1109          from base modules, 'normal' will also add all headers except from the module built,
1110          'full' will use all suitable headers even from a module itself.])
1113 libo_FUZZ_ARG_ENABLE(epm,
1114     AS_HELP_STRING([--enable-epm],
1115         [LibreOffice includes self-packaging code, that requires epm, however epm is
1116          useless for large scale package building.])
1119 libo_FUZZ_ARG_ENABLE(odk,
1120     AS_HELP_STRING([--disable-odk],
1121         [LibreOffice includes an ODK, office development kit which some packagers may
1122          wish to build without.])
1125 AC_ARG_ENABLE(mpl-subset,
1126     AS_HELP_STRING([--enable-mpl-subset],
1127         [Don't compile any pieces which are not MPL or more liberally licensed])
1130 libo_FUZZ_ARG_ENABLE(evolution2,
1131     AS_HELP_STRING([--enable-evolution2],
1132         [Allows the built-in evolution 2 addressbook connectivity build to be
1133          enabled.])
1136 AC_ARG_ENABLE(avahi,
1137     AS_HELP_STRING([--enable-avahi],
1138         [Determines whether to use Avahi to advertise Impress to remote controls.])
1141 libo_FUZZ_ARG_ENABLE(werror,
1142     AS_HELP_STRING([--enable-werror],
1143         [Turn warnings to errors. (Has no effect in modules where the treating
1144          of warnings as errors is disabled explicitly.)]),
1147 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1148     AS_HELP_STRING([--enable-assert-always-abort],
1149         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1152 libo_FUZZ_ARG_ENABLE(dbgutil,
1153     AS_HELP_STRING([--enable-dbgutil],
1154         [Provide debugging support from --enable-debug and include additional debugging
1155          utilities such as object counting or more expensive checks.
1156          This is the recommended option for developers.
1157          Note that this makes the build ABI incompatible, it is not possible to mix object
1158          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1160 libo_FUZZ_ARG_ENABLE(debug,
1161     AS_HELP_STRING([--enable-debug],
1162         [Include debugging information, disable compiler optimization and inlining plus
1163          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1165 libo_FUZZ_ARG_ENABLE(split-debug,
1166     AS_HELP_STRING([--disable-split-debug],
1167         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1168          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1170 libo_FUZZ_ARG_ENABLE(gdb-index,
1171     AS_HELP_STRING([--disable-gdb-index],
1172         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1173          The feature requires the gold or lld linker.]))
1175 libo_FUZZ_ARG_ENABLE(sal-log,
1176     AS_HELP_STRING([--enable-sal-log],
1177         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1179 libo_FUZZ_ARG_ENABLE(symbols,
1180     AS_HELP_STRING([--enable-symbols],
1181         [Generate debug information.
1182          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1183          otherwise. It is possible to explicitly specify gbuild build targets
1184          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1185          everything in the directory; there is no ordering, more specific overrides
1186          more general, and disabling takes precedence).
1187          Example: --enable-symbols="all -sw/ -Library_sc".]))
1189 libo_FUZZ_ARG_ENABLE(optimized,
1190     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1191         [Whether to compile with optimization flags.
1192          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1193          otherwise. Using 'debug' will try to use only optimizations that should
1194          not interfere with debugging.]))
1196 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1197     AS_HELP_STRING([--disable-runtime-optimizations],
1198         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1199          JVM JIT) that are known to interact badly with certain dynamic analysis
1200          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1201          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1202          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1204 AC_ARG_WITH(valgrind,
1205     AS_HELP_STRING([--with-valgrind],
1206         [Make availability of Valgrind headers a hard requirement.]))
1208 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1209     AS_HELP_STRING([--enable-compiler-plugins],
1210         [Enable compiler plugins that will perform additional checks during
1211          building. Enabled automatically by --enable-dbgutil.
1212          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1213 COMPILER_PLUGINS_DEBUG=
1214 if test "$enable_compiler_plugins" = debug; then
1215     enable_compiler_plugins=yes
1216     COMPILER_PLUGINS_DEBUG=TRUE
1219 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1220     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1221         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1222          relevant in the --disable-compiler-plugins case.]))
1224 libo_FUZZ_ARG_ENABLE(ooenv,
1225     AS_HELP_STRING([--disable-ooenv],
1226         [Disable ooenv for the instdir installation.]))
1228 AC_ARG_ENABLE(lto,
1229     AS_HELP_STRING([--enable-lto],
1230         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1231          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1232          linker. For MSVC, this option is broken at the moment. This is experimental work
1233          in progress that shouldn't be used unless you are working on it.)]))
1235 AC_ARG_ENABLE(python,
1236     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1237         [Enables or disables Python support at run-time.
1238          Also specifies what Python to use at build-time.
1239          'fully-internal' even forces the internal version for uses of Python
1240          during the build.
1241          On macOS the only choices are
1242          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1243          ]))
1245 libo_FUZZ_ARG_ENABLE(gtk3,
1246     AS_HELP_STRING([--disable-gtk3],
1247         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1248 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1250 AC_ARG_ENABLE(introspection,
1251     AS_HELP_STRING([--enable-introspection],
1252         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1253          Linux distributions.)]))
1255 AC_ARG_ENABLE(split-app-modules,
1256     AS_HELP_STRING([--enable-split-app-modules],
1257         [Split file lists for app modules, e.g. base, calc.
1258          Has effect only with make distro-pack-install]),
1261 AC_ARG_ENABLE(split-opt-features,
1262     AS_HELP_STRING([--enable-split-opt-features],
1263         [Split file lists for some optional features, e.g. pyuno, testtool.
1264          Has effect only with make distro-pack-install]),
1267 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1268     AS_HELP_STRING([--disable-cairo-canvas],
1269         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1272 libo_FUZZ_ARG_ENABLE(dbus,
1273     AS_HELP_STRING([--disable-dbus],
1274         [Determines whether to enable features that depend on dbus.
1275          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1276 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1278 libo_FUZZ_ARG_ENABLE(sdremote,
1279     AS_HELP_STRING([--disable-sdremote],
1280         [Determines whether to enable Impress remote control (i.e. the server component).]),
1281 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1283 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1284     AS_HELP_STRING([--disable-sdremote-bluetooth],
1285         [Determines whether to build sdremote with bluetooth support.
1286          Requires dbus on Linux.]))
1288 libo_FUZZ_ARG_ENABLE(gio,
1289     AS_HELP_STRING([--disable-gio],
1290         [Determines whether to use the GIO support.]),
1291 ,test "${enable_gio+set}" = set || enable_gio=yes)
1293 AC_ARG_ENABLE(qt5,
1294     AS_HELP_STRING([--enable-qt5],
1295         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1296          available.]),
1299 AC_ARG_ENABLE(kf5,
1300     AS_HELP_STRING([--enable-kf5],
1301         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1302          KF5 are available.]),
1305 AC_ARG_ENABLE(kde5,
1306     AS_HELP_STRING([--enable-kde5],
1307         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1310 AC_ARG_ENABLE(gtk3_kde5,
1311     AS_HELP_STRING([--enable-gtk3-kde5],
1312         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1313          platforms where Gtk3, Qt5 and Plasma is available.]),
1316 AC_ARG_ENABLE(gui,
1317     AS_HELP_STRING([--disable-gui],
1318         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1319 ,enable_gui=yes)
1321 libo_FUZZ_ARG_ENABLE(randr,
1322     AS_HELP_STRING([--disable-randr],
1323         [Disable RandR support in the vcl project.]),
1324 ,test "${enable_randr+set}" = set || enable_randr=yes)
1326 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1327     AS_HELP_STRING([--disable-gstreamer-1-0],
1328         [Disable building with the gstreamer 1.0 avmedia backend.]),
1329 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1331 libo_FUZZ_ARG_ENABLE(vlc,
1332     AS_HELP_STRING([--enable-vlc],
1333         [Enable building with the (experimental) VLC avmedia backend.]),
1334 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1336 libo_FUZZ_ARG_ENABLE(neon,
1337     AS_HELP_STRING([--disable-neon],
1338         [Disable neon and the compilation of webdav binding.]),
1341 libo_FUZZ_ARG_ENABLE([eot],
1342     [AS_HELP_STRING([--enable-eot],
1343         [Enable support for Embedded OpenType fonts.])],
1344 ,test "${enable_eot+set}" = set || enable_eot=no)
1346 libo_FUZZ_ARG_ENABLE(cve-tests,
1347     AS_HELP_STRING([--disable-cve-tests],
1348         [Prevent CVE tests to be executed]),
1351 libo_FUZZ_ARG_ENABLE(chart-tests,
1352     AS_HELP_STRING([--enable-chart-tests],
1353         [Executes chart XShape tests. In a perfect world these tests would be
1354          stable and everyone could run them, in reality it is best to run them
1355          only on a few machines that are known to work and maintained by people
1356          who can judge if a test failure is a regression or not.]),
1359 AC_ARG_ENABLE(build-unowinreg,
1360     AS_HELP_STRING([--enable-build-unowinreg],
1361         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1362          compiler is needed on Linux.]),
1365 AC_ARG_ENABLE(build-opensymbol,
1366     AS_HELP_STRING([--enable-build-opensymbol],
1367         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1368          fontforge installed.]),
1371 AC_ARG_ENABLE(dependency-tracking,
1372     AS_HELP_STRING([--enable-dependency-tracking],
1373         [Do not reject slow dependency extractors.])[
1374   --disable-dependency-tracking
1375                           Disables generation of dependency information.
1376                           Speed up one-time builds.],
1379 AC_ARG_ENABLE(icecream,
1380     AS_HELP_STRING([--enable-icecream],
1381         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1382          It defaults to /opt/icecream for the location of the icecream gcc/g++
1383          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1386 AC_ARG_ENABLE(ld,
1387     AS_HELP_STRING([--enable-ld=<linker>],
1388         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1389          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1392 libo_FUZZ_ARG_ENABLE(cups,
1393     AS_HELP_STRING([--disable-cups],
1394         [Do not build cups support.])
1397 AC_ARG_ENABLE(ccache,
1398     AS_HELP_STRING([--disable-ccache],
1399         [Do not try to use ccache automatically.
1400          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1401          CC/CXX are not yet set, and --enable-icecream is not given, we
1402          attempt to use ccache. --disable-ccache disables ccache completely.
1403          Additionally ccache's depend mode is enabled if possible,
1404          use --enable-ccache=nodepend to enable ccache without depend mode.
1408 AC_ARG_ENABLE(64-bit,
1409     AS_HELP_STRING([--enable-64-bit],
1410         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1411          At the moment meaningful only for Windows.]), ,)
1413 libo_FUZZ_ARG_ENABLE(online-update,
1414     AS_HELP_STRING([--enable-online-update],
1415         [Enable the online update service that will check for new versions of
1416          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1417          If the value is "mar", the experimental Mozilla-like update will be
1418          enabled instead of the traditional update mechanism.]),
1421 AC_ARG_WITH(update-config,
1422     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1423                    [Path to the update config ini file]))
1425 libo_FUZZ_ARG_ENABLE(extension-update,
1426     AS_HELP_STRING([--disable-extension-update],
1427         [Disable possibility to update installed extensions.]),
1430 libo_FUZZ_ARG_ENABLE(release-build,
1431     AS_HELP_STRING([--enable-release-build],
1432         [Enable release build. Note that the "release build" choice is orthogonal to
1433          whether symbols are present, debug info is generated, or optimization
1434          is done.
1435          See http://wiki.documentfoundation.org/Development/DevBuild]),
1438 AC_ARG_ENABLE(windows-build-signing,
1439     AS_HELP_STRING([--enable-windows-build-signing],
1440         [Enable signing of windows binaries (*.exe, *.dll)]),
1443 AC_ARG_ENABLE(silent-msi,
1444     AS_HELP_STRING([--enable-silent-msi],
1445         [Enable MSI with LIMITUI=1 (silent install).]),
1448 AC_ARG_ENABLE(macosx-code-signing,
1449     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1450         [Sign executables, dylibs, frameworks and the app bundle. If you
1451          don't provide an identity the first suitable certificate
1452          in your keychain is used.]),
1455 AC_ARG_ENABLE(macosx-package-signing,
1456     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1457         [Create a .pkg suitable for uploading to the Mac App Store and sign
1458          it. If you don't provide an identity the first suitable certificate
1459          in your keychain is used.]),
1462 AC_ARG_ENABLE(macosx-sandbox,
1463     AS_HELP_STRING([--enable-macosx-sandbox],
1464         [Make the app bundle run in a sandbox. Requires code signing.
1465          Is required by apps distributed in the Mac App Store, and implies
1466          adherence to App Store rules.]),
1469 AC_ARG_WITH(macosx-bundle-identifier,
1470     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1471         [Define the macOS bundle identifier. Default is the somewhat weird
1472          org.libreoffice.script ("script", huh?).]),
1473 ,with_macosx_bundle_identifier=org.libreoffice.script)
1475 AC_ARG_WITH(product-name,
1476     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1477         [Define the product name. Default is AC_PACKAGE_NAME.]),
1478 ,with_product_name=$PRODUCTNAME)
1480 AC_ARG_WITH(package-version,
1481     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1482         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1485 libo_FUZZ_ARG_ENABLE(readonly-installset,
1486     AS_HELP_STRING([--enable-readonly-installset],
1487         [Prevents any attempts by LibreOffice to write into its installation. That means
1488          at least that no "system-wide" extensions can be added. Partly experimental work in
1489          progress, probably not fully implemented. Always enabled for macOS.]),
1492 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1493     AS_HELP_STRING([--disable-postgresql-sdbc],
1494         [Disable the build of the PostgreSQL-SDBC driver.])
1497 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1498     AS_HELP_STRING([--disable-lotuswordpro],
1499         [Disable the build of the Lotus Word Pro filter.]),
1500 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1502 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1503     AS_HELP_STRING([--disable-firebird-sdbc],
1504         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1505 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1507 AC_ARG_ENABLE(bogus-pkg-config,
1508     AS_HELP_STRING([--enable-bogus-pkg-config],
1509         [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.]),
1512 AC_ARG_ENABLE(openssl,
1513     AS_HELP_STRING([--disable-openssl],
1514         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1515          components will either use GNUTLS or NSS. Work in progress,
1516          use only if you are hacking on it.]),
1517 ,enable_openssl=yes)
1519 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1520     AS_HELP_STRING([--enable-cipher-openssl-backend],
1521         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1522          Requires --enable-openssl.]))
1524 AC_ARG_ENABLE(library-bin-tar,
1525     AS_HELP_STRING([--enable-library-bin-tar],
1526         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1527         Some libraries can save their build result in a tarball
1528         stored in TARFILE_LOCATION. That binary tarball is
1529         uniquely identified by the source tarball,
1530         the content of the config_host.mk file and the content
1531         of the top-level directory in core for that library
1532         If this option is enabled, then if such a tarfile exist, it will be untarred
1533         instead of the source tarfile, and the build step will be skipped for that
1534         library.
1535         If a proper tarfile does not exist, then the normal source-based
1536         build is done for that library and a proper binary tarfile is created
1537         for the next time.]),
1540 AC_ARG_ENABLE(dconf,
1541     AS_HELP_STRING([--disable-dconf],
1542         [Disable the dconf configuration backend (enabled by default where
1543          available).]))
1545 libo_FUZZ_ARG_ENABLE(formula-logger,
1546     AS_HELP_STRING(
1547         [--enable-formula-logger],
1548         [Enable formula logger for logging formula calculation flow in Calc.]
1549     )
1552 AC_ARG_ENABLE(ldap,
1553     AS_HELP_STRING([--disable-ldap],
1554         [Disable LDAP support.]),
1555 ,enable_ldap=yes)
1557 dnl ===================================================================
1558 dnl Optional Packages (--with/without-)
1559 dnl ===================================================================
1561 AC_ARG_WITH(gcc-home,
1562     AS_HELP_STRING([--with-gcc-home],
1563         [Specify the location of gcc/g++ manually. This can be used in conjunction
1564          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1565          non-default path.]),
1568 AC_ARG_WITH(gnu-patch,
1569     AS_HELP_STRING([--with-gnu-patch],
1570         [Specify location of GNU patch on Solaris or FreeBSD.]),
1573 AC_ARG_WITH(build-platform-configure-options,
1574     AS_HELP_STRING([--with-build-platform-configure-options],
1575         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1578 AC_ARG_WITH(gnu-cp,
1579     AS_HELP_STRING([--with-gnu-cp],
1580         [Specify location of GNU cp on Solaris or FreeBSD.]),
1583 AC_ARG_WITH(external-tar,
1584     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1585         [Specify an absolute path of where to find (and store) tarfiles.]),
1586     TARFILE_LOCATION=$withval ,
1589 AC_ARG_WITH(referenced-git,
1590     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1591         [Specify another checkout directory to reference. This makes use of
1592                  git submodule update --reference, and saves a lot of diskspace
1593                  when having multiple trees side-by-side.]),
1594     GIT_REFERENCE_SRC=$withval ,
1597 AC_ARG_WITH(linked-git,
1598     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1599         [Specify a directory where the repositories of submodules are located.
1600          This uses a method similar to git-new-workdir to get submodules.]),
1601     GIT_LINK_SRC=$withval ,
1604 AC_ARG_WITH(galleries,
1605     AS_HELP_STRING([--with-galleries],
1606         [Specify how galleries should be built. It is possible either to
1607          build these internally from source ("build"),
1608          or to disable them ("no")]),
1611 AC_ARG_WITH(theme,
1612     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1613         [Choose which themes to include. By default those themes with an '*' are included.
1614          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1615          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
1618 libo_FUZZ_ARG_WITH(helppack-integration,
1619     AS_HELP_STRING([--without-helppack-integration],
1620         [It will not integrate the helppacks to the installer
1621          of the product. Please use this switch to use the online help
1622          or separate help packages.]),
1625 libo_FUZZ_ARG_WITH(fonts,
1626     AS_HELP_STRING([--without-fonts],
1627         [LibreOffice includes some third-party fonts to provide a reliable basis for
1628          help content, templates, samples, etc. When these fonts are already
1629          known to be available on the system then you should use this option.]),
1632 AC_ARG_WITH(epm,
1633     AS_HELP_STRING([--with-epm],
1634         [Decides which epm to use. Default is to use the one from the system if
1635          one is built. When either this is not there or you say =internal epm
1636          will be built.]),
1639 AC_ARG_WITH(package-format,
1640     AS_HELP_STRING([--with-package-format],
1641         [Specify package format(s) for LibreOffice installation sets. The
1642          implicit --without-package-format leads to no installation sets being
1643          generated. Possible values: aix, archive, bsd, deb, dmg,
1644          installed, msi, pkg, and rpm.
1645          Example: --with-package-format='deb rpm']),
1648 AC_ARG_WITH(tls,
1649     AS_HELP_STRING([--with-tls],
1650         [Decides which TLS/SSL and cryptographic implementations to use for
1651          LibreOffice's code. Notice that this doesn't apply for depending
1652          libraries like "neon", for example. Default is to use NSS
1653          although OpenSSL is also possible. Notice that selecting NSS restricts
1654          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1655          restrict by now the usage of NSS in LO's code. Possible values:
1656          openssl, nss. Example: --with-tls="nss"]),
1659 AC_ARG_WITH(system-libs,
1660     AS_HELP_STRING([--with-system-libs],
1661         [Use libraries already on system -- enables all --with-system-* flags.]),
1664 AC_ARG_WITH(system-bzip2,
1665     AS_HELP_STRING([--with-system-bzip2],
1666         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1667     [with_system_bzip2="$with_system_libs"])
1669 AC_ARG_WITH(system-headers,
1670     AS_HELP_STRING([--with-system-headers],
1671         [Use headers already on system -- enables all --with-system-* flags for
1672          external packages whose headers are the only entities used i.e.
1673          boost/odbc/sane-header(s).]),,
1674     [with_system_headers="$with_system_libs"])
1676 AC_ARG_WITH(system-jars,
1677     AS_HELP_STRING([--without-system-jars],
1678         [When building with --with-system-libs, also the needed jars are expected
1679          on the system. Use this to disable that]),,
1680     [with_system_jars="$with_system_libs"])
1682 AC_ARG_WITH(system-cairo,
1683     AS_HELP_STRING([--with-system-cairo],
1684         [Use cairo libraries already on system.  Happens automatically for
1685          (implicit) --enable-gtk3.]))
1687 AC_ARG_WITH(system-epoxy,
1688     AS_HELP_STRING([--with-system-epoxy],
1689         [Use epoxy libraries already on system.  Happens automatically for
1690          (implicit) --enable-gtk3.]),,
1691        [with_system_epoxy="$with_system_libs"])
1693 AC_ARG_WITH(myspell-dicts,
1694     AS_HELP_STRING([--with-myspell-dicts],
1695         [Adds myspell dictionaries to the LibreOffice installation set]),
1698 AC_ARG_WITH(system-dicts,
1699     AS_HELP_STRING([--without-system-dicts],
1700         [Do not use dictionaries from system paths.]),
1703 AC_ARG_WITH(external-dict-dir,
1704     AS_HELP_STRING([--with-external-dict-dir],
1705         [Specify external dictionary dir.]),
1708 AC_ARG_WITH(external-hyph-dir,
1709     AS_HELP_STRING([--with-external-hyph-dir],
1710         [Specify external hyphenation pattern dir.]),
1713 AC_ARG_WITH(external-thes-dir,
1714     AS_HELP_STRING([--with-external-thes-dir],
1715         [Specify external thesaurus dir.]),
1718 AC_ARG_WITH(system-zlib,
1719     AS_HELP_STRING([--with-system-zlib],
1720         [Use zlib already on system.]),,
1721     [with_system_zlib=auto])
1723 AC_ARG_WITH(system-jpeg,
1724     AS_HELP_STRING([--with-system-jpeg],
1725         [Use jpeg already on system.]),,
1726     [with_system_jpeg="$with_system_libs"])
1728 AC_ARG_WITH(system-clucene,
1729     AS_HELP_STRING([--with-system-clucene],
1730         [Use clucene already on system.]),,
1731     [with_system_clucene="$with_system_libs"])
1733 AC_ARG_WITH(system-expat,
1734     AS_HELP_STRING([--with-system-expat],
1735         [Use expat already on system.]),,
1736     [with_system_expat="$with_system_libs"])
1738 AC_ARG_WITH(system-libxml,
1739     AS_HELP_STRING([--with-system-libxml],
1740         [Use libxml/libxslt already on system.]),,
1741     [with_system_libxml=auto])
1743 AC_ARG_WITH(system-icu,
1744     AS_HELP_STRING([--with-system-icu],
1745         [Use icu already on system.]),,
1746     [with_system_icu="$with_system_libs"])
1748 AC_ARG_WITH(system-ucpp,
1749     AS_HELP_STRING([--with-system-ucpp],
1750         [Use ucpp already on system.]),,
1751     [])
1753 AC_ARG_WITH(system-openldap,
1754     AS_HELP_STRING([--with-system-openldap],
1755         [Use the OpenLDAP LDAP SDK already on system.]),,
1756     [with_system_openldap="$with_system_libs"])
1758 libo_FUZZ_ARG_ENABLE(poppler,
1759     AS_HELP_STRING([--disable-poppler],
1760         [Disable building Poppler.])
1763 AC_ARG_WITH(system-poppler,
1764     AS_HELP_STRING([--with-system-poppler],
1765         [Use system poppler (only needed for PDF import).]),,
1766     [with_system_poppler="$with_system_libs"])
1768 AC_ARG_WITH(system-gpgmepp,
1769     AS_HELP_STRING([--with-system-gpgmepp],
1770         [Use gpgmepp already on system]),,
1771     [with_system_gpgmepp="$with_system_libs"])
1773 AC_ARG_WITH(system-apache-commons,
1774     AS_HELP_STRING([--with-system-apache-commons],
1775         [Use Apache commons libraries already on system.]),,
1776     [with_system_apache_commons="$with_system_jars"])
1778 AC_ARG_WITH(system-mariadb,
1779     AS_HELP_STRING([--with-system-mariadb],
1780         [Use MariaDB/MySQL libraries already on system.]),,
1781     [with_system_mariadb="$with_system_libs"])
1783 AC_ARG_ENABLE(bundle-mariadb,
1784     AS_HELP_STRING([--enable-bundle-mariadb],
1785         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1788 AC_ARG_WITH(system-postgresql,
1789     AS_HELP_STRING([--with-system-postgresql],
1790         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1791          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1792     [with_system_postgresql="$with_system_libs"])
1794 AC_ARG_WITH(libpq-path,
1795     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1796         [Use this PostgreSQL C interface (libpq) installation for building
1797          the PostgreSQL-SDBC extension.]),
1800 AC_ARG_WITH(system-firebird,
1801     AS_HELP_STRING([--with-system-firebird],
1802         [Use Firebird libraries already on system, for building the Firebird-SDBC
1803          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1804     [with_system_firebird="$with_system_libs"])
1806 AC_ARG_WITH(system-libtommath,
1807             AS_HELP_STRING([--with-system-libtommath],
1808                            [Use libtommath already on system]),,
1809             [with_system_libtommath="$with_system_libs"])
1811 AC_ARG_WITH(system-hsqldb,
1812     AS_HELP_STRING([--with-system-hsqldb],
1813         [Use hsqldb already on system.]))
1815 AC_ARG_WITH(hsqldb-jar,
1816     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1817         [Specify path to jarfile manually.]),
1818     HSQLDB_JAR=$withval)
1820 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1821     AS_HELP_STRING([--disable-scripting-beanshell],
1822         [Disable support for scripts in BeanShell.]),
1826 AC_ARG_WITH(system-beanshell,
1827     AS_HELP_STRING([--with-system-beanshell],
1828         [Use beanshell already on system.]),,
1829     [with_system_beanshell="$with_system_jars"])
1831 AC_ARG_WITH(beanshell-jar,
1832     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1833         [Specify path to jarfile manually.]),
1834     BSH_JAR=$withval)
1836 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1837     AS_HELP_STRING([--disable-scripting-javascript],
1838         [Disable support for scripts in JavaScript.]),
1842 AC_ARG_WITH(system-rhino,
1843     AS_HELP_STRING([--with-system-rhino],
1844         [Use rhino already on system.]),,)
1845 #    [with_system_rhino="$with_system_jars"])
1846 # Above is not used as we have different debug interface
1847 # patched into internal rhino. This code needs to be fixed
1848 # before we can enable it by default.
1850 AC_ARG_WITH(rhino-jar,
1851     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1852         [Specify path to jarfile manually.]),
1853     RHINO_JAR=$withval)
1855 AC_ARG_WITH(commons-logging-jar,
1856     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1857         [Specify path to jarfile manually.]),
1858     COMMONS_LOGGING_JAR=$withval)
1860 AC_ARG_WITH(system-jfreereport,
1861     AS_HELP_STRING([--with-system-jfreereport],
1862         [Use JFreeReport already on system.]),,
1863     [with_system_jfreereport="$with_system_jars"])
1865 AC_ARG_WITH(sac-jar,
1866     AS_HELP_STRING([--with-sac-jar=JARFILE],
1867         [Specify path to jarfile manually.]),
1868     SAC_JAR=$withval)
1870 AC_ARG_WITH(libxml-jar,
1871     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1872         [Specify path to jarfile manually.]),
1873     LIBXML_JAR=$withval)
1875 AC_ARG_WITH(flute-jar,
1876     AS_HELP_STRING([--with-flute-jar=JARFILE],
1877         [Specify path to jarfile manually.]),
1878     FLUTE_JAR=$withval)
1880 AC_ARG_WITH(jfreereport-jar,
1881     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1882         [Specify path to jarfile manually.]),
1883     JFREEREPORT_JAR=$withval)
1885 AC_ARG_WITH(liblayout-jar,
1886     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1887         [Specify path to jarfile manually.]),
1888     LIBLAYOUT_JAR=$withval)
1890 AC_ARG_WITH(libloader-jar,
1891     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1892         [Specify path to jarfile manually.]),
1893     LIBLOADER_JAR=$withval)
1895 AC_ARG_WITH(libformula-jar,
1896     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1897         [Specify path to jarfile manually.]),
1898     LIBFORMULA_JAR=$withval)
1900 AC_ARG_WITH(librepository-jar,
1901     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1902         [Specify path to jarfile manually.]),
1903     LIBREPOSITORY_JAR=$withval)
1905 AC_ARG_WITH(libfonts-jar,
1906     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1907         [Specify path to jarfile manually.]),
1908     LIBFONTS_JAR=$withval)
1910 AC_ARG_WITH(libserializer-jar,
1911     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1912         [Specify path to jarfile manually.]),
1913     LIBSERIALIZER_JAR=$withval)
1915 AC_ARG_WITH(libbase-jar,
1916     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1917         [Specify path to jarfile manually.]),
1918     LIBBASE_JAR=$withval)
1920 AC_ARG_WITH(system-odbc,
1921     AS_HELP_STRING([--with-system-odbc],
1922         [Use the odbc headers already on system.]),,
1923     [with_system_odbc="auto"])
1925 AC_ARG_WITH(system-sane,
1926     AS_HELP_STRING([--with-system-sane],
1927         [Use sane.h already on system.]),,
1928     [with_system_sane="$with_system_headers"])
1930 AC_ARG_WITH(system-bluez,
1931     AS_HELP_STRING([--with-system-bluez],
1932         [Use bluetooth.h already on system.]),,
1933     [with_system_bluez="$with_system_headers"])
1935 AC_ARG_WITH(system-curl,
1936     AS_HELP_STRING([--with-system-curl],
1937         [Use curl already on system.]),,
1938     [with_system_curl=auto])
1940 AC_ARG_WITH(system-boost,
1941     AS_HELP_STRING([--with-system-boost],
1942         [Use boost already on system.]),,
1943     [with_system_boost="$with_system_headers"])
1945 AC_ARG_WITH(system-glm,
1946     AS_HELP_STRING([--with-system-glm],
1947         [Use glm already on system.]),,
1948     [with_system_glm="$with_system_headers"])
1950 AC_ARG_WITH(system-hunspell,
1951     AS_HELP_STRING([--with-system-hunspell],
1952         [Use libhunspell already on system.]),,
1953     [with_system_hunspell="$with_system_libs"])
1955 AC_ARG_WITH(system-qrcodegen,
1956     AS_HELP_STRING([--with-system-qrcodegen],
1957         [Use libqrcodegen already on system.]),,
1958     [with_system_qrcodegen="$with_system_libs"])
1960 AC_ARG_WITH(system-box2d,
1961     AS_HELP_STRING([--with-system-box2d],
1962         [Use box2d already on system.]),,
1963     [with_system_box2d="$with_system_libs"])
1965 AC_ARG_WITH(system-mythes,
1966     AS_HELP_STRING([--with-system-mythes],
1967         [Use mythes already on system.]),,
1968     [with_system_mythes="$with_system_libs"])
1970 AC_ARG_WITH(system-altlinuxhyph,
1971     AS_HELP_STRING([--with-system-altlinuxhyph],
1972         [Use ALTLinuxhyph already on system.]),,
1973     [with_system_altlinuxhyph="$with_system_libs"])
1975 AC_ARG_WITH(system-lpsolve,
1976     AS_HELP_STRING([--with-system-lpsolve],
1977         [Use lpsolve already on system.]),,
1978     [with_system_lpsolve="$with_system_libs"])
1980 AC_ARG_WITH(system-coinmp,
1981     AS_HELP_STRING([--with-system-coinmp],
1982         [Use CoinMP already on system.]),,
1983     [with_system_coinmp="$with_system_libs"])
1985 AC_ARG_WITH(system-liblangtag,
1986     AS_HELP_STRING([--with-system-liblangtag],
1987         [Use liblangtag library already on system.]),,
1988     [with_system_liblangtag="$with_system_libs"])
1990 AC_ARG_WITH(webdav,
1991     AS_HELP_STRING([--with-webdav],
1992         [Specify which library to use for webdav implementation.
1993          Possible values: "neon", "serf", "no". The default value is "neon".
1994          Example: --with-webdav="serf"]),
1995     WITH_WEBDAV=$withval,
1996     WITH_WEBDAV="neon")
1998 AC_ARG_WITH(linker-hash-style,
1999     AS_HELP_STRING([--with-linker-hash-style],
2000         [Use linker with --hash-style=<style> when linking shared objects.
2001          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2002          if supported on the build system, and "sysv" otherwise.]))
2004 AC_ARG_WITH(jdk-home,
2005     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2006         [If you have installed JDK 9 or later on your system please supply the
2007          path here. Note that this is not the location of the java command but the
2008          location of the entire distribution.]),
2011 AC_ARG_WITH(help,
2012     AS_HELP_STRING([--with-help],
2013         [Enable the build of help. There is a special parameter "common" that
2014          can be used to bundle only the common part, .e.g help-specific icons.
2015          This is useful when you build the helpcontent separately.])
2016     [
2017                           Usage:     --with-help    build the old local help
2018                                  --without-help     no local help (default)
2019                                  --with-help=html   build the new HTML local help
2020                                  --with-help=online build the new HTML online help
2021     ],
2024 AC_ARG_WITH(omindex,
2025    AS_HELP_STRING([--with-omindex],
2026         [Enable the support of xapian-omega index for online help.])
2027    [
2028                          Usage: --with-omindex=server prepare the pages for omindex
2029                                 but let xapian-omega be built in server.
2030                                 --with-omindex=noxap do not prepare online pages
2031                                 for xapian-omega
2032   ],
2035 libo_FUZZ_ARG_WITH(java,
2036     AS_HELP_STRING([--with-java=<java command>],
2037         [Specify the name of the Java interpreter command. Typically "java"
2038          which is the default.
2040          To build without support for Java components, applets, accessibility
2041          or the XML filters written in Java, use --without-java or --with-java=no.]),
2042     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2043     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2046 AC_ARG_WITH(jvm-path,
2047     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2048         [Use a specific JVM search path at runtime.
2049          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2052 AC_ARG_WITH(ant-home,
2053     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2054         [If you have installed Apache Ant on your system, please supply the path here.
2055          Note that this is not the location of the Ant binary but the location
2056          of the entire distribution.]),
2059 AC_ARG_WITH(symbol-config,
2060     AS_HELP_STRING([--with-symbol-config],
2061         [Configuration for the crashreport symbol upload]),
2062         [],
2063         [with_symbol_config=no])
2065 AC_ARG_WITH(export-validation,
2066     AS_HELP_STRING([--without-export-validation],
2067         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2068 ,with_export_validation=auto)
2070 AC_ARG_WITH(bffvalidator,
2071     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2072         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2073          Requires installed Microsoft Office Binary File Format Validator.
2074          Note: export-validation (--with-export-validation) is required to be turned on.
2075          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2076 ,with_bffvalidator=no)
2078 libo_FUZZ_ARG_WITH(junit,
2079     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2080         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2081          --without-junit disables those tests. Not relevant in the --without-java case.]),
2082 ,with_junit=yes)
2084 AC_ARG_WITH(hamcrest,
2085     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2086         [Specifies the hamcrest jar file to use for JUnit-based tests.
2087          --without-junit disables those tests. Not relevant in the --without-java case.]),
2088 ,with_hamcrest=yes)
2090 AC_ARG_WITH(perl-home,
2091     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2092         [If you have installed Perl 5 Distribution, on your system, please
2093          supply the path here. Note that this is not the location of the Perl
2094          binary but the location of the entire distribution.]),
2097 libo_FUZZ_ARG_WITH(doxygen,
2098     AS_HELP_STRING(
2099         [--with-doxygen=<absolute path to doxygen executable>],
2100         [Specifies the doxygen executable to use when generating ODK C/C++
2101          documentation. --without-doxygen disables generation of ODK C/C++
2102          documentation. Not relevant in the --disable-odk case.]),
2103 ,with_doxygen=yes)
2105 AC_ARG_WITH(visual-studio,
2106     AS_HELP_STRING([--with-visual-studio=<2019>],
2107         [Specify which Visual Studio version to use in case several are
2108          installed. Currently only 2019 (default) is supported.]),
2111 AC_ARG_WITH(windows-sdk,
2112     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2113         [Specify which Windows SDK, or "Windows Kit", version to use
2114          in case the one that came with the selected Visual Studio
2115          is not what you want for some reason. Note that not all compiler/SDK
2116          combinations are supported. The intent is that this option should not
2117          be needed.]),
2120 AC_ARG_WITH(lang,
2121     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2122         [Use this option to build LibreOffice with additional UI language support.
2123          English (US) is always included by default.
2124          Separate multiple languages with space.
2125          For all languages, use --with-lang=ALL.]),
2128 AC_ARG_WITH(locales,
2129     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2130         [Use this option to limit the locale information built in.
2131          Separate multiple locales with space.
2132          Very experimental and might well break stuff.
2133          Just a desperate measure to shrink code and data size.
2134          By default all the locales available is included.
2135          This option is completely unrelated to --with-lang.])
2136     [
2137                           Affects also our character encoding conversion
2138                           tables for encodings mainly targeted for a
2139                           particular locale, like EUC-CN and EUC-TW for
2140                           zh, ISO-2022-JP for ja.
2142                           Affects also our add-on break iterator data for
2143                           some languages.
2145                           For the default, all locales, don't use this switch at all.
2146                           Specifying just the language part of a locale means all matching
2147                           locales will be included.
2148     ],
2151 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2152 libo_FUZZ_ARG_WITH(krb5,
2153     AS_HELP_STRING([--with-krb5],
2154         [Enable MIT Kerberos 5 support in modules that support it.
2155          By default automatically enabled on platforms
2156          where a good system Kerberos 5 is available.]),
2159 libo_FUZZ_ARG_WITH(gssapi,
2160     AS_HELP_STRING([--with-gssapi],
2161         [Enable GSSAPI support in modules that support it.
2162          By default automatically enabled on platforms
2163          where a good system GSSAPI is available.]),
2166 AC_ARG_WITH(iwyu,
2167     AS_HELP_STRING([--with-iwyu],
2168         [Use given IWYU binary path to check unneeded includes instead of building.
2169          Use only if you are hacking on it.]),
2172 libo_FUZZ_ARG_WITH(lxml,
2173     AS_HELP_STRING([--without-lxml],
2174         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2175          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2176          report widget classes and ids.]),
2179 libo_FUZZ_ARG_WITH(latest-c++,
2180     AS_HELP_STRING([--with-latest-c++],
2181         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2182          published standard.]),,
2183         [with_latest_c__=no])
2185 dnl ===================================================================
2186 dnl Branding
2187 dnl ===================================================================
2189 AC_ARG_WITH(branding,
2190     AS_HELP_STRING([--with-branding=/path/to/images],
2191         [Use given path to retrieve branding images set.])
2192     [
2193                           Search for intro.png about.svg and logo.svg.
2194                           If any is missing, default ones will be used instead.
2196                           Search also progress.conf for progress
2197                           settings on intro screen :
2199                           PROGRESSBARCOLOR="255,255,255" Set color of
2200                           progress bar. Comma separated RGB decimal values.
2201                           PROGRESSSIZE="407,6" Set size of progress bar.
2202                           Comma separated decimal values (width, height).
2203                           PROGRESSPOSITION="61,317" Set position of progress
2204                           bar from left,top. Comma separated decimal values.
2205                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2206                           bar frame. Comma separated RGB decimal values.
2207                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2208                           bar text. Comma separated RGB decimal values.
2209                           PROGRESSTEXTBASELINE="287" Set vertical position of
2210                           progress bar text from top. Decimal value.
2212                           Default values will be used if not found.
2213     ],
2217 AC_ARG_WITH(extra-buildid,
2218     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2219         [Show addition build identification in about dialog.]),
2223 AC_ARG_WITH(vendor,
2224     AS_HELP_STRING([--with-vendor="John the Builder"],
2225         [Set vendor of the build.]),
2228 AC_ARG_WITH(android-package-name,
2229     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2230         [Set Android package name of the build.]),
2233 AC_ARG_WITH(compat-oowrappers,
2234     AS_HELP_STRING([--with-compat-oowrappers],
2235         [Install oo* wrappers in parallel with
2236          lo* ones to keep backward compatibility.
2237          Has effect only with make distro-pack-install]),
2240 AC_ARG_WITH(os-version,
2241     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2242         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2245 AC_ARG_WITH(mingw-cross-compiler,
2246     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2247         [Specify the MinGW cross-compiler to use.
2248          When building on the ODK on Unix and building unowinreg.dll,
2249          specify the MinGW C++ cross-compiler.]),
2252 AC_ARG_WITH(idlc-cpp,
2253     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2254         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2257 AC_ARG_WITH(build-version,
2258     AS_HELP_STRING([--with-build-version="Built by Jim"],
2259         [Allows the builder to add a custom version tag that will appear in the
2260          Help/About box for QA purposes.]),
2261 with_build_version=$withval,
2264 AC_ARG_WITH(parallelism,
2265     AS_HELP_STRING([--with-parallelism],
2266         [Number of jobs to run simultaneously during build. Parallel builds can
2267         save a lot of time on multi-cpu machines. Defaults to the number of
2268         CPUs on the machine, unless you configure --enable-icecream - then to
2269         40.]),
2272 AC_ARG_WITH(all-tarballs,
2273     AS_HELP_STRING([--with-all-tarballs],
2274         [Download all external tarballs unconditionally]))
2276 AC_ARG_WITH(gdrive-client-id,
2277     AS_HELP_STRING([--with-gdrive-client-id],
2278         [Provides the client id of the application for OAuth2 authentication
2279         on Google Drive. If either this or --with-gdrive-client-secret is
2280         empty, the feature will be disabled]),
2283 AC_ARG_WITH(gdrive-client-secret,
2284     AS_HELP_STRING([--with-gdrive-client-secret],
2285         [Provides the client secret of the application for OAuth2
2286         authentication on Google Drive. If either this or
2287         --with-gdrive-client-id is empty, the feature will be disabled]),
2290 AC_ARG_WITH(alfresco-cloud-client-id,
2291     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2292         [Provides the client id of the application for OAuth2 authentication
2293         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2294         empty, the feature will be disabled]),
2297 AC_ARG_WITH(alfresco-cloud-client-secret,
2298     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2299         [Provides the client secret of the application for OAuth2
2300         authentication on Alfresco Cloud. If either this or
2301         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2304 AC_ARG_WITH(onedrive-client-id,
2305     AS_HELP_STRING([--with-onedrive-client-id],
2306         [Provides the client id of the application for OAuth2 authentication
2307         on OneDrive. If either this or --with-onedrive-client-secret is
2308         empty, the feature will be disabled]),
2311 AC_ARG_WITH(onedrive-client-secret,
2312     AS_HELP_STRING([--with-onedrive-client-secret],
2313         [Provides the client secret of the application for OAuth2
2314         authentication on OneDrive. If either this or
2315         --with-onedrive-client-id is empty, the feature will be disabled]),
2317 dnl ===================================================================
2318 dnl Do we want to use pre-build binary tarball for recompile
2319 dnl ===================================================================
2321 if test "$enable_library_bin_tar" = "yes" ; then
2322     USE_LIBRARY_BIN_TAR=TRUE
2323 else
2324     USE_LIBRARY_BIN_TAR=
2326 AC_SUBST(USE_LIBRARY_BIN_TAR)
2328 dnl ===================================================================
2329 dnl Test whether build target is Release Build
2330 dnl ===================================================================
2331 AC_MSG_CHECKING([whether build target is Release Build])
2332 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2333     AC_MSG_RESULT([no])
2334     ENABLE_RELEASE_BUILD=
2335     GET_TASK_ALLOW_ENTITLEMENT='
2336         <!-- We want to be able to debug a hardened process when not building for release -->
2337         <key>com.apple.security.get-task-allow</key>
2338         <true/>'
2339 else
2340     AC_MSG_RESULT([yes])
2341     ENABLE_RELEASE_BUILD=TRUE
2342     GET_TASK_ALLOW_ENTITLEMENT=''
2344 AC_SUBST(ENABLE_RELEASE_BUILD)
2345 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2347 dnl ===================================================================
2348 dnl Test whether to sign Windows Build
2349 dnl ===================================================================
2350 AC_MSG_CHECKING([whether to sign windows build])
2351 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2352     AC_MSG_RESULT([yes])
2353     WINDOWS_BUILD_SIGNING="TRUE"
2354 else
2355     AC_MSG_RESULT([no])
2356     WINDOWS_BUILD_SIGNING="FALSE"
2358 AC_SUBST(WINDOWS_BUILD_SIGNING)
2360 dnl ===================================================================
2361 dnl MacOSX build and runtime environment options
2362 dnl ===================================================================
2364 AC_ARG_WITH(macosx-sdk,
2365     AS_HELP_STRING([--with-macosx-sdk=<version>],
2366         [Prefer a specific SDK for building.])
2367     [
2368                           If the requested SDK is not available, a search for the oldest one will be done.
2369                           With current Xcode versions, only the latest SDK is included, so this option is
2370                           not terribly useful. It works fine to build with a new SDK and run the result
2371                           on an older OS.
2373                           e. g.: --with-macosx-sdk=10.10
2375                           there are 3 options to control the MacOSX build:
2376                           --with-macosx-sdk (referred as 'sdk' below)
2377                           --with-macosx-version-min-required (referred as 'min' below)
2378                           --with-macosx-version-max-allowed (referred as 'max' below)
2380                           the connection between these value and the default they take is as follow:
2381                           ( ? means not specified on the command line, s means the SDK version found,
2382                           constraint: 8 <= x <= y <= z)
2384                           ==========================================
2385                            command line      || config result
2386                           ==========================================
2387                           min  | max  | sdk  || min   | max  | sdk  |
2388                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2389                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2390                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2391                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2392                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2393                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2394                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2395                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2398                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2399                           for a detailed technical explanation of these variables
2401                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2402     ],
2405 AC_ARG_WITH(macosx-version-min-required,
2406     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2407         [set the minimum OS version needed to run the built LibreOffice])
2408     [
2409                           e. g.: --with-macos-version-min-required=10.10
2410                           see --with-macosx-sdk for more info
2411     ],
2414 AC_ARG_WITH(macosx-version-max-allowed,
2415     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2416         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2417     [
2418                           e. g.: --with-macos-version-max-allowed=10.10
2419                           see --with-macosx-sdk for more info
2420     ],
2424 dnl ===================================================================
2425 dnl options for stuff used during cross-compilation build
2426 dnl Not quite superseded by --with-build-platform-configure-options.
2427 dnl TODO: check, if the "force" option is still needed anywhere.
2428 dnl ===================================================================
2430 AC_ARG_WITH(system-icu-for-build,
2431     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2432         [Use icu already on system for build tools (cross-compilation only).]))
2435 dnl ===================================================================
2436 dnl Check for incompatible options set by fuzzing, and reset those
2437 dnl automatically to working combinations
2438 dnl ===================================================================
2440 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2441         "$enable_dbus" != "$enable_avahi"; then
2442     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2443     enable_avahi=$enable_dbus
2446 add_lopath_after ()
2448     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2449         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2450     fi
2453 add_lopath_before ()
2455     local IFS=${P_SEP}
2456     local path_cleanup
2457     local dir
2458     for dir in $LO_PATH ; do
2459         if test "$dir" != "$1" ; then
2460             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2461         fi
2462     done
2463     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2466 dnl ===================================================================
2467 dnl check for required programs (grep, awk, sed, bash)
2468 dnl ===================================================================
2470 pathmunge ()
2472     if test -n "$1"; then
2473         if test "$build_os" = "cygwin"; then
2474             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2475                 PathFormat "$1"
2476                 new_path=`cygpath -sm "$formatted_path"`
2477             else
2478                 PathFormat "$1"
2479                 new_path=`cygpath -u "$formatted_path"`
2480             fi
2481         else
2482             new_path="$1"
2483         fi
2484         if test "$2" = "after"; then
2485             add_lopath_after "$new_path"
2486         else
2487             add_lopath_before "$new_path"
2488         fi
2489         unset new_path
2490     fi
2493 AC_PROG_AWK
2494 AC_PATH_PROG( AWK, $AWK)
2495 if test -z "$AWK"; then
2496     AC_MSG_ERROR([install awk to run this script])
2499 AC_PATH_PROG(BASH, bash)
2500 if test -z "$BASH"; then
2501     AC_MSG_ERROR([bash not found in \$PATH])
2503 AC_SUBST(BASH)
2505 AC_MSG_CHECKING([for GNU or BSD tar])
2506 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2507     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2508     if test $? -eq 0;  then
2509         GNUTAR=$a
2510         break
2511     fi
2512 done
2513 AC_MSG_RESULT($GNUTAR)
2514 if test -z "$GNUTAR"; then
2515     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2517 AC_SUBST(GNUTAR)
2519 AC_MSG_CHECKING([for tar's option to strip components])
2520 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2521 if test $? -eq 0; then
2522     STRIP_COMPONENTS="--strip-components"
2523 else
2524     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2525     if test $? -eq 0; then
2526         STRIP_COMPONENTS="--strip-path"
2527     else
2528         STRIP_COMPONENTS="unsupported"
2529     fi
2531 AC_MSG_RESULT($STRIP_COMPONENTS)
2532 if test x$STRIP_COMPONENTS = xunsupported; then
2533     AC_MSG_ERROR([you need a tar that is able to strip components.])
2535 AC_SUBST(STRIP_COMPONENTS)
2537 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2538 dnl desktop OSes from "mobile" ones.
2540 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2541 dnl In other words, that when building for an OS that is not a
2542 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2544 dnl Note the direction of the implication; there is no assumption that
2545 dnl cross-compiling would imply a non-desktop OS.
2547 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2548     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2549     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2550     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2553 # Whether to build "avmedia" functionality or not.
2555 if test -z "$enable_avmedia"; then
2556     enable_avmedia=yes
2559 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2560 if test "$enable_avmedia" = yes; then
2561     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2562 else
2563     USE_AVMEDIA_DUMMY='TRUE'
2565 AC_SUBST(USE_AVMEDIA_DUMMY)
2567 # Decide whether to build database connectivity stuff (including
2568 # Base) or not. We probably don't want to on non-desktop OSes.
2569 if test -z "$enable_database_connectivity"; then
2570     # --disable-database-connectivity is unfinished work in progress
2571     # and the iOS test app doesn't link if we actually try to use it.
2572     # if test $_os != iOS -a $_os != Android; then
2573     if test $_os != iOS; then
2574         enable_database_connectivity=yes
2575     fi
2578 if test "$enable_database_connectivity" = yes; then
2579     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2580     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2583 if test -z "$enable_extensions"; then
2584     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2585     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2586         enable_extensions=yes
2587     fi
2590 if test "$enable_extensions" = yes; then
2591     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2592     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2595 if test -z "$enable_scripting"; then
2596     # Disable scripting for iOS unless specifically overridden
2597     # with --enable-scripting.
2598     if test $_os != iOS; then
2599         enable_scripting=yes
2600     fi
2603 DISABLE_SCRIPTING=''
2604 if test "$enable_scripting" = yes; then
2605     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2606     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2607 else
2608     DISABLE_SCRIPTING='TRUE'
2609     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2612 if test $_os = iOS -o $_os = Android; then
2613     # Disable dynamic_loading always for iOS and Android
2614     enable_dynamic_loading=no
2615 elif test -z "$enable_dynamic_loading"; then
2616     # Otherwise enable it unless specifically disabled
2617     enable_dynamic_loading=yes
2620 DISABLE_DYNLOADING=''
2621 if test "$enable_dynamic_loading" = yes; then
2622     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2623 else
2624     DISABLE_DYNLOADING='TRUE'
2626 AC_SUBST(DISABLE_DYNLOADING)
2628 # remember SYSBASE value
2629 AC_SUBST(SYSBASE)
2631 dnl ===================================================================
2632 dnl  Sort out various gallery compilation options
2633 dnl ===================================================================
2634 AC_MSG_CHECKING([how to build and package galleries])
2635 if test -n "${with_galleries}"; then
2636     if test "$with_galleries" = "build"; then
2637         WITH_GALLERY_BUILD=TRUE
2638         AC_MSG_RESULT([build from source images internally])
2639     elif test "$with_galleries" = "no"; then
2640         WITH_GALLERY_BUILD=
2641         AC_MSG_RESULT([disable non-internal gallery build])
2642     else
2643         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2644     fi
2645 else
2646     if test $_os != iOS -a $_os != Android; then
2647         WITH_GALLERY_BUILD=TRUE
2648         AC_MSG_RESULT([internal src images for desktop])
2649     else
2650         WITH_GALLERY_BUILD=
2651         AC_MSG_RESULT([disable src image build])
2652     fi
2654 AC_SUBST(WITH_GALLERY_BUILD)
2656 dnl ===================================================================
2657 dnl  Checks if ccache is available
2658 dnl ===================================================================
2659 CCACHE_DEPEND_MODE=
2660 if test "$_os" = "WINNT"; then
2661     # on windows/VC build do not use ccache
2662     CCACHE=""
2663 elif test "$enable_ccache" = "no"; then
2664     CCACHE=""
2665 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2666     case "%$CC%$CXX%" in
2667     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2668     # assume that's good then
2669     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2670         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2671         CCACHE_DEPEND_MODE=1
2672         ;;
2673     *)
2674         AC_PATH_PROG([CCACHE],[ccache],[not found])
2675         if test "$CCACHE" = "not found"; then
2676             CCACHE=""
2677         else
2678             CCACHE_DEPEND_MODE=1
2679             # Need to check for ccache version: otherwise prevents
2680             # caching of the results (like "-x objective-c++" for Mac)
2681             if test $_os = Darwin -o $_os = iOS; then
2682                 # Check ccache version
2683                 AC_MSG_CHECKING([whether version of ccache is suitable])
2684                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2685                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2686                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2687                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2688                 else
2689                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2690                     CCACHE=""
2691                     CCACHE_DEPEND_MODE=
2692                 fi
2693             fi
2694         fi
2695         ;;
2696     esac
2697 else
2698     CCACHE=""
2700 if test "$enable_ccache" = "nodepend"; then
2701     CCACHE_DEPEND_MODE=""
2703 AC_SUBST(CCACHE_DEPEND_MODE)
2705 if test "$CCACHE" != ""; then
2706     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2707     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2708     if test "$ccache_size" = ""; then
2709         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2710         if test "$ccache_size" = ""; then
2711             ccache_size=0
2712         fi
2713         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2714         if test $ccache_size -lt 1024; then
2715             CCACHE=""
2716             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2717             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2718         else
2719             # warn that ccache may be too small for debug build
2720             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2721             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2722         fi
2723     else
2724         if test $ccache_size -lt 5; then
2725             #warn that ccache may be too small for debug build
2726             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2727             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2728         fi
2729     fi
2732 dnl ===================================================================
2733 dnl  Checks for C compiler,
2734 dnl  The check for the C++ compiler is later on.
2735 dnl ===================================================================
2736 if test "$_os" != "WINNT"; then
2737     GCC_HOME_SET="true"
2738     AC_MSG_CHECKING([gcc home])
2739     if test -z "$with_gcc_home"; then
2740         if test "$enable_icecream" = "yes"; then
2741             if test -d "/usr/lib/icecc/bin"; then
2742                 GCC_HOME="/usr/lib/icecc/"
2743             elif test -d "/usr/libexec/icecc/bin"; then
2744                 GCC_HOME="/usr/libexec/icecc/"
2745             elif test -d "/opt/icecream/bin"; then
2746                 GCC_HOME="/opt/icecream/"
2747             else
2748                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2750             fi
2751         else
2752             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2753             GCC_HOME_SET="false"
2754         fi
2755     else
2756         GCC_HOME="$with_gcc_home"
2757     fi
2758     AC_MSG_RESULT($GCC_HOME)
2759     AC_SUBST(GCC_HOME)
2761     if test "$GCC_HOME_SET" = "true"; then
2762         if test -z "$CC"; then
2763             CC="$GCC_HOME/bin/gcc"
2764             CC_BASE="gcc"
2765         fi
2766         if test -z "$CXX"; then
2767             CXX="$GCC_HOME/bin/g++"
2768             CXX_BASE="g++"
2769         fi
2770     fi
2773 COMPATH=`dirname "$CC"`
2774 if test "$COMPATH" = "."; then
2775     AC_PATH_PROGS(COMPATH, $CC)
2776     dnl double square bracket to get single because of M4 quote...
2777     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2779 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2781 dnl ===================================================================
2782 dnl Java support
2783 dnl ===================================================================
2784 AC_MSG_CHECKING([whether to build with Java support])
2785 if test "$with_java" != "no"; then
2786     if test "$DISABLE_SCRIPTING" = TRUE; then
2787         AC_MSG_RESULT([no, overridden by --disable-scripting])
2788         ENABLE_JAVA=""
2789         with_java=no
2790     else
2791         AC_MSG_RESULT([yes])
2792         ENABLE_JAVA="TRUE"
2793         AC_DEFINE(HAVE_FEATURE_JAVA)
2794     fi
2795 else
2796     AC_MSG_RESULT([no])
2797     ENABLE_JAVA=""
2800 AC_SUBST(ENABLE_JAVA)
2802 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2804 dnl ENABLE_JAVA="" indicate no Java support at all
2806 dnl ===================================================================
2807 dnl Check macOS SDK and compiler
2808 dnl ===================================================================
2810 if test $_os = Darwin; then
2812     # If no --with-macosx-sdk option is given, look for one
2814     # The intent is that for "most" Mac-based developers, a suitable
2815     # SDK will be found automatically without any configure options.
2817     # For developers with a current Xcode, the lowest-numbered SDK
2818     # higher than or equal to the minimum required should be found.
2820     AC_MSG_CHECKING([what macOS SDK to use])
2821     for _macosx_sdk in ${with_macosx_sdk-11.0 10.15 10.14 10.13}; do
2822         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2823         if test -d "$MACOSX_SDK_PATH"; then
2824             with_macosx_sdk="${_macosx_sdk}"
2825             break
2826         else
2827             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2828             if test -d "$MACOSX_SDK_PATH"; then
2829                 with_macosx_sdk="${_macosx_sdk}"
2830                 break
2831             fi
2832         fi
2833     done
2834     if test ! -d "$MACOSX_SDK_PATH"; then
2835         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2836     fi
2838     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2840     case $with_macosx_sdk in
2841     10.13)
2842         MACOSX_SDK_VERSION=101300
2843         ;;
2844     10.14)
2845         MACOSX_SDK_VERSION=101400
2846         ;;
2847     10.15)
2848         MACOSX_SDK_VERSION=101500
2849         ;;
2850     11.0)
2851         MACOSX_SDK_VERSION=110000
2852         ;;
2853     *)
2854         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.0])
2855         ;;
2856     esac
2858     if test "$with_macosx_version_min_required" = "" ; then
2859         with_macosx_version_min_required="10.10";
2860     fi
2862     if test "$with_macosx_version_max_allowed" = "" ; then
2863         with_macosx_version_max_allowed="$with_macosx_sdk"
2864     fi
2866     # export this so that "xcrun" invocations later return matching values
2867     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2868     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2869     export DEVELOPER_DIR
2870     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2871     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2873     AC_MSG_CHECKING([whether Xcode is new enough])
2874     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2875     my_xcode_ver2=${my_xcode_ver1#Xcode }
2876     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2877     if test "$my_xcode_ver3" -ge 1103; then
2878         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2879     else
2880         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
2881     fi
2883     case "$with_macosx_version_min_required" in
2884     10.10)
2885         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2886         ;;
2887     10.11)
2888         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2889         ;;
2890     10.12)
2891         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2892         ;;
2893     10.13)
2894         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2895         ;;
2896     10.14)
2897         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2898         ;;
2899     10.15)
2900         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2901         ;;
2902     11.0)
2903         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
2904         ;;
2905     *)
2906         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--11.0])
2907         ;;
2908     esac
2910     LIBTOOL=/usr/bin/libtool
2911     INSTALL_NAME_TOOL=install_name_tool
2912     if test -z "$save_CC"; then
2913         stdlib=-stdlib=libc++
2914         if test "$ENABLE_LTO" = TRUE; then
2915             lto=-flto
2916         fi
2918         AC_MSG_CHECKING([what C compiler to use])
2919         CC="`xcrun -find clang`"
2920         CC_BASE=`first_arg_basename "$CC"`
2921         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2922         AC_MSG_RESULT([$CC])
2924         AC_MSG_CHECKING([what C++ compiler to use])
2925         CXX="`xcrun -find clang++`"
2926         CXX_BASE=`first_arg_basename "$CXX"`
2927         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2928         AC_MSG_RESULT([$CXX])
2930         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2931         AR=`xcrun -find ar`
2932         NM=`xcrun -find nm`
2933         STRIP=`xcrun -find strip`
2934         LIBTOOL=`xcrun -find libtool`
2935         RANLIB=`xcrun -find ranlib`
2936     fi
2938     case "$with_macosx_version_max_allowed" in
2939     10.10)
2940         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2941         ;;
2942     10.11)
2943         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2944         ;;
2945     10.12)
2946         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2947         ;;
2948     10.13)
2949         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2950         ;;
2951     10.14)
2952         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2953         ;;
2954     10.15)
2955         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2956         ;;
2957     11.0)
2958         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
2959         ;;
2960     *)
2961         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--11.0])
2962         ;;
2963     esac
2965     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2966     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2967         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])
2968     else
2969         AC_MSG_RESULT([ok])
2970     fi
2972     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2973     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2974         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2975     else
2976         AC_MSG_RESULT([ok])
2977     fi
2978     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2979     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2981     AC_MSG_CHECKING([whether to do code signing])
2983     if test "$enable_macosx_code_signing" = yes; then
2984         # By default use the first suitable certificate (?).
2986         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2987         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2988         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2989         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2990         # "Developer ID Application" one.
2992         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2993         if test -n "$identity"; then
2994             MACOSX_CODESIGNING_IDENTITY=$identity
2995             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2996             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2997         else
2998             AC_MSG_ERROR([cannot determine identity to use])
2999         fi
3000     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3001         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3002         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3003         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3004     else
3005         AC_MSG_RESULT([no])
3006     fi
3008     AC_MSG_CHECKING([whether to create a Mac App Store package])
3010     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3011         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3012     elif test "$enable_macosx_package_signing" = yes; then
3013         # By default use the first suitable certificate.
3014         # It should be a "3rd Party Mac Developer Installer" one
3016         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3017         if test -n "$identity"; then
3018             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3019             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3020             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3021         else
3022             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3023         fi
3024     elif test -n "$enable_macosx_package_signing"; then
3025         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3026         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3027         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3028     else
3029         AC_MSG_RESULT([no])
3030     fi
3032     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3033         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3034     fi
3036     AC_MSG_CHECKING([whether to sandbox the application])
3038     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3039         AC_MSG_ERROR([macOS sandboxing requires code signing])
3040     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3041         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3042     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3043         ENABLE_MACOSX_SANDBOX=TRUE
3044         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3045         AC_MSG_RESULT([yes])
3046     else
3047         AC_MSG_RESULT([no])
3048     fi
3050     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3051     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3052     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3054 AC_SUBST(MACOSX_SDK_PATH)
3055 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3056 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3057 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3058 AC_SUBST(INSTALL_NAME_TOOL)
3059 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3060 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3061 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3062 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3063 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3065 dnl ===================================================================
3066 dnl Check iOS SDK and compiler
3067 dnl ===================================================================
3069 if test $_os = iOS; then
3070     AC_MSG_CHECKING([what iOS SDK to use])
3071     current_sdk_ver=14.0
3072     older_sdk_vers="13.5 13.4 13.2 13.1 13.0 12.4 12.2"
3073     if test "$enable_ios_simulator" = "yes"; then
3074         platform=iPhoneSimulator
3075         versionmin=-mios-simulator-version-min=12.2
3076     else
3077         platform=iPhoneOS
3078         versionmin=-miphoneos-version-min=12.2
3079     fi
3080     xcode_developer=`xcode-select -print-path`
3082     for sdkver in $current_sdk_ver $older_sdk_vers; do
3083         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3084         if test -d $t; then
3085             sysroot=$t
3086             break
3087         fi
3088     done
3090     if test -z "$sysroot"; then
3091         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3092     fi
3094     AC_MSG_RESULT($sysroot)
3096     # LTO is not really recommended for iOS builds,
3097     # the link time will be astronomical
3098     if test "$ENABLE_LTO" = TRUE; then
3099         lto=-flto
3100     fi
3102     stdlib="-stdlib=libc++"
3104     AC_MSG_CHECKING([what C compiler to use])
3105     CC="`xcrun -find clang`"
3106     CC_BASE=`first_arg_basename "$CC"`
3107     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3108     AC_MSG_RESULT([$CC])
3110     AC_MSG_CHECKING([what C++ compiler to use])
3111     CXX="`xcrun -find clang++`"
3112     CXX_BASE=`first_arg_basename "$CXX"`
3113     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3114     AC_MSG_RESULT([$CXX])
3116     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3117     AR=`xcrun -find ar`
3118     NM=`xcrun -find nm`
3119     STRIP=`xcrun -find strip`
3120     LIBTOOL=`xcrun -find libtool`
3121     RANLIB=`xcrun -find ranlib`
3124 AC_MSG_CHECKING([whether to treat the installation as read-only])
3126 if test $_os = Darwin; then
3127     enable_readonly_installset=yes
3128 elif test "$enable_extensions" != yes; then
3129     enable_readonly_installset=yes
3131 if test "$enable_readonly_installset" = yes; then
3132     AC_MSG_RESULT([yes])
3133     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3134 else
3135     AC_MSG_RESULT([no])
3138 dnl ===================================================================
3139 dnl Structure of install set
3140 dnl ===================================================================
3142 if test $_os = Darwin; then
3143     LIBO_BIN_FOLDER=MacOS
3144     LIBO_ETC_FOLDER=Resources
3145     LIBO_LIBEXEC_FOLDER=MacOS
3146     LIBO_LIB_FOLDER=Frameworks
3147     LIBO_LIB_PYUNO_FOLDER=Resources
3148     LIBO_SHARE_FOLDER=Resources
3149     LIBO_SHARE_HELP_FOLDER=Resources/help
3150     LIBO_SHARE_JAVA_FOLDER=Resources/java
3151     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3152     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3153     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3154     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3155     LIBO_URE_BIN_FOLDER=MacOS
3156     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3157     LIBO_URE_LIB_FOLDER=Frameworks
3158     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3159     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3160 elif test $_os = WINNT; then
3161     LIBO_BIN_FOLDER=program
3162     LIBO_ETC_FOLDER=program
3163     LIBO_LIBEXEC_FOLDER=program
3164     LIBO_LIB_FOLDER=program
3165     LIBO_LIB_PYUNO_FOLDER=program
3166     LIBO_SHARE_FOLDER=share
3167     LIBO_SHARE_HELP_FOLDER=help
3168     LIBO_SHARE_JAVA_FOLDER=program/classes
3169     LIBO_SHARE_PRESETS_FOLDER=presets
3170     LIBO_SHARE_READMES_FOLDER=readmes
3171     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3172     LIBO_SHARE_SHELL_FOLDER=program/shell
3173     LIBO_URE_BIN_FOLDER=program
3174     LIBO_URE_ETC_FOLDER=program
3175     LIBO_URE_LIB_FOLDER=program
3176     LIBO_URE_MISC_FOLDER=program
3177     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3178 else
3179     LIBO_BIN_FOLDER=program
3180     LIBO_ETC_FOLDER=program
3181     LIBO_LIBEXEC_FOLDER=program
3182     LIBO_LIB_FOLDER=program
3183     LIBO_LIB_PYUNO_FOLDER=program
3184     LIBO_SHARE_FOLDER=share
3185     LIBO_SHARE_HELP_FOLDER=help
3186     LIBO_SHARE_JAVA_FOLDER=program/classes
3187     LIBO_SHARE_PRESETS_FOLDER=presets
3188     LIBO_SHARE_READMES_FOLDER=readmes
3189     if test "$enable_fuzzers" != yes; then
3190         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3191     else
3192         LIBO_SHARE_RESOURCE_FOLDER=resource
3193     fi
3194     LIBO_SHARE_SHELL_FOLDER=program/shell
3195     LIBO_URE_BIN_FOLDER=program
3196     LIBO_URE_ETC_FOLDER=program
3197     LIBO_URE_LIB_FOLDER=program
3198     LIBO_URE_MISC_FOLDER=program
3199     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3201 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3202 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3203 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3204 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3205 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3206 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3207 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3208 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3209 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3210 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3211 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3212 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3213 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3214 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3215 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3216 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3218 # Not all of them needed in config_host.mk, add more if need arises
3219 AC_SUBST(LIBO_BIN_FOLDER)
3220 AC_SUBST(LIBO_ETC_FOLDER)
3221 AC_SUBST(LIBO_LIB_FOLDER)
3222 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3223 AC_SUBST(LIBO_SHARE_FOLDER)
3224 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3225 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3226 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3227 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3228 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3229 AC_SUBST(LIBO_URE_BIN_FOLDER)
3230 AC_SUBST(LIBO_URE_ETC_FOLDER)
3231 AC_SUBST(LIBO_URE_LIB_FOLDER)
3232 AC_SUBST(LIBO_URE_MISC_FOLDER)
3233 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3235 dnl ===================================================================
3236 dnl Windows specific tests and stuff
3237 dnl ===================================================================
3239 reg_get_value()
3241     # Return value: $regvalue
3242     unset regvalue
3244     local _regentry="/proc/registry${1}/${2}"
3245     if test -f "$_regentry"; then
3246         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3247         # Registry keys read via /proc/registry* are always \0 terminated!
3248         local _regvalue=$(tr -d '\0' < "$_regentry")
3249         if test $? -eq 0; then
3250             regvalue=$_regvalue
3251         fi
3252     fi
3255 # Get a value from the 32-bit side of the Registry
3256 reg_get_value_32()
3258     reg_get_value "32" "$1"
3261 # Get a value from the 64-bit side of the Registry
3262 reg_get_value_64()
3264     reg_get_value "64" "$1"
3267 if test "$_os" = "WINNT"; then
3268     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3269     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3270         AC_MSG_RESULT([no])
3271         WINDOWS_SDK_ARCH="x86"
3272     else
3273         AC_MSG_RESULT([yes])
3274         WINDOWS_SDK_ARCH="x64"
3275         BITNESS_OVERRIDE=64
3276     fi
3278 if test "$_os" = "iOS"; then
3279     cross_compiling="yes"
3282 if test "$cross_compiling" = "yes"; then
3283     export CROSS_COMPILING=TRUE
3284 else
3285     CROSS_COMPILING=
3286     BUILD_TYPE="$BUILD_TYPE NATIVE"
3288 AC_SUBST(CROSS_COMPILING)
3290 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3291 # NOTE: must _not_ be used for bundled external libraries!
3292 ISYSTEM=
3293 if test "$GCC" = "yes"; then
3294     AC_MSG_CHECKING( for -isystem )
3295     save_CFLAGS=$CFLAGS
3296     CFLAGS="$CFLAGS -Werror"
3297     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3298     CFLAGS=$save_CFLAGS
3299     if test -n "$ISYSTEM"; then
3300         AC_MSG_RESULT(yes)
3301     else
3302         AC_MSG_RESULT(no)
3303     fi
3305 if test -z "$ISYSTEM"; then
3306     # fall back to using -I
3307     ISYSTEM=-I
3309 AC_SUBST(ISYSTEM)
3311 dnl ===================================================================
3312 dnl  Check which Visual Studio compiler is used
3313 dnl ===================================================================
3315 map_vs_year_to_version()
3317     # Return value: $vsversion
3319     unset vsversion
3321     case $1 in
3322     2019)
3323         vsversion=16;;
3324     *)
3325         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3326     esac
3329 vs_versions_to_check()
3331     # Args: $1 (optional) : versions to check, in the order of preference
3332     # Return value: $vsversions
3334     unset vsversions
3336     if test -n "$1"; then
3337         map_vs_year_to_version "$1"
3338         vsversions=$vsversion
3339     else
3340         # We accept only 2019
3341         vsversions="16"
3342     fi
3345 win_get_env_from_vsvars32bat()
3347     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3348     # Also seems to be located in another directory under the same name: vsvars32.bat
3349     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3350     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3351     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3352     chmod +x $WRAPPERBATCHFILEPATH
3353     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3354     rm -f $WRAPPERBATCHFILEPATH
3355     printf '%s' "$_win_get_env_from_vsvars32bat"
3358 find_ucrt()
3360     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3361     if test -n "$regvalue"; then
3362         PathFormat "$regvalue"
3363         UCRTSDKDIR=$formatted_path
3364         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3365         UCRTVERSION=$regvalue
3366         # Rest if not exist
3367         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3368           UCRTSDKDIR=
3369         fi
3370     fi
3371     if test -z "$UCRTSDKDIR"; then
3372         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3373         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3374         if test -f "$ide_env_file"; then
3375             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3376             UCRTSDKDIR=$formatted_path
3377             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3378             dnl Hack needed at least by tml:
3379             if test "$UCRTVERSION" = 10.0.15063.0 \
3380                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3381                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3382             then
3383                 UCRTVERSION=10.0.14393.0
3384             fi
3385         else
3386           AC_MSG_ERROR([No UCRT found])
3387         fi
3388     fi
3391 find_msvc()
3393     # Find Visual C++ 2019
3394     # Args: $1 (optional) : The VS version year
3395     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3397     unset vctest vcnum vcnumwithdot vcbuildnumber
3399     vs_versions_to_check "$1"
3400     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3401     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3402     PathFormat "$vswhere"
3403     vswhere=$formatted_path
3404     for ver in $vsversions; do
3405         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3406         # Fall back to all MS products (this includes VC++ Build Tools)
3407         if ! test -n "$vswhereoutput"; then
3408             AC_MSG_CHECKING([VC++ Build Tools and similar])
3409             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3410         fi
3411         if test -n "$vswhereoutput"; then
3412             PathFormat "$vswhereoutput"
3413             vctest=$formatted_path
3414             break
3415         fi
3416     done
3418     if test -n "$vctest"; then
3419         vcnumwithdot="$ver.0"
3420         case "$vcnumwithdot" in
3421         16.0)
3422             vcyear=2019
3423             vcnum=160
3424             ;;
3425         esac
3426         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3428     fi
3431 SOLARINC=
3432 MSBUILD_PATH=
3433 DEVENV=
3434 if test "$_os" = "WINNT"; then
3435     AC_MSG_CHECKING([Visual C++])
3436     find_msvc "$with_visual_studio"
3437     if test -z "$vctest"; then
3438         if test -n "$with_visual_studio"; then
3439             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3440         else
3441             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3442         fi
3443     fi
3445     if test "$BITNESS_OVERRIDE" = ""; then
3446         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3447             VC_PRODUCT_DIR=$vctest/VC
3448         else
3449             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3450         fi
3451     else
3452         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3453             VC_PRODUCT_DIR=$vctest/VC
3454         else
3455             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3456         fi
3457     fi
3458     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3460     AC_MSG_CHECKING([for short pathname of VC product directory])
3461     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3462     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3464     UCRTSDKDIR=
3465     UCRTVERSION=
3467     AC_MSG_CHECKING([for UCRT location])
3468     find_ucrt
3469     # find_ucrt errors out if it doesn't find it
3470     AC_MSG_RESULT([found])
3471     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3472     ucrtincpath_formatted=$formatted_path
3473     # SOLARINC is used for external modules and must be set too.
3474     # And no, it's not sufficient to set SOLARINC only, as configure
3475     # itself doesn't honour it.
3476     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3477     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3478     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3479     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3481     AC_SUBST(UCRTSDKDIR)
3482     AC_SUBST(UCRTVERSION)
3484     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3485     # Find the proper version of MSBuild.exe to use based on the VS version
3486     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3487     if test -n "$regvalue" ; then
3488         AC_MSG_RESULT([found: $regvalue])
3489         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3490     else
3491         if test "$vcnumwithdot" = "16.0"; then
3492             if test "$BITNESS_OVERRIDE" = ""; then
3493                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3494             else
3495                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3496             fi
3497         else
3498             if test "$BITNESS_OVERRIDE" = ""; then
3499                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3500             else
3501                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3502             fi
3503         fi
3504         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3505         AC_MSG_RESULT([$regvalue])
3506     fi
3508     # Find the version of devenv.exe
3509     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3510     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3511     if test ! -e "$DEVENV"; then
3512         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3513     fi
3515     dnl ===========================================================
3516     dnl  Check for the corresponding mspdb*.dll
3517     dnl ===========================================================
3519     VC_HOST_DIR=
3520     MSPDB_PATH=
3521     CL_PATH=
3523     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3524         VC_HOST_DIR="HostX64"
3525         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3526     else
3527         VC_HOST_DIR="HostX86"
3528         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3529     fi
3531     if test "$BITNESS_OVERRIDE" = ""; then
3532         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3533     else
3534         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3535     fi
3537     # MSVC 15.0 has libraries from 14.0?
3538     mspdbnum="140"
3540     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3541         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3542     fi
3544     dnl The path needs to be added before cl is called
3545     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3546     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3548     AC_MSG_CHECKING([cl.exe])
3550     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3551     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3552     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3553     # is not enough?
3555     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3556     dnl needed when building CLR code:
3557     if test -z "$MSVC_CXX"; then
3558         if test -f "$CL_PATH/cl.exe"; then
3559             MSVC_CXX="$CL_PATH/cl.exe"
3560         fi
3562         # This gives us a posix path with 8.3 filename restrictions
3563         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3564     fi
3566     if test -z "$CC"; then
3567         CC=$MSVC_CXX
3568         CC_BASE=`first_arg_basename "$CC"`
3569     fi
3570     if test -z "$CXX"; then
3571         CXX=$MSVC_CXX
3572         CXX_BASE=`first_arg_basename "$CXX"`
3573     fi
3575     if test -n "$CC"; then
3576         # Remove /cl.exe from CC case insensitive
3577         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3578         if test "$BITNESS_OVERRIDE" = ""; then
3579            COMPATH="$VC_PRODUCT_DIR"
3580         else
3581             if test -n "$VC_PRODUCT_DIR"; then
3582                 COMPATH=$VC_PRODUCT_DIR
3583             fi
3584         fi
3586         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3588         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3590         PathFormat "$COMPATH"
3591         COMPATH=`win_short_path_for_make "$formatted_path"`
3593         VCVER=$vcnum
3595         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3596         # are always "better", we list them in reverse chronological order.
3598         case "$vcnum" in
3599         160)
3600             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3601             ;;
3602         esac
3604         # The expectation is that --with-windows-sdk should not need to be used
3605         if test -n "$with_windows_sdk"; then
3606             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3607             *" "$with_windows_sdk" "*)
3608                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3609                 ;;
3610             *)
3611                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
3612                 ;;
3613             esac
3614         fi
3616         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3617         ac_objext=obj
3618         ac_exeext=exe
3620     else
3621         AC_MSG_ERROR([Visual C++ not found after all, huh])
3622     fi
3624     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
3625     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3626         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3627         // between Visual Studio versions and _MSC_VER:
3628         #if _MSC_VER < 1924
3629         #error
3630         #endif
3631     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3633     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3634     # version of the Explorer extension (and maybe other small
3635     # bits, too) needed when installing a 32-bit LibreOffice on a
3636     # 64-bit OS. The 64-bit Explorer extension is a feature that
3637     # has been present since long in OOo. Don't confuse it with
3638     # building LibreOffice itself as 64-bit code.
3640     BUILD_X64=
3641     CXX_X64_BINARY=
3643     if test "$BITNESS_OVERRIDE" = ""; then
3644         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3645         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3646              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3647             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3648                 BUILD_X64=TRUE
3649                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3650             fi
3651         fi
3652         if test "$BUILD_X64" = TRUE; then
3653             AC_MSG_RESULT([found])
3654         else
3655             AC_MSG_RESULT([not found])
3656             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3657         fi
3658     else
3659         CXX_X64_BINARY=$CXX
3660     fi
3661     AC_SUBST(BUILD_X64)
3663     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3664     AC_SUBST(CXX_X64_BINARY)
3666     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3667     # needed to support TWAIN scan on both 32- and 64-bit systems
3669     BUILD_X86=
3671     if test "$BITNESS_OVERRIDE" = "64"; then
3672         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3673         if test -n "$CXX_X86_BINARY"; then
3674             BUILD_X86=TRUE
3675             AC_MSG_RESULT([preset])
3676         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3677             BUILD_X86=TRUE
3678             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3679             CXX_X86_BINARY+=" /arch:SSE"
3680             AC_MSG_RESULT([found])
3681         else
3682             CXX_X86_BINARY=
3683             AC_MSG_RESULT([not found])
3684             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3685         fi
3686     else
3687         BUILD_X86=TRUE
3688         CXX_X86_BINARY=$MSVC_CXX
3689     fi
3690     AC_SUBST(BUILD_X86)
3691     AC_SUBST(CXX_X86_BINARY)
3693 AC_SUBST(VCVER)
3694 AC_SUBST(DEVENV)
3695 AC_SUBST(MSVC_CXX)
3698 # unowinreg.dll
3700 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3701 AC_SUBST(UNOWINREG_DLL)
3703 COM_IS_CLANG=
3704 AC_MSG_CHECKING([whether the compiler is actually Clang])
3705 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3706     #ifndef __clang__
3707     you lose
3708     #endif
3709     int foo=42;
3710     ]])],
3711     [AC_MSG_RESULT([yes])
3712      COM_IS_CLANG=TRUE],
3713     [AC_MSG_RESULT([no])])
3714 AC_SUBST(COM_IS_CLANG)
3716 CC_PLAIN=$CC
3717 CLANGVER=
3718 if test "$COM_IS_CLANG" = TRUE; then
3719     AC_MSG_CHECKING([whether Clang is new enough])
3720     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3721         #if !defined __apple_build_version__
3722         #error
3723         #endif
3724         ]])],
3725         [my_apple_clang=yes],[my_apple_clang=])
3726     if test "$my_apple_clang" = yes; then
3727         AC_MSG_RESULT([assumed yes (Apple Clang)])
3728     else
3729         if test "$_os" = WINNT; then
3730             dnl In which case, assume clang-cl:
3731             my_args="/EP /TC"
3732             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3733             dnl clang-cl:
3734             CC_PLAIN=
3735             for i in $CC; do
3736                 case $i in
3737                 -FIIntrin.h)
3738                     ;;
3739                 *)
3740                     CC_PLAIN="$CC_PLAIN $i"
3741                     ;;
3742                 esac
3743             done
3744         else
3745             my_args="-E -P"
3746         fi
3747         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3748         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3749         CLANGVER=`echo $clang_version \
3750             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3751         if test "$CLANGVER" -ge 50002; then
3752             AC_MSG_RESULT([yes ($clang_version)])
3753         else
3754             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3755         fi
3756         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3757         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3758     fi
3761 SHOWINCLUDES_PREFIX=
3762 if test "$_os" = WINNT; then
3763     dnl We need to guess the prefix of the -showIncludes output, it can be
3764     dnl localized
3765     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3766     echo "#include <stdlib.h>" > conftest.c
3767     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3768         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3769     rm -f conftest.c conftest.obj
3770     if test -z "$SHOWINCLUDES_PREFIX"; then
3771         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3772     else
3773         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3774     fi
3776 AC_SUBST(SHOWINCLUDES_PREFIX)
3779 # prefix C with ccache if needed
3781 if test "$CCACHE" != ""; then
3782     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3784     AC_LANG_PUSH([C])
3785     save_CFLAGS=$CFLAGS
3786     CFLAGS="$CFLAGS --ccache-skip -O2"
3787     dnl an empty program will do, we're checking the compiler flags
3788     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3789                       [use_ccache=yes], [use_ccache=no])
3790     if test $use_ccache = yes; then
3791         AC_MSG_RESULT([yes])
3792     else
3793         CC="$CCACHE $CC"
3794         CC_BASE="ccache $CC_BASE"
3795         AC_MSG_RESULT([no])
3796     fi
3797     CFLAGS=$save_CFLAGS
3798     AC_LANG_POP([C])
3801 # ===================================================================
3802 # check various GCC options that Clang does not support now but maybe
3803 # will somewhen in the future, check them even for GCC, so that the
3804 # flags are set
3805 # ===================================================================
3807 HAVE_GCC_GGDB2=
3808 if test "$GCC" = "yes"; then
3809     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3810     save_CFLAGS=$CFLAGS
3811     CFLAGS="$CFLAGS -Werror -ggdb2"
3812     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3813     CFLAGS=$save_CFLAGS
3814     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3815         AC_MSG_RESULT([yes])
3816     else
3817         AC_MSG_RESULT([no])
3818     fi
3820     if test "$host_cpu" = "m68k"; then
3821         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3822         save_CFLAGS=$CFLAGS
3823         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3824         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3825         CFLAGS=$save_CFLAGS
3826         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3827             AC_MSG_RESULT([yes])
3828         else
3829             AC_MSG_ERROR([no])
3830         fi
3831     fi
3833 AC_SUBST(HAVE_GCC_GGDB2)
3835 dnl ===================================================================
3836 dnl  Test the gcc version
3837 dnl ===================================================================
3838 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3839     AC_MSG_CHECKING([the GCC version])
3840     _gcc_version=`$CC -dumpversion`
3841     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3842         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3843     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3845     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3847     if test "$gcc_full_version" -lt 70000; then
3848         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3849     fi
3850 else
3851     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3852     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3853     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3854     # (which reports itself as GCC 4.2.1).
3855     GCC_VERSION=
3857 AC_SUBST(GCC_VERSION)
3859 dnl Set the ENABLE_DBGUTIL variable
3860 dnl ===================================================================
3861 AC_MSG_CHECKING([whether to build with additional debug utilities])
3862 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3863     ENABLE_DBGUTIL="TRUE"
3864     # this is an extra var so it can have different default on different MSVC
3865     # versions (in case there are version specific problems with it)
3866     MSVC_USE_DEBUG_RUNTIME="TRUE"
3868     AC_MSG_RESULT([yes])
3869     # cppunit and graphite expose STL in public headers
3870     if test "$with_system_cppunit" = "yes"; then
3871         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3872     else
3873         with_system_cppunit=no
3874     fi
3875     if test "$with_system_graphite" = "yes"; then
3876         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3877     else
3878         with_system_graphite=no
3879     fi
3880     if test "$with_system_orcus" = "yes"; then
3881         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3882     else
3883         with_system_orcus=no
3884     fi
3885     if test "$with_system_libcmis" = "yes"; then
3886         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3887     else
3888         with_system_libcmis=no
3889     fi
3890     if test "$with_system_hunspell" = "yes"; then
3891         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3892     else
3893         with_system_hunspell=no
3894     fi
3895     if test "$with_system_gpgmepp" = "yes"; then
3896         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3897     else
3898         with_system_gpgmepp=no
3899     fi
3900     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3901     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3902     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3903     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3904     # of those two is using the system variant:
3905     if test "$with_system_libnumbertext" = "yes"; then
3906         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3907     else
3908         with_system_libnumbertext=no
3909     fi
3910     if test "$with_system_libwps" = "yes"; then
3911         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3912     else
3913         with_system_libwps=no
3914     fi
3915 else
3916     ENABLE_DBGUTIL=""
3917     MSVC_USE_DEBUG_RUNTIME=""
3918     AC_MSG_RESULT([no])
3920 AC_SUBST(ENABLE_DBGUTIL)
3921 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3923 dnl Set the ENABLE_DEBUG variable.
3924 dnl ===================================================================
3925 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3926     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3928 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3929     if test -z "$libo_fuzzed_enable_debug"; then
3930         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3931     else
3932         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3933         enable_debug=yes
3934     fi
3937 AC_MSG_CHECKING([whether to do a debug build])
3938 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3939     ENABLE_DEBUG="TRUE"
3940     if test -n "$ENABLE_DBGUTIL" ; then
3941         AC_MSG_RESULT([yes (dbgutil)])
3942     else
3943         AC_MSG_RESULT([yes])
3944     fi
3945 else
3946     ENABLE_DEBUG=""
3947     AC_MSG_RESULT([no])
3949 AC_SUBST(ENABLE_DEBUG)
3951 dnl ===================================================================
3952 dnl Select the linker to use (gold/lld/ld.bfd).
3953 dnl This is done only after compiler checks (need to know if Clang is
3954 dnl used, for different defaults) and after checking if a debug build
3955 dnl is wanted (non-debug builds get the default linker if not explicitly
3956 dnl specified otherwise).
3957 dnl All checks for linker features/options should come after this.
3958 dnl ===================================================================
3959 check_use_ld()
3961     use_ld=$1
3962     use_ld_fail_if_error=$2
3963     use_ld_ok=
3964     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3965     use_ld_ldflags_save="$LDFLAGS"
3966     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3967     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3968 #include <stdio.h>
3969         ],[
3970 printf ("hello world\n");
3971         ])], USE_LD=$use_ld, [])
3972     if test -n "$USE_LD"; then
3973         AC_MSG_RESULT( yes )
3974         use_ld_ok=yes
3975     else
3976         if test -n "$use_ld_fail_if_error"; then
3977             AC_MSG_ERROR( no )
3978         else
3979             AC_MSG_RESULT( no )
3980         fi
3981     fi
3982     if test -n "$use_ld_ok"; then
3983         dnl keep the value of LDFLAGS
3984         return 0
3985     fi
3986     LDFLAGS="$use_ld_ldflags_save"
3987     return 1
3989 USE_LD=
3990 if test "$enable_ld" != "no"; then
3991     if test "$GCC" = "yes"; then
3992         if test -n "$enable_ld"; then
3993             check_use_ld "$enable_ld" fail_if_error
3994         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3995             dnl non-debug builds default to the default linker
3996             true
3997         elif test -n "$COM_IS_CLANG"; then
3998             check_use_ld lld
3999             if test $? -ne 0; then
4000                 check_use_ld gold
4001             fi
4002         else
4003             # For gcc first try gold, new versions also support lld.
4004             check_use_ld gold
4005             if test $? -ne 0; then
4006                 check_use_ld lld
4007             fi
4008         fi
4009         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4010         rm conftest.out
4011         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4012         if test -z "$ld_used"; then
4013             ld_used="unknown"
4014         fi
4015         AC_MSG_CHECKING([for linker that is used])
4016         AC_MSG_RESULT([$ld_used])
4017         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4018             if echo "$ld_used" | grep -q "^GNU ld"; then
4019                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4020                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4021             fi
4022         fi
4023     else
4024         if test "$enable_ld" = "yes"; then
4025             AC_MSG_ERROR([--enable-ld not supported])
4026         fi
4027     fi
4029 AC_SUBST(USE_LD)
4031 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4032 if test "$GCC" = "yes"; then
4033     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4034     bsymbolic_functions_ldflags_save=$LDFLAGS
4035     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4036     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4037 #include <stdio.h>
4038         ],[
4039 printf ("hello world\n");
4040         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4041     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4042         AC_MSG_RESULT( found )
4043     else
4044         AC_MSG_RESULT( not found )
4045     fi
4046     LDFLAGS=$bsymbolic_functions_ldflags_save
4048 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4050 LD_GC_SECTIONS=
4051 if test "$GCC" = "yes"; then
4052     for flag in "--gc-sections" "-dead_strip"; do
4053         AC_MSG_CHECKING([for $flag linker support])
4054         ldflags_save=$LDFLAGS
4055         LDFLAGS="$LDFLAGS -Wl,$flag"
4056         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4057 #include <stdio.h>
4058             ],[
4059 printf ("hello world\n");
4060             ])],[
4061             LD_GC_SECTIONS="-Wl,$flag"
4062             AC_MSG_RESULT( found )
4063             ], [
4064             AC_MSG_RESULT( not found )
4065             ])
4066         LDFLAGS=$ldflags_save
4067         if test -n "$LD_GC_SECTIONS"; then
4068             break
4069         fi
4070     done
4072 AC_SUBST(LD_GC_SECTIONS)
4074 HAVE_GSPLIT_DWARF=
4075 if test "$enable_split_debug" != no; then
4076     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4077     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4078         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4079         save_CFLAGS=$CFLAGS
4080         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4081         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4082         CFLAGS=$save_CFLAGS
4083         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4084             AC_MSG_RESULT([yes])
4085         else
4086             if test "$enable_split_debug" = yes; then
4087                 AC_MSG_ERROR([no])
4088             else
4089                 AC_MSG_RESULT([no])
4090             fi
4091         fi
4092     fi
4093     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4094         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4095         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4096     fi
4098 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4100 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4101 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4102 save_CFLAGS=$CFLAGS
4103 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4104 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4105 CFLAGS=$save_CFLAGS
4106 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4107     AC_MSG_RESULT([yes])
4108 else
4109     AC_MSG_RESULT([no])
4111 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4113 ENABLE_GDB_INDEX=
4114 if test "$enable_gdb_index" != "no"; then
4115     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4116     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4117         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4118         save_CFLAGS=$CFLAGS
4119         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4120         have_ggnu_pubnames=
4121         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4122         if test "$have_ggnu_pubnames" != "TRUE"; then
4123             if test "$enable_gdb_index" = "yes"; then
4124                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4125             else
4126                 AC_MSG_RESULT( no )
4127             fi
4128         else
4129             AC_MSG_RESULT( yes )
4130             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4131             ldflags_save=$LDFLAGS
4132             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4133             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4134 #include <stdio.h>
4135                 ],[
4136 printf ("hello world\n");
4137                 ])], ENABLE_GDB_INDEX=TRUE, [])
4138             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4139                 AC_MSG_RESULT( yes )
4140             else
4141                 if test "$enable_gdb_index" = "yes"; then
4142                     AC_MSG_ERROR( no )
4143                 else
4144                     AC_MSG_RESULT( no )
4145                 fi
4146             fi
4147             LDFLAGS=$ldflags_save
4148         fi
4149         CFLAGS=$save_CFLAGS
4150         fi
4151     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4152         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4153         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4154     fi
4156 AC_SUBST(ENABLE_GDB_INDEX)
4158 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4159     enable_sal_log=yes
4161 if test "$enable_sal_log" = yes; then
4162     ENABLE_SAL_LOG=TRUE
4164 AC_SUBST(ENABLE_SAL_LOG)
4166 dnl Check for enable symbols option
4167 dnl ===================================================================
4168 AC_MSG_CHECKING([whether to generate debug information])
4169 if test -z "$enable_symbols"; then
4170     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4171         enable_symbols=yes
4172     else
4173         enable_symbols=no
4174     fi
4176 if test "$enable_symbols" = yes; then
4177     ENABLE_SYMBOLS_FOR=all
4178     AC_MSG_RESULT([yes])
4179 elif test "$enable_symbols" = no; then
4180     ENABLE_SYMBOLS_FOR=
4181     AC_MSG_RESULT([no])
4182 else
4183     # Selective debuginfo.
4184     ENABLE_SYMBOLS_FOR="$enable_symbols"
4185     AC_MSG_RESULT([for "$enable_symbols"])
4187 AC_SUBST(ENABLE_SYMBOLS_FOR)
4189 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4190     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4191     AC_MSG_CHECKING([whether enough memory is available for linking])
4192     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4193     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4194     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4195         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4196     else
4197         AC_MSG_RESULT([yes])
4198     fi
4201 ENABLE_OPTIMIZED=
4202 ENABLE_OPTIMIZED_DEBUG=
4203 AC_MSG_CHECKING([whether to compile with optimization flags])
4204 if test -z "$enable_optimized"; then
4205     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4206         enable_optimized=no
4207     else
4208         enable_optimized=yes
4209     fi
4211 if test "$enable_optimized" = yes; then
4212     ENABLE_OPTIMIZED=TRUE
4213     AC_MSG_RESULT([yes])
4214 elif test "$enable_optimized" = debug; then
4215     ENABLE_OPTIMIZED_DEBUG=TRUE
4216     AC_MSG_RESULT([yes (debug)])
4217     HAVE_GCC_OG=
4218     if test "$GCC" = "yes"; then
4219         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4220         save_CFLAGS=$CFLAGS
4221         CFLAGS="$CFLAGS -Werror -Og"
4222         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4223         CFLAGS=$save_CFLAGS
4224         if test "$HAVE_GCC_OG" = "TRUE"; then
4225             AC_MSG_RESULT([yes])
4226         else
4227             AC_MSG_RESULT([no])
4228         fi
4229     fi
4230     if test -z "$HAVE_GCC_OG"; then
4231         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4232     fi
4233 else
4234     AC_MSG_RESULT([no])
4236 AC_SUBST(ENABLE_OPTIMIZED)
4237 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4240 # determine CPUNAME, OS, ...
4241 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4243 case "$host_os" in
4245 aix*)
4246     COM=GCC
4247     CPUNAME=POWERPC
4248     USING_X11=TRUE
4249     OS=AIX
4250     RTL_OS=AIX
4251     RTL_ARCH=PowerPC
4252     PLATFORMID=aix_powerpc
4253     P_SEP=:
4254     ;;
4256 cygwin*)
4257     COM=MSC
4258     USING_X11=
4259     OS=WNT
4260     RTL_OS=Windows
4261     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4262         P_SEP=";"
4263     else
4264         P_SEP=:
4265     fi
4266     case "$host_cpu" in
4267     i*86|x86_64)
4268         if test "$BITNESS_OVERRIDE" = 64; then
4269             CPUNAME=X86_64
4270             RTL_ARCH=X86_64
4271             PLATFORMID=windows_x86_64
4272             WINDOWS_X64=1
4273             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4274         else
4275             CPUNAME=INTEL
4276             RTL_ARCH=x86
4277             PLATFORMID=windows_x86
4278         fi
4279         ;;
4280     *)
4281         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4282         ;;
4283     esac
4284     SCPDEFS="$SCPDEFS -D_MSC_VER"
4285     ;;
4287 darwin*)
4288     COM=GCC
4289     USING_X11=
4290     OS=MACOSX
4291     RTL_OS=MacOSX
4292     P_SEP=:
4294     case "$host_cpu" in
4295     arm)
4296         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4297         ;;
4298     arm64)
4299         OS=iOS
4300         RTL_OS=iOS
4301         if test "$enable_ios_simulator" = "yes"; then
4302             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4303         else
4304             CPUNAME=ARM64
4305             RTL_ARCH=ARM_EABI
4306             PLATFORMID=ios_arm64
4307         fi
4308         ;;
4309     i*86)
4310         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4311         ;;
4312     x86_64)
4313         if test "$enable_ios_simulator" = "yes"; then
4314             OS=iOS
4315         fi
4316         CPUNAME=X86_64
4317         RTL_ARCH=X86_64
4318         PLATFORMID=macosx_x86_64
4319         ;;
4320     *)
4321         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4322         ;;
4323     esac
4324     ;;
4326 dragonfly*)
4327     COM=GCC
4328     USING_X11=TRUE
4329     OS=DRAGONFLY
4330     RTL_OS=DragonFly
4331     P_SEP=:
4333     case "$host_cpu" in
4334     i*86)
4335         CPUNAME=INTEL
4336         RTL_ARCH=x86
4337         PLATFORMID=dragonfly_x86
4338         ;;
4339     x86_64)
4340         CPUNAME=X86_64
4341         RTL_ARCH=X86_64
4342         PLATFORMID=dragonfly_x86_64
4343         ;;
4344     *)
4345         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4346         ;;
4347     esac
4348     ;;
4350 freebsd*)
4351     COM=GCC
4352     USING_X11=TRUE
4353     RTL_OS=FreeBSD
4354     OS=FREEBSD
4355     P_SEP=:
4357     case "$host_cpu" in
4358     i*86)
4359         CPUNAME=INTEL
4360         RTL_ARCH=x86
4361         PLATFORMID=freebsd_x86
4362         ;;
4363     x86_64|amd64)
4364         CPUNAME=X86_64
4365         RTL_ARCH=X86_64
4366         PLATFORMID=freebsd_x86_64
4367         ;;
4368     *)
4369         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4370         ;;
4371     esac
4372     ;;
4374 haiku*)
4375     COM=GCC
4376     USING_X11=
4377     GUIBASE=haiku
4378     RTL_OS=Haiku
4379     OS=HAIKU
4380     P_SEP=:
4382     case "$host_cpu" in
4383     i*86)
4384         CPUNAME=INTEL
4385         RTL_ARCH=x86
4386         PLATFORMID=haiku_x86
4387         ;;
4388     x86_64|amd64)
4389         CPUNAME=X86_64
4390         RTL_ARCH=X86_64
4391         PLATFORMID=haiku_x86_64
4392         ;;
4393     *)
4394         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4395         ;;
4396     esac
4397     ;;
4399 kfreebsd*)
4400     COM=GCC
4401     USING_X11=TRUE
4402     OS=LINUX
4403     RTL_OS=kFreeBSD
4404     P_SEP=:
4406     case "$host_cpu" in
4408     i*86)
4409         CPUNAME=INTEL
4410         RTL_ARCH=x86
4411         PLATFORMID=kfreebsd_x86
4412         ;;
4413     x86_64)
4414         CPUNAME=X86_64
4415         RTL_ARCH=X86_64
4416         PLATFORMID=kfreebsd_x86_64
4417         ;;
4418     *)
4419         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4420         ;;
4421     esac
4422     ;;
4424 linux-gnu*)
4425     COM=GCC
4426     USING_X11=TRUE
4427     OS=LINUX
4428     RTL_OS=Linux
4429     P_SEP=:
4431     case "$host_cpu" in
4433     aarch64)
4434         CPUNAME=AARCH64
4435         PLATFORMID=linux_aarch64
4436         RTL_ARCH=AARCH64
4437         ;;
4438     alpha)
4439         CPUNAME=AXP
4440         RTL_ARCH=ALPHA
4441         PLATFORMID=linux_alpha
4442         ;;
4443     arm*)
4444         CPUNAME=ARM
4445         EPM_FLAGS="-a arm"
4446         RTL_ARCH=ARM_EABI
4447         PLATFORMID=linux_arm_eabi
4448         case "$host_cpu" in
4449         arm*-linux)
4450             RTL_ARCH=ARM_OABI
4451             PLATFORMID=linux_arm_oabi
4452             ;;
4453         esac
4454         ;;
4455     hppa)
4456         CPUNAME=HPPA
4457         RTL_ARCH=HPPA
4458         EPM_FLAGS="-a hppa"
4459         PLATFORMID=linux_hppa
4460         ;;
4461     i*86)
4462         CPUNAME=INTEL
4463         RTL_ARCH=x86
4464         PLATFORMID=linux_x86
4465         ;;
4466     ia64)
4467         CPUNAME=IA64
4468         RTL_ARCH=IA64
4469         PLATFORMID=linux_ia64
4470         ;;
4471     mips)
4472         CPUNAME=GODSON
4473         RTL_ARCH=MIPS_EB
4474         EPM_FLAGS="-a mips"
4475         PLATFORMID=linux_mips_eb
4476         ;;
4477     mips64)
4478         CPUNAME=GODSON64
4479         RTL_ARCH=MIPS64_EB
4480         EPM_FLAGS="-a mips64"
4481         PLATFORMID=linux_mips64_eb
4482         ;;
4483     mips64el)
4484         CPUNAME=GODSON64
4485         RTL_ARCH=MIPS64_EL
4486         EPM_FLAGS="-a mips64el"
4487         PLATFORMID=linux_mips64_el
4488         ;;
4489     mipsel)
4490         CPUNAME=GODSON
4491         RTL_ARCH=MIPS_EL
4492         EPM_FLAGS="-a mipsel"
4493         PLATFORMID=linux_mips_el
4494         ;;
4495     m68k)
4496         CPUNAME=M68K
4497         RTL_ARCH=M68K
4498         PLATFORMID=linux_m68k
4499         ;;
4500     powerpc)
4501         CPUNAME=POWERPC
4502         RTL_ARCH=PowerPC
4503         PLATFORMID=linux_powerpc
4504         ;;
4505     powerpc64)
4506         CPUNAME=POWERPC64
4507         RTL_ARCH=PowerPC_64
4508         PLATFORMID=linux_powerpc64
4509         ;;
4510     powerpc64le)
4511         CPUNAME=POWERPC64
4512         RTL_ARCH=PowerPC_64_LE
4513         PLATFORMID=linux_powerpc64_le
4514         ;;
4515     sparc)
4516         CPUNAME=SPARC
4517         RTL_ARCH=SPARC
4518         PLATFORMID=linux_sparc
4519         ;;
4520     sparc64)
4521         CPUNAME=SPARC64
4522         RTL_ARCH=SPARC64
4523         PLATFORMID=linux_sparc64
4524         ;;
4525     s390)
4526         CPUNAME=S390
4527         RTL_ARCH=S390
4528         PLATFORMID=linux_s390
4529         ;;
4530     s390x)
4531         CPUNAME=S390X
4532         RTL_ARCH=S390x
4533         PLATFORMID=linux_s390x
4534         ;;
4535     x86_64)
4536         CPUNAME=X86_64
4537         RTL_ARCH=X86_64
4538         PLATFORMID=linux_x86_64
4539         ;;
4540     *)
4541         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4542         ;;
4543     esac
4544     ;;
4546 linux-android*)
4547     COM=GCC
4548     USING_X11=
4549     OS=ANDROID
4550     RTL_OS=Android
4551     P_SEP=:
4553     case "$host_cpu" in
4555     arm|armel)
4556         CPUNAME=ARM
4557         RTL_ARCH=ARM_EABI
4558         PLATFORMID=android_arm_eabi
4559         ;;
4560     aarch64)
4561         CPUNAME=AARCH64
4562         RTL_ARCH=AARCH64
4563         PLATFORMID=android_aarch64
4564         ;;
4565     i*86)
4566         CPUNAME=INTEL
4567         RTL_ARCH=x86
4568         PLATFORMID=android_x86
4569         ;;
4570     x86_64)
4571         CPUNAME=X86_64
4572         RTL_ARCH=X86_64
4573         PLATFORMID=android_x86_64
4574         ;;
4575     *)
4576         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4577         ;;
4578     esac
4579     ;;
4581 *netbsd*)
4582     COM=GCC
4583     USING_X11=TRUE
4584     OS=NETBSD
4585     RTL_OS=NetBSD
4586     P_SEP=:
4588     case "$host_cpu" in
4589     i*86)
4590         CPUNAME=INTEL
4591         RTL_ARCH=x86
4592         PLATFORMID=netbsd_x86
4593         ;;
4594     powerpc)
4595         CPUNAME=POWERPC
4596         RTL_ARCH=PowerPC
4597         PLATFORMID=netbsd_powerpc
4598         ;;
4599     sparc)
4600         CPUNAME=SPARC
4601         RTL_ARCH=SPARC
4602         PLATFORMID=netbsd_sparc
4603         ;;
4604     x86_64)
4605         CPUNAME=X86_64
4606         RTL_ARCH=X86_64
4607         PLATFORMID=netbsd_x86_64
4608         ;;
4609     *)
4610         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4611         ;;
4612     esac
4613     ;;
4615 openbsd*)
4616     COM=GCC
4617     USING_X11=TRUE
4618     OS=OPENBSD
4619     RTL_OS=OpenBSD
4620     P_SEP=:
4622     case "$host_cpu" in
4623     i*86)
4624         CPUNAME=INTEL
4625         RTL_ARCH=x86
4626         PLATFORMID=openbsd_x86
4627         ;;
4628     x86_64)
4629         CPUNAME=X86_64
4630         RTL_ARCH=X86_64
4631         PLATFORMID=openbsd_x86_64
4632         ;;
4633     *)
4634         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4635         ;;
4636     esac
4637     SOLARINC="$SOLARINC -I/usr/local/include"
4638     ;;
4640 solaris*)
4641     COM=GCC
4642     USING_X11=TRUE
4643     OS=SOLARIS
4644     RTL_OS=Solaris
4645     P_SEP=:
4647     case "$host_cpu" in
4648     i*86)
4649         CPUNAME=INTEL
4650         RTL_ARCH=x86
4651         PLATFORMID=solaris_x86
4652         ;;
4653     sparc)
4654         CPUNAME=SPARC
4655         RTL_ARCH=SPARC
4656         PLATFORMID=solaris_sparc
4657         ;;
4658     sparc64)
4659         CPUNAME=SPARC64
4660         RTL_ARCH=SPARC64
4661         PLATFORMID=solaris_sparc64
4662         ;;
4663     *)
4664         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4665         ;;
4666     esac
4667     SOLARINC="$SOLARINC -I/usr/local/include"
4668     ;;
4671     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4672     ;;
4673 esac
4675 if test "$with_x" = "no"; then
4676     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4679 DISABLE_GUI=""
4680 if test "$enable_gui" = "no"; then
4681     if test "$USING_X11" != TRUE; then
4682         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4683     fi
4684     USING_X11=
4685     DISABLE_GUI=TRUE
4686     AC_DEFINE(HAVE_FEATURE_UI,0)
4687     test_cairo=yes
4689 AC_SUBST(DISABLE_GUI)
4691 WORKDIR="${BUILDDIR}/workdir"
4692 INSTDIR="${BUILDDIR}/instdir"
4693 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4694 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4695 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4696 AC_SUBST(COM)
4697 AC_SUBST(CPUNAME)
4698 AC_SUBST(RTL_OS)
4699 AC_SUBST(RTL_ARCH)
4700 AC_SUBST(EPM_FLAGS)
4701 AC_SUBST(USING_X11)
4702 AC_SUBST([INSTDIR])
4703 AC_SUBST([INSTROOT])
4704 AC_SUBST([INSTROOTBASE])
4705 AC_SUBST(OS)
4706 AC_SUBST(P_SEP)
4707 AC_SUBST(WORKDIR)
4708 AC_SUBST(PLATFORMID)
4709 AC_SUBST(WINDOWS_X64)
4710 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4712 dnl ===================================================================
4713 dnl Test which package format to use
4714 dnl ===================================================================
4715 AC_MSG_CHECKING([which package format to use])
4716 if test -n "$with_package_format" -a "$with_package_format" != no; then
4717     for i in $with_package_format; do
4718         case "$i" in
4719         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4720             ;;
4721         *)
4722             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4723 aix - AIX software distribution
4724 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4725 deb - Debian software distribution
4726 pkg - Solaris software distribution
4727 rpm - RedHat software distribution
4729 LibreOffice additionally supports:
4730 archive - .tar.gz or .zip
4731 dmg - macOS .dmg
4732 installed - installation tree
4733 msi - Windows .msi
4734         ])
4735             ;;
4736         esac
4737     done
4738     # fakeroot is needed to ensure correct file ownerships/permissions
4739     # inside deb packages and tar archives created on Linux and Solaris.
4740     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4741         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4742         if test "$FAKEROOT" = "no"; then
4743             AC_MSG_ERROR(
4744                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4745         fi
4746     fi
4747     PKGFORMAT="$with_package_format"
4748     AC_MSG_RESULT([$PKGFORMAT])
4749 else
4750     PKGFORMAT=
4751     AC_MSG_RESULT([none])
4753 AC_SUBST(PKGFORMAT)
4755 dnl ===================================================================
4756 dnl Set up a different compiler to produce tools to run on the build
4757 dnl machine when doing cross-compilation
4758 dnl ===================================================================
4760 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4761 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4762 if test "$cross_compiling" = "yes"; then
4763     AC_MSG_CHECKING([for BUILD platform configuration])
4764     echo
4765     rm -rf CONF-FOR-BUILD config_build.mk
4766     mkdir CONF-FOR-BUILD
4767     # Here must be listed all files needed when running the configure script. In particular, also
4768     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4769     # keep them in the same order as there.
4770     (cd $SRC_ROOT && tar cf - \
4771         config.guess \
4772         bin/get_config_variables \
4773         solenv/bin/getcompver.awk \
4774         solenv/inc/langlist.mk \
4775         download.lst \
4776         config_host.mk.in \
4777         config_host_lang.mk.in \
4778         Makefile.in \
4779         bin/bffvalidator.sh.in \
4780         bin/odfvalidator.sh.in \
4781         bin/officeotron.sh.in \
4782         hardened_runtime.xcent.in \
4783         instsetoo_native/util/openoffice.lst.in \
4784         config_host/*.in \
4785         sysui/desktop/macosx/Info.plist.in) \
4786     | (cd CONF-FOR-BUILD && tar xf -)
4787     cp configure CONF-FOR-BUILD
4788     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4789     (
4790     unset COM USING_X11 OS CPUNAME
4791     unset CC CXX SYSBASE CFLAGS
4792     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4793     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4794     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4795     if test -n "$CC_FOR_BUILD"; then
4796         export CC="$CC_FOR_BUILD"
4797         CC_BASE=`first_arg_basename "$CC"`
4798     fi
4799     if test -n "$CXX_FOR_BUILD"; then
4800         export CXX="$CXX_FOR_BUILD"
4801         CXX_BASE=`first_arg_basename "$CXX"`
4802     fi
4803     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4804     cd CONF-FOR-BUILD
4805     sub_conf_opts=""
4806     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4807     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4808     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4809     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4810     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4811     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4812     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4813     # Don't bother having configure look for stuff not needed for the build platform anyway
4814     ./configure \
4815         --disable-cups \
4816         --disable-gstreamer-1-0 \
4817         --disable-gtk3 \
4818         --disable-pdfimport \
4819         --disable-postgresql-sdbc \
4820         --enable-icecream="$enable_icecream" \
4821         --with-parallelism="$with_parallelism" \
4822         --without-doxygen \
4823         --without-java \
4824         $sub_conf_opts \
4825         --srcdir=$srcdir \
4826         2>&1 | sed -e 's/^/    /'
4827     test -f ./config_host.mk 2>/dev/null || exit
4828     cp config_host.mk ../config_build.mk
4829     cp config_host_lang.mk ../config_build_lang.mk
4830     mv config.log ../config.Build.log
4831     mkdir -p ../config_build
4832     mv config_host/*.h ../config_build
4833     . ./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
4835     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
4836         VV='$'$V
4837         VV=`eval "echo $VV"`
4838         if test -n "$VV"; then
4839             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4840             echo "$line" >>build-config
4841         fi
4842     done
4844     for V in INSTDIR INSTROOT WORKDIR; do
4845         VV='$'$V
4846         VV=`eval "echo $VV"`
4847         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4848         if test -n "$VV"; then
4849             line="${V}_FOR_BUILD='$VV'"
4850             echo "$line" >>build-config
4851         fi
4852     done
4854     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4855     echo "$line" >>build-config
4857     )
4858     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4859     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])
4860     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4861              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4863     eval `cat CONF-FOR-BUILD/build-config`
4865     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4867     rm -rf CONF-FOR-BUILD
4868 else
4869     OS_FOR_BUILD="$OS"
4870     CC_FOR_BUILD="$CC"
4871     CXX_FOR_BUILD="$CXX"
4872     INSTDIR_FOR_BUILD="$INSTDIR"
4873     INSTROOT_FOR_BUILD="$INSTROOT"
4874     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4875     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4876     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4877     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4878     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4879     WORKDIR_FOR_BUILD="$WORKDIR"
4881 AC_SUBST(OS_FOR_BUILD)
4882 AC_SUBST(INSTDIR_FOR_BUILD)
4883 AC_SUBST(INSTROOT_FOR_BUILD)
4884 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4885 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4886 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4887 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4888 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4889 AC_SUBST(WORKDIR_FOR_BUILD)
4891 dnl ===================================================================
4892 dnl Check for syslog header
4893 dnl ===================================================================
4894 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4896 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4897 dnl ===================================================================
4898 AC_MSG_CHECKING([whether to turn warnings to errors])
4899 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4900     ENABLE_WERROR="TRUE"
4901     AC_MSG_RESULT([yes])
4902 else
4903     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4904         ENABLE_WERROR="TRUE"
4905         AC_MSG_RESULT([yes])
4906     else
4907         AC_MSG_RESULT([no])
4908     fi
4910 AC_SUBST(ENABLE_WERROR)
4912 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4913 dnl ===================================================================
4914 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4915 if test -z "$enable_assert_always_abort"; then
4916    if test "$ENABLE_DEBUG" = TRUE; then
4917        enable_assert_always_abort=yes
4918    else
4919        enable_assert_always_abort=no
4920    fi
4922 if test "$enable_assert_always_abort" = "yes"; then
4923     ASSERT_ALWAYS_ABORT="TRUE"
4924     AC_MSG_RESULT([yes])
4925 else
4926     ASSERT_ALWAYS_ABORT="FALSE"
4927     AC_MSG_RESULT([no])
4929 AC_SUBST(ASSERT_ALWAYS_ABORT)
4931 # Determine whether to use ooenv for the instdir installation
4932 # ===================================================================
4933 if test $_os != "WINNT" -a $_os != "Darwin"; then
4934     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4935     if test "$enable_ooenv" = "no"; then
4936         AC_MSG_RESULT([no])
4937     else
4938         ENABLE_OOENV="TRUE"
4939         AC_MSG_RESULT([yes])
4940     fi
4942 AC_SUBST(ENABLE_OOENV)
4944 if test "$USING_X11" != TRUE; then
4945     # be sure to do not mess with unneeded stuff
4946     test_randr=no
4947     test_xrender=no
4948     test_cups=no
4949     test_dbus=no
4950     build_gstreamer_1_0=no
4951     test_kf5=no
4952     test_qt5=no
4953     test_gtk3_kde5=no
4954     enable_cairo_canvas=no
4957 if test "$OS" = "HAIKU"; then
4958     enable_cairo_canvas=yes
4959     test_kf5=yes
4962 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4963     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!])
4964     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!"
4965     enable_kf5=yes
4968 if test "$test_kf5" = "yes"; then
4969     test_qt5=yes
4972 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4973     if test "$enable_qt5" = "no"; then
4974         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4975     else
4976         enable_qt5=yes
4977     fi
4980 dnl ===================================================================
4981 dnl check for cups support
4982 dnl ===================================================================
4983 ENABLE_CUPS=""
4985 if test "$enable_cups" = "no"; then
4986     test_cups=no
4989 AC_MSG_CHECKING([whether to enable CUPS support])
4990 if test "$test_cups" = "yes"; then
4991     ENABLE_CUPS="TRUE"
4992     AC_MSG_RESULT([yes])
4994     AC_MSG_CHECKING([whether cups support is present])
4995     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4996     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4997     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4998         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4999     fi
5001 else
5002     AC_MSG_RESULT([no])
5005 AC_SUBST(ENABLE_CUPS)
5007 # fontconfig checks
5008 if test "$test_fontconfig" = "yes"; then
5009     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5010     SYSTEM_FONTCONFIG=TRUE
5011     FilterLibs "${FONTCONFIG_LIBS}"
5012     FONTCONFIG_LIBS="${filteredlibs}"
5014 AC_SUBST(FONTCONFIG_CFLAGS)
5015 AC_SUBST(FONTCONFIG_LIBS)
5016 AC_SUBST([SYSTEM_FONTCONFIG])
5018 dnl whether to find & fetch external tarballs?
5019 dnl ===================================================================
5020 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5021    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5022        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5023    else
5024        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5025    fi
5027 if test -z "$TARFILE_LOCATION"; then
5028     if test -d "$SRC_ROOT/src" ; then
5029         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5030         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5031     fi
5032     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5033 else
5034     AbsolutePath "$TARFILE_LOCATION"
5035     PathFormat "${absolute_path}"
5036     TARFILE_LOCATION="${formatted_path}"
5038 AC_SUBST(TARFILE_LOCATION)
5040 AC_MSG_CHECKING([whether we want to fetch tarballs])
5041 if test "$enable_fetch_external" != "no"; then
5042     if test "$with_all_tarballs" = "yes"; then
5043         AC_MSG_RESULT([yes, all of them])
5044         DO_FETCH_TARBALLS="ALL"
5045     else
5046         AC_MSG_RESULT([yes, if we use them])
5047         DO_FETCH_TARBALLS="TRUE"
5048     fi
5049 else
5050     AC_MSG_RESULT([no])
5051     DO_FETCH_TARBALLS=
5053 AC_SUBST(DO_FETCH_TARBALLS)
5055 AC_MSG_CHECKING([whether to build help])
5056 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5057     BUILD_TYPE="$BUILD_TYPE HELP"
5058     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5059     case "$with_help" in
5060     "html")
5061         ENABLE_HTMLHELP=TRUE
5062         SCPDEFS="$SCPDEFS -DWITH_HELP"
5063         AC_MSG_RESULT([HTML])
5064         ;;
5065     "online")
5066         ENABLE_HTMLHELP=TRUE
5067         HELP_ONLINE=TRUE
5068         AC_MSG_RESULT([HTML])
5069         ;;
5070     yes)
5071         SCPDEFS="$SCPDEFS -DWITH_HELP"
5072         AC_MSG_RESULT([yes])
5073         ;;
5074     *)
5075         AC_MSG_ERROR([Unknown --with-help=$with_help])
5076         ;;
5077     esac
5078 else
5079     AC_MSG_RESULT([no])
5081 AC_SUBST([ENABLE_HTMLHELP])
5082 AC_SUBST([HELP_ONLINE])
5084 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5085 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5086     BUILD_TYPE="$BUILD_TYPE HELP"
5087     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5088     case "$with_omindex" in
5089     "server")
5090         ENABLE_HTMLHELP=TRUE
5091         HELP_ONLINE=TRUE
5092         HELP_OMINDEX_PAGE=TRUE
5093         AC_MSG_RESULT([SERVER])
5094         ;;
5095     "noxap")
5096         ENABLE_HTMLHELP=TRUE
5097         HELP_ONLINE=TRUE
5098         HELP_OMINDEX_PAGE=FALSE
5099         AC_MSG_RESULT([NOXAP])
5100         ;;
5101     *)
5102         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5103         ;;
5104     esac
5105 else
5106     HELP_OMINDEX_PAGE=FALSE
5107     AC_MSG_RESULT([no])
5109 AC_SUBST([ENABLE_HTMLHELP])
5110 AC_SUBST([HELP_OMINDEX_PAGE])
5111 AC_SUBST([HELP_ONLINE])
5114 dnl Test whether to include MySpell dictionaries
5115 dnl ===================================================================
5116 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5117 if test "$with_myspell_dicts" = "yes"; then
5118     AC_MSG_RESULT([yes])
5119     WITH_MYSPELL_DICTS=TRUE
5120     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5121     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5122 else
5123     AC_MSG_RESULT([no])
5124     WITH_MYSPELL_DICTS=
5126 AC_SUBST(WITH_MYSPELL_DICTS)
5128 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5129 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5130     if test "$with_system_dicts" = yes; then
5131         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5132     fi
5133     with_system_dicts=no
5136 AC_MSG_CHECKING([whether to use dicts from external paths])
5137 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5138     AC_MSG_RESULT([yes])
5139     SYSTEM_DICTS=TRUE
5140     AC_MSG_CHECKING([for spelling dictionary directory])
5141     if test -n "$with_external_dict_dir"; then
5142         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5143     else
5144         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5145         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5146             DICT_SYSTEM_DIR=file:///usr/share/myspell
5147         fi
5148     fi
5149     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5150     AC_MSG_CHECKING([for hyphenation patterns directory])
5151     if test -n "$with_external_hyph_dir"; then
5152         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5153     else
5154         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5155     fi
5156     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5157     AC_MSG_CHECKING([for thesaurus directory])
5158     if test -n "$with_external_thes_dir"; then
5159         THES_SYSTEM_DIR=file://$with_external_thes_dir
5160     else
5161         THES_SYSTEM_DIR=file:///usr/share/mythes
5162     fi
5163     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5164 else
5165     AC_MSG_RESULT([no])
5166     SYSTEM_DICTS=
5168 AC_SUBST(SYSTEM_DICTS)
5169 AC_SUBST(DICT_SYSTEM_DIR)
5170 AC_SUBST(HYPH_SYSTEM_DIR)
5171 AC_SUBST(THES_SYSTEM_DIR)
5173 dnl ===================================================================
5174 dnl Precompiled headers.
5175 ENABLE_PCH=""
5176 AC_MSG_CHECKING([whether to enable pch feature])
5177 if test -z "$enable_pch"; then
5178     if test "$_os" = "WINNT"; then
5179         # Enabled by default on Windows.
5180         enable_pch=yes
5181     else
5182         enable_pch=no
5183     fi
5185 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5186     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5188 if test "$enable_pch" = "system"; then
5189     ENABLE_PCH="1"
5190     AC_MSG_RESULT([yes (system headers)])
5191 elif test "$enable_pch" = "base"; then
5192     ENABLE_PCH="2"
5193     AC_MSG_RESULT([yes (system and base headers)])
5194 elif test "$enable_pch" = "normal"; then
5195     ENABLE_PCH="3"
5196     AC_MSG_RESULT([yes (normal)])
5197 elif test "$enable_pch" = "full"; then
5198     ENABLE_PCH="4"
5199     AC_MSG_RESULT([yes (full)])
5200 elif test "$enable_pch" = "yes"; then
5201     # Pick a suitable default.
5202     if test "$GCC" = "yes"; then
5203         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5204         # while making the PCHs larger and rebuilds more likely.
5205         ENABLE_PCH="2"
5206         AC_MSG_RESULT([yes (system and base headers)])
5207     else
5208         # With MSVC the highest level makes a significant difference,
5209         # and it was the default when there used to be no PCH levels.
5210         ENABLE_PCH="4"
5211         AC_MSG_RESULT([yes (full)])
5212     fi
5213 elif test "$enable_pch" = "no"; then
5214     AC_MSG_RESULT([no])
5215 else
5216     AC_MSG_ERROR([Unknown value for --enable-pch])
5218 AC_SUBST(ENABLE_PCH)
5219 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5220 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5221     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5222     if test "$CCACHE_BIN" != "not found"; then
5223         AC_MSG_CHECKING([ccache version])
5224         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5225         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5226         AC_MSG_RESULT([$CCACHE_VERSION])
5227         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5228         if test "$CCACHE_NUMVER" -gt "030701"; then
5229             AC_MSG_RESULT([yes])
5230         else
5231             AC_MSG_RESULT([no (not newer than 3.7.1)])
5232             CCACHE_DEPEND_MODE=
5233         fi
5234     fi
5237 BUILDING_PCH_WITH_OBJ=
5238 if test -n "$ENABLE_PCH"; then
5239     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5240     save_CFLAGS=$CFLAGS
5241     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5242     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5243     CFLAGS=$save_CFLAGS
5244     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5245         AC_MSG_RESULT(yes)
5246     else
5247         AC_MSG_RESULT(no)
5248     fi
5250 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5252 PCH_MODULES_CODEGEN=
5253 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5254     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-codegen])
5255     save_CFLAGS=$CFLAGS
5256     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-codegen"
5257     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_CODEGEN="-Xclang -fmodules-codegen" ],[])
5258     CFLAGS=$save_CFLAGS
5259     if test -n "$PCH_MODULES_CODEGEN"; then
5260         AC_MSG_RESULT(yes)
5261     else
5262         AC_MSG_RESULT(no)
5263     fi
5264     CFLAGS=$save_CFLAGS
5266 AC_SUBST(PCH_MODULES_CODEGEN)
5267 PCH_MODULES_DEBUGINFO=
5268 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5269     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-debuginfo])
5270     save_CFLAGS=$CFLAGS
5271     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-debuginfo"
5272     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_DEBUGINFO="-Xclang -fmodules-debuginfo" ],[])
5273     CFLAGS=$save_CFLAGS
5274     if test -n "$PCH_MODULES_DEBUGINFO"; then
5275         AC_MSG_RESULT(yes)
5276     else
5277         AC_MSG_RESULT(no)
5278     fi
5279     CFLAGS=$save_CFLAGS
5281 AC_SUBST(PCH_MODULES_DEBUGINFO)
5283 TAB=`printf '\t'`
5285 AC_MSG_CHECKING([the GNU Make version])
5286 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5287 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5288 if test "$_make_longver" -ge "038200"; then
5289     AC_MSG_RESULT([$GNUMAKE $_make_version])
5291 elif test "$_make_longver" -ge "038100"; then
5292     if test "$build_os" = "cygwin"; then
5293         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5294     fi
5295     AC_MSG_RESULT([$GNUMAKE $_make_version])
5297     dnl ===================================================================
5298     dnl Search all the common names for sha1sum
5299     dnl ===================================================================
5300     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5301     if test -z "$SHA1SUM"; then
5302         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5303     elif test "$SHA1SUM" = "openssl"; then
5304         SHA1SUM="openssl sha1"
5305     fi
5306     AC_MSG_CHECKING([for GNU Make bug 20033])
5307     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5308     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5309 A := \$(wildcard *.a)
5311 .PHONY: all
5312 all: \$(A:.a=.b)
5313 <TAB>@echo survived bug20033.
5315 .PHONY: setup
5316 setup:
5317 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5319 define d1
5320 @echo lala \$(1)
5321 @sleep 1
5322 endef
5324 define d2
5325 @echo tyty \$(1)
5326 @sleep 1
5327 endef
5329 %.b : %.a
5330 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5331 <TAB>\$(call d1,\$(CHECKSUM)),\
5332 <TAB>\$(call d2,\$(CHECKSUM)))
5334     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5335         no_parallelism_make="YES"
5336         AC_MSG_RESULT([yes, disable parallelism])
5337     else
5338         AC_MSG_RESULT([no, keep parallelism enabled])
5339     fi
5340     rm -rf $TESTGMAKEBUG20033
5341 else
5342     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5345 # find if gnumake support file function
5346 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5347 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5348 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5349     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5351 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5352 \$(file >test.txt,Success )
5354 .PHONY: all
5355 all:
5356 <TAB>@cat test.txt
5359 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5360 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5361     HAVE_GNUMAKE_FILE_FUNC=TRUE
5362     AC_MSG_RESULT([yes])
5363 else
5364     AC_MSG_RESULT([no])
5366 rm -rf $TESTGMAKEFILEFUNC
5367 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5368 AC_SUBST(GNUMAKE_WIN_NATIVE)
5370 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5371 STALE_MAKE=
5372 if test "$_make_ver_check" = ""; then
5373    STALE_MAKE=TRUE
5376 HAVE_LD_HASH_STYLE=FALSE
5377 WITH_LINKER_HASH_STYLE=
5378 AC_MSG_CHECKING([for --hash-style gcc linker support])
5379 if test "$GCC" = "yes"; then
5380     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5381         hash_styles="gnu sysv"
5382     elif test "$with_linker_hash_style" = "no"; then
5383         hash_styles=
5384     else
5385         hash_styles="$with_linker_hash_style"
5386     fi
5388     for hash_style in $hash_styles; do
5389         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5390         hash_style_ldflags_save=$LDFLAGS
5391         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5393         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5394             [
5395 #include <stdio.h>
5396             ],[
5397 printf ("");
5398             ])],
5399             [
5400                   HAVE_LD_HASH_STYLE=TRUE
5401                   WITH_LINKER_HASH_STYLE=$hash_style
5402             ],
5403             [HAVE_LD_HASH_STYLE=FALSE],
5404             [HAVE_LD_HASH_STYLE=FALSE])
5405         LDFLAGS=$hash_style_ldflags_save
5406     done
5408     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5409         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5410     else
5411         AC_MSG_RESULT( no )
5412     fi
5413     LDFLAGS=$hash_style_ldflags_save
5414 else
5415     AC_MSG_RESULT( no )
5417 AC_SUBST(HAVE_LD_HASH_STYLE)
5418 AC_SUBST(WITH_LINKER_HASH_STYLE)
5420 dnl ===================================================================
5421 dnl Check whether there's a Perl version available.
5422 dnl ===================================================================
5423 if test -z "$with_perl_home"; then
5424     AC_PATH_PROG(PERL, perl)
5425 else
5426     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5427     _perl_path="$with_perl_home/bin/perl"
5428     if test -x "$_perl_path"; then
5429         PERL=$_perl_path
5430     else
5431         AC_MSG_ERROR([$_perl_path not found])
5432     fi
5435 dnl ===================================================================
5436 dnl Testing for Perl version 5 or greater.
5437 dnl $] is the Perl version variable, it is returned as an integer
5438 dnl ===================================================================
5439 if test "$PERL"; then
5440     AC_MSG_CHECKING([the Perl version])
5441     ${PERL} -e "exit($]);"
5442     _perl_version=$?
5443     if test "$_perl_version" -lt 5; then
5444         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5445     fi
5446     AC_MSG_RESULT([Perl $_perl_version])
5447 else
5448     AC_MSG_ERROR([Perl not found, install Perl 5])
5451 dnl ===================================================================
5452 dnl Testing for required Perl modules
5453 dnl ===================================================================
5455 AC_MSG_CHECKING([for required Perl modules])
5456 perl_use_string="use Cwd ; use Digest::MD5"
5457 if test "$_os" = "WINNT"; then
5458     if test -n "$PKGFORMAT"; then
5459         for i in $PKGFORMAT; do
5460             case "$i" in
5461             msi)
5462                 # for getting fonts versions to use in MSI
5463                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5464                 ;;
5465             esac
5466         done
5467     fi
5469 if test "$with_system_hsqldb" = "yes"; then
5470     perl_use_string="$perl_use_string ; use Archive::Zip"
5472 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5473     AC_MSG_RESULT([all modules found])
5474 else
5475     AC_MSG_RESULT([failed to find some modules])
5476     # Find out which modules are missing.
5477     for i in $perl_use_string; do
5478         if test "$i" != "use" -a "$i" != ";"; then
5479             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5480                 missing_perl_modules="$missing_perl_modules $i"
5481             fi
5482         fi
5483     done
5484     AC_MSG_ERROR([
5485     The missing Perl modules are: $missing_perl_modules
5486     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5489 dnl ===================================================================
5490 dnl Check for pkg-config
5491 dnl ===================================================================
5492 if test "$_os" != "WINNT"; then
5493     PKG_PROG_PKG_CONFIG
5496 if test "$_os" != "WINNT"; then
5498     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5499     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5500     # explicitly. Or put /path/to/compiler in PATH yourself.
5502     # Use wrappers for LTO
5503     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5504         AC_CHECK_TOOL(AR,gcc-ar)
5505         AC_CHECK_TOOL(NM,gcc-nm)
5506         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5507     else
5508         AC_CHECK_TOOL(AR,ar)
5509         AC_CHECK_TOOL(NM,nm)
5510         AC_CHECK_TOOL(RANLIB,ranlib)
5511     fi
5512     AC_CHECK_TOOL(OBJDUMP,objdump)
5513     AC_CHECK_TOOL(READELF,readelf)
5514     AC_CHECK_TOOL(STRIP,strip)
5515     if test "$_os" = "WINNT"; then
5516         AC_CHECK_TOOL(DLLTOOL,dlltool)
5517         AC_CHECK_TOOL(WINDRES,windres)
5518     fi
5520 AC_SUBST(AR)
5521 AC_SUBST(DLLTOOL)
5522 AC_SUBST(NM)
5523 AC_SUBST(OBJDUMP)
5524 AC_SUBST(PKG_CONFIG)
5525 AC_SUBST(RANLIB)
5526 AC_SUBST(READELF)
5527 AC_SUBST(STRIP)
5528 AC_SUBST(WINDRES)
5530 dnl ===================================================================
5531 dnl pkg-config checks on macOS
5532 dnl ===================================================================
5534 if test $_os = Darwin; then
5535     AC_MSG_CHECKING([for bogus pkg-config])
5536     if test -n "$PKG_CONFIG"; then
5537         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5538             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5539         else
5540             if test "$enable_bogus_pkg_config" = "yes"; then
5541                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5542             else
5543                 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.])
5544             fi
5545         fi
5546     else
5547         AC_MSG_RESULT([no, good])
5548     fi
5551 find_csc()
5553     # Return value: $csctest
5555     unset csctest
5557     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5558     if test -n "$regvalue"; then
5559         csctest=$regvalue
5560         return
5561     fi
5564 find_al()
5566     # Return value: $altest
5568     unset altest
5570     # We need this check to detect 4.6.1 or above.
5571     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5572         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5573         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5574             altest=$regvalue
5575             return
5576         fi
5577     done
5579     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5580         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5581         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5582             altest=$regvalue
5583             return
5584         fi
5585     done
5590 find_dotnetsdk46()
5592     unset frametest
5594     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5595         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5596         if test -n "$regvalue"; then
5597             frametest=$regvalue
5598             return
5599         fi
5600     done
5603 find_winsdk_version()
5605     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5606     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5608     unset winsdktest winsdkbinsubdir winsdklibsubdir
5610     case "$1" in
5611     8.0|8.0A)
5612         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5613         if test -n "$regvalue"; then
5614             winsdktest=$regvalue
5615             winsdklibsubdir=win8
5616             return
5617         fi
5618         ;;
5619     8.1|8.1A)
5620         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5621         if test -n "$regvalue"; then
5622             winsdktest=$regvalue
5623             winsdklibsubdir=winv6.3
5624             return
5625         fi
5626         ;;
5627     10.0)
5628         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5629         if test -n "$regvalue"; then
5630             winsdktest=$regvalue
5631             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5632             if test -n "$regvalue"; then
5633                 winsdkbinsubdir="$regvalue".0
5634                 winsdklibsubdir=$winsdkbinsubdir
5635                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5636                 # test exist the SDK path
5637                 if test -d "$tmppath"; then
5638                    # when path is convertible to a short path then path is okay
5639                    cygpath -d "$tmppath" >/dev/null 2>&1
5640                    if test $? -ne 0; then
5641                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5642                    fi
5643                 else
5644                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5645                 fi
5646             fi
5647             return
5648         fi
5649         ;;
5650     esac
5653 find_winsdk()
5655     # Return value: From find_winsdk_version
5657     unset winsdktest
5659     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5660         find_winsdk_version $ver
5661         if test -n "$winsdktest"; then
5662             return
5663         fi
5664     done
5667 find_msms()
5669     AC_MSG_CHECKING([for MSVC merge modules directory])
5670     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5671     case "$VCVER" in
5672         160)
5673         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5674         ;;
5675     esac
5676     for f in $my_msm_files; do
5677         echo "$as_me:$LINENO: searching for $f" >&5
5678     done
5680     msmdir=
5681     for ver in 14.0 15.0; do
5682         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5683         if test -n "$regvalue"; then
5684             for f in ${my_msm_files}; do
5685                 if test -e "$regvalue/${f}"; then
5686                     msmdir=$regvalue
5687                     break
5688                 fi
5689             done
5690         fi
5691     done
5692     dnl Is the following fallback really necessary, or was it added in response
5693     dnl to never having started Visual Studio on a given machine, so the
5694     dnl registry keys checked above had presumably not yet been created?
5695     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5696     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5697     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5698     dnl expanding to "C:\Program Files\Common Files"), which would need
5699     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5700     dnl obtain its value from cygwin:
5701     if test -z "$msmdir"; then
5702         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5703         for f in ${my_msm_files}; do
5704             if test -e "$my_msm_dir/${f}"; then
5705                 msmdir=$my_msm_dir
5706             fi
5707         done
5708     fi
5710     dnl Starting from MSVC 15.0, merge modules are located in different directory
5711     case "$VCVER" in
5712     160)
5713         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5714             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5715             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5716             for f in ${my_msm_files}; do
5717                 if test -e "$my_msm_dir/${f}"; then
5718                     msmdir=$my_msm_dir
5719                     break
5720                 fi
5721             done
5722         done
5723         ;;
5724     esac
5726     if test -n "$msmdir"; then
5727         msmdir=`cygpath -m "$msmdir"`
5728         AC_MSG_RESULT([$msmdir])
5729     else
5730         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5731             AC_MSG_FAILURE([not found])
5732         else
5733             AC_MSG_WARN([not found (check config.log)])
5734             add_warning "MSM none of ${my_msm_files} found"
5735         fi
5736     fi
5739 find_msvc_x64_dlls()
5741     AC_MSG_CHECKING([for MSVC x64 DLL path])
5742     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5743     case "$VCVER" in
5744     160)
5745         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5746             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5747             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5748                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5749                 break
5750             fi
5751             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5752             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5753                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5754                 break
5755             fi
5756         done
5757         ;;
5758     esac
5759     AC_MSG_RESULT([$msvcdllpath])
5760     AC_MSG_CHECKING([for MSVC x64 DLLs])
5761     msvcdlls="msvcp140.dll vcruntime140.dll"
5762     for dll in $msvcdlls; do
5763         if ! test -f "$msvcdllpath/$dll"; then
5764             AC_MSG_FAILURE([missing $dll])
5765         fi
5766     done
5767     AC_MSG_RESULT([found all ($msvcdlls)])
5770 dnl =========================================
5771 dnl Check for the Windows  SDK.
5772 dnl =========================================
5773 if test "$_os" = "WINNT"; then
5774     AC_MSG_CHECKING([for Windows SDK])
5775     if test "$build_os" = "cygwin"; then
5776         find_winsdk
5777         WINDOWS_SDK_HOME=$winsdktest
5779         # normalize if found
5780         if test -n "$WINDOWS_SDK_HOME"; then
5781             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5782             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5783         fi
5785         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5786     fi
5788     if test -n "$WINDOWS_SDK_HOME"; then
5789         # Remove a possible trailing backslash
5790         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5792         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5793              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5794              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5795             have_windows_sdk_headers=yes
5796         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5797              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5798              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5799             have_windows_sdk_headers=yes
5800         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5801              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5802              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5803             have_windows_sdk_headers=yes
5804         else
5805             have_windows_sdk_headers=no
5806         fi
5808         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5809             have_windows_sdk_libs=yes
5810         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5811             have_windows_sdk_libs=yes
5812         else
5813             have_windows_sdk_libs=no
5814         fi
5816         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5817             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5818 the  Windows SDK are installed.])
5819         fi
5820     fi
5822     if test -z "$WINDOWS_SDK_HOME"; then
5823         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5824     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5825         WINDOWS_SDK_VERSION=80
5826         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5827     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5828         WINDOWS_SDK_VERSION=81
5829         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5830     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5831         WINDOWS_SDK_VERSION=10
5832         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5833     else
5834         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5835     fi
5836     PathFormat "$WINDOWS_SDK_HOME"
5837     WINDOWS_SDK_HOME="$formatted_path"
5838     if test "$build_os" = "cygwin"; then
5839         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5840         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5841             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5842         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5843             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5844         fi
5845     fi
5847     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5848     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5849     dnl but not in v8.0), so allow this to be overridden with a
5850     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5851     dnl and configuration error if no WiLangId.vbs is found would arguably be
5852     dnl better, but I do not know under which conditions exactly it is needed by
5853     dnl msiglobal.pm:
5854     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5855         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5856         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5857             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5858         fi
5859         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5860             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5861         fi
5862         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5863             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5864         fi
5865     fi
5866     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5867         if test -n "$with_package_format" -a "$with_package_format" != no; then
5868             for i in "$with_package_format"; do
5869                 if test "$i" = "msi"; then
5870                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5871                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5872                     fi
5873                 fi
5874             done
5875         fi
5876     fi
5878 AC_SUBST(WINDOWS_SDK_HOME)
5879 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5880 AC_SUBST(WINDOWS_SDK_VERSION)
5881 AC_SUBST(WINDOWS_SDK_WILANGID)
5883 if test "$build_os" = "cygwin"; then
5884     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5885     dnl dir, it also determines that dir's path w/o an arch segment if any,
5886     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5887     AC_MSG_CHECKING([for midl.exe])
5889     find_winsdk
5890     if test -n "$winsdkbinsubdir" \
5891         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5892     then
5893         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5894         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5895     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5896         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5897         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5898     elif test -f "$winsdktest/Bin/midl.exe"; then
5899         MIDL_PATH=$winsdktest/Bin
5900         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5901     fi
5902     if test ! -f "$MIDL_PATH/midl.exe"; then
5903         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5904     else
5905         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5906     fi
5908     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5909     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5911     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5912          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5913          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5914          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5915     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5916          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5917          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5918          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5919     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5920          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5921          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5922          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5923     else
5924         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5925     fi
5927     dnl Check csc.exe
5928     AC_MSG_CHECKING([for csc.exe])
5929     find_csc
5930     if test -f "$csctest/csc.exe"; then
5931         CSC_PATH="$csctest"
5932     fi
5933     if test ! -f "$CSC_PATH/csc.exe"; then
5934         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5935     else
5936         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5937     fi
5939     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5941     dnl Check al.exe
5942     AC_MSG_CHECKING([for al.exe])
5943     find_winsdk
5944     if test -n "$winsdkbinsubdir" \
5945         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5946     then
5947         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5948     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5949         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5950     elif test -f "$winsdktest/Bin/al.exe"; then
5951         AL_PATH="$winsdktest/Bin"
5952     fi
5954     if test -z "$AL_PATH"; then
5955         find_al
5956         if test -f "$altest/bin/al.exe"; then
5957             AL_PATH="$altest/bin"
5958         elif test -f "$altest/al.exe"; then
5959             AL_PATH="$altest"
5960         fi
5961     fi
5962     if test ! -f "$AL_PATH/al.exe"; then
5963         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5964     else
5965         AC_MSG_RESULT([$AL_PATH/al.exe])
5966     fi
5968     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5970     dnl Check mscoree.lib / .NET Framework dir
5971     AC_MSG_CHECKING(.NET Framework)
5972     find_dotnetsdk46
5973     PathFormat "$frametest"
5974     frametest="$formatted_path"
5975     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5976         DOTNET_FRAMEWORK_HOME="$frametest"
5977     else
5978         find_winsdk
5979         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5980             DOTNET_FRAMEWORK_HOME="$winsdktest"
5981         fi
5982     fi
5983     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
5984         AC_MSG_ERROR([mscoree.lib not found])
5985     fi
5986     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5988     PathFormat "$MIDL_PATH"
5989     MIDL_PATH="$formatted_path"
5991     PathFormat "$AL_PATH"
5992     AL_PATH="$formatted_path"
5994     PathFormat "$DOTNET_FRAMEWORK_HOME"
5995     DOTNET_FRAMEWORK_HOME="$formatted_path"
5997     PathFormat "$CSC_PATH"
5998     CSC_PATH="$formatted_path"
6001 dnl ===================================================================
6002 dnl Check if stdc headers are available excluding MSVC.
6003 dnl ===================================================================
6004 if test "$_os" != "WINNT"; then
6005     AC_HEADER_STDC
6008 dnl ===================================================================
6009 dnl Testing for C++ compiler and version...
6010 dnl ===================================================================
6012 if test "$_os" != "WINNT"; then
6013     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6014     save_CXXFLAGS=$CXXFLAGS
6015     AC_PROG_CXX
6016     CXXFLAGS=$save_CXXFLAGS
6017     if test -z "$CXX_BASE"; then
6018         CXX_BASE=`first_arg_basename "$CXX"`
6019     fi
6022 dnl check for GNU C++ compiler version
6023 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6024     AC_MSG_CHECKING([the GNU C++ compiler version])
6026     _gpp_version=`$CXX -dumpversion`
6027     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6029     if test "$_gpp_majmin" -lt "700"; then
6030         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6031     else
6032         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6033     fi
6035     dnl see https://code.google.com/p/android/issues/detail?id=41770
6036         glibcxx_threads=no
6037         AC_LANG_PUSH([C++])
6038         AC_REQUIRE_CPP
6039         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6040         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6041             #include <bits/c++config.h>]],[[
6042             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6043             && !defined(_GLIBCXX__PTHREADS) \
6044             && !defined(_GLIBCXX_HAS_GTHREADS)
6045             choke me
6046             #endif
6047         ]])],[AC_MSG_RESULT([yes])
6048         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6049         AC_LANG_POP([C++])
6050         if test $glibcxx_threads = yes; then
6051             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6052         fi
6054 AC_SUBST(BOOST_CXXFLAGS)
6057 # prefx CXX with ccache if needed
6059 if test "$CCACHE" != ""; then
6060     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6061     AC_LANG_PUSH([C++])
6062     save_CXXFLAGS=$CXXFLAGS
6063     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6064     dnl an empty program will do, we're checking the compiler flags
6065     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6066                       [use_ccache=yes], [use_ccache=no])
6067     if test $use_ccache = yes; then
6068         AC_MSG_RESULT([yes])
6069     else
6070         CXX="$CCACHE $CXX"
6071         CXX_BASE="ccache $CXX_BASE"
6072         AC_MSG_RESULT([no])
6073     fi
6074     CXXFLAGS=$save_CXXFLAGS
6075     AC_LANG_POP([C++])
6078 dnl ===================================================================
6079 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6080 dnl ===================================================================
6082 if test "$_os" != "WINNT"; then
6083     AC_PROG_CXXCPP
6085     dnl Check whether there's a C pre-processor.
6086     AC_PROG_CPP
6090 dnl ===================================================================
6091 dnl Find integral type sizes and alignments
6092 dnl ===================================================================
6094 if test "$_os" != "WINNT"; then
6096 if test "$_os" = "iOS"; then
6097     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6098     ac_cv_sizeof_long=8
6099     ac_cv_sizeof_short=2
6100     ac_cv_sizeof_int=4
6101     ac_cv_sizeof_long_long=8
6102     ac_cv_sizeof_double=8
6103     ac_cv_sizeof_voidp=8
6104 else
6105     AC_CHECK_SIZEOF(long)
6106     AC_CHECK_SIZEOF(short)
6107     AC_CHECK_SIZEOF(int)
6108     AC_CHECK_SIZEOF(long long)
6109     AC_CHECK_SIZEOF(double)
6110     AC_CHECK_SIZEOF(void*)
6113     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6114     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6115     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6116     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6117     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6119     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6120     m4_pattern_allow([AC_CHECK_ALIGNOF])
6121     m4_ifdef([AC_CHECK_ALIGNOF],
6122         [
6123             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6124             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6125             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6126             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6127         ],
6128         [
6129             case "$_os-$host_cpu" in
6130             Linux-i686)
6131                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6132                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6133                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6134                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6135                 ;;
6136             Linux-x86_64)
6137                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6138                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6139                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6140                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6141                 ;;
6142             *)
6143                 if test -z "$ac_cv_alignof_short" -o \
6144                         -z "$ac_cv_alignof_int" -o \
6145                         -z "$ac_cv_alignof_long" -o \
6146                         -z "$ac_cv_alignof_double"; then
6147                    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.])
6148                 fi
6149                 ;;
6150             esac
6151         ])
6153     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6154     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6155     if test $ac_cv_sizeof_long -eq 8; then
6156         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6157     elif test $ac_cv_sizeof_double -eq 8; then
6158         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6159     else
6160         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6161     fi
6163     dnl Check for large file support
6164     AC_SYS_LARGEFILE
6165     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6166         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6167     fi
6168     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6169         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6170     fi
6171 else
6172     # Hardcode for MSVC
6173     SAL_TYPES_SIZEOFSHORT=2
6174     SAL_TYPES_SIZEOFINT=4
6175     SAL_TYPES_SIZEOFLONG=4
6176     SAL_TYPES_SIZEOFLONGLONG=8
6177     if test "$BITNESS_OVERRIDE" = ""; then
6178         SAL_TYPES_SIZEOFPOINTER=4
6179     else
6180         SAL_TYPES_SIZEOFPOINTER=8
6181     fi
6182     SAL_TYPES_ALIGNMENT2=2
6183     SAL_TYPES_ALIGNMENT4=4
6184     SAL_TYPES_ALIGNMENT8=8
6185     LFS_CFLAGS=''
6187 AC_SUBST(LFS_CFLAGS)
6189 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6190 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6191 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6192 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6193 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6194 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6195 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6196 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6198 dnl ===================================================================
6199 dnl Check whether to enable runtime optimizations
6200 dnl ===================================================================
6201 ENABLE_RUNTIME_OPTIMIZATIONS=
6202 AC_MSG_CHECKING([whether to enable runtime optimizations])
6203 if test -z "$enable_runtime_optimizations"; then
6204     for i in $CC; do
6205         case $i in
6206         -fsanitize=*)
6207             enable_runtime_optimizations=no
6208             break
6209             ;;
6210         esac
6211     done
6213 if test "$enable_runtime_optimizations" != no; then
6214     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6215     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6216     AC_MSG_RESULT([yes])
6217 else
6218     AC_MSG_RESULT([no])
6220 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6222 dnl ===================================================================
6223 dnl Check if valgrind headers are available
6224 dnl ===================================================================
6225 ENABLE_VALGRIND=
6226 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6227     prev_cppflags=$CPPFLAGS
6228     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6229     # or where does it come from?
6230     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6231     AC_CHECK_HEADER([valgrind/valgrind.h],
6232         [ENABLE_VALGRIND=TRUE])
6233     CPPFLAGS=$prev_cppflags
6235 AC_SUBST([ENABLE_VALGRIND])
6236 if test -z "$ENABLE_VALGRIND"; then
6237     if test "$with_valgrind" = yes; then
6238         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6239     fi
6240     VALGRIND_CFLAGS=
6242 AC_SUBST([VALGRIND_CFLAGS])
6245 dnl ===================================================================
6246 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6247 dnl ===================================================================
6249 # We need at least the sys/sdt.h include header.
6250 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6251 if test "$SDT_H_FOUND" = "TRUE"; then
6252     # Found sys/sdt.h header, now make sure the c++ compiler works.
6253     # Old g++ versions had problems with probes in constructors/destructors.
6254     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6255     AC_LANG_PUSH([C++])
6256     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6257     #include <sys/sdt.h>
6258     class ProbeClass
6259     {
6260     private:
6261       int& ref;
6262       const char *name;
6264     public:
6265       ProbeClass(int& v, const char *n) : ref(v), name(n)
6266       {
6267         DTRACE_PROBE2(_test_, cons, name, ref);
6268       }
6270       void method(int min)
6271       {
6272         DTRACE_PROBE3(_test_, meth, name, ref, min);
6273         ref -= min;
6274       }
6276       ~ProbeClass()
6277       {
6278         DTRACE_PROBE2(_test_, dest, name, ref);
6279       }
6280     };
6281     ]],[[
6282     int i = 64;
6283     DTRACE_PROBE1(_test_, call, i);
6284     ProbeClass inst = ProbeClass(i, "call");
6285     inst.method(24);
6286     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6287           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6288     AC_LANG_POP([C++])
6290 AC_CONFIG_HEADERS([config_host/config_probes.h])
6292 dnl ===================================================================
6293 dnl GCC features
6294 dnl ===================================================================
6295 HAVE_GCC_STACK_CLASH_PROTECTION=
6296 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6297     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6298     save_CFLAGS=$CFLAGS
6299     CFLAGS="$CFLAGS -fstack-clash-protection"
6300     AC_LINK_IFELSE(
6301         [AC_LANG_PROGRAM(, [[return 0;]])],
6302         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6303         [AC_MSG_RESULT([no])])
6304     CFLAGS=$save_CFLAGS
6306     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6307     save_CFLAGS=$CFLAGS
6308     CFLAGS="$CFLAGS -Werror -mno-avx"
6309     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6310     CFLAGS=$save_CFLAGS
6311     if test "$HAVE_GCC_AVX" = "TRUE"; then
6312         AC_MSG_RESULT([yes])
6313     else
6314         AC_MSG_RESULT([no])
6315     fi
6317     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6318     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6319     int v = 0;
6320     if (__sync_add_and_fetch(&v, 1) != 1 ||
6321         __sync_sub_and_fetch(&v, 1) != 0)
6322         return 1;
6323     __sync_synchronize();
6324     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6325         v != 1)
6326         return 1;
6327     return 0;
6328 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6329     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6330         AC_MSG_RESULT([yes])
6331         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6332     else
6333         AC_MSG_RESULT([no])
6334     fi
6336     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6337     AC_LANG_PUSH([C++])
6338     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6339             #include <cstddef>
6340             #include <cxxabi.h>
6341             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6342         ])], [
6343             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6344             AC_MSG_RESULT([yes])
6345         ], [AC_MSG_RESULT([no])])
6346     AC_LANG_POP([C++])
6348     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6349     AC_LANG_PUSH([C++])
6350     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6351             #include <cstddef>
6352             #include <cxxabi.h>
6353             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6354         ])], [
6355             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6356             AC_MSG_RESULT([yes])
6357         ], [AC_MSG_RESULT([no])])
6358     AC_LANG_POP([C++])
6360     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6361     AC_LANG_PUSH([C++])
6362     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6363             #include <cxxabi.h>
6364             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6365         ])], [
6366             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6367             AC_MSG_RESULT([yes])
6368         ], [AC_MSG_RESULT([no])])
6369     AC_LANG_POP([C++])
6371     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6372     AC_LANG_PUSH([C++])
6373     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6374             #include <cstddef>
6375             #include <cxxabi.h>
6376             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6377         ])], [
6378             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6379             AC_MSG_RESULT([yes])
6380         ], [AC_MSG_RESULT([no])])
6381     AC_LANG_POP([C++])
6383     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6384     AC_LANG_PUSH([C++])
6385     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6386             #include <cstddef>
6387             #include <cxxabi.h>
6388             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6389         ])], [
6390             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6391             AC_MSG_RESULT([yes])
6392         ], [AC_MSG_RESULT([no])])
6393     AC_LANG_POP([C++])
6395     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6396     AC_LANG_PUSH([C++])
6397     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6398             #include <cxxabi.h>
6399             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6400         ])], [
6401             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6402             AC_MSG_RESULT([yes])
6403         ], [AC_MSG_RESULT([no])])
6404     AC_LANG_POP([C++])
6406     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6407     AC_LANG_PUSH([C++])
6408     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6409             #include <cxxabi.h>
6410             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6411         ])], [
6412             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6413             AC_MSG_RESULT([yes])
6414         ], [AC_MSG_RESULT([no])])
6415     AC_LANG_POP([C++])
6417     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6418     AC_LANG_PUSH([C++])
6419     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6420             #include <cxxabi.h>
6421             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6422         ])], [
6423             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6424             AC_MSG_RESULT([yes])
6425         ], [AC_MSG_RESULT([no])])
6426     AC_LANG_POP([C++])
6428     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6429     AC_LANG_PUSH([C++])
6430     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6431             #include <cstddef>
6432             #include <cxxabi.h>
6433             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6434         ])], [
6435             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6436             AC_MSG_RESULT([yes])
6437         ], [AC_MSG_RESULT([no])])
6438     AC_LANG_POP([C++])
6440     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6441     AC_LANG_PUSH([C++])
6442     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6443             #include <cstddef>
6444             #include <cxxabi.h>
6445             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6446         ])], [
6447             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6448             AC_MSG_RESULT([yes])
6449         ], [AC_MSG_RESULT([no])])
6450     AC_LANG_POP([C++])
6453 AC_SUBST(HAVE_GCC_AVX)
6454 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6455 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6457 dnl ===================================================================
6458 dnl Identify the C++ library
6459 dnl ===================================================================
6461 AC_MSG_CHECKING([what the C++ library is])
6462 AC_LANG_PUSH([C++])
6463 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6464 #include <utility>
6465 #ifndef __GLIBCXX__
6466 foo bar
6467 #endif
6468 ]])],
6469     [CPP_LIBRARY=GLIBCXX
6470      cpp_library_name="GNU libstdc++"
6471     ],
6472     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6473 #include <utility>
6474 #ifndef _LIBCPP_VERSION
6475 foo bar
6476 #endif
6477 ]])],
6478     [CPP_LIBRARY=LIBCPP
6479      cpp_library_name="LLVM libc++"
6480      AC_DEFINE([HAVE_LIBCXX])
6481     ],
6482     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6483 #include <utility>
6484 #ifndef _MSC_VER
6485 foo bar
6486 #endif
6487 ]])],
6488     [CPP_LIBRARY=MSVCRT
6489      cpp_library_name="Microsoft"
6490     ],
6491     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6492 AC_MSG_RESULT([$cpp_library_name])
6493 AC_LANG_POP([C++])
6495 dnl ===================================================================
6496 dnl Check for gperf
6497 dnl ===================================================================
6498 AC_PATH_PROG(GPERF, gperf)
6499 if test -z "$GPERF"; then
6500     AC_MSG_ERROR([gperf not found but needed. Install it.])
6502 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6503     GPERF=`cygpath -m $GPERF`
6505 AC_MSG_CHECKING([whether gperf is new enough])
6506 my_gperf_ver1=$($GPERF --version | head -n 1)
6507 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6508 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6509 if test "$my_gperf_ver3" -ge 301; then
6510     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6511 else
6512     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6514 AC_SUBST(GPERF)
6516 dnl ===================================================================
6517 dnl Check for system libcmis
6518 dnl ===================================================================
6519 # libcmis requires curl and we can't build curl for iOS
6520 if test $_os != iOS; then
6521     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6522     ENABLE_LIBCMIS=TRUE
6523 else
6524     ENABLE_LIBCMIS=
6526 AC_SUBST(ENABLE_LIBCMIS)
6528 dnl ===================================================================
6529 dnl C++11
6530 dnl ===================================================================
6532 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6533 CXXFLAGS_CXX11=
6534 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6535     if test "$with_latest_c__" = yes; then
6536         CXXFLAGS_CXX11=-std:c++latest
6537     else
6538         CXXFLAGS_CXX11=-std:c++17
6539     fi
6540     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6541 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6542     my_flags='-std=c++17 -std=c++1z'
6543     if test "$with_latest_c__" = yes; then
6544         my_flags="-std=c++20 -std=c++2a $my_flags"
6545     fi
6546     for flag in $my_flags; do
6547         if test "$COM" = MSC; then
6548             flag="-Xclang $flag"
6549         fi
6550         save_CXXFLAGS=$CXXFLAGS
6551         CXXFLAGS="$CXXFLAGS $flag -Werror"
6552         if test "$SYSTEM_LIBCMIS" = TRUE; then
6553             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6554         fi
6555         AC_LANG_PUSH([C++])
6556         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6557             #include <algorithm>
6558             #include <functional>
6559             #include <vector>
6561             #if defined SYSTEM_LIBCMIS
6562             // See ucb/source/ucp/cmis/auth_provider.hxx:
6563             #if !defined __clang__
6564             #pragma GCC diagnostic push
6565             #pragma GCC diagnostic ignored "-Wdeprecated"
6566             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6567             #endif
6568             #include <libcmis/libcmis.hxx>
6569             #if !defined __clang__
6570             #pragma GCC diagnostic pop
6571             #endif
6572             #endif
6574             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6575                 std::sort(v.begin(), v.end(), fn);
6576             }
6577             ]])],[CXXFLAGS_CXX11=$flag])
6578         AC_LANG_POP([C++])
6579         CXXFLAGS=$save_CXXFLAGS
6580         if test -n "$CXXFLAGS_CXX11"; then
6581             break
6582         fi
6583     done
6585 if test -n "$CXXFLAGS_CXX11"; then
6586     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6587 else
6588     AC_MSG_ERROR(no)
6590 AC_SUBST(CXXFLAGS_CXX11)
6592 if test "$GCC" = "yes"; then
6593     save_CXXFLAGS=$CXXFLAGS
6594     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6595     CHECK_L_ATOMIC
6596     CXXFLAGS=$save_CXXFLAGS
6597     AC_SUBST(ATOMIC_LIB)
6600 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6601 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6602 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6603 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6604 dnl again towards 4.7.2:
6605 if test $CPP_LIBRARY = GLIBCXX; then
6606     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6607     AC_LANG_PUSH([C++])
6608     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6609 #include <list>
6610 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6611     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6612     //   GCC 4.7.0: 20120322
6613     //   GCC 4.7.1: 20120614
6614     // and using a range check is not possible as the mapping between
6615     // __GLIBCXX__ values and GCC versions is not monotonic
6616 /* ok */
6617 #else
6618 abi broken
6619 #endif
6620         ]])], [AC_MSG_RESULT(no, ok)],
6621         [AC_MSG_ERROR(yes)])
6622     AC_LANG_POP([C++])
6625 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6626 save_CXXFLAGS=$CXXFLAGS
6627 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6628 AC_LANG_PUSH([C++])
6630 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6631 #include <stddef.h>
6633 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6635 namespace
6637         struct b
6638         {
6639                 int i;
6640                 int j;
6641         };
6643 ]], [[
6644 struct a
6646         int i;
6647         int j;
6649 a thinga[]={{0,0}, {1,1}};
6650 b thingb[]={{0,0}, {1,1}};
6651 size_t i = sizeof(sal_n_array_size(thinga));
6652 size_t j = sizeof(sal_n_array_size(thingb));
6653 return !(i != 0 && j != 0);
6655     ], [ AC_MSG_RESULT(yes) ],
6656     [ AC_MSG_ERROR(no)])
6657 AC_LANG_POP([C++])
6658 CXXFLAGS=$save_CXXFLAGS
6660 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6661 if test "$GCC" = yes; then
6662     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6663     AC_LANG_PUSH([C++])
6664     save_CXXFLAGS=$CXXFLAGS
6665     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6666     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6667     CXXFLAGS=$save_CXXFLAGS
6668     AC_LANG_POP([C++])
6669     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6670         AC_MSG_RESULT([yes])
6671     else
6672         AC_MSG_RESULT([no])
6673     fi
6675 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6677 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6678 AC_LANG_PUSH([C++])
6679 save_CXXFLAGS=$CXXFLAGS
6680 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6681 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6682         #include <algorithm>
6683         #include <initializer_list>
6684         #include <vector>
6685         template<typename T> class S {
6686         private:
6687             std::vector<T> v_;
6688         public:
6689             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6690         };
6691         constinit S<int> s{3, 2, 1};
6692     ])], [
6693         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6694         AC_MSG_RESULT([yes])
6695     ], [AC_MSG_RESULT([no])])
6696 CXXFLAGS=$save_CXXFLAGS
6697 AC_LANG_POP([C++])
6699 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6700 AC_LANG_PUSH([C++])
6701 save_CXXFLAGS=$CXXFLAGS
6702 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6703 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6704         #include <span>
6705         #include <type_traits>
6706         // Don't check size_type directly, as it was called index_type before P1872R0:
6707         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6708     ])], [
6709         AC_DEFINE([HAVE_CPP_SPAN],[1])
6710         AC_MSG_RESULT([yes])
6711     ], [AC_MSG_RESULT([no])])
6712 CXXFLAGS=$save_CXXFLAGS
6713 AC_LANG_POP([C++])
6715 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
6716 AC_LANG_PUSH([C++])
6717 save_CXXFLAGS=$CXXFLAGS
6718 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6719 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6720         struct S1 { S1(S1 &&); };
6721         struct S2: S1 {};
6722         S1 f(S2 s) { return s; }
6723     ])], [
6724         AC_DEFINE([HAVE_P1155R3],[1])
6725         AC_MSG_RESULT([yes])
6726     ], [AC_MSG_RESULT([no])])
6727 CXXFLAGS=$save_CXXFLAGS
6728 AC_LANG_POP([C++])
6730 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
6731 dnl which is included in -Wextra anyway):
6732 HAVE_WDEPRECATED_COPY_DTOR=
6733 if test "$GCC" = yes; then
6734     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
6735     AC_LANG_PUSH([C++])
6736     save_CXXFLAGS=$CXXFLAGS
6737     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
6738     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
6739             HAVE_WDEPRECATED_COPY_DTOR=TRUE
6740             AC_MSG_RESULT([yes])
6741         ], [AC_MSG_RESULT([no])])
6742     CXXFLAGS=$save_CXXFLAGS
6743     AC_LANG_POP([C++])
6745 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
6747 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6748 dnl uninitialized warning for code like
6750 dnl   OString f();
6751 dnl   boost::optional<OString> * g(bool b) {
6752 dnl       boost::optional<OString> o;
6753 dnl       if (b) o = f();
6754 dnl       return new boost::optional<OString>(o);
6755 dnl   }
6757 dnl (as is e.g. present, in a slightly more elaborate form, in
6758 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6759 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6760 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6761 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6762     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6763     AC_LANG_PUSH([C++])
6764     save_CXXFLAGS=$CXXFLAGS
6765     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6766     if test "$ENABLE_OPTIMIZED" = TRUE; then
6767         CXXFLAGS="$CXXFLAGS -O2"
6768     else
6769         CXXFLAGS="$CXXFLAGS -O0"
6770     fi
6771     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6772             #include <new>
6773             void f1(int);
6774             struct S1 {
6775                 ~S1() { f1(n); }
6776                 int n = 0;
6777             };
6778             struct S2 {
6779                 S2() {}
6780                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6781                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6782                 void set(S1 s) {
6783                     new (stg) S1(s);
6784                     init = true;
6785                 }
6786                 bool init = false;
6787                 char stg[sizeof (S1)];
6788             } ;
6789             S1 f2();
6790             S2 * f3(bool b) {
6791                 S2 o;
6792                 if (b) o.set(f2());
6793                 return new S2(o);
6794             }
6795         ]])], [AC_MSG_RESULT([no])], [
6796             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6797             AC_MSG_RESULT([yes])
6798         ])
6799     CXXFLAGS=$save_CXXFLAGS
6800     AC_LANG_POP([C++])
6802 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6804 dnl ===================================================================
6805 dnl CPU Intrinsics support - SSE, AVX
6806 dnl ===================================================================
6808 CXXFLAGS_INTRINSICS_SSE2=
6809 CXXFLAGS_INTRINSICS_SSSE3=
6810 CXXFLAGS_INTRINSICS_SSE41=
6811 CXXFLAGS_INTRINSICS_SSE42=
6812 CXXFLAGS_INTRINSICS_AVX=
6813 CXXFLAGS_INTRINSICS_AVX2=
6814 CXXFLAGS_INTRINSICS_F16C=
6815 CXXFLAGS_INTRINSICS_FMA=
6817 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6818     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
6819     flag_sse2=-msse2
6820     flag_ssse3=-mssse3
6821     flag_sse41=-msse4.1
6822     flag_sse42=-msse4.2
6823     flag_avx=-mavx
6824     flag_avx2=-mavx2
6825     flag_f16c=-mf16c
6826     flag_fma=-mfma
6827 else
6828     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
6829     # MSVC seems to differentiate only between SSE and SSE2, where in fact
6830     # SSE2 seems to be SSE2+.
6831     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
6832     # is not empty (and can be tested in gbuild).
6833     flag_sse2=-arch:SSE2
6834     flag_ssse3=-arch:SSE2
6835     flag_sse41=-arch:SSE2
6836     flag_sse42=-arch:SSE2
6837     flag_avx=-arch:AVX
6838     flag_avx2=-arch:AVX2
6839     # These are part of -arch:AVX2
6840     flag_f16c=-arch:AVX2
6841     flag_fma=-arch:AVX2
6844 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6845 AC_LANG_PUSH([C++])
6846 save_CXXFLAGS=$CXXFLAGS
6847 CXXFLAGS="$CXXFLAGS $flag_sse2"
6848 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6849     #include <emmintrin.h>
6850     int main () {
6851         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6852         c = _mm_xor_si128 (a, b);
6853         return 0;
6854     }
6855     ])],
6856     [can_compile_sse2=yes],
6857     [can_compile_sse2=no])
6858 AC_LANG_POP([C++])
6859 CXXFLAGS=$save_CXXFLAGS
6860 AC_MSG_RESULT([${can_compile_sse2}])
6861 if test "${can_compile_sse2}" = "yes" ; then
6862     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
6865 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6866 AC_LANG_PUSH([C++])
6867 save_CXXFLAGS=$CXXFLAGS
6868 CXXFLAGS="$CXXFLAGS $flag_ssse3"
6869 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6870     #include <tmmintrin.h>
6871     int main () {
6872         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6873         c = _mm_maddubs_epi16 (a, b);
6874         return 0;
6875     }
6876     ])],
6877     [can_compile_ssse3=yes],
6878     [can_compile_ssse3=no])
6879 AC_LANG_POP([C++])
6880 CXXFLAGS=$save_CXXFLAGS
6881 AC_MSG_RESULT([${can_compile_ssse3}])
6882 if test "${can_compile_ssse3}" = "yes" ; then
6883     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
6886 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
6887 AC_LANG_PUSH([C++])
6888 save_CXXFLAGS=$CXXFLAGS
6889 CXXFLAGS="$CXXFLAGS $flag_sse41"
6890 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6891     #include <smmintrin.h>
6892     int main () {
6893         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6894         c = _mm_cmpeq_epi64 (a, b);
6895         return 0;
6896     }
6897     ])],
6898     [can_compile_sse41=yes],
6899     [can_compile_sse41=no])
6900 AC_LANG_POP([C++])
6901 CXXFLAGS=$save_CXXFLAGS
6902 AC_MSG_RESULT([${can_compile_sse41}])
6903 if test "${can_compile_sse41}" = "yes" ; then
6904     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
6907 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
6908 AC_LANG_PUSH([C++])
6909 save_CXXFLAGS=$CXXFLAGS
6910 CXXFLAGS="$CXXFLAGS $flag_sse42"
6911 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6912     #include <nmmintrin.h>
6913     int main () {
6914         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6915         c = _mm_cmpgt_epi64 (a, b);
6916         return 0;
6917     }
6918     ])],
6919     [can_compile_sse42=yes],
6920     [can_compile_sse42=no])
6921 AC_LANG_POP([C++])
6922 CXXFLAGS=$save_CXXFLAGS
6923 AC_MSG_RESULT([${can_compile_sse42}])
6924 if test "${can_compile_sse42}" = "yes" ; then
6925     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
6928 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6929 AC_LANG_PUSH([C++])
6930 save_CXXFLAGS=$CXXFLAGS
6931 CXXFLAGS="$CXXFLAGS $flag_avx"
6932 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6933     #include <immintrin.h>
6934     int main () {
6935         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6936         c = _mm256_xor_ps(a, b);
6937         return 0;
6938     }
6939     ])],
6940     [can_compile_avx=yes],
6941     [can_compile_avx=no])
6942 AC_LANG_POP([C++])
6943 CXXFLAGS=$save_CXXFLAGS
6944 AC_MSG_RESULT([${can_compile_avx}])
6945 if test "${can_compile_avx}" = "yes" ; then
6946     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
6949 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6950 AC_LANG_PUSH([C++])
6951 save_CXXFLAGS=$CXXFLAGS
6952 CXXFLAGS="$CXXFLAGS $flag_avx2"
6953 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6954     #include <immintrin.h>
6955     int main () {
6956         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6957         c = _mm256_maddubs_epi16(a, b);
6958         return 0;
6959     }
6960     ])],
6961     [can_compile_avx2=yes],
6962     [can_compile_avx2=no])
6963 AC_LANG_POP([C++])
6964 CXXFLAGS=$save_CXXFLAGS
6965 AC_MSG_RESULT([${can_compile_avx2}])
6966 if test "${can_compile_avx2}" = "yes" ; then
6967     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
6970 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
6971 AC_LANG_PUSH([C++])
6972 save_CXXFLAGS=$CXXFLAGS
6973 CXXFLAGS="$CXXFLAGS $flag_f16c"
6974 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6975     #include <immintrin.h>
6976     int main () {
6977         __m128i a = _mm_set1_epi32 (0);
6978         __m128 c;
6979         c = _mm_cvtph_ps(a);
6980         return 0;
6981     }
6982     ])],
6983     [can_compile_f16c=yes],
6984     [can_compile_f16c=no])
6985 AC_LANG_POP([C++])
6986 CXXFLAGS=$save_CXXFLAGS
6987 AC_MSG_RESULT([${can_compile_f16c}])
6988 if test "${can_compile_f16c}" = "yes" ; then
6989     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
6992 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
6993 AC_LANG_PUSH([C++])
6994 save_CXXFLAGS=$CXXFLAGS
6995 CXXFLAGS="$CXXFLAGS $flag_fma"
6996 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6997     #include <immintrin.h>
6998     int main () {
6999         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7000         d = _mm256_fmadd_ps(a, b, c);
7001         return 0;
7002     }
7003     ])],
7004     [can_compile_fma=yes],
7005     [can_compile_fma=no])
7006 AC_LANG_POP([C++])
7007 CXXFLAGS=$save_CXXFLAGS
7008 AC_MSG_RESULT([${can_compile_fma}])
7009 if test "${can_compile_fma}" = "yes" ; then
7010     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7013 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7014 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7015 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7016 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7017 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7018 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7019 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7020 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7022 dnl ===================================================================
7023 dnl system stl sanity tests
7024 dnl ===================================================================
7025 if test "$_os" != "WINNT"; then
7027     AC_LANG_PUSH([C++])
7029     save_CPPFLAGS="$CPPFLAGS"
7030     if test -n "$MACOSX_SDK_PATH"; then
7031         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7032     fi
7034     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7035     # only.
7036     if test "$CPP_LIBRARY" = GLIBCXX; then
7037         dnl gcc#19664, gcc#22482, rhbz#162935
7038         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7039         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7040         AC_MSG_RESULT([$stlvisok])
7041         if test "$stlvisok" = "no"; then
7042             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7043         fi
7044     fi
7046     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7047     # when we don't make any dynamic libraries?
7048     if test "$DISABLE_DYNLOADING" = ""; then
7049         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7050         cat > conftestlib1.cc <<_ACEOF
7051 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7052 struct S2: S1<int> { virtual ~S2(); };
7053 S2::~S2() {}
7054 _ACEOF
7055         cat > conftestlib2.cc <<_ACEOF
7056 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7057 struct S2: S1<int> { virtual ~S2(); };
7058 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7059 _ACEOF
7060         gccvisinlineshiddenok=yes
7061         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7062             gccvisinlineshiddenok=no
7063         else
7064             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7065             dnl known to not work with -z defs (unsetting which makes the test
7066             dnl moot, though):
7067             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7068             if test "$COM_IS_CLANG" = TRUE; then
7069                 for i in $CXX $CXXFLAGS; do
7070                     case $i in
7071                     -fsanitize=*)
7072                         my_linkflagsnoundefs=
7073                         break
7074                         ;;
7075                     esac
7076                 done
7077             fi
7078             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7079                 gccvisinlineshiddenok=no
7080             fi
7081         fi
7083         rm -fr libconftest*
7084         AC_MSG_RESULT([$gccvisinlineshiddenok])
7085         if test "$gccvisinlineshiddenok" = "no"; then
7086             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7087         fi
7088     fi
7090    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7091     cat >visibility.cxx <<_ACEOF
7092 #pragma GCC visibility push(hidden)
7093 struct __attribute__ ((visibility ("default"))) TestStruct {
7094   static void Init();
7096 __attribute__ ((visibility ("default"))) void TestFunc() {
7097   TestStruct::Init();
7099 _ACEOF
7100     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7101         gccvisbroken=yes
7102     else
7103         case "$host_cpu" in
7104         i?86|x86_64)
7105             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7106                 gccvisbroken=no
7107             else
7108                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7109                     gccvisbroken=no
7110                 else
7111                     gccvisbroken=yes
7112                 fi
7113             fi
7114             ;;
7115         *)
7116             gccvisbroken=no
7117             ;;
7118         esac
7119     fi
7120     rm -f visibility.s visibility.cxx
7122     AC_MSG_RESULT([$gccvisbroken])
7123     if test "$gccvisbroken" = "yes"; then
7124         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7125     fi
7127     CPPFLAGS="$save_CPPFLAGS"
7129     AC_LANG_POP([C++])
7132 dnl ===================================================================
7133 dnl  Clang++ tests
7134 dnl ===================================================================
7136 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7137 if test "$GCC" = "yes"; then
7138     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7139     AC_LANG_PUSH([C++])
7140     save_CXXFLAGS=$CXXFLAGS
7141     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7142     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7143     CXXFLAGS=$save_CXXFLAGS
7144     AC_LANG_POP([C++])
7145     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7146         AC_MSG_RESULT([yes])
7147     else
7148         AC_MSG_RESULT([no])
7149     fi
7151 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7153 dnl ===================================================================
7154 dnl Compiler plugins
7155 dnl ===================================================================
7157 COMPILER_PLUGINS=
7158 # currently only Clang
7160 if test "$COM_IS_CLANG" != "TRUE"; then
7161     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7162         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7163         enable_compiler_plugins=no
7164     fi
7167 COMPILER_PLUGINS_COM_IS_CLANG=
7168 if test "$COM_IS_CLANG" = "TRUE"; then
7169     if test -n "$enable_compiler_plugins"; then
7170         compiler_plugins="$enable_compiler_plugins"
7171     elif test -n "$ENABLE_DBGUTIL"; then
7172         compiler_plugins=test
7173     else
7174         compiler_plugins=no
7175     fi
7176     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7177         if test "$CLANGVER" -lt 50002; then
7178             if test "$compiler_plugins" = yes; then
7179                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7180             else
7181                 compiler_plugins=no
7182             fi
7183         fi
7184     fi
7185     if test "$compiler_plugins" != "no"; then
7186         dnl The prefix where Clang resides, override to where Clang resides if
7187         dnl using a source build:
7188         if test -z "$CLANGDIR"; then
7189             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | head -n 1)))))
7190         fi
7191         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7192         if test -z "$COMPILER_PLUGINS_CXX"; then
7193             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7194         fi
7195         clangbindir=$CLANGDIR/bin
7196         if test "$build_os" = "cygwin"; then
7197             clangbindir=$(cygpath -u "$clangbindir")
7198         fi
7199         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7200         if test -n "$LLVM_CONFIG"; then
7201             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7202             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7203             if test -z "$CLANGLIBDIR"; then
7204                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7205             fi
7206             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7207             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7208             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7209             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7210                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7211             fi
7212             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7213             clangobjdir=$($LLVM_CONFIG --obj-root)
7214             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7215                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7216             fi
7217         fi
7218         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7219         AC_LANG_PUSH([C++])
7220         save_CXX=$CXX
7221         save_CXXCPP=$CXXCPP
7222         save_CPPFLAGS=$CPPFLAGS
7223         save_CXXFLAGS=$CXXFLAGS
7224         save_LDFLAGS=$LDFLAGS
7225         save_LIBS=$LIBS
7226         CXX=$COMPILER_PLUGINS_CXX
7227         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7228         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7229         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7230         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7231             [COMPILER_PLUGINS=TRUE],
7232             [
7233             if test "$compiler_plugins" = "yes"; then
7234                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7235             else
7236                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7237                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7238             fi
7239             ])
7240         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7241         dnl comment in compilerplugins/Makefile-clang.mk:
7242         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7243             LDFLAGS=""
7244             AC_MSG_CHECKING([for clang libraries to use])
7245             if test -z "$CLANGTOOLLIBS"; then
7246                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7247  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7248                 AC_LINK_IFELSE([
7249                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7250                         [[ clang::FullSourceLoc().dump(); ]])
7251                 ],[CLANGTOOLLIBS="$LIBS"],[])
7252             fi
7253             if test -z "$CLANGTOOLLIBS"; then
7254                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7255                 AC_LINK_IFELSE([
7256                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7257                         [[ clang::FullSourceLoc().dump(); ]])
7258                 ],[CLANGTOOLLIBS="$LIBS"],[])
7259             fi
7260             AC_MSG_RESULT([$CLANGTOOLLIBS])
7261             if test -z "$CLANGTOOLLIBS"; then
7262                 if test "$compiler_plugins" = "yes"; then
7263                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7264                 else
7265                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7266                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7267                 fi
7268                 COMPILER_PLUGINS=
7269             fi
7270             if test -n "$COMPILER_PLUGINS"; then
7271                 if test -z "$CLANGSYSINCLUDE"; then
7272                     if test -n "$LLVM_CONFIG"; then
7273                         # Path to the clang system headers (no idea if there's a better way to get it).
7274                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7275                     fi
7276                 fi
7277             fi
7278         fi
7279         CXX=$save_CXX
7280         CXXCPP=$save_CXXCPP
7281         CPPFLAGS=$save_CPPFLAGS
7282         CXXFLAGS=$save_CXXFLAGS
7283         LDFLAGS=$save_LDFLAGS
7284         LIBS="$save_LIBS"
7285         AC_LANG_POP([C++])
7287         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7288         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7289             #ifndef __clang__
7290             you lose
7291             #endif
7292             int foo=42;
7293             ]])],
7294             [AC_MSG_RESULT([yes])
7295              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7296             [AC_MSG_RESULT([no])])
7297         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7298     fi
7299 else
7300     if test "$enable_compiler_plugins" = "yes"; then
7301         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7302     fi
7304 COMPILER_PLUGINS_ANALYZER_PCH=
7305 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7306     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7308 AC_SUBST(COMPILER_PLUGINS)
7309 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7310 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7311 AC_SUBST(COMPILER_PLUGINS_CXX)
7312 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7313 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7314 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7315 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7316 AC_SUBST(CLANGDIR)
7317 AC_SUBST(CLANGLIBDIR)
7318 AC_SUBST(CLANGTOOLLIBS)
7319 AC_SUBST(CLANGSYSINCLUDE)
7321 # Plugin to help linker.
7322 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7323 # This makes --enable-lto build with clang work.
7324 AC_SUBST(LD_PLUGIN)
7326 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7327 AC_SUBST(HAVE_POSIX_FALLOCATE)
7329 dnl ===================================================================
7330 dnl Custom build version
7331 dnl ===================================================================
7333 AC_MSG_CHECKING([whether to add custom build version])
7334 if test "$with_build_version" != ""; then
7335     BUILD_VER_STRING=$with_build_version
7336     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7337 else
7338     BUILD_VER_STRING=
7339     AC_MSG_RESULT([no])
7341 AC_SUBST(BUILD_VER_STRING)
7343 JITC_PROCESSOR_TYPE=""
7344 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7345     # IBMs JDK needs this...
7346     JITC_PROCESSOR_TYPE=6
7347     export JITC_PROCESSOR_TYPE
7349 AC_SUBST([JITC_PROCESSOR_TYPE])
7351 # Misc Windows Stuff
7352 AC_ARG_WITH(ucrt-dir,
7353     AS_HELP_STRING([--with-ucrt-dir],
7354         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7355         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7356         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7357             Windows6.1-KB2999226-x64.msu
7358             Windows6.1-KB2999226-x86.msu
7359             Windows8.1-KB2999226-x64.msu
7360             Windows8.1-KB2999226-x86.msu
7361             Windows8-RT-KB2999226-x64.msu
7362             Windows8-RT-KB2999226-x86.msu
7363         A zip archive including those files is available from Microsoft site:
7364         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7366 UCRT_REDISTDIR="$with_ucrt_dir"
7367 if test $_os = "WINNT"; then
7368     find_msvc_x64_dlls
7369     find_msms
7370     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7371     MSVC_DLLS="$msvcdlls"
7372     MSM_PATH=`win_short_path_for_make "$msmdir"`
7373     # MSVC 15.3 changed it to VC141
7374     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
7375         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
7376     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7377         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7378     else
7379         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7380     fi
7382     if test "$UCRT_REDISTDIR" = "no"; then
7383         dnl explicitly disabled
7384         UCRT_REDISTDIR=""
7385     else
7386         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7387                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7388                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7389                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7390                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7391                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7392             UCRT_REDISTDIR=""
7393             if test -n "$PKGFORMAT"; then
7394                for i in $PKGFORMAT; do
7395                    case "$i" in
7396                    msi)
7397                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7398                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7399                        ;;
7400                    esac
7401                done
7402             fi
7403         fi
7404     fi
7407 AC_SUBST(UCRT_REDISTDIR)
7408 AC_SUBST(MSVC_DLL_PATH)
7409 AC_SUBST(MSVC_DLLS)
7410 AC_SUBST(MSM_PATH)
7412 dnl ===================================================================
7413 dnl Checks for Java
7414 dnl ===================================================================
7415 if test "$ENABLE_JAVA" != ""; then
7417     # Windows-specific tests
7418     if test "$build_os" = "cygwin"; then
7419         if test "$BITNESS_OVERRIDE" = 64; then
7420             bitness=64
7421         else
7422             bitness=32
7423         fi
7425         if test -z "$with_jdk_home"; then
7426             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7427             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7428             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7429             if test -n "$regvalue"; then
7430                 ver=$regvalue
7431                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7432                 _jdk_home=$regvalue
7433             fi
7435             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7436                 with_jdk_home="$_jdk_home"
7437                 howfound="found automatically"
7438             else
7439                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK >= 9])
7440             fi
7441         else
7442             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7443             howfound="you passed"
7444         fi
7445     fi
7447     # 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.
7448     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7449     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7450         with_jdk_home=`/usr/libexec/java_home`
7451     fi
7453     JAVA_HOME=; export JAVA_HOME
7454     if test -z "$with_jdk_home"; then
7455         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7456     else
7457         _java_path="$with_jdk_home/bin/$with_java"
7458         dnl Check if there is a Java interpreter at all.
7459         if test -x "$_java_path"; then
7460             JAVAINTERPRETER=$_java_path
7461         else
7462             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7463         fi
7464     fi
7466     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7467     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7468     dnl loaded by java to run JunitTests:
7469     if test "$build_os" = "cygwin"; then
7470         shortjdkhome=`cygpath -d "$with_jdk_home"`
7471         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
7472             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7473             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7474         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
7475             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7476             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7477         fi
7479         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7480             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7481         fi
7482         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7483     elif test "$cross_compiling" != "yes"; then
7484         case $CPUNAME in
7485             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7486                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7487                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7488                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7489                 fi
7490                 ;;
7491             *) # assumption: everything else 32-bit
7492                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7493                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7494                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7495                 fi
7496                 ;;
7497         esac
7498     fi
7501 dnl ===================================================================
7502 dnl Checks for JDK.
7503 dnl ===================================================================
7505 # Note that JAVA_HOME as for now always means the *build* platform's
7506 # JAVA_HOME. Whether all the complexity here actually is needed any
7507 # more or not, no idea.
7509 if test "$ENABLE_JAVA" != ""; then
7510     _gij_longver=0
7511     AC_MSG_CHECKING([the installed JDK])
7512     if test -n "$JAVAINTERPRETER"; then
7513         dnl java -version sends output to stderr!
7514         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7515             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7516         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7517             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7518         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7519             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7520         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7521             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7522         else
7523             JDK=sun
7525             dnl Sun JDK specific tests
7526             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7527             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7529             if test "$_jdk_ver" -lt 10900; then
7530                 AC_MSG_ERROR([JDK is too old, you need at least 9])
7531             fi
7532             if test "$_jdk_ver" -gt 10900; then
7533                 JAVA_CLASSPATH_NOT_SET=TRUE
7534             fi
7536             AC_MSG_RESULT([found (JDK $_jdk)])
7537             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7538             if test "$_os" = "WINNT"; then
7539                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7540             fi
7542             # set to limit VM usage for JunitTests
7543             JAVAIFLAGS=-Xmx64M
7544             # set to limit VM usage for javac
7545             JAVAFLAGS=-J-Xmx128M
7546         fi
7547     else
7548         AC_MSG_ERROR([Java not found. You need at least JDK 9])
7549     fi
7550 else
7551     dnl Java disabled
7552     JAVA_HOME=
7553     export JAVA_HOME
7556 dnl ===================================================================
7557 dnl Checks for javac
7558 dnl ===================================================================
7559 if test "$ENABLE_JAVA" != ""; then
7560     javacompiler="javac"
7561     : ${JAVA_SOURCE_VER=8}
7562     : ${JAVA_TARGET_VER=8}
7563     if test -z "$with_jdk_home"; then
7564         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7565     else
7566         _javac_path="$with_jdk_home/bin/$javacompiler"
7567         dnl Check if there is a Java compiler at all.
7568         if test -x "$_javac_path"; then
7569             JAVACOMPILER=$_javac_path
7570         fi
7571     fi
7572     if test -z "$JAVACOMPILER"; then
7573         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7574     fi
7575     if test "$build_os" = "cygwin"; then
7576         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7577             JAVACOMPILER="${JAVACOMPILER}.exe"
7578         fi
7579         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7580     fi
7583 dnl ===================================================================
7584 dnl Checks for javadoc
7585 dnl ===================================================================
7586 if test "$ENABLE_JAVA" != ""; then
7587     if test -z "$with_jdk_home"; then
7588         AC_PATH_PROG(JAVADOC, javadoc)
7589     else
7590         _javadoc_path="$with_jdk_home/bin/javadoc"
7591         dnl Check if there is a javadoc at all.
7592         if test -x "$_javadoc_path"; then
7593             JAVADOC=$_javadoc_path
7594         else
7595             AC_PATH_PROG(JAVADOC, javadoc)
7596         fi
7597     fi
7598     if test -z "$JAVADOC"; then
7599         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7600     fi
7601     if test "$build_os" = "cygwin"; then
7602         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7603             JAVADOC="${JAVADOC}.exe"
7604         fi
7605         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7606     fi
7608     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7609     JAVADOCISGJDOC="yes"
7610     fi
7612 AC_SUBST(JAVADOCISGJDOC)
7614 if test "$ENABLE_JAVA" != ""; then
7615     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7616     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7617         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7618            # try to recover first by looking whether we have an alternative
7619            # system as in Debian or newer SuSEs where following /usr/bin/javac
7620            # over /etc/alternatives/javac leads to the right bindir where we
7621            # just need to strip a bit away to get a valid JAVA_HOME
7622            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7623         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7624             # maybe only one level of symlink (e.g. on Mac)
7625             JAVA_HOME=$(readlink $JAVACOMPILER)
7626             if test "$(dirname $JAVA_HOME)" = "."; then
7627                 # we've got no path to trim back
7628                 JAVA_HOME=""
7629             fi
7630         else
7631             # else warn
7632             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7633             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7634             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7635             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7636         fi
7637         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7638         if test "$JAVA_HOME" != "/usr"; then
7639             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7640                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7641                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7642                 dnl Tiger already returns a JDK path...
7643                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7644             else
7645                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7646                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7647                 dnl that checks which version to run
7648                 if test -f "$JAVA_HOME"; then
7649                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7650                 fi
7651             fi
7652         fi
7653     fi
7654     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7656     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7657     if test -z "$JAVA_HOME"; then
7658         if test "x$with_jdk_home" = "x"; then
7659             cat > findhome.java <<_ACEOF
7660 [import java.io.File;
7662 class findhome
7664     public static void main(String args[])
7665     {
7666         String jrelocation = System.getProperty("java.home");
7667         File jre = new File(jrelocation);
7668         System.out.println(jre.getParent());
7669     }
7671 _ACEOF
7672             AC_MSG_CHECKING([if javac works])
7673             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7674             AC_TRY_EVAL(javac_cmd)
7675             if test $? = 0 -a -f ./findhome.class; then
7676                 AC_MSG_RESULT([javac works])
7677             else
7678                 echo "configure: javac test failed" >&5
7679                 cat findhome.java >&5
7680                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7681             fi
7682             AC_MSG_CHECKING([if gij knows its java.home])
7683             JAVA_HOME=`$JAVAINTERPRETER findhome`
7684             if test $? = 0 -a "$JAVA_HOME" != ""; then
7685                 AC_MSG_RESULT([$JAVA_HOME])
7686             else
7687                 echo "configure: java test failed" >&5
7688                 cat findhome.java >&5
7689                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7690             fi
7691             # clean-up after ourselves
7692             rm -f ./findhome.java ./findhome.class
7693         else
7694             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7695         fi
7696     fi
7698     # now check if $JAVA_HOME is really valid
7699     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7700         case "${JAVA_HOME}" in
7701             /Library/Java/JavaVirtualMachines/*)
7702                 ;;
7703             *)
7704                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7705                 ;;
7706         esac
7707         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7708             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7709             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7710             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7711             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7712             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7713             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7714         fi
7715     fi
7716     PathFormat "$JAVA_HOME"
7717     JAVA_HOME="$formatted_path"
7720 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7721     "$_os" != Darwin
7722 then
7723     AC_MSG_CHECKING([for JAWT lib])
7724     if test "$_os" = WINNT; then
7725         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7726         JAWTLIB=jawt.lib
7727     else
7728         case "$host_cpu" in
7729         arm*)
7730             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7731             JAVA_ARCH=$my_java_arch
7732             ;;
7733         i*86)
7734             my_java_arch=i386
7735             ;;
7736         m68k)
7737             my_java_arch=m68k
7738             ;;
7739         powerpc)
7740             my_java_arch=ppc
7741             ;;
7742         powerpc64)
7743             my_java_arch=ppc64
7744             ;;
7745         powerpc64le)
7746             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7747             JAVA_ARCH=$my_java_arch
7748             ;;
7749         sparc64)
7750             my_java_arch=sparcv9
7751             ;;
7752         x86_64)
7753             my_java_arch=amd64
7754             ;;
7755         *)
7756             my_java_arch=$host_cpu
7757             ;;
7758         esac
7759         # This is where JDK9 puts the library
7760         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7761             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7762         else
7763             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7764         fi
7765         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7766     fi
7767     AC_MSG_RESULT([$JAWTLIB])
7769 AC_SUBST(JAWTLIB)
7771 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7772     case "$host_os" in
7774     aix*)
7775         JAVAINC="-I$JAVA_HOME/include"
7776         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7777         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7778         ;;
7780     cygwin*)
7781         JAVAINC="-I$JAVA_HOME/include/win32"
7782         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7783         ;;
7785     darwin*)
7786         if test -d "$JAVA_HOME/include/darwin"; then
7787             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7788         else
7789             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7790         fi
7791         ;;
7793     dragonfly*)
7794         JAVAINC="-I$JAVA_HOME/include"
7795         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7796         ;;
7798     freebsd*)
7799         JAVAINC="-I$JAVA_HOME/include"
7800         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7801         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7802         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7803         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7804         ;;
7806     k*bsd*-gnu*)
7807         JAVAINC="-I$JAVA_HOME/include"
7808         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7809         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7810         ;;
7812     linux-gnu*)
7813         JAVAINC="-I$JAVA_HOME/include"
7814         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7815         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7816         ;;
7818     *netbsd*)
7819         JAVAINC="-I$JAVA_HOME/include"
7820         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7821         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7822        ;;
7824     openbsd*)
7825         JAVAINC="-I$JAVA_HOME/include"
7826         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7827         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7828         ;;
7830     solaris*)
7831         JAVAINC="-I$JAVA_HOME/include"
7832         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7833         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7834         ;;
7835     esac
7837 SOLARINC="$SOLARINC $JAVAINC"
7839 AC_SUBST(JAVACOMPILER)
7840 AC_SUBST(JAVADOC)
7841 AC_SUBST(JAVAINTERPRETER)
7842 AC_SUBST(JAVAIFLAGS)
7843 AC_SUBST(JAVAFLAGS)
7844 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7845 AC_SUBST(JAVA_HOME)
7846 AC_SUBST(JAVA_SOURCE_VER)
7847 AC_SUBST(JAVA_TARGET_VER)
7848 AC_SUBST(JDK)
7851 dnl ===================================================================
7852 dnl Export file validation
7853 dnl ===================================================================
7854 AC_MSG_CHECKING([whether to enable export file validation])
7855 if test "$with_export_validation" != "no"; then
7856     if test -z "$ENABLE_JAVA"; then
7857         if test "$with_export_validation" = "yes"; then
7858             AC_MSG_ERROR([requested, but Java is disabled])
7859         else
7860             AC_MSG_RESULT([no, as Java is disabled])
7861         fi
7862     elif ! test -d "${SRC_ROOT}/schema"; then
7863         if test "$with_export_validation" = "yes"; then
7864             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7865         else
7866             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7867         fi
7868     else
7869         AC_MSG_RESULT([yes])
7870         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7872         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7873         if test -z "$ODFVALIDATOR"; then
7874             # remember to download the ODF toolkit with validator later
7875             AC_MSG_NOTICE([no odfvalidator found, will download it])
7876             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7877             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7879             # and fetch name of odfvalidator jar name from download.lst
7880             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7881             AC_SUBST(ODFVALIDATOR_JAR)
7883             if test -z "$ODFVALIDATOR_JAR"; then
7884                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7885             fi
7886         fi
7887         if test "$build_os" = "cygwin"; then
7888             # In case of Cygwin it will be executed from Windows,
7889             # so we need to run bash and absolute path to validator
7890             # so instead of "odfvalidator" it will be
7891             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7892             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7893         else
7894             ODFVALIDATOR="sh $ODFVALIDATOR"
7895         fi
7896         AC_SUBST(ODFVALIDATOR)
7899         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7900         if test -z "$OFFICEOTRON"; then
7901             # remember to download the officeotron with validator later
7902             AC_MSG_NOTICE([no officeotron found, will download it])
7903             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7904             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7906             # and fetch name of officeotron jar name from download.lst
7907             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7908             AC_SUBST(OFFICEOTRON_JAR)
7910             if test -z "$OFFICEOTRON_JAR"; then
7911                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7912             fi
7913         else
7914             # check version of existing officeotron
7915             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7916             if test 0"$OFFICEOTRON_VER" -lt 704; then
7917                 AC_MSG_ERROR([officeotron too old])
7918             fi
7919         fi
7920         if test "$build_os" = "cygwin"; then
7921             # In case of Cygwin it will be executed from Windows,
7922             # so we need to run bash and absolute path to validator
7923             # so instead of "odfvalidator" it will be
7924             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7925             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7926         else
7927             OFFICEOTRON="sh $OFFICEOTRON"
7928         fi
7929     fi
7930     AC_SUBST(OFFICEOTRON)
7931 else
7932     AC_MSG_RESULT([no])
7935 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7936 if test "$with_bffvalidator" != "no"; then
7937     AC_DEFINE(HAVE_BFFVALIDATOR)
7939     if test "$with_export_validation" = "no"; then
7940         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7941     fi
7943     if test "$with_bffvalidator" = "yes"; then
7944         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7945     else
7946         BFFVALIDATOR="$with_bffvalidator"
7947     fi
7949     if test "$build_os" = "cygwin"; then
7950         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7951             AC_MSG_RESULT($BFFVALIDATOR)
7952         else
7953             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7954         fi
7955     elif test -n "$BFFVALIDATOR"; then
7956         # We are not in Cygwin but need to run Windows binary with wine
7957         AC_PATH_PROGS(WINE, wine)
7959         # so swap in a shell wrapper that converts paths transparently
7960         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7961         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7962         AC_SUBST(BFFVALIDATOR_EXE)
7963         AC_MSG_RESULT($BFFVALIDATOR)
7964     else
7965         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7966     fi
7967     AC_SUBST(BFFVALIDATOR)
7968 else
7969     AC_MSG_RESULT([no])
7972 dnl ===================================================================
7973 dnl Check for C preprocessor to use
7974 dnl ===================================================================
7975 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7976 if test -n "$with_idlc_cpp"; then
7977     AC_MSG_RESULT([$with_idlc_cpp])
7978     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7979 else
7980     AC_MSG_RESULT([ucpp])
7981     AC_MSG_CHECKING([which ucpp tp use])
7982     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7983         AC_MSG_RESULT([external])
7984         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7985     else
7986         AC_MSG_RESULT([internal])
7987         BUILD_TYPE="$BUILD_TYPE UCPP"
7988     fi
7990 AC_SUBST(SYSTEM_UCPP)
7992 dnl ===================================================================
7993 dnl Check for epm (not needed for Windows)
7994 dnl ===================================================================
7995 AC_MSG_CHECKING([whether to enable EPM for packing])
7996 if test "$enable_epm" = "yes"; then
7997     AC_MSG_RESULT([yes])
7998     if test "$_os" != "WINNT"; then
7999         if test $_os = Darwin; then
8000             EPM=internal
8001         elif test -n "$with_epm"; then
8002             EPM=$with_epm
8003         else
8004             AC_PATH_PROG(EPM, epm, no)
8005         fi
8006         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8007             AC_MSG_NOTICE([EPM will be built.])
8008             BUILD_TYPE="$BUILD_TYPE EPM"
8009             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8010         else
8011             # Gentoo has some epm which is something different...
8012             AC_MSG_CHECKING([whether the found epm is the right epm])
8013             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8014                 AC_MSG_RESULT([yes])
8015             else
8016                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8017             fi
8018             AC_MSG_CHECKING([epm version])
8019             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8020             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8021                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8022                 AC_MSG_RESULT([OK, >= 3.7])
8023             else
8024                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8025                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8026             fi
8027         fi
8028     fi
8030     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8031         AC_MSG_CHECKING([for rpm])
8032         for a in "$RPM" rpmbuild rpm; do
8033             $a --usage >/dev/null 2> /dev/null
8034             if test $? -eq 0; then
8035                 RPM=$a
8036                 break
8037             else
8038                 $a --version >/dev/null 2> /dev/null
8039                 if test $? -eq 0; then
8040                     RPM=$a
8041                     break
8042                 fi
8043             fi
8044         done
8045         if test -z "$RPM"; then
8046             AC_MSG_ERROR([not found])
8047         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8048             RPM_PATH=`which $RPM`
8049             AC_MSG_RESULT([$RPM_PATH])
8050             SCPDEFS="$SCPDEFS -DWITH_RPM"
8051         else
8052             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8053         fi
8054     fi
8055     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8056         AC_PATH_PROG(DPKG, dpkg, no)
8057         if test "$DPKG" = "no"; then
8058             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8059         fi
8060     fi
8061     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8062        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8063         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8064             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8065                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8066                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8067                     AC_MSG_RESULT([yes])
8068                 else
8069                     AC_MSG_RESULT([no])
8070                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8071                         _pt="rpm"
8072                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8073                         add_warning "the rpms will need to be installed with --nodeps"
8074                     else
8075                         _pt="pkg"
8076                     fi
8077                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8078                     add_warning "the ${_pt}s will not be relocatable"
8079                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8080                                  relocation will work, you need to patch your epm with the
8081                                  patch in epm/epm-3.7.patch or build with
8082                                  --with-epm=internal which will build a suitable epm])
8083                 fi
8084             fi
8085         fi
8086     fi
8087     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8088         AC_PATH_PROG(PKGMK, pkgmk, no)
8089         if test "$PKGMK" = "no"; then
8090             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8091         fi
8092     fi
8093     AC_SUBST(RPM)
8094     AC_SUBST(DPKG)
8095     AC_SUBST(PKGMK)
8096 else
8097     for i in $PKGFORMAT; do
8098         case "$i" in
8099         aix | bsd | deb | pkg | rpm | native | portable)
8100             AC_MSG_ERROR(
8101                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8102             ;;
8103         esac
8104     done
8105     AC_MSG_RESULT([no])
8106     EPM=NO
8108 AC_SUBST(EPM)
8110 ENABLE_LWP=
8111 if test "$enable_lotuswordpro" = "yes"; then
8112     ENABLE_LWP="TRUE"
8114 AC_SUBST(ENABLE_LWP)
8116 dnl ===================================================================
8117 dnl Check for building ODK
8118 dnl ===================================================================
8119 if test "$enable_odk" = no; then
8120     unset DOXYGEN
8121 else
8122     if test "$with_doxygen" = no; then
8123         AC_MSG_CHECKING([for doxygen])
8124         unset DOXYGEN
8125         AC_MSG_RESULT([no])
8126     else
8127         if test "$with_doxygen" = yes; then
8128             AC_PATH_PROG([DOXYGEN], [doxygen])
8129             if test -z "$DOXYGEN"; then
8130                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8131             fi
8132             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8133                 if ! dot -V 2>/dev/null; then
8134                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8135                 fi
8136             fi
8137         else
8138             AC_MSG_CHECKING([for doxygen])
8139             DOXYGEN=$with_doxygen
8140             AC_MSG_RESULT([$DOXYGEN])
8141         fi
8142         if test -n "$DOXYGEN"; then
8143             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8144             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8145             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8146                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8147             fi
8148         fi
8149     fi
8151 AC_SUBST([DOXYGEN])
8153 AC_MSG_CHECKING([whether to build the ODK])
8154 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8155     AC_MSG_RESULT([yes])
8157     if test "$with_java" != "no"; then
8158         AC_MSG_CHECKING([whether to build unowinreg.dll])
8159         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8160             # build on Win by default
8161             enable_build_unowinreg=yes
8162         fi
8163         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8164             AC_MSG_RESULT([no])
8165             BUILD_UNOWINREG=
8166         else
8167             AC_MSG_RESULT([yes])
8168             BUILD_UNOWINREG=TRUE
8169         fi
8170         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8171             if test -z "$with_mingw_cross_compiler"; then
8172                 dnl Guess...
8173                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8174             elif test -x "$with_mingw_cross_compiler"; then
8175                  MINGWCXX="$with_mingw_cross_compiler"
8176             else
8177                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8178             fi
8180             if test "$MINGWCXX" = "false"; then
8181                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8182             fi
8184             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8185             if test -x "$mingwstrip_test"; then
8186                 MINGWSTRIP="$mingwstrip_test"
8187             else
8188                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8189             fi
8191             if test "$MINGWSTRIP" = "false"; then
8192                 AC_MSG_ERROR(MinGW32 binutils not found.)
8193             fi
8194         fi
8195     fi
8196     BUILD_TYPE="$BUILD_TYPE ODK"
8197 else
8198     AC_MSG_RESULT([no])
8199     BUILD_UNOWINREG=
8201 AC_SUBST(BUILD_UNOWINREG)
8202 AC_SUBST(MINGWCXX)
8203 AC_SUBST(MINGWSTRIP)
8205 dnl ===================================================================
8206 dnl Check for system zlib
8207 dnl ===================================================================
8208 if test "$with_system_zlib" = "auto"; then
8209     case "$_os" in
8210     WINNT)
8211         with_system_zlib="$with_system_libs"
8212         ;;
8213     *)
8214         if test "$enable_fuzzers" != "yes"; then
8215             with_system_zlib=yes
8216         else
8217             with_system_zlib=no
8218         fi
8219         ;;
8220     esac
8223 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8224 dnl and has no pkg-config for it at least on some tinderboxes,
8225 dnl so leaving that out for now
8226 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8227 AC_MSG_CHECKING([which zlib to use])
8228 if test "$with_system_zlib" = "yes"; then
8229     AC_MSG_RESULT([external])
8230     SYSTEM_ZLIB=TRUE
8231     AC_CHECK_HEADER(zlib.h, [],
8232         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8233     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8234         [AC_MSG_ERROR(zlib not found or functional)], [])
8235 else
8236     AC_MSG_RESULT([internal])
8237     SYSTEM_ZLIB=
8238     BUILD_TYPE="$BUILD_TYPE ZLIB"
8239     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8240     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8242 AC_SUBST(ZLIB_CFLAGS)
8243 AC_SUBST(ZLIB_LIBS)
8244 AC_SUBST(SYSTEM_ZLIB)
8246 dnl ===================================================================
8247 dnl Check for system jpeg
8248 dnl ===================================================================
8249 AC_MSG_CHECKING([which libjpeg to use])
8250 if test "$with_system_jpeg" = "yes"; then
8251     AC_MSG_RESULT([external])
8252     SYSTEM_LIBJPEG=TRUE
8253     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8254         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8255     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8256         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8257 else
8258     SYSTEM_LIBJPEG=
8259     AC_MSG_RESULT([internal, libjpeg-turbo])
8260     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8261     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8262     if test "$COM" = "MSC"; then
8263         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8264     else
8265         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8266     fi
8268     case "$host_cpu" in
8269     x86_64 | amd64 | i*86 | x86 | ia32)
8270         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8271         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8272             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8273                 NASM="$LODE_HOME/opt/bin/nasm"
8274             elif test -x "/opt/lo/bin/nasm"; then
8275                 NASM="/opt/lo/bin/nasm"
8276             fi
8277         fi
8279         if test -n "$NASM"; then
8280             AC_MSG_CHECKING([for object file format of host system])
8281             case "$host_os" in
8282               cygwin* | mingw* | pw32* | interix*)
8283                 case "$host_cpu" in
8284                   x86_64)
8285                     objfmt='Win64-COFF'
8286                     ;;
8287                   *)
8288                     objfmt='Win32-COFF'
8289                     ;;
8290                 esac
8291               ;;
8292               msdosdjgpp* | go32*)
8293                 objfmt='COFF'
8294               ;;
8295               os2-emx*) # not tested
8296                 objfmt='MSOMF' # obj
8297               ;;
8298               linux*coff* | linux*oldld*)
8299                 objfmt='COFF' # ???
8300               ;;
8301               linux*aout*)
8302                 objfmt='a.out'
8303               ;;
8304               linux*)
8305                 case "$host_cpu" in
8306                   x86_64)
8307                     objfmt='ELF64'
8308                     ;;
8309                   *)
8310                     objfmt='ELF'
8311                     ;;
8312                 esac
8313               ;;
8314               kfreebsd* | freebsd* | netbsd* | openbsd*)
8315                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8316                   objfmt='BSD-a.out'
8317                 else
8318                   case "$host_cpu" in
8319                     x86_64 | amd64)
8320                       objfmt='ELF64'
8321                       ;;
8322                     *)
8323                       objfmt='ELF'
8324                       ;;
8325                   esac
8326                 fi
8327               ;;
8328               solaris* | sunos* | sysv* | sco*)
8329                 case "$host_cpu" in
8330                   x86_64)
8331                     objfmt='ELF64'
8332                     ;;
8333                   *)
8334                     objfmt='ELF'
8335                     ;;
8336                 esac
8337               ;;
8338               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8339                 case "$host_cpu" in
8340                   x86_64)
8341                     objfmt='Mach-O64'
8342                     ;;
8343                   *)
8344                     objfmt='Mach-O'
8345                     ;;
8346                 esac
8347               ;;
8348               *)
8349                 objfmt='ELF ?'
8350               ;;
8351             esac
8353             AC_MSG_RESULT([$objfmt])
8354             if test "$objfmt" = 'ELF ?'; then
8355               objfmt='ELF'
8356               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8357             fi
8359             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8360             case "$objfmt" in
8361               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8362               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8363               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8364               COFF)       NAFLAGS='-fcoff -DCOFF';;
8365               a.out)      NAFLAGS='-faout -DAOUT';;
8366               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8367               ELF)        NAFLAGS='-felf -DELF';;
8368               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8369               RDF)        NAFLAGS='-frdf -DRDF';;
8370               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8371               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8372             esac
8373             AC_MSG_RESULT([$NAFLAGS])
8375             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8376             cat > conftest.asm << EOF
8377             [%line __oline__ "configure"
8378                     section .text
8379                     global  _main,main
8380             _main:
8381             main:   xor     eax,eax
8382                     ret
8383             ]
8385             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8386             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8387               AC_MSG_RESULT(yes)
8388             else
8389               echo "configure: failed program was:" >&AC_FD_CC
8390               cat conftest.asm >&AC_FD_CC
8391               rm -rf conftest*
8392               AC_MSG_RESULT(no)
8393               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8394               NASM=""
8395             fi
8397         fi
8399         if test -z "$NASM"; then
8400 cat << _EOS
8401 ****************************************************************************
8402 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8403 To get one please:
8405 _EOS
8406             if test "$build_os" = "cygwin"; then
8407 cat << _EOS
8408 install a pre-compiled binary for Win32
8410 mkdir -p /opt/lo/bin
8411 cd /opt/lo/bin
8412 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8413 chmod +x nasm
8415 or get and install one from http://www.nasm.us/
8417 Then re-run autogen.sh
8419 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8420 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8422 _EOS
8423             else
8424 cat << _EOS
8425 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8427 _EOS
8428             fi
8429             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8430             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8431         fi
8432       ;;
8433     esac
8436 AC_SUBST(NASM)
8437 AC_SUBST(LIBJPEG_CFLAGS)
8438 AC_SUBST(LIBJPEG_LIBS)
8439 AC_SUBST(SYSTEM_LIBJPEG)
8441 dnl ===================================================================
8442 dnl Check for system clucene
8443 dnl ===================================================================
8444 dnl we should rather be using
8445 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8446 dnl but the contribs-lib check seems tricky
8447 AC_MSG_CHECKING([which clucene to use])
8448 if test "$with_system_clucene" = "yes"; then
8449     AC_MSG_RESULT([external])
8450     SYSTEM_CLUCENE=TRUE
8451     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8452     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8453     FilterLibs "${CLUCENE_LIBS}"
8454     CLUCENE_LIBS="${filteredlibs}"
8455     AC_LANG_PUSH([C++])
8456     save_CXXFLAGS=$CXXFLAGS
8457     save_CPPFLAGS=$CPPFLAGS
8458     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8459     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8460     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8461     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8462     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8463                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8464     CXXFLAGS=$save_CXXFLAGS
8465     CPPFLAGS=$save_CPPFLAGS
8466     AC_LANG_POP([C++])
8468     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8469 else
8470     AC_MSG_RESULT([internal])
8471     SYSTEM_CLUCENE=
8472     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8474 AC_SUBST(SYSTEM_CLUCENE)
8475 AC_SUBST(CLUCENE_CFLAGS)
8476 AC_SUBST(CLUCENE_LIBS)
8478 dnl ===================================================================
8479 dnl Check for system expat
8480 dnl ===================================================================
8481 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8483 dnl ===================================================================
8484 dnl Check for system xmlsec
8485 dnl ===================================================================
8486 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8488 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8489 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8490     ENABLE_EOT="TRUE"
8491     AC_DEFINE([ENABLE_EOT])
8492     AC_MSG_RESULT([yes])
8494     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8495 else
8496     ENABLE_EOT=
8497     AC_MSG_RESULT([no])
8499 AC_SUBST([ENABLE_EOT])
8501 dnl ===================================================================
8502 dnl Check for DLP libs
8503 dnl ===================================================================
8504 AS_IF([test "$COM" = "MSC"],
8505       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8506       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8508 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8510 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8512 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8514 AS_IF([test "$COM" = "MSC"],
8515       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8516       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8518 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8520 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8522 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8523 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.11])
8525 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8527 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8529 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8531 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8532 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.16])
8534 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8535 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8537 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8539 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8540 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8542 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8544 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8546 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8548 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8550 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8551 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
8553 dnl ===================================================================
8554 dnl Check for system lcms2
8555 dnl ===================================================================
8556 if test "$with_system_lcms2" != "yes"; then
8557     SYSTEM_LCMS2=
8559 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8560 if test "$GCC" = "yes"; then
8561     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8563 if test "$COM" = "MSC"; then # override the above
8564     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8567 dnl ===================================================================
8568 dnl Check for system cppunit
8569 dnl ===================================================================
8570 if test "$_os" != "Android" ; then
8571     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8574 dnl ===================================================================
8575 dnl Check whether freetype is available
8576 dnl ===================================================================
8577 if test  "$test_freetype" = "yes"; then
8578     AC_MSG_CHECKING([whether freetype is available])
8579     # FreeType has 3 different kinds of versions
8580     # * release, like 2.4.10
8581     # * libtool, like 13.0.7 (this what pkg-config returns)
8582     # * soname
8583     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8584     #
8585     # 9.9.3 is 2.2.0
8586     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8587     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8588     FilterLibs "${FREETYPE_LIBS}"
8589     FREETYPE_LIBS="${filteredlibs}"
8590     SYSTEM_FREETYPE=TRUE
8591 else
8592     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8593     if test "x$ac_config_site_64bit_host" = xYES; then
8594         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8595     else
8596         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8597     fi
8599 AC_SUBST(FREETYPE_CFLAGS)
8600 AC_SUBST(FREETYPE_LIBS)
8601 AC_SUBST([SYSTEM_FREETYPE])
8603 # ===================================================================
8604 # Check for system libxslt
8605 # to prevent incompatibilities between internal libxml2 and external libxslt,
8606 # or vice versa, use with_system_libxml here
8607 # ===================================================================
8608 if test "$with_system_libxml" = "auto"; then
8609     case "$_os" in
8610     WINNT|iOS|Android)
8611         with_system_libxml="$with_system_libs"
8612         ;;
8613     *)
8614         if test "$enable_fuzzers" != "yes"; then
8615             with_system_libxml=yes
8616         else
8617             with_system_libxml=no
8618         fi
8619         ;;
8620     esac
8623 AC_MSG_CHECKING([which libxslt to use])
8624 if test "$with_system_libxml" = "yes"; then
8625     AC_MSG_RESULT([external])
8626     SYSTEM_LIBXSLT=TRUE
8627     if test "$_os" = "Darwin"; then
8628         dnl make sure to use SDK path
8629         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8630         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8631         dnl omit -L/usr/lib
8632         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8633         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8634     else
8635         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8636         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8637         FilterLibs "${LIBXSLT_LIBS}"
8638         LIBXSLT_LIBS="${filteredlibs}"
8639         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8640         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8641         FilterLibs "${LIBEXSLT_LIBS}"
8642         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8643     fi
8645     dnl Check for xsltproc
8646     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8647     if test "$XSLTPROC" = "no"; then
8648         AC_MSG_ERROR([xsltproc is required])
8649     fi
8650 else
8651     AC_MSG_RESULT([internal])
8652     SYSTEM_LIBXSLT=
8653     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8655     if test "$cross_compiling" = "yes"; then
8656         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8657         if test "$XSLTPROC" = "no"; then
8658             AC_MSG_ERROR([xsltproc is required])
8659         fi
8660     fi
8662 AC_SUBST(SYSTEM_LIBXSLT)
8663 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8664     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8666 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8668 AC_SUBST(LIBEXSLT_CFLAGS)
8669 AC_SUBST(LIBEXSLT_LIBS)
8670 AC_SUBST(LIBXSLT_CFLAGS)
8671 AC_SUBST(LIBXSLT_LIBS)
8672 AC_SUBST(XSLTPROC)
8674 # ===================================================================
8675 # Check for system libxml
8676 # ===================================================================
8677 AC_MSG_CHECKING([which libxml to use])
8678 if test "$with_system_libxml" = "yes"; then
8679     AC_MSG_RESULT([external])
8680     SYSTEM_LIBXML=TRUE
8681     if test "$_os" = "Darwin"; then
8682         dnl make sure to use SDK path
8683         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8684         dnl omit -L/usr/lib
8685         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8686     elif test $_os = iOS; then
8687         dnl make sure to use SDK path
8688         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8689         LIBXML_CFLAGS="-I$usr/include/libxml2"
8690         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8691     else
8692         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8693         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8694         FilterLibs "${LIBXML_LIBS}"
8695         LIBXML_LIBS="${filteredlibs}"
8696     fi
8698     dnl Check for xmllint
8699     AC_PATH_PROG(XMLLINT, xmllint, no)
8700     if test "$XMLLINT" = "no"; then
8701         AC_MSG_ERROR([xmllint is required])
8702     fi
8703 else
8704     AC_MSG_RESULT([internal])
8705     SYSTEM_LIBXML=
8706     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8707     if test "$COM" = "MSC"; then
8708         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8709     fi
8710     if test "$COM" = "MSC"; then
8711         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8712     else
8713         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8714     fi
8715     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8717 AC_SUBST(SYSTEM_LIBXML)
8718 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8719     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8721 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8722 AC_SUBST(LIBXML_CFLAGS)
8723 AC_SUBST(LIBXML_LIBS)
8724 AC_SUBST(XMLLINT)
8726 # =====================================================================
8727 # Checking for a Python interpreter with version >= 3.3.
8728 # Optionally user can pass an option to configure, i. e.
8729 # ./configure PYTHON=/usr/bin/python
8730 # =====================================================================
8731 if test $_os = Darwin -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
8732     # Only allowed choices for macOS are 'internal' (default) and 'fully-internal'
8733     enable_python=internal
8735 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8736     if test -n "$PYTHON"; then
8737         PYTHON_FOR_BUILD=$PYTHON
8738     else
8739         # This allows a lack of system python with no error, we use internal one in that case.
8740         AM_PATH_PYTHON([3.3],, [:])
8741         # Clean PYTHON_VERSION checked below if cross-compiling
8742         PYTHON_VERSION=""
8743         if test "$PYTHON" != ":"; then
8744             PYTHON_FOR_BUILD=$PYTHON
8745         fi
8746     fi
8748 AC_SUBST(PYTHON_FOR_BUILD)
8750 # Checks for Python to use for Pyuno
8751 AC_MSG_CHECKING([which Python to use for Pyuno])
8752 case "$enable_python" in
8753 no|disable)
8754     if test -z $PYTHON_FOR_BUILD; then
8755         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8756         # requirement from the choice whether to include Python stuff in the installer, but why
8757         # bother?
8758         AC_MSG_ERROR([Python is required at build time.])
8759     fi
8760     enable_python=no
8761     AC_MSG_RESULT([none])
8762     ;;
8763 ""|yes|auto)
8764     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8765         AC_MSG_RESULT([no, overridden by --disable-scripting])
8766         enable_python=no
8767     elif test $build_os = cygwin; then
8768         dnl When building on Windows we don't attempt to use any installed
8769         dnl "system"  Python.
8770         AC_MSG_RESULT([fully internal])
8771         enable_python=internal
8772     elif test "$cross_compiling" = yes; then
8773         AC_MSG_RESULT([system])
8774         enable_python=system
8775     else
8776         # Unset variables set by the above AM_PATH_PYTHON so that
8777         # we actually do check anew.
8778         AC_MSG_RESULT([])
8779         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
8780         AM_PATH_PYTHON([3.3],, [:])
8781         AC_MSG_CHECKING([which Python to use for Pyuno])
8782         if test "$PYTHON" = ":"; then
8783             if test -z "$PYTHON_FOR_BUILD"; then
8784                 AC_MSG_RESULT([fully internal])
8785             else
8786                 AC_MSG_RESULT([internal])
8787             fi
8788             enable_python=internal
8789         else
8790             AC_MSG_RESULT([system])
8791             enable_python=system
8792         fi
8793     fi
8794     ;;
8795 internal)
8796     AC_MSG_RESULT([internal])
8797     ;;
8798 fully-internal)
8799     AC_MSG_RESULT([fully internal])
8800     enable_python=internal
8801     ;;
8802 system)
8803     AC_MSG_RESULT([system])
8804     if test "$_os" = Darwin; then
8805         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
8806     fi
8807     ;;
8809     AC_MSG_ERROR([Incorrect --enable-python option])
8810     ;;
8811 esac
8813 if test $enable_python != no; then
8814     BUILD_TYPE="$BUILD_TYPE PYUNO"
8817 if test $enable_python = system; then
8818     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8819         # Fallback: Accept these in the environment, or as set above
8820         # for MacOSX.
8821         :
8822     elif test "$cross_compiling" != yes; then
8823         # Unset variables set by the above AM_PATH_PYTHON so that
8824         # we actually do check anew.
8825         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
8826         # This causes an error if no python command is found
8827         AM_PATH_PYTHON([3.3])
8828         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8829         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8830         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8831         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8832         if test -z "$PKG_CONFIG"; then
8833             PYTHON_CFLAGS="-I$python_include"
8834             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8835         elif $PKG_CONFIG --exists python-$python_version-embed; then
8836             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8837             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8838         elif $PKG_CONFIG --exists python-$python_version; then
8839             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8840             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8841         else
8842             PYTHON_CFLAGS="-I$python_include"
8843             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8844         fi
8845         FilterLibs "${PYTHON_LIBS}"
8846         PYTHON_LIBS="${filteredlibs}"
8847     else
8848         dnl How to find out the cross-compilation Python installation path?
8849         AC_MSG_CHECKING([for python version])
8850         AS_IF([test -n "$PYTHON_VERSION"],
8851               [AC_MSG_RESULT([$PYTHON_VERSION])],
8852               [AC_MSG_RESULT([not found])
8853                AC_MSG_ERROR([no usable python found])])
8854         test -n "$PYTHON_CFLAGS" && break
8855     fi
8857     dnl Check if the headers really work
8858     save_CPPFLAGS="$CPPFLAGS"
8859     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8860     AC_CHECK_HEADER(Python.h)
8861     CPPFLAGS="$save_CPPFLAGS"
8863     # let the PYTHON_FOR_BUILD match the same python installation that
8864     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8865     # better for PythonTests.
8866     PYTHON_FOR_BUILD=$PYTHON
8869 if test "$with_lxml" != no; then
8870     if test -z "$PYTHON_FOR_BUILD"; then
8871         case $build_os in
8872             cygwin)
8873                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8874                 ;;
8875             *)
8876                 if test "$cross_compiling" != yes ; then
8877                     BUILD_TYPE="$BUILD_TYPE LXML"
8878                 fi
8879                 ;;
8880         esac
8881     else
8882         AC_MSG_CHECKING([for python lxml])
8883         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8884             AC_MSG_RESULT([yes])
8885         else
8886             case $build_os in
8887                 cygwin)
8888                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8889                     ;;
8890                 *)
8891                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8892                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8893                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8894                         else
8895                             BUILD_TYPE="$BUILD_TYPE LXML"
8896                             AC_MSG_RESULT([no, using internal lxml])
8897                         fi
8898                     else
8899                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8900                     fi
8901                     ;;
8902             esac
8903         fi
8904     fi
8907 dnl By now enable_python should be "system", "internal" or "no"
8908 case $enable_python in
8909 system)
8910     SYSTEM_PYTHON=TRUE
8912     if test "x$ac_cv_header_Python_h" != "xyes"; then
8913        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8914     fi
8916     AC_LANG_PUSH(C)
8917     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8918     AC_MSG_CHECKING([for correct python library version])
8919        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8920 #include <Python.h>
8922 int main(int argc, char **argv) {
8923    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8924    else return 1;
8926        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
8927     CFLAGS=$save_CFLAGS
8928     AC_LANG_POP(C)
8930     dnl FIXME Check if the Python library can be linked with, too?
8931     ;;
8933 internal)
8934     SYSTEM_PYTHON=
8935     PYTHON_VERSION_MAJOR=3
8936     PYTHON_VERSION_MINOR=7
8937     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8938     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8939         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8940     fi
8941     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8942     BUILD_TYPE="$BUILD_TYPE PYTHON"
8943     if test "$OS" = LINUX; then
8944         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8945     fi
8946     # Embedded Python dies without Home set
8947     if test "$HOME" = ""; then
8948         export HOME=""
8949     fi
8950     ;;
8952     DISABLE_PYTHON=TRUE
8953     SYSTEM_PYTHON=
8954     ;;
8956     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8957     ;;
8958 esac
8960 AC_SUBST(DISABLE_PYTHON)
8961 AC_SUBST(SYSTEM_PYTHON)
8962 AC_SUBST(PYTHON_CFLAGS)
8963 AC_SUBST(PYTHON_LIBS)
8964 AC_SUBST(PYTHON_VERSION)
8965 AC_SUBST(PYTHON_VERSION_MAJOR)
8966 AC_SUBST(PYTHON_VERSION_MINOR)
8968 ENABLE_MARIADBC=TRUE
8969 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8970     ENABLE_MARIADBC=
8972 MARIADBC_MAJOR=1
8973 MARIADBC_MINOR=0
8974 MARIADBC_MICRO=2
8975 if test "$ENABLE_MARIADBC" = "TRUE"; then
8976     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8979 AC_SUBST(ENABLE_MARIADBC)
8980 AC_SUBST(MARIADBC_MAJOR)
8981 AC_SUBST(MARIADBC_MINOR)
8982 AC_SUBST(MARIADBC_MICRO)
8984 if test "$ENABLE_MARIADBC" = "TRUE"; then
8985     dnl ===================================================================
8986     dnl Check for system MariaDB
8987     dnl ===================================================================
8988     AC_MSG_CHECKING([which MariaDB to use])
8989     if test "$with_system_mariadb" = "yes"; then
8990         AC_MSG_RESULT([external])
8991         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8992         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8993         if test -z "$MARIADBCONFIG"; then
8994             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8995             if test -z "$MARIADBCONFIG"; then
8996                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8997                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8998             fi
8999         fi
9000         AC_MSG_CHECKING([MariaDB version])
9001         MARIADB_VERSION=`$MARIADBCONFIG --version`
9002         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9003         if test "$MARIADB_MAJOR" -ge "5"; then
9004             AC_MSG_RESULT([OK])
9005         else
9006             AC_MSG_ERROR([too old, use 5.0.x or later])
9007         fi
9008         AC_MSG_CHECKING([for MariaDB Client library])
9009         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9010         if test "$COM_IS_CLANG" = TRUE; then
9011             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9012         fi
9013         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9014         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9015         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9016         dnl linux32:
9017         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9018             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9019             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9020                 | sed -e 's|/lib64/|/lib/|')
9021         fi
9022         FilterLibs "${MARIADB_LIBS}"
9023         MARIADB_LIBS="${filteredlibs}"
9024         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9025         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9026         if test "$enable_bundle_mariadb" = "yes"; then
9027             AC_MSG_RESULT([yes])
9028             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9029             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9031 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9033 /g' | grep -E '(mysqlclient|mariadb)')
9034             if test "$_os" = "Darwin"; then
9035                 LIBMARIADB=${LIBMARIADB}.dylib
9036             elif test "$_os" = "WINNT"; then
9037                 LIBMARIADB=${LIBMARIADB}.dll
9038             else
9039                 LIBMARIADB=${LIBMARIADB}.so
9040             fi
9041             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9042             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9043             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9044                 AC_MSG_RESULT([found.])
9045                 PathFormat "$LIBMARIADB_PATH"
9046                 LIBMARIADB_PATH="$formatted_path"
9047             else
9048                 AC_MSG_ERROR([not found.])
9049             fi
9050         else
9051             AC_MSG_RESULT([no])
9052             BUNDLE_MARIADB_CONNECTOR_C=
9053         fi
9054     else
9055         AC_MSG_RESULT([internal])
9056         SYSTEM_MARIADB_CONNECTOR_C=
9057         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9058         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9059         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9060     fi
9062     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9063     AC_SUBST(MARIADB_CFLAGS)
9064     AC_SUBST(MARIADB_LIBS)
9065     AC_SUBST(LIBMARIADB)
9066     AC_SUBST(LIBMARIADB_PATH)
9067     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9070 dnl ===================================================================
9071 dnl Check for system hsqldb
9072 dnl ===================================================================
9073 if test "$with_java" != "no"; then
9074     HSQLDB_USE_JDBC_4_1=
9075     AC_MSG_CHECKING([which hsqldb to use])
9076     if test "$with_system_hsqldb" = "yes"; then
9077         AC_MSG_RESULT([external])
9078         SYSTEM_HSQLDB=TRUE
9079         if test -z $HSQLDB_JAR; then
9080             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9081         fi
9082         if ! test -f $HSQLDB_JAR; then
9083                AC_MSG_ERROR(hsqldb.jar not found.)
9084         fi
9085         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9086         export HSQLDB_JAR
9087         if $PERL -e \
9088            'use Archive::Zip;
9089             my $file = "$ENV{'HSQLDB_JAR'}";
9090             my $zip = Archive::Zip->new( $file );
9091             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9092             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9093             {
9094                 push @l, split(/\n/, $mf);
9095                 foreach my $line (@l)
9096                 {
9097                     if ($line =~ m/Specification-Version:/)
9098                     {
9099                         ($t, $version) = split (/:/,$line);
9100                         $version =~ s/^\s//;
9101                         ($a, $b, $c, $d) = split (/\./,$version);
9102                         if ($c == "0" && $d > "8")
9103                         {
9104                             exit 0;
9105                         }
9106                         else
9107                         {
9108                             exit 1;
9109                         }
9110                     }
9111                 }
9112             }
9113             else
9114             {
9115                 exit 1;
9116             }'; then
9117             AC_MSG_RESULT([yes])
9118         else
9119             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9120         fi
9121     else
9122         AC_MSG_RESULT([internal])
9123         SYSTEM_HSQLDB=
9124         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9125         NEED_ANT=TRUE
9126         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9127         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9128         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9129             AC_MSG_RESULT([yes])
9130             HSQLDB_USE_JDBC_4_1=TRUE
9131         else
9132             AC_MSG_RESULT([no])
9133         fi
9134     fi
9135     AC_SUBST(SYSTEM_HSQLDB)
9136     AC_SUBST(HSQLDB_JAR)
9137     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9140 dnl ===================================================================
9141 dnl Check for PostgreSQL stuff
9142 dnl ===================================================================
9143 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9144 if test "x$enable_postgresql_sdbc" != "xno"; then
9145     AC_MSG_RESULT([yes])
9146     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9148     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9149         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9150     fi
9151     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9152         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9153     fi
9155     postgres_interface=""
9156     if test "$with_system_postgresql" = "yes"; then
9157         postgres_interface="external PostgreSQL"
9158         SYSTEM_POSTGRESQL=TRUE
9159         if test "$_os" = Darwin; then
9160             supp_path=''
9161             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9162                 pg_supp_path="$P_SEP$d$pg_supp_path"
9163             done
9164         fi
9165         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9166         if test -n "$PGCONFIG"; then
9167             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9168             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9169         else
9170             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9171               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9172               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9173             ],[
9174               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9175             ])
9176         fi
9177         FilterLibs "${POSTGRESQL_LIB}"
9178         POSTGRESQL_LIB="${filteredlibs}"
9179     else
9180         # if/when anything else than PostgreSQL uses Kerberos,
9181         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9182         WITH_KRB5=
9183         WITH_GSSAPI=
9184         case "$_os" in
9185         Darwin)
9186             # macOS has system MIT Kerberos 5 since 10.4
9187             if test "$with_krb5" != "no"; then
9188                 WITH_KRB5=TRUE
9189                 save_LIBS=$LIBS
9190                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9191                 # that the libraries where these functions are located on macOS will change, is it?
9192                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9193                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9194                 KRB5_LIBS=$LIBS
9195                 LIBS=$save_LIBS
9196                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9197                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9198                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9199                 LIBS=$save_LIBS
9200             fi
9201             if test "$with_gssapi" != "no"; then
9202                 WITH_GSSAPI=TRUE
9203                 save_LIBS=$LIBS
9204                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9205                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9206                 GSSAPI_LIBS=$LIBS
9207                 LIBS=$save_LIBS
9208             fi
9209             ;;
9210         WINNT)
9211             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9212                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9213             fi
9214             ;;
9215         Linux|GNU|*BSD|DragonFly)
9216             if test "$with_krb5" != "no"; then
9217                 WITH_KRB5=TRUE
9218                 save_LIBS=$LIBS
9219                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9220                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9221                 KRB5_LIBS=$LIBS
9222                 LIBS=$save_LIBS
9223                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9224                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9225                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9226                 LIBS=$save_LIBS
9227             fi
9228             if test "$with_gssapi" != "no"; then
9229                 WITH_GSSAPI=TRUE
9230                 save_LIBS=$LIBS
9231                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9232                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9233                 GSSAPI_LIBS=$LIBS
9234                 LIBS=$save_LIBS
9235             fi
9236             ;;
9237         *)
9238             if test "$with_krb5" = "yes"; then
9239                 WITH_KRB5=TRUE
9240                 save_LIBS=$LIBS
9241                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9242                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9243                 KRB5_LIBS=$LIBS
9244                 LIBS=$save_LIBS
9245                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9246                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9247                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9248                 LIBS=$save_LIBS
9249             fi
9250             if test "$with_gssapi" = "yes"; then
9251                 WITH_GSSAPI=TRUE
9252                 save_LIBS=$LIBS
9253                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9254                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9255                 LIBS=$save_LIBS
9256                 GSSAPI_LIBS=$LIBS
9257             fi
9258         esac
9260         if test -n "$with_libpq_path"; then
9261             SYSTEM_POSTGRESQL=TRUE
9262             postgres_interface="external libpq"
9263             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9264             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9265         else
9266             SYSTEM_POSTGRESQL=
9267             postgres_interface="internal"
9268             POSTGRESQL_LIB=""
9269             POSTGRESQL_INC="%OVERRIDE_ME%"
9270             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9271         fi
9272     fi
9274     AC_MSG_CHECKING([PostgreSQL C interface])
9275     AC_MSG_RESULT([$postgres_interface])
9277     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9278         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9279         save_CFLAGS=$CFLAGS
9280         save_CPPFLAGS=$CPPFLAGS
9281         save_LIBS=$LIBS
9282         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9283         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9284         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9285         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9286             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9287         CFLAGS=$save_CFLAGS
9288         CPPFLAGS=$save_CPPFLAGS
9289         LIBS=$save_LIBS
9290     fi
9291     BUILD_POSTGRESQL_SDBC=TRUE
9292 else
9293     AC_MSG_RESULT([no])
9295 AC_SUBST(WITH_KRB5)
9296 AC_SUBST(WITH_GSSAPI)
9297 AC_SUBST(GSSAPI_LIBS)
9298 AC_SUBST(KRB5_LIBS)
9299 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9300 AC_SUBST(SYSTEM_POSTGRESQL)
9301 AC_SUBST(POSTGRESQL_INC)
9302 AC_SUBST(POSTGRESQL_LIB)
9304 dnl ===================================================================
9305 dnl Check for Firebird stuff
9306 dnl ===================================================================
9307 ENABLE_FIREBIRD_SDBC=
9308 if test "$enable_firebird_sdbc" = "yes" ; then
9309     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9311     dnl ===================================================================
9312     dnl Check for system Firebird
9313     dnl ===================================================================
9314     AC_MSG_CHECKING([which Firebird to use])
9315     if test "$with_system_firebird" = "yes"; then
9316         AC_MSG_RESULT([external])
9317         SYSTEM_FIREBIRD=TRUE
9318         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9319         if test -z "$FIREBIRDCONFIG"; then
9320             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9321             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9322                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9323             ])
9324             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9325         else
9326             AC_MSG_NOTICE([fb_config found])
9327             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9328             AC_MSG_CHECKING([for Firebird Client library])
9329             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9330             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9331             FilterLibs "${FIREBIRD_LIBS}"
9332             FIREBIRD_LIBS="${filteredlibs}"
9333         fi
9334         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9335         AC_MSG_CHECKING([Firebird version])
9336         if test -n "${FIREBIRD_VERSION}"; then
9337             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9338             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9339             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9340                 AC_MSG_RESULT([OK])
9341             else
9342                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9343             fi
9344         else
9345             __save_CFLAGS="${CFLAGS}"
9346             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9347             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9348 #if defined(FB_API_VER) && FB_API_VER == 30
9349 int fb_api_is_30(void) { return 0; }
9350 #else
9351 #error "Wrong Firebird API version"
9352 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9353             CFLAGS="${__save_CFLAGS}"
9354         fi
9355         ENABLE_FIREBIRD_SDBC=TRUE
9356         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9357     elif test "$enable_database_connectivity" != yes; then
9358         AC_MSG_RESULT([none])
9359     elif test "$cross_compiling" = "yes"; then
9360         AC_MSG_RESULT([none])
9361     else
9362         dnl Embedded Firebird has version 3.0
9363         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9364         dnl We need libatomic_ops for any non X86/X64 system
9365         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9366             dnl ===================================================================
9367             dnl Check for system libatomic_ops
9368             dnl ===================================================================
9369             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9370             if test "$with_system_libatomic_ops" = "yes"; then
9371                 SYSTEM_LIBATOMIC_OPS=TRUE
9372                 AC_CHECK_HEADERS(atomic_ops.h, [],
9373                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9374             else
9375                 SYSTEM_LIBATOMIC_OPS=
9376                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9377                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9378                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9379             fi
9380         fi
9382         AC_MSG_RESULT([internal])
9383         SYSTEM_FIREBIRD=
9384         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9385         FIREBIRD_LIBS="-lfbclient"
9387         if test "$with_system_libtommath" = "yes"; then
9388             SYSTEM_LIBTOMMATH=TRUE
9389             dnl check for tommath presence
9390             save_LIBS=$LIBS
9391             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9392             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9393             LIBS=$save_LIBS
9394         else
9395             SYSTEM_LIBTOMMATH=
9396             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9397             LIBTOMMATH_LIBS="-ltommath"
9398             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9399         fi
9401         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9402         ENABLE_FIREBIRD_SDBC=TRUE
9403         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9404     fi
9406 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9407 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9408 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9409 AC_SUBST(LIBATOMIC_OPS_LIBS)
9410 AC_SUBST(SYSTEM_FIREBIRD)
9411 AC_SUBST(FIREBIRD_CFLAGS)
9412 AC_SUBST(FIREBIRD_LIBS)
9413 AC_SUBST([TOMMATH_CFLAGS])
9414 AC_SUBST([TOMMATH_LIBS])
9416 dnl ===================================================================
9417 dnl Check for system curl
9418 dnl ===================================================================
9419 AC_MSG_CHECKING([which libcurl to use])
9420 if test "$with_system_curl" = "auto"; then
9421     with_system_curl="$with_system_libs"
9424 if test "$with_system_curl" = "yes"; then
9425     AC_MSG_RESULT([external])
9426     SYSTEM_CURL=TRUE
9428     # First try PKGCONFIG and then fall back
9429     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9431     if test -n "$CURL_PKG_ERRORS"; then
9432         AC_PATH_PROG(CURLCONFIG, curl-config)
9433         if test -z "$CURLCONFIG"; then
9434             AC_MSG_ERROR([curl development files not found])
9435         fi
9436         CURL_LIBS=`$CURLCONFIG --libs`
9437         FilterLibs "${CURL_LIBS}"
9438         CURL_LIBS="${filteredlibs}"
9439         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9440         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9442         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9443         case $curl_version in
9444         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9445         dnl so they need to be doubled to end up in the configure script
9446         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9447             AC_MSG_RESULT([yes])
9448             ;;
9449         *)
9450             AC_MSG_ERROR([no, you have $curl_version])
9451             ;;
9452         esac
9453     fi
9455     ENABLE_CURL=TRUE
9456 elif test $_os = iOS; then
9457     # Let's see if we need curl, I think not?
9458     AC_MSG_RESULT([none])
9459     ENABLE_CURL=
9460 else
9461     AC_MSG_RESULT([internal])
9462     SYSTEM_CURL=
9463     BUILD_TYPE="$BUILD_TYPE CURL"
9464     ENABLE_CURL=TRUE
9466 AC_SUBST(SYSTEM_CURL)
9467 AC_SUBST(CURL_CFLAGS)
9468 AC_SUBST(CURL_LIBS)
9469 AC_SUBST(ENABLE_CURL)
9471 dnl ===================================================================
9472 dnl Check for system boost
9473 dnl ===================================================================
9474 AC_MSG_CHECKING([which boost to use])
9475 if test "$with_system_boost" = "yes"; then
9476     AC_MSG_RESULT([external])
9477     SYSTEM_BOOST=TRUE
9478     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
9479     AX_BOOST_DATE_TIME
9480     AX_BOOST_FILESYSTEM
9481     AX_BOOST_IOSTREAMS
9482     AX_BOOST_LOCALE
9483     AC_LANG_PUSH([C++])
9484     save_CXXFLAGS=$CXXFLAGS
9485     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9486     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9487        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9488     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9489        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9490     CXXFLAGS=$save_CXXFLAGS
9491     AC_LANG_POP([C++])
9492     # this is in m4/ax_boost_base.m4
9493     FilterLibs "${BOOST_LDFLAGS}"
9494     BOOST_LDFLAGS="${filteredlibs}"
9495 else
9496     AC_MSG_RESULT([internal])
9497     BUILD_TYPE="$BUILD_TYPE BOOST"
9498     SYSTEM_BOOST=
9499     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9500         # use warning-suppressing wrapper headers
9501         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9502     else
9503         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9504     fi
9506 AC_SUBST(SYSTEM_BOOST)
9508 dnl ===================================================================
9509 dnl Check for system mdds
9510 dnl ===================================================================
9511 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9513 dnl ===================================================================
9514 dnl Check for system glm
9515 dnl ===================================================================
9516 AC_MSG_CHECKING([which glm to use])
9517 if test "$with_system_glm" = "yes"; then
9518     AC_MSG_RESULT([external])
9519     SYSTEM_GLM=TRUE
9520     AC_LANG_PUSH([C++])
9521     AC_CHECK_HEADER([glm/glm.hpp], [],
9522        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9523     AC_LANG_POP([C++])
9524 else
9525     AC_MSG_RESULT([internal])
9526     BUILD_TYPE="$BUILD_TYPE GLM"
9527     SYSTEM_GLM=
9528     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9530 AC_SUBST([GLM_CFLAGS])
9531 AC_SUBST([SYSTEM_GLM])
9533 dnl ===================================================================
9534 dnl Check for system odbc
9535 dnl ===================================================================
9536 AC_MSG_CHECKING([which odbc headers to use])
9537 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
9538     AC_MSG_RESULT([external])
9539     SYSTEM_ODBC_HEADERS=TRUE
9541     if test "$build_os" = "cygwin"; then
9542         save_CPPFLAGS=$CPPFLAGS
9543         find_winsdk
9544         PathFormat "$winsdktest"
9545         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"
9546         AC_CHECK_HEADER(sqlext.h, [],
9547             [AC_MSG_ERROR(odbc not found. install odbc)],
9548             [#include <windows.h>])
9549         CPPFLAGS=$save_CPPFLAGS
9550     else
9551         AC_CHECK_HEADER(sqlext.h, [],
9552             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9553     fi
9554 elif test "$enable_database_connectivity" != yes; then
9555     AC_MSG_RESULT([none])
9556 else
9557     AC_MSG_RESULT([internal])
9558     SYSTEM_ODBC_HEADERS=
9560 AC_SUBST(SYSTEM_ODBC_HEADERS)
9562 dnl ===================================================================
9563 dnl Enable LDAP support
9564 dnl ===================================================================
9566 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9567 AC_MSG_CHECKING([whether to enable LDAP support])
9568     if test "$enable_ldap" != "yes"; then
9569         AC_MSG_RESULT([no])
9570         ENABLE_LDAP=""
9571         enable_ldap=no
9572     else
9573         AC_MSG_RESULT([yes])
9574         ENABLE_LDAP="TRUE"
9575     fi
9577 AC_SUBST(ENABLE_LDAP)
9579 dnl ===================================================================
9580 dnl Check for system openldap
9581 dnl ===================================================================
9583 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9584 AC_MSG_CHECKING([which openldap library to use])
9585 if test "$with_system_openldap" = "yes"; then
9586     AC_MSG_RESULT([external])
9587     SYSTEM_OPENLDAP=TRUE
9588     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9589     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9590     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9591 else
9592     AC_MSG_RESULT([internal])
9593     SYSTEM_OPENLDAP=
9594     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9597 AC_SUBST(SYSTEM_OPENLDAP)
9599 dnl ===================================================================
9600 dnl Check for system NSS
9601 dnl ===================================================================
9602 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9603     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9604     AC_DEFINE(HAVE_FEATURE_NSS)
9605     ENABLE_NSS="TRUE"
9606     AC_DEFINE(ENABLE_NSS)
9607 elif test $_os != iOS ; then
9608     with_tls=openssl
9610 AC_SUBST(ENABLE_NSS)
9612 dnl ===================================================================
9613 dnl Check for TLS/SSL and cryptographic implementation to use
9614 dnl ===================================================================
9615 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9616 if test -n "$with_tls"; then
9617     case $with_tls in
9618     openssl)
9619         AC_DEFINE(USE_TLS_OPENSSL)
9620         TLS=OPENSSL
9622         if test "$enable_openssl" != "yes"; then
9623             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9624         fi
9626         # warn that OpenSSL has been selected but not all TLS code has this option
9627         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9628         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9629         ;;
9630     nss)
9631         AC_DEFINE(USE_TLS_NSS)
9632         TLS=NSS
9633         ;;
9634     no)
9635         AC_MSG_WARN([Skipping TLS/SSL])
9636         ;;
9637     *)
9638         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9639 openssl - OpenSSL
9640 nss - Mozilla's Network Security Services (NSS)
9641     ])
9642         ;;
9643     esac
9644 else
9645     # default to using NSS, it results in smaller oox lib
9646     AC_DEFINE(USE_TLS_NSS)
9647     TLS=NSS
9649 AC_MSG_RESULT([$TLS])
9650 AC_SUBST(TLS)
9652 dnl ===================================================================
9653 dnl Check for system sane
9654 dnl ===================================================================
9655 AC_MSG_CHECKING([which sane header to use])
9656 if test "$with_system_sane" = "yes"; then
9657     AC_MSG_RESULT([external])
9658     AC_CHECK_HEADER(sane/sane.h, [],
9659       [AC_MSG_ERROR(sane not found. install sane)], [])
9660 else
9661     AC_MSG_RESULT([internal])
9662     BUILD_TYPE="$BUILD_TYPE SANE"
9665 dnl ===================================================================
9666 dnl Check for system icu
9667 dnl ===================================================================
9668 SYSTEM_GENBRK=
9669 SYSTEM_GENCCODE=
9670 SYSTEM_GENCMN=
9672 ICU_MAJOR=67
9673 ICU_MINOR=1
9674 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9675 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9676 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9677 AC_MSG_CHECKING([which icu to use])
9678 if test "$with_system_icu" = "yes"; then
9679     AC_MSG_RESULT([external])
9680     SYSTEM_ICU=TRUE
9681     AC_LANG_PUSH([C++])
9682     AC_MSG_CHECKING([for unicode/rbbi.h])
9683     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9684     AC_LANG_POP([C++])
9686     if test "$cross_compiling" != "yes"; then
9687         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9688         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9689         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9690         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9691     fi
9693     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9694         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9695         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9696         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9697         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9698         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9699             AC_MSG_RESULT([yes])
9700         else
9701             AC_MSG_RESULT([no])
9702             if test "$with_system_icu_for_build" != "force"; then
9703                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9704 You can use --with-system-icu-for-build=force to use it anyway.])
9705             fi
9706         fi
9707     fi
9709     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9710         # using the system icu tools can lead to version confusion, use the
9711         # ones from the build environment when cross-compiling
9712         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9713         if test -z "$SYSTEM_GENBRK"; then
9714             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9715         fi
9716         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9717         if test -z "$SYSTEM_GENCCODE"; then
9718             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9719         fi
9720         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9721         if test -z "$SYSTEM_GENCMN"; then
9722             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9723         fi
9724         if test "$ICU_MAJOR" -ge "49"; then
9725             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9726             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9727             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9728         else
9729             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9730             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9731             ICU_RECLASSIFIED_HEBREW_LETTER=
9732         fi
9733     fi
9735     if test "$cross_compiling" = "yes"; then
9736         if test "$ICU_MAJOR" -ge "50"; then
9737             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9738             ICU_MINOR=""
9739         fi
9740     fi
9741 else
9742     AC_MSG_RESULT([internal])
9743     SYSTEM_ICU=
9744     BUILD_TYPE="$BUILD_TYPE ICU"
9745     # surprisingly set these only for "internal" (to be used by various other
9746     # external libs): the system icu-config is quite unhelpful and spits out
9747     # dozens of weird flags and also default path -I/usr/include
9748     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9749     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9751 if test "$ICU_MAJOR" -ge "59"; then
9752     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9753     # with -std=c++11 but not all external libraries can be built with that,
9754     # for those use a bit-compatible typedef uint16_t UChar; see
9755     # icu/source/common/unicode/umachine.h
9756     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9757 else
9758     ICU_UCHAR_TYPE=""
9760 AC_SUBST(SYSTEM_ICU)
9761 AC_SUBST(SYSTEM_GENBRK)
9762 AC_SUBST(SYSTEM_GENCCODE)
9763 AC_SUBST(SYSTEM_GENCMN)
9764 AC_SUBST(ICU_MAJOR)
9765 AC_SUBST(ICU_MINOR)
9766 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9767 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9768 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9769 AC_SUBST(ICU_CFLAGS)
9770 AC_SUBST(ICU_LIBS)
9771 AC_SUBST(ICU_UCHAR_TYPE)
9773 dnl ==================================================================
9774 dnl Breakpad
9775 dnl ==================================================================
9776 DEFAULT_CRASHDUMP_VALUE="true"
9777 AC_MSG_CHECKING([whether to enable breakpad])
9778 if test "$enable_breakpad" != yes; then
9779     AC_MSG_RESULT([no])
9780 else
9781     AC_MSG_RESULT([yes])
9782     ENABLE_BREAKPAD="TRUE"
9783     AC_DEFINE(ENABLE_BREAKPAD)
9784     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9785     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9787     AC_MSG_CHECKING([for disable crash dump])
9788     if test "$enable_crashdump" = no; then
9789         DEFAULT_CRASHDUMP_VALUE="false"
9790         AC_MSG_RESULT([yes])
9791     else
9792        AC_MSG_RESULT([no])
9793     fi
9795     AC_MSG_CHECKING([for crashreport config])
9796     if test "$with_symbol_config" = "no"; then
9797         BREAKPAD_SYMBOL_CONFIG="invalid"
9798         AC_MSG_RESULT([no])
9799     else
9800         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9801         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9802         AC_MSG_RESULT([yes])
9803     fi
9804     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9806 AC_SUBST(ENABLE_BREAKPAD)
9807 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9809 dnl ==================================================================
9810 dnl libfuzzer
9811 dnl ==================================================================
9812 AC_MSG_CHECKING([whether to enable fuzzers])
9813 if test "$enable_fuzzers" != yes; then
9814     AC_MSG_RESULT([no])
9815 else
9816     AC_MSG_RESULT([yes])
9817     ENABLE_FUZZERS="TRUE"
9818     AC_DEFINE([ENABLE_FUZZERS],1)
9819     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9821 AC_SUBST(ENABLE_FUZZERS)
9823 dnl ===================================================================
9824 dnl Orcus
9825 dnl ===================================================================
9826 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9827 if test "$with_system_orcus" != "yes"; then
9828     if test "$SYSTEM_BOOST" = "TRUE"; then
9829         # ===========================================================
9830         # Determine if we are going to need to link with Boost.System
9831         # ===========================================================
9832         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9833         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9834         dnl in documentation has no effect.
9835         AC_MSG_CHECKING([if we need to link with Boost.System])
9836         AC_LANG_PUSH([C++])
9837         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9838                 @%:@include <boost/version.hpp>
9839             ]],[[
9840                 #if BOOST_VERSION >= 105000
9841                 #   error yes, we need to link with Boost.System
9842                 #endif
9843             ]])],[
9844                 AC_MSG_RESULT([no])
9845             ],[
9846                 AC_MSG_RESULT([yes])
9847                 AX_BOOST_SYSTEM
9848         ])
9849         AC_LANG_POP([C++])
9850     fi
9852 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9853 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9854 AC_SUBST([BOOST_SYSTEM_LIB])
9855 AC_SUBST(SYSTEM_LIBORCUS)
9857 dnl ===================================================================
9858 dnl HarfBuzz
9859 dnl ===================================================================
9860 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9861                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9862                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9864 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9865                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9866                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9868 if test "$COM" = "MSC"; then # override the above
9869     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9870     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9873 if test "$with_system_harfbuzz" = "yes"; then
9874     if test "$with_system_graphite" = "no"; then
9875         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9876     fi
9877     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9878     _save_libs="$LIBS"
9879     _save_cflags="$CFLAGS"
9880     LIBS="$LIBS $HARFBUZZ_LIBS"
9881     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9882     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9883     LIBS="$_save_libs"
9884     CFLAGS="$_save_cflags"
9885 else
9886     if test "$with_system_graphite" = "yes"; then
9887         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9888     fi
9891 AC_MSG_CHECKING([whether to use X11])
9892 dnl ***************************************
9893 dnl testing for X libraries and includes...
9894 dnl ***************************************
9895 if test "$USING_X11" = TRUE; then
9896     AC_DEFINE(HAVE_FEATURE_X11)
9898 AC_MSG_RESULT([$USING_X11])
9900 if test "$USING_X11" = TRUE; then
9901     AC_PATH_X
9902     AC_PATH_XTRA
9903     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9905     if test -z "$x_includes"; then
9906         x_includes="default_x_includes"
9907     fi
9908     if test -z "$x_libraries"; then
9909         x_libraries="default_x_libraries"
9910     fi
9911     CFLAGS="$CFLAGS $X_CFLAGS"
9912     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9913     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9914 else
9915     x_includes="no_x_includes"
9916     x_libraries="no_x_libraries"
9919 if test "$USING_X11" = TRUE; then
9920     dnl ===================================================================
9921     dnl Check for extension headers
9922     dnl ===================================================================
9923     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9924      [#include <X11/extensions/shape.h>])
9926     # vcl needs ICE and SM
9927     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9928     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9929         [AC_MSG_ERROR(ICE library not found)])
9930     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9931     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9932         [AC_MSG_ERROR(SM library not found)])
9935 dnl ===================================================================
9936 dnl Check for system Xrender
9937 dnl ===================================================================
9938 AC_MSG_CHECKING([whether to use Xrender])
9939 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9940     AC_MSG_RESULT([yes])
9941     PKG_CHECK_MODULES(XRENDER, xrender)
9942     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9943     FilterLibs "${XRENDER_LIBS}"
9944     XRENDER_LIBS="${filteredlibs}"
9945     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9946       [AC_MSG_ERROR(libXrender not found or functional)], [])
9947     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9948       [AC_MSG_ERROR(Xrender not found. install X)], [])
9949 else
9950     AC_MSG_RESULT([no])
9952 AC_SUBST(XRENDER_CFLAGS)
9953 AC_SUBST(XRENDER_LIBS)
9955 dnl ===================================================================
9956 dnl Check for XRandr
9957 dnl ===================================================================
9958 AC_MSG_CHECKING([whether to enable RandR support])
9959 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9960     AC_MSG_RESULT([yes])
9961     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9962     if test "$ENABLE_RANDR" != "TRUE"; then
9963         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9964                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9965         XRANDR_CFLAGS=" "
9966         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9967           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9968         XRANDR_LIBS="-lXrandr "
9969         ENABLE_RANDR="TRUE"
9970     fi
9971     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9972     FilterLibs "${XRANDR_LIBS}"
9973     XRANDR_LIBS="${filteredlibs}"
9974 else
9975     ENABLE_RANDR=""
9976     AC_MSG_RESULT([no])
9978 AC_SUBST(XRANDR_CFLAGS)
9979 AC_SUBST(XRANDR_LIBS)
9980 AC_SUBST(ENABLE_RANDR)
9982 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9983     WITH_WEBDAV="serf"
9985 if test $_os = iOS -o $_os = Android; then
9986     WITH_WEBDAV="no"
9988 AC_MSG_CHECKING([for webdav library])
9989 case "$WITH_WEBDAV" in
9990 serf)
9991     AC_MSG_RESULT([serf])
9992     # Check for system apr-util
9993     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9994                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9995                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9996     if test "$COM" = "MSC"; then
9997         APR_LIB_DIR="LibR"
9998         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9999         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10000     fi
10002     # Check for system serf
10003     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
10004                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
10005     if test "$COM" = "MSC"; then
10006         SERF_LIB_DIR="Release"
10007         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
10008         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
10009     fi
10010     ;;
10011 neon)
10012     AC_MSG_RESULT([neon])
10013     # Check for system neon
10014     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.1])
10015     if test "$with_system_neon" = "yes"; then
10016         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10017     else
10018         NEON_VERSION=0311
10019     fi
10020     AC_SUBST(NEON_VERSION)
10021     ;;
10023     AC_MSG_RESULT([none, disabled])
10024     WITH_WEBDAV=""
10025     ;;
10026 esac
10027 AC_SUBST(WITH_WEBDAV)
10029 dnl ===================================================================
10030 dnl Check for disabling cve_tests
10031 dnl ===================================================================
10032 AC_MSG_CHECKING([whether to execute CVE tests])
10033 # If not explicitly enabled or disabled, default
10034 if test -z "$enable_cve_tests"; then
10035     case "$OS" in
10036     WNT)
10037         # Default cves off for Windows with its wild and wonderful
10038         # variety of AV software kicking in and panicking
10039         enable_cve_tests=no
10040         ;;
10041     *)
10042         # otherwise yes
10043         enable_cve_tests=yes
10044         ;;
10045     esac
10047 if test "$enable_cve_tests" = "no"; then
10048     AC_MSG_RESULT([no])
10049     DISABLE_CVE_TESTS=TRUE
10050     AC_SUBST(DISABLE_CVE_TESTS)
10051 else
10052     AC_MSG_RESULT([yes])
10055 dnl ===================================================================
10056 dnl Check for enabling chart XShape tests
10057 dnl ===================================================================
10058 AC_MSG_CHECKING([whether to execute chart XShape tests])
10059 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10060     AC_MSG_RESULT([yes])
10061     ENABLE_CHART_TESTS=TRUE
10062     AC_SUBST(ENABLE_CHART_TESTS)
10063 else
10064     AC_MSG_RESULT([no])
10067 dnl ===================================================================
10068 dnl Check for system openssl
10069 dnl ===================================================================
10070 DISABLE_OPENSSL=
10071 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10072 if test "$enable_openssl" = "yes"; then
10073     AC_MSG_RESULT([no])
10074     if test "$_os" = Darwin ; then
10075         # OpenSSL is deprecated when building for 10.7 or later.
10076         #
10077         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10078         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10080         with_system_openssl=no
10081         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10082     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10083             && test "$with_system_openssl" != "no"; then
10084         with_system_openssl=yes
10085         SYSTEM_OPENSSL=TRUE
10086         OPENSSL_CFLAGS=
10087         OPENSSL_LIBS="-lssl -lcrypto"
10088     else
10089         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10090     fi
10091     if test "$with_system_openssl" = "yes"; then
10092         AC_MSG_CHECKING([whether openssl supports SHA512])
10093         AC_LANG_PUSH([C])
10094         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10095             SHA512_CTX context;
10096 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10097         AC_LANG_POP(C)
10098     fi
10099 else
10100     AC_MSG_RESULT([yes])
10101     DISABLE_OPENSSL=TRUE
10103     # warn that although OpenSSL is disabled, system libraries may depend on it
10104     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10105     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10108 AC_SUBST([DISABLE_OPENSSL])
10110 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10111     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10112         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10113         enable_cipher_openssl_backend=no
10114     else
10115         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10116     fi
10118 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10119 ENABLE_CIPHER_OPENSSL_BACKEND=
10120 if test "$enable_cipher_openssl_backend" = yes; then
10121     AC_MSG_RESULT([yes])
10122     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10123 else
10124     AC_MSG_RESULT([no])
10126 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10128 dnl ===================================================================
10129 dnl Check for building gnutls
10130 dnl ===================================================================
10131 AC_MSG_CHECKING([whether to use gnutls])
10132 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10133     AC_MSG_RESULT([yes])
10134     AM_PATH_LIBGCRYPT()
10135     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10136         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10137                       available in the system to use as replacement.]]))
10138     FilterLibs "${LIBGCRYPT_LIBS}"
10139     LIBGCRYPT_LIBS="${filteredlibs}"
10140 else
10141     AC_MSG_RESULT([no])
10144 AC_SUBST([LIBGCRYPT_CFLAGS])
10145 AC_SUBST([LIBGCRYPT_LIBS])
10147 dnl ===================================================================
10148 dnl Check for system redland
10149 dnl ===================================================================
10150 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10151 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10152 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10153 if test "$with_system_redland" = "yes"; then
10154     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10155             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10156 else
10157     RAPTOR_MAJOR="0"
10158     RASQAL_MAJOR="3"
10159     REDLAND_MAJOR="0"
10161 AC_SUBST(RAPTOR_MAJOR)
10162 AC_SUBST(RASQAL_MAJOR)
10163 AC_SUBST(REDLAND_MAJOR)
10165 dnl ===================================================================
10166 dnl Check for system hunspell
10167 dnl ===================================================================
10168 AC_MSG_CHECKING([which libhunspell to use])
10169 if test "$_os" = iOS; then
10170    AC_MSG_RESULT([none])
10171 elif test "$with_system_hunspell" = "yes"; then
10172     AC_MSG_RESULT([external])
10173     SYSTEM_HUNSPELL=TRUE
10174     AC_LANG_PUSH([C++])
10175     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10176     if test "$HUNSPELL_PC" != "TRUE"; then
10177         AC_CHECK_HEADER(hunspell.hxx, [],
10178             [
10179             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10180             [AC_MSG_ERROR(hunspell headers not found.)], [])
10181             ], [])
10182         AC_CHECK_LIB([hunspell], [main], [:],
10183            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10184         HUNSPELL_LIBS=-lhunspell
10185     fi
10186     AC_LANG_POP([C++])
10187     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10188     FilterLibs "${HUNSPELL_LIBS}"
10189     HUNSPELL_LIBS="${filteredlibs}"
10190 else
10191     AC_MSG_RESULT([internal])
10192     SYSTEM_HUNSPELL=
10193     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10194     if test "$COM" = "MSC"; then
10195         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10196     else
10197         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10198     fi
10199     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10201 AC_SUBST(SYSTEM_HUNSPELL)
10202 AC_SUBST(HUNSPELL_CFLAGS)
10203 AC_SUBST(HUNSPELL_LIBS)
10205 dnl ===================================================================
10206 dnl Check for system qrcodegen
10207 dnl ===================================================================
10208 AC_MSG_CHECKING([which libqrcodegen to use])
10209 if test "$with_system_qrcodegen" = "yes"; then
10210     AC_MSG_RESULT([external])
10211     SYSTEM_QRCODEGEN=TRUE
10212     AC_LANG_PUSH([C++])
10213     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10214         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10215     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10216         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10217     QRCODEGEN_LIBS=-lqrcodegencpp
10218     AC_LANG_POP([C++])
10219     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10220     FilterLibs "${QRCODEGEN_LIBS}"
10221     QRCODEGEN_LIBS="${filteredlibs}"
10222 else
10223     AC_MSG_RESULT([internal])
10224     SYSTEM_QRCODEGEN=
10225     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10227 AC_SUBST(SYSTEM_QRCODEGEN)
10228 AC_SUBST(QRCODEGEN_CFLAGS)
10229 AC_SUBST(QRCODEGEN_LIBS)
10231 dnl ===================================================================
10232 dnl Check for system box2d
10233 dnl ===================================================================
10234 AC_MSG_CHECKING([which box2d to use])
10235 if test "$with_system_box2d" = "yes"; then
10236     AC_MSG_RESULT([external])
10237     SYSTEM_BOX2D=TRUE
10238     AC_LANG_PUSH([C++])
10239     AC_CHECK_HEADER(Box2D/Box2D.h, [],
10240         [AC_MSG_ERROR(box2d headers not found.)], [])
10241     AC_CHECK_LIB([Box2D], [main], [:],
10242         [ AC_MSG_ERROR(box2d library not found.) ], [])
10243     BOX2D_LIBS=-lBox2D
10244     AC_LANG_POP([C++])
10245     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10246     FilterLibs "${BOX2D_LIBS}"
10247     BOX2D_LIBS="${filteredlibs}"
10248 else
10249     AC_MSG_RESULT([internal])
10250     SYSTEM_BOX2D=
10251     BUILD_TYPE="$BUILD_TYPE BOX2D"
10253 AC_SUBST(SYSTEM_BOX2D)
10254 AC_SUBST(BOX2D_CFLAGS)
10255 AC_SUBST(BOX2D_LIBS)
10257 dnl ===================================================================
10258 dnl Checking for altlinuxhyph
10259 dnl ===================================================================
10260 AC_MSG_CHECKING([which altlinuxhyph to use])
10261 if test "$with_system_altlinuxhyph" = "yes"; then
10262     AC_MSG_RESULT([external])
10263     SYSTEM_HYPH=TRUE
10264     AC_CHECK_HEADER(hyphen.h, [],
10265        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10266     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10267        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10268        [#include <hyphen.h>])
10269     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10270         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10271     if test -z "$HYPHEN_LIB"; then
10272         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10273            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10274     fi
10275     if test -z "$HYPHEN_LIB"; then
10276         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10277            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10278     fi
10279 else
10280     AC_MSG_RESULT([internal])
10281     SYSTEM_HYPH=
10282     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10283     if test "$COM" = "MSC"; then
10284         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10285     else
10286         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10287     fi
10289 AC_SUBST(SYSTEM_HYPH)
10290 AC_SUBST(HYPHEN_LIB)
10292 dnl ===================================================================
10293 dnl Checking for mythes
10294 dnl ===================================================================
10295 AC_MSG_CHECKING([which mythes to use])
10296 if test "$_os" = iOS; then
10297    AC_MSG_RESULT([none])
10298 elif test "$with_system_mythes" = "yes"; then
10299     AC_MSG_RESULT([external])
10300     SYSTEM_MYTHES=TRUE
10301     AC_LANG_PUSH([C++])
10302     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10303     if test "$MYTHES_PKGCONFIG" = "no"; then
10304         AC_CHECK_HEADER(mythes.hxx, [],
10305             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10306         AC_CHECK_LIB([mythes-1.2], [main], [:],
10307             [ MYTHES_FOUND=no], [])
10308     if test "$MYTHES_FOUND" = "no"; then
10309         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10310                 [ MYTHES_FOUND=no], [])
10311     fi
10312     if test "$MYTHES_FOUND" = "no"; then
10313         AC_MSG_ERROR([mythes library not found!.])
10314     fi
10315     fi
10316     AC_LANG_POP([C++])
10317     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10318     FilterLibs "${MYTHES_LIBS}"
10319     MYTHES_LIBS="${filteredlibs}"
10320 else
10321     AC_MSG_RESULT([internal])
10322     SYSTEM_MYTHES=
10323     BUILD_TYPE="$BUILD_TYPE MYTHES"
10324     if test "$COM" = "MSC"; then
10325         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10326     else
10327         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10328     fi
10330 AC_SUBST(SYSTEM_MYTHES)
10331 AC_SUBST(MYTHES_CFLAGS)
10332 AC_SUBST(MYTHES_LIBS)
10334 dnl ===================================================================
10335 dnl How should we build the linear programming solver ?
10336 dnl ===================================================================
10338 ENABLE_COINMP=
10339 AC_MSG_CHECKING([whether to build with CoinMP])
10340 if test "$enable_coinmp" != "no"; then
10341     ENABLE_COINMP=TRUE
10342     AC_MSG_RESULT([yes])
10343     if test "$with_system_coinmp" = "yes"; then
10344         SYSTEM_COINMP=TRUE
10345         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10346         FilterLibs "${COINMP_LIBS}"
10347         COINMP_LIBS="${filteredlibs}"
10348     else
10349         BUILD_TYPE="$BUILD_TYPE COINMP"
10350     fi
10351 else
10352     AC_MSG_RESULT([no])
10354 AC_SUBST(ENABLE_COINMP)
10355 AC_SUBST(SYSTEM_COINMP)
10356 AC_SUBST(COINMP_CFLAGS)
10357 AC_SUBST(COINMP_LIBS)
10359 ENABLE_LPSOLVE=
10360 AC_MSG_CHECKING([whether to build with lpsolve])
10361 if test "$enable_lpsolve" != "no"; then
10362     ENABLE_LPSOLVE=TRUE
10363     AC_MSG_RESULT([yes])
10364 else
10365     AC_MSG_RESULT([no])
10367 AC_SUBST(ENABLE_LPSOLVE)
10369 if test "$ENABLE_LPSOLVE" = TRUE; then
10370     AC_MSG_CHECKING([which lpsolve to use])
10371     if test "$with_system_lpsolve" = "yes"; then
10372         AC_MSG_RESULT([external])
10373         SYSTEM_LPSOLVE=TRUE
10374         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10375            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10376         save_LIBS=$LIBS
10377         # some systems need this. Like Ubuntu...
10378         AC_CHECK_LIB(m, floor)
10379         AC_CHECK_LIB(dl, dlopen)
10380         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10381             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10382         LIBS=$save_LIBS
10383     else
10384         AC_MSG_RESULT([internal])
10385         SYSTEM_LPSOLVE=
10386         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10387     fi
10389 AC_SUBST(SYSTEM_LPSOLVE)
10391 dnl ===================================================================
10392 dnl Checking for libexttextcat
10393 dnl ===================================================================
10394 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10395 if test "$with_system_libexttextcat" = "yes"; then
10396     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10398 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10400 dnl ===================================================================
10401 dnl Checking for libnumbertext
10402 dnl ===================================================================
10403 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10404 if test "$with_system_libnumbertext" = "yes"; then
10405     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10406     SYSTEM_LIBNUMBERTEXT=YES
10407 else
10408     SYSTEM_LIBNUMBERTEXT=
10409     AC_LANG_PUSH([C++])
10410     save_CPPFLAGS=$CPPFLAGS
10411     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10412     AC_CHECK_HEADERS([codecvt regex])
10413     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10414             [ LIBNUMBERTEXT_CFLAGS=''
10415               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10416                            Enable libnumbertext fallback (missing number to number name conversion).])
10417             ])
10418     CPPFLAGS=$save_CPPFLAGS
10419     AC_LANG_POP([C++])
10421 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10422 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10423 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10425 dnl ***************************************
10426 dnl testing libc version for Linux...
10427 dnl ***************************************
10428 if test "$_os" = "Linux"; then
10429     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10430     exec 6>/dev/null # no output
10431     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10432     exec 6>&1 # output on again
10433     if test "$HAVE_LIBC"; then
10434         AC_MSG_RESULT([yes])
10435     else
10436         AC_MSG_ERROR([no, upgrade libc])
10437     fi
10440 dnl =========================================
10441 dnl Check for uuidgen
10442 dnl =========================================
10443 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10444     # presence is already tested above in the WINDOWS_SDK_HOME check
10445     UUIDGEN=uuidgen.exe
10446     AC_SUBST(UUIDGEN)
10447 else
10448     AC_PATH_PROG([UUIDGEN], [uuidgen])
10449     if test -z "$UUIDGEN"; then
10450         AC_MSG_WARN([uuid is needed for building installation sets])
10451     fi
10454 dnl ***************************************
10455 dnl Checking for bison and flex
10456 dnl ***************************************
10457 AC_PATH_PROG(BISON, bison)
10458 if test -z "$BISON"; then
10459     AC_MSG_ERROR([no bison found in \$PATH, install it])
10460 else
10461     AC_MSG_CHECKING([the bison version])
10462     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10463     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10464     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
10465     dnl cause
10466     dnl
10467     dnl   idlc/source/parser.y:222:15: error: externally available entity 'YYSTYPE' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]
10468     dnl   typedef union YYSTYPE
10469     dnl           ~~~~~~^~~~~~~
10470     dnl
10471     dnl while at least 3.4.1 is know to be good:
10472     if test "$COMPILER_PLUGINS" = TRUE; then
10473         if test "$_bison_longver" -lt 2004; then
10474             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
10475         fi
10476     else
10477         if test "$_bison_longver" -lt 2000; then
10478             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10479         fi
10480     fi
10482 AC_SUBST([BISON])
10484 AC_PATH_PROG(FLEX, flex)
10485 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10486     FLEX=`cygpath -m $FLEX`
10488 if test -z "$FLEX"; then
10489     AC_MSG_ERROR([no flex found in \$PATH, install it])
10490 else
10491     AC_MSG_CHECKING([the flex version])
10492     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10493     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10494         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10495     fi
10497 AC_SUBST([FLEX])
10498 dnl ***************************************
10499 dnl Checking for patch
10500 dnl ***************************************
10501 AC_PATH_PROG(PATCH, patch)
10502 if test -z "$PATCH"; then
10503     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10506 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10507 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10508     if test -z "$with_gnu_patch"; then
10509         GNUPATCH=$PATCH
10510     else
10511         if test -x "$with_gnu_patch"; then
10512             GNUPATCH=$with_gnu_patch
10513         else
10514             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10515         fi
10516     fi
10518     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10519     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10520         AC_MSG_RESULT([yes])
10521     else
10522         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10523     fi
10524 else
10525     GNUPATCH=$PATCH
10528 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10529     GNUPATCH=`cygpath -m $GNUPATCH`
10532 dnl We also need to check for --with-gnu-cp
10534 if test -z "$with_gnu_cp"; then
10535     # check the place where the good stuff is hidden on Solaris...
10536     if test -x /usr/gnu/bin/cp; then
10537         GNUCP=/usr/gnu/bin/cp
10538     else
10539         AC_PATH_PROGS(GNUCP, gnucp cp)
10540     fi
10541     if test -z $GNUCP; then
10542         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10543     fi
10544 else
10545     if test -x "$with_gnu_cp"; then
10546         GNUCP=$with_gnu_cp
10547     else
10548         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10549     fi
10552 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10553     GNUCP=`cygpath -m $GNUCP`
10556 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10557 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10558     AC_MSG_RESULT([yes])
10559 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10560     AC_MSG_RESULT([yes])
10561 else
10562     case "$build_os" in
10563     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10564         x_GNUCP=[\#]
10565         GNUCP=''
10566         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10567         ;;
10568     *)
10569         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10570         ;;
10571     esac
10574 AC_SUBST(GNUPATCH)
10575 AC_SUBST(GNUCP)
10576 AC_SUBST(x_GNUCP)
10578 dnl ***************************************
10579 dnl testing assembler path
10580 dnl ***************************************
10581 ML_EXE=""
10582 if test "$_os" = "WINNT"; then
10583     if test "$BITNESS_OVERRIDE" = ""; then
10584         assembler=ml.exe
10585     else
10586         assembler=ml64.exe
10587     fi
10589     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10590     if test -f "$CL_PATH/$assembler"; then
10591         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10592         AC_MSG_RESULT([$ML_EXE])
10593     else
10594         AC_MSG_ERROR([not found])
10595     fi
10598 AC_SUBST(ML_EXE)
10600 dnl ===================================================================
10601 dnl We need zip and unzip
10602 dnl ===================================================================
10603 AC_PATH_PROG(ZIP, zip)
10604 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10605 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10606     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],,)
10609 AC_PATH_PROG(UNZIP, unzip)
10610 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10612 dnl ===================================================================
10613 dnl Zip must be a specific type for different build types.
10614 dnl ===================================================================
10615 if test $build_os = cygwin; then
10616     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10617         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10618     fi
10621 dnl ===================================================================
10622 dnl We need touch with -h option support.
10623 dnl ===================================================================
10624 AC_PATH_PROG(TOUCH, touch)
10625 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10626 touch warn
10627 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10628     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],,)
10631 dnl ===================================================================
10632 dnl Check for system epoxy
10633 dnl ===================================================================
10634 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10636 dnl ===================================================================
10637 dnl Set vcl option: coordinate device in double or sal_Int32
10638 dnl ===================================================================
10640 dnl disabled for now, we don't want subtle differences between OSs
10641 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10642 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10643 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10644 dnl     AC_MSG_RESULT([double])
10645 dnl else
10646 dnl     AC_MSG_RESULT([sal_Int32])
10647 dnl fi
10649 dnl ===================================================================
10650 dnl Test which vclplugs have to be built.
10651 dnl ===================================================================
10652 R=""
10653 if test "$USING_X11" != TRUE; then
10654     enable_gtk3=no
10657 ENABLE_GTK3=""
10658 if test "x$enable_gtk3" = "xyes"; then
10659     ENABLE_GTK3="TRUE"
10660     AC_DEFINE(ENABLE_GTK3)
10661     R="$R gtk3"
10663 AC_SUBST(ENABLE_GTK3)
10665 ENABLE_GTK3_KDE5=""
10666 if test "x$enable_gtk3_kde5" = "xyes"; then
10667     ENABLE_GTK3_KDE5="TRUE"
10668     AC_DEFINE(ENABLE_GTK3_KDE5)
10669     R="$R gtk3_kde5"
10671 AC_SUBST(ENABLE_GTK3_KDE5)
10673 ENABLE_QT5=""
10674 if test "x$enable_qt5" = "xyes"; then
10675     ENABLE_QT5="TRUE"
10676     AC_DEFINE(ENABLE_QT5)
10677     R="$R qt5"
10679 AC_SUBST(ENABLE_QT5)
10681 ENABLE_KF5=""
10682 if test "x$enable_kf5" = "xyes"; then
10683     ENABLE_KF5="TRUE"
10684     AC_DEFINE(ENABLE_KF5)
10685     R="$R kf5"
10687 AC_SUBST(ENABLE_KF5)
10689 GTK3_CFLAGS=""
10690 GTK3_LIBS=""
10691 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
10692     if test "$with_system_cairo" = no; then
10693         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10694     fi
10695     : ${with_system_cairo:=yes}
10696     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)
10697     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10698     FilterLibs "${GTK3_LIBS}"
10699     GTK3_LIBS="${filteredlibs}"
10701     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10702     if test "$with_system_epoxy" != "yes"; then
10703         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10704         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10705                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10706     fi
10708 AC_SUBST(GTK3_LIBS)
10709 AC_SUBST(GTK3_CFLAGS)
10711 if test "$enable_introspection" = yes; then
10712     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
10713         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10714     else
10715         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10716     fi
10719 if test "$_os" = "WINNT"; then
10720     R="$R win"
10721 elif test "$_os" = "Darwin"; then
10722     R="$R osx"
10723 elif test "$_os" = "iOS"; then
10724     R="ios (builtin)"
10727 build_vcl_plugins="$R"
10728 if test -z "$build_vcl_plugins"; then
10729     build_vcl_plugins="none"
10731 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10733 dnl ===================================================================
10734 dnl check for dbus support
10735 dnl ===================================================================
10736 ENABLE_DBUS=""
10737 DBUS_CFLAGS=""
10738 DBUS_LIBS=""
10739 DBUS_GLIB_CFLAGS=""
10740 DBUS_GLIB_LIBS=""
10741 DBUS_HAVE_GLIB=""
10743 if test "$enable_dbus" = "no"; then
10744     test_dbus=no
10747 AC_MSG_CHECKING([whether to enable DBUS support])
10748 if test "$test_dbus" = "yes"; then
10749     ENABLE_DBUS="TRUE"
10750     AC_MSG_RESULT([yes])
10751     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10752     AC_DEFINE(ENABLE_DBUS)
10753     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10754     FilterLibs "${DBUS_LIBS}"
10755     DBUS_LIBS="${filteredlibs}"
10757     # Glib is needed for BluetoothServer
10758     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10759     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10760         [
10761             DBUS_HAVE_GLIB="TRUE"
10762             AC_DEFINE(DBUS_HAVE_GLIB,1)
10763         ],
10764         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10765     )
10766 else
10767     AC_MSG_RESULT([no])
10770 AC_SUBST(ENABLE_DBUS)
10771 AC_SUBST(DBUS_CFLAGS)
10772 AC_SUBST(DBUS_LIBS)
10773 AC_SUBST(DBUS_GLIB_CFLAGS)
10774 AC_SUBST(DBUS_GLIB_LIBS)
10775 AC_SUBST(DBUS_HAVE_GLIB)
10777 AC_MSG_CHECKING([whether to enable Impress remote control])
10778 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10779     AC_MSG_RESULT([yes])
10780     ENABLE_SDREMOTE=TRUE
10781     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10783     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
10784         # The Bluetooth code doesn't compile with macOS SDK 10.15
10785         if test "$enable_sdremote_bluetooth" = yes; then
10786             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
10787         fi
10788         enable_sdremote_bluetooth=no
10789     fi
10790     # If not explicitly enabled or disabled, default
10791     if test -z "$enable_sdremote_bluetooth"; then
10792         case "$OS" in
10793         LINUX|MACOSX|WNT)
10794             # Default to yes for these
10795             enable_sdremote_bluetooth=yes
10796             ;;
10797         *)
10798             # otherwise no
10799             enable_sdremote_bluetooth=no
10800             ;;
10801         esac
10802     fi
10803     # $enable_sdremote_bluetooth is guaranteed non-empty now
10805     if test "$enable_sdremote_bluetooth" != "no"; then
10806         if test "$OS" = "LINUX"; then
10807             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10808                 AC_MSG_RESULT([yes])
10809                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10810                 dnl ===================================================================
10811                 dnl Check for system bluez
10812                 dnl ===================================================================
10813                 AC_MSG_CHECKING([which Bluetooth header to use])
10814                 if test "$with_system_bluez" = "yes"; then
10815                     AC_MSG_RESULT([external])
10816                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10817                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10818                     SYSTEM_BLUEZ=TRUE
10819                 else
10820                     AC_MSG_RESULT([internal])
10821                     SYSTEM_BLUEZ=
10822                 fi
10823             else
10824                 AC_MSG_RESULT([no, dbus disabled])
10825                 ENABLE_SDREMOTE_BLUETOOTH=
10826                 SYSTEM_BLUEZ=
10827             fi
10828         else
10829             AC_MSG_RESULT([yes])
10830             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10831             SYSTEM_BLUEZ=
10832         fi
10833     else
10834         AC_MSG_RESULT([no])
10835         ENABLE_SDREMOTE_BLUETOOTH=
10836         SYSTEM_BLUEZ=
10837     fi
10838 else
10839     ENABLE_SDREMOTE=
10840     SYSTEM_BLUEZ=
10841     AC_MSG_RESULT([no])
10843 AC_SUBST(ENABLE_SDREMOTE)
10844 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10845 AC_SUBST(SYSTEM_BLUEZ)
10847 dnl ===================================================================
10848 dnl Check whether to enable GIO support
10849 dnl ===================================================================
10850 if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
10851     AC_MSG_CHECKING([whether to enable GIO support])
10852     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10853         dnl Need at least 2.26 for the dbus support.
10854         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10855                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10856         if test "$ENABLE_GIO" = "TRUE"; then
10857             AC_DEFINE(ENABLE_GIO)
10858             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10859             FilterLibs "${GIO_LIBS}"
10860             GIO_LIBS="${filteredlibs}"
10861         fi
10862     else
10863         AC_MSG_RESULT([no])
10864     fi
10866 AC_SUBST(ENABLE_GIO)
10867 AC_SUBST(GIO_CFLAGS)
10868 AC_SUBST(GIO_LIBS)
10871 dnl ===================================================================
10873 SPLIT_APP_MODULES=""
10874 if test "$enable_split_app_modules" = "yes"; then
10875     SPLIT_APP_MODULES="TRUE"
10877 AC_SUBST(SPLIT_APP_MODULES)
10879 SPLIT_OPT_FEATURES=""
10880 if test "$enable_split_opt_features" = "yes"; then
10881     SPLIT_OPT_FEATURES="TRUE"
10883 AC_SUBST(SPLIT_OPT_FEATURES)
10885 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10886     if test "$enable_cairo_canvas" = yes; then
10887         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10888     fi
10889     enable_cairo_canvas=no
10890 elif test -z "$enable_cairo_canvas"; then
10891     enable_cairo_canvas=yes
10894 ENABLE_CAIRO_CANVAS=""
10895 if test "$enable_cairo_canvas" = "yes"; then
10896     test_cairo=yes
10897     ENABLE_CAIRO_CANVAS="TRUE"
10898     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10900 AC_SUBST(ENABLE_CAIRO_CANVAS)
10902 dnl ===================================================================
10903 dnl Check whether the GStreamer libraries are available.
10904 dnl ===================================================================
10906 ENABLE_GSTREAMER_1_0=""
10908 if test "$build_gstreamer_1_0" = "yes"; then
10910     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10911     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10912         ENABLE_GSTREAMER_1_0="TRUE"
10913         AC_MSG_RESULT([yes])
10914         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10915         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10916         FilterLibs "${GSTREAMER_1_0_LIBS}"
10917         GSTREAMER_1_0_LIBS="${filteredlibs}"
10918         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10919     else
10920         AC_MSG_RESULT([no])
10921     fi
10923 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10924 AC_SUBST(GSTREAMER_1_0_LIBS)
10925 AC_SUBST(ENABLE_GSTREAMER_1_0)
10927 dnl ===================================================================
10928 dnl Check whether to build the VLC avmedia backend
10929 dnl ===================================================================
10931 ENABLE_VLC=""
10933 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10934 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10935     ENABLE_VLC="TRUE"
10936     AC_MSG_RESULT([yes])
10937 else
10938     AC_MSG_RESULT([no])
10940 AC_SUBST(ENABLE_VLC)
10942 ENABLE_OPENGL_TRANSITIONS=
10943 ENABLE_OPENGL_CANVAS=
10944 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10945    : # disable
10946 elif test "$_os" = "Darwin"; then
10947     # We use frameworks on macOS, no need for detail checks
10948     ENABLE_OPENGL_TRANSITIONS=TRUE
10949     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10950     ENABLE_OPENGL_CANVAS=TRUE
10951 elif test $_os = WINNT; then
10952     ENABLE_OPENGL_TRANSITIONS=TRUE
10953     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10954     ENABLE_OPENGL_CANVAS=TRUE
10955 else
10956     if test "$USING_X11" = TRUE; then
10957         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10958         ENABLE_OPENGL_TRANSITIONS=TRUE
10959         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10960         ENABLE_OPENGL_CANVAS=TRUE
10961     fi
10964 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10965 AC_SUBST(ENABLE_OPENGL_CANVAS)
10967 dnl =================================================
10968 dnl Check whether to build with OpenCL support.
10969 dnl =================================================
10971 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10972     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10973     # platform (optional at run-time, used through clew).
10974     BUILD_TYPE="$BUILD_TYPE OPENCL"
10975     AC_DEFINE(HAVE_FEATURE_OPENCL)
10978 dnl =================================================
10979 dnl Check whether to build with dconf support.
10980 dnl =================================================
10982 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10983     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10984         if test "$enable_dconf" = yes; then
10985             AC_MSG_ERROR([dconf not found])
10986         else
10987             enable_dconf=no
10988         fi])
10990 AC_MSG_CHECKING([whether to enable dconf])
10991 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10992     DCONF_CFLAGS=
10993     DCONF_LIBS=
10994     ENABLE_DCONF=
10995     AC_MSG_RESULT([no])
10996 else
10997     ENABLE_DCONF=TRUE
10998     AC_DEFINE(ENABLE_DCONF)
10999     AC_MSG_RESULT([yes])
11001 AC_SUBST([DCONF_CFLAGS])
11002 AC_SUBST([DCONF_LIBS])
11003 AC_SUBST([ENABLE_DCONF])
11005 # pdf import?
11006 AC_MSG_CHECKING([whether to build the PDF import feature])
11007 ENABLE_PDFIMPORT=
11008 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
11009     AC_MSG_RESULT([yes])
11010     ENABLE_PDFIMPORT=TRUE
11011     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11012 else
11013     AC_MSG_RESULT([no])
11016 # Pdfium?
11017 AC_MSG_CHECKING([whether to build PDFium])
11018 ENABLE_PDFIUM=
11019 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11020     AC_MSG_RESULT([yes])
11021     ENABLE_PDFIUM=TRUE
11022     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11023     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11024 else
11025     AC_MSG_RESULT([no])
11027 AC_SUBST(ENABLE_PDFIUM)
11029 dnl ===================================================================
11030 dnl Check for poppler
11031 dnl ===================================================================
11032 ENABLE_POPPLER=
11033 AC_MSG_CHECKING([whether to build Poppler])
11034 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11035     AC_MSG_RESULT([yes])
11036     ENABLE_POPPLER=TRUE
11037     AC_DEFINE(HAVE_FEATURE_POPPLER)
11038 else
11039     AC_MSG_RESULT([no])
11041 AC_SUBST(ENABLE_POPPLER)
11043 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11044     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11047 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11048     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11051 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11052     dnl ===================================================================
11053     dnl Check for system poppler
11054     dnl ===================================================================
11055     AC_MSG_CHECKING([which PDF import poppler to use])
11056     if test "$with_system_poppler" = "yes"; then
11057         AC_MSG_RESULT([external])
11058         SYSTEM_POPPLER=TRUE
11059         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11060         AC_LANG_PUSH([C++])
11061         save_CXXFLAGS=$CXXFLAGS
11062         save_CPPFLAGS=$CPPFLAGS
11063         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11064         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11065         AC_CHECK_HEADER([cpp/poppler-version.h],
11066             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11067             [])
11068         CXXFLAGS=$save_CXXFLAGS
11069         CPPFLAGS=$save_CPPFLAGS
11070         AC_LANG_POP([C++])
11071         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11073         FilterLibs "${POPPLER_LIBS}"
11074         POPPLER_LIBS="${filteredlibs}"
11075     else
11076         AC_MSG_RESULT([internal])
11077         SYSTEM_POPPLER=
11078         BUILD_TYPE="$BUILD_TYPE POPPLER"
11079         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11080     fi
11081     AC_DEFINE([ENABLE_PDFIMPORT],1)
11083 AC_SUBST(ENABLE_PDFIMPORT)
11084 AC_SUBST(SYSTEM_POPPLER)
11085 AC_SUBST(POPPLER_CFLAGS)
11086 AC_SUBST(POPPLER_LIBS)
11088 # Skia?
11089 AC_MSG_CHECKING([whether to build Skia])
11090 ENABLE_SKIA=
11091 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
11092     if test "$enable_skia" = "debug"; then
11093         AC_MSG_RESULT([yes (debug)])
11094         ENABLE_SKIA_DEBUG=TRUE
11095     else
11096         AC_MSG_RESULT([yes])
11097         ENABLE_SKIA_DEBUG=
11098     fi
11099     ENABLE_SKIA=TRUE
11100     AC_DEFINE(HAVE_FEATURE_SKIA)
11101     BUILD_TYPE="$BUILD_TYPE SKIA"
11102 else
11103     AC_MSG_RESULT([no])
11105 AC_SUBST(ENABLE_SKIA)
11106 AC_SUBST(ENABLE_SKIA_DEBUG)
11108 CLANG_CXXFLAGS_INTRINSICS_SSE2=
11109 CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11110 CLANG_CXXFLAGS_INTRINSICS_SSE41=
11111 CLANG_CXXFLAGS_INTRINSICS_SSE42=
11112 CLANG_CXXFLAGS_INTRINSICS_AVX=
11113 CLANG_CXXFLAGS_INTRINSICS_AVX2=
11114 CLANG_CXXFLAGS_INTRINSICS_F16C=
11115 CLANG_CXXFLAGS_INTRINSICS_FMA=
11117 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
11118     if test -n "$CLANG_CC" -a -n "$CLANG_CXX"; then
11119         AC_MSG_CHECKING([for Clang])
11120         AC_MSG_RESULT([$CLANG_CC / $CLANG_CXX])
11121     else
11122         if test "$_os" = "WINNT"; then
11123             AC_MSG_CHECKING([for clang-cl])
11124             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11125                 CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11126                 dnl explicitly set -m32/-m64
11127                 if test "$BITNESS_OVERRIDE" = ""; then
11128                     CLANG_CC="$CLANG_CC -m32"
11129                 else
11130                     CLANG_CC="$CLANG_CC -m64"
11131                 fi
11132                 CLANG_CXX="$CLANG_CC"
11133                 AC_MSG_RESULT([$CLANG_CC])
11134             else
11135                 AC_MSG_RESULT([no])
11136             fi
11137         else
11138             AC_CHECK_PROG(CLANG_CC,clang,clang,[])
11139             AC_CHECK_PROG(CLANG_CXX,clang++,clang++,[])
11140         fi
11141     fi
11142     if test -n "$CLANG_CC" -a -n "$CLANG_CXX"; then
11143         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CLANG_CC -E - | tail -1 | sed 's/ //g'`
11144         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11145         if test "$clang2_ver" -lt 50002; then
11146             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11147             CLANG_CC=
11148             CLANG_CXX=
11149         fi
11150     fi
11151     if test -z "$CLANG_CC" -o -z "$CLANG_CXX"; then
11152         # Skia is the default on Windows, so hard-require Clang.
11153         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11154         if test "$_os" = "WINNT"; then
11155             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11156         else
11157             AC_MSG_WARN([Clang compiler not found.])
11158         fi
11159     else
11161         save_CXX="$CXX"
11162         CXX="$CLANG_CXX"
11163         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11164         flag_sse2=-msse2
11165         flag_ssse3=-mssse3
11166         flag_sse41=-msse4.1
11167         flag_sse42=-msse4.2
11168         flag_avx=-mavx
11169         flag_avx2=-mavx2
11170         flag_f16c=-mf16c
11171         flag_fma=-mfma
11173         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11174         AC_LANG_PUSH([C++])
11175         save_CXXFLAGS=$CXXFLAGS
11176         CXXFLAGS="$CXXFLAGS $flag_sse2"
11177         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11178             #include <emmintrin.h>
11179             int main () {
11180                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11181                 c = _mm_xor_si128 (a, b);
11182                 return 0;
11183             }
11184             ])],
11185             [can_compile_sse2=yes],
11186             [can_compile_sse2=no])
11187         AC_LANG_POP([C++])
11188         CXXFLAGS=$save_CXXFLAGS
11189         AC_MSG_RESULT([${can_compile_sse2}])
11190         if test "${can_compile_sse2}" = "yes" ; then
11191             CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11192         fi
11194         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11195         AC_LANG_PUSH([C++])
11196         save_CXXFLAGS=$CXXFLAGS
11197         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11198         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11199             #include <tmmintrin.h>
11200             int main () {
11201                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11202                 c = _mm_maddubs_epi16 (a, b);
11203                 return 0;
11204             }
11205             ])],
11206             [can_compile_ssse3=yes],
11207             [can_compile_ssse3=no])
11208         AC_LANG_POP([C++])
11209         CXXFLAGS=$save_CXXFLAGS
11210         AC_MSG_RESULT([${can_compile_ssse3}])
11211         if test "${can_compile_ssse3}" = "yes" ; then
11212             CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
11213         fi
11215         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
11216         AC_LANG_PUSH([C++])
11217         save_CXXFLAGS=$CXXFLAGS
11218         CXXFLAGS="$CXXFLAGS $flag_sse41"
11219         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11220             #include <smmintrin.h>
11221             int main () {
11222                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11223                 c = _mm_cmpeq_epi64 (a, b);
11224                 return 0;
11225             }
11226             ])],
11227             [can_compile_sse41=yes],
11228             [can_compile_sse41=no])
11229         AC_LANG_POP([C++])
11230         CXXFLAGS=$save_CXXFLAGS
11231         AC_MSG_RESULT([${can_compile_sse41}])
11232         if test "${can_compile_sse41}" = "yes" ; then
11233             CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
11234         fi
11236         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
11237         AC_LANG_PUSH([C++])
11238         save_CXXFLAGS=$CXXFLAGS
11239         CXXFLAGS="$CXXFLAGS $flag_sse42"
11240         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11241             #include <nmmintrin.h>
11242             int main () {
11243                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11244                 c = _mm_cmpgt_epi64 (a, b);
11245                 return 0;
11246             }
11247             ])],
11248             [can_compile_sse42=yes],
11249             [can_compile_sse42=no])
11250         AC_LANG_POP([C++])
11251         CXXFLAGS=$save_CXXFLAGS
11252         AC_MSG_RESULT([${can_compile_sse42}])
11253         if test "${can_compile_sse42}" = "yes" ; then
11254             CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
11255         fi
11257         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
11258         AC_LANG_PUSH([C++])
11259         save_CXXFLAGS=$CXXFLAGS
11260         CXXFLAGS="$CXXFLAGS $flag_avx"
11261         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11262             #include <immintrin.h>
11263             int main () {
11264                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
11265                 c = _mm256_xor_ps(a, b);
11266                 return 0;
11267             }
11268             ])],
11269             [can_compile_avx=yes],
11270             [can_compile_avx=no])
11271         AC_LANG_POP([C++])
11272         CXXFLAGS=$save_CXXFLAGS
11273         AC_MSG_RESULT([${can_compile_avx}])
11274         if test "${can_compile_avx}" = "yes" ; then
11275             CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
11276         fi
11278         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
11279         AC_LANG_PUSH([C++])
11280         save_CXXFLAGS=$CXXFLAGS
11281         CXXFLAGS="$CXXFLAGS $flag_avx2"
11282         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11283             #include <immintrin.h>
11284             int main () {
11285                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
11286                 c = _mm256_maddubs_epi16(a, b);
11287                 return 0;
11288             }
11289             ])],
11290             [can_compile_avx2=yes],
11291             [can_compile_avx2=no])
11292         AC_LANG_POP([C++])
11293         CXXFLAGS=$save_CXXFLAGS
11294         AC_MSG_RESULT([${can_compile_avx2}])
11295         if test "${can_compile_avx2}" = "yes" ; then
11296             CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
11297         fi
11299         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
11300         AC_LANG_PUSH([C++])
11301         save_CXXFLAGS=$CXXFLAGS
11302         CXXFLAGS="$CXXFLAGS $flag_f16c"
11303         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11304             #include <immintrin.h>
11305             int main () {
11306                 __m128i a = _mm_set1_epi32 (0);
11307                 __m128 c;
11308                 c = _mm_cvtph_ps(a);
11309                 return 0;
11310             }
11311             ])],
11312             [can_compile_f16c=yes],
11313             [can_compile_f16c=no])
11314         AC_LANG_POP([C++])
11315         CXXFLAGS=$save_CXXFLAGS
11316         AC_MSG_RESULT([${can_compile_f16c}])
11317         if test "${can_compile_f16c}" = "yes" ; then
11318             CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
11319         fi
11321         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
11322         AC_LANG_PUSH([C++])
11323         save_CXXFLAGS=$CXXFLAGS
11324         CXXFLAGS="$CXXFLAGS $flag_fma"
11325         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11326             #include <immintrin.h>
11327             int main () {
11328                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
11329                 d = _mm256_fmadd_ps(a, b, c);
11330                 return 0;
11331             }
11332             ])],
11333             [can_compile_fma=yes],
11334             [can_compile_fma=no])
11335         AC_LANG_POP([C++])
11336         CXXFLAGS=$save_CXXFLAGS
11337         AC_MSG_RESULT([${can_compile_fma}])
11338         if test "${can_compile_fma}" = "yes" ; then
11339             CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
11340         fi
11342         CXX="$save_CXX"
11343     fi
11345 AC_SUBST(CLANG_CC)
11346 AC_SUBST(CLANG_CXX)
11347 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE2)
11348 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSSE3)
11349 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE41)
11350 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE42)
11351 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX)
11352 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX2)
11353 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_F16C)
11354 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_FMA)
11356 SYSTEM_GPGMEPP=
11358 if test "$build_for_ios" = "YES"; then
11359     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
11360     AC_MSG_RESULT([yes])
11361 elif test "$enable_mpl_subset" = "yes"; then
11362     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11363     AC_MSG_RESULT([yes])
11364 elif test "$enable_fuzzers" = "yes"; then
11365     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11366     AC_MSG_RESULT([yes])
11367 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11368     dnl ===================================================================
11369     dnl Check for system gpgme
11370     dnl ===================================================================
11371     AC_MSG_CHECKING([which gpgmepp to use])
11372     if test "$with_system_gpgmepp" = "yes"; then
11373         AC_MSG_RESULT([external])
11374         SYSTEM_GPGMEPP=TRUE
11376         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11377         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11378             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11379         # progress_callback is the only func with plain C linkage
11380         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11381         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11382             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11383         AC_CHECK_HEADER(gpgme.h, [],
11384             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11385     else
11386         AC_MSG_RESULT([internal])
11387         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11388         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11390         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11391         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11392         if test "$_os" != "WINNT"; then
11393             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11394             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11395         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11396             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11397         fi
11398     fi
11399     ENABLE_GPGMEPP=TRUE
11400     AC_DEFINE([HAVE_FEATURE_GPGME])
11401     AC_PATH_PROG(GPG, gpg)
11402     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11403     # so let's exclude that manually for the moment
11404     if test -n "$GPG" -a "$_os" != "WINNT"; then
11405         # make sure we not only have a working gpgme, but a full working
11406         # gpg installation to run OpenPGP signature verification
11407         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11408     fi
11409     if test "$_os" = "Linux"; then
11410       uid=`id -u`
11411       AC_MSG_CHECKING([for /run/user/$uid])
11412       if test -d /run/user/$uid; then
11413         AC_MSG_RESULT([yes])
11414         AC_PATH_PROG(GPGCONF, gpgconf)
11416         # Older versions of gpgconf are not working as expected, since
11417         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11418         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11419         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11420         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11421         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11422         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11423         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11424           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11425           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11426           if $GPGCONF --dump-options > /dev/null ; then
11427             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11428               AC_MSG_RESULT([yes])
11429               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11430               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11431             else
11432               AC_MSG_RESULT([no])
11433             fi
11434           else
11435             AC_MSG_RESULT([no. missing or broken gpgconf?])
11436           fi
11437         else
11438           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11439         fi
11440       else
11441         AC_MSG_RESULT([no])
11442      fi
11443    fi
11445 AC_SUBST(ENABLE_GPGMEPP)
11446 AC_SUBST(SYSTEM_GPGMEPP)
11447 AC_SUBST(GPG_ERROR_CFLAGS)
11448 AC_SUBST(GPG_ERROR_LIBS)
11449 AC_SUBST(LIBASSUAN_CFLAGS)
11450 AC_SUBST(LIBASSUAN_LIBS)
11451 AC_SUBST(GPGMEPP_CFLAGS)
11452 AC_SUBST(GPGMEPP_LIBS)
11454 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11455 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11456     AC_MSG_RESULT([yes])
11457     ENABLE_MEDIAWIKI=TRUE
11458     BUILD_TYPE="$BUILD_TYPE XSLTML"
11459     if test  "x$with_java" = "xno"; then
11460         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11461     fi
11462 else
11463     AC_MSG_RESULT([no])
11464     ENABLE_MEDIAWIKI=
11465     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11467 AC_SUBST(ENABLE_MEDIAWIKI)
11469 AC_MSG_CHECKING([whether to build the Report Builder])
11470 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11471     AC_MSG_RESULT([yes])
11472     ENABLE_REPORTBUILDER=TRUE
11473     AC_MSG_CHECKING([which jfreereport libs to use])
11474     if test "$with_system_jfreereport" = "yes"; then
11475         SYSTEM_JFREEREPORT=TRUE
11476         AC_MSG_RESULT([external])
11477         if test -z $SAC_JAR; then
11478             SAC_JAR=/usr/share/java/sac.jar
11479         fi
11480         if ! test -f $SAC_JAR; then
11481              AC_MSG_ERROR(sac.jar not found.)
11482         fi
11484         if test -z $LIBXML_JAR; then
11485             if test -f /usr/share/java/libxml-1.0.0.jar; then
11486                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11487             elif test -f /usr/share/java/libxml.jar; then
11488                 LIBXML_JAR=/usr/share/java/libxml.jar
11489             else
11490                 AC_MSG_ERROR(libxml.jar replacement not found.)
11491             fi
11492         elif ! test -f $LIBXML_JAR; then
11493             AC_MSG_ERROR(libxml.jar not found.)
11494         fi
11496         if test -z $FLUTE_JAR; then
11497             if test -f /usr/share/java/flute-1.3.0.jar; then
11498                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11499             elif test -f /usr/share/java/flute.jar; then
11500                 FLUTE_JAR=/usr/share/java/flute.jar
11501             else
11502                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11503             fi
11504         elif ! test -f $FLUTE_JAR; then
11505             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11506         fi
11508         if test -z $JFREEREPORT_JAR; then
11509             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11510                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11511             elif test -f /usr/share/java/flow-engine.jar; then
11512                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11513             else
11514                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11515             fi
11516         elif ! test -f  $JFREEREPORT_JAR; then
11517                 AC_MSG_ERROR(jfreereport.jar not found.)
11518         fi
11520         if test -z $LIBLAYOUT_JAR; then
11521             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11522                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11523             elif test -f /usr/share/java/liblayout.jar; then
11524                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11525             else
11526                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11527             fi
11528         elif ! test -f $LIBLAYOUT_JAR; then
11529                 AC_MSG_ERROR(liblayout.jar not found.)
11530         fi
11532         if test -z $LIBLOADER_JAR; then
11533             if test -f /usr/share/java/libloader-1.0.0.jar; then
11534                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11535             elif test -f /usr/share/java/libloader.jar; then
11536                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11537             else
11538                 AC_MSG_ERROR(libloader.jar replacement not found.)
11539             fi
11540         elif ! test -f  $LIBLOADER_JAR; then
11541             AC_MSG_ERROR(libloader.jar not found.)
11542         fi
11544         if test -z $LIBFORMULA_JAR; then
11545             if test -f /usr/share/java/libformula-0.2.0.jar; then
11546                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11547             elif test -f /usr/share/java/libformula.jar; then
11548                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11549             else
11550                 AC_MSG_ERROR(libformula.jar replacement not found.)
11551             fi
11552         elif ! test -f $LIBFORMULA_JAR; then
11553                 AC_MSG_ERROR(libformula.jar not found.)
11554         fi
11556         if test -z $LIBREPOSITORY_JAR; then
11557             if test -f /usr/share/java/librepository-1.0.0.jar; then
11558                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11559             elif test -f /usr/share/java/librepository.jar; then
11560                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11561             else
11562                 AC_MSG_ERROR(librepository.jar replacement not found.)
11563             fi
11564         elif ! test -f $LIBREPOSITORY_JAR; then
11565             AC_MSG_ERROR(librepository.jar not found.)
11566         fi
11568         if test -z $LIBFONTS_JAR; then
11569             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11570                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11571             elif test -f /usr/share/java/libfonts.jar; then
11572                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11573             else
11574                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11575             fi
11576         elif ! test -f $LIBFONTS_JAR; then
11577                 AC_MSG_ERROR(libfonts.jar not found.)
11578         fi
11580         if test -z $LIBSERIALIZER_JAR; then
11581             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11582                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11583             elif test -f /usr/share/java/libserializer.jar; then
11584                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11585             else
11586                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11587             fi
11588         elif ! test -f $LIBSERIALIZER_JAR; then
11589                 AC_MSG_ERROR(libserializer.jar not found.)
11590         fi
11592         if test -z $LIBBASE_JAR; then
11593             if test -f /usr/share/java/libbase-1.0.0.jar; then
11594                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11595             elif test -f /usr/share/java/libbase.jar; then
11596                 LIBBASE_JAR=/usr/share/java/libbase.jar
11597             else
11598                 AC_MSG_ERROR(libbase.jar replacement not found.)
11599             fi
11600         elif ! test -f $LIBBASE_JAR; then
11601             AC_MSG_ERROR(libbase.jar not found.)
11602         fi
11604     else
11605         AC_MSG_RESULT([internal])
11606         SYSTEM_JFREEREPORT=
11607         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11608         NEED_ANT=TRUE
11609     fi
11610 else
11611     AC_MSG_RESULT([no])
11612     ENABLE_REPORTBUILDER=
11613     SYSTEM_JFREEREPORT=
11615 AC_SUBST(ENABLE_REPORTBUILDER)
11616 AC_SUBST(SYSTEM_JFREEREPORT)
11617 AC_SUBST(SAC_JAR)
11618 AC_SUBST(LIBXML_JAR)
11619 AC_SUBST(FLUTE_JAR)
11620 AC_SUBST(JFREEREPORT_JAR)
11621 AC_SUBST(LIBBASE_JAR)
11622 AC_SUBST(LIBLAYOUT_JAR)
11623 AC_SUBST(LIBLOADER_JAR)
11624 AC_SUBST(LIBFORMULA_JAR)
11625 AC_SUBST(LIBREPOSITORY_JAR)
11626 AC_SUBST(LIBFONTS_JAR)
11627 AC_SUBST(LIBSERIALIZER_JAR)
11629 # this has to be here because both the Wiki Publisher and the SRB use
11630 # commons-logging
11631 COMMONS_LOGGING_VERSION=1.2
11632 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11633     AC_MSG_CHECKING([which Apache commons-* libs to use])
11634     if test "$with_system_apache_commons" = "yes"; then
11635         SYSTEM_APACHE_COMMONS=TRUE
11636         AC_MSG_RESULT([external])
11637         if test -z $COMMONS_LOGGING_JAR; then
11638             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11639                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11640            elif test -f /usr/share/java/commons-logging.jar; then
11641                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11642             else
11643                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11644             fi
11645         elif ! test -f $COMMONS_LOGGING_JAR; then
11646             AC_MSG_ERROR(commons-logging.jar not found.)
11647         fi
11648     else
11649         AC_MSG_RESULT([internal])
11650         SYSTEM_APACHE_COMMONS=
11651         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11652         NEED_ANT=TRUE
11653     fi
11655 AC_SUBST(SYSTEM_APACHE_COMMONS)
11656 AC_SUBST(COMMONS_LOGGING_JAR)
11657 AC_SUBST(COMMONS_LOGGING_VERSION)
11659 # scripting provider for BeanShell?
11660 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11661 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11662     AC_MSG_RESULT([yes])
11663     ENABLE_SCRIPTING_BEANSHELL=TRUE
11665     dnl ===================================================================
11666     dnl Check for system beanshell
11667     dnl ===================================================================
11668     AC_MSG_CHECKING([which beanshell to use])
11669     if test "$with_system_beanshell" = "yes"; then
11670         AC_MSG_RESULT([external])
11671         SYSTEM_BSH=TRUE
11672         if test -z $BSH_JAR; then
11673             BSH_JAR=/usr/share/java/bsh.jar
11674         fi
11675         if ! test -f $BSH_JAR; then
11676             AC_MSG_ERROR(bsh.jar not found.)
11677         fi
11678     else
11679         AC_MSG_RESULT([internal])
11680         SYSTEM_BSH=
11681         BUILD_TYPE="$BUILD_TYPE BSH"
11682     fi
11683 else
11684     AC_MSG_RESULT([no])
11685     ENABLE_SCRIPTING_BEANSHELL=
11686     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11688 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11689 AC_SUBST(SYSTEM_BSH)
11690 AC_SUBST(BSH_JAR)
11692 # scripting provider for JavaScript?
11693 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11694 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11695     AC_MSG_RESULT([yes])
11696     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11698     dnl ===================================================================
11699     dnl Check for system rhino
11700     dnl ===================================================================
11701     AC_MSG_CHECKING([which rhino to use])
11702     if test "$with_system_rhino" = "yes"; then
11703         AC_MSG_RESULT([external])
11704         SYSTEM_RHINO=TRUE
11705         if test -z $RHINO_JAR; then
11706             RHINO_JAR=/usr/share/java/js.jar
11707         fi
11708         if ! test -f $RHINO_JAR; then
11709             AC_MSG_ERROR(js.jar not found.)
11710         fi
11711     else
11712         AC_MSG_RESULT([internal])
11713         SYSTEM_RHINO=
11714         BUILD_TYPE="$BUILD_TYPE RHINO"
11715         NEED_ANT=TRUE
11716     fi
11717 else
11718     AC_MSG_RESULT([no])
11719     ENABLE_SCRIPTING_JAVASCRIPT=
11720     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11722 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11723 AC_SUBST(SYSTEM_RHINO)
11724 AC_SUBST(RHINO_JAR)
11726 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11727 # paths should be added to library search path. So lets put all 64-bit
11728 # platforms there.
11729 supports_multilib=
11730 case "$host_cpu" in
11731 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11732     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11733         supports_multilib="yes"
11734     fi
11735     ;;
11737     ;;
11738 esac
11740 dnl ===================================================================
11741 dnl QT5 Integration
11742 dnl ===================================================================
11744 QT5_CFLAGS=""
11745 QT5_LIBS=""
11746 QMAKE5="qmake"
11747 MOC5="moc"
11748 QT5_GOBJECT_CFLAGS=""
11749 QT5_GOBJECT_LIBS=""
11750 QT5_HAVE_GOBJECT=""
11751 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11752         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11753         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11754 then
11755     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11756     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11758     if test -n "$supports_multilib"; then
11759         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11760     fi
11762     qt5_test_include="QtWidgets/qapplication.h"
11763     qt5_test_library="libQt5Widgets.so"
11765     dnl Check for qmake5
11766     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11767     if test "$QMAKE5" = "no"; then
11768         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11769     else
11770         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11771         if test -z "$qmake5_test_ver"; then
11772             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11773         fi
11774         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11775         qt5_minimal_minor="6"
11776         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11777             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11778         else
11779             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11780         fi
11781     fi
11783     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11784     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11786     AC_MSG_CHECKING([for Qt5 headers])
11787     qt5_incdir="no"
11788     for inc_dir in $qt5_incdirs; do
11789         if test -r "$inc_dir/$qt5_test_include"; then
11790             qt5_incdir="$inc_dir"
11791             break
11792         fi
11793     done
11794     AC_MSG_RESULT([$qt5_incdir])
11795     if test "x$qt5_incdir" = "xno"; then
11796         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11797     fi
11799     AC_MSG_CHECKING([for Qt5 libraries])
11800     qt5_libdir="no"
11801     for lib_dir in $qt5_libdirs; do
11802         if test -r "$lib_dir/$qt5_test_library"; then
11803             qt5_libdir="$lib_dir"
11804             break
11805         fi
11806     done
11807     AC_MSG_RESULT([$qt5_libdir])
11808     if test "x$qt5_libdir" = "xno"; then
11809         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11810     fi
11812     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11813     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11814     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11816     if test "$USING_X11" = TRUE; then
11817         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11818         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11819             QT5_HAVE_XCB_ICCCM=1
11820             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11821         ],[
11822             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)])
11823             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11824         ])
11825         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11826         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11827         QT5_USING_X11=1
11828         AC_DEFINE(QT5_USING_X11)
11829     fi
11831     dnl Check for Meta Object Compiler
11833     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11834     if test "$MOC5" = "no"; then
11835         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11836 the root of your Qt installation by exporting QT5DIR before running "configure".])
11837     fi
11839     if test "$build_gstreamer_1_0" = "yes"; then
11840         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11841                 QT5_HAVE_GOBJECT=1
11842                 AC_DEFINE(QT5_HAVE_GOBJECT)
11843             ],
11844             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11845         )
11846     fi
11848 AC_SUBST(QT5_CFLAGS)
11849 AC_SUBST(QT5_LIBS)
11850 AC_SUBST(MOC5)
11851 AC_SUBST(QT5_GOBJECT_CFLAGS)
11852 AC_SUBST(QT5_GOBJECT_LIBS)
11853 AC_SUBST(QT5_HAVE_GOBJECT)
11855 dnl ===================================================================
11856 dnl KF5 Integration
11857 dnl ===================================================================
11859 KF5_CFLAGS=""
11860 KF5_LIBS=""
11861 KF5_CONFIG="kf5-config"
11862 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11863         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11864 then
11865     if test "$OS" = "HAIKU"; then
11866         haiku_arch="`echo $RTL_ARCH | tr X x`"
11867         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11868         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11869     fi
11871     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11872     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11873     if test -n "$supports_multilib"; then
11874         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11875     fi
11877     kf5_test_include="KF5/kcoreaddons_version.h"
11878     kf5_test_library="libKF5CoreAddons.so"
11879     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11881     dnl kf5 KDE4 support compatibility installed
11882     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11883     if test "$KF5_CONFIG" != "no"; then
11884         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11885         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11886     fi
11888     dnl Check for KF5 headers
11889     AC_MSG_CHECKING([for KF5 headers])
11890     kf5_incdir="no"
11891     for kf5_check in $kf5_incdirs; do
11892         if test -r "$kf5_check/$kf5_test_include"; then
11893             kf5_incdir="$kf5_check/KF5"
11894             break
11895         fi
11896     done
11897     AC_MSG_RESULT([$kf5_incdir])
11898     if test "x$kf5_incdir" = "xno"; then
11899         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11900     fi
11902     dnl Check for KF5 libraries
11903     AC_MSG_CHECKING([for KF5 libraries])
11904     kf5_libdir="no"
11905     for kf5_check in $kf5_libdirs; do
11906         if test -r "$kf5_check/$kf5_test_library"; then
11907             kf5_libdir="$kf5_check"
11908             break
11909         fi
11910     done
11912     AC_MSG_RESULT([$kf5_libdir])
11913     if test "x$kf5_libdir" = "xno"; then
11914         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11915     fi
11917     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"
11918     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11919     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11921     if test "$USING_X11" = TRUE; then
11922         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11923     fi
11925     AC_LANG_PUSH([C++])
11926     save_CXXFLAGS=$CXXFLAGS
11927     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11928     AC_MSG_CHECKING([whether KDE is >= 5.0])
11929        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11930 #include <kcoreaddons_version.h>
11932 int main(int argc, char **argv) {
11933        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11934        else return 1;
11936        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11937     CXXFLAGS=$save_CXXFLAGS
11938     AC_LANG_POP([C++])
11940 AC_SUBST(KF5_CFLAGS)
11941 AC_SUBST(KF5_LIBS)
11943 dnl ===================================================================
11944 dnl Test whether to include Evolution 2 support
11945 dnl ===================================================================
11946 AC_MSG_CHECKING([whether to enable evolution 2 support])
11947 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11948     AC_MSG_RESULT([yes])
11949     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11950     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11951     FilterLibs "${GOBJECT_LIBS}"
11952     GOBJECT_LIBS="${filteredlibs}"
11953     ENABLE_EVOAB2="TRUE"
11954 else
11955     ENABLE_EVOAB2=""
11956     AC_MSG_RESULT([no])
11958 AC_SUBST(ENABLE_EVOAB2)
11959 AC_SUBST(GOBJECT_CFLAGS)
11960 AC_SUBST(GOBJECT_LIBS)
11962 dnl ===================================================================
11963 dnl Test which themes to include
11964 dnl ===================================================================
11965 AC_MSG_CHECKING([which themes to include])
11966 # if none given use default subset of available themes
11967 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11968     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg sukapura sukapura_svg"
11971 WITH_THEMES=""
11972 if test "x$with_theme" != "xno"; then
11973     for theme in $with_theme; do
11974         case $theme in
11975         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|sukapura|sukapura_svg) real_theme="$theme" ;;
11976         default) real_theme=colibre ;;
11977         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11978         esac
11979         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11980     done
11982 AC_MSG_RESULT([$WITH_THEMES])
11983 AC_SUBST([WITH_THEMES])
11984 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11985 for theme in $with_theme; do
11986     case $theme in
11987     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11988     *) ;;
11989     esac
11990 done
11992 dnl ===================================================================
11993 dnl Test whether to integrate helppacks into the product's installer
11994 dnl ===================================================================
11995 AC_MSG_CHECKING([for helppack integration])
11996 if test "$with_helppack_integration" = "no"; then
11997     AC_MSG_RESULT([no integration])
11998 else
11999     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12000     AC_MSG_RESULT([integration])
12003 ###############################################################################
12004 # Extensions checking
12005 ###############################################################################
12006 AC_MSG_CHECKING([for extensions integration])
12007 if test "x$enable_extension_integration" != "xno"; then
12008     WITH_EXTENSION_INTEGRATION=TRUE
12009     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12010     AC_MSG_RESULT([yes, use integration])
12011 else
12012     WITH_EXTENSION_INTEGRATION=
12013     AC_MSG_RESULT([no, do not integrate])
12015 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12017 dnl Should any extra extensions be included?
12018 dnl There are standalone tests for each of these below.
12019 WITH_EXTRA_EXTENSIONS=
12020 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12022 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12023 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12024 if test "x$with_java" != "xno"; then
12025     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12026     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12029 AC_MSG_CHECKING([whether to build opens___.ttf])
12030 if test "$enable_build_opensymbol" = "yes"; then
12031     AC_MSG_RESULT([yes])
12032     AC_PATH_PROG(FONTFORGE, fontforge)
12033     if test -z "$FONTFORGE"; then
12034         AC_MSG_ERROR([fontforge not installed])
12035     fi
12036 else
12037     AC_MSG_RESULT([no])
12038     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
12039     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12041 AC_SUBST(OPENSYMBOL_TTF)
12042 AC_SUBST(FONTFORGE)
12044 dnl ===================================================================
12045 dnl Test whether to include fonts
12046 dnl ===================================================================
12047 AC_MSG_CHECKING([whether to include third-party fonts])
12048 if test "$with_fonts" != "no"; then
12049     AC_MSG_RESULT([yes])
12050     WITH_FONTS=TRUE
12051     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12052     AC_DEFINE(HAVE_MORE_FONTS)
12053 else
12054     AC_MSG_RESULT([no])
12055     WITH_FONTS=
12056     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12058 AC_SUBST(WITH_FONTS)
12061 dnl ===================================================================
12062 dnl Test whether to enable online update service
12063 dnl ===================================================================
12064 AC_MSG_CHECKING([whether to enable online update])
12065 ENABLE_ONLINE_UPDATE=
12066 ENABLE_ONLINE_UPDATE_MAR=
12067 UPDATE_CONFIG=
12068 if test "$enable_online_update" = ""; then
12069     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12070         AC_MSG_RESULT([yes])
12071         ENABLE_ONLINE_UPDATE="TRUE"
12072     else
12073         AC_MSG_RESULT([no])
12074     fi
12075 else
12076     if test "$enable_online_update" = "mar"; then
12077         AC_MSG_RESULT([yes - MAR-based online update])
12078         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12079         if test "$with_update_config" = ""; then
12080             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12081         fi
12082         UPDATE_CONFIG="$with_update_config"
12083         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12084     elif test "$enable_online_update" = "yes"; then
12085         AC_MSG_RESULT([yes])
12086         ENABLE_ONLINE_UPDATE="TRUE"
12087     else
12088         AC_MSG_RESULT([no])
12089     fi
12091 AC_SUBST(ENABLE_ONLINE_UPDATE)
12092 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
12093 AC_SUBST(UPDATE_CONFIG)
12095 dnl ===================================================================
12096 dnl Test whether we need bzip2
12097 dnl ===================================================================
12098 SYSTEM_BZIP2=
12099 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
12100     AC_MSG_CHECKING([whether to use system bzip2])
12101     if test "$with_system_bzip2" = yes; then
12102         SYSTEM_BZIP2=TRUE
12103         AC_MSG_RESULT([yes])
12104         PKG_CHECK_MODULES(BZIP2, bzip2)
12105         FilterLibs "${BZIP2_LIBS}"
12106         BZIP2_LIBS="${filteredlibs}"
12107     else
12108         AC_MSG_RESULT([no])
12109         BUILD_TYPE="$BUILD_TYPE BZIP2"
12110     fi
12112 AC_SUBST(SYSTEM_BZIP2)
12113 AC_SUBST(BZIP2_CFLAGS)
12114 AC_SUBST(BZIP2_LIBS)
12116 dnl ===================================================================
12117 dnl Test whether to enable extension update
12118 dnl ===================================================================
12119 AC_MSG_CHECKING([whether to enable extension update])
12120 ENABLE_EXTENSION_UPDATE=
12121 if test "x$enable_extension_update" = "xno"; then
12122     AC_MSG_RESULT([no])
12123 else
12124     AC_MSG_RESULT([yes])
12125     ENABLE_EXTENSION_UPDATE="TRUE"
12126     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
12127     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
12129 AC_SUBST(ENABLE_EXTENSION_UPDATE)
12132 dnl ===================================================================
12133 dnl Test whether to create MSI with LIMITUI=1 (silent install)
12134 dnl ===================================================================
12135 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
12136 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
12137     AC_MSG_RESULT([no])
12138     ENABLE_SILENT_MSI=
12139 else
12140     AC_MSG_RESULT([yes])
12141     ENABLE_SILENT_MSI=TRUE
12142     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
12144 AC_SUBST(ENABLE_SILENT_MSI)
12146 AC_MSG_CHECKING([whether and how to use Xinerama])
12147 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
12148     if test "$x_libraries" = "default_x_libraries"; then
12149         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
12150         if test "x$XINERAMALIB" = x; then
12151            XINERAMALIB="/usr/lib"
12152         fi
12153     else
12154         XINERAMALIB="$x_libraries"
12155     fi
12156     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
12157         # we have both versions, let the user decide but use the dynamic one
12158         # per default
12159         USE_XINERAMA=TRUE
12160         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
12161             XINERAMA_LINK=dynamic
12162         else
12163             XINERAMA_LINK=static
12164         fi
12165     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
12166         # we have only the dynamic version
12167         USE_XINERAMA=TRUE
12168         XINERAMA_LINK=dynamic
12169     elif test -e "$XINERAMALIB/libXinerama.a"; then
12170         # static version
12171         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
12172             USE_XINERAMA=TRUE
12173             XINERAMA_LINK=static
12174         else
12175             USE_XINERAMA=
12176             XINERAMA_LINK=none
12177         fi
12178     else
12179         # no Xinerama
12180         USE_XINERAMA=
12181         XINERAMA_LINK=none
12182     fi
12183     if test "$USE_XINERAMA" = "TRUE"; then
12184         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
12185         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
12186             [AC_MSG_ERROR(Xinerama header not found.)], [])
12187         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
12188         if test "x$XEXTLIB" = x; then
12189            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
12190         fi
12191         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
12192         if test "$_os" = "FreeBSD"; then
12193             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
12194         fi
12195         if test "$_os" = "Linux"; then
12196             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
12197         fi
12198         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
12199             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
12200     else
12201         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
12202     fi
12203 else
12204     USE_XINERAMA=
12205     XINERAMA_LINK=none
12206     AC_MSG_RESULT([no])
12208 AC_SUBST(USE_XINERAMA)
12209 AC_SUBST(XINERAMA_LINK)
12211 dnl ===================================================================
12212 dnl Test whether to build cairo or rely on the system version
12213 dnl ===================================================================
12215 if test "$USING_X11" = TRUE; then
12216     # Used in vcl/Library_vclplug_gen.mk
12217     test_cairo=yes
12220 if test "$test_cairo" = "yes"; then
12221     AC_MSG_CHECKING([whether to use the system cairo])
12223     : ${with_system_cairo:=$with_system_libs}
12224     if test "$with_system_cairo" = "yes"; then
12225         SYSTEM_CAIRO=TRUE
12226         AC_MSG_RESULT([yes])
12228         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
12229         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12230         FilterLibs "${CAIRO_LIBS}"
12231         CAIRO_LIBS="${filteredlibs}"
12233         if test "$test_xrender" = "yes"; then
12234             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
12235             AC_LANG_PUSH([C])
12236             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
12237 #ifdef PictStandardA8
12238 #else
12239       return fail;
12240 #endif
12241 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
12243             AC_LANG_POP([C])
12244         fi
12245     else
12246         SYSTEM_CAIRO=
12247         AC_MSG_RESULT([no])
12249         BUILD_TYPE="$BUILD_TYPE CAIRO"
12250     fi
12253 AC_SUBST(SYSTEM_CAIRO)
12254 AC_SUBST(CAIRO_CFLAGS)
12255 AC_SUBST(CAIRO_LIBS)
12257 dnl ===================================================================
12258 dnl Test whether to use avahi
12259 dnl ===================================================================
12260 if test "$_os" = "WINNT"; then
12261     # Windows uses bundled mDNSResponder
12262     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
12263 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12264     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12265                       [ENABLE_AVAHI="TRUE"])
12266     AC_DEFINE(HAVE_FEATURE_AVAHI)
12267     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12268     FilterLibs "${AVAHI_LIBS}"
12269     AVAHI_LIBS="${filteredlibs}"
12272 AC_SUBST(ENABLE_AVAHI)
12273 AC_SUBST(AVAHI_CFLAGS)
12274 AC_SUBST(AVAHI_LIBS)
12276 dnl ===================================================================
12277 dnl Test whether to use liblangtag
12278 dnl ===================================================================
12279 SYSTEM_LIBLANGTAG=
12280 AC_MSG_CHECKING([whether to use system liblangtag])
12281 if test "$with_system_liblangtag" = yes; then
12282     SYSTEM_LIBLANGTAG=TRUE
12283     AC_MSG_RESULT([yes])
12284     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12285     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12286     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12287     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12288     FilterLibs "${LIBLANGTAG_LIBS}"
12289     LIBLANGTAG_LIBS="${filteredlibs}"
12290 else
12291     SYSTEM_LIBLANGTAG=
12292     AC_MSG_RESULT([no])
12293     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12294     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12295     if test "$COM" = "MSC"; then
12296         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12297     else
12298         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12299     fi
12301 AC_SUBST(SYSTEM_LIBLANGTAG)
12302 AC_SUBST(LIBLANGTAG_CFLAGS)
12303 AC_SUBST(LIBLANGTAG_LIBS)
12305 dnl ===================================================================
12306 dnl Test whether to build libpng or rely on the system version
12307 dnl ===================================================================
12309 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12311 dnl ===================================================================
12312 dnl Check for runtime JVM search path
12313 dnl ===================================================================
12314 if test "$ENABLE_JAVA" != ""; then
12315     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12316     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12317         AC_MSG_RESULT([yes])
12318         if ! test -d "$with_jvm_path"; then
12319             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12320         fi
12321         if ! test -d "$with_jvm_path"jvm; then
12322             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12323         fi
12324         JVM_ONE_PATH_CHECK="$with_jvm_path"
12325         AC_SUBST(JVM_ONE_PATH_CHECK)
12326     else
12327         AC_MSG_RESULT([no])
12328     fi
12331 dnl ===================================================================
12332 dnl Test for the presence of Ant and that it works
12333 dnl ===================================================================
12335 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12336     ANT_HOME=; export ANT_HOME
12337     WITH_ANT_HOME=; export WITH_ANT_HOME
12338     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12339         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12340             if test "$_os" = "WINNT"; then
12341                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12342             else
12343                 with_ant_home="$LODE_HOME/opt/ant"
12344             fi
12345         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12346             with_ant_home="$LODE_HOME/opt/ant"
12347         fi
12348     fi
12349     if test -z "$with_ant_home"; then
12350         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12351     else
12352         if test "$_os" = "WINNT"; then
12353             # AC_PATH_PROGS needs unix path
12354             with_ant_home=`cygpath -u "$with_ant_home"`
12355         fi
12356         AbsolutePath "$with_ant_home"
12357         with_ant_home=$absolute_path
12358         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12359         WITH_ANT_HOME=$with_ant_home
12360         ANT_HOME=$with_ant_home
12361     fi
12363     if test -z "$ANT"; then
12364         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12365     else
12366         # resolve relative or absolute symlink
12367         while test -h "$ANT"; do
12368             a_cwd=`pwd`
12369             a_basename=`basename "$ANT"`
12370             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12371             cd "`dirname "$ANT"`"
12372             cd "`dirname "$a_script"`"
12373             ANT="`pwd`"/"`basename "$a_script"`"
12374             cd "$a_cwd"
12375         done
12377         AC_MSG_CHECKING([if $ANT works])
12378         mkdir -p conftest.dir
12379         a_cwd=$(pwd)
12380         cd conftest.dir
12381         cat > conftest.java << EOF
12382         public class conftest {
12383             int testmethod(int a, int b) {
12384                     return a + b;
12385             }
12386         }
12389         cat > conftest.xml << EOF
12390         <project name="conftest" default="conftest">
12391         <target name="conftest">
12392             <javac srcdir="." includes="conftest.java">
12393             </javac>
12394         </target>
12395         </project>
12398         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12399         if test $? = 0 -a -f ./conftest.class; then
12400             AC_MSG_RESULT([Ant works])
12401             if test -z "$WITH_ANT_HOME"; then
12402                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12403                 if test -z "$ANT_HOME"; then
12404                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12405                 fi
12406             else
12407                 ANT_HOME="$WITH_ANT_HOME"
12408             fi
12409         else
12410             echo "configure: Ant test failed" >&5
12411             cat conftest.java >&5
12412             cat conftest.xml >&5
12413             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12414         fi
12415         cd "$a_cwd"
12416         rm -fr conftest.dir
12417     fi
12418     if test -z "$ANT_HOME"; then
12419         ANT_HOME="NO_ANT_HOME"
12420     else
12421         PathFormat "$ANT_HOME"
12422         ANT_HOME="$formatted_path"
12423         PathFormat "$ANT"
12424         ANT="$formatted_path"
12425     fi
12426     AC_SUBST(ANT_HOME)
12427     AC_SUBST(ANT)
12429     dnl Checking for ant.jar
12430     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12431         AC_MSG_CHECKING([Ant lib directory])
12432         if test -f $ANT_HOME/lib/ant.jar; then
12433             ANT_LIB="$ANT_HOME/lib"
12434         else
12435             if test -f $ANT_HOME/ant.jar; then
12436                 ANT_LIB="$ANT_HOME"
12437             else
12438                 if test -f /usr/share/java/ant.jar; then
12439                     ANT_LIB=/usr/share/java
12440                 else
12441                     if test -f /usr/share/ant-core/lib/ant.jar; then
12442                         ANT_LIB=/usr/share/ant-core/lib
12443                     else
12444                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12445                             ANT_LIB="$ANT_HOME/lib/ant"
12446                         else
12447                             if test -f /usr/share/lib/ant/ant.jar; then
12448                                 ANT_LIB=/usr/share/lib/ant
12449                             else
12450                                 AC_MSG_ERROR([Ant libraries not found!])
12451                             fi
12452                         fi
12453                     fi
12454                 fi
12455             fi
12456         fi
12457         PathFormat "$ANT_LIB"
12458         ANT_LIB="$formatted_path"
12459         AC_MSG_RESULT([Ant lib directory found.])
12460     fi
12461     AC_SUBST(ANT_LIB)
12463     ant_minver=1.6.0
12464     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12466     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12467     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12468     ant_version_major=`echo $ant_version | cut -d. -f1`
12469     ant_version_minor=`echo $ant_version | cut -d. -f2`
12470     echo "configure: ant_version $ant_version " >&5
12471     echo "configure: ant_version_major $ant_version_major " >&5
12472     echo "configure: ant_version_minor $ant_version_minor " >&5
12473     if test "$ant_version_major" -ge "2"; then
12474         AC_MSG_RESULT([yes, $ant_version])
12475     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12476         AC_MSG_RESULT([yes, $ant_version])
12477     else
12478         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12479     fi
12481     rm -f conftest* core core.* *.core
12484 OOO_JUNIT_JAR=
12485 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12486     AC_MSG_CHECKING([for JUnit 4])
12487     if test "$with_junit" = "yes"; then
12488         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12489             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12490         elif test -e /usr/share/java/junit4.jar; then
12491             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12492         else
12493            if test -e /usr/share/lib/java/junit.jar; then
12494               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12495            else
12496               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12497            fi
12498         fi
12499     else
12500         OOO_JUNIT_JAR=$with_junit
12501     fi
12502     if test "$_os" = "WINNT"; then
12503         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12504     fi
12505     printf 'import org.junit.Before;' > conftest.java
12506     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12507         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12508     else
12509         AC_MSG_ERROR(
12510 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12511  specify its pathname via --with-junit=..., or disable it via --without-junit])
12512     fi
12513     rm -f conftest.class conftest.java
12514     if test $OOO_JUNIT_JAR != ""; then
12515     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12516     fi
12518 AC_SUBST(OOO_JUNIT_JAR)
12520 HAMCREST_JAR=
12521 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12522     AC_MSG_CHECKING([for included Hamcrest])
12523     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12524     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12525         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12526     else
12527         AC_MSG_RESULT([Not included])
12528         AC_MSG_CHECKING([for standalone hamcrest jar.])
12529         if test "$with_hamcrest" = "yes"; then
12530             if test -e /usr/share/lib/java/hamcrest.jar; then
12531                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12532             elif test -e /usr/share/java/hamcrest/core.jar; then
12533                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12534             else
12535                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12536             fi
12537         else
12538             HAMCREST_JAR=$with_hamcrest
12539         fi
12540         if test "$_os" = "WINNT"; then
12541             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12542         fi
12543         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12544             AC_MSG_RESULT([$HAMCREST_JAR])
12545         else
12546             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),
12547                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12548         fi
12549     fi
12550     rm -f conftest.class conftest.java
12552 AC_SUBST(HAMCREST_JAR)
12555 AC_SUBST(SCPDEFS)
12558 # check for wget and curl
12560 WGET=
12561 CURL=
12563 if test "$enable_fetch_external" != "no"; then
12565 CURL=`which curl 2>/dev/null`
12567 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12568     # wget new enough?
12569     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12570     if test $? -eq 0; then
12571         WGET=$i
12572         break
12573     fi
12574 done
12576 if test -z "$WGET" -a -z "$CURL"; then
12577     AC_MSG_ERROR([neither wget nor curl found!])
12582 AC_SUBST(WGET)
12583 AC_SUBST(CURL)
12586 # check for sha256sum
12588 SHA256SUM=
12590 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12591     eval "$i -a 256 --version" > /dev/null 2>&1
12592     ret=$?
12593     if test $ret -eq 0; then
12594         SHA256SUM="$i -a 256"
12595         break
12596     fi
12597 done
12599 if test -z "$SHA256SUM"; then
12600     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12601         eval "$i --version" > /dev/null 2>&1
12602         ret=$?
12603         if test $ret -eq 0; then
12604             SHA256SUM=$i
12605             break
12606         fi
12607     done
12610 if test -z "$SHA256SUM"; then
12611     AC_MSG_ERROR([no sha256sum found!])
12614 AC_SUBST(SHA256SUM)
12616 dnl ===================================================================
12617 dnl Dealing with l10n options
12618 dnl ===================================================================
12619 AC_MSG_CHECKING([which languages to be built])
12620 # get list of all languages
12621 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12622 # the sed command does the following:
12623 #   + if a line ends with a backslash, append the next line to it
12624 #   + adds " on the beginning of the value (after =)
12625 #   + adds " at the end of the value
12626 #   + removes en-US; we want to put it on the beginning
12627 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12628 [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)]
12629 ALL_LANGS="en-US $completelangiso"
12630 # check the configured localizations
12631 WITH_LANG="$with_lang"
12633 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12634 # (Norwegian is "nb" and "nn".)
12635 if test "$WITH_LANG" = "no"; then
12636     WITH_LANG=
12639 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12640     AC_MSG_RESULT([en-US])
12641 else
12642     AC_MSG_RESULT([$WITH_LANG])
12643     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12644     if test -z "$MSGFMT"; then
12645         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12646             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12647         elif test -x "/opt/lo/bin/msgfmt"; then
12648             MSGFMT="/opt/lo/bin/msgfmt"
12649         else
12650             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12651             if test -z "$MSGFMT"; then
12652                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12653             fi
12654         fi
12655     fi
12656     if test -z "$MSGUNIQ"; then
12657         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12658             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12659         elif test -x "/opt/lo/bin/msguniq"; then
12660             MSGUNIQ="/opt/lo/bin/msguniq"
12661         else
12662             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12663             if test -z "$MSGUNIQ"; then
12664                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12665             fi
12666         fi
12667     fi
12669 AC_SUBST(MSGFMT)
12670 AC_SUBST(MSGUNIQ)
12671 # check that the list is valid
12672 for lang in $WITH_LANG; do
12673     test "$lang" = "ALL" && continue
12674     # need to check for the exact string, so add space before and after the list of all languages
12675     for vl in $ALL_LANGS; do
12676         if test "$vl" = "$lang"; then
12677            break
12678         fi
12679     done
12680     if test "$vl" != "$lang"; then
12681         # if you're reading this - you prolly quoted your languages remove the quotes ...
12682         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12683     fi
12684 done
12685 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12686     echo $WITH_LANG | grep -q en-US
12687     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12689 # list with substituted ALL
12690 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12691 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12692 test "$WITH_LANG" = "en-US" && WITH_LANG=
12693 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12694     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12695     ALL_LANGS=`echo $ALL_LANGS qtz`
12697 AC_SUBST(ALL_LANGS)
12698 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12699 AC_SUBST(WITH_LANG)
12700 AC_SUBST(WITH_LANG_LIST)
12701 AC_SUBST(GIT_NEEDED_SUBMODULES)
12703 WITH_POOR_HELP_LOCALIZATIONS=
12704 if test -d "$SRC_ROOT/translations/source"; then
12705     for l in `ls -1 $SRC_ROOT/translations/source`; do
12706         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12707             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12708         fi
12709     done
12711 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12713 if test -n "$with_locales"; then
12714     WITH_LOCALES="$with_locales"
12716     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12717     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12718     # config_host/config_locales.h.in
12719     for locale in $WITH_LOCALES; do
12720         lang=${locale%_*}
12722         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12724         case $lang in
12725         hi|mr*ne)
12726             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12727             ;;
12728         bg|ru)
12729             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12730             ;;
12731         esac
12732     done
12733 else
12734     AC_DEFINE(WITH_LOCALE_ALL)
12736 AC_SUBST(WITH_LOCALES)
12738 dnl git submodule update --reference
12739 dnl ===================================================================
12740 if test -n "${GIT_REFERENCE_SRC}"; then
12741     for repo in ${GIT_NEEDED_SUBMODULES}; do
12742         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12743             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12744         fi
12745     done
12747 AC_SUBST(GIT_REFERENCE_SRC)
12749 dnl git submodules linked dirs
12750 dnl ===================================================================
12751 if test -n "${GIT_LINK_SRC}"; then
12752     for repo in ${GIT_NEEDED_SUBMODULES}; do
12753         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12754             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12755         fi
12756     done
12758 AC_SUBST(GIT_LINK_SRC)
12760 dnl branding
12761 dnl ===================================================================
12762 AC_MSG_CHECKING([for alternative branding images directory])
12763 # initialize mapped arrays
12764 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
12765 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg about.svg"
12767 if test -z "$with_branding" -o "$with_branding" = "no"; then
12768     AC_MSG_RESULT([none])
12769     DEFAULT_BRAND_IMAGES="$brand_files"
12770 else
12771     if ! test -d $with_branding ; then
12772         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12773     else
12774         AC_MSG_RESULT([$with_branding])
12775         CUSTOM_BRAND_DIR="$with_branding"
12776         for lfile in $brand_files
12777         do
12778             if ! test -f $with_branding/$lfile ; then
12779                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12780                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12781             else
12782                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12783             fi
12784         done
12785         check_for_progress="yes"
12786     fi
12788 AC_SUBST([BRAND_INTRO_IMAGES])
12789 AC_SUBST([CUSTOM_BRAND_DIR])
12790 AC_SUBST([CUSTOM_BRAND_IMAGES])
12791 AC_SUBST([DEFAULT_BRAND_IMAGES])
12794 AC_MSG_CHECKING([for 'intro' progress settings])
12795 PROGRESSBARCOLOR=
12796 PROGRESSSIZE=
12797 PROGRESSPOSITION=
12798 PROGRESSFRAMECOLOR=
12799 PROGRESSTEXTCOLOR=
12800 PROGRESSTEXTBASELINE=
12802 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12803     source "$with_branding/progress.conf"
12804     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12805 else
12806     AC_MSG_RESULT([none])
12809 AC_SUBST(PROGRESSBARCOLOR)
12810 AC_SUBST(PROGRESSSIZE)
12811 AC_SUBST(PROGRESSPOSITION)
12812 AC_SUBST(PROGRESSFRAMECOLOR)
12813 AC_SUBST(PROGRESSTEXTCOLOR)
12814 AC_SUBST(PROGRESSTEXTBASELINE)
12817 AC_MSG_CHECKING([for extra build ID])
12818 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12819     EXTRA_BUILDID="$with_extra_buildid"
12821 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12822 if test -n "$EXTRA_BUILDID" ; then
12823     AC_MSG_RESULT([$EXTRA_BUILDID])
12824 else
12825     AC_MSG_RESULT([not set])
12827 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12829 OOO_VENDOR=
12830 AC_MSG_CHECKING([for vendor])
12831 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12832     OOO_VENDOR="$USERNAME"
12834     if test -z "$OOO_VENDOR"; then
12835         OOO_VENDOR="$USER"
12836     fi
12838     if test -z "$OOO_VENDOR"; then
12839         OOO_VENDOR="`id -u -n`"
12840     fi
12842     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12843 else
12844     OOO_VENDOR="$with_vendor"
12845     AC_MSG_RESULT([$OOO_VENDOR])
12847 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12848 AC_SUBST(OOO_VENDOR)
12850 if test "$_os" = "Android" ; then
12851     ANDROID_PACKAGE_NAME=
12852     AC_MSG_CHECKING([for Android package name])
12853     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12854         if test -n "$ENABLE_DEBUG"; then
12855             # Default to the package name that makes ndk-gdb happy.
12856             ANDROID_PACKAGE_NAME="org.libreoffice"
12857         else
12858             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12859         fi
12861         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12862     else
12863         ANDROID_PACKAGE_NAME="$with_android_package_name"
12864         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12865     fi
12866     AC_SUBST(ANDROID_PACKAGE_NAME)
12869 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12870 if test "$with_compat_oowrappers" = "yes"; then
12871     WITH_COMPAT_OOWRAPPERS=TRUE
12872     AC_MSG_RESULT(yes)
12873 else
12874     WITH_COMPAT_OOWRAPPERS=
12875     AC_MSG_RESULT(no)
12877 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12879 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12880 AC_MSG_CHECKING([for install dirname])
12881 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12882     INSTALLDIRNAME="$with_install_dirname"
12884 AC_MSG_RESULT([$INSTALLDIRNAME])
12885 AC_SUBST(INSTALLDIRNAME)
12887 AC_MSG_CHECKING([for prefix])
12888 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12889 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12890 PREFIXDIR="$prefix"
12891 AC_MSG_RESULT([$PREFIXDIR])
12892 AC_SUBST(PREFIXDIR)
12894 LIBDIR=[$(eval echo $(eval echo $libdir))]
12895 AC_SUBST(LIBDIR)
12897 DATADIR=[$(eval echo $(eval echo $datadir))]
12898 AC_SUBST(DATADIR)
12900 MANDIR=[$(eval echo $(eval echo $mandir))]
12901 AC_SUBST(MANDIR)
12903 DOCDIR=[$(eval echo $(eval echo $docdir))]
12904 AC_SUBST(DOCDIR)
12906 BINDIR=[$(eval echo $(eval echo $bindir))]
12907 AC_SUBST(BINDIR)
12909 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12910 AC_SUBST(INSTALLDIR)
12912 TESTINSTALLDIR="${BUILDDIR}/test-install"
12913 AC_SUBST(TESTINSTALLDIR)
12916 # ===================================================================
12917 # OAuth2 id and secrets
12918 # ===================================================================
12920 AC_MSG_CHECKING([for Google Drive client id and secret])
12921 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12922     AC_MSG_RESULT([not set])
12923     GDRIVE_CLIENT_ID="\"\""
12924     GDRIVE_CLIENT_SECRET="\"\""
12925 else
12926     AC_MSG_RESULT([set])
12927     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12928     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12930 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12931 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12933 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12934 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12935     AC_MSG_RESULT([not set])
12936     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12937     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12938 else
12939     AC_MSG_RESULT([set])
12940     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12941     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12943 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12944 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12946 AC_MSG_CHECKING([for OneDrive client id and secret])
12947 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12948     AC_MSG_RESULT([not set])
12949     ONEDRIVE_CLIENT_ID="\"\""
12950     ONEDRIVE_CLIENT_SECRET="\"\""
12951 else
12952     AC_MSG_RESULT([set])
12953     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12954     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12956 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12957 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12960 dnl ===================================================================
12961 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12962 dnl --enable-dependency-tracking configure option
12963 dnl ===================================================================
12964 AC_MSG_CHECKING([whether to enable dependency tracking])
12965 if test "$enable_dependency_tracking" = "no"; then
12966     nodep=TRUE
12967     AC_MSG_RESULT([no])
12968 else
12969     AC_MSG_RESULT([yes])
12971 AC_SUBST(nodep)
12973 dnl ===================================================================
12974 dnl Number of CPUs to use during the build
12975 dnl ===================================================================
12976 AC_MSG_CHECKING([for number of processors to use])
12977 # plain --with-parallelism is just the default
12978 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12979     if test "$with_parallelism" = "no"; then
12980         PARALLELISM=0
12981     else
12982         PARALLELISM=$with_parallelism
12983     fi
12984 else
12985     if test "$enable_icecream" = "yes"; then
12986         PARALLELISM="40"
12987     else
12988         case `uname -s` in
12990         Darwin|FreeBSD|NetBSD|OpenBSD)
12991             PARALLELISM=`sysctl -n hw.ncpu`
12992             ;;
12994         Linux)
12995             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12996         ;;
12997         # what else than above does profit here *and* has /proc?
12998         *)
12999             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13000             ;;
13001         esac
13003         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13004         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13005     fi
13008 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13009     if test -z "$with_parallelism"; then
13010             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13011             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13012             PARALLELISM="1"
13013     else
13014         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."
13015     fi
13018 if test $PARALLELISM -eq 0; then
13019     AC_MSG_RESULT([explicit make -j option needed])
13020 else
13021     AC_MSG_RESULT([$PARALLELISM])
13023 AC_SUBST(PARALLELISM)
13025 IWYU_PATH="$with_iwyu"
13026 AC_SUBST(IWYU_PATH)
13027 if test ! -z "$IWYU_PATH"; then
13028     if test ! -f "$IWYU_PATH"; then
13029         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13030     fi
13034 # Set up ILIB for MSVC build
13036 ILIB1=
13037 if test "$build_os" = "cygwin"; then
13038     ILIB="."
13039     if test -n "$JAVA_HOME"; then
13040         ILIB="$ILIB;$JAVA_HOME/lib"
13041     fi
13042     ILIB1=-link
13043     if test "$BITNESS_OVERRIDE" = 64; then
13044         ILIB="$ILIB;$COMPATH/lib/x64"
13045         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
13046         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
13047         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
13048         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13049             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
13050             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
13051         fi
13052         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
13053         ucrtlibpath_formatted=$formatted_path
13054         ILIB="$ILIB;$ucrtlibpath_formatted"
13055         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13056     else
13057         ILIB="$ILIB;$COMPATH/lib/x86"
13058         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
13059         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
13060         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
13061         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13062             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
13063             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
13064         fi
13065         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
13066         ucrtlibpath_formatted=$formatted_path
13067         ILIB="$ILIB;$ucrtlibpath_formatted"
13068         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13069     fi
13070     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13071         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13072     else
13073         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
13074     fi
13076     AC_SUBST(ILIB)
13079 # ===================================================================
13080 # Creating bigger shared library to link against
13081 # ===================================================================
13082 AC_MSG_CHECKING([whether to create huge library])
13083 MERGELIBS=
13085 if test $_os = iOS -o $_os = Android; then
13086     # Never any point in mergelibs for these as we build just static
13087     # libraries anyway...
13088     enable_mergelibs=no
13091 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
13092     if test $_os != Linux -a $_os != WINNT; then
13093         add_warning "--enable-mergelibs is not tested for this platform"
13094     fi
13095     MERGELIBS="TRUE"
13096     AC_MSG_RESULT([yes])
13097     AC_DEFINE(ENABLE_MERGELIBS)
13098 else
13099     AC_MSG_RESULT([no])
13101 AC_SUBST([MERGELIBS])
13103 dnl ===================================================================
13104 dnl icerun is a wrapper that stops us spawning tens of processes
13105 dnl locally - for tools that can't be executed on the compile cluster
13106 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
13107 dnl ===================================================================
13108 AC_MSG_CHECKING([whether to use icerun wrapper])
13109 ICECREAM_RUN=
13110 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
13111     ICECREAM_RUN=icerun
13112     AC_MSG_RESULT([yes])
13113 else
13114     AC_MSG_RESULT([no])
13116 AC_SUBST(ICECREAM_RUN)
13118 dnl ===================================================================
13119 dnl Setup the ICECC_VERSION for the build the same way it was set for
13120 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
13121 dnl ===================================================================
13122 x_ICECC_VERSION=[\#]
13123 if test -n "$ICECC_VERSION" ; then
13124     x_ICECC_VERSION=
13126 AC_SUBST(x_ICECC_VERSION)
13127 AC_SUBST(ICECC_VERSION)
13129 dnl ===================================================================
13131 AC_MSG_CHECKING([MPL subset])
13132 MPL_SUBSET=
13134 if test "$enable_mpl_subset" = "yes"; then
13135     warn_report=false
13136     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13137         warn_report=true
13138     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
13139         warn_report=true
13140     fi
13141     if test "$warn_report" = "true"; then
13142         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
13143     fi
13144     if test "x$enable_postgresql_sdbc" != "xno"; then
13145         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
13146     fi
13147     if test "$enable_lotuswordpro" = "yes"; then
13148         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
13149     fi
13150     if test "$WITH_WEBDAV" = "neon"; then
13151         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
13152     fi
13153     if test -n "$ENABLE_POPPLER"; then
13154         if test "x$SYSTEM_POPPLER" = "x"; then
13155             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
13156         fi
13157     fi
13158     # cf. m4/libo_check_extension.m4
13159     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
13160         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
13161     fi
13162     for theme in $WITH_THEMES; do
13163         case $theme in
13164         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sukapura|sukapura_svg) #blacklist of icon themes under GPL or LGPL
13165             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
13166         *) : ;;
13167         esac
13168     done
13170     ENABLE_OPENGL_TRANSITIONS=
13172     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
13173         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
13174     fi
13176     MPL_SUBSET="TRUE"
13177     AC_DEFINE(MPL_HAVE_SUBSET)
13178     AC_MSG_RESULT([only])
13179 else
13180     AC_MSG_RESULT([no restrictions])
13182 AC_SUBST(MPL_SUBSET)
13184 dnl ===================================================================
13186 AC_MSG_CHECKING([formula logger])
13187 ENABLE_FORMULA_LOGGER=
13189 if test "x$enable_formula_logger" = "xyes"; then
13190     AC_MSG_RESULT([yes])
13191     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13192     ENABLE_FORMULA_LOGGER=TRUE
13193 elif test -n "$ENABLE_DBGUTIL" ; then
13194     AC_MSG_RESULT([yes])
13195     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13196     ENABLE_FORMULA_LOGGER=TRUE
13197 else
13198     AC_MSG_RESULT([no])
13201 AC_SUBST(ENABLE_FORMULA_LOGGER)
13203 dnl ===================================================================
13204 dnl Checking for active Antivirus software.
13205 dnl ===================================================================
13207 if test $_os = WINNT ; then
13208     AC_MSG_CHECKING([for active Antivirus software])
13209     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
13210     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
13211         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
13212             AC_MSG_RESULT([found])
13213             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
13214             echo $EICAR_STRING > $SRC_ROOT/eicar
13215             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
13216             rm $SRC_ROOT/eicar
13217             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13218                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13219             fi
13220             echo $EICAR_STRING > $BUILDDIR/eicar
13221             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
13222             rm $BUILDDIR/eicar
13223             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13224                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13225             fi
13226             add_warning "To speed up builds and avoid failures in unit tests, it is highly recommended that you exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST"
13227         else
13228             AC_MSG_RESULT([not found])
13229         fi
13230     else
13231         AC_MSG_RESULT([n/a])
13232     fi
13235 dnl ===================================================================
13236 dnl Setting up the environment.
13237 dnl ===================================================================
13238 AC_MSG_NOTICE([setting up the build environment variables...])
13240 AC_SUBST(COMPATH)
13242 if test "$build_os" = "cygwin"; then
13243     if test -d "$COMPATH/atlmfc/lib/spectre"; then
13244         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
13245         ATL_INCLUDE="$COMPATH/atlmfc/include"
13246     elif test -d "$COMPATH/atlmfc/lib"; then
13247         ATL_LIB="$COMPATH/atlmfc/lib"
13248         ATL_INCLUDE="$COMPATH/atlmfc/include"
13249     else
13250         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
13251         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
13252     fi
13253     if test "$BITNESS_OVERRIDE" = 64; then
13254         ATL_LIB="$ATL_LIB/x64"
13255     else
13256         ATL_LIB="$ATL_LIB/x86"
13257     fi
13258     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
13259     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
13261     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
13262     PathFormat "/usr/bin/find.exe"
13263     FIND="$formatted_path"
13264     PathFormat "/usr/bin/sort.exe"
13265     SORT="$formatted_path"
13266     PathFormat "/usr/bin/grep.exe"
13267     WIN_GREP="$formatted_path"
13268     PathFormat "/usr/bin/ls.exe"
13269     WIN_LS="$formatted_path"
13270     PathFormat "/usr/bin/touch.exe"
13271     WIN_TOUCH="$formatted_path"
13272 else
13273     FIND=find
13274     SORT=sort
13277 AC_SUBST(ATL_INCLUDE)
13278 AC_SUBST(ATL_LIB)
13279 AC_SUBST(FIND)
13280 AC_SUBST(SORT)
13281 AC_SUBST(WIN_GREP)
13282 AC_SUBST(WIN_LS)
13283 AC_SUBST(WIN_TOUCH)
13285 AC_SUBST(BUILD_TYPE)
13287 AC_SUBST(SOLARINC)
13289 PathFormat "$PERL"
13290 PERL="$formatted_path"
13291 AC_SUBST(PERL)
13293 if test -n "$TMPDIR"; then
13294     TEMP_DIRECTORY="$TMPDIR"
13295 else
13296     TEMP_DIRECTORY="/tmp"
13298 if test "$build_os" = "cygwin"; then
13299     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
13301 AC_SUBST(TEMP_DIRECTORY)
13303 # setup the PATH for the environment
13304 if test -n "$LO_PATH_FOR_BUILD"; then
13305     LO_PATH="$LO_PATH_FOR_BUILD"
13306 else
13307     LO_PATH="$PATH"
13309     case "$host_os" in
13311     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13312         if test "$ENABLE_JAVA" != ""; then
13313             pathmunge "$JAVA_HOME/bin" "after"
13314         fi
13315         ;;
13317     cygwin*)
13318         # Win32 make needs native paths
13319         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13320             LO_PATH=`cygpath -p -m "$PATH"`
13321         fi
13322         if test "$BITNESS_OVERRIDE" = 64; then
13323             # needed for msi packaging
13324             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13325         fi
13326         # .NET 4.6 and higher don't have bin directory
13327         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13328             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13329         fi
13330         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13331         pathmunge "$CSC_PATH" "before"
13332         pathmunge "$MIDL_PATH" "before"
13333         pathmunge "$AL_PATH" "before"
13334         pathmunge "$MSPDB_PATH" "before"
13335         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13336             pathmunge "$CL_PATH" "before"
13337         fi
13338         if test -n "$MSBUILD_PATH" ; then
13339             pathmunge "$MSBUILD_PATH" "before"
13340         fi
13341         if test "$BITNESS_OVERRIDE" = 64; then
13342             pathmunge "$COMPATH/bin/amd64" "before"
13343             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13344         else
13345             pathmunge "$COMPATH/bin" "before"
13346             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13347         fi
13348         if test "$ENABLE_JAVA" != ""; then
13349             if test -d "$JAVA_HOME/jre/bin/client"; then
13350                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13351             fi
13352             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13353                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13354             fi
13355             pathmunge "$JAVA_HOME/bin" "before"
13356         fi
13357         ;;
13359     solaris*)
13360         pathmunge "/usr/css/bin" "before"
13361         if test "$ENABLE_JAVA" != ""; then
13362             pathmunge "$JAVA_HOME/bin" "after"
13363         fi
13364         ;;
13365     esac
13368 AC_SUBST(LO_PATH)
13370 libo_FUZZ_SUMMARY
13372 # Generate a configuration sha256 we can use for deps
13373 if test -f config_host.mk; then
13374     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13376 if test -f config_host_lang.mk; then
13377     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13380 CFLAGS=$my_original_CFLAGS
13381 CXXFLAGS=$my_original_CXXFLAGS
13382 CPPFLAGS=$my_original_CPPFLAGS
13384 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
13385 # BUILD platform configuration] - otherwise breaks cross building
13386 AC_CONFIG_FILES([config_host.mk
13387                  config_host_lang.mk
13388                  Makefile
13389                  bin/bffvalidator.sh
13390                  bin/odfvalidator.sh
13391                  bin/officeotron.sh
13392                  hardened_runtime.xcent
13393                  instsetoo_native/util/openoffice.lst
13394                  sysui/desktop/macosx/Info.plist])
13395 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13396 AC_CONFIG_HEADERS([config_host/config_clang.h])
13397 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13398 AC_CONFIG_HEADERS([config_host/config_eot.h])
13399 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13400 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13401 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13402 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13403 AC_CONFIG_HEADERS([config_host/config_features.h])
13404 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13405 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13406 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13407 AC_CONFIG_HEADERS([config_host/config_folders.h])
13408 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13409 AC_CONFIG_HEADERS([config_host/config_gio.h])
13410 AC_CONFIG_HEADERS([config_host/config_global.h])
13411 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13412 AC_CONFIG_HEADERS([config_host/config_java.h])
13413 AC_CONFIG_HEADERS([config_host/config_langs.h])
13414 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13415 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13416 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13417 AC_CONFIG_HEADERS([config_host/config_locales.h])
13418 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13419 AC_CONFIG_HEADERS([config_host/config_oox.h])
13420 AC_CONFIG_HEADERS([config_host/config_options.h])
13421 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13422 AC_CONFIG_HEADERS([config_host/config_skia.h])
13423 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13424 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13425 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13426 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13427 AC_CONFIG_HEADERS([config_host/config_version.h])
13428 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13429 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13430 AC_CONFIG_HEADERS([config_host/config_python.h])
13431 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13432 AC_OUTPUT
13434 if test "$CROSS_COMPILING" = TRUE; then
13435     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13438 # touch the config timestamp file
13439 if test ! -f config_host.mk.stamp; then
13440     echo > config_host.mk.stamp
13441 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13442     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13443 else
13444     echo > config_host.mk.stamp
13447 # touch the config lang timestamp file
13448 if test ! -f config_host_lang.mk.stamp; then
13449     echo > config_host_lang.mk.stamp
13450 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13451     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13452 else
13453     echo > config_host_lang.mk.stamp
13457 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13458         -a "$build_os" = "cygwin"; then
13460 cat << _EOS
13461 ****************************************************************************
13462 WARNING:
13463 Your make version is known to be horribly slow, and hard to debug
13464 problems with. To get a reasonably functional make please do:
13466 to install a pre-compiled binary make for Win32
13468  mkdir -p /opt/lo/bin
13469  cd /opt/lo/bin
13470  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13471  cp make-4.2.1-msvc.exe make
13472  chmod +x make
13474 to install from source:
13475 place yourself in a working directory of you choice.
13477  git clone git://git.savannah.gnu.org/make.git
13479  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
13480  set PATH=%PATH%;C:\Cygwin\bin
13481  [or Cygwin64, if that is what you have]
13482  cd path-to-make-repo-you-cloned-above
13483  build_w32.bat --without-guile
13485 should result in a WinRel/gnumake.exe.
13486 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13488 Then re-run autogen.sh
13490 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13491 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13493 _EOS
13494 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13495     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13500 cat << _EOF
13501 ****************************************************************************
13503 To build, run:
13504 $GNUMAKE
13506 To view some help, run:
13507 $GNUMAKE help
13509 _EOF
13511 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13512     cat << _EOF
13513 After the build has finished successfully, you can immediately run what you built using the command:
13514 _EOF
13516     if test $_os = Darwin; then
13517         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
13518     else
13519         echo instdir/program/soffice
13520     fi
13521     cat << _EOF
13523 If you want to run the smoketest, run:
13524 $GNUMAKE check
13526 _EOF
13529 if test -f warn; then
13530     cat warn
13531     rm warn
13534 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: