tdf#133853 Large spreadsheets have 16385 columns instead of 16384
[LibreOffice.git] / configure.ac
blobce2cdec3be4c5142a7c331a96f8ddc3f610e2e56
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 HOST_PLATFORM="$host"
602 host_cpu_for_clang="$host_cpu"
604 case "$host_os" in
606 solaris*)
607     build_gstreamer_1_0=yes
608     test_freetype=yes
609     build_skia=yes
610     _os=SunOS
612     dnl ===========================================================
613     dnl Check whether we're using Solaris 10 - SPARC or Intel.
614     dnl ===========================================================
615     AC_MSG_CHECKING([the Solaris operating system release])
616     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
617     if test "$_os_release" -lt "10"; then
618         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
619     else
620         AC_MSG_RESULT([ok ($_os_release)])
621     fi
623     dnl Check whether we're using a SPARC or i386 processor
624     AC_MSG_CHECKING([the processor type])
625     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
626         AC_MSG_RESULT([ok ($host_cpu)])
627     else
628         AC_MSG_ERROR([only SPARC and i386 processors are supported])
629     fi
630     ;;
632 linux-gnu*|k*bsd*-gnu*)
633     build_gstreamer_1_0=yes
634     test_kf5=yes
635     test_gtk3_kde5=yes
636     build_skia=yes
637     test_gdb_index=yes
638     test_split_debug=yes
639     if test "$enable_fuzzers" != yes; then
640         test_freetype=yes
641         test_fontconfig=yes
642     else
643         test_freetype=no
644         test_fontconfig=no
645         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
646     fi
647     _os=Linux
648     ;;
650 gnu)
651     test_randr=no
652     test_xrender=no
653     _os=GNU
654      ;;
656 cygwin*|interix*)
658     # When building on Windows normally with MSVC under Cygwin,
659     # configure thinks that the host platform (the platform the
660     # built code will run on) is Cygwin, even if it obviously is
661     # Windows, which in Autoconf terminology is called
662     # "mingw32". (Which is misleading as MinGW is the name of the
663     # tool-chain, not an operating system.)
665     # Somewhat confusing, yes. But this configure script doesn't
666     # look at $host etc that much, it mostly uses its own $_os
667     # variable, set here in this case statement.
669     test_cups=no
670     test_dbus=no
671     test_randr=no
672     test_xrender=no
673     test_freetype=no
674     test_fontconfig=no
675     build_skia=yes
676     _os=WINNT
678     DLLPOST=".dll"
679     LINKFLAGSNOUNDEFS=
680     ;;
682 darwin*|macos*) # macOS
683     test_randr=no
684     test_xrender=no
685     test_freetype=no
686     test_fontconfig=no
687     test_dbus=no
688     if test -n "$LODE_HOME" ; then
689         mac_sanitize_path
690         AC_MSG_NOTICE([sanitized the PATH to $PATH])
691     fi
692     _os=Darwin
693     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
694     INSTROOTCONTENTSUFFIX=/Contents
695     SDKDIRNAME=${PRODUCTNAME}${PRODUCTVERSION}_SDK
696     # See comment above the case "$host_os"
697     LINKFLAGSSHL="-dynamiclib -single_module"
699     # -fPIC is default
700     PICSWITCH=""
702     DLLPOST=".dylib"
704     # -undefined error is the default
705     LINKFLAGSNOUNDEFS=""
706     case "$host_cpu" in
707     aarch64|arm64)
708         case "$host_os" in
709         macos*)
710             # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
711             # the "macos" part so be sure to use aarch64-apple-darwin for now.
712             HOST_PLATFORM=aarch64-apple-darwin
713             ;;
714         esac
716         # Apple's Clang uses "arm64"
717         host_cpu_for_clang=arm64
718     esac
721 ios*) # iOS
722     test_randr=no
723     test_xrender=no
724     test_freetype=no
725     test_fontconfig=no
726     test_dbus=no
727     if test -n "$LODE_HOME" ; then
728         mac_sanitize_path
729         AC_MSG_NOTICE([sanitized the PATH to $PATH])
730     fi
731     enable_gpgmepp=no
732     _os=iOS
733     test_cups=no
734     enable_mpl_subset=yes
735     enable_lotuswordpro=no
736     enable_coinmp=no
737     enable_lpsolve=no
738     enable_postgresql_sdbc=no
739     enable_extension_integration=no
740     enable_report_builder=no
741     with_ppds=no
742     if test "$enable_ios_simulator" = "yes"; then
743         host=x86_64-apple-darwin
744     fi
745     # See comment above the case "$host_os"
746     LINKFLAGSSHL="-dynamiclib -single_module"
748     # -fPIC is default
749     PICSWITCH=""
751     DLLPOST=".dylib"
753     # -undefined error is the default
754     LINKFLAGSNOUNDEFS=""
756     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
757     # part, so use aarch64-apple-darwin for now.
758     HOST_PLATFORM=aarch64-apple-darwin
760     # Apple's Clang uses "arm64"
761     host_cpu_for_clang=arm64
764 freebsd*)
765     build_gstreamer_1_0=yes
766     test_kf5=yes
767     test_gtk3_kde5=yes
768     test_freetype=yes
769     build_skia=yes
770     AC_MSG_CHECKING([the FreeBSD operating system release])
771     if test -n "$with_os_version"; then
772         OSVERSION="$with_os_version"
773     else
774         OSVERSION=`/sbin/sysctl -n kern.osreldate`
775     fi
776     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
777     AC_MSG_CHECKING([which thread library to use])
778     if test "$OSVERSION" -lt "500016"; then
779         PTHREAD_CFLAGS="-D_THREAD_SAFE"
780         PTHREAD_LIBS="-pthread"
781     elif test "$OSVERSION" -lt "502102"; then
782         PTHREAD_CFLAGS="-D_THREAD_SAFE"
783         PTHREAD_LIBS="-lc_r"
784     else
785         PTHREAD_CFLAGS=""
786         PTHREAD_LIBS="-pthread"
787     fi
788     AC_MSG_RESULT([$PTHREAD_LIBS])
789     _os=FreeBSD
790     ;;
792 *netbsd*)
793     build_gstreamer_1_0=yes
794     test_kf5=yes
795     test_gtk3_kde5=yes
796     test_freetype=yes
797     build_skia=yes
798     PTHREAD_LIBS="-pthread -lpthread"
799     _os=NetBSD
800     ;;
802 aix*)
803     test_randr=no
804     test_freetype=yes
805     PTHREAD_LIBS=-pthread
806     _os=AIX
807     ;;
809 openbsd*)
810     test_freetype=yes
811     PTHREAD_CFLAGS="-D_THREAD_SAFE"
812     PTHREAD_LIBS="-pthread"
813     _os=OpenBSD
814     ;;
816 dragonfly*)
817     build_gstreamer_1_0=yes
818     test_kf5=yes
819     test_gtk3_kde5=yes
820     test_freetype=yes
821     build_skia=yes
822     PTHREAD_LIBS="-pthread"
823     _os=DragonFly
824     ;;
826 linux-android*)
827     build_gstreamer_1_0=no
828     enable_lotuswordpro=no
829     enable_mpl_subset=yes
830     enable_coinmp=yes
831     enable_lpsolve=no
832     enable_report_builder=no
833     enable_odk=no
834     enable_postgresql_sdbc=no
835     enable_python=no
836     test_cups=no
837     test_dbus=no
838     test_fontconfig=no
839     test_freetype=no
840     test_kf5=no
841     test_qt5=no
842     test_gtk3_kde5=no
843     test_randr=no
844     test_xrender=no
845     _os=Android
847     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
848     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
849     ;;
851 haiku*)
852     test_cups=no
853     test_dbus=no
854     test_randr=no
855     test_xrender=no
856     test_freetype=yes
857     enable_odk=no
858     enable_gstreamer_1_0=no
859     enable_vlc=no
860     enable_coinmp=no
861     enable_pdfium=no
862     enable_sdremote=no
863     enable_postgresql_sdbc=no
864     enable_firebird_sdbc=no
865     _os=Haiku
866     ;;
869     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
870     ;;
871 esac
873 AC_SUBST(HOST_PLATFORM)
875 if test "$_os" = "Android" ; then
876     # Verify that the NDK and SDK options are proper
877     if test -z "$with_android_ndk"; then
878         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
879     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
880         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
881     fi
883     if test -z "$ANDROID_SDK_HOME"; then
884         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
885     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
886         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
887     fi
889     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
890     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
891         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
892                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
893                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
894         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
895         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
896         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
897     fi
898     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
899         AC_MSG_WARN([android support repository not found - install with
900                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
901                      to allow the build to download the specified version of the android support libraries])
902         add_warning "android support repository not found - install with"
903         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
904         add_warning "to allow the build to download the specified version of the android support libraries"
905     fi
908 if test "$_os" = "AIX"; then
909     AC_PATH_PROG(GAWK, gawk)
910     if test -z "$GAWK"; then
911         AC_MSG_ERROR([gawk not found in \$PATH])
912     fi
915 AC_SUBST(SDKDIRNAME)
917 AC_SUBST(PTHREAD_CFLAGS)
918 AC_SUBST(PTHREAD_LIBS)
920 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
921 # By default use the ones specified by our build system,
922 # but explicit override is possible.
923 AC_MSG_CHECKING(for explicit AFLAGS)
924 if test -n "$AFLAGS"; then
925     AC_MSG_RESULT([$AFLAGS])
926     x_AFLAGS=
927 else
928     AC_MSG_RESULT(no)
929     x_AFLAGS=[\#]
931 AC_MSG_CHECKING(for explicit CFLAGS)
932 if test -n "$CFLAGS"; then
933     AC_MSG_RESULT([$CFLAGS])
934     x_CFLAGS=
935 else
936     AC_MSG_RESULT(no)
937     x_CFLAGS=[\#]
939 AC_MSG_CHECKING(for explicit CXXFLAGS)
940 if test -n "$CXXFLAGS"; then
941     AC_MSG_RESULT([$CXXFLAGS])
942     x_CXXFLAGS=
943 else
944     AC_MSG_RESULT(no)
945     x_CXXFLAGS=[\#]
947 AC_MSG_CHECKING(for explicit OBJCFLAGS)
948 if test -n "$OBJCFLAGS"; then
949     AC_MSG_RESULT([$OBJCFLAGS])
950     x_OBJCFLAGS=
951 else
952     AC_MSG_RESULT(no)
953     x_OBJCFLAGS=[\#]
955 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
956 if test -n "$OBJCXXFLAGS"; then
957     AC_MSG_RESULT([$OBJCXXFLAGS])
958     x_OBJCXXFLAGS=
959 else
960     AC_MSG_RESULT(no)
961     x_OBJCXXFLAGS=[\#]
963 AC_MSG_CHECKING(for explicit LDFLAGS)
964 if test -n "$LDFLAGS"; then
965     AC_MSG_RESULT([$LDFLAGS])
966     x_LDFLAGS=
967 else
968     AC_MSG_RESULT(no)
969     x_LDFLAGS=[\#]
971 AC_SUBST(AFLAGS)
972 AC_SUBST(CFLAGS)
973 AC_SUBST(CXXFLAGS)
974 AC_SUBST(OBJCFLAGS)
975 AC_SUBST(OBJCXXFLAGS)
976 AC_SUBST(LDFLAGS)
977 AC_SUBST(x_AFLAGS)
978 AC_SUBST(x_CFLAGS)
979 AC_SUBST(x_CXXFLAGS)
980 AC_SUBST(x_OBJCFLAGS)
981 AC_SUBST(x_OBJCXXFLAGS)
982 AC_SUBST(x_LDFLAGS)
984 dnl These are potentially set for MSVC, in the code checking for UCRT below:
985 my_original_CFLAGS=$CFLAGS
986 my_original_CXXFLAGS=$CXXFLAGS
987 my_original_CPPFLAGS=$CPPFLAGS
989 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
990 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
991 dnl AC_PROG_CC internally.
992 if test "$_os" != "WINNT"; then
993     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
994     save_CFLAGS=$CFLAGS
995     AC_PROG_CC
996     CFLAGS=$save_CFLAGS
997     if test -z "$CC_BASE"; then
998         CC_BASE=`first_arg_basename "$CC"`
999     fi
1002 if test "$_os" != "WINNT"; then
1003     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1004 else
1005     ENDIANNESS=little
1007 AC_SUBST(ENDIANNESS)
1009 if test $_os != "WINNT"; then
1010     save_LIBS="$LIBS"
1011     AC_SEARCH_LIBS([dlsym], [dl],
1012         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1013         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1014     LIBS="$save_LIBS"
1016 AC_SUBST(DLOPEN_LIBS)
1018 AC_ARG_ENABLE(ios-simulator,
1019     AS_HELP_STRING([--enable-ios-simulator],
1020         [build i386 or x86_64 for ios simulator])
1023 AC_ARG_ENABLE(ios-libreofficelight-app,
1024     AS_HELP_STRING([--enable-ios-libreofficelight-app],
1025         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
1026          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
1027          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
1030 ENABLE_IOS_LIBREOFFICELIGHT_APP=
1031 if test "$enable_ios_libreofficelight_app" = yes; then
1032     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
1034 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
1036 ###############################################################################
1037 # Extensions switches --enable/--disable
1038 ###############################################################################
1039 # By default these should be enabled unless having extra dependencies.
1040 # If there is extra dependency over configure options then the enable should
1041 # be automagic based on whether the requiring feature is enabled or not.
1042 # All this options change anything only with --enable-extension-integration.
1044 # The name of this option and its help string makes it sound as if
1045 # extensions are built anyway, just not integrated in the installer,
1046 # if you use --disable-extension-integration. Is that really the
1047 # case?
1049 libo_FUZZ_ARG_ENABLE(extension-integration,
1050     AS_HELP_STRING([--disable-extension-integration],
1051         [Disable integration of the built extensions in the installer of the
1052          product. Use this switch to disable the integration.])
1055 AC_ARG_ENABLE(avmedia,
1056     AS_HELP_STRING([--disable-avmedia],
1057         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1060 AC_ARG_ENABLE(database-connectivity,
1061     AS_HELP_STRING([--disable-database-connectivity],
1062         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1065 # This doesn't mean not building (or "integrating") extensions
1066 # (although it probably should; i.e. it should imply
1067 # --disable-extension-integration I guess), it means not supporting
1068 # any extension mechanism at all
1069 libo_FUZZ_ARG_ENABLE(extensions,
1070     AS_HELP_STRING([--disable-extensions],
1071         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1074 AC_ARG_ENABLE(scripting,
1075     AS_HELP_STRING([--disable-scripting],
1076         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1079 # This is mainly for Android and iOS, but could potentially be used in some
1080 # special case otherwise, too, so factored out as a separate setting
1082 AC_ARG_ENABLE(dynamic-loading,
1083     AS_HELP_STRING([--disable-dynamic-loading],
1084         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1087 libo_FUZZ_ARG_ENABLE(report-builder,
1088     AS_HELP_STRING([--disable-report-builder],
1089         [Disable the Report Builder.])
1092 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1093     AS_HELP_STRING([--enable-ext-wiki-publisher],
1094         [Enable the Wiki Publisher extension.])
1097 libo_FUZZ_ARG_ENABLE(lpsolve,
1098     AS_HELP_STRING([--disable-lpsolve],
1099         [Disable compilation of the lp solve solver ])
1101 libo_FUZZ_ARG_ENABLE(coinmp,
1102     AS_HELP_STRING([--disable-coinmp],
1103         [Disable compilation of the CoinMP solver ])
1106 libo_FUZZ_ARG_ENABLE(pdfimport,
1107     AS_HELP_STRING([--disable-pdfimport],
1108         [Disable building the PDF import feature.])
1111 libo_FUZZ_ARG_ENABLE(pdfium,
1112     AS_HELP_STRING([--disable-pdfium],
1113         [Disable building PDFium.])
1116 libo_FUZZ_ARG_ENABLE(skia,
1117     AS_HELP_STRING([--disable-skia],
1118         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1121 ###############################################################################
1123 dnl ---------- *** ----------
1125 libo_FUZZ_ARG_ENABLE(mergelibs,
1126     AS_HELP_STRING([--enable-mergelibs],
1127         [Merge several of the smaller libraries into one big, "merged", one.])
1130 libo_FUZZ_ARG_ENABLE(breakpad,
1131     AS_HELP_STRING([--enable-breakpad],
1132         [Enables breakpad for crash reporting.])
1135 libo_FUZZ_ARG_ENABLE(crashdump,
1136     AS_HELP_STRING([--disable-crashdump],
1137         [Disable dump.ini and dump-file, when --enable-breakpad])
1140 AC_ARG_ENABLE(fetch-external,
1141     AS_HELP_STRING([--disable-fetch-external],
1142         [Disables fetching external tarballs from web sources.])
1145 AC_ARG_ENABLE(fuzzers,
1146     AS_HELP_STRING([--enable-fuzzers],
1147         [Enables building libfuzzer targets for fuzz testing.])
1150 libo_FUZZ_ARG_ENABLE(pch,
1151     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1152         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1153          Using 'system' will include only external headers, 'base' will add also headers
1154          from base modules, 'normal' will also add all headers except from the module built,
1155          'full' will use all suitable headers even from a module itself.])
1158 libo_FUZZ_ARG_ENABLE(epm,
1159     AS_HELP_STRING([--enable-epm],
1160         [LibreOffice includes self-packaging code, that requires epm, however epm is
1161          useless for large scale package building.])
1164 libo_FUZZ_ARG_ENABLE(odk,
1165     AS_HELP_STRING([--disable-odk],
1166         [LibreOffice includes an ODK, office development kit which some packagers may
1167          wish to build without.])
1170 AC_ARG_ENABLE(mpl-subset,
1171     AS_HELP_STRING([--enable-mpl-subset],
1172         [Don't compile any pieces which are not MPL or more liberally licensed])
1175 libo_FUZZ_ARG_ENABLE(evolution2,
1176     AS_HELP_STRING([--enable-evolution2],
1177         [Allows the built-in evolution 2 addressbook connectivity build to be
1178          enabled.])
1181 AC_ARG_ENABLE(avahi,
1182     AS_HELP_STRING([--enable-avahi],
1183         [Determines whether to use Avahi to advertise Impress to remote controls.])
1186 libo_FUZZ_ARG_ENABLE(werror,
1187     AS_HELP_STRING([--enable-werror],
1188         [Turn warnings to errors. (Has no effect in modules where the treating
1189          of warnings as errors is disabled explicitly.)]),
1192 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1193     AS_HELP_STRING([--enable-assert-always-abort],
1194         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1197 libo_FUZZ_ARG_ENABLE(dbgutil,
1198     AS_HELP_STRING([--enable-dbgutil],
1199         [Provide debugging support from --enable-debug and include additional debugging
1200          utilities such as object counting or more expensive checks.
1201          This is the recommended option for developers.
1202          Note that this makes the build ABI incompatible, it is not possible to mix object
1203          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1205 libo_FUZZ_ARG_ENABLE(debug,
1206     AS_HELP_STRING([--enable-debug],
1207         [Include debugging information, disable compiler optimization and inlining plus
1208          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1210 libo_FUZZ_ARG_ENABLE(split-debug,
1211     AS_HELP_STRING([--disable-split-debug],
1212         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1213          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1215 libo_FUZZ_ARG_ENABLE(gdb-index,
1216     AS_HELP_STRING([--disable-gdb-index],
1217         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1218          The feature requires the gold or lld linker.]))
1220 libo_FUZZ_ARG_ENABLE(sal-log,
1221     AS_HELP_STRING([--enable-sal-log],
1222         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1224 libo_FUZZ_ARG_ENABLE(symbols,
1225     AS_HELP_STRING([--enable-symbols],
1226         [Generate debug information.
1227          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1228          otherwise. It is possible to explicitly specify gbuild build targets
1229          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1230          everything in the directory; there is no ordering, more specific overrides
1231          more general, and disabling takes precedence).
1232          Example: --enable-symbols="all -sw/ -Library_sc".]))
1234 libo_FUZZ_ARG_ENABLE(optimized,
1235     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1236         [Whether to compile with optimization flags.
1237          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1238          otherwise. Using 'debug' will try to use only optimizations that should
1239          not interfere with debugging.]))
1241 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1242     AS_HELP_STRING([--disable-runtime-optimizations],
1243         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1244          JVM JIT) that are known to interact badly with certain dynamic analysis
1245          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1246          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1247          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1249 AC_ARG_WITH(valgrind,
1250     AS_HELP_STRING([--with-valgrind],
1251         [Make availability of Valgrind headers a hard requirement.]))
1253 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1254     AS_HELP_STRING([--enable-compiler-plugins],
1255         [Enable compiler plugins that will perform additional checks during
1256          building. Enabled automatically by --enable-dbgutil.
1257          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1258 COMPILER_PLUGINS_DEBUG=
1259 if test "$enable_compiler_plugins" = debug; then
1260     enable_compiler_plugins=yes
1261     COMPILER_PLUGINS_DEBUG=TRUE
1264 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1265     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1266         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1267          relevant in the --disable-compiler-plugins case.]))
1269 libo_FUZZ_ARG_ENABLE(ooenv,
1270     AS_HELP_STRING([--disable-ooenv],
1271         [Disable ooenv for the instdir installation.]))
1273 AC_ARG_ENABLE(lto,
1274     AS_HELP_STRING([--enable-lto],
1275         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1276          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1277          linker. For MSVC, this option is broken at the moment. This is experimental work
1278          in progress that shouldn't be used unless you are working on it.)]))
1280 AC_ARG_ENABLE(python,
1281     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1282         [Enables or disables Python support at run-time.
1283          Also specifies what Python to use at build-time.
1284          'fully-internal' even forces the internal version for uses of Python
1285          during the build.
1286          On macOS the only choices are
1287          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1288          ]))
1290 libo_FUZZ_ARG_ENABLE(gtk3,
1291     AS_HELP_STRING([--disable-gtk3],
1292         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1293 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1295 AC_ARG_ENABLE(introspection,
1296     AS_HELP_STRING([--enable-introspection],
1297         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1298          Linux distributions.)]))
1300 AC_ARG_ENABLE(split-app-modules,
1301     AS_HELP_STRING([--enable-split-app-modules],
1302         [Split file lists for app modules, e.g. base, calc.
1303          Has effect only with make distro-pack-install]),
1306 AC_ARG_ENABLE(split-opt-features,
1307     AS_HELP_STRING([--enable-split-opt-features],
1308         [Split file lists for some optional features, e.g. pyuno, testtool.
1309          Has effect only with make distro-pack-install]),
1312 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1313     AS_HELP_STRING([--disable-cairo-canvas],
1314         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1317 libo_FUZZ_ARG_ENABLE(dbus,
1318     AS_HELP_STRING([--disable-dbus],
1319         [Determines whether to enable features that depend on dbus.
1320          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1321 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1323 libo_FUZZ_ARG_ENABLE(sdremote,
1324     AS_HELP_STRING([--disable-sdremote],
1325         [Determines whether to enable Impress remote control (i.e. the server component).]),
1326 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1328 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1329     AS_HELP_STRING([--disable-sdremote-bluetooth],
1330         [Determines whether to build sdremote with bluetooth support.
1331          Requires dbus on Linux.]))
1333 libo_FUZZ_ARG_ENABLE(gio,
1334     AS_HELP_STRING([--disable-gio],
1335         [Determines whether to use the GIO support.]),
1336 ,test "${enable_gio+set}" = set || enable_gio=yes)
1338 AC_ARG_ENABLE(qt5,
1339     AS_HELP_STRING([--enable-qt5],
1340         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1341          available.]),
1344 AC_ARG_ENABLE(kf5,
1345     AS_HELP_STRING([--enable-kf5],
1346         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1347          KF5 are available.]),
1350 AC_ARG_ENABLE(kde5,
1351     AS_HELP_STRING([--enable-kde5],
1352         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1355 AC_ARG_ENABLE(gtk3_kde5,
1356     AS_HELP_STRING([--enable-gtk3-kde5],
1357         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1358          platforms where Gtk3, Qt5 and Plasma is available.]),
1361 AC_ARG_ENABLE(gui,
1362     AS_HELP_STRING([--disable-gui],
1363         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1364 ,enable_gui=yes)
1366 libo_FUZZ_ARG_ENABLE(randr,
1367     AS_HELP_STRING([--disable-randr],
1368         [Disable RandR support in the vcl project.]),
1369 ,test "${enable_randr+set}" = set || enable_randr=yes)
1371 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1372     AS_HELP_STRING([--disable-gstreamer-1-0],
1373         [Disable building with the gstreamer 1.0 avmedia backend.]),
1374 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1376 libo_FUZZ_ARG_ENABLE(vlc,
1377     AS_HELP_STRING([--enable-vlc],
1378         [Enable building with the (experimental) VLC avmedia backend.]),
1379 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1381 libo_FUZZ_ARG_ENABLE(neon,
1382     AS_HELP_STRING([--disable-neon],
1383         [Disable neon and the compilation of webdav binding.]),
1386 libo_FUZZ_ARG_ENABLE([eot],
1387     [AS_HELP_STRING([--enable-eot],
1388         [Enable support for Embedded OpenType fonts.])],
1389 ,test "${enable_eot+set}" = set || enable_eot=no)
1391 libo_FUZZ_ARG_ENABLE(cve-tests,
1392     AS_HELP_STRING([--disable-cve-tests],
1393         [Prevent CVE tests to be executed]),
1396 libo_FUZZ_ARG_ENABLE(chart-tests,
1397     AS_HELP_STRING([--enable-chart-tests],
1398         [Executes chart XShape tests. In a perfect world these tests would be
1399          stable and everyone could run them, in reality it is best to run them
1400          only on a few machines that are known to work and maintained by people
1401          who can judge if a test failure is a regression or not.]),
1404 AC_ARG_ENABLE(build-unowinreg,
1405     AS_HELP_STRING([--enable-build-unowinreg],
1406         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1407          compiler is needed on Linux.]),
1410 AC_ARG_ENABLE(build-opensymbol,
1411     AS_HELP_STRING([--enable-build-opensymbol],
1412         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1413          fontforge installed.]),
1416 AC_ARG_ENABLE(dependency-tracking,
1417     AS_HELP_STRING([--enable-dependency-tracking],
1418         [Do not reject slow dependency extractors.])[
1419   --disable-dependency-tracking
1420                           Disables generation of dependency information.
1421                           Speed up one-time builds.],
1424 AC_ARG_ENABLE(icecream,
1425     AS_HELP_STRING([--enable-icecream],
1426         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1427          It defaults to /opt/icecream for the location of the icecream gcc/g++
1428          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1431 AC_ARG_ENABLE(ld,
1432     AS_HELP_STRING([--enable-ld=<linker>],
1433         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1434          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1435          If <linker> contains any ':', the part before the first ':' is used as the value of
1436          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1437          needed for Clang 12).]),
1440 libo_FUZZ_ARG_ENABLE(cups,
1441     AS_HELP_STRING([--disable-cups],
1442         [Do not build cups support.])
1445 AC_ARG_ENABLE(ccache,
1446     AS_HELP_STRING([--disable-ccache],
1447         [Do not try to use ccache automatically.
1448          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1449          CC/CXX are not yet set, and --enable-icecream is not given, we
1450          attempt to use ccache. --disable-ccache disables ccache completely.
1451          Additionally ccache's depend mode is enabled if possible,
1452          use --enable-ccache=nodepend to enable ccache without depend mode.
1456 AC_ARG_ENABLE(64-bit,
1457     AS_HELP_STRING([--enable-64-bit],
1458         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1459          At the moment meaningful only for Windows.]), ,)
1461 libo_FUZZ_ARG_ENABLE(online-update,
1462     AS_HELP_STRING([--enable-online-update],
1463         [Enable the online update service that will check for new versions of
1464          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1465          If the value is "mar", the experimental Mozilla-like update will be
1466          enabled instead of the traditional update mechanism.]),
1469 AC_ARG_WITH(update-config,
1470     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1471                    [Path to the update config ini file]))
1473 libo_FUZZ_ARG_ENABLE(extension-update,
1474     AS_HELP_STRING([--disable-extension-update],
1475         [Disable possibility to update installed extensions.]),
1478 libo_FUZZ_ARG_ENABLE(release-build,
1479     AS_HELP_STRING([--enable-release-build],
1480         [Enable release build. Note that the "release build" choice is orthogonal to
1481          whether symbols are present, debug info is generated, or optimization
1482          is done.
1483          See http://wiki.documentfoundation.org/Development/DevBuild]),
1486 AC_ARG_ENABLE(windows-build-signing,
1487     AS_HELP_STRING([--enable-windows-build-signing],
1488         [Enable signing of windows binaries (*.exe, *.dll)]),
1491 AC_ARG_ENABLE(silent-msi,
1492     AS_HELP_STRING([--enable-silent-msi],
1493         [Enable MSI with LIMITUI=1 (silent install).]),
1496 AC_ARG_ENABLE(macosx-code-signing,
1497     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1498         [Sign executables, dylibs, frameworks and the app bundle. If you
1499          don't provide an identity the first suitable certificate
1500          in your keychain is used.]),
1503 AC_ARG_ENABLE(macosx-package-signing,
1504     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1505         [Create a .pkg suitable for uploading to the Mac App Store and sign
1506          it. If you don't provide an identity the first suitable certificate
1507          in your keychain is used.]),
1510 AC_ARG_ENABLE(macosx-sandbox,
1511     AS_HELP_STRING([--enable-macosx-sandbox],
1512         [Make the app bundle run in a sandbox. Requires code signing.
1513          Is required by apps distributed in the Mac App Store, and implies
1514          adherence to App Store rules.]),
1517 AC_ARG_WITH(macosx-bundle-identifier,
1518     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1519         [Define the macOS bundle identifier. Default is the somewhat weird
1520          org.libreoffice.script ("script", huh?).]),
1521 ,with_macosx_bundle_identifier=org.libreoffice.script)
1523 AC_ARG_WITH(product-name,
1524     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1525         [Define the product name. Default is AC_PACKAGE_NAME.]),
1526 ,with_product_name=$PRODUCTNAME)
1528 AC_ARG_WITH(package-version,
1529     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1530         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1533 libo_FUZZ_ARG_ENABLE(readonly-installset,
1534     AS_HELP_STRING([--enable-readonly-installset],
1535         [Prevents any attempts by LibreOffice to write into its installation. That means
1536          at least that no "system-wide" extensions can be added. Partly experimental work in
1537          progress, probably not fully implemented. Always enabled for macOS.]),
1540 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1541     AS_HELP_STRING([--disable-postgresql-sdbc],
1542         [Disable the build of the PostgreSQL-SDBC driver.])
1545 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1546     AS_HELP_STRING([--disable-lotuswordpro],
1547         [Disable the build of the Lotus Word Pro filter.]),
1548 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1550 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1551     AS_HELP_STRING([--disable-firebird-sdbc],
1552         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1553 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1555 AC_ARG_ENABLE(bogus-pkg-config,
1556     AS_HELP_STRING([--enable-bogus-pkg-config],
1557         [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.]),
1560 AC_ARG_ENABLE(openssl,
1561     AS_HELP_STRING([--disable-openssl],
1562         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1563          components will either use GNUTLS or NSS. Work in progress,
1564          use only if you are hacking on it.]),
1565 ,enable_openssl=yes)
1567 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1568     AS_HELP_STRING([--enable-cipher-openssl-backend],
1569         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1570          Requires --enable-openssl.]))
1572 AC_ARG_ENABLE(library-bin-tar,
1573     AS_HELP_STRING([--enable-library-bin-tar],
1574         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1575         Some libraries can save their build result in a tarball
1576         stored in TARFILE_LOCATION. That binary tarball is
1577         uniquely identified by the source tarball,
1578         the content of the config_host.mk file and the content
1579         of the top-level directory in core for that library
1580         If this option is enabled, then if such a tarfile exist, it will be untarred
1581         instead of the source tarfile, and the build step will be skipped for that
1582         library.
1583         If a proper tarfile does not exist, then the normal source-based
1584         build is done for that library and a proper binary tarfile is created
1585         for the next time.]),
1588 AC_ARG_ENABLE(dconf,
1589     AS_HELP_STRING([--disable-dconf],
1590         [Disable the dconf configuration backend (enabled by default where
1591          available).]))
1593 libo_FUZZ_ARG_ENABLE(formula-logger,
1594     AS_HELP_STRING(
1595         [--enable-formula-logger],
1596         [Enable formula logger for logging formula calculation flow in Calc.]
1597     )
1600 AC_ARG_ENABLE(ldap,
1601     AS_HELP_STRING([--disable-ldap],
1602         [Disable LDAP support.]),
1603 ,enable_ldap=yes)
1605 dnl ===================================================================
1606 dnl Optional Packages (--with/without-)
1607 dnl ===================================================================
1609 AC_ARG_WITH(gcc-home,
1610     AS_HELP_STRING([--with-gcc-home],
1611         [Specify the location of gcc/g++ manually. This can be used in conjunction
1612          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1613          non-default path.]),
1616 AC_ARG_WITH(gnu-patch,
1617     AS_HELP_STRING([--with-gnu-patch],
1618         [Specify location of GNU patch on Solaris or FreeBSD.]),
1621 AC_ARG_WITH(build-platform-configure-options,
1622     AS_HELP_STRING([--with-build-platform-configure-options],
1623         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1626 AC_ARG_WITH(gnu-cp,
1627     AS_HELP_STRING([--with-gnu-cp],
1628         [Specify location of GNU cp on Solaris or FreeBSD.]),
1631 AC_ARG_WITH(external-tar,
1632     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1633         [Specify an absolute path of where to find (and store) tarfiles.]),
1634     TARFILE_LOCATION=$withval ,
1637 AC_ARG_WITH(referenced-git,
1638     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1639         [Specify another checkout directory to reference. This makes use of
1640                  git submodule update --reference, and saves a lot of diskspace
1641                  when having multiple trees side-by-side.]),
1642     GIT_REFERENCE_SRC=$withval ,
1645 AC_ARG_WITH(linked-git,
1646     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1647         [Specify a directory where the repositories of submodules are located.
1648          This uses a method similar to git-new-workdir to get submodules.]),
1649     GIT_LINK_SRC=$withval ,
1652 AC_ARG_WITH(galleries,
1653     AS_HELP_STRING([--with-galleries],
1654         [Specify how galleries should be built. It is possible either to
1655          build these internally from source ("build"),
1656          or to disable them ("no")]),
1659 AC_ARG_WITH(theme,
1660     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1661         [Choose which themes to include. By default those themes with an '*' are included.
1662          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1663          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
1666 libo_FUZZ_ARG_WITH(helppack-integration,
1667     AS_HELP_STRING([--without-helppack-integration],
1668         [It will not integrate the helppacks to the installer
1669          of the product. Please use this switch to use the online help
1670          or separate help packages.]),
1673 libo_FUZZ_ARG_WITH(fonts,
1674     AS_HELP_STRING([--without-fonts],
1675         [LibreOffice includes some third-party fonts to provide a reliable basis for
1676          help content, templates, samples, etc. When these fonts are already
1677          known to be available on the system then you should use this option.]),
1680 AC_ARG_WITH(epm,
1681     AS_HELP_STRING([--with-epm],
1682         [Decides which epm to use. Default is to use the one from the system if
1683          one is built. When either this is not there or you say =internal epm
1684          will be built.]),
1687 AC_ARG_WITH(package-format,
1688     AS_HELP_STRING([--with-package-format],
1689         [Specify package format(s) for LibreOffice installation sets. The
1690          implicit --without-package-format leads to no installation sets being
1691          generated. Possible values: aix, archive, bsd, deb, dmg,
1692          installed, msi, pkg, and rpm.
1693          Example: --with-package-format='deb rpm']),
1696 AC_ARG_WITH(tls,
1697     AS_HELP_STRING([--with-tls],
1698         [Decides which TLS/SSL and cryptographic implementations to use for
1699          LibreOffice's code. Notice that this doesn't apply for depending
1700          libraries like "neon", for example. Default is to use NSS
1701          although OpenSSL is also possible. Notice that selecting NSS restricts
1702          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1703          restrict by now the usage of NSS in LO's code. Possible values:
1704          openssl, nss. Example: --with-tls="nss"]),
1707 AC_ARG_WITH(system-libs,
1708     AS_HELP_STRING([--with-system-libs],
1709         [Use libraries already on system -- enables all --with-system-* flags.]),
1712 AC_ARG_WITH(system-bzip2,
1713     AS_HELP_STRING([--with-system-bzip2],
1714         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1715     [with_system_bzip2="$with_system_libs"])
1717 AC_ARG_WITH(system-headers,
1718     AS_HELP_STRING([--with-system-headers],
1719         [Use headers already on system -- enables all --with-system-* flags for
1720          external packages whose headers are the only entities used i.e.
1721          boost/odbc/sane-header(s).]),,
1722     [with_system_headers="$with_system_libs"])
1724 AC_ARG_WITH(system-jars,
1725     AS_HELP_STRING([--without-system-jars],
1726         [When building with --with-system-libs, also the needed jars are expected
1727          on the system. Use this to disable that]),,
1728     [with_system_jars="$with_system_libs"])
1730 AC_ARG_WITH(system-cairo,
1731     AS_HELP_STRING([--with-system-cairo],
1732         [Use cairo libraries already on system.  Happens automatically for
1733          (implicit) --enable-gtk3.]))
1735 AC_ARG_WITH(system-epoxy,
1736     AS_HELP_STRING([--with-system-epoxy],
1737         [Use epoxy libraries already on system.  Happens automatically for
1738          (implicit) --enable-gtk3.]),,
1739        [with_system_epoxy="$with_system_libs"])
1741 AC_ARG_WITH(myspell-dicts,
1742     AS_HELP_STRING([--with-myspell-dicts],
1743         [Adds myspell dictionaries to the LibreOffice installation set]),
1746 AC_ARG_WITH(system-dicts,
1747     AS_HELP_STRING([--without-system-dicts],
1748         [Do not use dictionaries from system paths.]),
1751 AC_ARG_WITH(external-dict-dir,
1752     AS_HELP_STRING([--with-external-dict-dir],
1753         [Specify external dictionary dir.]),
1756 AC_ARG_WITH(external-hyph-dir,
1757     AS_HELP_STRING([--with-external-hyph-dir],
1758         [Specify external hyphenation pattern dir.]),
1761 AC_ARG_WITH(external-thes-dir,
1762     AS_HELP_STRING([--with-external-thes-dir],
1763         [Specify external thesaurus dir.]),
1766 AC_ARG_WITH(system-zlib,
1767     AS_HELP_STRING([--with-system-zlib],
1768         [Use zlib already on system.]),,
1769     [with_system_zlib=auto])
1771 AC_ARG_WITH(system-jpeg,
1772     AS_HELP_STRING([--with-system-jpeg],
1773         [Use jpeg already on system.]),,
1774     [with_system_jpeg="$with_system_libs"])
1776 AC_ARG_WITH(system-clucene,
1777     AS_HELP_STRING([--with-system-clucene],
1778         [Use clucene already on system.]),,
1779     [with_system_clucene="$with_system_libs"])
1781 AC_ARG_WITH(system-expat,
1782     AS_HELP_STRING([--with-system-expat],
1783         [Use expat already on system.]),,
1784     [with_system_expat="$with_system_libs"])
1786 AC_ARG_WITH(system-libxml,
1787     AS_HELP_STRING([--with-system-libxml],
1788         [Use libxml/libxslt already on system.]),,
1789     [with_system_libxml=auto])
1791 AC_ARG_WITH(system-icu,
1792     AS_HELP_STRING([--with-system-icu],
1793         [Use icu already on system.]),,
1794     [with_system_icu="$with_system_libs"])
1796 AC_ARG_WITH(system-ucpp,
1797     AS_HELP_STRING([--with-system-ucpp],
1798         [Use ucpp already on system.]),,
1799     [])
1801 AC_ARG_WITH(system-openldap,
1802     AS_HELP_STRING([--with-system-openldap],
1803         [Use the OpenLDAP LDAP SDK already on system.]),,
1804     [with_system_openldap="$with_system_libs"])
1806 libo_FUZZ_ARG_ENABLE(poppler,
1807     AS_HELP_STRING([--disable-poppler],
1808         [Disable building Poppler.])
1811 AC_ARG_WITH(system-poppler,
1812     AS_HELP_STRING([--with-system-poppler],
1813         [Use system poppler (only needed for PDF import).]),,
1814     [with_system_poppler="$with_system_libs"])
1816 libo_FUZZ_ARG_ENABLE(gpgmepp,
1817     AS_HELP_STRING([--disable-gpgmepp],
1818         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
1821 AC_ARG_WITH(system-gpgmepp,
1822     AS_HELP_STRING([--with-system-gpgmepp],
1823         [Use gpgmepp already on system]),,
1824     [with_system_gpgmepp="$with_system_libs"])
1826 AC_ARG_WITH(system-apache-commons,
1827     AS_HELP_STRING([--with-system-apache-commons],
1828         [Use Apache commons libraries already on system.]),,
1829     [with_system_apache_commons="$with_system_jars"])
1831 AC_ARG_WITH(system-mariadb,
1832     AS_HELP_STRING([--with-system-mariadb],
1833         [Use MariaDB/MySQL libraries already on system.]),,
1834     [with_system_mariadb="$with_system_libs"])
1836 AC_ARG_ENABLE(bundle-mariadb,
1837     AS_HELP_STRING([--enable-bundle-mariadb],
1838         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1841 AC_ARG_WITH(system-postgresql,
1842     AS_HELP_STRING([--with-system-postgresql],
1843         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1844          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1845     [with_system_postgresql="$with_system_libs"])
1847 AC_ARG_WITH(libpq-path,
1848     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1849         [Use this PostgreSQL C interface (libpq) installation for building
1850          the PostgreSQL-SDBC extension.]),
1853 AC_ARG_WITH(system-firebird,
1854     AS_HELP_STRING([--with-system-firebird],
1855         [Use Firebird libraries already on system, for building the Firebird-SDBC
1856          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1857     [with_system_firebird="$with_system_libs"])
1859 AC_ARG_WITH(system-libtommath,
1860             AS_HELP_STRING([--with-system-libtommath],
1861                            [Use libtommath already on system]),,
1862             [with_system_libtommath="$with_system_libs"])
1864 AC_ARG_WITH(system-hsqldb,
1865     AS_HELP_STRING([--with-system-hsqldb],
1866         [Use hsqldb already on system.]))
1868 AC_ARG_WITH(hsqldb-jar,
1869     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1870         [Specify path to jarfile manually.]),
1871     HSQLDB_JAR=$withval)
1873 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1874     AS_HELP_STRING([--disable-scripting-beanshell],
1875         [Disable support for scripts in BeanShell.]),
1879 AC_ARG_WITH(system-beanshell,
1880     AS_HELP_STRING([--with-system-beanshell],
1881         [Use beanshell already on system.]),,
1882     [with_system_beanshell="$with_system_jars"])
1884 AC_ARG_WITH(beanshell-jar,
1885     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1886         [Specify path to jarfile manually.]),
1887     BSH_JAR=$withval)
1889 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1890     AS_HELP_STRING([--disable-scripting-javascript],
1891         [Disable support for scripts in JavaScript.]),
1895 AC_ARG_WITH(system-rhino,
1896     AS_HELP_STRING([--with-system-rhino],
1897         [Use rhino already on system.]),,)
1898 #    [with_system_rhino="$with_system_jars"])
1899 # Above is not used as we have different debug interface
1900 # patched into internal rhino. This code needs to be fixed
1901 # before we can enable it by default.
1903 AC_ARG_WITH(rhino-jar,
1904     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1905         [Specify path to jarfile manually.]),
1906     RHINO_JAR=$withval)
1908 AC_ARG_WITH(commons-logging-jar,
1909     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1910         [Specify path to jarfile manually.]),
1911     COMMONS_LOGGING_JAR=$withval)
1913 AC_ARG_WITH(system-jfreereport,
1914     AS_HELP_STRING([--with-system-jfreereport],
1915         [Use JFreeReport already on system.]),,
1916     [with_system_jfreereport="$with_system_jars"])
1918 AC_ARG_WITH(sac-jar,
1919     AS_HELP_STRING([--with-sac-jar=JARFILE],
1920         [Specify path to jarfile manually.]),
1921     SAC_JAR=$withval)
1923 AC_ARG_WITH(libxml-jar,
1924     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1925         [Specify path to jarfile manually.]),
1926     LIBXML_JAR=$withval)
1928 AC_ARG_WITH(flute-jar,
1929     AS_HELP_STRING([--with-flute-jar=JARFILE],
1930         [Specify path to jarfile manually.]),
1931     FLUTE_JAR=$withval)
1933 AC_ARG_WITH(jfreereport-jar,
1934     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1935         [Specify path to jarfile manually.]),
1936     JFREEREPORT_JAR=$withval)
1938 AC_ARG_WITH(liblayout-jar,
1939     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1940         [Specify path to jarfile manually.]),
1941     LIBLAYOUT_JAR=$withval)
1943 AC_ARG_WITH(libloader-jar,
1944     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1945         [Specify path to jarfile manually.]),
1946     LIBLOADER_JAR=$withval)
1948 AC_ARG_WITH(libformula-jar,
1949     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1950         [Specify path to jarfile manually.]),
1951     LIBFORMULA_JAR=$withval)
1953 AC_ARG_WITH(librepository-jar,
1954     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1955         [Specify path to jarfile manually.]),
1956     LIBREPOSITORY_JAR=$withval)
1958 AC_ARG_WITH(libfonts-jar,
1959     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1960         [Specify path to jarfile manually.]),
1961     LIBFONTS_JAR=$withval)
1963 AC_ARG_WITH(libserializer-jar,
1964     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1965         [Specify path to jarfile manually.]),
1966     LIBSERIALIZER_JAR=$withval)
1968 AC_ARG_WITH(libbase-jar,
1969     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1970         [Specify path to jarfile manually.]),
1971     LIBBASE_JAR=$withval)
1973 AC_ARG_WITH(system-odbc,
1974     AS_HELP_STRING([--with-system-odbc],
1975         [Use the odbc headers already on system.]),,
1976     [with_system_odbc="auto"])
1978 AC_ARG_WITH(system-sane,
1979     AS_HELP_STRING([--with-system-sane],
1980         [Use sane.h already on system.]),,
1981     [with_system_sane="$with_system_headers"])
1983 AC_ARG_WITH(system-bluez,
1984     AS_HELP_STRING([--with-system-bluez],
1985         [Use bluetooth.h already on system.]),,
1986     [with_system_bluez="$with_system_headers"])
1988 AC_ARG_WITH(system-curl,
1989     AS_HELP_STRING([--with-system-curl],
1990         [Use curl already on system.]),,
1991     [with_system_curl=auto])
1993 AC_ARG_WITH(system-boost,
1994     AS_HELP_STRING([--with-system-boost],
1995         [Use boost already on system.]),,
1996     [with_system_boost="$with_system_headers"])
1998 AC_ARG_WITH(system-glm,
1999     AS_HELP_STRING([--with-system-glm],
2000         [Use glm already on system.]),,
2001     [with_system_glm="$with_system_headers"])
2003 AC_ARG_WITH(system-hunspell,
2004     AS_HELP_STRING([--with-system-hunspell],
2005         [Use libhunspell already on system.]),,
2006     [with_system_hunspell="$with_system_libs"])
2008 AC_ARG_WITH(system-qrcodegen,
2009     AS_HELP_STRING([--with-system-qrcodegen],
2010         [Use libqrcodegen already on system.]),,
2011     [with_system_qrcodegen="$with_system_libs"])
2013 AC_ARG_WITH(system-box2d,
2014     AS_HELP_STRING([--with-system-box2d],
2015         [Use box2d already on system.]),,
2016     [with_system_box2d="$with_system_libs"])
2018 AC_ARG_WITH(system-mythes,
2019     AS_HELP_STRING([--with-system-mythes],
2020         [Use mythes already on system.]),,
2021     [with_system_mythes="$with_system_libs"])
2023 AC_ARG_WITH(system-altlinuxhyph,
2024     AS_HELP_STRING([--with-system-altlinuxhyph],
2025         [Use ALTLinuxhyph already on system.]),,
2026     [with_system_altlinuxhyph="$with_system_libs"])
2028 AC_ARG_WITH(system-lpsolve,
2029     AS_HELP_STRING([--with-system-lpsolve],
2030         [Use lpsolve already on system.]),,
2031     [with_system_lpsolve="$with_system_libs"])
2033 AC_ARG_WITH(system-coinmp,
2034     AS_HELP_STRING([--with-system-coinmp],
2035         [Use CoinMP already on system.]),,
2036     [with_system_coinmp="$with_system_libs"])
2038 AC_ARG_WITH(system-liblangtag,
2039     AS_HELP_STRING([--with-system-liblangtag],
2040         [Use liblangtag library already on system.]),,
2041     [with_system_liblangtag="$with_system_libs"])
2043 AC_ARG_WITH(webdav,
2044     AS_HELP_STRING([--with-webdav],
2045         [Specify which library to use for webdav implementation.
2046          Possible values: "neon", "serf", "no". The default value is "neon".
2047          Example: --with-webdav="serf"]),
2048     WITH_WEBDAV=$withval,
2049     WITH_WEBDAV="neon")
2051 AC_ARG_WITH(linker-hash-style,
2052     AS_HELP_STRING([--with-linker-hash-style],
2053         [Use linker with --hash-style=<style> when linking shared objects.
2054          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2055          if supported on the build system, and "sysv" otherwise.]))
2057 AC_ARG_WITH(jdk-home,
2058     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2059         [If you have installed JDK 9 or later on your system please supply the
2060          path here. Note that this is not the location of the java command but the
2061          location of the entire distribution.]),
2064 AC_ARG_WITH(help,
2065     AS_HELP_STRING([--with-help],
2066         [Enable the build of help. There is a special parameter "common" that
2067          can be used to bundle only the common part, .e.g help-specific icons.
2068          This is useful when you build the helpcontent separately.])
2069     [
2070                           Usage:     --with-help    build the old local help
2071                                  --without-help     no local help (default)
2072                                  --with-help=html   build the new HTML local help
2073                                  --with-help=online build the new HTML online help
2074     ],
2077 AC_ARG_WITH(omindex,
2078    AS_HELP_STRING([--with-omindex],
2079         [Enable the support of xapian-omega index for online help.])
2080    [
2081                          Usage: --with-omindex=server prepare the pages for omindex
2082                                 but let xapian-omega be built in server.
2083                                 --with-omindex=noxap do not prepare online pages
2084                                 for xapian-omega
2085   ],
2088 libo_FUZZ_ARG_WITH(java,
2089     AS_HELP_STRING([--with-java=<java command>],
2090         [Specify the name of the Java interpreter command. Typically "java"
2091          which is the default.
2093          To build without support for Java components, applets, accessibility
2094          or the XML filters written in Java, use --without-java or --with-java=no.]),
2095     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2096     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2099 AC_ARG_WITH(jvm-path,
2100     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2101         [Use a specific JVM search path at runtime.
2102          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2105 AC_ARG_WITH(ant-home,
2106     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2107         [If you have installed Apache Ant on your system, please supply the path here.
2108          Note that this is not the location of the Ant binary but the location
2109          of the entire distribution.]),
2112 AC_ARG_WITH(symbol-config,
2113     AS_HELP_STRING([--with-symbol-config],
2114         [Configuration for the crashreport symbol upload]),
2115         [],
2116         [with_symbol_config=no])
2118 AC_ARG_WITH(export-validation,
2119     AS_HELP_STRING([--without-export-validation],
2120         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2121 ,with_export_validation=auto)
2123 AC_ARG_WITH(bffvalidator,
2124     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2125         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2126          Requires installed Microsoft Office Binary File Format Validator.
2127          Note: export-validation (--with-export-validation) is required to be turned on.
2128          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2129 ,with_bffvalidator=no)
2131 libo_FUZZ_ARG_WITH(junit,
2132     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2133         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2134          --without-junit disables those tests. Not relevant in the --without-java case.]),
2135 ,with_junit=yes)
2137 AC_ARG_WITH(hamcrest,
2138     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2139         [Specifies the hamcrest jar file to use for JUnit-based tests.
2140          --without-junit disables those tests. Not relevant in the --without-java case.]),
2141 ,with_hamcrest=yes)
2143 AC_ARG_WITH(perl-home,
2144     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2145         [If you have installed Perl 5 Distribution, on your system, please
2146          supply the path here. Note that this is not the location of the Perl
2147          binary but the location of the entire distribution.]),
2150 libo_FUZZ_ARG_WITH(doxygen,
2151     AS_HELP_STRING(
2152         [--with-doxygen=<absolute path to doxygen executable>],
2153         [Specifies the doxygen executable to use when generating ODK C/C++
2154          documentation. --without-doxygen disables generation of ODK C/C++
2155          documentation. Not relevant in the --disable-odk case.]),
2156 ,with_doxygen=yes)
2158 AC_ARG_WITH(visual-studio,
2159     AS_HELP_STRING([--with-visual-studio=<2019>],
2160         [Specify which Visual Studio version to use in case several are
2161          installed. Currently only 2019 (default) is supported.]),
2164 AC_ARG_WITH(windows-sdk,
2165     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2166         [Specify which Windows SDK, or "Windows Kit", version to use
2167          in case the one that came with the selected Visual Studio
2168          is not what you want for some reason. Note that not all compiler/SDK
2169          combinations are supported. The intent is that this option should not
2170          be needed.]),
2173 AC_ARG_WITH(lang,
2174     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2175         [Use this option to build LibreOffice with additional UI language support.
2176          English (US) is always included by default.
2177          Separate multiple languages with space.
2178          For all languages, use --with-lang=ALL.]),
2181 AC_ARG_WITH(locales,
2182     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2183         [Use this option to limit the locale information built in.
2184          Separate multiple locales with space.
2185          Very experimental and might well break stuff.
2186          Just a desperate measure to shrink code and data size.
2187          By default all the locales available is included.
2188          This option is completely unrelated to --with-lang.])
2189     [
2190                           Affects also our character encoding conversion
2191                           tables for encodings mainly targeted for a
2192                           particular locale, like EUC-CN and EUC-TW for
2193                           zh, ISO-2022-JP for ja.
2195                           Affects also our add-on break iterator data for
2196                           some languages.
2198                           For the default, all locales, don't use this switch at all.
2199                           Specifying just the language part of a locale means all matching
2200                           locales will be included.
2201     ],
2204 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2205 libo_FUZZ_ARG_WITH(krb5,
2206     AS_HELP_STRING([--with-krb5],
2207         [Enable MIT Kerberos 5 support in modules that support it.
2208          By default automatically enabled on platforms
2209          where a good system Kerberos 5 is available.]),
2212 libo_FUZZ_ARG_WITH(gssapi,
2213     AS_HELP_STRING([--with-gssapi],
2214         [Enable GSSAPI support in modules that support it.
2215          By default automatically enabled on platforms
2216          where a good system GSSAPI is available.]),
2219 AC_ARG_WITH(iwyu,
2220     AS_HELP_STRING([--with-iwyu],
2221         [Use given IWYU binary path to check unneeded includes instead of building.
2222          Use only if you are hacking on it.]),
2225 libo_FUZZ_ARG_WITH(lxml,
2226     AS_HELP_STRING([--without-lxml],
2227         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2228          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2229          report widget classes and ids.]),
2232 libo_FUZZ_ARG_WITH(latest-c++,
2233     AS_HELP_STRING([--with-latest-c++],
2234         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2235          published standard.]),,
2236         [with_latest_c__=no])
2238 dnl ===================================================================
2239 dnl Branding
2240 dnl ===================================================================
2242 AC_ARG_WITH(branding,
2243     AS_HELP_STRING([--with-branding=/path/to/images],
2244         [Use given path to retrieve branding images set.])
2245     [
2246                           Search for intro.png about.svg and logo.svg.
2247                           If any is missing, default ones will be used instead.
2249                           Search also progress.conf for progress
2250                           settings on intro screen :
2252                           PROGRESSBARCOLOR="255,255,255" Set color of
2253                           progress bar. Comma separated RGB decimal values.
2254                           PROGRESSSIZE="407,6" Set size of progress bar.
2255                           Comma separated decimal values (width, height).
2256                           PROGRESSPOSITION="61,317" Set position of progress
2257                           bar from left,top. Comma separated decimal values.
2258                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2259                           bar frame. Comma separated RGB decimal values.
2260                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2261                           bar text. Comma separated RGB decimal values.
2262                           PROGRESSTEXTBASELINE="287" Set vertical position of
2263                           progress bar text from top. Decimal value.
2265                           Default values will be used if not found.
2266     ],
2270 AC_ARG_WITH(extra-buildid,
2271     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2272         [Show addition build identification in about dialog.]),
2276 AC_ARG_WITH(vendor,
2277     AS_HELP_STRING([--with-vendor="John the Builder"],
2278         [Set vendor of the build.]),
2281 AC_ARG_WITH(android-package-name,
2282     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2283         [Set Android package name of the build.]),
2286 AC_ARG_WITH(compat-oowrappers,
2287     AS_HELP_STRING([--with-compat-oowrappers],
2288         [Install oo* wrappers in parallel with
2289          lo* ones to keep backward compatibility.
2290          Has effect only with make distro-pack-install]),
2293 AC_ARG_WITH(os-version,
2294     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2295         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2298 AC_ARG_WITH(mingw-cross-compiler,
2299     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2300         [Specify the MinGW cross-compiler to use.
2301          When building on the ODK on Unix and building unowinreg.dll,
2302          specify the MinGW C++ cross-compiler.]),
2305 AC_ARG_WITH(idlc-cpp,
2306     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2307         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2310 AC_ARG_WITH(parallelism,
2311     AS_HELP_STRING([--with-parallelism],
2312         [Number of jobs to run simultaneously during build. Parallel builds can
2313         save a lot of time on multi-cpu machines. Defaults to the number of
2314         CPUs on the machine, unless you configure --enable-icecream - then to
2315         40.]),
2318 AC_ARG_WITH(all-tarballs,
2319     AS_HELP_STRING([--with-all-tarballs],
2320         [Download all external tarballs unconditionally]))
2322 AC_ARG_WITH(gdrive-client-id,
2323     AS_HELP_STRING([--with-gdrive-client-id],
2324         [Provides the client id of the application for OAuth2 authentication
2325         on Google Drive. If either this or --with-gdrive-client-secret is
2326         empty, the feature will be disabled]),
2329 AC_ARG_WITH(gdrive-client-secret,
2330     AS_HELP_STRING([--with-gdrive-client-secret],
2331         [Provides the client secret of the application for OAuth2
2332         authentication on Google Drive. If either this or
2333         --with-gdrive-client-id is empty, the feature will be disabled]),
2336 AC_ARG_WITH(alfresco-cloud-client-id,
2337     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2338         [Provides the client id of the application for OAuth2 authentication
2339         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2340         empty, the feature will be disabled]),
2343 AC_ARG_WITH(alfresco-cloud-client-secret,
2344     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2345         [Provides the client secret of the application for OAuth2
2346         authentication on Alfresco Cloud. If either this or
2347         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2350 AC_ARG_WITH(onedrive-client-id,
2351     AS_HELP_STRING([--with-onedrive-client-id],
2352         [Provides the client id of the application for OAuth2 authentication
2353         on OneDrive. If either this or --with-onedrive-client-secret is
2354         empty, the feature will be disabled]),
2357 AC_ARG_WITH(onedrive-client-secret,
2358     AS_HELP_STRING([--with-onedrive-client-secret],
2359         [Provides the client secret of the application for OAuth2
2360         authentication on OneDrive. If either this or
2361         --with-onedrive-client-id is empty, the feature will be disabled]),
2363 dnl ===================================================================
2364 dnl Do we want to use pre-build binary tarball for recompile
2365 dnl ===================================================================
2367 if test "$enable_library_bin_tar" = "yes" ; then
2368     USE_LIBRARY_BIN_TAR=TRUE
2369 else
2370     USE_LIBRARY_BIN_TAR=
2372 AC_SUBST(USE_LIBRARY_BIN_TAR)
2374 dnl ===================================================================
2375 dnl Test whether build target is Release Build
2376 dnl ===================================================================
2377 AC_MSG_CHECKING([whether build target is Release Build])
2378 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2379     AC_MSG_RESULT([no])
2380     ENABLE_RELEASE_BUILD=
2381     GET_TASK_ALLOW_ENTITLEMENT='
2382         <!-- We want to be able to debug a hardened process when not building for release -->
2383         <key>com.apple.security.get-task-allow</key>
2384         <true/>'
2385 else
2386     AC_MSG_RESULT([yes])
2387     ENABLE_RELEASE_BUILD=TRUE
2388     GET_TASK_ALLOW_ENTITLEMENT=''
2390 AC_SUBST(ENABLE_RELEASE_BUILD)
2391 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2393 dnl ===================================================================
2394 dnl Test whether to sign Windows Build
2395 dnl ===================================================================
2396 AC_MSG_CHECKING([whether to sign windows build])
2397 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2398     AC_MSG_RESULT([yes])
2399     WINDOWS_BUILD_SIGNING="TRUE"
2400 else
2401     AC_MSG_RESULT([no])
2402     WINDOWS_BUILD_SIGNING="FALSE"
2404 AC_SUBST(WINDOWS_BUILD_SIGNING)
2406 dnl ===================================================================
2407 dnl MacOSX build and runtime environment options
2408 dnl ===================================================================
2410 AC_ARG_WITH(macosx-sdk,
2411     AS_HELP_STRING([--with-macosx-sdk=<version>],
2412         [Prefer a specific SDK for building.])
2413     [
2414                           If the requested SDK is not available, a search for the oldest one will be done.
2415                           With current Xcode versions, only the latest SDK is included, so this option is
2416                           not terribly useful. It works fine to build with a new SDK and run the result
2417                           on an older OS.
2419                           e. g.: --with-macosx-sdk=10.10
2421                           there are 3 options to control the MacOSX build:
2422                           --with-macosx-sdk (referred as 'sdk' below)
2423                           --with-macosx-version-min-required (referred as 'min' below)
2424                           --with-macosx-version-max-allowed (referred as 'max' below)
2426                           the connection between these value and the default they take is as follow:
2427                           ( ? means not specified on the command line, s means the SDK version found,
2428                           constraint: 8 <= x <= y <= z)
2430                           ==========================================
2431                            command line      || config result
2432                           ==========================================
2433                           min  | max  | sdk  || min   | max  | sdk  |
2434                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2435                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2436                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2437                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2438                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2439                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2440                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2441                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2444                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2445                           for a detailed technical explanation of these variables
2447                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2448     ],
2451 AC_ARG_WITH(macosx-version-min-required,
2452     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2453         [set the minimum OS version needed to run the built LibreOffice])
2454     [
2455                           e. g.: --with-macosx-version-min-required=10.10
2456                           see --with-macosx-sdk for more info
2457     ],
2460 AC_ARG_WITH(macosx-version-max-allowed,
2461     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2462         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2463     [
2464                           e. g.: --with-macosx-version-max-allowed=10.10
2465                           see --with-macosx-sdk for more info
2466     ],
2470 dnl ===================================================================
2471 dnl options for stuff used during cross-compilation build
2472 dnl Not quite superseded by --with-build-platform-configure-options.
2473 dnl TODO: check, if the "force" option is still needed anywhere.
2474 dnl ===================================================================
2476 AC_ARG_WITH(system-icu-for-build,
2477     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2478         [Use icu already on system for build tools (cross-compilation only).]))
2481 dnl ===================================================================
2482 dnl Check for incompatible options set by fuzzing, and reset those
2483 dnl automatically to working combinations
2484 dnl ===================================================================
2486 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2487         "$enable_dbus" != "$enable_avahi"; then
2488     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2489     enable_avahi=$enable_dbus
2492 add_lopath_after ()
2494     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2495         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2496     fi
2499 add_lopath_before ()
2501     local IFS=${P_SEP}
2502     local path_cleanup
2503     local dir
2504     for dir in $LO_PATH ; do
2505         if test "$dir" != "$1" ; then
2506             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2507         fi
2508     done
2509     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2512 dnl ===================================================================
2513 dnl check for required programs (grep, awk, sed, bash)
2514 dnl ===================================================================
2516 pathmunge ()
2518     if test -n "$1"; then
2519         if test "$build_os" = "cygwin"; then
2520             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2521                 PathFormat "$1"
2522                 new_path=`cygpath -sm "$formatted_path"`
2523             else
2524                 PathFormat "$1"
2525                 new_path=`cygpath -u "$formatted_path"`
2526             fi
2527         else
2528             new_path="$1"
2529         fi
2530         if test "$2" = "after"; then
2531             add_lopath_after "$new_path"
2532         else
2533             add_lopath_before "$new_path"
2534         fi
2535         unset new_path
2536     fi
2539 AC_PROG_AWK
2540 AC_PATH_PROG( AWK, $AWK)
2541 if test -z "$AWK"; then
2542     AC_MSG_ERROR([install awk to run this script])
2545 AC_PATH_PROG(BASH, bash)
2546 if test -z "$BASH"; then
2547     AC_MSG_ERROR([bash not found in \$PATH])
2549 AC_SUBST(BASH)
2551 AC_MSG_CHECKING([for GNU or BSD tar])
2552 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2553     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2554     if test $? -eq 0;  then
2555         GNUTAR=$a
2556         break
2557     fi
2558 done
2559 AC_MSG_RESULT($GNUTAR)
2560 if test -z "$GNUTAR"; then
2561     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2563 AC_SUBST(GNUTAR)
2565 AC_MSG_CHECKING([for tar's option to strip components])
2566 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2567 if test $? -eq 0; then
2568     STRIP_COMPONENTS="--strip-components"
2569 else
2570     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2571     if test $? -eq 0; then
2572         STRIP_COMPONENTS="--strip-path"
2573     else
2574         STRIP_COMPONENTS="unsupported"
2575     fi
2577 AC_MSG_RESULT($STRIP_COMPONENTS)
2578 if test x$STRIP_COMPONENTS = xunsupported; then
2579     AC_MSG_ERROR([you need a tar that is able to strip components.])
2581 AC_SUBST(STRIP_COMPONENTS)
2583 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2584 dnl desktop OSes from "mobile" ones.
2586 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2587 dnl In other words, that when building for an OS that is not a
2588 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2590 dnl Note the direction of the implication; there is no assumption that
2591 dnl cross-compiling would imply a non-desktop OS.
2593 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2594     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2595     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2596     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2599 # Whether to build "avmedia" functionality or not.
2601 if test -z "$enable_avmedia"; then
2602     enable_avmedia=yes
2605 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2606 if test "$enable_avmedia" = yes; then
2607     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2608 else
2609     USE_AVMEDIA_DUMMY='TRUE'
2611 AC_SUBST(USE_AVMEDIA_DUMMY)
2613 # Decide whether to build database connectivity stuff (including
2614 # Base) or not. We probably don't want to on non-desktop OSes.
2615 if test -z "$enable_database_connectivity"; then
2616     # --disable-database-connectivity is unfinished work in progress
2617     # and the iOS test app doesn't link if we actually try to use it.
2618     # if test $_os != iOS -a $_os != Android; then
2619     if test $_os != iOS; then
2620         enable_database_connectivity=yes
2621     fi
2624 if test "$enable_database_connectivity" = yes; then
2625     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2626     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2629 if test -z "$enable_extensions"; then
2630     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2631     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2632         enable_extensions=yes
2633     fi
2636 if test "$enable_extensions" = yes; then
2637     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2638     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2641 if test -z "$enable_scripting"; then
2642     # Disable scripting for iOS unless specifically overridden
2643     # with --enable-scripting.
2644     if test $_os != iOS; then
2645         enable_scripting=yes
2646     fi
2649 DISABLE_SCRIPTING=''
2650 if test "$enable_scripting" = yes; then
2651     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2652     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2653 else
2654     DISABLE_SCRIPTING='TRUE'
2655     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2658 if test $_os = iOS -o $_os = Android; then
2659     # Disable dynamic_loading always for iOS and Android
2660     enable_dynamic_loading=no
2661 elif test -z "$enable_dynamic_loading"; then
2662     # Otherwise enable it unless specifically disabled
2663     enable_dynamic_loading=yes
2666 DISABLE_DYNLOADING=''
2667 if test "$enable_dynamic_loading" = yes; then
2668     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2669 else
2670     DISABLE_DYNLOADING='TRUE'
2672 AC_SUBST(DISABLE_DYNLOADING)
2674 # remember SYSBASE value
2675 AC_SUBST(SYSBASE)
2677 dnl ===================================================================
2678 dnl  Sort out various gallery compilation options
2679 dnl ===================================================================
2680 AC_MSG_CHECKING([how to build and package galleries])
2681 if test -n "${with_galleries}"; then
2682     if test "$with_galleries" = "build"; then
2683         WITH_GALLERY_BUILD=TRUE
2684         AC_MSG_RESULT([build from source images internally])
2685     elif test "$with_galleries" = "no"; then
2686         WITH_GALLERY_BUILD=
2687         AC_MSG_RESULT([disable non-internal gallery build])
2688     else
2689         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2690     fi
2691 else
2692     if test $_os != iOS -a $_os != Android; then
2693         WITH_GALLERY_BUILD=TRUE
2694         AC_MSG_RESULT([internal src images for desktop])
2695     else
2696         WITH_GALLERY_BUILD=
2697         AC_MSG_RESULT([disable src image build])
2698     fi
2700 AC_SUBST(WITH_GALLERY_BUILD)
2702 dnl ===================================================================
2703 dnl  Checks if ccache is available
2704 dnl ===================================================================
2705 CCACHE_DEPEND_MODE=
2706 if test "$_os" = "WINNT"; then
2707     # on windows/VC build do not use ccache
2708     CCACHE=""
2709 elif test "$enable_ccache" = "no"; then
2710     CCACHE=""
2711 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2712     case "%$CC%$CXX%" in
2713     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2714     # assume that's good then
2715     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2716         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2717         CCACHE_DEPEND_MODE=1
2718         ;;
2719     *)
2720         AC_PATH_PROG([CCACHE],[ccache],[not found])
2721         if test "$CCACHE" = "not found"; then
2722             CCACHE=""
2723         else
2724             CCACHE_DEPEND_MODE=1
2725             # Need to check for ccache version: otherwise prevents
2726             # caching of the results (like "-x objective-c++" for Mac)
2727             if test $_os = Darwin -o $_os = iOS; then
2728                 # Check ccache version
2729                 AC_MSG_CHECKING([whether version of ccache is suitable])
2730                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2731                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2732                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2733                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2734                 else
2735                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2736                     CCACHE=""
2737                     CCACHE_DEPEND_MODE=
2738                 fi
2739             fi
2740         fi
2741         ;;
2742     esac
2743 else
2744     CCACHE=""
2746 if test "$enable_ccache" = "nodepend"; then
2747     CCACHE_DEPEND_MODE=""
2749 AC_SUBST(CCACHE_DEPEND_MODE)
2751 if test "$CCACHE" != ""; then
2752     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2753     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2754     if test "$ccache_size" = ""; then
2755         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2756         if test "$ccache_size" = ""; then
2757             ccache_size=0
2758         fi
2759         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2760         if test $ccache_size -lt 1024; then
2761             CCACHE=""
2762             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2763             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2764         else
2765             # warn that ccache may be too small for debug build
2766             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2767             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2768         fi
2769     else
2770         if test $ccache_size -lt 5; then
2771             #warn that ccache may be too small for debug build
2772             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2773             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2774         fi
2775     fi
2778 dnl ===================================================================
2779 dnl  Checks for C compiler,
2780 dnl  The check for the C++ compiler is later on.
2781 dnl ===================================================================
2782 if test "$_os" != "WINNT"; then
2783     GCC_HOME_SET="true"
2784     AC_MSG_CHECKING([gcc home])
2785     if test -z "$with_gcc_home"; then
2786         if test "$enable_icecream" = "yes"; then
2787             if test -d "/usr/lib/icecc/bin"; then
2788                 GCC_HOME="/usr/lib/icecc/"
2789             elif test -d "/usr/libexec/icecc/bin"; then
2790                 GCC_HOME="/usr/libexec/icecc/"
2791             elif test -d "/opt/icecream/bin"; then
2792                 GCC_HOME="/opt/icecream/"
2793             else
2794                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2796             fi
2797         else
2798             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2799             GCC_HOME_SET="false"
2800         fi
2801     else
2802         GCC_HOME="$with_gcc_home"
2803     fi
2804     AC_MSG_RESULT($GCC_HOME)
2805     AC_SUBST(GCC_HOME)
2807     if test "$GCC_HOME_SET" = "true"; then
2808         if test -z "$CC"; then
2809             CC="$GCC_HOME/bin/gcc"
2810             CC_BASE="gcc"
2811         fi
2812         if test -z "$CXX"; then
2813             CXX="$GCC_HOME/bin/g++"
2814             CXX_BASE="g++"
2815         fi
2816     fi
2819 COMPATH=`dirname "$CC"`
2820 if test "$COMPATH" = "."; then
2821     AC_PATH_PROGS(COMPATH, $CC)
2822     dnl double square bracket to get single because of M4 quote...
2823     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2825 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2827 dnl ===================================================================
2828 dnl Java support
2829 dnl ===================================================================
2830 AC_MSG_CHECKING([whether to build with Java support])
2831 if test "$with_java" != "no"; then
2832     if test "$DISABLE_SCRIPTING" = TRUE; then
2833         AC_MSG_RESULT([no, overridden by --disable-scripting])
2834         ENABLE_JAVA=""
2835         with_java=no
2836     else
2837         AC_MSG_RESULT([yes])
2838         ENABLE_JAVA="TRUE"
2839         AC_DEFINE(HAVE_FEATURE_JAVA)
2840     fi
2841 else
2842     AC_MSG_RESULT([no])
2843     ENABLE_JAVA=""
2846 AC_SUBST(ENABLE_JAVA)
2848 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2850 dnl ENABLE_JAVA="" indicate no Java support at all
2852 dnl ===================================================================
2853 dnl Check macOS SDK and compiler
2854 dnl ===================================================================
2856 if test $_os = Darwin; then
2858     # If no --with-macosx-sdk option is given, look for one
2860     # The intent is that for "most" Mac-based developers, a suitable
2861     # SDK will be found automatically without any configure options.
2863     # For developers with a current Xcode, the lowest-numbered SDK
2864     # higher than or equal to the minimum required should be found.
2866     AC_MSG_CHECKING([what macOS SDK to use])
2867     for _macosx_sdk in ${with_macosx_sdk-11.0 10.15 10.14 10.13}; do
2868         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2869         if test -d "$MACOSX_SDK_PATH"; then
2870             with_macosx_sdk="${_macosx_sdk}"
2871             break
2872         else
2873             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2874             if test -d "$MACOSX_SDK_PATH"; then
2875                 with_macosx_sdk="${_macosx_sdk}"
2876                 break
2877             fi
2878         fi
2879     done
2880     if test ! -d "$MACOSX_SDK_PATH"; then
2881         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2882     fi
2884     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2886     case $with_macosx_sdk in
2887     10.13)
2888         MACOSX_SDK_VERSION=101300
2889         ;;
2890     10.14)
2891         MACOSX_SDK_VERSION=101400
2892         ;;
2893     10.15)
2894         MACOSX_SDK_VERSION=101500
2895         ;;
2896     11.0)
2897         MACOSX_SDK_VERSION=110000
2898         ;;
2899     *)
2900         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.0])
2901         ;;
2902     esac
2904     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
2905         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
2906     fi
2908     if test "$with_macosx_version_min_required" = "" ; then
2909         if test "$host_cpu" = x86_64; then
2910             with_macosx_version_min_required="10.10";
2911         else
2912             with_macosx_version_min_required="10.16";
2913         fi
2914     fi
2916     if test "$with_macosx_version_max_allowed" = "" ; then
2917         with_macosx_version_max_allowed="$with_macosx_sdk"
2918     fi
2920     # export this so that "xcrun" invocations later return matching values
2921     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2922     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2923     export DEVELOPER_DIR
2924     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2925     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2927     AC_MSG_CHECKING([whether Xcode is new enough])
2928     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2929     my_xcode_ver2=${my_xcode_ver1#Xcode }
2930     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2931     if test "$my_xcode_ver3" -ge 1103; then
2932         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2933     else
2934         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
2935     fi
2937     case "$with_macosx_version_min_required" in
2938     10.10)
2939         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2940         ;;
2941     10.11)
2942         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2943         ;;
2944     10.12)
2945         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2946         ;;
2947     10.13)
2948         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2949         ;;
2950     10.14)
2951         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2952         ;;
2953     10.15)
2954         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2955         ;;
2956     10.16)
2957         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
2958         ;;
2959     11.0)
2960         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
2961         ;;
2962     *)
2963         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])
2964         ;;
2965     esac
2967     LIBTOOL=/usr/bin/libtool
2968     INSTALL_NAME_TOOL=install_name_tool
2969     if test -z "$save_CC"; then
2970         stdlib=-stdlib=libc++
2971         if test "$ENABLE_LTO" = TRUE; then
2972             lto=-flto
2973         fi
2975         AC_MSG_CHECKING([what C compiler to use])
2976         CC="`xcrun -find clang`"
2977         CC_BASE=`first_arg_basename "$CC"`
2978         if test "$host_cpu" = x86_64; then
2979             CC+=" -target x86_64-apple-macos"
2980         else
2981             CC+=" -target arm64-apple-macos"
2982         fi
2983         CC+=" $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2984         AC_MSG_RESULT([$CC])
2986         AC_MSG_CHECKING([what C++ compiler to use])
2987         CXX="`xcrun -find clang++`"
2988         CXX_BASE=`first_arg_basename "$CXX"`
2989         if test "$host_cpu" = x86_64; then
2990             CXX+=" -target x86_64-apple-macos"
2991         else
2992             CXX+=" -target arm64-apple-macos"
2993         fi
2994         CXX+=" $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2995         AC_MSG_RESULT([$CXX])
2997         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2998         AR=`xcrun -find ar`
2999         NM=`xcrun -find nm`
3000         STRIP=`xcrun -find strip`
3001         LIBTOOL=`xcrun -find libtool`
3002         RANLIB=`xcrun -find ranlib`
3003     fi
3005     case "$with_macosx_version_max_allowed" in
3006     10.10)
3007         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3008         ;;
3009     10.11)
3010         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3011         ;;
3012     10.12)
3013         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3014         ;;
3015     10.13)
3016         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3017         ;;
3018     10.14)
3019         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3020         ;;
3021     10.15)
3022         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3023         ;;
3024     11.0)
3025         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3026         ;;
3027     *)
3028         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])
3029         ;;
3030     esac
3032     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3033     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3034         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])
3035     else
3036         AC_MSG_RESULT([ok])
3037     fi
3039     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3040     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3041         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3042     else
3043         AC_MSG_RESULT([ok])
3044     fi
3045     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3046     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3048     AC_MSG_CHECKING([whether to do code signing])
3050     if test "$enable_macosx_code_signing" = yes; then
3051         # By default use the first suitable certificate (?).
3053         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3054         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3055         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3056         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3057         # "Developer ID Application" one.
3059         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3060         if test -n "$identity"; then
3061             MACOSX_CODESIGNING_IDENTITY=$identity
3062             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3063             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3064         else
3065             AC_MSG_ERROR([cannot determine identity to use])
3066         fi
3067     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3068         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3069         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3070         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3071     else
3072         AC_MSG_RESULT([no])
3073     fi
3075     AC_MSG_CHECKING([whether to create a Mac App Store package])
3077     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3078         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3079     elif test "$enable_macosx_package_signing" = yes; then
3080         # By default use the first suitable certificate.
3081         # It should be a "3rd Party Mac Developer Installer" one
3083         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3084         if test -n "$identity"; then
3085             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3086             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3087             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3088         else
3089             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3090         fi
3091     elif test -n "$enable_macosx_package_signing"; then
3092         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3093         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3094         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3095     else
3096         AC_MSG_RESULT([no])
3097     fi
3099     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3100         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3101     fi
3103     AC_MSG_CHECKING([whether to sandbox the application])
3105     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3106         AC_MSG_ERROR([macOS sandboxing requires code signing])
3107     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3108         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3109     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3110         ENABLE_MACOSX_SANDBOX=TRUE
3111         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3112         AC_MSG_RESULT([yes])
3113     else
3114         AC_MSG_RESULT([no])
3115     fi
3117     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3118     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3119     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3121 AC_SUBST(MACOSX_SDK_PATH)
3122 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3123 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3124 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3125 AC_SUBST(INSTALL_NAME_TOOL)
3126 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3127 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3128 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3129 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3130 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3132 dnl ===================================================================
3133 dnl Check iOS SDK and compiler
3134 dnl ===================================================================
3136 if test $_os = iOS; then
3137     AC_MSG_CHECKING([what iOS SDK to use])
3138     current_sdk_ver=14.0
3139     older_sdk_vers="13.6 13.5 13.4 13.2 13.1 13.0 12.4 12.2"
3140     if test "$enable_ios_simulator" = "yes"; then
3141         platform=iPhoneSimulator
3142         versionmin=-mios-simulator-version-min=12.2
3143     else
3144         platform=iPhoneOS
3145         versionmin=-miphoneos-version-min=12.2
3146     fi
3147     xcode_developer=`xcode-select -print-path`
3149     for sdkver in $current_sdk_ver $older_sdk_vers; do
3150         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3151         if test -d $t; then
3152             sysroot=$t
3153             break
3154         fi
3155     done
3157     if test -z "$sysroot"; then
3158         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3159     fi
3161     AC_MSG_RESULT($sysroot)
3163     # LTO is not really recommended for iOS builds,
3164     # the link time will be astronomical
3165     if test "$ENABLE_LTO" = TRUE; then
3166         lto=-flto
3167     fi
3169     stdlib="-stdlib=libc++"
3171     AC_MSG_CHECKING([what C compiler to use])
3172     CC="`xcrun -find clang`"
3173     CC_BASE=`first_arg_basename "$CC"`
3174     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $lto $versionmin"
3175     AC_MSG_RESULT([$CC])
3177     AC_MSG_CHECKING([what C++ compiler to use])
3178     CXX="`xcrun -find clang++`"
3179     CXX_BASE=`first_arg_basename "$CXX"`
3180     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $lto $versionmin"
3181     AC_MSG_RESULT([$CXX])
3183     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3184     AR=`xcrun -find ar`
3185     NM=`xcrun -find nm`
3186     STRIP=`xcrun -find strip`
3187     LIBTOOL=`xcrun -find libtool`
3188     RANLIB=`xcrun -find ranlib`
3191 AC_MSG_CHECKING([whether to treat the installation as read-only])
3193 if test $_os = Darwin; then
3194     enable_readonly_installset=yes
3195 elif test "$enable_extensions" != yes; then
3196     enable_readonly_installset=yes
3198 if test "$enable_readonly_installset" = yes; then
3199     AC_MSG_RESULT([yes])
3200     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3201 else
3202     AC_MSG_RESULT([no])
3205 dnl ===================================================================
3206 dnl Structure of install set
3207 dnl ===================================================================
3209 if test $_os = Darwin; then
3210     LIBO_BIN_FOLDER=MacOS
3211     LIBO_ETC_FOLDER=Resources
3212     LIBO_LIBEXEC_FOLDER=MacOS
3213     LIBO_LIB_FOLDER=Frameworks
3214     LIBO_LIB_PYUNO_FOLDER=Resources
3215     LIBO_SHARE_FOLDER=Resources
3216     LIBO_SHARE_HELP_FOLDER=Resources/help
3217     LIBO_SHARE_JAVA_FOLDER=Resources/java
3218     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3219     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3220     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3221     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3222     LIBO_URE_BIN_FOLDER=MacOS
3223     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3224     LIBO_URE_LIB_FOLDER=Frameworks
3225     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3226     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3227 elif test $_os = WINNT; then
3228     LIBO_BIN_FOLDER=program
3229     LIBO_ETC_FOLDER=program
3230     LIBO_LIBEXEC_FOLDER=program
3231     LIBO_LIB_FOLDER=program
3232     LIBO_LIB_PYUNO_FOLDER=program
3233     LIBO_SHARE_FOLDER=share
3234     LIBO_SHARE_HELP_FOLDER=help
3235     LIBO_SHARE_JAVA_FOLDER=program/classes
3236     LIBO_SHARE_PRESETS_FOLDER=presets
3237     LIBO_SHARE_READMES_FOLDER=readmes
3238     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3239     LIBO_SHARE_SHELL_FOLDER=program/shell
3240     LIBO_URE_BIN_FOLDER=program
3241     LIBO_URE_ETC_FOLDER=program
3242     LIBO_URE_LIB_FOLDER=program
3243     LIBO_URE_MISC_FOLDER=program
3244     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3245 else
3246     LIBO_BIN_FOLDER=program
3247     LIBO_ETC_FOLDER=program
3248     LIBO_LIBEXEC_FOLDER=program
3249     LIBO_LIB_FOLDER=program
3250     LIBO_LIB_PYUNO_FOLDER=program
3251     LIBO_SHARE_FOLDER=share
3252     LIBO_SHARE_HELP_FOLDER=help
3253     LIBO_SHARE_JAVA_FOLDER=program/classes
3254     LIBO_SHARE_PRESETS_FOLDER=presets
3255     LIBO_SHARE_READMES_FOLDER=readmes
3256     if test "$enable_fuzzers" != yes; then
3257         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3258     else
3259         LIBO_SHARE_RESOURCE_FOLDER=resource
3260     fi
3261     LIBO_SHARE_SHELL_FOLDER=program/shell
3262     LIBO_URE_BIN_FOLDER=program
3263     LIBO_URE_ETC_FOLDER=program
3264     LIBO_URE_LIB_FOLDER=program
3265     LIBO_URE_MISC_FOLDER=program
3266     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3268 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3269 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3270 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3271 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3272 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3273 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3274 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3275 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3276 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3277 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3278 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3279 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3280 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3281 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3282 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3283 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3285 # Not all of them needed in config_host.mk, add more if need arises
3286 AC_SUBST(LIBO_BIN_FOLDER)
3287 AC_SUBST(LIBO_ETC_FOLDER)
3288 AC_SUBST(LIBO_LIB_FOLDER)
3289 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3290 AC_SUBST(LIBO_SHARE_FOLDER)
3291 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3292 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3293 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3294 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3295 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3296 AC_SUBST(LIBO_URE_BIN_FOLDER)
3297 AC_SUBST(LIBO_URE_ETC_FOLDER)
3298 AC_SUBST(LIBO_URE_LIB_FOLDER)
3299 AC_SUBST(LIBO_URE_MISC_FOLDER)
3300 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3302 dnl ===================================================================
3303 dnl Windows specific tests and stuff
3304 dnl ===================================================================
3306 reg_get_value()
3308     # Return value: $regvalue
3309     unset regvalue
3311     local _regentry="/proc/registry${1}/${2}"
3312     if test -f "$_regentry"; then
3313         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3314         # Registry keys read via /proc/registry* are always \0 terminated!
3315         local _regvalue=$(tr -d '\0' < "$_regentry")
3316         if test $? -eq 0; then
3317             regvalue=$_regvalue
3318         fi
3319     fi
3322 # Get a value from the 32-bit side of the Registry
3323 reg_get_value_32()
3325     reg_get_value "32" "$1"
3328 # Get a value from the 64-bit side of the Registry
3329 reg_get_value_64()
3331     reg_get_value "64" "$1"
3334 if test "$_os" = "WINNT"; then
3335     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3336     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3337         AC_MSG_RESULT([no])
3338         WINDOWS_SDK_ARCH="x86"
3339     else
3340         AC_MSG_RESULT([yes])
3341         WINDOWS_SDK_ARCH="x64"
3342         BITNESS_OVERRIDE=64
3343     fi
3345 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3346     cross_compiling="yes"
3348 if test "$cross_compiling" = "yes"; then
3349     export CROSS_COMPILING=TRUE
3350 else
3351     CROSS_COMPILING=
3352     BUILD_TYPE="$BUILD_TYPE NATIVE"
3354 AC_SUBST(CROSS_COMPILING)
3356 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3357 # NOTE: must _not_ be used for bundled external libraries!
3358 ISYSTEM=
3359 if test "$GCC" = "yes"; then
3360     AC_MSG_CHECKING( for -isystem )
3361     save_CFLAGS=$CFLAGS
3362     CFLAGS="$CFLAGS -Werror"
3363     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3364     CFLAGS=$save_CFLAGS
3365     if test -n "$ISYSTEM"; then
3366         AC_MSG_RESULT(yes)
3367     else
3368         AC_MSG_RESULT(no)
3369     fi
3371 if test -z "$ISYSTEM"; then
3372     # fall back to using -I
3373     ISYSTEM=-I
3375 AC_SUBST(ISYSTEM)
3377 dnl ===================================================================
3378 dnl  Check which Visual Studio compiler is used
3379 dnl ===================================================================
3381 map_vs_year_to_version()
3383     # Return value: $vsversion
3385     unset vsversion
3387     case $1 in
3388     2019)
3389         vsversion=16;;
3390     *)
3391         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3392     esac
3395 vs_versions_to_check()
3397     # Args: $1 (optional) : versions to check, in the order of preference
3398     # Return value: $vsversions
3400     unset vsversions
3402     if test -n "$1"; then
3403         map_vs_year_to_version "$1"
3404         vsversions=$vsversion
3405     else
3406         # We accept only 2019
3407         vsversions="16"
3408     fi
3411 win_get_env_from_vsvars32bat()
3413     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3414     # Also seems to be located in another directory under the same name: vsvars32.bat
3415     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3416     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3417     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3418     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3419     chmod +x $WRAPPERBATCHFILEPATH
3420     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3421     rm -f $WRAPPERBATCHFILEPATH
3422     printf '%s' "$_win_get_env_from_vsvars32bat"
3425 find_ucrt()
3427     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3428     if test -n "$regvalue"; then
3429         PathFormat "$regvalue"
3430         UCRTSDKDIR=$formatted_path
3431         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3432         UCRTVERSION=$regvalue
3433         # Rest if not exist
3434         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3435           UCRTSDKDIR=
3436         fi
3437     fi
3438     if test -z "$UCRTSDKDIR"; then
3439         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3440         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3441         if test -f "$ide_env_file"; then
3442             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3443             UCRTSDKDIR=$formatted_path
3444             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3445             dnl Hack needed at least by tml:
3446             if test "$UCRTVERSION" = 10.0.15063.0 \
3447                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3448                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3449             then
3450                 UCRTVERSION=10.0.14393.0
3451             fi
3452         else
3453           AC_MSG_ERROR([No UCRT found])
3454         fi
3455     fi
3458 find_msvc()
3460     # Find Visual C++ 2019
3461     # Args: $1 (optional) : The VS version year
3462     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3464     unset vctest vcnum vcnumwithdot vcbuildnumber
3466     vs_versions_to_check "$1"
3467     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3468     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3469     PathFormat "$vswhere"
3470     vswhere=$formatted_path
3471     for ver in $vsversions; do
3472         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3473         # Fall back to all MS products (this includes VC++ Build Tools)
3474         if ! test -n "$vswhereoutput"; then
3475             AC_MSG_CHECKING([VC++ Build Tools and similar])
3476             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3477         fi
3478         if test -n "$vswhereoutput"; then
3479             PathFormat "$vswhereoutput"
3480             vctest=$formatted_path
3481             break
3482         fi
3483     done
3485     if test -n "$vctest"; then
3486         vcnumwithdot="$ver.0"
3487         case "$vcnumwithdot" in
3488         16.0)
3489             vcyear=2019
3490             vcnum=160
3491             ;;
3492         esac
3493         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3495     fi
3498 SOLARINC=
3499 MSBUILD_PATH=
3500 DEVENV=
3501 if test "$_os" = "WINNT"; then
3502     AC_MSG_CHECKING([Visual C++])
3503     find_msvc "$with_visual_studio"
3504     if test -z "$vctest"; then
3505         if test -n "$with_visual_studio"; then
3506             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3507         else
3508             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3509         fi
3510     fi
3512     if test "$BITNESS_OVERRIDE" = ""; then
3513         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3514             VC_PRODUCT_DIR=$vctest/VC
3515         else
3516             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3517         fi
3518     else
3519         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3520             VC_PRODUCT_DIR=$vctest/VC
3521         else
3522             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3523         fi
3524     fi
3525     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3527     AC_MSG_CHECKING([for short pathname of VC product directory])
3528     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3529     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3531     UCRTSDKDIR=
3532     UCRTVERSION=
3534     AC_MSG_CHECKING([for UCRT location])
3535     find_ucrt
3536     # find_ucrt errors out if it doesn't find it
3537     AC_MSG_RESULT([found])
3538     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3539     ucrtincpath_formatted=$formatted_path
3540     # SOLARINC is used for external modules and must be set too.
3541     # And no, it's not sufficient to set SOLARINC only, as configure
3542     # itself doesn't honour it.
3543     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3544     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3545     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3546     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3548     AC_SUBST(UCRTSDKDIR)
3549     AC_SUBST(UCRTVERSION)
3551     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3552     # Find the proper version of MSBuild.exe to use based on the VS version
3553     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3554     if test -n "$regvalue" ; then
3555         AC_MSG_RESULT([found: $regvalue])
3556         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3557     else
3558         if test "$vcnumwithdot" = "16.0"; then
3559             if test "$BITNESS_OVERRIDE" = ""; then
3560                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3561             else
3562                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3563             fi
3564         else
3565             if test "$BITNESS_OVERRIDE" = ""; then
3566                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3567             else
3568                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3569             fi
3570         fi
3571         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3572         AC_MSG_RESULT([$regvalue])
3573     fi
3575     # Find the version of devenv.exe
3576     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3577     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3578     if test ! -e "$DEVENV"; then
3579         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3580     fi
3582     dnl ===========================================================
3583     dnl  Check for the corresponding mspdb*.dll
3584     dnl ===========================================================
3586     VC_HOST_DIR=
3587     MSPDB_PATH=
3588     CL_PATH=
3590     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3591         VC_HOST_DIR="HostX64"
3592         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3593     else
3594         VC_HOST_DIR="HostX86"
3595         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3596     fi
3598     if test "$BITNESS_OVERRIDE" = ""; then
3599         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3600     else
3601         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3602     fi
3604     # MSVC 15.0 has libraries from 14.0?
3605     mspdbnum="140"
3607     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3608         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3609     fi
3611     dnl The path needs to be added before cl is called
3612     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3613     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3615     AC_MSG_CHECKING([cl.exe])
3617     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3618     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3619     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3620     # is not enough?
3622     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3623     dnl needed when building CLR code:
3624     if test -z "$MSVC_CXX"; then
3625         if test -f "$CL_PATH/cl.exe"; then
3626             MSVC_CXX="$CL_PATH/cl.exe"
3627         fi
3629         # This gives us a posix path with 8.3 filename restrictions
3630         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3631     fi
3633     if test -z "$CC"; then
3634         CC=$MSVC_CXX
3635         CC_BASE=`first_arg_basename "$CC"`
3636     fi
3637     if test -z "$CXX"; then
3638         CXX=$MSVC_CXX
3639         CXX_BASE=`first_arg_basename "$CXX"`
3640     fi
3642     if test -n "$CC"; then
3643         # Remove /cl.exe from CC case insensitive
3644         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3645         if test "$BITNESS_OVERRIDE" = ""; then
3646            COMPATH="$VC_PRODUCT_DIR"
3647         else
3648             if test -n "$VC_PRODUCT_DIR"; then
3649                 COMPATH=$VC_PRODUCT_DIR
3650             fi
3651         fi
3653         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3655         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3657         PathFormat "$COMPATH"
3658         COMPATH=`win_short_path_for_make "$formatted_path"`
3660         VCVER=$vcnum
3662         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3663         # are always "better", we list them in reverse chronological order.
3665         case "$vcnum" in
3666         160)
3667             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3668             ;;
3669         esac
3671         # The expectation is that --with-windows-sdk should not need to be used
3672         if test -n "$with_windows_sdk"; then
3673             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3674             *" "$with_windows_sdk" "*)
3675                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3676                 ;;
3677             *)
3678                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
3679                 ;;
3680             esac
3681         fi
3683         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3684         ac_objext=obj
3685         ac_exeext=exe
3687     else
3688         AC_MSG_ERROR([Visual C++ not found after all, huh])
3689     fi
3691     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
3692     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3693         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3694         // between Visual Studio versions and _MSC_VER:
3695         #if _MSC_VER < 1924
3696         #error
3697         #endif
3698     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3700     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3701     # version of the Explorer extension (and maybe other small
3702     # bits, too) needed when installing a 32-bit LibreOffice on a
3703     # 64-bit OS. The 64-bit Explorer extension is a feature that
3704     # has been present since long in OOo. Don't confuse it with
3705     # building LibreOffice itself as 64-bit code.
3707     BUILD_X64=
3708     CXX_X64_BINARY=
3710     if test "$BITNESS_OVERRIDE" = ""; then
3711         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3712         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3713              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3714             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3715                 BUILD_X64=TRUE
3716                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3717             fi
3718         fi
3719         if test "$BUILD_X64" = TRUE; then
3720             AC_MSG_RESULT([found])
3721         else
3722             AC_MSG_RESULT([not found])
3723             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3724         fi
3725     else
3726         CXX_X64_BINARY=$CXX
3727     fi
3728     AC_SUBST(BUILD_X64)
3730     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3731     AC_SUBST(CXX_X64_BINARY)
3733     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3734     # needed to support TWAIN scan on both 32- and 64-bit systems
3736     BUILD_X86=
3738     if test "$BITNESS_OVERRIDE" = "64"; then
3739         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3740         if test -n "$CXX_X86_BINARY"; then
3741             BUILD_X86=TRUE
3742             AC_MSG_RESULT([preset])
3743         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3744             BUILD_X86=TRUE
3745             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3746             CXX_X86_BINARY+=" /arch:SSE"
3747             AC_MSG_RESULT([found])
3748         else
3749             CXX_X86_BINARY=
3750             AC_MSG_RESULT([not found])
3751             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3752         fi
3753     else
3754         BUILD_X86=TRUE
3755         CXX_X86_BINARY=$MSVC_CXX
3756     fi
3757     AC_SUBST(BUILD_X86)
3758     AC_SUBST(CXX_X86_BINARY)
3760 AC_SUBST(VCVER)
3761 AC_SUBST(DEVENV)
3762 AC_SUBST(MSVC_CXX)
3765 # unowinreg.dll
3767 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3768 AC_SUBST(UNOWINREG_DLL)
3770 COM_IS_CLANG=
3771 AC_MSG_CHECKING([whether the compiler is actually Clang])
3772 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3773     #ifndef __clang__
3774     you lose
3775     #endif
3776     int foo=42;
3777     ]])],
3778     [AC_MSG_RESULT([yes])
3779      COM_IS_CLANG=TRUE],
3780     [AC_MSG_RESULT([no])])
3781 AC_SUBST(COM_IS_CLANG)
3783 CC_PLAIN=$CC
3784 CLANGVER=
3785 if test "$COM_IS_CLANG" = TRUE; then
3786     AC_MSG_CHECKING([whether Clang is new enough])
3787     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3788         #if !defined __apple_build_version__
3789         #error
3790         #endif
3791         ]])],
3792         [my_apple_clang=yes],[my_apple_clang=])
3793     if test "$my_apple_clang" = yes; then
3794         AC_MSG_RESULT([assumed yes (Apple Clang)])
3795     else
3796         if test "$_os" = WINNT; then
3797             dnl In which case, assume clang-cl:
3798             my_args="/EP /TC"
3799             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3800             dnl clang-cl:
3801             CC_PLAIN=
3802             for i in $CC; do
3803                 case $i in
3804                 -FIIntrin.h)
3805                     ;;
3806                 *)
3807                     CC_PLAIN="$CC_PLAIN $i"
3808                     ;;
3809                 esac
3810             done
3811         else
3812             my_args="-E -P"
3813         fi
3814         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3815         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3816         CLANGVER=`echo $clang_version \
3817             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3818         if test "$CLANGVER" -ge 50002; then
3819             AC_MSG_RESULT([yes ($clang_version)])
3820         else
3821             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3822         fi
3823         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3824         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3825     fi
3828 SHOWINCLUDES_PREFIX=
3829 if test "$_os" = WINNT; then
3830     dnl We need to guess the prefix of the -showIncludes output, it can be
3831     dnl localized
3832     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3833     echo "#include <stdlib.h>" > conftest.c
3834     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3835         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3836     rm -f conftest.c conftest.obj
3837     if test -z "$SHOWINCLUDES_PREFIX"; then
3838         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3839     else
3840         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3841     fi
3843 AC_SUBST(SHOWINCLUDES_PREFIX)
3846 # prefix C with ccache if needed
3848 if test "$CCACHE" != ""; then
3849     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3851     AC_LANG_PUSH([C])
3852     save_CFLAGS=$CFLAGS
3853     CFLAGS="$CFLAGS --ccache-skip -O2"
3854     dnl an empty program will do, we're checking the compiler flags
3855     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3856                       [use_ccache=yes], [use_ccache=no])
3857     if test $use_ccache = yes; then
3858         AC_MSG_RESULT([yes])
3859     else
3860         CC="$CCACHE $CC"
3861         CC_BASE="ccache $CC_BASE"
3862         AC_MSG_RESULT([no])
3863     fi
3864     CFLAGS=$save_CFLAGS
3865     AC_LANG_POP([C])
3868 # ===================================================================
3869 # check various GCC options that Clang does not support now but maybe
3870 # will somewhen in the future, check them even for GCC, so that the
3871 # flags are set
3872 # ===================================================================
3874 HAVE_GCC_GGDB2=
3875 if test "$GCC" = "yes"; then
3876     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3877     save_CFLAGS=$CFLAGS
3878     CFLAGS="$CFLAGS -Werror -ggdb2"
3879     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3880     CFLAGS=$save_CFLAGS
3881     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3882         AC_MSG_RESULT([yes])
3883     else
3884         AC_MSG_RESULT([no])
3885     fi
3887     if test "$host_cpu" = "m68k"; then
3888         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3889         save_CFLAGS=$CFLAGS
3890         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3891         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3892         CFLAGS=$save_CFLAGS
3893         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3894             AC_MSG_RESULT([yes])
3895         else
3896             AC_MSG_ERROR([no])
3897         fi
3898     fi
3900 AC_SUBST(HAVE_GCC_GGDB2)
3902 dnl ===================================================================
3903 dnl  Test the gcc version
3904 dnl ===================================================================
3905 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3906     AC_MSG_CHECKING([the GCC version])
3907     _gcc_version=`$CC -dumpversion`
3908     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3909         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3910     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3912     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3914     if test "$gcc_full_version" -lt 70000; then
3915         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3916     fi
3917 else
3918     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3919     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3920     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3921     # (which reports itself as GCC 4.2.1).
3922     GCC_VERSION=
3924 AC_SUBST(GCC_VERSION)
3926 dnl Set the ENABLE_DBGUTIL variable
3927 dnl ===================================================================
3928 AC_MSG_CHECKING([whether to build with additional debug utilities])
3929 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3930     ENABLE_DBGUTIL="TRUE"
3931     # this is an extra var so it can have different default on different MSVC
3932     # versions (in case there are version specific problems with it)
3933     MSVC_USE_DEBUG_RUNTIME="TRUE"
3935     AC_MSG_RESULT([yes])
3936     # cppunit and graphite expose STL in public headers
3937     if test "$with_system_cppunit" = "yes"; then
3938         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3939     else
3940         with_system_cppunit=no
3941     fi
3942     if test "$with_system_graphite" = "yes"; then
3943         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3944     else
3945         with_system_graphite=no
3946     fi
3947     if test "$with_system_orcus" = "yes"; then
3948         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3949     else
3950         with_system_orcus=no
3951     fi
3952     if test "$with_system_libcmis" = "yes"; then
3953         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3954     else
3955         with_system_libcmis=no
3956     fi
3957     if test "$with_system_hunspell" = "yes"; then
3958         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3959     else
3960         with_system_hunspell=no
3961     fi
3962     if test "$with_system_gpgmepp" = "yes"; then
3963         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3964     else
3965         with_system_gpgmepp=no
3966     fi
3967     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3968     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3969     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3970     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3971     # of those two is using the system variant:
3972     if test "$with_system_libnumbertext" = "yes"; then
3973         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3974     else
3975         with_system_libnumbertext=no
3976     fi
3977     if test "$with_system_libwps" = "yes"; then
3978         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3979     else
3980         with_system_libwps=no
3981     fi
3982 else
3983     ENABLE_DBGUTIL=""
3984     MSVC_USE_DEBUG_RUNTIME=""
3985     AC_MSG_RESULT([no])
3987 AC_SUBST(ENABLE_DBGUTIL)
3988 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3990 dnl Set the ENABLE_DEBUG variable.
3991 dnl ===================================================================
3992 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3993     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3995 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3996     if test -z "$libo_fuzzed_enable_debug"; then
3997         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3998     else
3999         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4000         enable_debug=yes
4001     fi
4004 AC_MSG_CHECKING([whether to do a debug build])
4005 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4006     ENABLE_DEBUG="TRUE"
4007     if test -n "$ENABLE_DBGUTIL" ; then
4008         AC_MSG_RESULT([yes (dbgutil)])
4009     else
4010         AC_MSG_RESULT([yes])
4011     fi
4012 else
4013     ENABLE_DEBUG=""
4014     AC_MSG_RESULT([no])
4016 AC_SUBST(ENABLE_DEBUG)
4018 dnl ===================================================================
4019 dnl Select the linker to use (gold/lld/ld.bfd).
4020 dnl This is done only after compiler checks (need to know if Clang is
4021 dnl used, for different defaults) and after checking if a debug build
4022 dnl is wanted (non-debug builds get the default linker if not explicitly
4023 dnl specified otherwise).
4024 dnl All checks for linker features/options should come after this.
4025 dnl ===================================================================
4026 check_use_ld()
4028     use_ld=-fuse-ld=${1%%:*}
4029     use_ld_path=${1#*:}
4030     if test "$use_ld_path" != "$1"; then
4031         use_ld="$use_ld --ld-path=$use_ld_path"
4032     fi
4033     use_ld_fail_if_error=$2
4034     use_ld_ok=
4035     AC_MSG_CHECKING([for $use_ld linker support])
4036     use_ld_ldflags_save="$LDFLAGS"
4037     LDFLAGS="$LDFLAGS $use_ld"
4038     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4039 #include <stdio.h>
4040         ],[
4041 printf ("hello world\n");
4042         ])], USE_LD=$use_ld, [])
4043     if test -n "$USE_LD"; then
4044         AC_MSG_RESULT( yes )
4045         use_ld_ok=yes
4046     else
4047         if test -n "$use_ld_fail_if_error"; then
4048             AC_MSG_ERROR( no )
4049         else
4050             AC_MSG_RESULT( no )
4051         fi
4052     fi
4053     if test -n "$use_ld_ok"; then
4054         dnl keep the value of LDFLAGS
4055         return 0
4056     fi
4057     LDFLAGS="$use_ld_ldflags_save"
4058     return 1
4060 USE_LD=
4061 if test "$enable_ld" != "no"; then
4062     if test "$GCC" = "yes"; then
4063         if test -n "$enable_ld"; then
4064             check_use_ld "$enable_ld" fail_if_error
4065         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4066             dnl non-debug builds default to the default linker
4067             true
4068         elif test -n "$COM_IS_CLANG"; then
4069             check_use_ld lld
4070             if test $? -ne 0; then
4071                 check_use_ld gold
4072             fi
4073         else
4074             # For gcc first try gold, new versions also support lld.
4075             check_use_ld gold
4076             if test $? -ne 0; then
4077                 check_use_ld lld
4078             fi
4079         fi
4080         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4081         rm conftest.out
4082         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4083         if test -z "$ld_used"; then
4084             ld_used="unknown"
4085         fi
4086         AC_MSG_CHECKING([for linker that is used])
4087         AC_MSG_RESULT([$ld_used])
4088         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4089             if echo "$ld_used" | grep -q "^GNU ld"; then
4090                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4091                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4092             fi
4093         fi
4094     else
4095         if test "$enable_ld" = "yes"; then
4096             AC_MSG_ERROR([--enable-ld not supported])
4097         fi
4098     fi
4100 AC_SUBST(USE_LD)
4102 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4103 if test "$GCC" = "yes"; then
4104     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4105     bsymbolic_functions_ldflags_save=$LDFLAGS
4106     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4107     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4108 #include <stdio.h>
4109         ],[
4110 printf ("hello world\n");
4111         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4112     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4113         AC_MSG_RESULT( found )
4114     else
4115         AC_MSG_RESULT( not found )
4116     fi
4117     LDFLAGS=$bsymbolic_functions_ldflags_save
4119 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4121 LD_GC_SECTIONS=
4122 if test "$GCC" = "yes"; then
4123     for flag in "--gc-sections" "-dead_strip"; do
4124         AC_MSG_CHECKING([for $flag linker support])
4125         ldflags_save=$LDFLAGS
4126         LDFLAGS="$LDFLAGS -Wl,$flag"
4127         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4128 #include <stdio.h>
4129             ],[
4130 printf ("hello world\n");
4131             ])],[
4132             LD_GC_SECTIONS="-Wl,$flag"
4133             AC_MSG_RESULT( found )
4134             ], [
4135             AC_MSG_RESULT( not found )
4136             ])
4137         LDFLAGS=$ldflags_save
4138         if test -n "$LD_GC_SECTIONS"; then
4139             break
4140         fi
4141     done
4143 AC_SUBST(LD_GC_SECTIONS)
4145 HAVE_GSPLIT_DWARF=
4146 if test "$enable_split_debug" != no; then
4147     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4148     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4149         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4150         save_CFLAGS=$CFLAGS
4151         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4152         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4153         CFLAGS=$save_CFLAGS
4154         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4155             AC_MSG_RESULT([yes])
4156         else
4157             if test "$enable_split_debug" = yes; then
4158                 AC_MSG_ERROR([no])
4159             else
4160                 AC_MSG_RESULT([no])
4161             fi
4162         fi
4163     fi
4164     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4165         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4166         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4167     fi
4169 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4171 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4172 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4173 save_CFLAGS=$CFLAGS
4174 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4175 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4176 CFLAGS=$save_CFLAGS
4177 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4178     AC_MSG_RESULT([yes])
4179 else
4180     AC_MSG_RESULT([no])
4182 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4184 ENABLE_GDB_INDEX=
4185 if test "$enable_gdb_index" != "no"; then
4186     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4187     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4188         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4189         save_CFLAGS=$CFLAGS
4190         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4191         have_ggnu_pubnames=
4192         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4193         if test "$have_ggnu_pubnames" != "TRUE"; then
4194             if test "$enable_gdb_index" = "yes"; then
4195                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4196             else
4197                 AC_MSG_RESULT( no )
4198             fi
4199         else
4200             AC_MSG_RESULT( yes )
4201             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4202             ldflags_save=$LDFLAGS
4203             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4204             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4205 #include <stdio.h>
4206                 ],[
4207 printf ("hello world\n");
4208                 ])], ENABLE_GDB_INDEX=TRUE, [])
4209             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4210                 AC_MSG_RESULT( yes )
4211             else
4212                 if test "$enable_gdb_index" = "yes"; then
4213                     AC_MSG_ERROR( no )
4214                 else
4215                     AC_MSG_RESULT( no )
4216                 fi
4217             fi
4218             LDFLAGS=$ldflags_save
4219         fi
4220         CFLAGS=$save_CFLAGS
4221         fi
4222     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4223         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4224         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4225     fi
4227 AC_SUBST(ENABLE_GDB_INDEX)
4229 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4230     enable_sal_log=yes
4232 if test "$enable_sal_log" = yes; then
4233     ENABLE_SAL_LOG=TRUE
4235 AC_SUBST(ENABLE_SAL_LOG)
4237 dnl Check for enable symbols option
4238 dnl ===================================================================
4239 AC_MSG_CHECKING([whether to generate debug information])
4240 if test -z "$enable_symbols"; then
4241     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4242         enable_symbols=yes
4243     else
4244         enable_symbols=no
4245     fi
4247 if test "$enable_symbols" = yes; then
4248     ENABLE_SYMBOLS_FOR=all
4249     AC_MSG_RESULT([yes])
4250 elif test "$enable_symbols" = no; then
4251     ENABLE_SYMBOLS_FOR=
4252     AC_MSG_RESULT([no])
4253 else
4254     # Selective debuginfo.
4255     ENABLE_SYMBOLS_FOR="$enable_symbols"
4256     AC_MSG_RESULT([for "$enable_symbols"])
4258 AC_SUBST(ENABLE_SYMBOLS_FOR)
4260 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4261     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4262     AC_MSG_CHECKING([whether enough memory is available for linking])
4263     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4264     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4265     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4266         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4267     else
4268         AC_MSG_RESULT([yes])
4269     fi
4272 ENABLE_OPTIMIZED=
4273 ENABLE_OPTIMIZED_DEBUG=
4274 AC_MSG_CHECKING([whether to compile with optimization flags])
4275 if test -z "$enable_optimized"; then
4276     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4277         enable_optimized=no
4278     else
4279         enable_optimized=yes
4280     fi
4282 if test "$enable_optimized" = yes; then
4283     ENABLE_OPTIMIZED=TRUE
4284     AC_MSG_RESULT([yes])
4285 elif test "$enable_optimized" = debug; then
4286     ENABLE_OPTIMIZED_DEBUG=TRUE
4287     AC_MSG_RESULT([yes (debug)])
4288     HAVE_GCC_OG=
4289     if test "$GCC" = "yes"; then
4290         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4291         save_CFLAGS=$CFLAGS
4292         CFLAGS="$CFLAGS -Werror -Og"
4293         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4294         CFLAGS=$save_CFLAGS
4295         if test "$HAVE_GCC_OG" = "TRUE"; then
4296             AC_MSG_RESULT([yes])
4297         else
4298             AC_MSG_RESULT([no])
4299         fi
4300     fi
4301     if test -z "$HAVE_GCC_OG"; then
4302         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4303     fi
4304 else
4305     AC_MSG_RESULT([no])
4307 AC_SUBST(ENABLE_OPTIMIZED)
4308 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4311 # determine CPUNAME, OS, ...
4312 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4314 case "$host_os" in
4316 aix*)
4317     COM=GCC
4318     CPUNAME=POWERPC
4319     USING_X11=TRUE
4320     OS=AIX
4321     RTL_OS=AIX
4322     RTL_ARCH=PowerPC
4323     PLATFORMID=aix_powerpc
4324     P_SEP=:
4325     ;;
4327 cygwin*)
4328     COM=MSC
4329     USING_X11=
4330     OS=WNT
4331     RTL_OS=Windows
4332     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4333         P_SEP=";"
4334     else
4335         P_SEP=:
4336     fi
4337     case "$host_cpu" in
4338     i*86|x86_64)
4339         if test "$BITNESS_OVERRIDE" = 64; then
4340             CPUNAME=X86_64
4341             RTL_ARCH=X86_64
4342             PLATFORMID=windows_x86_64
4343             WINDOWS_X64=1
4344             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4345         else
4346             CPUNAME=INTEL
4347             RTL_ARCH=x86
4348             PLATFORMID=windows_x86
4349         fi
4350         ;;
4351     *)
4352         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4353         ;;
4354     esac
4355     SCPDEFS="$SCPDEFS -D_MSC_VER"
4356     ;;
4358 darwin*|macos*)
4359     COM=GCC
4360     USING_X11=
4361     OS=MACOSX
4362     RTL_OS=MacOSX
4363     P_SEP=:
4365     case "$host_cpu" in
4366     aarch64|arm64)
4367         if test "$enable_ios_simulator" = "yes"; then
4368             OS=iOS
4369         else
4370             CPUNAME=AARCH64
4371             RTL_ARCH=AARCH64
4372             PLATFORMID=macosx_arm64
4373         fi
4374         ;;
4375     x86_64)
4376         if test "$enable_ios_simulator" = "yes"; then
4377             OS=iOS
4378         fi
4379         CPUNAME=X86_64
4380         RTL_ARCH=X86_64
4381         PLATFORMID=macosx_x86_64
4382         ;;
4383     *)
4384         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4385         ;;
4386     esac
4387     ;;
4389 ios*)
4390     COM=GCC
4391     USING_X11=
4392     OS=iOS
4393     RTL_OS=iOS
4394     P_SEP=:
4396     case "$host_cpu" in
4397     aarch64|arm64)
4398         if test "$enable_ios_simulator" = "yes"; then
4399             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4400         fi
4401         ;;
4402     *)
4403         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4404         ;;
4405     esac
4406     CPUNAME=AARCH64
4407     RTL_ARCH=AARCH64
4408     PLATFORMID=ios_arm64
4409     ;;
4411 dragonfly*)
4412     COM=GCC
4413     USING_X11=TRUE
4414     OS=DRAGONFLY
4415     RTL_OS=DragonFly
4416     P_SEP=:
4418     case "$host_cpu" in
4419     i*86)
4420         CPUNAME=INTEL
4421         RTL_ARCH=x86
4422         PLATFORMID=dragonfly_x86
4423         ;;
4424     x86_64)
4425         CPUNAME=X86_64
4426         RTL_ARCH=X86_64
4427         PLATFORMID=dragonfly_x86_64
4428         ;;
4429     *)
4430         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4431         ;;
4432     esac
4433     ;;
4435 freebsd*)
4436     COM=GCC
4437     USING_X11=TRUE
4438     RTL_OS=FreeBSD
4439     OS=FREEBSD
4440     P_SEP=:
4442     case "$host_cpu" in
4443     aarch64)
4444         CPUNAME=AARCH64
4445         PLATFORMID=freebsd_aarch64
4446         RTL_ARCH=AARCH64
4447         ;;
4448     i*86)
4449         CPUNAME=INTEL
4450         RTL_ARCH=x86
4451         PLATFORMID=freebsd_x86
4452         ;;
4453     x86_64|amd64)
4454         CPUNAME=X86_64
4455         RTL_ARCH=X86_64
4456         PLATFORMID=freebsd_x86_64
4457         ;;
4458     *)
4459         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4460         ;;
4461     esac
4462     ;;
4464 haiku*)
4465     COM=GCC
4466     USING_X11=
4467     GUIBASE=haiku
4468     RTL_OS=Haiku
4469     OS=HAIKU
4470     P_SEP=:
4472     case "$host_cpu" in
4473     i*86)
4474         CPUNAME=INTEL
4475         RTL_ARCH=x86
4476         PLATFORMID=haiku_x86
4477         ;;
4478     x86_64|amd64)
4479         CPUNAME=X86_64
4480         RTL_ARCH=X86_64
4481         PLATFORMID=haiku_x86_64
4482         ;;
4483     *)
4484         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4485         ;;
4486     esac
4487     ;;
4489 kfreebsd*)
4490     COM=GCC
4491     USING_X11=TRUE
4492     OS=LINUX
4493     RTL_OS=kFreeBSD
4494     P_SEP=:
4496     case "$host_cpu" in
4498     i*86)
4499         CPUNAME=INTEL
4500         RTL_ARCH=x86
4501         PLATFORMID=kfreebsd_x86
4502         ;;
4503     x86_64)
4504         CPUNAME=X86_64
4505         RTL_ARCH=X86_64
4506         PLATFORMID=kfreebsd_x86_64
4507         ;;
4508     *)
4509         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4510         ;;
4511     esac
4512     ;;
4514 linux-gnu*)
4515     COM=GCC
4516     USING_X11=TRUE
4517     OS=LINUX
4518     RTL_OS=Linux
4519     P_SEP=:
4521     case "$host_cpu" in
4523     aarch64)
4524         CPUNAME=AARCH64
4525         PLATFORMID=linux_aarch64
4526         RTL_ARCH=AARCH64
4527         ;;
4528     alpha)
4529         CPUNAME=AXP
4530         RTL_ARCH=ALPHA
4531         PLATFORMID=linux_alpha
4532         ;;
4533     arm*)
4534         CPUNAME=ARM
4535         EPM_FLAGS="-a arm"
4536         RTL_ARCH=ARM_EABI
4537         PLATFORMID=linux_arm_eabi
4538         case "$host_cpu" in
4539         arm*-linux)
4540             RTL_ARCH=ARM_OABI
4541             PLATFORMID=linux_arm_oabi
4542             ;;
4543         esac
4544         ;;
4545     hppa)
4546         CPUNAME=HPPA
4547         RTL_ARCH=HPPA
4548         EPM_FLAGS="-a hppa"
4549         PLATFORMID=linux_hppa
4550         ;;
4551     i*86)
4552         CPUNAME=INTEL
4553         RTL_ARCH=x86
4554         PLATFORMID=linux_x86
4555         ;;
4556     ia64)
4557         CPUNAME=IA64
4558         RTL_ARCH=IA64
4559         PLATFORMID=linux_ia64
4560         ;;
4561     mips)
4562         CPUNAME=GODSON
4563         RTL_ARCH=MIPS_EB
4564         EPM_FLAGS="-a mips"
4565         PLATFORMID=linux_mips_eb
4566         ;;
4567     mips64)
4568         CPUNAME=GODSON64
4569         RTL_ARCH=MIPS64_EB
4570         EPM_FLAGS="-a mips64"
4571         PLATFORMID=linux_mips64_eb
4572         ;;
4573     mips64el)
4574         CPUNAME=GODSON64
4575         RTL_ARCH=MIPS64_EL
4576         EPM_FLAGS="-a mips64el"
4577         PLATFORMID=linux_mips64_el
4578         ;;
4579     mipsel)
4580         CPUNAME=GODSON
4581         RTL_ARCH=MIPS_EL
4582         EPM_FLAGS="-a mipsel"
4583         PLATFORMID=linux_mips_el
4584         ;;
4585     m68k)
4586         CPUNAME=M68K
4587         RTL_ARCH=M68K
4588         PLATFORMID=linux_m68k
4589         ;;
4590     powerpc)
4591         CPUNAME=POWERPC
4592         RTL_ARCH=PowerPC
4593         PLATFORMID=linux_powerpc
4594         ;;
4595     powerpc64)
4596         CPUNAME=POWERPC64
4597         RTL_ARCH=PowerPC_64
4598         PLATFORMID=linux_powerpc64
4599         ;;
4600     powerpc64le)
4601         CPUNAME=POWERPC64
4602         RTL_ARCH=PowerPC_64_LE
4603         PLATFORMID=linux_powerpc64_le
4604         ;;
4605     sparc)
4606         CPUNAME=SPARC
4607         RTL_ARCH=SPARC
4608         PLATFORMID=linux_sparc
4609         ;;
4610     sparc64)
4611         CPUNAME=SPARC64
4612         RTL_ARCH=SPARC64
4613         PLATFORMID=linux_sparc64
4614         ;;
4615     s390)
4616         CPUNAME=S390
4617         RTL_ARCH=S390
4618         PLATFORMID=linux_s390
4619         ;;
4620     s390x)
4621         CPUNAME=S390X
4622         RTL_ARCH=S390x
4623         PLATFORMID=linux_s390x
4624         ;;
4625     x86_64)
4626         CPUNAME=X86_64
4627         RTL_ARCH=X86_64
4628         PLATFORMID=linux_x86_64
4629         ;;
4630     *)
4631         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4632         ;;
4633     esac
4634     ;;
4636 linux-android*)
4637     COM=GCC
4638     USING_X11=
4639     OS=ANDROID
4640     RTL_OS=Android
4641     P_SEP=:
4643     case "$host_cpu" in
4645     arm|armel)
4646         CPUNAME=ARM
4647         RTL_ARCH=ARM_EABI
4648         PLATFORMID=android_arm_eabi
4649         ;;
4650     aarch64)
4651         CPUNAME=AARCH64
4652         RTL_ARCH=AARCH64
4653         PLATFORMID=android_aarch64
4654         ;;
4655     i*86)
4656         CPUNAME=INTEL
4657         RTL_ARCH=x86
4658         PLATFORMID=android_x86
4659         ;;
4660     x86_64)
4661         CPUNAME=X86_64
4662         RTL_ARCH=X86_64
4663         PLATFORMID=android_x86_64
4664         ;;
4665     *)
4666         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4667         ;;
4668     esac
4669     ;;
4671 *netbsd*)
4672     COM=GCC
4673     USING_X11=TRUE
4674     OS=NETBSD
4675     RTL_OS=NetBSD
4676     P_SEP=:
4678     case "$host_cpu" in
4679     i*86)
4680         CPUNAME=INTEL
4681         RTL_ARCH=x86
4682         PLATFORMID=netbsd_x86
4683         ;;
4684     powerpc)
4685         CPUNAME=POWERPC
4686         RTL_ARCH=PowerPC
4687         PLATFORMID=netbsd_powerpc
4688         ;;
4689     sparc)
4690         CPUNAME=SPARC
4691         RTL_ARCH=SPARC
4692         PLATFORMID=netbsd_sparc
4693         ;;
4694     x86_64)
4695         CPUNAME=X86_64
4696         RTL_ARCH=X86_64
4697         PLATFORMID=netbsd_x86_64
4698         ;;
4699     *)
4700         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4701         ;;
4702     esac
4703     ;;
4705 openbsd*)
4706     COM=GCC
4707     USING_X11=TRUE
4708     OS=OPENBSD
4709     RTL_OS=OpenBSD
4710     P_SEP=:
4712     case "$host_cpu" in
4713     i*86)
4714         CPUNAME=INTEL
4715         RTL_ARCH=x86
4716         PLATFORMID=openbsd_x86
4717         ;;
4718     x86_64)
4719         CPUNAME=X86_64
4720         RTL_ARCH=X86_64
4721         PLATFORMID=openbsd_x86_64
4722         ;;
4723     *)
4724         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4725         ;;
4726     esac
4727     SOLARINC="$SOLARINC -I/usr/local/include"
4728     ;;
4730 solaris*)
4731     COM=GCC
4732     USING_X11=TRUE
4733     OS=SOLARIS
4734     RTL_OS=Solaris
4735     P_SEP=:
4737     case "$host_cpu" in
4738     i*86)
4739         CPUNAME=INTEL
4740         RTL_ARCH=x86
4741         PLATFORMID=solaris_x86
4742         ;;
4743     sparc)
4744         CPUNAME=SPARC
4745         RTL_ARCH=SPARC
4746         PLATFORMID=solaris_sparc
4747         ;;
4748     sparc64)
4749         CPUNAME=SPARC64
4750         RTL_ARCH=SPARC64
4751         PLATFORMID=solaris_sparc64
4752         ;;
4753     *)
4754         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4755         ;;
4756     esac
4757     SOLARINC="$SOLARINC -I/usr/local/include"
4758     ;;
4761     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4762     ;;
4763 esac
4765 if test "$with_x" = "no"; then
4766     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4769 DISABLE_GUI=""
4770 if test "$enable_gui" = "no"; then
4771     if test "$USING_X11" != TRUE; then
4772         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4773     fi
4774     USING_X11=
4775     DISABLE_GUI=TRUE
4776     AC_DEFINE(HAVE_FEATURE_UI,0)
4777     test_cairo=yes
4779 AC_SUBST(DISABLE_GUI)
4781 WORKDIR="${BUILDDIR}/workdir"
4782 INSTDIR="${BUILDDIR}/instdir"
4783 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4784 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4785 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4786 AC_SUBST(COM)
4787 AC_SUBST(CPUNAME)
4788 AC_SUBST(RTL_OS)
4789 AC_SUBST(RTL_ARCH)
4790 AC_SUBST(EPM_FLAGS)
4791 AC_SUBST(USING_X11)
4792 AC_SUBST([INSTDIR])
4793 AC_SUBST([INSTROOT])
4794 AC_SUBST([INSTROOTBASE])
4795 AC_SUBST(OS)
4796 AC_SUBST(P_SEP)
4797 AC_SUBST(WORKDIR)
4798 AC_SUBST(PLATFORMID)
4799 AC_SUBST(WINDOWS_X64)
4800 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4802 dnl ===================================================================
4803 dnl Test which package format to use
4804 dnl ===================================================================
4805 AC_MSG_CHECKING([which package format to use])
4806 if test -n "$with_package_format" -a "$with_package_format" != no; then
4807     for i in $with_package_format; do
4808         case "$i" in
4809         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4810             ;;
4811         *)
4812             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4813 aix - AIX software distribution
4814 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4815 deb - Debian software distribution
4816 pkg - Solaris software distribution
4817 rpm - RedHat software distribution
4819 LibreOffice additionally supports:
4820 archive - .tar.gz or .zip
4821 dmg - macOS .dmg
4822 installed - installation tree
4823 msi - Windows .msi
4824         ])
4825             ;;
4826         esac
4827     done
4828     # fakeroot is needed to ensure correct file ownerships/permissions
4829     # inside deb packages and tar archives created on Linux and Solaris.
4830     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4831         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4832         if test "$FAKEROOT" = "no"; then
4833             AC_MSG_ERROR(
4834                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4835         fi
4836     fi
4837     PKGFORMAT="$with_package_format"
4838     AC_MSG_RESULT([$PKGFORMAT])
4839 else
4840     PKGFORMAT=
4841     AC_MSG_RESULT([none])
4843 AC_SUBST(PKGFORMAT)
4845 dnl ===================================================================
4846 dnl Set up a different compiler to produce tools to run on the build
4847 dnl machine when doing cross-compilation
4848 dnl ===================================================================
4850 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4851 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4852 if test "$cross_compiling" = "yes"; then
4853     AC_MSG_CHECKING([for BUILD platform configuration])
4854     echo
4855     rm -rf CONF-FOR-BUILD config_build.mk
4856     mkdir CONF-FOR-BUILD
4857     # Here must be listed all files needed when running the configure script. In particular, also
4858     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4859     # keep them in the same order as there.
4860     (cd $SRC_ROOT && tar cf - \
4861         config.guess \
4862         bin/get_config_variables \
4863         solenv/bin/getcompver.awk \
4864         solenv/inc/langlist.mk \
4865         download.lst \
4866         config_host.mk.in \
4867         config_host_lang.mk.in \
4868         Makefile.in \
4869         bin/bffvalidator.sh.in \
4870         bin/odfvalidator.sh.in \
4871         bin/officeotron.sh.in \
4872         hardened_runtime.xcent.in \
4873         instsetoo_native/util/openoffice.lst.in \
4874         config_host/*.in \
4875         sysui/desktop/macosx/Info.plist.in) \
4876     | (cd CONF-FOR-BUILD && tar xf -)
4877     cp configure CONF-FOR-BUILD
4878     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4879     (
4880     unset COM USING_X11 OS CPUNAME
4881     unset CC CXX SYSBASE CFLAGS
4882     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4883     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4884     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4885     if test -n "$CC_FOR_BUILD"; then
4886         export CC="$CC_FOR_BUILD"
4887         CC_BASE=`first_arg_basename "$CC"`
4888     fi
4889     if test -n "$CXX_FOR_BUILD"; then
4890         export CXX="$CXX_FOR_BUILD"
4891         CXX_BASE=`first_arg_basename "$CXX"`
4892     fi
4893     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4894     cd CONF-FOR-BUILD
4895     sub_conf_opts=""
4896     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4897     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4898     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4899     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4900     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4901     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4902     # Don't bother having configure look for stuff not needed for the build platform anyway
4903     ./configure \
4904         --disable-cups \
4905         --disable-gpgmepp \
4906         --disable-gstreamer-1-0 \
4907         --disable-gtk3 \
4908         --disable-pdfimport \
4909         --disable-postgresql-sdbc \
4910         --enable-icecream="$enable_icecream" \
4911         --with-parallelism="$with_parallelism" \
4912         --without-doxygen \
4913         --without-java \
4914         $sub_conf_opts \
4915         --srcdir=$srcdir \
4916         2>&1 | sed -e 's/^/    /'
4917     test -f ./config_host.mk 2>/dev/null || exit
4918     cp config_host.mk ../config_build.mk
4919     cp config_host_lang.mk ../config_build_lang.mk
4920     mv config.log ../config.Build.log
4921     mkdir -p ../config_build
4922     mv config_host/*.h ../config_build
4923     . ./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
4925     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
4926         VV='$'$V
4927         VV=`eval "echo $VV"`
4928         if test -n "$VV"; then
4929             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4930             echo "$line" >>build-config
4931         fi
4932     done
4934     for V in INSTDIR INSTROOT WORKDIR; do
4935         VV='$'$V
4936         VV=`eval "echo $VV"`
4937         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4938         if test -n "$VV"; then
4939             line="${V}_FOR_BUILD='$VV'"
4940             echo "$line" >>build-config
4941         fi
4942     done
4944     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4945     echo "$line" >>build-config
4947     )
4948     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4949     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])
4950     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4951              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4953     eval `cat CONF-FOR-BUILD/build-config`
4955     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4957     rm -rf CONF-FOR-BUILD
4958 else
4959     OS_FOR_BUILD="$OS"
4960     CC_FOR_BUILD="$CC"
4961     CXX_FOR_BUILD="$CXX"
4962     INSTDIR_FOR_BUILD="$INSTDIR"
4963     INSTROOT_FOR_BUILD="$INSTROOT"
4964     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4965     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4966     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4967     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4968     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4969     WORKDIR_FOR_BUILD="$WORKDIR"
4971 AC_SUBST(OS_FOR_BUILD)
4972 AC_SUBST(INSTDIR_FOR_BUILD)
4973 AC_SUBST(INSTROOT_FOR_BUILD)
4974 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4975 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4976 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4977 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4978 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4979 AC_SUBST(WORKDIR_FOR_BUILD)
4981 dnl ===================================================================
4982 dnl Check for syslog header
4983 dnl ===================================================================
4984 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4986 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4987 dnl ===================================================================
4988 AC_MSG_CHECKING([whether to turn warnings to errors])
4989 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4990     ENABLE_WERROR="TRUE"
4991     AC_MSG_RESULT([yes])
4992 else
4993     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4994         ENABLE_WERROR="TRUE"
4995         AC_MSG_RESULT([yes])
4996     else
4997         AC_MSG_RESULT([no])
4998     fi
5000 AC_SUBST(ENABLE_WERROR)
5002 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5003 dnl ===================================================================
5004 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5005 if test -z "$enable_assert_always_abort"; then
5006    if test "$ENABLE_DEBUG" = TRUE; then
5007        enable_assert_always_abort=yes
5008    else
5009        enable_assert_always_abort=no
5010    fi
5012 if test "$enable_assert_always_abort" = "yes"; then
5013     ASSERT_ALWAYS_ABORT="TRUE"
5014     AC_MSG_RESULT([yes])
5015 else
5016     ASSERT_ALWAYS_ABORT="FALSE"
5017     AC_MSG_RESULT([no])
5019 AC_SUBST(ASSERT_ALWAYS_ABORT)
5021 # Determine whether to use ooenv for the instdir installation
5022 # ===================================================================
5023 if test $_os != "WINNT" -a $_os != "Darwin"; then
5024     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5025     if test "$enable_ooenv" = "no"; then
5026         AC_MSG_RESULT([no])
5027     else
5028         ENABLE_OOENV="TRUE"
5029         AC_MSG_RESULT([yes])
5030     fi
5032 AC_SUBST(ENABLE_OOENV)
5034 if test "$USING_X11" != TRUE; then
5035     # be sure to do not mess with unneeded stuff
5036     test_randr=no
5037     test_xrender=no
5038     test_cups=no
5039     test_dbus=no
5040     build_gstreamer_1_0=no
5041     test_kf5=no
5042     test_qt5=no
5043     test_gtk3_kde5=no
5044     enable_cairo_canvas=no
5047 if test "$OS" = "HAIKU"; then
5048     enable_cairo_canvas=yes
5049     test_kf5=yes
5052 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5053     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!])
5054     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!"
5055     enable_kf5=yes
5058 if test "$test_kf5" = "yes"; then
5059     test_qt5=yes
5062 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5063     if test "$enable_qt5" = "no"; then
5064         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5065     else
5066         enable_qt5=yes
5067     fi
5070 dnl ===================================================================
5071 dnl check for cups support
5072 dnl ===================================================================
5073 ENABLE_CUPS=""
5075 if test "$enable_cups" = "no"; then
5076     test_cups=no
5079 AC_MSG_CHECKING([whether to enable CUPS support])
5080 if test "$test_cups" = "yes"; then
5081     ENABLE_CUPS="TRUE"
5082     AC_MSG_RESULT([yes])
5084     AC_MSG_CHECKING([whether cups support is present])
5085     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5086     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5087     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5088         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5089     fi
5091 else
5092     AC_MSG_RESULT([no])
5095 AC_SUBST(ENABLE_CUPS)
5097 # fontconfig checks
5098 if test "$test_fontconfig" = "yes"; then
5099     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5100     SYSTEM_FONTCONFIG=TRUE
5101     FilterLibs "${FONTCONFIG_LIBS}"
5102     FONTCONFIG_LIBS="${filteredlibs}"
5104 AC_SUBST(FONTCONFIG_CFLAGS)
5105 AC_SUBST(FONTCONFIG_LIBS)
5106 AC_SUBST([SYSTEM_FONTCONFIG])
5108 dnl whether to find & fetch external tarballs?
5109 dnl ===================================================================
5110 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5111    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5112        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5113    else
5114        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5115    fi
5117 if test -z "$TARFILE_LOCATION"; then
5118     if test -d "$SRC_ROOT/src" ; then
5119         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5120         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5121     fi
5122     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5123 else
5124     AbsolutePath "$TARFILE_LOCATION"
5125     PathFormat "${absolute_path}"
5126     TARFILE_LOCATION="${formatted_path}"
5128 AC_SUBST(TARFILE_LOCATION)
5130 AC_MSG_CHECKING([whether we want to fetch tarballs])
5131 if test "$enable_fetch_external" != "no"; then
5132     if test "$with_all_tarballs" = "yes"; then
5133         AC_MSG_RESULT([yes, all of them])
5134         DO_FETCH_TARBALLS="ALL"
5135     else
5136         AC_MSG_RESULT([yes, if we use them])
5137         DO_FETCH_TARBALLS="TRUE"
5138     fi
5139 else
5140     AC_MSG_RESULT([no])
5141     DO_FETCH_TARBALLS=
5143 AC_SUBST(DO_FETCH_TARBALLS)
5145 AC_MSG_CHECKING([whether to build help])
5146 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5147     BUILD_TYPE="$BUILD_TYPE HELP"
5148     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5149     case "$with_help" in
5150     "html")
5151         ENABLE_HTMLHELP=TRUE
5152         SCPDEFS="$SCPDEFS -DWITH_HELP"
5153         AC_MSG_RESULT([HTML])
5154         ;;
5155     "online")
5156         ENABLE_HTMLHELP=TRUE
5157         HELP_ONLINE=TRUE
5158         AC_MSG_RESULT([HTML])
5159         ;;
5160     yes)
5161         SCPDEFS="$SCPDEFS -DWITH_HELP"
5162         AC_MSG_RESULT([yes])
5163         ;;
5164     *)
5165         AC_MSG_ERROR([Unknown --with-help=$with_help])
5166         ;;
5167     esac
5168 else
5169     AC_MSG_RESULT([no])
5171 AC_SUBST([ENABLE_HTMLHELP])
5172 AC_SUBST([HELP_ONLINE])
5174 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5175 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5176     BUILD_TYPE="$BUILD_TYPE HELP"
5177     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5178     case "$with_omindex" in
5179     "server")
5180         ENABLE_HTMLHELP=TRUE
5181         HELP_ONLINE=TRUE
5182         HELP_OMINDEX_PAGE=TRUE
5183         AC_MSG_RESULT([SERVER])
5184         ;;
5185     "noxap")
5186         ENABLE_HTMLHELP=TRUE
5187         HELP_ONLINE=TRUE
5188         HELP_OMINDEX_PAGE=FALSE
5189         AC_MSG_RESULT([NOXAP])
5190         ;;
5191     *)
5192         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5193         ;;
5194     esac
5195 else
5196     HELP_OMINDEX_PAGE=FALSE
5197     AC_MSG_RESULT([no])
5199 AC_SUBST([ENABLE_HTMLHELP])
5200 AC_SUBST([HELP_OMINDEX_PAGE])
5201 AC_SUBST([HELP_ONLINE])
5204 dnl Test whether to include MySpell dictionaries
5205 dnl ===================================================================
5206 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5207 if test "$with_myspell_dicts" = "yes"; then
5208     AC_MSG_RESULT([yes])
5209     WITH_MYSPELL_DICTS=TRUE
5210     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5211     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5212 else
5213     AC_MSG_RESULT([no])
5214     WITH_MYSPELL_DICTS=
5216 AC_SUBST(WITH_MYSPELL_DICTS)
5218 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5219 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5220     if test "$with_system_dicts" = yes; then
5221         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5222     fi
5223     with_system_dicts=no
5226 AC_MSG_CHECKING([whether to use dicts from external paths])
5227 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5228     AC_MSG_RESULT([yes])
5229     SYSTEM_DICTS=TRUE
5230     AC_MSG_CHECKING([for spelling dictionary directory])
5231     if test -n "$with_external_dict_dir"; then
5232         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5233     else
5234         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5235         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5236             DICT_SYSTEM_DIR=file:///usr/share/myspell
5237         fi
5238     fi
5239     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5240     AC_MSG_CHECKING([for hyphenation patterns directory])
5241     if test -n "$with_external_hyph_dir"; then
5242         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5243     else
5244         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5245     fi
5246     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5247     AC_MSG_CHECKING([for thesaurus directory])
5248     if test -n "$with_external_thes_dir"; then
5249         THES_SYSTEM_DIR=file://$with_external_thes_dir
5250     else
5251         THES_SYSTEM_DIR=file:///usr/share/mythes
5252     fi
5253     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5254 else
5255     AC_MSG_RESULT([no])
5256     SYSTEM_DICTS=
5258 AC_SUBST(SYSTEM_DICTS)
5259 AC_SUBST(DICT_SYSTEM_DIR)
5260 AC_SUBST(HYPH_SYSTEM_DIR)
5261 AC_SUBST(THES_SYSTEM_DIR)
5263 dnl ===================================================================
5264 dnl Precompiled headers.
5265 ENABLE_PCH=""
5266 AC_MSG_CHECKING([whether to enable pch feature])
5267 if test -z "$enable_pch"; then
5268     if test "$_os" = "WINNT"; then
5269         # Enabled by default on Windows.
5270         enable_pch=yes
5271     else
5272         enable_pch=no
5273     fi
5275 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5276     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5278 if test "$enable_pch" = "system"; then
5279     ENABLE_PCH="1"
5280     AC_MSG_RESULT([yes (system headers)])
5281 elif test "$enable_pch" = "base"; then
5282     ENABLE_PCH="2"
5283     AC_MSG_RESULT([yes (system and base headers)])
5284 elif test "$enable_pch" = "normal"; then
5285     ENABLE_PCH="3"
5286     AC_MSG_RESULT([yes (normal)])
5287 elif test "$enable_pch" = "full"; then
5288     ENABLE_PCH="4"
5289     AC_MSG_RESULT([yes (full)])
5290 elif test "$enable_pch" = "yes"; then
5291     # Pick a suitable default.
5292     if test "$GCC" = "yes"; then
5293         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5294         # while making the PCHs larger and rebuilds more likely.
5295         ENABLE_PCH="2"
5296         AC_MSG_RESULT([yes (system and base headers)])
5297     else
5298         # With MSVC the highest level makes a significant difference,
5299         # and it was the default when there used to be no PCH levels.
5300         ENABLE_PCH="4"
5301         AC_MSG_RESULT([yes (full)])
5302     fi
5303 elif test "$enable_pch" = "no"; then
5304     AC_MSG_RESULT([no])
5305 else
5306     AC_MSG_ERROR([Unknown value for --enable-pch])
5308 AC_SUBST(ENABLE_PCH)
5309 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5310 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5311     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5312     if test "$CCACHE_BIN" != "not found"; then
5313         AC_MSG_CHECKING([ccache version])
5314         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5315         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5316         AC_MSG_RESULT([$CCACHE_VERSION])
5317         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5318         if test "$CCACHE_NUMVER" -gt "030701"; then
5319             AC_MSG_RESULT([yes])
5320         else
5321             AC_MSG_RESULT([no (not newer than 3.7.1)])
5322             CCACHE_DEPEND_MODE=
5323         fi
5324     fi
5327 PCH_INSTANTIATE_TEMPLATES=
5328 if test -n "$ENABLE_PCH"; then
5329     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5330     save_CFLAGS=$CFLAGS
5331     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5332     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5333     CFLAGS=$save_CFLAGS
5334     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5335         AC_MSG_RESULT(yes)
5336     else
5337         AC_MSG_RESULT(no)
5338     fi
5339     CFLAGS=$save_CFLAGS
5341 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5343 BUILDING_PCH_WITH_OBJ=
5344 if test -n "$ENABLE_PCH"; then
5345     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5346     save_CFLAGS=$CFLAGS
5347     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5348     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5349     CFLAGS=$save_CFLAGS
5350     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5351         AC_MSG_RESULT(yes)
5352     else
5353         AC_MSG_RESULT(no)
5354     fi
5356 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5358 PCH_MODULES_CODEGEN=
5359 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5360     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-codegen])
5361     save_CFLAGS=$CFLAGS
5362     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-codegen"
5363     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_CODEGEN="-Xclang -fmodules-codegen" ],[])
5364     CFLAGS=$save_CFLAGS
5365     if test -n "$PCH_MODULES_CODEGEN"; then
5366         AC_MSG_RESULT(yes)
5367     else
5368         AC_MSG_RESULT(no)
5369     fi
5370     CFLAGS=$save_CFLAGS
5372 AC_SUBST(PCH_MODULES_CODEGEN)
5373 PCH_MODULES_DEBUGINFO=
5374 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5375     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-debuginfo])
5376     save_CFLAGS=$CFLAGS
5377     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-debuginfo"
5378     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_DEBUGINFO="-Xclang -fmodules-debuginfo" ],[])
5379     CFLAGS=$save_CFLAGS
5380     if test -n "$PCH_MODULES_DEBUGINFO"; then
5381         AC_MSG_RESULT(yes)
5382     else
5383         AC_MSG_RESULT(no)
5384     fi
5385     CFLAGS=$save_CFLAGS
5387 AC_SUBST(PCH_MODULES_DEBUGINFO)
5389 TAB=`printf '\t'`
5391 AC_MSG_CHECKING([the GNU Make version])
5392 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5393 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5394 if test "$_make_longver" -ge "038200"; then
5395     AC_MSG_RESULT([$GNUMAKE $_make_version])
5397 elif test "$_make_longver" -ge "038100"; then
5398     if test "$build_os" = "cygwin"; then
5399         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5400     fi
5401     AC_MSG_RESULT([$GNUMAKE $_make_version])
5403     dnl ===================================================================
5404     dnl Search all the common names for sha1sum
5405     dnl ===================================================================
5406     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5407     if test -z "$SHA1SUM"; then
5408         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5409     elif test "$SHA1SUM" = "openssl"; then
5410         SHA1SUM="openssl sha1"
5411     fi
5412     AC_MSG_CHECKING([for GNU Make bug 20033])
5413     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5414     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5415 A := \$(wildcard *.a)
5417 .PHONY: all
5418 all: \$(A:.a=.b)
5419 <TAB>@echo survived bug20033.
5421 .PHONY: setup
5422 setup:
5423 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5425 define d1
5426 @echo lala \$(1)
5427 @sleep 1
5428 endef
5430 define d2
5431 @echo tyty \$(1)
5432 @sleep 1
5433 endef
5435 %.b : %.a
5436 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5437 <TAB>\$(call d1,\$(CHECKSUM)),\
5438 <TAB>\$(call d2,\$(CHECKSUM)))
5440     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5441         no_parallelism_make="YES"
5442         AC_MSG_RESULT([yes, disable parallelism])
5443     else
5444         AC_MSG_RESULT([no, keep parallelism enabled])
5445     fi
5446     rm -rf $TESTGMAKEBUG20033
5447 else
5448     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5451 # find if gnumake support file function
5452 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5453 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5454 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5455     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5457 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5458 \$(file >test.txt,Success )
5460 .PHONY: all
5461 all:
5462 <TAB>@cat test.txt
5465 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5466 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5467     HAVE_GNUMAKE_FILE_FUNC=TRUE
5468     AC_MSG_RESULT([yes])
5469 else
5470     AC_MSG_RESULT([no])
5472 rm -rf $TESTGMAKEFILEFUNC
5473 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5474 AC_SUBST(GNUMAKE_WIN_NATIVE)
5476 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5477 STALE_MAKE=
5478 if test "$_make_ver_check" = ""; then
5479    STALE_MAKE=TRUE
5482 HAVE_LD_HASH_STYLE=FALSE
5483 WITH_LINKER_HASH_STYLE=
5484 AC_MSG_CHECKING([for --hash-style gcc linker support])
5485 if test "$GCC" = "yes"; then
5486     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5487         hash_styles="gnu sysv"
5488     elif test "$with_linker_hash_style" = "no"; then
5489         hash_styles=
5490     else
5491         hash_styles="$with_linker_hash_style"
5492     fi
5494     for hash_style in $hash_styles; do
5495         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5496         hash_style_ldflags_save=$LDFLAGS
5497         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5499         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5500             [
5501 #include <stdio.h>
5502             ],[
5503 printf ("");
5504             ])],
5505             [
5506                   HAVE_LD_HASH_STYLE=TRUE
5507                   WITH_LINKER_HASH_STYLE=$hash_style
5508             ],
5509             [HAVE_LD_HASH_STYLE=FALSE],
5510             [HAVE_LD_HASH_STYLE=FALSE])
5511         LDFLAGS=$hash_style_ldflags_save
5512     done
5514     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5515         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5516     else
5517         AC_MSG_RESULT( no )
5518     fi
5519     LDFLAGS=$hash_style_ldflags_save
5520 else
5521     AC_MSG_RESULT( no )
5523 AC_SUBST(HAVE_LD_HASH_STYLE)
5524 AC_SUBST(WITH_LINKER_HASH_STYLE)
5526 dnl ===================================================================
5527 dnl Check whether there's a Perl version available.
5528 dnl ===================================================================
5529 if test -z "$with_perl_home"; then
5530     AC_PATH_PROG(PERL, perl)
5531 else
5532     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5533     _perl_path="$with_perl_home/bin/perl"
5534     if test -x "$_perl_path"; then
5535         PERL=$_perl_path
5536     else
5537         AC_MSG_ERROR([$_perl_path not found])
5538     fi
5541 dnl ===================================================================
5542 dnl Testing for Perl version 5 or greater.
5543 dnl $] is the Perl version variable, it is returned as an integer
5544 dnl ===================================================================
5545 if test "$PERL"; then
5546     AC_MSG_CHECKING([the Perl version])
5547     ${PERL} -e "exit($]);"
5548     _perl_version=$?
5549     if test "$_perl_version" -lt 5; then
5550         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5551     fi
5552     AC_MSG_RESULT([Perl $_perl_version])
5553 else
5554     AC_MSG_ERROR([Perl not found, install Perl 5])
5557 dnl ===================================================================
5558 dnl Testing for required Perl modules
5559 dnl ===================================================================
5561 AC_MSG_CHECKING([for required Perl modules])
5562 perl_use_string="use Cwd ; use Digest::MD5"
5563 if test "$_os" = "WINNT"; then
5564     if test -n "$PKGFORMAT"; then
5565         for i in $PKGFORMAT; do
5566             case "$i" in
5567             msi)
5568                 # for getting fonts versions to use in MSI
5569                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5570                 ;;
5571             esac
5572         done
5573     fi
5575 if test "$with_system_hsqldb" = "yes"; then
5576     perl_use_string="$perl_use_string ; use Archive::Zip"
5578 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5579     AC_MSG_RESULT([all modules found])
5580 else
5581     AC_MSG_RESULT([failed to find some modules])
5582     # Find out which modules are missing.
5583     for i in $perl_use_string; do
5584         if test "$i" != "use" -a "$i" != ";"; then
5585             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5586                 missing_perl_modules="$missing_perl_modules $i"
5587             fi
5588         fi
5589     done
5590     AC_MSG_ERROR([
5591     The missing Perl modules are: $missing_perl_modules
5592     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5595 dnl ===================================================================
5596 dnl Check for pkg-config
5597 dnl ===================================================================
5598 if test "$_os" != "WINNT"; then
5599     PKG_PROG_PKG_CONFIG
5602 if test "$_os" != "WINNT"; then
5604     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5605     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5606     # explicitly. Or put /path/to/compiler in PATH yourself.
5608     # Use wrappers for LTO
5609     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5610         AC_CHECK_TOOL(AR,gcc-ar)
5611         AC_CHECK_TOOL(NM,gcc-nm)
5612         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5613     else
5614         AC_CHECK_TOOL(AR,ar)
5615         AC_CHECK_TOOL(NM,nm)
5616         AC_CHECK_TOOL(RANLIB,ranlib)
5617     fi
5618     AC_CHECK_TOOL(OBJDUMP,objdump)
5619     AC_CHECK_TOOL(READELF,readelf)
5620     AC_CHECK_TOOL(STRIP,strip)
5621     if test "$_os" = "WINNT"; then
5622         AC_CHECK_TOOL(DLLTOOL,dlltool)
5623         AC_CHECK_TOOL(WINDRES,windres)
5624     fi
5626 AC_SUBST(AR)
5627 AC_SUBST(DLLTOOL)
5628 AC_SUBST(NM)
5629 AC_SUBST(OBJDUMP)
5630 AC_SUBST(PKG_CONFIG)
5631 AC_SUBST(RANLIB)
5632 AC_SUBST(READELF)
5633 AC_SUBST(STRIP)
5634 AC_SUBST(WINDRES)
5636 dnl ===================================================================
5637 dnl pkg-config checks on macOS
5638 dnl ===================================================================
5640 if test $_os = Darwin; then
5641     AC_MSG_CHECKING([for bogus pkg-config])
5642     if test -n "$PKG_CONFIG"; then
5643         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5644             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5645         else
5646             if test "$enable_bogus_pkg_config" = "yes"; then
5647                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5648             else
5649                 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.])
5650             fi
5651         fi
5652     else
5653         AC_MSG_RESULT([no, good])
5654     fi
5657 find_csc()
5659     # Return value: $csctest
5661     unset csctest
5663     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5664     if test -n "$regvalue"; then
5665         csctest=$regvalue
5666         return
5667     fi
5670 find_al()
5672     # Return value: $altest
5674     unset altest
5676     # We need this check to detect 4.6.1 or above.
5677     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5678         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5679         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5680             altest=$regvalue
5681             return
5682         fi
5683     done
5685     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5686         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5687         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5688             altest=$regvalue
5689             return
5690         fi
5691     done
5696 find_dotnetsdk46()
5698     unset frametest
5700     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5701         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5702         if test -n "$regvalue"; then
5703             frametest=$regvalue
5704             return
5705         fi
5706     done
5709 find_winsdk_version()
5711     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5712     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5714     unset winsdktest winsdkbinsubdir winsdklibsubdir
5716     case "$1" in
5717     8.0|8.0A)
5718         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5719         if test -n "$regvalue"; then
5720             winsdktest=$regvalue
5721             winsdklibsubdir=win8
5722             return
5723         fi
5724         ;;
5725     8.1|8.1A)
5726         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5727         if test -n "$regvalue"; then
5728             winsdktest=$regvalue
5729             winsdklibsubdir=winv6.3
5730             return
5731         fi
5732         ;;
5733     10.0)
5734         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5735         if test -n "$regvalue"; then
5736             winsdktest=$regvalue
5737             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5738             if test -n "$regvalue"; then
5739                 winsdkbinsubdir="$regvalue".0
5740                 winsdklibsubdir=$winsdkbinsubdir
5741                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5742                 # test exist the SDK path
5743                 if test -d "$tmppath"; then
5744                    # when path is convertible to a short path then path is okay
5745                    cygpath -d "$tmppath" >/dev/null 2>&1
5746                    if test $? -ne 0; then
5747                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5748                    fi
5749                 else
5750                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5751                 fi
5752             fi
5753             return
5754         fi
5755         ;;
5756     esac
5759 find_winsdk()
5761     # Return value: From find_winsdk_version
5763     unset winsdktest
5765     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5766         find_winsdk_version $ver
5767         if test -n "$winsdktest"; then
5768             return
5769         fi
5770     done
5773 find_msms()
5775     AC_MSG_CHECKING([for MSVC merge modules directory])
5776     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5777     case "$VCVER" in
5778         160)
5779         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5780         ;;
5781     esac
5782     for f in $my_msm_files; do
5783         echo "$as_me:$LINENO: searching for $f" >&5
5784     done
5786     msmdir=
5787     for ver in 14.0 15.0; do
5788         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5789         if test -n "$regvalue"; then
5790             for f in ${my_msm_files}; do
5791                 if test -e "$regvalue/${f}"; then
5792                     msmdir=$regvalue
5793                     break
5794                 fi
5795             done
5796         fi
5797     done
5798     dnl Is the following fallback really necessary, or was it added in response
5799     dnl to never having started Visual Studio on a given machine, so the
5800     dnl registry keys checked above had presumably not yet been created?
5801     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5802     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5803     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5804     dnl expanding to "C:\Program Files\Common Files"), which would need
5805     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5806     dnl obtain its value from cygwin:
5807     if test -z "$msmdir"; then
5808         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5809         for f in ${my_msm_files}; do
5810             if test -e "$my_msm_dir/${f}"; then
5811                 msmdir=$my_msm_dir
5812             fi
5813         done
5814     fi
5816     dnl Starting from MSVC 15.0, merge modules are located in different directory
5817     case "$VCVER" in
5818     160)
5819         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5820             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5821             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5822             for f in ${my_msm_files}; do
5823                 if test -e "$my_msm_dir/${f}"; then
5824                     msmdir=$my_msm_dir
5825                     break
5826                 fi
5827             done
5828         done
5829         ;;
5830     esac
5832     if test -n "$msmdir"; then
5833         msmdir=`cygpath -m "$msmdir"`
5834         AC_MSG_RESULT([$msmdir])
5835     else
5836         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5837             AC_MSG_FAILURE([not found])
5838         else
5839             AC_MSG_WARN([not found (check config.log)])
5840             add_warning "MSM none of ${my_msm_files} found"
5841         fi
5842     fi
5845 find_msvc_x64_dlls()
5847     AC_MSG_CHECKING([for MSVC x64 DLL path])
5848     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5849     case "$VCVER" in
5850     160)
5851         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5852             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5853             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5854                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5855                 break
5856             fi
5857             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5858             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5859                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5860                 break
5861             fi
5862         done
5863         ;;
5864     esac
5865     AC_MSG_RESULT([$msvcdllpath])
5866     AC_MSG_CHECKING([for MSVC x64 DLLs])
5867     msvcdlls="msvcp140.dll vcruntime140.dll"
5868     for dll in $msvcdlls; do
5869         if ! test -f "$msvcdllpath/$dll"; then
5870             AC_MSG_FAILURE([missing $dll])
5871         fi
5872     done
5873     AC_MSG_RESULT([found all ($msvcdlls)])
5876 dnl =========================================
5877 dnl Check for the Windows  SDK.
5878 dnl =========================================
5879 if test "$_os" = "WINNT"; then
5880     AC_MSG_CHECKING([for Windows SDK])
5881     if test "$build_os" = "cygwin"; then
5882         find_winsdk
5883         WINDOWS_SDK_HOME=$winsdktest
5885         # normalize if found
5886         if test -n "$WINDOWS_SDK_HOME"; then
5887             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5888             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5889         fi
5891         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5892     fi
5894     if test -n "$WINDOWS_SDK_HOME"; then
5895         # Remove a possible trailing backslash
5896         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5898         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5899              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5900              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5901             have_windows_sdk_headers=yes
5902         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5903              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5904              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5905             have_windows_sdk_headers=yes
5906         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5907              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5908              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5909             have_windows_sdk_headers=yes
5910         else
5911             have_windows_sdk_headers=no
5912         fi
5914         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5915             have_windows_sdk_libs=yes
5916         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5917             have_windows_sdk_libs=yes
5918         else
5919             have_windows_sdk_libs=no
5920         fi
5922         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5923             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5924 the  Windows SDK are installed.])
5925         fi
5926     fi
5928     if test -z "$WINDOWS_SDK_HOME"; then
5929         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5930     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5931         WINDOWS_SDK_VERSION=80
5932         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5933     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5934         WINDOWS_SDK_VERSION=81
5935         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5936     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5937         WINDOWS_SDK_VERSION=10
5938         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5939     else
5940         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5941     fi
5942     PathFormat "$WINDOWS_SDK_HOME"
5943     WINDOWS_SDK_HOME="$formatted_path"
5944     if test "$build_os" = "cygwin"; then
5945         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5946         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5947             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5948         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5949             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5950         fi
5951     fi
5953     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5954     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5955     dnl but not in v8.0), so allow this to be overridden with a
5956     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5957     dnl and configuration error if no WiLangId.vbs is found would arguably be
5958     dnl better, but I do not know under which conditions exactly it is needed by
5959     dnl msiglobal.pm:
5960     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5961         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5962         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5963             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5964         fi
5965         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5966             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5967         fi
5968         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5969             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5970         fi
5971     fi
5972     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5973         if test -n "$with_package_format" -a "$with_package_format" != no; then
5974             for i in "$with_package_format"; do
5975                 if test "$i" = "msi"; then
5976                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5977                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5978                     fi
5979                 fi
5980             done
5981         fi
5982     fi
5984 AC_SUBST(WINDOWS_SDK_HOME)
5985 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5986 AC_SUBST(WINDOWS_SDK_VERSION)
5987 AC_SUBST(WINDOWS_SDK_WILANGID)
5989 if test "$build_os" = "cygwin"; then
5990     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5991     dnl dir, it also determines that dir's path w/o an arch segment if any,
5992     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5993     AC_MSG_CHECKING([for midl.exe])
5995     find_winsdk
5996     if test -n "$winsdkbinsubdir" \
5997         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5998     then
5999         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
6000         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6001     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
6002         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
6003         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6004     elif test -f "$winsdktest/Bin/midl.exe"; then
6005         MIDL_PATH=$winsdktest/Bin
6006         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6007     fi
6008     if test ! -f "$MIDL_PATH/midl.exe"; then
6009         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
6010     else
6011         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6012     fi
6014     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6015     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6017     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6018          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6019          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6020          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6021     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6022          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6023          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6024          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6025     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6026          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6027          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6028          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6029     else
6030         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6031     fi
6033     dnl Check csc.exe
6034     AC_MSG_CHECKING([for csc.exe])
6035     find_csc
6036     if test -f "$csctest/csc.exe"; then
6037         CSC_PATH="$csctest"
6038     fi
6039     if test ! -f "$CSC_PATH/csc.exe"; then
6040         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6041     else
6042         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6043     fi
6045     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6047     dnl Check al.exe
6048     AC_MSG_CHECKING([for al.exe])
6049     find_winsdk
6050     if test -n "$winsdkbinsubdir" \
6051         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
6052     then
6053         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
6054     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
6055         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
6056     elif test -f "$winsdktest/Bin/al.exe"; then
6057         AL_PATH="$winsdktest/Bin"
6058     fi
6060     if test -z "$AL_PATH"; then
6061         find_al
6062         if test -f "$altest/bin/al.exe"; then
6063             AL_PATH="$altest/bin"
6064         elif test -f "$altest/al.exe"; then
6065             AL_PATH="$altest"
6066         fi
6067     fi
6068     if test ! -f "$AL_PATH/al.exe"; then
6069         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6070     else
6071         AC_MSG_RESULT([$AL_PATH/al.exe])
6072     fi
6074     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6076     dnl Check mscoree.lib / .NET Framework dir
6077     AC_MSG_CHECKING(.NET Framework)
6078     find_dotnetsdk46
6079     PathFormat "$frametest"
6080     frametest="$formatted_path"
6081     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6082         DOTNET_FRAMEWORK_HOME="$frametest"
6083     else
6084         find_winsdk
6085         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6086             DOTNET_FRAMEWORK_HOME="$winsdktest"
6087         fi
6088     fi
6089     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
6090         AC_MSG_ERROR([mscoree.lib not found])
6091     fi
6092     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6094     PathFormat "$MIDL_PATH"
6095     MIDL_PATH="$formatted_path"
6097     PathFormat "$AL_PATH"
6098     AL_PATH="$formatted_path"
6100     PathFormat "$DOTNET_FRAMEWORK_HOME"
6101     DOTNET_FRAMEWORK_HOME="$formatted_path"
6103     PathFormat "$CSC_PATH"
6104     CSC_PATH="$formatted_path"
6107 dnl ===================================================================
6108 dnl Check if stdc headers are available excluding MSVC.
6109 dnl ===================================================================
6110 if test "$_os" != "WINNT"; then
6111     AC_HEADER_STDC
6114 dnl ===================================================================
6115 dnl Testing for C++ compiler and version...
6116 dnl ===================================================================
6118 if test "$_os" != "WINNT"; then
6119     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6120     save_CXXFLAGS=$CXXFLAGS
6121     AC_PROG_CXX
6122     CXXFLAGS=$save_CXXFLAGS
6123     if test -z "$CXX_BASE"; then
6124         CXX_BASE=`first_arg_basename "$CXX"`
6125     fi
6128 dnl check for GNU C++ compiler version
6129 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6130     AC_MSG_CHECKING([the GNU C++ compiler version])
6132     _gpp_version=`$CXX -dumpversion`
6133     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6135     if test "$_gpp_majmin" -lt "700"; then
6136         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6137     else
6138         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6139     fi
6141     dnl see https://code.google.com/p/android/issues/detail?id=41770
6142         glibcxx_threads=no
6143         AC_LANG_PUSH([C++])
6144         AC_REQUIRE_CPP
6145         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6146         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6147             #include <bits/c++config.h>]],[[
6148             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6149             && !defined(_GLIBCXX__PTHREADS) \
6150             && !defined(_GLIBCXX_HAS_GTHREADS)
6151             choke me
6152             #endif
6153         ]])],[AC_MSG_RESULT([yes])
6154         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6155         AC_LANG_POP([C++])
6156         if test $glibcxx_threads = yes; then
6157             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6158         fi
6160 AC_SUBST(BOOST_CXXFLAGS)
6163 # prefx CXX with ccache if needed
6165 if test "$CCACHE" != ""; then
6166     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6167     AC_LANG_PUSH([C++])
6168     save_CXXFLAGS=$CXXFLAGS
6169     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6170     dnl an empty program will do, we're checking the compiler flags
6171     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6172                       [use_ccache=yes], [use_ccache=no])
6173     if test $use_ccache = yes; then
6174         AC_MSG_RESULT([yes])
6175     else
6176         CXX="$CCACHE $CXX"
6177         CXX_BASE="ccache $CXX_BASE"
6178         AC_MSG_RESULT([no])
6179     fi
6180     CXXFLAGS=$save_CXXFLAGS
6181     AC_LANG_POP([C++])
6184 dnl ===================================================================
6185 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6186 dnl ===================================================================
6188 if test "$_os" != "WINNT"; then
6189     AC_PROG_CXXCPP
6191     dnl Check whether there's a C pre-processor.
6192     AC_PROG_CPP
6196 dnl ===================================================================
6197 dnl Find integral type sizes and alignments
6198 dnl ===================================================================
6200 if test "$_os" != "WINNT"; then
6202 if test "$_os" = "iOS"; then
6203     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6204     ac_cv_sizeof_long=8
6205     ac_cv_sizeof_short=2
6206     ac_cv_sizeof_int=4
6207     ac_cv_sizeof_long_long=8
6208     ac_cv_sizeof_double=8
6209     ac_cv_sizeof_voidp=8
6210 else
6211     AC_CHECK_SIZEOF(long)
6212     AC_CHECK_SIZEOF(short)
6213     AC_CHECK_SIZEOF(int)
6214     AC_CHECK_SIZEOF(long long)
6215     AC_CHECK_SIZEOF(double)
6216     AC_CHECK_SIZEOF(void*)
6219     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6220     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6221     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6222     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6223     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6225     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6226     m4_pattern_allow([AC_CHECK_ALIGNOF])
6227     m4_ifdef([AC_CHECK_ALIGNOF],
6228         [
6229             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6230             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6231             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6232             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6233         ],
6234         [
6235             case "$_os-$host_cpu" in
6236             Linux-i686)
6237                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6238                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6239                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6240                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6241                 ;;
6242             Linux-x86_64)
6243                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6244                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6245                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6246                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6247                 ;;
6248             *)
6249                 if test -z "$ac_cv_alignof_short" -o \
6250                         -z "$ac_cv_alignof_int" -o \
6251                         -z "$ac_cv_alignof_long" -o \
6252                         -z "$ac_cv_alignof_double"; then
6253                    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.])
6254                 fi
6255                 ;;
6256             esac
6257         ])
6259     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6260     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6261     if test $ac_cv_sizeof_long -eq 8; then
6262         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6263     elif test $ac_cv_sizeof_double -eq 8; then
6264         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6265     else
6266         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6267     fi
6269     dnl Check for large file support
6270     AC_SYS_LARGEFILE
6271     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6272         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6273     fi
6274     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6275         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6276     fi
6277 else
6278     # Hardcode for MSVC
6279     SAL_TYPES_SIZEOFSHORT=2
6280     SAL_TYPES_SIZEOFINT=4
6281     SAL_TYPES_SIZEOFLONG=4
6282     SAL_TYPES_SIZEOFLONGLONG=8
6283     if test "$BITNESS_OVERRIDE" = ""; then
6284         SAL_TYPES_SIZEOFPOINTER=4
6285     else
6286         SAL_TYPES_SIZEOFPOINTER=8
6287     fi
6288     SAL_TYPES_ALIGNMENT2=2
6289     SAL_TYPES_ALIGNMENT4=4
6290     SAL_TYPES_ALIGNMENT8=8
6291     LFS_CFLAGS=''
6293 AC_SUBST(LFS_CFLAGS)
6295 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6296 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6297 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6298 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6299 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6300 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6301 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6302 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6304 dnl ===================================================================
6305 dnl Check whether to enable runtime optimizations
6306 dnl ===================================================================
6307 ENABLE_RUNTIME_OPTIMIZATIONS=
6308 AC_MSG_CHECKING([whether to enable runtime optimizations])
6309 if test -z "$enable_runtime_optimizations"; then
6310     for i in $CC; do
6311         case $i in
6312         -fsanitize=*)
6313             enable_runtime_optimizations=no
6314             break
6315             ;;
6316         esac
6317     done
6319 if test "$enable_runtime_optimizations" != no; then
6320     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6321     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6322     AC_MSG_RESULT([yes])
6323 else
6324     AC_MSG_RESULT([no])
6326 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6328 dnl ===================================================================
6329 dnl Check if valgrind headers are available
6330 dnl ===================================================================
6331 ENABLE_VALGRIND=
6332 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6333     prev_cppflags=$CPPFLAGS
6334     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6335     # or where does it come from?
6336     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6337     AC_CHECK_HEADER([valgrind/valgrind.h],
6338         [ENABLE_VALGRIND=TRUE])
6339     CPPFLAGS=$prev_cppflags
6341 AC_SUBST([ENABLE_VALGRIND])
6342 if test -z "$ENABLE_VALGRIND"; then
6343     if test "$with_valgrind" = yes; then
6344         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6345     fi
6346     VALGRIND_CFLAGS=
6348 AC_SUBST([VALGRIND_CFLAGS])
6351 dnl ===================================================================
6352 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6353 dnl ===================================================================
6355 # We need at least the sys/sdt.h include header.
6356 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6357 if test "$SDT_H_FOUND" = "TRUE"; then
6358     # Found sys/sdt.h header, now make sure the c++ compiler works.
6359     # Old g++ versions had problems with probes in constructors/destructors.
6360     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6361     AC_LANG_PUSH([C++])
6362     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6363     #include <sys/sdt.h>
6364     class ProbeClass
6365     {
6366     private:
6367       int& ref;
6368       const char *name;
6370     public:
6371       ProbeClass(int& v, const char *n) : ref(v), name(n)
6372       {
6373         DTRACE_PROBE2(_test_, cons, name, ref);
6374       }
6376       void method(int min)
6377       {
6378         DTRACE_PROBE3(_test_, meth, name, ref, min);
6379         ref -= min;
6380       }
6382       ~ProbeClass()
6383       {
6384         DTRACE_PROBE2(_test_, dest, name, ref);
6385       }
6386     };
6387     ]],[[
6388     int i = 64;
6389     DTRACE_PROBE1(_test_, call, i);
6390     ProbeClass inst = ProbeClass(i, "call");
6391     inst.method(24);
6392     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6393           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6394     AC_LANG_POP([C++])
6396 AC_CONFIG_HEADERS([config_host/config_probes.h])
6398 dnl ===================================================================
6399 dnl GCC features
6400 dnl ===================================================================
6401 HAVE_GCC_STACK_CLASH_PROTECTION=
6402 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6403     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6404     save_CFLAGS=$CFLAGS
6405     CFLAGS="$CFLAGS -fstack-clash-protection"
6406     AC_LINK_IFELSE(
6407         [AC_LANG_PROGRAM(, [[return 0;]])],
6408         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6409         [AC_MSG_RESULT([no])])
6410     CFLAGS=$save_CFLAGS
6412     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6413     save_CFLAGS=$CFLAGS
6414     CFLAGS="$CFLAGS -Werror -mno-avx"
6415     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6416     CFLAGS=$save_CFLAGS
6417     if test "$HAVE_GCC_AVX" = "TRUE"; then
6418         AC_MSG_RESULT([yes])
6419     else
6420         AC_MSG_RESULT([no])
6421     fi
6423     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6424     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6425     int v = 0;
6426     if (__sync_add_and_fetch(&v, 1) != 1 ||
6427         __sync_sub_and_fetch(&v, 1) != 0)
6428         return 1;
6429     __sync_synchronize();
6430     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6431         v != 1)
6432         return 1;
6433     return 0;
6434 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6435     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6436         AC_MSG_RESULT([yes])
6437         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6438     else
6439         AC_MSG_RESULT([no])
6440     fi
6442     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6443     AC_LANG_PUSH([C++])
6444     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6445             #include <cstddef>
6446             #include <cxxabi.h>
6447             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6448         ])], [
6449             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6450             AC_MSG_RESULT([yes])
6451         ], [AC_MSG_RESULT([no])])
6452     AC_LANG_POP([C++])
6454     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6455     AC_LANG_PUSH([C++])
6456     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6457             #include <cstddef>
6458             #include <cxxabi.h>
6459             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6460         ])], [
6461             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6462             AC_MSG_RESULT([yes])
6463         ], [AC_MSG_RESULT([no])])
6464     AC_LANG_POP([C++])
6466     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6467     AC_LANG_PUSH([C++])
6468     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6469             #include <cxxabi.h>
6470             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6471         ])], [
6472             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6473             AC_MSG_RESULT([yes])
6474         ], [AC_MSG_RESULT([no])])
6475     AC_LANG_POP([C++])
6477     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6478     AC_LANG_PUSH([C++])
6479     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6480             #include <cstddef>
6481             #include <cxxabi.h>
6482             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6483         ])], [
6484             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6485             AC_MSG_RESULT([yes])
6486         ], [AC_MSG_RESULT([no])])
6487     AC_LANG_POP([C++])
6489     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6490     AC_LANG_PUSH([C++])
6491     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6492             #include <cstddef>
6493             #include <cxxabi.h>
6494             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6495         ])], [
6496             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6497             AC_MSG_RESULT([yes])
6498         ], [AC_MSG_RESULT([no])])
6499     AC_LANG_POP([C++])
6501     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6502     AC_LANG_PUSH([C++])
6503     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6504             #include <cxxabi.h>
6505             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6506         ])], [
6507             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6508             AC_MSG_RESULT([yes])
6509         ], [AC_MSG_RESULT([no])])
6510     AC_LANG_POP([C++])
6512     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6513     AC_LANG_PUSH([C++])
6514     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6515             #include <cxxabi.h>
6516             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6517         ])], [
6518             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6519             AC_MSG_RESULT([yes])
6520         ], [AC_MSG_RESULT([no])])
6521     AC_LANG_POP([C++])
6523     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6524     AC_LANG_PUSH([C++])
6525     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6526             #include <cxxabi.h>
6527             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6528         ])], [
6529             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6530             AC_MSG_RESULT([yes])
6531         ], [AC_MSG_RESULT([no])])
6532     AC_LANG_POP([C++])
6534     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6535     AC_LANG_PUSH([C++])
6536     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6537             #include <cstddef>
6538             #include <cxxabi.h>
6539             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6540         ])], [
6541             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6542             AC_MSG_RESULT([yes])
6543         ], [AC_MSG_RESULT([no])])
6544     AC_LANG_POP([C++])
6546     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6547     AC_LANG_PUSH([C++])
6548     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6549             #include <cstddef>
6550             #include <cxxabi.h>
6551             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6552         ])], [
6553             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6554             AC_MSG_RESULT([yes])
6555         ], [AC_MSG_RESULT([no])])
6556     AC_LANG_POP([C++])
6559 AC_SUBST(HAVE_GCC_AVX)
6560 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6561 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6563 dnl ===================================================================
6564 dnl Identify the C++ library
6565 dnl ===================================================================
6567 AC_MSG_CHECKING([what the C++ library is])
6568 AC_LANG_PUSH([C++])
6569 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6570 #include <utility>
6571 #ifndef __GLIBCXX__
6572 foo bar
6573 #endif
6574 ]])],
6575     [CPP_LIBRARY=GLIBCXX
6576      cpp_library_name="GNU libstdc++"
6577     ],
6578     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6579 #include <utility>
6580 #ifndef _LIBCPP_VERSION
6581 foo bar
6582 #endif
6583 ]])],
6584     [CPP_LIBRARY=LIBCPP
6585      cpp_library_name="LLVM libc++"
6586      AC_DEFINE([HAVE_LIBCXX])
6587     ],
6588     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6589 #include <utility>
6590 #ifndef _MSC_VER
6591 foo bar
6592 #endif
6593 ]])],
6594     [CPP_LIBRARY=MSVCRT
6595      cpp_library_name="Microsoft"
6596     ],
6597     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6598 AC_MSG_RESULT([$cpp_library_name])
6599 AC_LANG_POP([C++])
6601 dnl ===================================================================
6602 dnl Check for gperf
6603 dnl ===================================================================
6604 AC_PATH_PROG(GPERF, gperf)
6605 if test -z "$GPERF"; then
6606     AC_MSG_ERROR([gperf not found but needed. Install it.])
6608 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6609     GPERF=`cygpath -m $GPERF`
6611 AC_MSG_CHECKING([whether gperf is new enough])
6612 my_gperf_ver1=$($GPERF --version | head -n 1)
6613 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6614 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6615 if test "$my_gperf_ver3" -ge 301; then
6616     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6617 else
6618     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6620 AC_SUBST(GPERF)
6622 dnl ===================================================================
6623 dnl Check for system libcmis
6624 dnl ===================================================================
6625 # libcmis requires curl and we can't build curl for iOS
6626 if test $_os != iOS; then
6627     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6628     ENABLE_LIBCMIS=TRUE
6629 else
6630     ENABLE_LIBCMIS=
6632 AC_SUBST(ENABLE_LIBCMIS)
6634 dnl ===================================================================
6635 dnl C++11
6636 dnl ===================================================================
6638 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6639 CXXFLAGS_CXX11=
6640 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6641     if test "$with_latest_c__" = yes; then
6642         CXXFLAGS_CXX11=-std:c++latest
6643     else
6644         CXXFLAGS_CXX11=-std:c++17
6645     fi
6646     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6647 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6648     my_flags='-std=c++17 -std=c++1z'
6649     if test "$with_latest_c__" = yes; then
6650         my_flags="-std=c++20 -std=c++2a $my_flags"
6651     fi
6652     for flag in $my_flags; do
6653         if test "$COM" = MSC; then
6654             flag="-Xclang $flag"
6655         fi
6656         save_CXXFLAGS=$CXXFLAGS
6657         CXXFLAGS="$CXXFLAGS $flag -Werror"
6658         if test "$SYSTEM_LIBCMIS" = TRUE; then
6659             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6660         fi
6661         AC_LANG_PUSH([C++])
6662         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6663             #include <algorithm>
6664             #include <functional>
6665             #include <vector>
6667             #if defined SYSTEM_LIBCMIS
6668             // See ucb/source/ucp/cmis/auth_provider.hxx:
6669             #if !defined __clang__
6670             #pragma GCC diagnostic push
6671             #pragma GCC diagnostic ignored "-Wdeprecated"
6672             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6673             #endif
6674             #include <libcmis/libcmis.hxx>
6675             #if !defined __clang__
6676             #pragma GCC diagnostic pop
6677             #endif
6678             #endif
6680             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6681                 std::sort(v.begin(), v.end(), fn);
6682             }
6683             ]])],[CXXFLAGS_CXX11=$flag])
6684         AC_LANG_POP([C++])
6685         CXXFLAGS=$save_CXXFLAGS
6686         if test -n "$CXXFLAGS_CXX11"; then
6687             break
6688         fi
6689     done
6691 if test -n "$CXXFLAGS_CXX11"; then
6692     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6693 else
6694     AC_MSG_ERROR(no)
6696 AC_SUBST(CXXFLAGS_CXX11)
6698 if test "$GCC" = "yes"; then
6699     save_CXXFLAGS=$CXXFLAGS
6700     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6701     CHECK_L_ATOMIC
6702     CXXFLAGS=$save_CXXFLAGS
6703     AC_SUBST(ATOMIC_LIB)
6706 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6707 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6708 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6709 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6710 dnl again towards 4.7.2:
6711 if test $CPP_LIBRARY = GLIBCXX; then
6712     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6713     AC_LANG_PUSH([C++])
6714     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6715 #include <list>
6716 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6717     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6718     //   GCC 4.7.0: 20120322
6719     //   GCC 4.7.1: 20120614
6720     // and using a range check is not possible as the mapping between
6721     // __GLIBCXX__ values and GCC versions is not monotonic
6722 /* ok */
6723 #else
6724 abi broken
6725 #endif
6726         ]])], [AC_MSG_RESULT(no, ok)],
6727         [AC_MSG_ERROR(yes)])
6728     AC_LANG_POP([C++])
6731 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6732 save_CXXFLAGS=$CXXFLAGS
6733 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6734 AC_LANG_PUSH([C++])
6736 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6737 #include <stddef.h>
6739 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6741 namespace
6743         struct b
6744         {
6745                 int i;
6746                 int j;
6747         };
6749 ]], [[
6750 struct a
6752         int i;
6753         int j;
6755 a thinga[]={{0,0}, {1,1}};
6756 b thingb[]={{0,0}, {1,1}};
6757 size_t i = sizeof(sal_n_array_size(thinga));
6758 size_t j = sizeof(sal_n_array_size(thingb));
6759 return !(i != 0 && j != 0);
6761     ], [ AC_MSG_RESULT(yes) ],
6762     [ AC_MSG_ERROR(no)])
6763 AC_LANG_POP([C++])
6764 CXXFLAGS=$save_CXXFLAGS
6766 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6767 if test "$GCC" = yes; then
6768     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6769     AC_LANG_PUSH([C++])
6770     save_CXXFLAGS=$CXXFLAGS
6771     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6772     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6773     CXXFLAGS=$save_CXXFLAGS
6774     AC_LANG_POP([C++])
6775     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6776         AC_MSG_RESULT([yes])
6777     else
6778         AC_MSG_RESULT([no])
6779     fi
6781 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6783 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6784 AC_LANG_PUSH([C++])
6785 save_CXXFLAGS=$CXXFLAGS
6786 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6787 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6788         #include <algorithm>
6789         #include <initializer_list>
6790         #include <vector>
6791         template<typename T> class S {
6792         private:
6793             std::vector<T> v_;
6794         public:
6795             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6796         };
6797         constinit S<int> s{3, 2, 1};
6798     ])], [
6799         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6800         AC_MSG_RESULT([yes])
6801     ], [AC_MSG_RESULT([no])])
6802 CXXFLAGS=$save_CXXFLAGS
6803 AC_LANG_POP([C++])
6805 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6806 AC_LANG_PUSH([C++])
6807 save_CXXFLAGS=$CXXFLAGS
6808 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6809 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6810         #include <span>
6811         #include <type_traits>
6812         // Don't check size_type directly, as it was called index_type before P1872R0:
6813         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6814     ])], [
6815         AC_DEFINE([HAVE_CPP_SPAN],[1])
6816         AC_MSG_RESULT([yes])
6817     ], [AC_MSG_RESULT([no])])
6818 CXXFLAGS=$save_CXXFLAGS
6819 AC_LANG_POP([C++])
6821 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
6822 AC_LANG_PUSH([C++])
6823 save_CXXFLAGS=$CXXFLAGS
6824 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6825 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6826         struct S1 { S1(S1 &&); };
6827         struct S2: S1 {};
6828         S1 f(S2 s) { return s; }
6829     ])], [
6830         AC_DEFINE([HAVE_P1155R3],[1])
6831         AC_MSG_RESULT([yes])
6832     ], [AC_MSG_RESULT([no])])
6833 CXXFLAGS=$save_CXXFLAGS
6834 AC_LANG_POP([C++])
6836 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
6837 dnl which is included in -Wextra anyway):
6838 HAVE_WDEPRECATED_COPY_DTOR=
6839 if test "$GCC" = yes; then
6840     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
6841     AC_LANG_PUSH([C++])
6842     save_CXXFLAGS=$CXXFLAGS
6843     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
6844     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
6845             HAVE_WDEPRECATED_COPY_DTOR=TRUE
6846             AC_MSG_RESULT([yes])
6847         ], [AC_MSG_RESULT([no])])
6848     CXXFLAGS=$save_CXXFLAGS
6849     AC_LANG_POP([C++])
6851 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
6853 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6854 dnl uninitialized warning for code like
6856 dnl   OString f();
6857 dnl   boost::optional<OString> * g(bool b) {
6858 dnl       boost::optional<OString> o;
6859 dnl       if (b) o = f();
6860 dnl       return new boost::optional<OString>(o);
6861 dnl   }
6863 dnl (as is e.g. present, in a slightly more elaborate form, in
6864 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6865 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6866 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6867 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6868     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6869     AC_LANG_PUSH([C++])
6870     save_CXXFLAGS=$CXXFLAGS
6871     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6872     if test "$ENABLE_OPTIMIZED" = TRUE; then
6873         CXXFLAGS="$CXXFLAGS -O2"
6874     else
6875         CXXFLAGS="$CXXFLAGS -O0"
6876     fi
6877     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6878             #include <new>
6879             void f1(int);
6880             struct S1 {
6881                 ~S1() { f1(n); }
6882                 int n = 0;
6883             };
6884             struct S2 {
6885                 S2() {}
6886                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6887                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6888                 void set(S1 s) {
6889                     new (stg) S1(s);
6890                     init = true;
6891                 }
6892                 bool init = false;
6893                 char stg[sizeof (S1)];
6894             } ;
6895             S1 f2();
6896             S2 * f3(bool b) {
6897                 S2 o;
6898                 if (b) o.set(f2());
6899                 return new S2(o);
6900             }
6901         ]])], [AC_MSG_RESULT([no])], [
6902             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6903             AC_MSG_RESULT([yes])
6904         ])
6905     CXXFLAGS=$save_CXXFLAGS
6906     AC_LANG_POP([C++])
6908 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6910 dnl ===================================================================
6911 dnl CPU Intrinsics support - SSE, AVX
6912 dnl ===================================================================
6914 CXXFLAGS_INTRINSICS_SSE2=
6915 CXXFLAGS_INTRINSICS_SSSE3=
6916 CXXFLAGS_INTRINSICS_SSE41=
6917 CXXFLAGS_INTRINSICS_SSE42=
6918 CXXFLAGS_INTRINSICS_AVX=
6919 CXXFLAGS_INTRINSICS_AVX2=
6920 CXXFLAGS_INTRINSICS_AVX512=
6921 CXXFLAGS_INTRINSICS_F16C=
6922 CXXFLAGS_INTRINSICS_FMA=
6924 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6925     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
6926     flag_sse2=-msse2
6927     flag_ssse3=-mssse3
6928     flag_sse41=-msse4.1
6929     flag_sse42=-msse4.2
6930     flag_avx=-mavx
6931     flag_avx2=-mavx2
6932     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
6933     flag_f16c=-mf16c
6934     flag_fma=-mfma
6935 else
6936     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
6937     # MSVC seems to differentiate only between SSE and SSE2, where in fact
6938     # SSE2 seems to be SSE2+.
6939     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
6940     # is not empty (and can be tested in gbuild).
6941     flag_sse2=-arch:SSE2
6942     flag_ssse3=-arch:SSE2
6943     flag_sse41=-arch:SSE2
6944     flag_sse42=-arch:SSE2
6945     flag_avx=-arch:AVX
6946     flag_avx2=-arch:AVX2
6947     flag_avx512=-arch:AVX512
6948     # These are part of -arch:AVX2
6949     flag_f16c=-arch:AVX2
6950     flag_fma=-arch:AVX2
6953 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6954 AC_LANG_PUSH([C++])
6955 save_CXXFLAGS=$CXXFLAGS
6956 CXXFLAGS="$CXXFLAGS $flag_sse2"
6957 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6958     #include <emmintrin.h>
6959     int main () {
6960         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6961         c = _mm_xor_si128 (a, b);
6962         return 0;
6963     }
6964     ])],
6965     [can_compile_sse2=yes],
6966     [can_compile_sse2=no])
6967 AC_LANG_POP([C++])
6968 CXXFLAGS=$save_CXXFLAGS
6969 AC_MSG_RESULT([${can_compile_sse2}])
6970 if test "${can_compile_sse2}" = "yes" ; then
6971     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
6974 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6975 AC_LANG_PUSH([C++])
6976 save_CXXFLAGS=$CXXFLAGS
6977 CXXFLAGS="$CXXFLAGS $flag_ssse3"
6978 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6979     #include <tmmintrin.h>
6980     int main () {
6981         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6982         c = _mm_maddubs_epi16 (a, b);
6983         return 0;
6984     }
6985     ])],
6986     [can_compile_ssse3=yes],
6987     [can_compile_ssse3=no])
6988 AC_LANG_POP([C++])
6989 CXXFLAGS=$save_CXXFLAGS
6990 AC_MSG_RESULT([${can_compile_ssse3}])
6991 if test "${can_compile_ssse3}" = "yes" ; then
6992     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
6995 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
6996 AC_LANG_PUSH([C++])
6997 save_CXXFLAGS=$CXXFLAGS
6998 CXXFLAGS="$CXXFLAGS $flag_sse41"
6999 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7000     #include <smmintrin.h>
7001     int main () {
7002         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7003         c = _mm_cmpeq_epi64 (a, b);
7004         return 0;
7005     }
7006     ])],
7007     [can_compile_sse41=yes],
7008     [can_compile_sse41=no])
7009 AC_LANG_POP([C++])
7010 CXXFLAGS=$save_CXXFLAGS
7011 AC_MSG_RESULT([${can_compile_sse41}])
7012 if test "${can_compile_sse41}" = "yes" ; then
7013     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7016 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7017 AC_LANG_PUSH([C++])
7018 save_CXXFLAGS=$CXXFLAGS
7019 CXXFLAGS="$CXXFLAGS $flag_sse42"
7020 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7021     #include <nmmintrin.h>
7022     int main () {
7023         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7024         c = _mm_cmpgt_epi64 (a, b);
7025         return 0;
7026     }
7027     ])],
7028     [can_compile_sse42=yes],
7029     [can_compile_sse42=no])
7030 AC_LANG_POP([C++])
7031 CXXFLAGS=$save_CXXFLAGS
7032 AC_MSG_RESULT([${can_compile_sse42}])
7033 if test "${can_compile_sse42}" = "yes" ; then
7034     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7037 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7038 AC_LANG_PUSH([C++])
7039 save_CXXFLAGS=$CXXFLAGS
7040 CXXFLAGS="$CXXFLAGS $flag_avx"
7041 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7042     #include <immintrin.h>
7043     int main () {
7044         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7045         c = _mm256_xor_ps(a, b);
7046         return 0;
7047     }
7048     ])],
7049     [can_compile_avx=yes],
7050     [can_compile_avx=no])
7051 AC_LANG_POP([C++])
7052 CXXFLAGS=$save_CXXFLAGS
7053 AC_MSG_RESULT([${can_compile_avx}])
7054 if test "${can_compile_avx}" = "yes" ; then
7055     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7058 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7059 AC_LANG_PUSH([C++])
7060 save_CXXFLAGS=$CXXFLAGS
7061 CXXFLAGS="$CXXFLAGS $flag_avx2"
7062 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7063     #include <immintrin.h>
7064     int main () {
7065         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7066         c = _mm256_maddubs_epi16(a, b);
7067         return 0;
7068     }
7069     ])],
7070     [can_compile_avx2=yes],
7071     [can_compile_avx2=no])
7072 AC_LANG_POP([C++])
7073 CXXFLAGS=$save_CXXFLAGS
7074 AC_MSG_RESULT([${can_compile_avx2}])
7075 if test "${can_compile_avx2}" = "yes" ; then
7076     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7079 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7080 AC_LANG_PUSH([C++])
7081 save_CXXFLAGS=$CXXFLAGS
7082 CXXFLAGS="$CXXFLAGS $flag_avx512"
7083 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7084     #include <immintrin.h>
7085     int main () {
7086         __m512i a = _mm512_loadu_si512(0);
7087         return 0;
7088     }
7089     ])],
7090     [can_compile_avx512=yes],
7091     [can_compile_avx512=no])
7092 AC_LANG_POP([C++])
7093 CXXFLAGS=$save_CXXFLAGS
7094 AC_MSG_RESULT([${can_compile_avx512}])
7095 if test "${can_compile_avx512}" = "yes" ; then
7096     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7099 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7100 AC_LANG_PUSH([C++])
7101 save_CXXFLAGS=$CXXFLAGS
7102 CXXFLAGS="$CXXFLAGS $flag_f16c"
7103 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7104     #include <immintrin.h>
7105     int main () {
7106         __m128i a = _mm_set1_epi32 (0);
7107         __m128 c;
7108         c = _mm_cvtph_ps(a);
7109         return 0;
7110     }
7111     ])],
7112     [can_compile_f16c=yes],
7113     [can_compile_f16c=no])
7114 AC_LANG_POP([C++])
7115 CXXFLAGS=$save_CXXFLAGS
7116 AC_MSG_RESULT([${can_compile_f16c}])
7117 if test "${can_compile_f16c}" = "yes" ; then
7118     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7121 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7122 AC_LANG_PUSH([C++])
7123 save_CXXFLAGS=$CXXFLAGS
7124 CXXFLAGS="$CXXFLAGS $flag_fma"
7125 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7126     #include <immintrin.h>
7127     int main () {
7128         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7129         d = _mm256_fmadd_ps(a, b, c);
7130         return 0;
7131     }
7132     ])],
7133     [can_compile_fma=yes],
7134     [can_compile_fma=no])
7135 AC_LANG_POP([C++])
7136 CXXFLAGS=$save_CXXFLAGS
7137 AC_MSG_RESULT([${can_compile_fma}])
7138 if test "${can_compile_fma}" = "yes" ; then
7139     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7142 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7143 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7144 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7145 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7146 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7147 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7148 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7149 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7150 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7152 dnl ===================================================================
7153 dnl system stl sanity tests
7154 dnl ===================================================================
7155 if test "$_os" != "WINNT"; then
7157     AC_LANG_PUSH([C++])
7159     save_CPPFLAGS="$CPPFLAGS"
7160     if test -n "$MACOSX_SDK_PATH"; then
7161         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7162     fi
7164     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7165     # only.
7166     if test "$CPP_LIBRARY" = GLIBCXX; then
7167         dnl gcc#19664, gcc#22482, rhbz#162935
7168         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7169         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7170         AC_MSG_RESULT([$stlvisok])
7171         if test "$stlvisok" = "no"; then
7172             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7173         fi
7174     fi
7176     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7177     # when we don't make any dynamic libraries?
7178     if test "$DISABLE_DYNLOADING" = ""; then
7179         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7180         cat > conftestlib1.cc <<_ACEOF
7181 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7182 struct S2: S1<int> { virtual ~S2(); };
7183 S2::~S2() {}
7184 _ACEOF
7185         cat > conftestlib2.cc <<_ACEOF
7186 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7187 struct S2: S1<int> { virtual ~S2(); };
7188 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7189 _ACEOF
7190         gccvisinlineshiddenok=yes
7191         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7192             gccvisinlineshiddenok=no
7193         else
7194             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7195             dnl known to not work with -z defs (unsetting which makes the test
7196             dnl moot, though):
7197             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7198             if test "$COM_IS_CLANG" = TRUE; then
7199                 for i in $CXX $CXXFLAGS; do
7200                     case $i in
7201                     -fsanitize=*)
7202                         my_linkflagsnoundefs=
7203                         break
7204                         ;;
7205                     esac
7206                 done
7207             fi
7208             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7209                 gccvisinlineshiddenok=no
7210             fi
7211         fi
7213         rm -fr libconftest*
7214         AC_MSG_RESULT([$gccvisinlineshiddenok])
7215         if test "$gccvisinlineshiddenok" = "no"; then
7216             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7217         fi
7218     fi
7220    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7221     cat >visibility.cxx <<_ACEOF
7222 #pragma GCC visibility push(hidden)
7223 struct __attribute__ ((visibility ("default"))) TestStruct {
7224   static void Init();
7226 __attribute__ ((visibility ("default"))) void TestFunc() {
7227   TestStruct::Init();
7229 _ACEOF
7230     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7231         gccvisbroken=yes
7232     else
7233         case "$host_cpu" in
7234         i?86|x86_64)
7235             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7236                 gccvisbroken=no
7237             else
7238                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7239                     gccvisbroken=no
7240                 else
7241                     gccvisbroken=yes
7242                 fi
7243             fi
7244             ;;
7245         *)
7246             gccvisbroken=no
7247             ;;
7248         esac
7249     fi
7250     rm -f visibility.s visibility.cxx
7252     AC_MSG_RESULT([$gccvisbroken])
7253     if test "$gccvisbroken" = "yes"; then
7254         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7255     fi
7257     CPPFLAGS="$save_CPPFLAGS"
7259     AC_LANG_POP([C++])
7262 dnl ===================================================================
7263 dnl  Clang++ tests
7264 dnl ===================================================================
7266 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7267 if test "$GCC" = "yes"; then
7268     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7269     AC_LANG_PUSH([C++])
7270     save_CXXFLAGS=$CXXFLAGS
7271     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7272     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7273     CXXFLAGS=$save_CXXFLAGS
7274     AC_LANG_POP([C++])
7275     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7276         AC_MSG_RESULT([yes])
7277     else
7278         AC_MSG_RESULT([no])
7279     fi
7281 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7283 dnl ===================================================================
7284 dnl Compiler plugins
7285 dnl ===================================================================
7287 COMPILER_PLUGINS=
7288 # currently only Clang
7290 if test "$COM_IS_CLANG" != "TRUE"; then
7291     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7292         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7293         enable_compiler_plugins=no
7294     fi
7297 COMPILER_PLUGINS_COM_IS_CLANG=
7298 if test "$COM_IS_CLANG" = "TRUE"; then
7299     if test -n "$enable_compiler_plugins"; then
7300         compiler_plugins="$enable_compiler_plugins"
7301     elif test -n "$ENABLE_DBGUTIL"; then
7302         compiler_plugins=test
7303     else
7304         compiler_plugins=no
7305     fi
7306     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7307         if test "$CLANGVER" -lt 50002; then
7308             if test "$compiler_plugins" = yes; then
7309                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7310             else
7311                 compiler_plugins=no
7312             fi
7313         fi
7314     fi
7315     if test "$compiler_plugins" != "no"; then
7316         dnl The prefix where Clang resides, override to where Clang resides if
7317         dnl using a source build:
7318         if test -z "$CLANGDIR"; then
7319             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | head -n 1)))))
7320         fi
7321         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7322         if test -z "$COMPILER_PLUGINS_CXX"; then
7323             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7324         fi
7325         clangbindir=$CLANGDIR/bin
7326         if test "$build_os" = "cygwin"; then
7327             clangbindir=$(cygpath -u "$clangbindir")
7328         fi
7329         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7330         if test -n "$LLVM_CONFIG"; then
7331             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7332             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7333             if test -z "$CLANGLIBDIR"; then
7334                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7335             fi
7336             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7337             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7338             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7339             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7340                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7341             fi
7342             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7343             clangobjdir=$($LLVM_CONFIG --obj-root)
7344             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7345                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7346             fi
7347         fi
7348         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7349         AC_LANG_PUSH([C++])
7350         save_CXX=$CXX
7351         save_CXXCPP=$CXXCPP
7352         save_CPPFLAGS=$CPPFLAGS
7353         save_CXXFLAGS=$CXXFLAGS
7354         save_LDFLAGS=$LDFLAGS
7355         save_LIBS=$LIBS
7356         CXX=$COMPILER_PLUGINS_CXX
7357         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7358         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7359         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7360         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7361             [COMPILER_PLUGINS=TRUE],
7362             [
7363             if test "$compiler_plugins" = "yes"; then
7364                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7365             else
7366                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7367                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7368             fi
7369             ])
7370         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7371         dnl comment in compilerplugins/Makefile-clang.mk:
7372         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7373             LDFLAGS=""
7374             AC_MSG_CHECKING([for clang libraries to use])
7375             if test -z "$CLANGTOOLLIBS"; then
7376                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7377  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7378                 AC_LINK_IFELSE([
7379                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7380                         [[ clang::FullSourceLoc().dump(); ]])
7381                 ],[CLANGTOOLLIBS="$LIBS"],[])
7382             fi
7383             if test -z "$CLANGTOOLLIBS"; then
7384                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7385                 AC_LINK_IFELSE([
7386                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7387                         [[ clang::FullSourceLoc().dump(); ]])
7388                 ],[CLANGTOOLLIBS="$LIBS"],[])
7389             fi
7390             AC_MSG_RESULT([$CLANGTOOLLIBS])
7391             if test -z "$CLANGTOOLLIBS"; then
7392                 if test "$compiler_plugins" = "yes"; then
7393                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7394                 else
7395                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7396                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7397                 fi
7398                 COMPILER_PLUGINS=
7399             fi
7400             if test -n "$COMPILER_PLUGINS"; then
7401                 if test -z "$CLANGSYSINCLUDE"; then
7402                     if test -n "$LLVM_CONFIG"; then
7403                         # Path to the clang system headers (no idea if there's a better way to get it).
7404                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7405                     fi
7406                 fi
7407             fi
7408         fi
7409         CXX=$save_CXX
7410         CXXCPP=$save_CXXCPP
7411         CPPFLAGS=$save_CPPFLAGS
7412         CXXFLAGS=$save_CXXFLAGS
7413         LDFLAGS=$save_LDFLAGS
7414         LIBS="$save_LIBS"
7415         AC_LANG_POP([C++])
7417         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7418         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7419             #ifndef __clang__
7420             you lose
7421             #endif
7422             int foo=42;
7423             ]])],
7424             [AC_MSG_RESULT([yes])
7425              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7426             [AC_MSG_RESULT([no])])
7427         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7428     fi
7429 else
7430     if test "$enable_compiler_plugins" = "yes"; then
7431         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7432     fi
7434 COMPILER_PLUGINS_ANALYZER_PCH=
7435 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7436     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7438 AC_SUBST(COMPILER_PLUGINS)
7439 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7440 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7441 AC_SUBST(COMPILER_PLUGINS_CXX)
7442 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7443 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7444 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7445 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7446 AC_SUBST(CLANGDIR)
7447 AC_SUBST(CLANGLIBDIR)
7448 AC_SUBST(CLANGTOOLLIBS)
7449 AC_SUBST(CLANGSYSINCLUDE)
7451 # Plugin to help linker.
7452 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7453 # This makes --enable-lto build with clang work.
7454 AC_SUBST(LD_PLUGIN)
7456 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7457 AC_SUBST(HAVE_POSIX_FALLOCATE)
7459 JITC_PROCESSOR_TYPE=""
7460 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7461     # IBMs JDK needs this...
7462     JITC_PROCESSOR_TYPE=6
7463     export JITC_PROCESSOR_TYPE
7465 AC_SUBST([JITC_PROCESSOR_TYPE])
7467 # Misc Windows Stuff
7468 AC_ARG_WITH(ucrt-dir,
7469     AS_HELP_STRING([--with-ucrt-dir],
7470         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7471         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7472         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7473             Windows6.1-KB2999226-x64.msu
7474             Windows6.1-KB2999226-x86.msu
7475             Windows8.1-KB2999226-x64.msu
7476             Windows8.1-KB2999226-x86.msu
7477             Windows8-RT-KB2999226-x64.msu
7478             Windows8-RT-KB2999226-x86.msu
7479         A zip archive including those files is available from Microsoft site:
7480         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7482 UCRT_REDISTDIR="$with_ucrt_dir"
7483 if test $_os = "WINNT"; then
7484     find_msvc_x64_dlls
7485     for i in $PKGFORMAT; do
7486         if test "$i" = msi; then
7487             find_msms
7488             break
7489         fi
7490     done
7491     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7492     MSVC_DLLS="$msvcdlls"
7493     MSM_PATH=`win_short_path_for_make "$msmdir"`
7494     # MSVC 15.3 changed it to VC141
7495     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
7496         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
7497     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7498         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7499     else
7500         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7501     fi
7503     if test "$UCRT_REDISTDIR" = "no"; then
7504         dnl explicitly disabled
7505         UCRT_REDISTDIR=""
7506     else
7507         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7508                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7509                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7510                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7511                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7512                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7513             UCRT_REDISTDIR=""
7514             if test -n "$PKGFORMAT"; then
7515                for i in $PKGFORMAT; do
7516                    case "$i" in
7517                    msi)
7518                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7519                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7520                        ;;
7521                    esac
7522                done
7523             fi
7524         fi
7525     fi
7528 AC_SUBST(UCRT_REDISTDIR)
7529 AC_SUBST(MSVC_DLL_PATH)
7530 AC_SUBST(MSVC_DLLS)
7531 AC_SUBST(MSM_PATH)
7533 dnl ===================================================================
7534 dnl Checks for Java
7535 dnl ===================================================================
7536 if test "$ENABLE_JAVA" != ""; then
7538     # Windows-specific tests
7539     if test "$build_os" = "cygwin"; then
7540         if test "$BITNESS_OVERRIDE" = 64; then
7541             bitness=64
7542         else
7543             bitness=32
7544         fi
7546         if test -z "$with_jdk_home"; then
7547             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7548             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7549             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7550             if test -n "$regvalue"; then
7551                 ver=$regvalue
7552                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7553                 reg_jdk_home=$regvalue
7554             fi
7556             if test -f "$reg_jdk_home/lib/jvm.lib" -a -f "$reg_jdk_home/bin/java.exe"; then
7557                 with_jdk_home="$reg_jdk_home"
7558                 howfound="found automatically"
7559             else
7560                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK >= 9])
7561             fi
7562         else
7563             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7564             howfound="you passed"
7565         fi
7566     fi
7568     # 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.
7569     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7570     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7571         with_jdk_home=`/usr/libexec/java_home`
7572     fi
7574     JAVA_HOME=; export JAVA_HOME
7575     if test -z "$with_jdk_home"; then
7576         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7577     else
7578         _java_path="$with_jdk_home/bin/$with_java"
7579         dnl Check if there is a Java interpreter at all.
7580         if test -x "$_java_path"; then
7581             JAVAINTERPRETER=$_java_path
7582         else
7583             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7584         fi
7585     fi
7587     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7588     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7589     dnl loaded by java to run JunitTests:
7590     if test "$build_os" = "cygwin"; then
7591         shortjdkhome=`cygpath -d "$with_jdk_home"`
7592         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
7593             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7594             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7595         elif test "$BITNESS_OVERRIDE" = "" -a -f "$with_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7596             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7597             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7598         fi
7600         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7601             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7602         fi
7603         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7604     elif test "$cross_compiling" != "yes"; then
7605         case $CPUNAME in
7606             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7607                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7608                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7609                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7610                 fi
7611                 ;;
7612             *) # assumption: everything else 32-bit
7613                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7614                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7615                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7616                 fi
7617                 ;;
7618         esac
7619     fi
7622 dnl ===================================================================
7623 dnl Checks for JDK.
7624 dnl ===================================================================
7626 # Note that JAVA_HOME as for now always means the *build* platform's
7627 # JAVA_HOME. Whether all the complexity here actually is needed any
7628 # more or not, no idea.
7630 if test "$ENABLE_JAVA" != ""; then
7631     _gij_longver=0
7632     AC_MSG_CHECKING([the installed JDK])
7633     if test -n "$JAVAINTERPRETER"; then
7634         dnl java -version sends output to stderr!
7635         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7636             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7637         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7638             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7639         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7640             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7641         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7642             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7643         else
7644             JDK=sun
7646             dnl Sun JDK specific tests
7647             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7648             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7650             if test "$_jdk_ver" -lt 10900; then
7651                 AC_MSG_ERROR([JDK is too old, you need at least 9])
7652             fi
7653             if test "$_jdk_ver" -gt 10900; then
7654                 JAVA_CLASSPATH_NOT_SET=TRUE
7655             fi
7657             AC_MSG_RESULT([found (JDK $_jdk)])
7658             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7659             if test "$_os" = "WINNT"; then
7660                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7661             fi
7663             # set to limit VM usage for JunitTests
7664             JAVAIFLAGS=-Xmx64M
7665             # set to limit VM usage for javac
7666             JAVAFLAGS=-J-Xmx128M
7667         fi
7668     else
7669         AC_MSG_ERROR([Java not found. You need at least JDK 9])
7670     fi
7671 else
7672     dnl Java disabled
7673     JAVA_HOME=
7674     export JAVA_HOME
7677 dnl ===================================================================
7678 dnl Checks for javac
7679 dnl ===================================================================
7680 if test "$ENABLE_JAVA" != ""; then
7681     javacompiler="javac"
7682     : ${JAVA_SOURCE_VER=8}
7683     : ${JAVA_TARGET_VER=8}
7684     if test -z "$with_jdk_home"; then
7685         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7686     else
7687         _javac_path="$with_jdk_home/bin/$javacompiler"
7688         dnl Check if there is a Java compiler at all.
7689         if test -x "$_javac_path"; then
7690             JAVACOMPILER=$_javac_path
7691         fi
7692     fi
7693     if test -z "$JAVACOMPILER"; then
7694         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7695     fi
7696     if test "$build_os" = "cygwin"; then
7697         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7698             JAVACOMPILER="${JAVACOMPILER}.exe"
7699         fi
7700         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7701     fi
7704 dnl ===================================================================
7705 dnl Checks for javadoc
7706 dnl ===================================================================
7707 if test "$ENABLE_JAVA" != ""; then
7708     if test -z "$with_jdk_home"; then
7709         AC_PATH_PROG(JAVADOC, javadoc)
7710     else
7711         _javadoc_path="$with_jdk_home/bin/javadoc"
7712         dnl Check if there is a javadoc at all.
7713         if test -x "$_javadoc_path"; then
7714             JAVADOC=$_javadoc_path
7715         else
7716             AC_PATH_PROG(JAVADOC, javadoc)
7717         fi
7718     fi
7719     if test -z "$JAVADOC"; then
7720         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7721     fi
7722     if test "$build_os" = "cygwin"; then
7723         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7724             JAVADOC="${JAVADOC}.exe"
7725         fi
7726         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7727     fi
7729     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7730     JAVADOCISGJDOC="yes"
7731     fi
7733 AC_SUBST(JAVADOCISGJDOC)
7735 if test "$ENABLE_JAVA" != ""; then
7736     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7737     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7738         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7739            # try to recover first by looking whether we have an alternative
7740            # system as in Debian or newer SuSEs where following /usr/bin/javac
7741            # over /etc/alternatives/javac leads to the right bindir where we
7742            # just need to strip a bit away to get a valid JAVA_HOME
7743            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7744         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7745             # maybe only one level of symlink (e.g. on Mac)
7746             JAVA_HOME=$(readlink $JAVACOMPILER)
7747             if test "$(dirname $JAVA_HOME)" = "."; then
7748                 # we've got no path to trim back
7749                 JAVA_HOME=""
7750             fi
7751         else
7752             # else warn
7753             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7754             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7755             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7756             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7757         fi
7758         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7759         if test "$JAVA_HOME" != "/usr"; then
7760             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7761                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7762                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7763                 dnl Tiger already returns a JDK path...
7764                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7765             else
7766                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7767                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7768                 dnl that checks which version to run
7769                 if test -f "$JAVA_HOME"; then
7770                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7771                 fi
7772             fi
7773         fi
7774     fi
7775     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7777     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7778     if test -z "$JAVA_HOME"; then
7779         if test "x$with_jdk_home" = "x"; then
7780             cat > findhome.java <<_ACEOF
7781 [import java.io.File;
7783 class findhome
7785     public static void main(String args[])
7786     {
7787         String jrelocation = System.getProperty("java.home");
7788         File jre = new File(jrelocation);
7789         System.out.println(jre.getParent());
7790     }
7792 _ACEOF
7793             AC_MSG_CHECKING([if javac works])
7794             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7795             AC_TRY_EVAL(javac_cmd)
7796             if test $? = 0 -a -f ./findhome.class; then
7797                 AC_MSG_RESULT([javac works])
7798             else
7799                 echo "configure: javac test failed" >&5
7800                 cat findhome.java >&5
7801                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7802             fi
7803             AC_MSG_CHECKING([if gij knows its java.home])
7804             JAVA_HOME=`$JAVAINTERPRETER findhome`
7805             if test $? = 0 -a "$JAVA_HOME" != ""; then
7806                 AC_MSG_RESULT([$JAVA_HOME])
7807             else
7808                 echo "configure: java test failed" >&5
7809                 cat findhome.java >&5
7810                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7811             fi
7812             # clean-up after ourselves
7813             rm -f ./findhome.java ./findhome.class
7814         else
7815             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7816         fi
7817     fi
7819     # now check if $JAVA_HOME is really valid
7820     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7821         case "${JAVA_HOME}" in
7822             /Library/Java/JavaVirtualMachines/*)
7823                 ;;
7824             *)
7825                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7826                 ;;
7827         esac
7828         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7829             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7830             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7831             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7832             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7833             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7834             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7835         fi
7836     fi
7837     PathFormat "$JAVA_HOME"
7838     JAVA_HOME="$formatted_path"
7841 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7842     "$_os" != Darwin
7843 then
7844     AC_MSG_CHECKING([for JAWT lib])
7845     if test "$_os" = WINNT; then
7846         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7847         JAWTLIB=jawt.lib
7848     else
7849         case "$host_cpu" in
7850         arm*)
7851             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7852             JAVA_ARCH=$my_java_arch
7853             ;;
7854         i*86)
7855             my_java_arch=i386
7856             ;;
7857         m68k)
7858             my_java_arch=m68k
7859             ;;
7860         powerpc)
7861             my_java_arch=ppc
7862             ;;
7863         powerpc64)
7864             my_java_arch=ppc64
7865             ;;
7866         powerpc64le)
7867             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7868             JAVA_ARCH=$my_java_arch
7869             ;;
7870         sparc64)
7871             my_java_arch=sparcv9
7872             ;;
7873         x86_64)
7874             my_java_arch=amd64
7875             ;;
7876         *)
7877             my_java_arch=$host_cpu
7878             ;;
7879         esac
7880         # This is where JDK9 puts the library
7881         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7882             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7883         else
7884             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7885         fi
7886         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7887     fi
7888     AC_MSG_RESULT([$JAWTLIB])
7890 AC_SUBST(JAWTLIB)
7892 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7893     case "$host_os" in
7895     aix*)
7896         JAVAINC="-I$JAVA_HOME/include"
7897         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7898         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7899         ;;
7901     cygwin*)
7902         JAVAINC="-I$JAVA_HOME/include/win32"
7903         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7904         ;;
7906     darwin*)
7907         if test -d "$JAVA_HOME/include/darwin"; then
7908             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7909         else
7910             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7911         fi
7912         ;;
7914     dragonfly*)
7915         JAVAINC="-I$JAVA_HOME/include"
7916         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7917         ;;
7919     freebsd*)
7920         JAVAINC="-I$JAVA_HOME/include"
7921         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7922         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7923         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7924         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7925         ;;
7927     k*bsd*-gnu*)
7928         JAVAINC="-I$JAVA_HOME/include"
7929         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7930         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7931         ;;
7933     linux-gnu*)
7934         JAVAINC="-I$JAVA_HOME/include"
7935         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7936         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7937         ;;
7939     *netbsd*)
7940         JAVAINC="-I$JAVA_HOME/include"
7941         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7942         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7943        ;;
7945     openbsd*)
7946         JAVAINC="-I$JAVA_HOME/include"
7947         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7948         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7949         ;;
7951     solaris*)
7952         JAVAINC="-I$JAVA_HOME/include"
7953         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7954         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7955         ;;
7956     esac
7958 SOLARINC="$SOLARINC $JAVAINC"
7960 AC_SUBST(JAVACOMPILER)
7961 AC_SUBST(JAVADOC)
7962 AC_SUBST(JAVAINTERPRETER)
7963 AC_SUBST(JAVAIFLAGS)
7964 AC_SUBST(JAVAFLAGS)
7965 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7966 AC_SUBST(JAVA_HOME)
7967 AC_SUBST(JAVA_SOURCE_VER)
7968 AC_SUBST(JAVA_TARGET_VER)
7969 AC_SUBST(JDK)
7972 dnl ===================================================================
7973 dnl Export file validation
7974 dnl ===================================================================
7975 AC_MSG_CHECKING([whether to enable export file validation])
7976 if test "$with_export_validation" != "no"; then
7977     if test -z "$ENABLE_JAVA"; then
7978         if test "$with_export_validation" = "yes"; then
7979             AC_MSG_ERROR([requested, but Java is disabled])
7980         else
7981             AC_MSG_RESULT([no, as Java is disabled])
7982         fi
7983     elif ! test -d "${SRC_ROOT}/schema"; then
7984         if test "$with_export_validation" = "yes"; then
7985             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7986         else
7987             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7988         fi
7989     else
7990         AC_MSG_RESULT([yes])
7991         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7993         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7994         if test -z "$ODFVALIDATOR"; then
7995             # remember to download the ODF toolkit with validator later
7996             AC_MSG_NOTICE([no odfvalidator found, will download it])
7997             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7998             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8000             # and fetch name of odfvalidator jar name from download.lst
8001             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8002             AC_SUBST(ODFVALIDATOR_JAR)
8004             if test -z "$ODFVALIDATOR_JAR"; then
8005                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8006             fi
8007         fi
8008         if test "$build_os" = "cygwin"; then
8009             # In case of Cygwin it will be executed from Windows,
8010             # so we need to run bash and absolute path to validator
8011             # so instead of "odfvalidator" it will be
8012             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8013             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8014         else
8015             ODFVALIDATOR="sh $ODFVALIDATOR"
8016         fi
8017         AC_SUBST(ODFVALIDATOR)
8020         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8021         if test -z "$OFFICEOTRON"; then
8022             # remember to download the officeotron with validator later
8023             AC_MSG_NOTICE([no officeotron found, will download it])
8024             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8025             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8027             # and fetch name of officeotron jar name from download.lst
8028             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8029             AC_SUBST(OFFICEOTRON_JAR)
8031             if test -z "$OFFICEOTRON_JAR"; then
8032                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8033             fi
8034         else
8035             # check version of existing officeotron
8036             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8037             if test 0"$OFFICEOTRON_VER" -lt 704; then
8038                 AC_MSG_ERROR([officeotron too old])
8039             fi
8040         fi
8041         if test "$build_os" = "cygwin"; then
8042             # In case of Cygwin it will be executed from Windows,
8043             # so we need to run bash and absolute path to validator
8044             # so instead of "odfvalidator" it will be
8045             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8046             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8047         else
8048             OFFICEOTRON="sh $OFFICEOTRON"
8049         fi
8050     fi
8051     AC_SUBST(OFFICEOTRON)
8052 else
8053     AC_MSG_RESULT([no])
8056 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8057 if test "$with_bffvalidator" != "no"; then
8058     AC_DEFINE(HAVE_BFFVALIDATOR)
8060     if test "$with_export_validation" = "no"; then
8061         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8062     fi
8064     if test "$with_bffvalidator" = "yes"; then
8065         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8066     else
8067         BFFVALIDATOR="$with_bffvalidator"
8068     fi
8070     if test "$build_os" = "cygwin"; then
8071         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8072             AC_MSG_RESULT($BFFVALIDATOR)
8073         else
8074             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8075         fi
8076     elif test -n "$BFFVALIDATOR"; then
8077         # We are not in Cygwin but need to run Windows binary with wine
8078         AC_PATH_PROGS(WINE, wine)
8080         # so swap in a shell wrapper that converts paths transparently
8081         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8082         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8083         AC_SUBST(BFFVALIDATOR_EXE)
8084         AC_MSG_RESULT($BFFVALIDATOR)
8085     else
8086         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8087     fi
8088     AC_SUBST(BFFVALIDATOR)
8089 else
8090     AC_MSG_RESULT([no])
8093 dnl ===================================================================
8094 dnl Check for C preprocessor to use
8095 dnl ===================================================================
8096 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8097 if test -n "$with_idlc_cpp"; then
8098     AC_MSG_RESULT([$with_idlc_cpp])
8099     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8100 else
8101     AC_MSG_RESULT([ucpp])
8102     AC_MSG_CHECKING([which ucpp tp use])
8103     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8104         AC_MSG_RESULT([external])
8105         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8106     else
8107         AC_MSG_RESULT([internal])
8108         BUILD_TYPE="$BUILD_TYPE UCPP"
8109     fi
8111 AC_SUBST(SYSTEM_UCPP)
8113 dnl ===================================================================
8114 dnl Check for epm (not needed for Windows)
8115 dnl ===================================================================
8116 AC_MSG_CHECKING([whether to enable EPM for packing])
8117 if test "$enable_epm" = "yes"; then
8118     AC_MSG_RESULT([yes])
8119     if test "$_os" != "WINNT"; then
8120         if test $_os = Darwin; then
8121             EPM=internal
8122         elif test -n "$with_epm"; then
8123             EPM=$with_epm
8124         else
8125             AC_PATH_PROG(EPM, epm, no)
8126         fi
8127         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8128             AC_MSG_NOTICE([EPM will be built.])
8129             BUILD_TYPE="$BUILD_TYPE EPM"
8130             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8131         else
8132             # Gentoo has some epm which is something different...
8133             AC_MSG_CHECKING([whether the found epm is the right epm])
8134             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8135                 AC_MSG_RESULT([yes])
8136             else
8137                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8138             fi
8139             AC_MSG_CHECKING([epm version])
8140             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8141             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8142                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8143                 AC_MSG_RESULT([OK, >= 3.7])
8144             else
8145                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8146                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8147             fi
8148         fi
8149     fi
8151     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8152         AC_MSG_CHECKING([for rpm])
8153         for a in "$RPM" rpmbuild rpm; do
8154             $a --usage >/dev/null 2> /dev/null
8155             if test $? -eq 0; then
8156                 RPM=$a
8157                 break
8158             else
8159                 $a --version >/dev/null 2> /dev/null
8160                 if test $? -eq 0; then
8161                     RPM=$a
8162                     break
8163                 fi
8164             fi
8165         done
8166         if test -z "$RPM"; then
8167             AC_MSG_ERROR([not found])
8168         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8169             RPM_PATH=`which $RPM`
8170             AC_MSG_RESULT([$RPM_PATH])
8171             SCPDEFS="$SCPDEFS -DWITH_RPM"
8172         else
8173             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8174         fi
8175     fi
8176     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8177         AC_PATH_PROG(DPKG, dpkg, no)
8178         if test "$DPKG" = "no"; then
8179             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8180         fi
8181     fi
8182     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8183        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8184         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8185             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8186                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8187                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8188                     AC_MSG_RESULT([yes])
8189                 else
8190                     AC_MSG_RESULT([no])
8191                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8192                         _pt="rpm"
8193                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8194                         add_warning "the rpms will need to be installed with --nodeps"
8195                     else
8196                         _pt="pkg"
8197                     fi
8198                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8199                     add_warning "the ${_pt}s will not be relocatable"
8200                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8201                                  relocation will work, you need to patch your epm with the
8202                                  patch in epm/epm-3.7.patch or build with
8203                                  --with-epm=internal which will build a suitable epm])
8204                 fi
8205             fi
8206         fi
8207     fi
8208     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8209         AC_PATH_PROG(PKGMK, pkgmk, no)
8210         if test "$PKGMK" = "no"; then
8211             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8212         fi
8213     fi
8214     AC_SUBST(RPM)
8215     AC_SUBST(DPKG)
8216     AC_SUBST(PKGMK)
8217 else
8218     for i in $PKGFORMAT; do
8219         case "$i" in
8220         aix | bsd | deb | pkg | rpm | native | portable)
8221             AC_MSG_ERROR(
8222                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8223             ;;
8224         esac
8225     done
8226     AC_MSG_RESULT([no])
8227     EPM=NO
8229 AC_SUBST(EPM)
8231 ENABLE_LWP=
8232 if test "$enable_lotuswordpro" = "yes"; then
8233     ENABLE_LWP="TRUE"
8235 AC_SUBST(ENABLE_LWP)
8237 dnl ===================================================================
8238 dnl Check for building ODK
8239 dnl ===================================================================
8240 if test "$enable_odk" = no; then
8241     unset DOXYGEN
8242 else
8243     if test "$with_doxygen" = no; then
8244         AC_MSG_CHECKING([for doxygen])
8245         unset DOXYGEN
8246         AC_MSG_RESULT([no])
8247     else
8248         if test "$with_doxygen" = yes; then
8249             AC_PATH_PROG([DOXYGEN], [doxygen])
8250             if test -z "$DOXYGEN"; then
8251                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8252             fi
8253             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8254                 if ! dot -V 2>/dev/null; then
8255                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8256                 fi
8257             fi
8258         else
8259             AC_MSG_CHECKING([for doxygen])
8260             DOXYGEN=$with_doxygen
8261             AC_MSG_RESULT([$DOXYGEN])
8262         fi
8263         if test -n "$DOXYGEN"; then
8264             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8265             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8266             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8267                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8268             fi
8269         fi
8270     fi
8272 AC_SUBST([DOXYGEN])
8274 AC_MSG_CHECKING([whether to build the ODK])
8275 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8276     AC_MSG_RESULT([yes])
8278     if test "$with_java" != "no"; then
8279         AC_MSG_CHECKING([whether to build unowinreg.dll])
8280         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8281             # build on Win by default
8282             enable_build_unowinreg=yes
8283         fi
8284         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8285             AC_MSG_RESULT([no])
8286             BUILD_UNOWINREG=
8287         else
8288             AC_MSG_RESULT([yes])
8289             BUILD_UNOWINREG=TRUE
8290         fi
8291         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8292             if test -z "$with_mingw_cross_compiler"; then
8293                 dnl Guess...
8294                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8295             elif test -x "$with_mingw_cross_compiler"; then
8296                  MINGWCXX="$with_mingw_cross_compiler"
8297             else
8298                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8299             fi
8301             if test "$MINGWCXX" = "false"; then
8302                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8303             fi
8305             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8306             if test -x "$mingwstrip_test"; then
8307                 MINGWSTRIP="$mingwstrip_test"
8308             else
8309                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8310             fi
8312             if test "$MINGWSTRIP" = "false"; then
8313                 AC_MSG_ERROR(MinGW32 binutils not found.)
8314             fi
8315         fi
8316     fi
8317     BUILD_TYPE="$BUILD_TYPE ODK"
8318 else
8319     AC_MSG_RESULT([no])
8320     BUILD_UNOWINREG=
8322 AC_SUBST(BUILD_UNOWINREG)
8323 AC_SUBST(MINGWCXX)
8324 AC_SUBST(MINGWSTRIP)
8326 dnl ===================================================================
8327 dnl Check for system zlib
8328 dnl ===================================================================
8329 if test "$with_system_zlib" = "auto"; then
8330     case "$_os" in
8331     WINNT)
8332         with_system_zlib="$with_system_libs"
8333         ;;
8334     *)
8335         if test "$enable_fuzzers" != "yes"; then
8336             with_system_zlib=yes
8337         else
8338             with_system_zlib=no
8339         fi
8340         ;;
8341     esac
8344 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8345 dnl and has no pkg-config for it at least on some tinderboxes,
8346 dnl so leaving that out for now
8347 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8348 AC_MSG_CHECKING([which zlib to use])
8349 if test "$with_system_zlib" = "yes"; then
8350     AC_MSG_RESULT([external])
8351     SYSTEM_ZLIB=TRUE
8352     AC_CHECK_HEADER(zlib.h, [],
8353         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8354     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8355         [AC_MSG_ERROR(zlib not found or functional)], [])
8356 else
8357     AC_MSG_RESULT([internal])
8358     SYSTEM_ZLIB=
8359     BUILD_TYPE="$BUILD_TYPE ZLIB"
8360     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8361     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8363 AC_SUBST(ZLIB_CFLAGS)
8364 AC_SUBST(ZLIB_LIBS)
8365 AC_SUBST(SYSTEM_ZLIB)
8367 dnl ===================================================================
8368 dnl Check for system jpeg
8369 dnl ===================================================================
8370 AC_MSG_CHECKING([which libjpeg to use])
8371 if test "$with_system_jpeg" = "yes"; then
8372     AC_MSG_RESULT([external])
8373     SYSTEM_LIBJPEG=TRUE
8374     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8375         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8376     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8377         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8378 else
8379     SYSTEM_LIBJPEG=
8380     AC_MSG_RESULT([internal, libjpeg-turbo])
8381     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8382     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8383     if test "$COM" = "MSC"; then
8384         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8385     else
8386         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8387     fi
8389     case "$host_cpu" in
8390     x86_64 | amd64 | i*86 | x86 | ia32)
8391         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8392         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8393             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8394                 NASM="$LODE_HOME/opt/bin/nasm"
8395             elif test -x "/opt/lo/bin/nasm"; then
8396                 NASM="/opt/lo/bin/nasm"
8397             fi
8398         fi
8400         if test -n "$NASM"; then
8401             AC_MSG_CHECKING([for object file format of host system])
8402             case "$host_os" in
8403               cygwin* | mingw* | pw32* | interix*)
8404                 case "$host_cpu" in
8405                   x86_64)
8406                     objfmt='Win64-COFF'
8407                     ;;
8408                   *)
8409                     objfmt='Win32-COFF'
8410                     ;;
8411                 esac
8412               ;;
8413               msdosdjgpp* | go32*)
8414                 objfmt='COFF'
8415               ;;
8416               os2-emx*) # not tested
8417                 objfmt='MSOMF' # obj
8418               ;;
8419               linux*coff* | linux*oldld*)
8420                 objfmt='COFF' # ???
8421               ;;
8422               linux*aout*)
8423                 objfmt='a.out'
8424               ;;
8425               linux*)
8426                 case "$host_cpu" in
8427                   x86_64)
8428                     objfmt='ELF64'
8429                     ;;
8430                   *)
8431                     objfmt='ELF'
8432                     ;;
8433                 esac
8434               ;;
8435               kfreebsd* | freebsd* | netbsd* | openbsd*)
8436                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8437                   objfmt='BSD-a.out'
8438                 else
8439                   case "$host_cpu" in
8440                     x86_64 | amd64)
8441                       objfmt='ELF64'
8442                       ;;
8443                     *)
8444                       objfmt='ELF'
8445                       ;;
8446                   esac
8447                 fi
8448               ;;
8449               solaris* | sunos* | sysv* | sco*)
8450                 case "$host_cpu" in
8451                   x86_64)
8452                     objfmt='ELF64'
8453                     ;;
8454                   *)
8455                     objfmt='ELF'
8456                     ;;
8457                 esac
8458               ;;
8459               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8460                 case "$host_cpu" in
8461                   x86_64)
8462                     objfmt='Mach-O64'
8463                     ;;
8464                   *)
8465                     objfmt='Mach-O'
8466                     ;;
8467                 esac
8468               ;;
8469               *)
8470                 objfmt='ELF ?'
8471               ;;
8472             esac
8474             AC_MSG_RESULT([$objfmt])
8475             if test "$objfmt" = 'ELF ?'; then
8476               objfmt='ELF'
8477               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8478             fi
8480             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8481             case "$objfmt" in
8482               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8483               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8484               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8485               COFF)       NAFLAGS='-fcoff -DCOFF';;
8486               a.out)      NAFLAGS='-faout -DAOUT';;
8487               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8488               ELF)        NAFLAGS='-felf -DELF';;
8489               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8490               RDF)        NAFLAGS='-frdf -DRDF';;
8491               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8492               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8493             esac
8494             AC_MSG_RESULT([$NAFLAGS])
8496             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8497             cat > conftest.asm << EOF
8498             [%line __oline__ "configure"
8499                     section .text
8500                     global  _main,main
8501             _main:
8502             main:   xor     eax,eax
8503                     ret
8504             ]
8506             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8507             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8508               AC_MSG_RESULT(yes)
8509             else
8510               echo "configure: failed program was:" >&AC_FD_CC
8511               cat conftest.asm >&AC_FD_CC
8512               rm -rf conftest*
8513               AC_MSG_RESULT(no)
8514               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8515               NASM=""
8516             fi
8518         fi
8520         if test -z "$NASM"; then
8521 cat << _EOS
8522 ****************************************************************************
8523 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8524 To get one please:
8526 _EOS
8527             if test "$build_os" = "cygwin"; then
8528 cat << _EOS
8529 install a pre-compiled binary for Win32
8531 mkdir -p /opt/lo/bin
8532 cd /opt/lo/bin
8533 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8534 chmod +x nasm
8536 or get and install one from http://www.nasm.us/
8538 Then re-run autogen.sh
8540 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8541 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8543 _EOS
8544             else
8545 cat << _EOS
8546 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8548 _EOS
8549             fi
8550             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8551             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8552         fi
8553       ;;
8554     esac
8557 AC_SUBST(NASM)
8558 AC_SUBST(LIBJPEG_CFLAGS)
8559 AC_SUBST(LIBJPEG_LIBS)
8560 AC_SUBST(SYSTEM_LIBJPEG)
8562 dnl ===================================================================
8563 dnl Check for system clucene
8564 dnl ===================================================================
8565 dnl we should rather be using
8566 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8567 dnl but the contribs-lib check seems tricky
8568 AC_MSG_CHECKING([which clucene to use])
8569 if test "$with_system_clucene" = "yes"; then
8570     AC_MSG_RESULT([external])
8571     SYSTEM_CLUCENE=TRUE
8572     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8573     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8574     FilterLibs "${CLUCENE_LIBS}"
8575     CLUCENE_LIBS="${filteredlibs}"
8576     AC_LANG_PUSH([C++])
8577     save_CXXFLAGS=$CXXFLAGS
8578     save_CPPFLAGS=$CPPFLAGS
8579     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8580     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8581     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8582     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8583     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8584                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8585     CXXFLAGS=$save_CXXFLAGS
8586     CPPFLAGS=$save_CPPFLAGS
8587     AC_LANG_POP([C++])
8589     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8590 else
8591     AC_MSG_RESULT([internal])
8592     SYSTEM_CLUCENE=
8593     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8595 AC_SUBST(SYSTEM_CLUCENE)
8596 AC_SUBST(CLUCENE_CFLAGS)
8597 AC_SUBST(CLUCENE_LIBS)
8599 dnl ===================================================================
8600 dnl Check for system expat
8601 dnl ===================================================================
8602 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8604 dnl ===================================================================
8605 dnl Check for system xmlsec
8606 dnl ===================================================================
8607 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8609 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8610 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8611     ENABLE_EOT="TRUE"
8612     AC_DEFINE([ENABLE_EOT])
8613     AC_MSG_RESULT([yes])
8615     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8616 else
8617     ENABLE_EOT=
8618     AC_MSG_RESULT([no])
8620 AC_SUBST([ENABLE_EOT])
8622 dnl ===================================================================
8623 dnl Check for DLP libs
8624 dnl ===================================================================
8625 AS_IF([test "$COM" = "MSC"],
8626       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8627       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8629 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8631 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8633 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8635 AS_IF([test "$COM" = "MSC"],
8636       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8637       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8639 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8641 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8643 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8644 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.11])
8646 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8648 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8650 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8652 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8653 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.16])
8655 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8656 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8658 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8660 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8661 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8663 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8665 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8667 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8669 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8671 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8672 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
8674 dnl ===================================================================
8675 dnl Check for system lcms2
8676 dnl ===================================================================
8677 if test "$with_system_lcms2" != "yes"; then
8678     SYSTEM_LCMS2=
8680 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8681 if test "$GCC" = "yes"; then
8682     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8684 if test "$COM" = "MSC"; then # override the above
8685     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8688 dnl ===================================================================
8689 dnl Check for system cppunit
8690 dnl ===================================================================
8691 if test "$_os" != "Android" ; then
8692     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8695 dnl ===================================================================
8696 dnl Check whether freetype is available
8697 dnl ===================================================================
8698 if test  "$test_freetype" = "yes"; then
8699     AC_MSG_CHECKING([whether freetype is available])
8700     # FreeType has 3 different kinds of versions
8701     # * release, like 2.4.10
8702     # * libtool, like 13.0.7 (this what pkg-config returns)
8703     # * soname
8704     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8705     #
8706     # 9.9.3 is 2.2.0
8707     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8708     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8709     FilterLibs "${FREETYPE_LIBS}"
8710     FREETYPE_LIBS="${filteredlibs}"
8711     SYSTEM_FREETYPE=TRUE
8712 else
8713     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8714     if test "x$ac_config_site_64bit_host" = xYES; then
8715         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8716     else
8717         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8718     fi
8720 AC_SUBST(FREETYPE_CFLAGS)
8721 AC_SUBST(FREETYPE_LIBS)
8722 AC_SUBST([SYSTEM_FREETYPE])
8724 # ===================================================================
8725 # Check for system libxslt
8726 # to prevent incompatibilities between internal libxml2 and external libxslt,
8727 # or vice versa, use with_system_libxml here
8728 # ===================================================================
8729 if test "$with_system_libxml" = "auto"; then
8730     case "$_os" in
8731     WINNT|iOS|Android)
8732         with_system_libxml="$with_system_libs"
8733         ;;
8734     *)
8735         if test "$enable_fuzzers" != "yes"; then
8736             with_system_libxml=yes
8737         else
8738             with_system_libxml=no
8739         fi
8740         ;;
8741     esac
8744 AC_MSG_CHECKING([which libxslt to use])
8745 if test "$with_system_libxml" = "yes"; then
8746     AC_MSG_RESULT([external])
8747     SYSTEM_LIBXSLT=TRUE
8748     if test "$_os" = "Darwin"; then
8749         dnl make sure to use SDK path
8750         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8751         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8752         dnl omit -L/usr/lib
8753         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8754         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8755     else
8756         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8757         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8758         FilterLibs "${LIBXSLT_LIBS}"
8759         LIBXSLT_LIBS="${filteredlibs}"
8760         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8761         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8762         FilterLibs "${LIBEXSLT_LIBS}"
8763         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8764     fi
8766     dnl Check for xsltproc
8767     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8768     if test "$XSLTPROC" = "no"; then
8769         AC_MSG_ERROR([xsltproc is required])
8770     fi
8771 else
8772     AC_MSG_RESULT([internal])
8773     SYSTEM_LIBXSLT=
8774     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8776     if test "$cross_compiling" = "yes"; then
8777         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8778         if test "$XSLTPROC" = "no"; then
8779             AC_MSG_ERROR([xsltproc is required])
8780         fi
8781     fi
8783 AC_SUBST(SYSTEM_LIBXSLT)
8784 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8785     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8787 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8789 AC_SUBST(LIBEXSLT_CFLAGS)
8790 AC_SUBST(LIBEXSLT_LIBS)
8791 AC_SUBST(LIBXSLT_CFLAGS)
8792 AC_SUBST(LIBXSLT_LIBS)
8793 AC_SUBST(XSLTPROC)
8795 # ===================================================================
8796 # Check for system libxml
8797 # ===================================================================
8798 AC_MSG_CHECKING([which libxml to use])
8799 if test "$with_system_libxml" = "yes"; then
8800     AC_MSG_RESULT([external])
8801     SYSTEM_LIBXML=TRUE
8802     if test "$_os" = "Darwin"; then
8803         dnl make sure to use SDK path
8804         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8805         dnl omit -L/usr/lib
8806         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8807     elif test $_os = iOS; then
8808         dnl make sure to use SDK path
8809         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8810         LIBXML_CFLAGS="-I$usr/include/libxml2"
8811         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8812     else
8813         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8814         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8815         FilterLibs "${LIBXML_LIBS}"
8816         LIBXML_LIBS="${filteredlibs}"
8817     fi
8819     dnl Check for xmllint
8820     AC_PATH_PROG(XMLLINT, xmllint, no)
8821     if test "$XMLLINT" = "no"; then
8822         AC_MSG_ERROR([xmllint is required])
8823     fi
8824 else
8825     AC_MSG_RESULT([internal])
8826     SYSTEM_LIBXML=
8827     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8828     if test "$COM" = "MSC"; then
8829         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8830     fi
8831     if test "$COM" = "MSC"; then
8832         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8833     else
8834         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8835     fi
8836     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8838 AC_SUBST(SYSTEM_LIBXML)
8839 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8840     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8842 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8843 AC_SUBST(LIBXML_CFLAGS)
8844 AC_SUBST(LIBXML_LIBS)
8845 AC_SUBST(XMLLINT)
8847 # =====================================================================
8848 # Checking for a Python interpreter with version >= 3.3.
8849 # Optionally user can pass an option to configure, i. e.
8850 # ./configure PYTHON=/usr/bin/python
8851 # =====================================================================
8852 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
8853     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
8854     enable_python=internal
8856 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8857     if test -n "$PYTHON"; then
8858         PYTHON_FOR_BUILD=$PYTHON
8859     else
8860         # This allows a lack of system python with no error, we use internal one in that case.
8861         AM_PATH_PYTHON([3.3],, [:])
8862         # Clean PYTHON_VERSION checked below if cross-compiling
8863         PYTHON_VERSION=""
8864         if test "$PYTHON" != ":"; then
8865             PYTHON_FOR_BUILD=$PYTHON
8866         fi
8867     fi
8869 AC_SUBST(PYTHON_FOR_BUILD)
8871 # Checks for Python to use for Pyuno
8872 AC_MSG_CHECKING([which Python to use for Pyuno])
8873 case "$enable_python" in
8874 no|disable)
8875     if test -z $PYTHON_FOR_BUILD; then
8876         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8877         # requirement from the choice whether to include Python stuff in the installer, but why
8878         # bother?
8879         AC_MSG_ERROR([Python is required at build time.])
8880     fi
8881     enable_python=no
8882     AC_MSG_RESULT([none])
8883     ;;
8884 ""|yes|auto)
8885     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8886         AC_MSG_RESULT([no, overridden by --disable-scripting])
8887         enable_python=no
8888     elif test $build_os = cygwin; then
8889         dnl When building on Windows we don't attempt to use any installed
8890         dnl "system"  Python.
8891         AC_MSG_RESULT([fully internal])
8892         enable_python=internal
8893     elif test "$cross_compiling" = yes; then
8894         AC_MSG_RESULT([system])
8895         enable_python=system
8896     else
8897         # Unset variables set by the above AM_PATH_PYTHON so that
8898         # we actually do check anew.
8899         AC_MSG_RESULT([])
8900         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
8901         AM_PATH_PYTHON([3.3],, [:])
8902         AC_MSG_CHECKING([which Python to use for Pyuno])
8903         if test "$PYTHON" = ":"; then
8904             if test -z "$PYTHON_FOR_BUILD"; then
8905                 AC_MSG_RESULT([fully internal])
8906             else
8907                 AC_MSG_RESULT([internal])
8908             fi
8909             enable_python=internal
8910         else
8911             AC_MSG_RESULT([system])
8912             enable_python=system
8913         fi
8914     fi
8915     ;;
8916 internal)
8917     AC_MSG_RESULT([internal])
8918     ;;
8919 fully-internal)
8920     AC_MSG_RESULT([fully internal])
8921     enable_python=internal
8922     ;;
8923 system)
8924     AC_MSG_RESULT([system])
8925     if test "$_os" = Darwin; then
8926         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
8927     fi
8928     ;;
8930     AC_MSG_ERROR([Incorrect --enable-python option])
8931     ;;
8932 esac
8934 if test $enable_python != no; then
8935     BUILD_TYPE="$BUILD_TYPE PYUNO"
8938 if test $enable_python = system; then
8939     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8940         # Fallback: Accept these in the environment, or as set above
8941         # for MacOSX.
8942         :
8943     elif test "$cross_compiling" != yes; then
8944         # Unset variables set by the above AM_PATH_PYTHON so that
8945         # we actually do check anew.
8946         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
8947         # This causes an error if no python command is found
8948         AM_PATH_PYTHON([3.3])
8949         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8950         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8951         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8952         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8953         if test -z "$PKG_CONFIG"; then
8954             PYTHON_CFLAGS="-I$python_include"
8955             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8956         elif $PKG_CONFIG --exists python-$python_version-embed; then
8957             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8958             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8959         elif $PKG_CONFIG --exists python-$python_version; then
8960             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8961             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8962         else
8963             PYTHON_CFLAGS="-I$python_include"
8964             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8965         fi
8966         FilterLibs "${PYTHON_LIBS}"
8967         PYTHON_LIBS="${filteredlibs}"
8968     else
8969         dnl How to find out the cross-compilation Python installation path?
8970         AC_MSG_CHECKING([for python version])
8971         AS_IF([test -n "$PYTHON_VERSION"],
8972               [AC_MSG_RESULT([$PYTHON_VERSION])],
8973               [AC_MSG_RESULT([not found])
8974                AC_MSG_ERROR([no usable python found])])
8975         test -n "$PYTHON_CFLAGS" && break
8976     fi
8978     dnl Check if the headers really work
8979     save_CPPFLAGS="$CPPFLAGS"
8980     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8981     AC_CHECK_HEADER(Python.h)
8982     CPPFLAGS="$save_CPPFLAGS"
8984     # let the PYTHON_FOR_BUILD match the same python installation that
8985     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8986     # better for PythonTests.
8987     PYTHON_FOR_BUILD=$PYTHON
8990 if test "$with_lxml" != no; then
8991     if test -z "$PYTHON_FOR_BUILD"; then
8992         case $build_os in
8993             cygwin)
8994                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8995                 ;;
8996             *)
8997                 if test "$cross_compiling" != yes ; then
8998                     BUILD_TYPE="$BUILD_TYPE LXML"
8999                 fi
9000                 ;;
9001         esac
9002     else
9003         AC_MSG_CHECKING([for python lxml])
9004         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9005             AC_MSG_RESULT([yes])
9006         else
9007             case $build_os in
9008                 cygwin)
9009                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9010                     ;;
9011                 *)
9012                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9013                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9014                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9015                         else
9016                             BUILD_TYPE="$BUILD_TYPE LXML"
9017                             AC_MSG_RESULT([no, using internal lxml])
9018                         fi
9019                     else
9020                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9021                     fi
9022                     ;;
9023             esac
9024         fi
9025     fi
9028 dnl By now enable_python should be "system", "internal" or "no"
9029 case $enable_python in
9030 system)
9031     SYSTEM_PYTHON=TRUE
9033     if test "x$ac_cv_header_Python_h" != "xyes"; then
9034        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9035     fi
9037     AC_LANG_PUSH(C)
9038     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9039     AC_MSG_CHECKING([for correct python library version])
9040        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9041 #include <Python.h>
9043 int main(int argc, char **argv) {
9044    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9045    else return 1;
9047        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9048     CFLAGS=$save_CFLAGS
9049     AC_LANG_POP(C)
9051     dnl FIXME Check if the Python library can be linked with, too?
9052     ;;
9054 internal)
9055     SYSTEM_PYTHON=
9056     PYTHON_VERSION_MAJOR=3
9057     PYTHON_VERSION_MINOR=8
9058     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
9059     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9060         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9061     fi
9062     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9063     BUILD_TYPE="$BUILD_TYPE PYTHON"
9064     if test "$OS" = LINUX -o "$OS" = WNT ; then
9065         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9066     fi
9067     # Embedded Python dies without Home set
9068     if test "$HOME" = ""; then
9069         export HOME=""
9070     fi
9071     ;;
9073     DISABLE_PYTHON=TRUE
9074     SYSTEM_PYTHON=
9075     ;;
9077     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9078     ;;
9079 esac
9081 AC_SUBST(DISABLE_PYTHON)
9082 AC_SUBST(SYSTEM_PYTHON)
9083 AC_SUBST(PYTHON_CFLAGS)
9084 AC_SUBST(PYTHON_LIBS)
9085 AC_SUBST(PYTHON_VERSION)
9086 AC_SUBST(PYTHON_VERSION_MAJOR)
9087 AC_SUBST(PYTHON_VERSION_MINOR)
9089 ENABLE_MARIADBC=TRUE
9090 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
9091     ENABLE_MARIADBC=
9093 MARIADBC_MAJOR=1
9094 MARIADBC_MINOR=0
9095 MARIADBC_MICRO=2
9096 if test "$ENABLE_MARIADBC" = "TRUE"; then
9097     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9100 AC_SUBST(ENABLE_MARIADBC)
9101 AC_SUBST(MARIADBC_MAJOR)
9102 AC_SUBST(MARIADBC_MINOR)
9103 AC_SUBST(MARIADBC_MICRO)
9105 if test "$ENABLE_MARIADBC" = "TRUE"; then
9106     dnl ===================================================================
9107     dnl Check for system MariaDB
9108     dnl ===================================================================
9109     AC_MSG_CHECKING([which MariaDB to use])
9110     if test "$with_system_mariadb" = "yes"; then
9111         AC_MSG_RESULT([external])
9112         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9113         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9114         if test -z "$MARIADBCONFIG"; then
9115             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9116             if test -z "$MARIADBCONFIG"; then
9117                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9118                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9119             fi
9120         fi
9121         AC_MSG_CHECKING([MariaDB version])
9122         MARIADB_VERSION=`$MARIADBCONFIG --version`
9123         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9124         if test "$MARIADB_MAJOR" -ge "5"; then
9125             AC_MSG_RESULT([OK])
9126         else
9127             AC_MSG_ERROR([too old, use 5.0.x or later])
9128         fi
9129         AC_MSG_CHECKING([for MariaDB Client library])
9130         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9131         if test "$COM_IS_CLANG" = TRUE; then
9132             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9133         fi
9134         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9135         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9136         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9137         dnl linux32:
9138         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9139             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9140             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9141                 | sed -e 's|/lib64/|/lib/|')
9142         fi
9143         FilterLibs "${MARIADB_LIBS}"
9144         MARIADB_LIBS="${filteredlibs}"
9145         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9146         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9147         if test "$enable_bundle_mariadb" = "yes"; then
9148             AC_MSG_RESULT([yes])
9149             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9150             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9152 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9154 /g' | grep -E '(mysqlclient|mariadb)')
9155             if test "$_os" = "Darwin"; then
9156                 LIBMARIADB=${LIBMARIADB}.dylib
9157             elif test "$_os" = "WINNT"; then
9158                 LIBMARIADB=${LIBMARIADB}.dll
9159             else
9160                 LIBMARIADB=${LIBMARIADB}.so
9161             fi
9162             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9163             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9164             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9165                 AC_MSG_RESULT([found.])
9166                 PathFormat "$LIBMARIADB_PATH"
9167                 LIBMARIADB_PATH="$formatted_path"
9168             else
9169                 AC_MSG_ERROR([not found.])
9170             fi
9171         else
9172             AC_MSG_RESULT([no])
9173             BUNDLE_MARIADB_CONNECTOR_C=
9174         fi
9175     else
9176         AC_MSG_RESULT([internal])
9177         SYSTEM_MARIADB_CONNECTOR_C=
9178         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9179         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9180         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9181     fi
9183     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9184     AC_SUBST(MARIADB_CFLAGS)
9185     AC_SUBST(MARIADB_LIBS)
9186     AC_SUBST(LIBMARIADB)
9187     AC_SUBST(LIBMARIADB_PATH)
9188     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9191 dnl ===================================================================
9192 dnl Check for system hsqldb
9193 dnl ===================================================================
9194 if test "$with_java" != "no"; then
9195     HSQLDB_USE_JDBC_4_1=
9196     AC_MSG_CHECKING([which hsqldb to use])
9197     if test "$with_system_hsqldb" = "yes"; then
9198         AC_MSG_RESULT([external])
9199         SYSTEM_HSQLDB=TRUE
9200         if test -z $HSQLDB_JAR; then
9201             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9202         fi
9203         if ! test -f $HSQLDB_JAR; then
9204                AC_MSG_ERROR(hsqldb.jar not found.)
9205         fi
9206         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9207         export HSQLDB_JAR
9208         if $PERL -e \
9209            'use Archive::Zip;
9210             my $file = "$ENV{'HSQLDB_JAR'}";
9211             my $zip = Archive::Zip->new( $file );
9212             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9213             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9214             {
9215                 push @l, split(/\n/, $mf);
9216                 foreach my $line (@l)
9217                 {
9218                     if ($line =~ m/Specification-Version:/)
9219                     {
9220                         ($t, $version) = split (/:/,$line);
9221                         $version =~ s/^\s//;
9222                         ($a, $b, $c, $d) = split (/\./,$version);
9223                         if ($c == "0" && $d > "8")
9224                         {
9225                             exit 0;
9226                         }
9227                         else
9228                         {
9229                             exit 1;
9230                         }
9231                     }
9232                 }
9233             }
9234             else
9235             {
9236                 exit 1;
9237             }'; then
9238             AC_MSG_RESULT([yes])
9239         else
9240             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9241         fi
9242     else
9243         AC_MSG_RESULT([internal])
9244         SYSTEM_HSQLDB=
9245         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9246         NEED_ANT=TRUE
9247         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9248         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9249         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9250             AC_MSG_RESULT([yes])
9251             HSQLDB_USE_JDBC_4_1=TRUE
9252         else
9253             AC_MSG_RESULT([no])
9254         fi
9255     fi
9256     AC_SUBST(SYSTEM_HSQLDB)
9257     AC_SUBST(HSQLDB_JAR)
9258     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9261 dnl ===================================================================
9262 dnl Check for PostgreSQL stuff
9263 dnl ===================================================================
9264 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9265 if test "x$enable_postgresql_sdbc" != "xno"; then
9266     AC_MSG_RESULT([yes])
9267     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9269     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9270         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9271     fi
9272     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9273         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9274     fi
9276     postgres_interface=""
9277     if test "$with_system_postgresql" = "yes"; then
9278         postgres_interface="external PostgreSQL"
9279         SYSTEM_POSTGRESQL=TRUE
9280         if test "$_os" = Darwin; then
9281             supp_path=''
9282             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9283                 pg_supp_path="$P_SEP$d$pg_supp_path"
9284             done
9285         fi
9286         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9287         if test -n "$PGCONFIG"; then
9288             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9289             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9290         else
9291             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9292               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9293               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9294             ],[
9295               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9296             ])
9297         fi
9298         FilterLibs "${POSTGRESQL_LIB}"
9299         POSTGRESQL_LIB="${filteredlibs}"
9300     else
9301         # if/when anything else than PostgreSQL uses Kerberos,
9302         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9303         WITH_KRB5=
9304         WITH_GSSAPI=
9305         case "$_os" in
9306         Darwin)
9307             # macOS has system MIT Kerberos 5 since 10.4
9308             if test "$with_krb5" != "no"; then
9309                 WITH_KRB5=TRUE
9310                 save_LIBS=$LIBS
9311                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9312                 # that the libraries where these functions are located on macOS will change, is it?
9313                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9314                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9315                 KRB5_LIBS=$LIBS
9316                 LIBS=$save_LIBS
9317                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9318                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9319                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9320                 LIBS=$save_LIBS
9321             fi
9322             if test "$with_gssapi" != "no"; then
9323                 WITH_GSSAPI=TRUE
9324                 save_LIBS=$LIBS
9325                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9326                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9327                 GSSAPI_LIBS=$LIBS
9328                 LIBS=$save_LIBS
9329             fi
9330             ;;
9331         WINNT)
9332             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9333                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9334             fi
9335             ;;
9336         Linux|GNU|*BSD|DragonFly)
9337             if test "$with_krb5" != "no"; then
9338                 WITH_KRB5=TRUE
9339                 save_LIBS=$LIBS
9340                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9341                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9342                 KRB5_LIBS=$LIBS
9343                 LIBS=$save_LIBS
9344                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9345                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9346                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9347                 LIBS=$save_LIBS
9348             fi
9349             if test "$with_gssapi" != "no"; then
9350                 WITH_GSSAPI=TRUE
9351                 save_LIBS=$LIBS
9352                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9353                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9354                 GSSAPI_LIBS=$LIBS
9355                 LIBS=$save_LIBS
9356             fi
9357             ;;
9358         *)
9359             if test "$with_krb5" = "yes"; then
9360                 WITH_KRB5=TRUE
9361                 save_LIBS=$LIBS
9362                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9363                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9364                 KRB5_LIBS=$LIBS
9365                 LIBS=$save_LIBS
9366                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9367                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9368                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9369                 LIBS=$save_LIBS
9370             fi
9371             if test "$with_gssapi" = "yes"; then
9372                 WITH_GSSAPI=TRUE
9373                 save_LIBS=$LIBS
9374                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9375                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9376                 LIBS=$save_LIBS
9377                 GSSAPI_LIBS=$LIBS
9378             fi
9379         esac
9381         if test -n "$with_libpq_path"; then
9382             SYSTEM_POSTGRESQL=TRUE
9383             postgres_interface="external libpq"
9384             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9385             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9386         else
9387             SYSTEM_POSTGRESQL=
9388             postgres_interface="internal"
9389             POSTGRESQL_LIB=""
9390             POSTGRESQL_INC="%OVERRIDE_ME%"
9391             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9392         fi
9393     fi
9395     AC_MSG_CHECKING([PostgreSQL C interface])
9396     AC_MSG_RESULT([$postgres_interface])
9398     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9399         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9400         save_CFLAGS=$CFLAGS
9401         save_CPPFLAGS=$CPPFLAGS
9402         save_LIBS=$LIBS
9403         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9404         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9405         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9406         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9407             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9408         CFLAGS=$save_CFLAGS
9409         CPPFLAGS=$save_CPPFLAGS
9410         LIBS=$save_LIBS
9411     fi
9412     BUILD_POSTGRESQL_SDBC=TRUE
9413 else
9414     AC_MSG_RESULT([no])
9416 AC_SUBST(WITH_KRB5)
9417 AC_SUBST(WITH_GSSAPI)
9418 AC_SUBST(GSSAPI_LIBS)
9419 AC_SUBST(KRB5_LIBS)
9420 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9421 AC_SUBST(SYSTEM_POSTGRESQL)
9422 AC_SUBST(POSTGRESQL_INC)
9423 AC_SUBST(POSTGRESQL_LIB)
9425 dnl ===================================================================
9426 dnl Check for Firebird stuff
9427 dnl ===================================================================
9428 ENABLE_FIREBIRD_SDBC=
9429 if test "$enable_firebird_sdbc" = "yes" ; then
9430     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9432     dnl ===================================================================
9433     dnl Check for system Firebird
9434     dnl ===================================================================
9435     AC_MSG_CHECKING([which Firebird to use])
9436     if test "$with_system_firebird" = "yes"; then
9437         AC_MSG_RESULT([external])
9438         SYSTEM_FIREBIRD=TRUE
9439         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9440         if test -z "$FIREBIRDCONFIG"; then
9441             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9442             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9443                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9444             ])
9445             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9446         else
9447             AC_MSG_NOTICE([fb_config found])
9448             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9449             AC_MSG_CHECKING([for Firebird Client library])
9450             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9451             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9452             FilterLibs "${FIREBIRD_LIBS}"
9453             FIREBIRD_LIBS="${filteredlibs}"
9454         fi
9455         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9456         AC_MSG_CHECKING([Firebird version])
9457         if test -n "${FIREBIRD_VERSION}"; then
9458             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9459             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9460             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9461                 AC_MSG_RESULT([OK])
9462             else
9463                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9464             fi
9465         else
9466             __save_CFLAGS="${CFLAGS}"
9467             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9468             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9469 #if defined(FB_API_VER) && FB_API_VER == 30
9470 int fb_api_is_30(void) { return 0; }
9471 #else
9472 #error "Wrong Firebird API version"
9473 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9474             CFLAGS="${__save_CFLAGS}"
9475         fi
9476         ENABLE_FIREBIRD_SDBC=TRUE
9477         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9478     elif test "$enable_database_connectivity" != yes; then
9479         AC_MSG_RESULT([none])
9480     elif test "$cross_compiling" = "yes"; then
9481         AC_MSG_RESULT([none])
9482     else
9483         dnl Embedded Firebird has version 3.0
9484         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9485         dnl We need libatomic_ops for any non X86/X64 system
9486         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9487             dnl ===================================================================
9488             dnl Check for system libatomic_ops
9489             dnl ===================================================================
9490             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9491             if test "$with_system_libatomic_ops" = "yes"; then
9492                 SYSTEM_LIBATOMIC_OPS=TRUE
9493                 AC_CHECK_HEADERS(atomic_ops.h, [],
9494                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9495             else
9496                 SYSTEM_LIBATOMIC_OPS=
9497                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9498                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9499                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9500             fi
9501         fi
9503         AC_MSG_RESULT([internal])
9504         SYSTEM_FIREBIRD=
9505         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9506         FIREBIRD_LIBS="-lfbclient"
9508         if test "$with_system_libtommath" = "yes"; then
9509             SYSTEM_LIBTOMMATH=TRUE
9510             dnl check for tommath presence
9511             save_LIBS=$LIBS
9512             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9513             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9514             LIBS=$save_LIBS
9515         else
9516             SYSTEM_LIBTOMMATH=
9517             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9518             LIBTOMMATH_LIBS="-ltommath"
9519             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9520         fi
9522         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9523         ENABLE_FIREBIRD_SDBC=TRUE
9524         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9525     fi
9527 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9528 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9529 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9530 AC_SUBST(LIBATOMIC_OPS_LIBS)
9531 AC_SUBST(SYSTEM_FIREBIRD)
9532 AC_SUBST(FIREBIRD_CFLAGS)
9533 AC_SUBST(FIREBIRD_LIBS)
9534 AC_SUBST([TOMMATH_CFLAGS])
9535 AC_SUBST([TOMMATH_LIBS])
9537 dnl ===================================================================
9538 dnl Check for system curl
9539 dnl ===================================================================
9540 AC_MSG_CHECKING([which libcurl to use])
9541 if test "$with_system_curl" = "auto"; then
9542     with_system_curl="$with_system_libs"
9545 if test "$with_system_curl" = "yes"; then
9546     AC_MSG_RESULT([external])
9547     SYSTEM_CURL=TRUE
9549     # First try PKGCONFIG and then fall back
9550     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9552     if test -n "$CURL_PKG_ERRORS"; then
9553         AC_PATH_PROG(CURLCONFIG, curl-config)
9554         if test -z "$CURLCONFIG"; then
9555             AC_MSG_ERROR([curl development files not found])
9556         fi
9557         CURL_LIBS=`$CURLCONFIG --libs`
9558         FilterLibs "${CURL_LIBS}"
9559         CURL_LIBS="${filteredlibs}"
9560         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9561         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9563         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9564         case $curl_version in
9565         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9566         dnl so they need to be doubled to end up in the configure script
9567         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9568             AC_MSG_RESULT([yes])
9569             ;;
9570         *)
9571             AC_MSG_ERROR([no, you have $curl_version])
9572             ;;
9573         esac
9574     fi
9576     ENABLE_CURL=TRUE
9577 elif test $_os = iOS; then
9578     # Let's see if we need curl, I think not?
9579     AC_MSG_RESULT([none])
9580     ENABLE_CURL=
9581 else
9582     AC_MSG_RESULT([internal])
9583     SYSTEM_CURL=
9584     BUILD_TYPE="$BUILD_TYPE CURL"
9585     ENABLE_CURL=TRUE
9587 AC_SUBST(SYSTEM_CURL)
9588 AC_SUBST(CURL_CFLAGS)
9589 AC_SUBST(CURL_LIBS)
9590 AC_SUBST(ENABLE_CURL)
9592 dnl ===================================================================
9593 dnl Check for system boost
9594 dnl ===================================================================
9595 AC_MSG_CHECKING([which boost to use])
9596 if test "$with_system_boost" = "yes"; then
9597     AC_MSG_RESULT([external])
9598     SYSTEM_BOOST=TRUE
9599     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
9600     AX_BOOST_DATE_TIME
9601     AX_BOOST_FILESYSTEM
9602     AX_BOOST_IOSTREAMS
9603     AX_BOOST_LOCALE
9604     AC_LANG_PUSH([C++])
9605     save_CXXFLAGS=$CXXFLAGS
9606     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9607     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9608        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9609     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9610        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9611     CXXFLAGS=$save_CXXFLAGS
9612     AC_LANG_POP([C++])
9613     # this is in m4/ax_boost_base.m4
9614     FilterLibs "${BOOST_LDFLAGS}"
9615     BOOST_LDFLAGS="${filteredlibs}"
9616 else
9617     AC_MSG_RESULT([internal])
9618     BUILD_TYPE="$BUILD_TYPE BOOST"
9619     SYSTEM_BOOST=
9620     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9621         # use warning-suppressing wrapper headers
9622         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9623     else
9624         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9625     fi
9627 AC_SUBST(SYSTEM_BOOST)
9629 dnl ===================================================================
9630 dnl Check for system mdds
9631 dnl ===================================================================
9632 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9634 dnl ===================================================================
9635 dnl Check for system glm
9636 dnl ===================================================================
9637 AC_MSG_CHECKING([which glm to use])
9638 if test "$with_system_glm" = "yes"; then
9639     AC_MSG_RESULT([external])
9640     SYSTEM_GLM=TRUE
9641     AC_LANG_PUSH([C++])
9642     AC_CHECK_HEADER([glm/glm.hpp], [],
9643        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9644     AC_LANG_POP([C++])
9645 else
9646     AC_MSG_RESULT([internal])
9647     BUILD_TYPE="$BUILD_TYPE GLM"
9648     SYSTEM_GLM=
9649     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9651 AC_SUBST([GLM_CFLAGS])
9652 AC_SUBST([SYSTEM_GLM])
9654 dnl ===================================================================
9655 dnl Check for system odbc
9656 dnl ===================================================================
9657 AC_MSG_CHECKING([which odbc headers to use])
9658 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
9659     AC_MSG_RESULT([external])
9660     SYSTEM_ODBC_HEADERS=TRUE
9662     if test "$build_os" = "cygwin"; then
9663         save_CPPFLAGS=$CPPFLAGS
9664         find_winsdk
9665         PathFormat "$winsdktest"
9666         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"
9667         AC_CHECK_HEADER(sqlext.h, [],
9668             [AC_MSG_ERROR(odbc not found. install odbc)],
9669             [#include <windows.h>])
9670         CPPFLAGS=$save_CPPFLAGS
9671     else
9672         AC_CHECK_HEADER(sqlext.h, [],
9673             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9674     fi
9675 elif test "$enable_database_connectivity" != yes; then
9676     AC_MSG_RESULT([none])
9677 else
9678     AC_MSG_RESULT([internal])
9679     SYSTEM_ODBC_HEADERS=
9681 AC_SUBST(SYSTEM_ODBC_HEADERS)
9683 dnl ===================================================================
9684 dnl Enable LDAP support
9685 dnl ===================================================================
9687 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9688 AC_MSG_CHECKING([whether to enable LDAP support])
9689     if test "$enable_ldap" != "yes"; then
9690         AC_MSG_RESULT([no])
9691         ENABLE_LDAP=""
9692         enable_ldap=no
9693     else
9694         AC_MSG_RESULT([yes])
9695         ENABLE_LDAP="TRUE"
9696     fi
9698 AC_SUBST(ENABLE_LDAP)
9700 dnl ===================================================================
9701 dnl Check for system openldap
9702 dnl ===================================================================
9704 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9705 AC_MSG_CHECKING([which openldap library to use])
9706 if test "$with_system_openldap" = "yes"; then
9707     AC_MSG_RESULT([external])
9708     SYSTEM_OPENLDAP=TRUE
9709     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9710     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9711     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9712 else
9713     AC_MSG_RESULT([internal])
9714     SYSTEM_OPENLDAP=
9715     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9718 AC_SUBST(SYSTEM_OPENLDAP)
9720 dnl ===================================================================
9721 dnl Check for system NSS
9722 dnl ===================================================================
9723 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9724     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9725     AC_DEFINE(HAVE_FEATURE_NSS)
9726     ENABLE_NSS="TRUE"
9727     AC_DEFINE(ENABLE_NSS)
9728 elif test $_os != iOS ; then
9729     with_tls=openssl
9731 AC_SUBST(ENABLE_NSS)
9733 dnl ===================================================================
9734 dnl Check for TLS/SSL and cryptographic implementation to use
9735 dnl ===================================================================
9736 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9737 if test -n "$with_tls"; then
9738     case $with_tls in
9739     openssl)
9740         AC_DEFINE(USE_TLS_OPENSSL)
9741         TLS=OPENSSL
9742         AC_MSG_RESULT([$TLS])
9744         if test "$enable_openssl" != "yes"; then
9745             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9746         fi
9748         # warn that OpenSSL has been selected but not all TLS code has this option
9749         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9750         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9751         ;;
9752     nss)
9753         AC_DEFINE(USE_TLS_NSS)
9754         TLS=NSS
9755         AC_MSG_RESULT([$TLS])
9756         ;;
9757     no)
9758         AC_MSG_RESULT([none])
9759         AC_MSG_WARN([Skipping TLS/SSL])
9760         ;;
9761     *)
9762         AC_MSG_RESULT([])
9763         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9764 openssl - OpenSSL
9765 nss - Mozilla's Network Security Services (NSS)
9766     ])
9767         ;;
9768     esac
9769 else
9770     # default to using NSS, it results in smaller oox lib
9771     AC_DEFINE(USE_TLS_NSS)
9772     TLS=NSS
9773     AC_MSG_RESULT([$TLS])
9775 AC_SUBST(TLS)
9777 dnl ===================================================================
9778 dnl Check for system sane
9779 dnl ===================================================================
9780 AC_MSG_CHECKING([which sane header to use])
9781 if test "$with_system_sane" = "yes"; then
9782     AC_MSG_RESULT([external])
9783     AC_CHECK_HEADER(sane/sane.h, [],
9784       [AC_MSG_ERROR(sane not found. install sane)], [])
9785 else
9786     AC_MSG_RESULT([internal])
9787     BUILD_TYPE="$BUILD_TYPE SANE"
9790 dnl ===================================================================
9791 dnl Check for system icu
9792 dnl ===================================================================
9793 SYSTEM_GENBRK=
9794 SYSTEM_GENCCODE=
9795 SYSTEM_GENCMN=
9797 ICU_MAJOR=67
9798 ICU_MINOR=1
9799 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9800 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9801 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9802 AC_MSG_CHECKING([which icu to use])
9803 if test "$with_system_icu" = "yes"; then
9804     AC_MSG_RESULT([external])
9805     SYSTEM_ICU=TRUE
9806     AC_LANG_PUSH([C++])
9807     AC_MSG_CHECKING([for unicode/rbbi.h])
9808     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9809     AC_LANG_POP([C++])
9811     if test "$cross_compiling" != "yes"; then
9812         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9813         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9814         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9815         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9816     fi
9818     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9819         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9820         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9821         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9822         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9823         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9824             AC_MSG_RESULT([yes])
9825         else
9826             AC_MSG_RESULT([no])
9827             if test "$with_system_icu_for_build" != "force"; then
9828                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9829 You can use --with-system-icu-for-build=force to use it anyway.])
9830             fi
9831         fi
9832     fi
9834     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9835         # using the system icu tools can lead to version confusion, use the
9836         # ones from the build environment when cross-compiling
9837         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9838         if test -z "$SYSTEM_GENBRK"; then
9839             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9840         fi
9841         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9842         if test -z "$SYSTEM_GENCCODE"; then
9843             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9844         fi
9845         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9846         if test -z "$SYSTEM_GENCMN"; then
9847             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9848         fi
9849         if test "$ICU_MAJOR" -ge "49"; then
9850             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9851             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9852             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9853         else
9854             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9855             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9856             ICU_RECLASSIFIED_HEBREW_LETTER=
9857         fi
9858     fi
9860     if test "$cross_compiling" = "yes"; then
9861         if test "$ICU_MAJOR" -ge "50"; then
9862             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9863             ICU_MINOR=""
9864         fi
9865     fi
9866 else
9867     AC_MSG_RESULT([internal])
9868     SYSTEM_ICU=
9869     BUILD_TYPE="$BUILD_TYPE ICU"
9870     # surprisingly set these only for "internal" (to be used by various other
9871     # external libs): the system icu-config is quite unhelpful and spits out
9872     # dozens of weird flags and also default path -I/usr/include
9873     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9874     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9876 if test "$ICU_MAJOR" -ge "59"; then
9877     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9878     # with -std=c++11 but not all external libraries can be built with that,
9879     # for those use a bit-compatible typedef uint16_t UChar; see
9880     # icu/source/common/unicode/umachine.h
9881     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9882 else
9883     ICU_UCHAR_TYPE=""
9885 AC_SUBST(SYSTEM_ICU)
9886 AC_SUBST(SYSTEM_GENBRK)
9887 AC_SUBST(SYSTEM_GENCCODE)
9888 AC_SUBST(SYSTEM_GENCMN)
9889 AC_SUBST(ICU_MAJOR)
9890 AC_SUBST(ICU_MINOR)
9891 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9892 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9893 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9894 AC_SUBST(ICU_CFLAGS)
9895 AC_SUBST(ICU_LIBS)
9896 AC_SUBST(ICU_UCHAR_TYPE)
9898 dnl ==================================================================
9899 dnl Breakpad
9900 dnl ==================================================================
9901 DEFAULT_CRASHDUMP_VALUE="true"
9902 AC_MSG_CHECKING([whether to enable breakpad])
9903 if test "$enable_breakpad" != yes; then
9904     AC_MSG_RESULT([no])
9905 else
9906     AC_MSG_RESULT([yes])
9907     ENABLE_BREAKPAD="TRUE"
9908     AC_DEFINE(ENABLE_BREAKPAD)
9909     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9910     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9912     AC_MSG_CHECKING([for disable crash dump])
9913     if test "$enable_crashdump" = no; then
9914         DEFAULT_CRASHDUMP_VALUE="false"
9915         AC_MSG_RESULT([yes])
9916     else
9917        AC_MSG_RESULT([no])
9918     fi
9920     AC_MSG_CHECKING([for crashreport config])
9921     if test "$with_symbol_config" = "no"; then
9922         BREAKPAD_SYMBOL_CONFIG="invalid"
9923         AC_MSG_RESULT([no])
9924     else
9925         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9926         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9927         AC_MSG_RESULT([yes])
9928     fi
9929     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9931 AC_SUBST(ENABLE_BREAKPAD)
9932 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9934 dnl ==================================================================
9935 dnl libfuzzer
9936 dnl ==================================================================
9937 AC_MSG_CHECKING([whether to enable fuzzers])
9938 if test "$enable_fuzzers" != yes; then
9939     AC_MSG_RESULT([no])
9940 else
9941     AC_MSG_RESULT([yes])
9942     ENABLE_FUZZERS="TRUE"
9943     AC_DEFINE([ENABLE_FUZZERS],1)
9944     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9946 AC_SUBST(ENABLE_FUZZERS)
9948 dnl ===================================================================
9949 dnl Orcus
9950 dnl ===================================================================
9951 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9952 if test "$with_system_orcus" != "yes"; then
9953     if test "$SYSTEM_BOOST" = "TRUE"; then
9954         # ===========================================================
9955         # Determine if we are going to need to link with Boost.System
9956         # ===========================================================
9957         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9958         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9959         dnl in documentation has no effect.
9960         AC_MSG_CHECKING([if we need to link with Boost.System])
9961         AC_LANG_PUSH([C++])
9962         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9963                 @%:@include <boost/version.hpp>
9964             ]],[[
9965                 #if BOOST_VERSION >= 105000
9966                 #   error yes, we need to link with Boost.System
9967                 #endif
9968             ]])],[
9969                 AC_MSG_RESULT([no])
9970             ],[
9971                 AC_MSG_RESULT([yes])
9972                 AX_BOOST_SYSTEM
9973         ])
9974         AC_LANG_POP([C++])
9975     fi
9977 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9978 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9979 AC_SUBST([BOOST_SYSTEM_LIB])
9980 AC_SUBST(SYSTEM_LIBORCUS)
9982 dnl ===================================================================
9983 dnl HarfBuzz
9984 dnl ===================================================================
9985 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9986                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9987                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9989 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9990                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9991                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9993 if test "$COM" = "MSC"; then # override the above
9994     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9995     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9998 if test "$with_system_harfbuzz" = "yes"; then
9999     if test "$with_system_graphite" = "no"; then
10000         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10001     fi
10002     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10003     _save_libs="$LIBS"
10004     _save_cflags="$CFLAGS"
10005     LIBS="$LIBS $HARFBUZZ_LIBS"
10006     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10007     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10008     LIBS="$_save_libs"
10009     CFLAGS="$_save_cflags"
10010 else
10011     if test "$with_system_graphite" = "yes"; then
10012         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10013     fi
10016 AC_MSG_CHECKING([whether to use X11])
10017 dnl ***************************************
10018 dnl testing for X libraries and includes...
10019 dnl ***************************************
10020 if test "$USING_X11" = TRUE; then
10021     AC_DEFINE(HAVE_FEATURE_X11)
10023 AC_MSG_RESULT([$USING_X11])
10025 if test "$USING_X11" = TRUE; then
10026     AC_PATH_X
10027     AC_PATH_XTRA
10028     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10030     if test -z "$x_includes"; then
10031         x_includes="default_x_includes"
10032     fi
10033     if test -z "$x_libraries"; then
10034         x_libraries="default_x_libraries"
10035     fi
10036     CFLAGS="$CFLAGS $X_CFLAGS"
10037     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10038     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10039 else
10040     x_includes="no_x_includes"
10041     x_libraries="no_x_libraries"
10044 if test "$USING_X11" = TRUE; then
10045     dnl ===================================================================
10046     dnl Check for extension headers
10047     dnl ===================================================================
10048     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10049      [#include <X11/extensions/shape.h>])
10051     # vcl needs ICE and SM
10052     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10053     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10054         [AC_MSG_ERROR(ICE library not found)])
10055     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10056     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10057         [AC_MSG_ERROR(SM library not found)])
10060 dnl ===================================================================
10061 dnl Check for system Xrender
10062 dnl ===================================================================
10063 AC_MSG_CHECKING([whether to use Xrender])
10064 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10065     AC_MSG_RESULT([yes])
10066     PKG_CHECK_MODULES(XRENDER, xrender)
10067     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10068     FilterLibs "${XRENDER_LIBS}"
10069     XRENDER_LIBS="${filteredlibs}"
10070     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10071       [AC_MSG_ERROR(libXrender not found or functional)], [])
10072     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10073       [AC_MSG_ERROR(Xrender not found. install X)], [])
10074 else
10075     AC_MSG_RESULT([no])
10077 AC_SUBST(XRENDER_CFLAGS)
10078 AC_SUBST(XRENDER_LIBS)
10080 dnl ===================================================================
10081 dnl Check for XRandr
10082 dnl ===================================================================
10083 AC_MSG_CHECKING([whether to enable RandR support])
10084 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10085     AC_MSG_RESULT([yes])
10086     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10087     if test "$ENABLE_RANDR" != "TRUE"; then
10088         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10089                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10090         XRANDR_CFLAGS=" "
10091         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10092           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10093         XRANDR_LIBS="-lXrandr "
10094         ENABLE_RANDR="TRUE"
10095     fi
10096     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10097     FilterLibs "${XRANDR_LIBS}"
10098     XRANDR_LIBS="${filteredlibs}"
10099 else
10100     ENABLE_RANDR=""
10101     AC_MSG_RESULT([no])
10103 AC_SUBST(XRANDR_CFLAGS)
10104 AC_SUBST(XRANDR_LIBS)
10105 AC_SUBST(ENABLE_RANDR)
10107 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10108     WITH_WEBDAV="serf"
10110 if test $_os = iOS -o $_os = Android; then
10111     WITH_WEBDAV="no"
10113 AC_MSG_CHECKING([for webdav library])
10114 case "$WITH_WEBDAV" in
10115 serf)
10116     AC_MSG_RESULT([serf])
10117     # Check for system apr-util
10118     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10119                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10120                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10121     if test "$COM" = "MSC"; then
10122         APR_LIB_DIR="LibR"
10123         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10124         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10125     fi
10127     # Check for system serf
10128     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
10129                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
10130     if test "$COM" = "MSC"; then
10131         SERF_LIB_DIR="Release"
10132         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
10133         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
10134     fi
10135     ;;
10136 neon)
10137     AC_MSG_RESULT([neon])
10138     # Check for system neon
10139     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.1])
10140     if test "$with_system_neon" = "yes"; then
10141         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10142     else
10143         NEON_VERSION=0311
10144     fi
10145     AC_SUBST(NEON_VERSION)
10146     ;;
10148     AC_MSG_RESULT([none, disabled])
10149     WITH_WEBDAV=""
10150     ;;
10151 esac
10152 AC_SUBST(WITH_WEBDAV)
10154 dnl ===================================================================
10155 dnl Check for disabling cve_tests
10156 dnl ===================================================================
10157 AC_MSG_CHECKING([whether to execute CVE tests])
10158 # If not explicitly enabled or disabled, default
10159 if test -z "$enable_cve_tests"; then
10160     case "$OS" in
10161     WNT)
10162         # Default cves off for Windows with its wild and wonderful
10163         # variety of AV software kicking in and panicking
10164         enable_cve_tests=no
10165         ;;
10166     *)
10167         # otherwise yes
10168         enable_cve_tests=yes
10169         ;;
10170     esac
10172 if test "$enable_cve_tests" = "no"; then
10173     AC_MSG_RESULT([no])
10174     DISABLE_CVE_TESTS=TRUE
10175     AC_SUBST(DISABLE_CVE_TESTS)
10176 else
10177     AC_MSG_RESULT([yes])
10180 dnl ===================================================================
10181 dnl Check for enabling chart XShape tests
10182 dnl ===================================================================
10183 AC_MSG_CHECKING([whether to execute chart XShape tests])
10184 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10185     AC_MSG_RESULT([yes])
10186     ENABLE_CHART_TESTS=TRUE
10187     AC_SUBST(ENABLE_CHART_TESTS)
10188 else
10189     AC_MSG_RESULT([no])
10192 dnl ===================================================================
10193 dnl Check for system openssl
10194 dnl ===================================================================
10195 DISABLE_OPENSSL=
10196 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10197 if test "$enable_openssl" = "yes"; then
10198     AC_MSG_RESULT([no])
10199     if test "$_os" = Darwin ; then
10200         # OpenSSL is deprecated when building for 10.7 or later.
10201         #
10202         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10203         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10205         with_system_openssl=no
10206         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10207     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10208             && test "$with_system_openssl" != "no"; then
10209         with_system_openssl=yes
10210         SYSTEM_OPENSSL=TRUE
10211         OPENSSL_CFLAGS=
10212         OPENSSL_LIBS="-lssl -lcrypto"
10213     else
10214         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10215     fi
10216     if test "$with_system_openssl" = "yes"; then
10217         AC_MSG_CHECKING([whether openssl supports SHA512])
10218         AC_LANG_PUSH([C])
10219         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10220             SHA512_CTX context;
10221 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10222         AC_LANG_POP(C)
10223     fi
10224 else
10225     AC_MSG_RESULT([yes])
10226     DISABLE_OPENSSL=TRUE
10228     # warn that although OpenSSL is disabled, system libraries may depend on it
10229     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10230     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10233 AC_SUBST([DISABLE_OPENSSL])
10235 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10236     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10237         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10238         enable_cipher_openssl_backend=no
10239     else
10240         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10241     fi
10243 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10244 ENABLE_CIPHER_OPENSSL_BACKEND=
10245 if test "$enable_cipher_openssl_backend" = yes; then
10246     AC_MSG_RESULT([yes])
10247     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10248 else
10249     AC_MSG_RESULT([no])
10251 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10253 dnl ===================================================================
10254 dnl Check for building gnutls
10255 dnl ===================================================================
10256 AC_MSG_CHECKING([whether to use gnutls])
10257 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10258     AC_MSG_RESULT([yes])
10259     AM_PATH_LIBGCRYPT()
10260     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10261         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10262                       available in the system to use as replacement.]]))
10263     FilterLibs "${LIBGCRYPT_LIBS}"
10264     LIBGCRYPT_LIBS="${filteredlibs}"
10265 else
10266     AC_MSG_RESULT([no])
10269 AC_SUBST([LIBGCRYPT_CFLAGS])
10270 AC_SUBST([LIBGCRYPT_LIBS])
10272 dnl ===================================================================
10273 dnl Check for system redland
10274 dnl ===================================================================
10275 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10276 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10277 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10278 if test "$with_system_redland" = "yes"; then
10279     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10280             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10281 else
10282     RAPTOR_MAJOR="0"
10283     RASQAL_MAJOR="3"
10284     REDLAND_MAJOR="0"
10286 AC_SUBST(RAPTOR_MAJOR)
10287 AC_SUBST(RASQAL_MAJOR)
10288 AC_SUBST(REDLAND_MAJOR)
10290 dnl ===================================================================
10291 dnl Check for system hunspell
10292 dnl ===================================================================
10293 AC_MSG_CHECKING([which libhunspell to use])
10294 if test "$_os" = iOS; then
10295    AC_MSG_RESULT([none])
10296 elif test "$with_system_hunspell" = "yes"; then
10297     AC_MSG_RESULT([external])
10298     SYSTEM_HUNSPELL=TRUE
10299     AC_LANG_PUSH([C++])
10300     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10301     if test "$HUNSPELL_PC" != "TRUE"; then
10302         AC_CHECK_HEADER(hunspell.hxx, [],
10303             [
10304             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10305             [AC_MSG_ERROR(hunspell headers not found.)], [])
10306             ], [])
10307         AC_CHECK_LIB([hunspell], [main], [:],
10308            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10309         HUNSPELL_LIBS=-lhunspell
10310     fi
10311     AC_LANG_POP([C++])
10312     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10313     FilterLibs "${HUNSPELL_LIBS}"
10314     HUNSPELL_LIBS="${filteredlibs}"
10315 else
10316     AC_MSG_RESULT([internal])
10317     SYSTEM_HUNSPELL=
10318     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10319     if test "$COM" = "MSC"; then
10320         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10321     else
10322         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10323     fi
10324     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10326 AC_SUBST(SYSTEM_HUNSPELL)
10327 AC_SUBST(HUNSPELL_CFLAGS)
10328 AC_SUBST(HUNSPELL_LIBS)
10330 dnl ===================================================================
10331 dnl Check for system qrcodegen
10332 dnl ===================================================================
10333 AC_MSG_CHECKING([which libqrcodegen to use])
10334 if test "$with_system_qrcodegen" = "yes"; then
10335     AC_MSG_RESULT([external])
10336     SYSTEM_QRCODEGEN=TRUE
10337     AC_LANG_PUSH([C++])
10338     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10339         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10340     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10341         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10342     QRCODEGEN_LIBS=-lqrcodegencpp
10343     AC_LANG_POP([C++])
10344     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10345     FilterLibs "${QRCODEGEN_LIBS}"
10346     QRCODEGEN_LIBS="${filteredlibs}"
10347 else
10348     AC_MSG_RESULT([internal])
10349     SYSTEM_QRCODEGEN=
10350     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10352 AC_SUBST(SYSTEM_QRCODEGEN)
10353 AC_SUBST(QRCODEGEN_CFLAGS)
10354 AC_SUBST(QRCODEGEN_LIBS)
10356 dnl ===================================================================
10357 dnl Check for system box2d
10358 dnl ===================================================================
10359 AC_MSG_CHECKING([which box2d to use])
10360 if test "$with_system_box2d" = "yes"; then
10361     AC_MSG_RESULT([external])
10362     SYSTEM_BOX2D=TRUE
10363     AC_LANG_PUSH([C++])
10364     AC_CHECK_HEADER(Box2D/Box2D.h, [],
10365         [AC_MSG_ERROR(box2d headers not found.)], [])
10366     AC_CHECK_LIB([Box2D], [main], [:],
10367         [ AC_MSG_ERROR(box2d library not found.) ], [])
10368     BOX2D_LIBS=-lBox2D
10369     AC_LANG_POP([C++])
10370     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10371     FilterLibs "${BOX2D_LIBS}"
10372     BOX2D_LIBS="${filteredlibs}"
10373 else
10374     AC_MSG_RESULT([internal])
10375     SYSTEM_BOX2D=
10376     BUILD_TYPE="$BUILD_TYPE BOX2D"
10378 AC_SUBST(SYSTEM_BOX2D)
10379 AC_SUBST(BOX2D_CFLAGS)
10380 AC_SUBST(BOX2D_LIBS)
10382 dnl ===================================================================
10383 dnl Checking for altlinuxhyph
10384 dnl ===================================================================
10385 AC_MSG_CHECKING([which altlinuxhyph to use])
10386 if test "$with_system_altlinuxhyph" = "yes"; then
10387     AC_MSG_RESULT([external])
10388     SYSTEM_HYPH=TRUE
10389     AC_CHECK_HEADER(hyphen.h, [],
10390        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10391     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10392        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10393        [#include <hyphen.h>])
10394     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10395         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10396     if test -z "$HYPHEN_LIB"; then
10397         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10398            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10399     fi
10400     if test -z "$HYPHEN_LIB"; then
10401         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10402            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10403     fi
10404 else
10405     AC_MSG_RESULT([internal])
10406     SYSTEM_HYPH=
10407     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10408     if test "$COM" = "MSC"; then
10409         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10410     else
10411         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10412     fi
10414 AC_SUBST(SYSTEM_HYPH)
10415 AC_SUBST(HYPHEN_LIB)
10417 dnl ===================================================================
10418 dnl Checking for mythes
10419 dnl ===================================================================
10420 AC_MSG_CHECKING([which mythes to use])
10421 if test "$_os" = iOS; then
10422    AC_MSG_RESULT([none])
10423 elif test "$with_system_mythes" = "yes"; then
10424     AC_MSG_RESULT([external])
10425     SYSTEM_MYTHES=TRUE
10426     AC_LANG_PUSH([C++])
10427     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10428     if test "$MYTHES_PKGCONFIG" = "no"; then
10429         AC_CHECK_HEADER(mythes.hxx, [],
10430             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10431         AC_CHECK_LIB([mythes-1.2], [main], [:],
10432             [ MYTHES_FOUND=no], [])
10433     if test "$MYTHES_FOUND" = "no"; then
10434         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10435                 [ MYTHES_FOUND=no], [])
10436     fi
10437     if test "$MYTHES_FOUND" = "no"; then
10438         AC_MSG_ERROR([mythes library not found!.])
10439     fi
10440     fi
10441     AC_LANG_POP([C++])
10442     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10443     FilterLibs "${MYTHES_LIBS}"
10444     MYTHES_LIBS="${filteredlibs}"
10445 else
10446     AC_MSG_RESULT([internal])
10447     SYSTEM_MYTHES=
10448     BUILD_TYPE="$BUILD_TYPE MYTHES"
10449     if test "$COM" = "MSC"; then
10450         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10451     else
10452         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10453     fi
10455 AC_SUBST(SYSTEM_MYTHES)
10456 AC_SUBST(MYTHES_CFLAGS)
10457 AC_SUBST(MYTHES_LIBS)
10459 dnl ===================================================================
10460 dnl How should we build the linear programming solver ?
10461 dnl ===================================================================
10463 ENABLE_COINMP=
10464 AC_MSG_CHECKING([whether to build with CoinMP])
10465 if test "$enable_coinmp" != "no"; then
10466     ENABLE_COINMP=TRUE
10467     AC_MSG_RESULT([yes])
10468     if test "$with_system_coinmp" = "yes"; then
10469         SYSTEM_COINMP=TRUE
10470         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10471         FilterLibs "${COINMP_LIBS}"
10472         COINMP_LIBS="${filteredlibs}"
10473     else
10474         BUILD_TYPE="$BUILD_TYPE COINMP"
10475     fi
10476 else
10477     AC_MSG_RESULT([no])
10479 AC_SUBST(ENABLE_COINMP)
10480 AC_SUBST(SYSTEM_COINMP)
10481 AC_SUBST(COINMP_CFLAGS)
10482 AC_SUBST(COINMP_LIBS)
10484 ENABLE_LPSOLVE=
10485 AC_MSG_CHECKING([whether to build with lpsolve])
10486 if test "$enable_lpsolve" != "no"; then
10487     ENABLE_LPSOLVE=TRUE
10488     AC_MSG_RESULT([yes])
10489 else
10490     AC_MSG_RESULT([no])
10492 AC_SUBST(ENABLE_LPSOLVE)
10494 if test "$ENABLE_LPSOLVE" = TRUE; then
10495     AC_MSG_CHECKING([which lpsolve to use])
10496     if test "$with_system_lpsolve" = "yes"; then
10497         AC_MSG_RESULT([external])
10498         SYSTEM_LPSOLVE=TRUE
10499         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10500            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10501         save_LIBS=$LIBS
10502         # some systems need this. Like Ubuntu...
10503         AC_CHECK_LIB(m, floor)
10504         AC_CHECK_LIB(dl, dlopen)
10505         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10506             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10507         LIBS=$save_LIBS
10508     else
10509         AC_MSG_RESULT([internal])
10510         SYSTEM_LPSOLVE=
10511         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10512     fi
10514 AC_SUBST(SYSTEM_LPSOLVE)
10516 dnl ===================================================================
10517 dnl Checking for libexttextcat
10518 dnl ===================================================================
10519 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10520 if test "$with_system_libexttextcat" = "yes"; then
10521     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10523 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10525 dnl ===================================================================
10526 dnl Checking for libnumbertext
10527 dnl ===================================================================
10528 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
10529 if test "$with_system_libnumbertext" = "yes"; then
10530     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10531     SYSTEM_LIBNUMBERTEXT=YES
10532 else
10533     SYSTEM_LIBNUMBERTEXT=
10534     AC_LANG_PUSH([C++])
10535     save_CPPFLAGS=$CPPFLAGS
10536     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10537     AC_CHECK_HEADERS([codecvt regex])
10538     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10539             [ LIBNUMBERTEXT_CFLAGS=''
10540               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10541                            Enable libnumbertext fallback (missing number to number name conversion).])
10542             ])
10543     CPPFLAGS=$save_CPPFLAGS
10544     AC_LANG_POP([C++])
10546 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10547 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10548 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10550 dnl ***************************************
10551 dnl testing libc version for Linux...
10552 dnl ***************************************
10553 if test "$_os" = "Linux"; then
10554     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10555     exec 6>/dev/null # no output
10556     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10557     exec 6>&1 # output on again
10558     if test "$HAVE_LIBC"; then
10559         AC_MSG_RESULT([yes])
10560     else
10561         AC_MSG_ERROR([no, upgrade libc])
10562     fi
10565 dnl =========================================
10566 dnl Check for uuidgen
10567 dnl =========================================
10568 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10569     # presence is already tested above in the WINDOWS_SDK_HOME check
10570     UUIDGEN=uuidgen.exe
10571     AC_SUBST(UUIDGEN)
10572 else
10573     AC_PATH_PROG([UUIDGEN], [uuidgen])
10574     if test -z "$UUIDGEN"; then
10575         AC_MSG_WARN([uuid is needed for building installation sets])
10576     fi
10579 dnl ***************************************
10580 dnl Checking for bison and flex
10581 dnl ***************************************
10582 AC_PATH_PROG(BISON, bison)
10583 if test -z "$BISON"; then
10584     AC_MSG_ERROR([no bison found in \$PATH, install it])
10585 else
10586     AC_MSG_CHECKING([the bison version])
10587     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10588     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10589     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
10590     dnl cause
10591     dnl
10592     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]
10593     dnl   typedef union YYSTYPE
10594     dnl           ~~~~~~^~~~~~~
10595     dnl
10596     dnl while at least 3.4.1 is know to be good:
10597     if test "$COMPILER_PLUGINS" = TRUE; then
10598         if test "$_bison_longver" -lt 2004; then
10599             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
10600         fi
10601     else
10602         if test "$_bison_longver" -lt 2000; then
10603             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10604         fi
10605     fi
10607 AC_SUBST([BISON])
10609 AC_PATH_PROG(FLEX, flex)
10610 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10611     FLEX=`cygpath -m $FLEX`
10613 if test -z "$FLEX"; then
10614     AC_MSG_ERROR([no flex found in \$PATH, install it])
10615 else
10616     AC_MSG_CHECKING([the flex version])
10617     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10618     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10619         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10620     fi
10622 AC_SUBST([FLEX])
10623 dnl ***************************************
10624 dnl Checking for patch
10625 dnl ***************************************
10626 AC_PATH_PROG(PATCH, patch)
10627 if test -z "$PATCH"; then
10628     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10631 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10632 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10633     if test -z "$with_gnu_patch"; then
10634         GNUPATCH=$PATCH
10635     else
10636         if test -x "$with_gnu_patch"; then
10637             GNUPATCH=$with_gnu_patch
10638         else
10639             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10640         fi
10641     fi
10643     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10644     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10645         AC_MSG_RESULT([yes])
10646     else
10647         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10648     fi
10649 else
10650     GNUPATCH=$PATCH
10653 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10654     GNUPATCH=`cygpath -m $GNUPATCH`
10657 dnl We also need to check for --with-gnu-cp
10659 if test -z "$with_gnu_cp"; then
10660     # check the place where the good stuff is hidden on Solaris...
10661     if test -x /usr/gnu/bin/cp; then
10662         GNUCP=/usr/gnu/bin/cp
10663     else
10664         AC_PATH_PROGS(GNUCP, gnucp cp)
10665     fi
10666     if test -z $GNUCP; then
10667         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10668     fi
10669 else
10670     if test -x "$with_gnu_cp"; then
10671         GNUCP=$with_gnu_cp
10672     else
10673         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10674     fi
10677 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10678     GNUCP=`cygpath -m $GNUCP`
10681 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10682 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10683     AC_MSG_RESULT([yes])
10684 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10685     AC_MSG_RESULT([yes])
10686 else
10687     case "$build_os" in
10688     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10689         x_GNUCP=[\#]
10690         GNUCP=''
10691         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10692         ;;
10693     *)
10694         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10695         ;;
10696     esac
10699 AC_SUBST(GNUPATCH)
10700 AC_SUBST(GNUCP)
10701 AC_SUBST(x_GNUCP)
10703 dnl ***************************************
10704 dnl testing assembler path
10705 dnl ***************************************
10706 ML_EXE=""
10707 if test "$_os" = "WINNT"; then
10708     if test "$BITNESS_OVERRIDE" = ""; then
10709         assembler=ml.exe
10710     else
10711         assembler=ml64.exe
10712     fi
10714     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10715     if test -f "$CL_PATH/$assembler"; then
10716         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10717         AC_MSG_RESULT([$ML_EXE])
10718     else
10719         AC_MSG_ERROR([not found])
10720     fi
10723 AC_SUBST(ML_EXE)
10725 dnl ===================================================================
10726 dnl We need zip and unzip
10727 dnl ===================================================================
10728 AC_PATH_PROG(ZIP, zip)
10729 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10730 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10731     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],,)
10734 AC_PATH_PROG(UNZIP, unzip)
10735 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10737 dnl ===================================================================
10738 dnl Zip must be a specific type for different build types.
10739 dnl ===================================================================
10740 if test $build_os = cygwin; then
10741     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10742         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10743     fi
10746 dnl ===================================================================
10747 dnl We need touch with -h option support.
10748 dnl ===================================================================
10749 AC_PATH_PROG(TOUCH, touch)
10750 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10751 touch warn
10752 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10753     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],,)
10756 dnl ===================================================================
10757 dnl Check for system epoxy
10758 dnl ===================================================================
10759 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10761 dnl ===================================================================
10762 dnl Set vcl option: coordinate device in double or sal_Int32
10763 dnl ===================================================================
10765 dnl disabled for now, we don't want subtle differences between OSs
10766 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10767 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10768 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10769 dnl     AC_MSG_RESULT([double])
10770 dnl else
10771 dnl     AC_MSG_RESULT([sal_Int32])
10772 dnl fi
10774 dnl ===================================================================
10775 dnl Test which vclplugs have to be built.
10776 dnl ===================================================================
10777 R=""
10778 if test "$USING_X11" != TRUE; then
10779     enable_gtk3=no
10782 ENABLE_GTK3=""
10783 if test "x$enable_gtk3" = "xyes"; then
10784     ENABLE_GTK3="TRUE"
10785     AC_DEFINE(ENABLE_GTK3)
10786     R="$R gtk3"
10788 AC_SUBST(ENABLE_GTK3)
10790 ENABLE_GTK3_KDE5=""
10791 if test "x$enable_gtk3_kde5" = "xyes"; then
10792     ENABLE_GTK3_KDE5="TRUE"
10793     AC_DEFINE(ENABLE_GTK3_KDE5)
10794     R="$R gtk3_kde5"
10796 AC_SUBST(ENABLE_GTK3_KDE5)
10798 ENABLE_QT5=""
10799 if test "x$enable_qt5" = "xyes"; then
10800     ENABLE_QT5="TRUE"
10801     AC_DEFINE(ENABLE_QT5)
10802     R="$R qt5"
10804 AC_SUBST(ENABLE_QT5)
10806 ENABLE_KF5=""
10807 if test "x$enable_kf5" = "xyes"; then
10808     ENABLE_KF5="TRUE"
10809     AC_DEFINE(ENABLE_KF5)
10810     R="$R kf5"
10812 AC_SUBST(ENABLE_KF5)
10814 GTK3_CFLAGS=""
10815 GTK3_LIBS=""
10816 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
10817     if test "$with_system_cairo" = no; then
10818         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10819     fi
10820     : ${with_system_cairo:=yes}
10821     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)
10822     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10823     FilterLibs "${GTK3_LIBS}"
10824     GTK3_LIBS="${filteredlibs}"
10826     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10827     if test "$with_system_epoxy" != "yes"; then
10828         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10829         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10830                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10831     fi
10833 AC_SUBST(GTK3_LIBS)
10834 AC_SUBST(GTK3_CFLAGS)
10836 if test "$enable_introspection" = yes; then
10837     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
10838         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10839     else
10840         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10841     fi
10844 if test "$_os" = "WINNT"; then
10845     R="$R win"
10846 elif test "$_os" = "Darwin"; then
10847     R="$R osx"
10848 elif test "$_os" = "iOS"; then
10849     R="ios (builtin)"
10852 build_vcl_plugins="$R"
10853 if test -z "$build_vcl_plugins"; then
10854     build_vcl_plugins="none"
10856 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10858 dnl ===================================================================
10859 dnl check for dbus support
10860 dnl ===================================================================
10861 ENABLE_DBUS=""
10862 DBUS_CFLAGS=""
10863 DBUS_LIBS=""
10864 DBUS_GLIB_CFLAGS=""
10865 DBUS_GLIB_LIBS=""
10866 DBUS_HAVE_GLIB=""
10868 if test "$enable_dbus" = "no"; then
10869     test_dbus=no
10872 AC_MSG_CHECKING([whether to enable DBUS support])
10873 if test "$test_dbus" = "yes"; then
10874     ENABLE_DBUS="TRUE"
10875     AC_MSG_RESULT([yes])
10876     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10877     AC_DEFINE(ENABLE_DBUS)
10878     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10879     FilterLibs "${DBUS_LIBS}"
10880     DBUS_LIBS="${filteredlibs}"
10882     # Glib is needed for BluetoothServer
10883     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10884     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10885         [
10886             DBUS_HAVE_GLIB="TRUE"
10887             AC_DEFINE(DBUS_HAVE_GLIB,1)
10888         ],
10889         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10890     )
10891 else
10892     AC_MSG_RESULT([no])
10895 AC_SUBST(ENABLE_DBUS)
10896 AC_SUBST(DBUS_CFLAGS)
10897 AC_SUBST(DBUS_LIBS)
10898 AC_SUBST(DBUS_GLIB_CFLAGS)
10899 AC_SUBST(DBUS_GLIB_LIBS)
10900 AC_SUBST(DBUS_HAVE_GLIB)
10902 AC_MSG_CHECKING([whether to enable Impress remote control])
10903 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10904     AC_MSG_RESULT([yes])
10905     ENABLE_SDREMOTE=TRUE
10906     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10908     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
10909         # The Bluetooth code doesn't compile with macOS SDK 10.15
10910         if test "$enable_sdremote_bluetooth" = yes; then
10911             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
10912         fi
10913         enable_sdremote_bluetooth=no
10914     fi
10915     # If not explicitly enabled or disabled, default
10916     if test -z "$enable_sdremote_bluetooth"; then
10917         case "$OS" in
10918         LINUX|MACOSX|WNT)
10919             # Default to yes for these
10920             enable_sdremote_bluetooth=yes
10921             ;;
10922         *)
10923             # otherwise no
10924             enable_sdremote_bluetooth=no
10925             ;;
10926         esac
10927     fi
10928     # $enable_sdremote_bluetooth is guaranteed non-empty now
10930     if test "$enable_sdremote_bluetooth" != "no"; then
10931         if test "$OS" = "LINUX"; then
10932             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10933                 AC_MSG_RESULT([yes])
10934                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10935                 dnl ===================================================================
10936                 dnl Check for system bluez
10937                 dnl ===================================================================
10938                 AC_MSG_CHECKING([which Bluetooth header to use])
10939                 if test "$with_system_bluez" = "yes"; then
10940                     AC_MSG_RESULT([external])
10941                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10942                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10943                     SYSTEM_BLUEZ=TRUE
10944                 else
10945                     AC_MSG_RESULT([internal])
10946                     SYSTEM_BLUEZ=
10947                 fi
10948             else
10949                 AC_MSG_RESULT([no, dbus disabled])
10950                 ENABLE_SDREMOTE_BLUETOOTH=
10951                 SYSTEM_BLUEZ=
10952             fi
10953         else
10954             AC_MSG_RESULT([yes])
10955             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10956             SYSTEM_BLUEZ=
10957         fi
10958     else
10959         AC_MSG_RESULT([no])
10960         ENABLE_SDREMOTE_BLUETOOTH=
10961         SYSTEM_BLUEZ=
10962     fi
10963 else
10964     ENABLE_SDREMOTE=
10965     SYSTEM_BLUEZ=
10966     AC_MSG_RESULT([no])
10968 AC_SUBST(ENABLE_SDREMOTE)
10969 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10970 AC_SUBST(SYSTEM_BLUEZ)
10972 dnl ===================================================================
10973 dnl Check whether to enable GIO support
10974 dnl ===================================================================
10975 if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
10976     AC_MSG_CHECKING([whether to enable GIO support])
10977     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10978         dnl Need at least 2.26 for the dbus support.
10979         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10980                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10981         if test "$ENABLE_GIO" = "TRUE"; then
10982             AC_DEFINE(ENABLE_GIO)
10983             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10984             FilterLibs "${GIO_LIBS}"
10985             GIO_LIBS="${filteredlibs}"
10986         fi
10987     else
10988         AC_MSG_RESULT([no])
10989     fi
10991 AC_SUBST(ENABLE_GIO)
10992 AC_SUBST(GIO_CFLAGS)
10993 AC_SUBST(GIO_LIBS)
10996 dnl ===================================================================
10998 SPLIT_APP_MODULES=""
10999 if test "$enable_split_app_modules" = "yes"; then
11000     SPLIT_APP_MODULES="TRUE"
11002 AC_SUBST(SPLIT_APP_MODULES)
11004 SPLIT_OPT_FEATURES=""
11005 if test "$enable_split_opt_features" = "yes"; then
11006     SPLIT_OPT_FEATURES="TRUE"
11008 AC_SUBST(SPLIT_OPT_FEATURES)
11010 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
11011     if test "$enable_cairo_canvas" = yes; then
11012         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
11013     fi
11014     enable_cairo_canvas=no
11015 elif test -z "$enable_cairo_canvas"; then
11016     enable_cairo_canvas=yes
11019 ENABLE_CAIRO_CANVAS=""
11020 if test "$enable_cairo_canvas" = "yes"; then
11021     test_cairo=yes
11022     ENABLE_CAIRO_CANVAS="TRUE"
11023     AC_DEFINE(ENABLE_CAIRO_CANVAS)
11025 AC_SUBST(ENABLE_CAIRO_CANVAS)
11027 dnl ===================================================================
11028 dnl Check whether the GStreamer libraries are available.
11029 dnl ===================================================================
11031 ENABLE_GSTREAMER_1_0=""
11033 if test "$build_gstreamer_1_0" = "yes"; then
11035     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11036     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11037         ENABLE_GSTREAMER_1_0="TRUE"
11038         AC_MSG_RESULT([yes])
11039         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11040         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11041         FilterLibs "${GSTREAMER_1_0_LIBS}"
11042         GSTREAMER_1_0_LIBS="${filteredlibs}"
11043         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11044     else
11045         AC_MSG_RESULT([no])
11046     fi
11048 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11049 AC_SUBST(GSTREAMER_1_0_LIBS)
11050 AC_SUBST(ENABLE_GSTREAMER_1_0)
11052 dnl ===================================================================
11053 dnl Check whether to build the VLC avmedia backend
11054 dnl ===================================================================
11056 ENABLE_VLC=""
11058 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
11059 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
11060     ENABLE_VLC="TRUE"
11061     AC_MSG_RESULT([yes])
11062 else
11063     AC_MSG_RESULT([no])
11065 AC_SUBST(ENABLE_VLC)
11067 ENABLE_OPENGL_TRANSITIONS=
11068 ENABLE_OPENGL_CANVAS=
11069 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11070    : # disable
11071 elif test "$_os" = "Darwin"; then
11072     # We use frameworks on macOS, no need for detail checks
11073     ENABLE_OPENGL_TRANSITIONS=TRUE
11074     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11075     ENABLE_OPENGL_CANVAS=TRUE
11076 elif test $_os = WINNT; then
11077     ENABLE_OPENGL_TRANSITIONS=TRUE
11078     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11079     ENABLE_OPENGL_CANVAS=TRUE
11080 else
11081     if test "$USING_X11" = TRUE; then
11082         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11083         ENABLE_OPENGL_TRANSITIONS=TRUE
11084         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11085         ENABLE_OPENGL_CANVAS=TRUE
11086     fi
11089 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11090 AC_SUBST(ENABLE_OPENGL_CANVAS)
11092 dnl =================================================
11093 dnl Check whether to build with OpenCL support.
11094 dnl =================================================
11096 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
11097     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11098     # platform (optional at run-time, used through clew).
11099     BUILD_TYPE="$BUILD_TYPE OPENCL"
11100     AC_DEFINE(HAVE_FEATURE_OPENCL)
11103 dnl =================================================
11104 dnl Check whether to build with dconf support.
11105 dnl =================================================
11107 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11108     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11109         if test "$enable_dconf" = yes; then
11110             AC_MSG_ERROR([dconf not found])
11111         else
11112             enable_dconf=no
11113         fi])
11115 AC_MSG_CHECKING([whether to enable dconf])
11116 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11117     DCONF_CFLAGS=
11118     DCONF_LIBS=
11119     ENABLE_DCONF=
11120     AC_MSG_RESULT([no])
11121 else
11122     ENABLE_DCONF=TRUE
11123     AC_DEFINE(ENABLE_DCONF)
11124     AC_MSG_RESULT([yes])
11126 AC_SUBST([DCONF_CFLAGS])
11127 AC_SUBST([DCONF_LIBS])
11128 AC_SUBST([ENABLE_DCONF])
11130 # pdf import?
11131 AC_MSG_CHECKING([whether to build the PDF import feature])
11132 ENABLE_PDFIMPORT=
11133 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
11134     AC_MSG_RESULT([yes])
11135     ENABLE_PDFIMPORT=TRUE
11136     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11137 else
11138     AC_MSG_RESULT([no])
11141 # Pdfium?
11142 AC_MSG_CHECKING([whether to build PDFium])
11143 ENABLE_PDFIUM=
11144 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11145     AC_MSG_RESULT([yes])
11146     ENABLE_PDFIUM=TRUE
11147     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11148     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11149 else
11150     AC_MSG_RESULT([no])
11152 AC_SUBST(ENABLE_PDFIUM)
11154 dnl ===================================================================
11155 dnl Check for poppler
11156 dnl ===================================================================
11157 ENABLE_POPPLER=
11158 AC_MSG_CHECKING([whether to build Poppler])
11159 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11160     AC_MSG_RESULT([yes])
11161     ENABLE_POPPLER=TRUE
11162     AC_DEFINE(HAVE_FEATURE_POPPLER)
11163 else
11164     AC_MSG_RESULT([no])
11166 AC_SUBST(ENABLE_POPPLER)
11168 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11169     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11172 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11173     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11176 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11177     dnl ===================================================================
11178     dnl Check for system poppler
11179     dnl ===================================================================
11180     AC_MSG_CHECKING([which PDF import poppler to use])
11181     if test "$with_system_poppler" = "yes"; then
11182         AC_MSG_RESULT([external])
11183         SYSTEM_POPPLER=TRUE
11184         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11185         AC_LANG_PUSH([C++])
11186         save_CXXFLAGS=$CXXFLAGS
11187         save_CPPFLAGS=$CPPFLAGS
11188         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11189         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11190         AC_CHECK_HEADER([cpp/poppler-version.h],
11191             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11192             [])
11193         CXXFLAGS=$save_CXXFLAGS
11194         CPPFLAGS=$save_CPPFLAGS
11195         AC_LANG_POP([C++])
11196         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11198         FilterLibs "${POPPLER_LIBS}"
11199         POPPLER_LIBS="${filteredlibs}"
11200     else
11201         AC_MSG_RESULT([internal])
11202         SYSTEM_POPPLER=
11203         BUILD_TYPE="$BUILD_TYPE POPPLER"
11204         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11205     fi
11206     AC_DEFINE([ENABLE_PDFIMPORT],1)
11208 AC_SUBST(ENABLE_PDFIMPORT)
11209 AC_SUBST(SYSTEM_POPPLER)
11210 AC_SUBST(POPPLER_CFLAGS)
11211 AC_SUBST(POPPLER_LIBS)
11213 # Skia?
11214 AC_MSG_CHECKING([whether to build Skia])
11215 ENABLE_SKIA=
11216 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
11217     if test "$enable_skia" = "debug"; then
11218         AC_MSG_RESULT([yes (debug)])
11219         ENABLE_SKIA_DEBUG=TRUE
11220     else
11221         AC_MSG_RESULT([yes])
11222         ENABLE_SKIA_DEBUG=
11223     fi
11224     ENABLE_SKIA=TRUE
11225     AC_DEFINE(HAVE_FEATURE_SKIA)
11226     BUILD_TYPE="$BUILD_TYPE SKIA"
11227 else
11228     AC_MSG_RESULT([no])
11230 AC_SUBST(ENABLE_SKIA)
11231 AC_SUBST(ENABLE_SKIA_DEBUG)
11233 CLANG_CXXFLAGS_INTRINSICS_SSE2=
11234 CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11235 CLANG_CXXFLAGS_INTRINSICS_SSE41=
11236 CLANG_CXXFLAGS_INTRINSICS_SSE42=
11237 CLANG_CXXFLAGS_INTRINSICS_AVX=
11238 CLANG_CXXFLAGS_INTRINSICS_AVX2=
11239 CLANG_CXXFLAGS_INTRINSICS_AVX512=
11240 CLANG_CXXFLAGS_INTRINSICS_F16C=
11241 CLANG_CXXFLAGS_INTRINSICS_FMA=
11243 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
11244     if test -n "$CLANG_CC" -a -n "$CLANG_CXX"; then
11245         AC_MSG_CHECKING([for Clang])
11246         AC_MSG_RESULT([$CLANG_CC / $CLANG_CXX])
11247     else
11248         if test "$_os" = "WINNT"; then
11249             AC_MSG_CHECKING([for clang-cl])
11250             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11251                 CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11252                 dnl explicitly set -m32/-m64
11253                 if test "$BITNESS_OVERRIDE" = ""; then
11254                     CLANG_CC="$CLANG_CC -m32"
11255                 else
11256                     CLANG_CC="$CLANG_CC -m64"
11257                 fi
11258                 CLANG_CXX="$CLANG_CC"
11259                 AC_MSG_RESULT([$CLANG_CC])
11260             else
11261                 AC_MSG_RESULT([no])
11262             fi
11263         else
11264             AC_CHECK_PROG(CLANG_CC,clang,clang,[])
11265             AC_CHECK_PROG(CLANG_CXX,clang++,clang++,[])
11266         fi
11267     fi
11268     if test -n "$CLANG_CC" -a -n "$CLANG_CXX"; then
11269         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CLANG_CC -E - | tail -1 | sed 's/ //g'`
11270         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11271         if test "$clang2_ver" -lt 50002; then
11272             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11273             CLANG_CC=
11274             CLANG_CXX=
11275         fi
11276     fi
11277     if test -z "$CLANG_CC" -o -z "$CLANG_CXX"; then
11278         # Skia is the default on Windows, so hard-require Clang.
11279         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11280         if test "$_os" = "WINNT"; then
11281             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11282         else
11283             AC_MSG_WARN([Clang compiler not found.])
11284         fi
11285     else
11287         save_CXX="$CXX"
11288         CXX="$CLANG_CXX"
11289         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11290         flag_sse2=-msse2
11291         flag_ssse3=-mssse3
11292         flag_sse41=-msse4.1
11293         flag_sse42=-msse4.2
11294         flag_avx=-mavx
11295         flag_avx2=-mavx2
11296         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
11297         flag_f16c=-mf16c
11298         flag_fma=-mfma
11300         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11301         AC_LANG_PUSH([C++])
11302         save_CXXFLAGS=$CXXFLAGS
11303         CXXFLAGS="$CXXFLAGS $flag_sse2"
11304         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11305             #include <emmintrin.h>
11306             int main () {
11307                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11308                 c = _mm_xor_si128 (a, b);
11309                 return 0;
11310             }
11311             ])],
11312             [can_compile_sse2=yes],
11313             [can_compile_sse2=no])
11314         AC_LANG_POP([C++])
11315         CXXFLAGS=$save_CXXFLAGS
11316         AC_MSG_RESULT([${can_compile_sse2}])
11317         if test "${can_compile_sse2}" = "yes" ; then
11318             CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11319         fi
11321         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11322         AC_LANG_PUSH([C++])
11323         save_CXXFLAGS=$CXXFLAGS
11324         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11325         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11326             #include <tmmintrin.h>
11327             int main () {
11328                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11329                 c = _mm_maddubs_epi16 (a, b);
11330                 return 0;
11331             }
11332             ])],
11333             [can_compile_ssse3=yes],
11334             [can_compile_ssse3=no])
11335         AC_LANG_POP([C++])
11336         CXXFLAGS=$save_CXXFLAGS
11337         AC_MSG_RESULT([${can_compile_ssse3}])
11338         if test "${can_compile_ssse3}" = "yes" ; then
11339             CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
11340         fi
11342         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
11343         AC_LANG_PUSH([C++])
11344         save_CXXFLAGS=$CXXFLAGS
11345         CXXFLAGS="$CXXFLAGS $flag_sse41"
11346         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11347             #include <smmintrin.h>
11348             int main () {
11349                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11350                 c = _mm_cmpeq_epi64 (a, b);
11351                 return 0;
11352             }
11353             ])],
11354             [can_compile_sse41=yes],
11355             [can_compile_sse41=no])
11356         AC_LANG_POP([C++])
11357         CXXFLAGS=$save_CXXFLAGS
11358         AC_MSG_RESULT([${can_compile_sse41}])
11359         if test "${can_compile_sse41}" = "yes" ; then
11360             CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
11361         fi
11363         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
11364         AC_LANG_PUSH([C++])
11365         save_CXXFLAGS=$CXXFLAGS
11366         CXXFLAGS="$CXXFLAGS $flag_sse42"
11367         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11368             #include <nmmintrin.h>
11369             int main () {
11370                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11371                 c = _mm_cmpgt_epi64 (a, b);
11372                 return 0;
11373             }
11374             ])],
11375             [can_compile_sse42=yes],
11376             [can_compile_sse42=no])
11377         AC_LANG_POP([C++])
11378         CXXFLAGS=$save_CXXFLAGS
11379         AC_MSG_RESULT([${can_compile_sse42}])
11380         if test "${can_compile_sse42}" = "yes" ; then
11381             CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
11382         fi
11384         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
11385         AC_LANG_PUSH([C++])
11386         save_CXXFLAGS=$CXXFLAGS
11387         CXXFLAGS="$CXXFLAGS $flag_avx"
11388         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11389             #include <immintrin.h>
11390             int main () {
11391                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
11392                 c = _mm256_xor_ps(a, b);
11393                 return 0;
11394             }
11395             ])],
11396             [can_compile_avx=yes],
11397             [can_compile_avx=no])
11398         AC_LANG_POP([C++])
11399         CXXFLAGS=$save_CXXFLAGS
11400         AC_MSG_RESULT([${can_compile_avx}])
11401         if test "${can_compile_avx}" = "yes" ; then
11402             CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
11403         fi
11405         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
11406         AC_LANG_PUSH([C++])
11407         save_CXXFLAGS=$CXXFLAGS
11408         CXXFLAGS="$CXXFLAGS $flag_avx2"
11409         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11410             #include <immintrin.h>
11411             int main () {
11412                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
11413                 c = _mm256_maddubs_epi16(a, b);
11414                 return 0;
11415             }
11416             ])],
11417             [can_compile_avx2=yes],
11418             [can_compile_avx2=no])
11419         AC_LANG_POP([C++])
11420         CXXFLAGS=$save_CXXFLAGS
11421         AC_MSG_RESULT([${can_compile_avx2}])
11422         if test "${can_compile_avx2}" = "yes" ; then
11423             CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
11424         fi
11426         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
11427         AC_LANG_PUSH([C++])
11428         save_CXXFLAGS=$CXXFLAGS
11429         CXXFLAGS="$CXXFLAGS $flag_avx512"
11430         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11431             #include <immintrin.h>
11432             int main () {
11433                 __m512i a = _mm512_loadu_si512(0);
11434                 return 0;
11435             }
11436             ])],
11437             [can_compile_avx512=yes],
11438             [can_compile_avx512=no])
11439         AC_LANG_POP([C++])
11440         CXXFLAGS=$save_CXXFLAGS
11441         AC_MSG_RESULT([${can_compile_avx512}])
11442         if test "${can_compile_avx512}" = "yes" ; then
11443             CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
11444         fi
11446         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
11447         AC_LANG_PUSH([C++])
11448         save_CXXFLAGS=$CXXFLAGS
11449         CXXFLAGS="$CXXFLAGS $flag_f16c"
11450         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11451             #include <immintrin.h>
11452             int main () {
11453                 __m128i a = _mm_set1_epi32 (0);
11454                 __m128 c;
11455                 c = _mm_cvtph_ps(a);
11456                 return 0;
11457             }
11458             ])],
11459             [can_compile_f16c=yes],
11460             [can_compile_f16c=no])
11461         AC_LANG_POP([C++])
11462         CXXFLAGS=$save_CXXFLAGS
11463         AC_MSG_RESULT([${can_compile_f16c}])
11464         if test "${can_compile_f16c}" = "yes" ; then
11465             CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
11466         fi
11468         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
11469         AC_LANG_PUSH([C++])
11470         save_CXXFLAGS=$CXXFLAGS
11471         CXXFLAGS="$CXXFLAGS $flag_fma"
11472         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11473             #include <immintrin.h>
11474             int main () {
11475                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
11476                 d = _mm256_fmadd_ps(a, b, c);
11477                 return 0;
11478             }
11479             ])],
11480             [can_compile_fma=yes],
11481             [can_compile_fma=no])
11482         AC_LANG_POP([C++])
11483         CXXFLAGS=$save_CXXFLAGS
11484         AC_MSG_RESULT([${can_compile_fma}])
11485         if test "${can_compile_fma}" = "yes" ; then
11486             CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
11487         fi
11489         CXX="$save_CXX"
11490     fi
11492 AC_SUBST(CLANG_CC)
11493 AC_SUBST(CLANG_CXX)
11494 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE2)
11495 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSSE3)
11496 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE41)
11497 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE42)
11498 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX)
11499 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX2)
11500 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX512)
11501 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_F16C)
11502 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_FMA)
11503 AC_SUBST(CLANG_USE_LD)
11505 SYSTEM_GPGMEPP=
11507 if test "$enable_gpgmepp" = no; then
11508     AC_MSG_CHECKING([whether to enable gpgmepp])
11509     AC_MSG_RESULT([no])
11510 elif test "$enable_mpl_subset" = "yes"; then
11511     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11512     AC_MSG_RESULT([yes])
11513 elif test "$enable_fuzzers" = "yes"; then
11514     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11515     AC_MSG_RESULT([yes])
11516 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11517     dnl ===================================================================
11518     dnl Check for system gpgme
11519     dnl ===================================================================
11520     AC_MSG_CHECKING([which gpgmepp to use])
11521     if test "$with_system_gpgmepp" = "yes"; then
11522         AC_MSG_RESULT([external])
11523         SYSTEM_GPGMEPP=TRUE
11525         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11526         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11527             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11528         # progress_callback is the only func with plain C linkage
11529         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11530         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11531             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11532         AC_CHECK_HEADER(gpgme.h, [],
11533             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11534     else
11535         AC_MSG_RESULT([internal])
11536         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11537         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11539         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11540         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11541         if test "$_os" != "WINNT"; then
11542             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11543             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11544         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11545             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11546         fi
11547     fi
11548     ENABLE_GPGMEPP=TRUE
11549     AC_DEFINE([HAVE_FEATURE_GPGME])
11550     AC_PATH_PROG(GPG, gpg)
11551     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11552     # so let's exclude that manually for the moment
11553     if test -n "$GPG" -a "$_os" != "WINNT"; then
11554         # make sure we not only have a working gpgme, but a full working
11555         # gpg installation to run OpenPGP signature verification
11556         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11557     fi
11558     if test "$_os" = "Linux"; then
11559       uid=`id -u`
11560       AC_MSG_CHECKING([for /run/user/$uid])
11561       if test -d /run/user/$uid; then
11562         AC_MSG_RESULT([yes])
11563         AC_PATH_PROG(GPGCONF, gpgconf)
11565         # Older versions of gpgconf are not working as expected, since
11566         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11567         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11568         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11569         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11570         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11571         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11572         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11573           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11574           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11575           if $GPGCONF --dump-options > /dev/null ; then
11576             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11577               AC_MSG_RESULT([yes])
11578               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11579               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11580             else
11581               AC_MSG_RESULT([no])
11582             fi
11583           else
11584             AC_MSG_RESULT([no. missing or broken gpgconf?])
11585           fi
11586         else
11587           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11588         fi
11589       else
11590         AC_MSG_RESULT([no])
11591      fi
11592    fi
11594 AC_SUBST(ENABLE_GPGMEPP)
11595 AC_SUBST(SYSTEM_GPGMEPP)
11596 AC_SUBST(GPG_ERROR_CFLAGS)
11597 AC_SUBST(GPG_ERROR_LIBS)
11598 AC_SUBST(LIBASSUAN_CFLAGS)
11599 AC_SUBST(LIBASSUAN_LIBS)
11600 AC_SUBST(GPGMEPP_CFLAGS)
11601 AC_SUBST(GPGMEPP_LIBS)
11603 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11604 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11605     AC_MSG_RESULT([yes])
11606     ENABLE_MEDIAWIKI=TRUE
11607     BUILD_TYPE="$BUILD_TYPE XSLTML"
11608     if test  "x$with_java" = "xno"; then
11609         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11610     fi
11611 else
11612     AC_MSG_RESULT([no])
11613     ENABLE_MEDIAWIKI=
11614     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11616 AC_SUBST(ENABLE_MEDIAWIKI)
11618 AC_MSG_CHECKING([whether to build the Report Builder])
11619 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11620     AC_MSG_RESULT([yes])
11621     ENABLE_REPORTBUILDER=TRUE
11622     AC_MSG_CHECKING([which jfreereport libs to use])
11623     if test "$with_system_jfreereport" = "yes"; then
11624         SYSTEM_JFREEREPORT=TRUE
11625         AC_MSG_RESULT([external])
11626         if test -z $SAC_JAR; then
11627             SAC_JAR=/usr/share/java/sac.jar
11628         fi
11629         if ! test -f $SAC_JAR; then
11630              AC_MSG_ERROR(sac.jar not found.)
11631         fi
11633         if test -z $LIBXML_JAR; then
11634             if test -f /usr/share/java/libxml-1.0.0.jar; then
11635                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11636             elif test -f /usr/share/java/libxml.jar; then
11637                 LIBXML_JAR=/usr/share/java/libxml.jar
11638             else
11639                 AC_MSG_ERROR(libxml.jar replacement not found.)
11640             fi
11641         elif ! test -f $LIBXML_JAR; then
11642             AC_MSG_ERROR(libxml.jar not found.)
11643         fi
11645         if test -z $FLUTE_JAR; then
11646             if test -f /usr/share/java/flute-1.3.0.jar; then
11647                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11648             elif test -f /usr/share/java/flute.jar; then
11649                 FLUTE_JAR=/usr/share/java/flute.jar
11650             else
11651                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11652             fi
11653         elif ! test -f $FLUTE_JAR; then
11654             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11655         fi
11657         if test -z $JFREEREPORT_JAR; then
11658             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11659                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11660             elif test -f /usr/share/java/flow-engine.jar; then
11661                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11662             else
11663                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11664             fi
11665         elif ! test -f  $JFREEREPORT_JAR; then
11666                 AC_MSG_ERROR(jfreereport.jar not found.)
11667         fi
11669         if test -z $LIBLAYOUT_JAR; then
11670             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11671                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11672             elif test -f /usr/share/java/liblayout.jar; then
11673                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11674             else
11675                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11676             fi
11677         elif ! test -f $LIBLAYOUT_JAR; then
11678                 AC_MSG_ERROR(liblayout.jar not found.)
11679         fi
11681         if test -z $LIBLOADER_JAR; then
11682             if test -f /usr/share/java/libloader-1.0.0.jar; then
11683                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11684             elif test -f /usr/share/java/libloader.jar; then
11685                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11686             else
11687                 AC_MSG_ERROR(libloader.jar replacement not found.)
11688             fi
11689         elif ! test -f  $LIBLOADER_JAR; then
11690             AC_MSG_ERROR(libloader.jar not found.)
11691         fi
11693         if test -z $LIBFORMULA_JAR; then
11694             if test -f /usr/share/java/libformula-0.2.0.jar; then
11695                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11696             elif test -f /usr/share/java/libformula.jar; then
11697                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11698             else
11699                 AC_MSG_ERROR(libformula.jar replacement not found.)
11700             fi
11701         elif ! test -f $LIBFORMULA_JAR; then
11702                 AC_MSG_ERROR(libformula.jar not found.)
11703         fi
11705         if test -z $LIBREPOSITORY_JAR; then
11706             if test -f /usr/share/java/librepository-1.0.0.jar; then
11707                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11708             elif test -f /usr/share/java/librepository.jar; then
11709                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11710             else
11711                 AC_MSG_ERROR(librepository.jar replacement not found.)
11712             fi
11713         elif ! test -f $LIBREPOSITORY_JAR; then
11714             AC_MSG_ERROR(librepository.jar not found.)
11715         fi
11717         if test -z $LIBFONTS_JAR; then
11718             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11719                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11720             elif test -f /usr/share/java/libfonts.jar; then
11721                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11722             else
11723                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11724             fi
11725         elif ! test -f $LIBFONTS_JAR; then
11726                 AC_MSG_ERROR(libfonts.jar not found.)
11727         fi
11729         if test -z $LIBSERIALIZER_JAR; then
11730             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11731                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11732             elif test -f /usr/share/java/libserializer.jar; then
11733                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11734             else
11735                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11736             fi
11737         elif ! test -f $LIBSERIALIZER_JAR; then
11738                 AC_MSG_ERROR(libserializer.jar not found.)
11739         fi
11741         if test -z $LIBBASE_JAR; then
11742             if test -f /usr/share/java/libbase-1.0.0.jar; then
11743                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11744             elif test -f /usr/share/java/libbase.jar; then
11745                 LIBBASE_JAR=/usr/share/java/libbase.jar
11746             else
11747                 AC_MSG_ERROR(libbase.jar replacement not found.)
11748             fi
11749         elif ! test -f $LIBBASE_JAR; then
11750             AC_MSG_ERROR(libbase.jar not found.)
11751         fi
11753     else
11754         AC_MSG_RESULT([internal])
11755         SYSTEM_JFREEREPORT=
11756         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11757         NEED_ANT=TRUE
11758     fi
11759 else
11760     AC_MSG_RESULT([no])
11761     ENABLE_REPORTBUILDER=
11762     SYSTEM_JFREEREPORT=
11764 AC_SUBST(ENABLE_REPORTBUILDER)
11765 AC_SUBST(SYSTEM_JFREEREPORT)
11766 AC_SUBST(SAC_JAR)
11767 AC_SUBST(LIBXML_JAR)
11768 AC_SUBST(FLUTE_JAR)
11769 AC_SUBST(JFREEREPORT_JAR)
11770 AC_SUBST(LIBBASE_JAR)
11771 AC_SUBST(LIBLAYOUT_JAR)
11772 AC_SUBST(LIBLOADER_JAR)
11773 AC_SUBST(LIBFORMULA_JAR)
11774 AC_SUBST(LIBREPOSITORY_JAR)
11775 AC_SUBST(LIBFONTS_JAR)
11776 AC_SUBST(LIBSERIALIZER_JAR)
11778 # this has to be here because both the Wiki Publisher and the SRB use
11779 # commons-logging
11780 COMMONS_LOGGING_VERSION=1.2
11781 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11782     AC_MSG_CHECKING([which Apache commons-* libs to use])
11783     if test "$with_system_apache_commons" = "yes"; then
11784         SYSTEM_APACHE_COMMONS=TRUE
11785         AC_MSG_RESULT([external])
11786         if test -z $COMMONS_LOGGING_JAR; then
11787             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11788                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11789            elif test -f /usr/share/java/commons-logging.jar; then
11790                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11791             else
11792                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11793             fi
11794         elif ! test -f $COMMONS_LOGGING_JAR; then
11795             AC_MSG_ERROR(commons-logging.jar not found.)
11796         fi
11797     else
11798         AC_MSG_RESULT([internal])
11799         SYSTEM_APACHE_COMMONS=
11800         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11801         NEED_ANT=TRUE
11802     fi
11804 AC_SUBST(SYSTEM_APACHE_COMMONS)
11805 AC_SUBST(COMMONS_LOGGING_JAR)
11806 AC_SUBST(COMMONS_LOGGING_VERSION)
11808 # scripting provider for BeanShell?
11809 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11810 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11811     AC_MSG_RESULT([yes])
11812     ENABLE_SCRIPTING_BEANSHELL=TRUE
11814     dnl ===================================================================
11815     dnl Check for system beanshell
11816     dnl ===================================================================
11817     AC_MSG_CHECKING([which beanshell to use])
11818     if test "$with_system_beanshell" = "yes"; then
11819         AC_MSG_RESULT([external])
11820         SYSTEM_BSH=TRUE
11821         if test -z $BSH_JAR; then
11822             BSH_JAR=/usr/share/java/bsh.jar
11823         fi
11824         if ! test -f $BSH_JAR; then
11825             AC_MSG_ERROR(bsh.jar not found.)
11826         fi
11827     else
11828         AC_MSG_RESULT([internal])
11829         SYSTEM_BSH=
11830         BUILD_TYPE="$BUILD_TYPE BSH"
11831     fi
11832 else
11833     AC_MSG_RESULT([no])
11834     ENABLE_SCRIPTING_BEANSHELL=
11835     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11837 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11838 AC_SUBST(SYSTEM_BSH)
11839 AC_SUBST(BSH_JAR)
11841 # scripting provider for JavaScript?
11842 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11843 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11844     AC_MSG_RESULT([yes])
11845     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11847     dnl ===================================================================
11848     dnl Check for system rhino
11849     dnl ===================================================================
11850     AC_MSG_CHECKING([which rhino to use])
11851     if test "$with_system_rhino" = "yes"; then
11852         AC_MSG_RESULT([external])
11853         SYSTEM_RHINO=TRUE
11854         if test -z $RHINO_JAR; then
11855             RHINO_JAR=/usr/share/java/js.jar
11856         fi
11857         if ! test -f $RHINO_JAR; then
11858             AC_MSG_ERROR(js.jar not found.)
11859         fi
11860     else
11861         AC_MSG_RESULT([internal])
11862         SYSTEM_RHINO=
11863         BUILD_TYPE="$BUILD_TYPE RHINO"
11864         NEED_ANT=TRUE
11865     fi
11866 else
11867     AC_MSG_RESULT([no])
11868     ENABLE_SCRIPTING_JAVASCRIPT=
11869     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11871 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11872 AC_SUBST(SYSTEM_RHINO)
11873 AC_SUBST(RHINO_JAR)
11875 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11876 # paths should be added to library search path. So lets put all 64-bit
11877 # platforms there.
11878 supports_multilib=
11879 case "$host_cpu" in
11880 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11881     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11882         supports_multilib="yes"
11883     fi
11884     ;;
11886     ;;
11887 esac
11889 dnl ===================================================================
11890 dnl QT5 Integration
11891 dnl ===================================================================
11893 QT5_CFLAGS=""
11894 QT5_LIBS=""
11895 QMAKE5="qmake"
11896 MOC5="moc"
11897 QT5_GOBJECT_CFLAGS=""
11898 QT5_GOBJECT_LIBS=""
11899 QT5_HAVE_GOBJECT=""
11900 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11901         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11902         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11903 then
11904     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11905     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11907     if test -n "$supports_multilib"; then
11908         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11909     fi
11911     qt5_test_include="QtWidgets/qapplication.h"
11912     qt5_test_library="libQt5Widgets.so"
11914     dnl Check for qmake5
11915     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11916     if test "$QMAKE5" = "no"; then
11917         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11918     else
11919         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11920         if test -z "$qmake5_test_ver"; then
11921             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11922         fi
11923         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11924         qt5_minimal_minor="6"
11925         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11926             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11927         else
11928             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11929         fi
11930     fi
11932     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11933     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11935     AC_MSG_CHECKING([for Qt5 headers])
11936     qt5_incdir="no"
11937     for inc_dir in $qt5_incdirs; do
11938         if test -r "$inc_dir/$qt5_test_include"; then
11939             qt5_incdir="$inc_dir"
11940             break
11941         fi
11942     done
11943     AC_MSG_RESULT([$qt5_incdir])
11944     if test "x$qt5_incdir" = "xno"; then
11945         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11946     fi
11947     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
11948     AC_LANG_PUSH([C++])
11949     save_CPPFLAGS=$CPPFLAGS
11950     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
11951     AC_CHECK_HEADER(QtCore/qconfig.h, [],
11952         [AC_MSG_ERROR(qconfig.h header not found.)], [])
11953     CPPFLAGS=$save_CPPFLAGS
11954     AC_LANG_POP([C++])
11956     AC_MSG_CHECKING([for Qt5 libraries])
11957     qt5_libdir="no"
11958     for lib_dir in $qt5_libdirs; do
11959         if test -r "$lib_dir/$qt5_test_library"; then
11960             qt5_libdir="$lib_dir"
11961             break
11962         fi
11963     done
11964     AC_MSG_RESULT([$qt5_libdir])
11965     if test "x$qt5_libdir" = "xno"; then
11966         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11967     fi
11969     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11970     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11971     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11973     if test "$USING_X11" = TRUE; then
11974         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11975         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11976             QT5_HAVE_XCB_ICCCM=1
11977             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11978         ],[
11979             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)])
11980             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11981         ])
11982         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11983         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11984         QT5_USING_X11=1
11985         AC_DEFINE(QT5_USING_X11)
11986     fi
11988     dnl Check for Meta Object Compiler
11990     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11991     if test "$MOC5" = "no"; then
11992         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11993 the root of your Qt installation by exporting QT5DIR before running "configure".])
11994     fi
11996     if test "$build_gstreamer_1_0" = "yes"; then
11997         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11998                 QT5_HAVE_GOBJECT=1
11999                 AC_DEFINE(QT5_HAVE_GOBJECT)
12000             ],
12001             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12002         )
12003     fi
12005 AC_SUBST(QT5_CFLAGS)
12006 AC_SUBST(QT5_LIBS)
12007 AC_SUBST(MOC5)
12008 AC_SUBST(QT5_GOBJECT_CFLAGS)
12009 AC_SUBST(QT5_GOBJECT_LIBS)
12010 AC_SUBST(QT5_HAVE_GOBJECT)
12012 dnl ===================================================================
12013 dnl KF5 Integration
12014 dnl ===================================================================
12016 KF5_CFLAGS=""
12017 KF5_LIBS=""
12018 KF5_CONFIG="kf5-config"
12019 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12020         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12021 then
12022     if test "$OS" = "HAIKU"; then
12023         haiku_arch="`echo $RTL_ARCH | tr X x`"
12024         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12025         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12026     fi
12028     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12029     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12030     if test -n "$supports_multilib"; then
12031         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12032     fi
12034     kf5_test_include="KF5/kcoreaddons_version.h"
12035     kf5_test_library="libKF5CoreAddons.so"
12036     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12038     dnl kf5 KDE4 support compatibility installed
12039     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12040     if test "$KF5_CONFIG" != "no"; then
12041         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12042         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12043     fi
12045     dnl Check for KF5 headers
12046     AC_MSG_CHECKING([for KF5 headers])
12047     kf5_incdir="no"
12048     for kf5_check in $kf5_incdirs; do
12049         if test -r "$kf5_check/$kf5_test_include"; then
12050             kf5_incdir="$kf5_check/KF5"
12051             break
12052         fi
12053     done
12054     AC_MSG_RESULT([$kf5_incdir])
12055     if test "x$kf5_incdir" = "xno"; then
12056         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12057     fi
12059     dnl Check for KF5 libraries
12060     AC_MSG_CHECKING([for KF5 libraries])
12061     kf5_libdir="no"
12062     for kf5_check in $kf5_libdirs; do
12063         if test -r "$kf5_check/$kf5_test_library"; then
12064             kf5_libdir="$kf5_check"
12065             break
12066         fi
12067     done
12069     AC_MSG_RESULT([$kf5_libdir])
12070     if test "x$kf5_libdir" = "xno"; then
12071         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12072     fi
12074     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"
12075     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12076     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12078     if test "$USING_X11" = TRUE; then
12079         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12080     fi
12082     AC_LANG_PUSH([C++])
12083     save_CXXFLAGS=$CXXFLAGS
12084     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12085     AC_MSG_CHECKING([whether KDE is >= 5.0])
12086        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12087 #include <kcoreaddons_version.h>
12089 int main(int argc, char **argv) {
12090        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12091        else return 1;
12093        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12094     CXXFLAGS=$save_CXXFLAGS
12095     AC_LANG_POP([C++])
12097 AC_SUBST(KF5_CFLAGS)
12098 AC_SUBST(KF5_LIBS)
12100 dnl ===================================================================
12101 dnl Test whether to include Evolution 2 support
12102 dnl ===================================================================
12103 AC_MSG_CHECKING([whether to enable evolution 2 support])
12104 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
12105     AC_MSG_RESULT([yes])
12106     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12107     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12108     FilterLibs "${GOBJECT_LIBS}"
12109     GOBJECT_LIBS="${filteredlibs}"
12110     ENABLE_EVOAB2="TRUE"
12111 else
12112     ENABLE_EVOAB2=""
12113     AC_MSG_RESULT([no])
12115 AC_SUBST(ENABLE_EVOAB2)
12116 AC_SUBST(GOBJECT_CFLAGS)
12117 AC_SUBST(GOBJECT_LIBS)
12119 dnl ===================================================================
12120 dnl Test which themes to include
12121 dnl ===================================================================
12122 AC_MSG_CHECKING([which themes to include])
12123 # if none given use default subset of available themes
12124 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12125     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"
12128 WITH_THEMES=""
12129 if test "x$with_theme" != "xno"; then
12130     for theme in $with_theme; do
12131         case $theme in
12132         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" ;;
12133         default) real_theme=colibre ;;
12134         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12135         esac
12136         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12137     done
12139 AC_MSG_RESULT([$WITH_THEMES])
12140 AC_SUBST([WITH_THEMES])
12141 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12142 for theme in $with_theme; do
12143     case $theme in
12144     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12145     *) ;;
12146     esac
12147 done
12149 dnl ===================================================================
12150 dnl Test whether to integrate helppacks into the product's installer
12151 dnl ===================================================================
12152 AC_MSG_CHECKING([for helppack integration])
12153 if test "$with_helppack_integration" = "no"; then
12154     AC_MSG_RESULT([no integration])
12155 else
12156     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12157     AC_MSG_RESULT([integration])
12160 ###############################################################################
12161 # Extensions checking
12162 ###############################################################################
12163 AC_MSG_CHECKING([for extensions integration])
12164 if test "x$enable_extension_integration" != "xno"; then
12165     WITH_EXTENSION_INTEGRATION=TRUE
12166     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12167     AC_MSG_RESULT([yes, use integration])
12168 else
12169     WITH_EXTENSION_INTEGRATION=
12170     AC_MSG_RESULT([no, do not integrate])
12172 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12174 dnl Should any extra extensions be included?
12175 dnl There are standalone tests for each of these below.
12176 WITH_EXTRA_EXTENSIONS=
12177 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12179 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12180 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12181 if test "x$with_java" != "xno"; then
12182     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12183     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12186 AC_MSG_CHECKING([whether to build opens___.ttf])
12187 if test "$enable_build_opensymbol" = "yes"; then
12188     AC_MSG_RESULT([yes])
12189     AC_PATH_PROG(FONTFORGE, fontforge)
12190     if test -z "$FONTFORGE"; then
12191         AC_MSG_ERROR([fontforge not installed])
12192     fi
12193 else
12194     AC_MSG_RESULT([no])
12195     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
12196     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12198 AC_SUBST(OPENSYMBOL_TTF)
12199 AC_SUBST(FONTFORGE)
12201 dnl ===================================================================
12202 dnl Test whether to include fonts
12203 dnl ===================================================================
12204 AC_MSG_CHECKING([whether to include third-party fonts])
12205 if test "$with_fonts" != "no"; then
12206     AC_MSG_RESULT([yes])
12207     WITH_FONTS=TRUE
12208     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12209     AC_DEFINE(HAVE_MORE_FONTS)
12210 else
12211     AC_MSG_RESULT([no])
12212     WITH_FONTS=
12213     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12215 AC_SUBST(WITH_FONTS)
12218 dnl ===================================================================
12219 dnl Test whether to enable online update service
12220 dnl ===================================================================
12221 AC_MSG_CHECKING([whether to enable online update])
12222 ENABLE_ONLINE_UPDATE=
12223 ENABLE_ONLINE_UPDATE_MAR=
12224 UPDATE_CONFIG=
12225 if test "$enable_online_update" = ""; then
12226     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12227         AC_MSG_RESULT([yes])
12228         ENABLE_ONLINE_UPDATE="TRUE"
12229     else
12230         AC_MSG_RESULT([no])
12231     fi
12232 else
12233     if test "$enable_online_update" = "mar"; then
12234         AC_MSG_RESULT([yes - MAR-based online update])
12235         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12236         if test "$with_update_config" = ""; then
12237             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12238         fi
12239         UPDATE_CONFIG="$with_update_config"
12240         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12241     elif test "$enable_online_update" = "yes"; then
12242         AC_MSG_RESULT([yes])
12243         ENABLE_ONLINE_UPDATE="TRUE"
12244     else
12245         AC_MSG_RESULT([no])
12246     fi
12248 AC_SUBST(ENABLE_ONLINE_UPDATE)
12249 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
12250 AC_SUBST(UPDATE_CONFIG)
12252 dnl ===================================================================
12253 dnl Test whether we need bzip2
12254 dnl ===================================================================
12255 SYSTEM_BZIP2=
12256 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
12257     AC_MSG_CHECKING([whether to use system bzip2])
12258     if test "$with_system_bzip2" = yes; then
12259         SYSTEM_BZIP2=TRUE
12260         AC_MSG_RESULT([yes])
12261         PKG_CHECK_MODULES(BZIP2, bzip2)
12262         FilterLibs "${BZIP2_LIBS}"
12263         BZIP2_LIBS="${filteredlibs}"
12264     else
12265         AC_MSG_RESULT([no])
12266         BUILD_TYPE="$BUILD_TYPE BZIP2"
12267     fi
12269 AC_SUBST(SYSTEM_BZIP2)
12270 AC_SUBST(BZIP2_CFLAGS)
12271 AC_SUBST(BZIP2_LIBS)
12273 dnl ===================================================================
12274 dnl Test whether to enable extension update
12275 dnl ===================================================================
12276 AC_MSG_CHECKING([whether to enable extension update])
12277 ENABLE_EXTENSION_UPDATE=
12278 if test "x$enable_extension_update" = "xno"; then
12279     AC_MSG_RESULT([no])
12280 else
12281     AC_MSG_RESULT([yes])
12282     ENABLE_EXTENSION_UPDATE="TRUE"
12283     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
12284     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
12286 AC_SUBST(ENABLE_EXTENSION_UPDATE)
12289 dnl ===================================================================
12290 dnl Test whether to create MSI with LIMITUI=1 (silent install)
12291 dnl ===================================================================
12292 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
12293 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
12294     AC_MSG_RESULT([no])
12295     ENABLE_SILENT_MSI=
12296 else
12297     AC_MSG_RESULT([yes])
12298     ENABLE_SILENT_MSI=TRUE
12299     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
12301 AC_SUBST(ENABLE_SILENT_MSI)
12303 AC_MSG_CHECKING([whether and how to use Xinerama])
12304 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
12305     if test "$x_libraries" = "default_x_libraries"; then
12306         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
12307         if test "x$XINERAMALIB" = x; then
12308            XINERAMALIB="/usr/lib"
12309         fi
12310     else
12311         XINERAMALIB="$x_libraries"
12312     fi
12313     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
12314         # we have both versions, let the user decide but use the dynamic one
12315         # per default
12316         USE_XINERAMA=TRUE
12317         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
12318             XINERAMA_LINK=dynamic
12319         else
12320             XINERAMA_LINK=static
12321         fi
12322     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
12323         # we have only the dynamic version
12324         USE_XINERAMA=TRUE
12325         XINERAMA_LINK=dynamic
12326     elif test -e "$XINERAMALIB/libXinerama.a"; then
12327         # static version
12328         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
12329             USE_XINERAMA=TRUE
12330             XINERAMA_LINK=static
12331         else
12332             USE_XINERAMA=
12333             XINERAMA_LINK=none
12334         fi
12335     else
12336         # no Xinerama
12337         USE_XINERAMA=
12338         XINERAMA_LINK=none
12339     fi
12340     if test "$USE_XINERAMA" = "TRUE"; then
12341         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
12342         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
12343             [AC_MSG_ERROR(Xinerama header not found.)], [])
12344         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
12345         if test "x$XEXTLIB" = x; then
12346            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
12347         fi
12348         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
12349         if test "$_os" = "FreeBSD"; then
12350             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
12351         fi
12352         if test "$_os" = "Linux"; then
12353             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
12354         fi
12355         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
12356             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
12357     else
12358         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
12359     fi
12360 else
12361     USE_XINERAMA=
12362     XINERAMA_LINK=none
12363     AC_MSG_RESULT([no])
12365 AC_SUBST(USE_XINERAMA)
12366 AC_SUBST(XINERAMA_LINK)
12368 dnl ===================================================================
12369 dnl Test whether to build cairo or rely on the system version
12370 dnl ===================================================================
12372 if test "$USING_X11" = TRUE; then
12373     # Used in vcl/Library_vclplug_gen.mk
12374     test_cairo=yes
12377 if test "$test_cairo" = "yes"; then
12378     AC_MSG_CHECKING([whether to use the system cairo])
12380     : ${with_system_cairo:=$with_system_libs}
12381     if test "$with_system_cairo" = "yes"; then
12382         SYSTEM_CAIRO=TRUE
12383         AC_MSG_RESULT([yes])
12385         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
12386         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12387         FilterLibs "${CAIRO_LIBS}"
12388         CAIRO_LIBS="${filteredlibs}"
12390         if test "$test_xrender" = "yes"; then
12391             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
12392             AC_LANG_PUSH([C])
12393             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
12394 #ifdef PictStandardA8
12395 #else
12396       return fail;
12397 #endif
12398 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
12400             AC_LANG_POP([C])
12401         fi
12402     else
12403         SYSTEM_CAIRO=
12404         AC_MSG_RESULT([no])
12406         BUILD_TYPE="$BUILD_TYPE CAIRO"
12407     fi
12410 AC_SUBST(SYSTEM_CAIRO)
12411 AC_SUBST(CAIRO_CFLAGS)
12412 AC_SUBST(CAIRO_LIBS)
12414 dnl ===================================================================
12415 dnl Test whether to use avahi
12416 dnl ===================================================================
12417 if test "$_os" = "WINNT"; then
12418     # Windows uses bundled mDNSResponder
12419     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
12420 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12421     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12422                       [ENABLE_AVAHI="TRUE"])
12423     AC_DEFINE(HAVE_FEATURE_AVAHI)
12424     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12425     FilterLibs "${AVAHI_LIBS}"
12426     AVAHI_LIBS="${filteredlibs}"
12429 AC_SUBST(ENABLE_AVAHI)
12430 AC_SUBST(AVAHI_CFLAGS)
12431 AC_SUBST(AVAHI_LIBS)
12433 dnl ===================================================================
12434 dnl Test whether to use liblangtag
12435 dnl ===================================================================
12436 SYSTEM_LIBLANGTAG=
12437 AC_MSG_CHECKING([whether to use system liblangtag])
12438 if test "$with_system_liblangtag" = yes; then
12439     SYSTEM_LIBLANGTAG=TRUE
12440     AC_MSG_RESULT([yes])
12441     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12442     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12443     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12444     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12445     FilterLibs "${LIBLANGTAG_LIBS}"
12446     LIBLANGTAG_LIBS="${filteredlibs}"
12447 else
12448     SYSTEM_LIBLANGTAG=
12449     AC_MSG_RESULT([no])
12450     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12451     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12452     if test "$COM" = "MSC"; then
12453         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12454     else
12455         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12456     fi
12458 AC_SUBST(SYSTEM_LIBLANGTAG)
12459 AC_SUBST(LIBLANGTAG_CFLAGS)
12460 AC_SUBST(LIBLANGTAG_LIBS)
12462 dnl ===================================================================
12463 dnl Test whether to build libpng or rely on the system version
12464 dnl ===================================================================
12466 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12468 dnl ===================================================================
12469 dnl Check for runtime JVM search path
12470 dnl ===================================================================
12471 if test "$ENABLE_JAVA" != ""; then
12472     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12473     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12474         AC_MSG_RESULT([yes])
12475         if ! test -d "$with_jvm_path"; then
12476             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12477         fi
12478         if ! test -d "$with_jvm_path"jvm; then
12479             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12480         fi
12481         JVM_ONE_PATH_CHECK="$with_jvm_path"
12482         AC_SUBST(JVM_ONE_PATH_CHECK)
12483     else
12484         AC_MSG_RESULT([no])
12485     fi
12488 dnl ===================================================================
12489 dnl Test for the presence of Ant and that it works
12490 dnl ===================================================================
12492 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12493     ANT_HOME=; export ANT_HOME
12494     WITH_ANT_HOME=; export WITH_ANT_HOME
12495     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12496         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12497             if test "$_os" = "WINNT"; then
12498                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12499             else
12500                 with_ant_home="$LODE_HOME/opt/ant"
12501             fi
12502         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12503             with_ant_home="$LODE_HOME/opt/ant"
12504         fi
12505     fi
12506     if test -z "$with_ant_home"; then
12507         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12508     else
12509         if test "$_os" = "WINNT"; then
12510             # AC_PATH_PROGS needs unix path
12511             with_ant_home=`cygpath -u "$with_ant_home"`
12512         fi
12513         AbsolutePath "$with_ant_home"
12514         with_ant_home=$absolute_path
12515         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12516         WITH_ANT_HOME=$with_ant_home
12517         ANT_HOME=$with_ant_home
12518     fi
12520     if test -z "$ANT"; then
12521         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12522     else
12523         # resolve relative or absolute symlink
12524         while test -h "$ANT"; do
12525             a_cwd=`pwd`
12526             a_basename=`basename "$ANT"`
12527             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12528             cd "`dirname "$ANT"`"
12529             cd "`dirname "$a_script"`"
12530             ANT="`pwd`"/"`basename "$a_script"`"
12531             cd "$a_cwd"
12532         done
12534         AC_MSG_CHECKING([if $ANT works])
12535         mkdir -p conftest.dir
12536         a_cwd=$(pwd)
12537         cd conftest.dir
12538         cat > conftest.java << EOF
12539         public class conftest {
12540             int testmethod(int a, int b) {
12541                     return a + b;
12542             }
12543         }
12546         cat > conftest.xml << EOF
12547         <project name="conftest" default="conftest">
12548         <target name="conftest">
12549             <javac srcdir="." includes="conftest.java">
12550             </javac>
12551         </target>
12552         </project>
12555         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12556         if test $? = 0 -a -f ./conftest.class; then
12557             AC_MSG_RESULT([Ant works])
12558             if test -z "$WITH_ANT_HOME"; then
12559                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12560                 if test -z "$ANT_HOME"; then
12561                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12562                 fi
12563             else
12564                 ANT_HOME="$WITH_ANT_HOME"
12565             fi
12566         else
12567             echo "configure: Ant test failed" >&5
12568             cat conftest.java >&5
12569             cat conftest.xml >&5
12570             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12571         fi
12572         cd "$a_cwd"
12573         rm -fr conftest.dir
12574     fi
12575     if test -z "$ANT_HOME"; then
12576         ANT_HOME="NO_ANT_HOME"
12577     else
12578         PathFormat "$ANT_HOME"
12579         ANT_HOME="$formatted_path"
12580         PathFormat "$ANT"
12581         ANT="$formatted_path"
12582     fi
12583     AC_SUBST(ANT_HOME)
12584     AC_SUBST(ANT)
12586     dnl Checking for ant.jar
12587     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12588         AC_MSG_CHECKING([Ant lib directory])
12589         if test -f $ANT_HOME/lib/ant.jar; then
12590             ANT_LIB="$ANT_HOME/lib"
12591         else
12592             if test -f $ANT_HOME/ant.jar; then
12593                 ANT_LIB="$ANT_HOME"
12594             else
12595                 if test -f /usr/share/java/ant.jar; then
12596                     ANT_LIB=/usr/share/java
12597                 else
12598                     if test -f /usr/share/ant-core/lib/ant.jar; then
12599                         ANT_LIB=/usr/share/ant-core/lib
12600                     else
12601                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12602                             ANT_LIB="$ANT_HOME/lib/ant"
12603                         else
12604                             if test -f /usr/share/lib/ant/ant.jar; then
12605                                 ANT_LIB=/usr/share/lib/ant
12606                             else
12607                                 AC_MSG_ERROR([Ant libraries not found!])
12608                             fi
12609                         fi
12610                     fi
12611                 fi
12612             fi
12613         fi
12614         PathFormat "$ANT_LIB"
12615         ANT_LIB="$formatted_path"
12616         AC_MSG_RESULT([Ant lib directory found.])
12617     fi
12618     AC_SUBST(ANT_LIB)
12620     ant_minver=1.6.0
12621     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12623     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12624     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12625     ant_version_major=`echo $ant_version | cut -d. -f1`
12626     ant_version_minor=`echo $ant_version | cut -d. -f2`
12627     echo "configure: ant_version $ant_version " >&5
12628     echo "configure: ant_version_major $ant_version_major " >&5
12629     echo "configure: ant_version_minor $ant_version_minor " >&5
12630     if test "$ant_version_major" -ge "2"; then
12631         AC_MSG_RESULT([yes, $ant_version])
12632     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12633         AC_MSG_RESULT([yes, $ant_version])
12634     else
12635         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12636     fi
12638     rm -f conftest* core core.* *.core
12641 OOO_JUNIT_JAR=
12642 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12643     AC_MSG_CHECKING([for JUnit 4])
12644     if test "$with_junit" = "yes"; then
12645         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12646             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12647         elif test -e /usr/share/java/junit4.jar; then
12648             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12649         else
12650            if test -e /usr/share/lib/java/junit.jar; then
12651               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12652            else
12653               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12654            fi
12655         fi
12656     else
12657         OOO_JUNIT_JAR=$with_junit
12658     fi
12659     if test "$_os" = "WINNT"; then
12660         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12661     fi
12662     printf 'import org.junit.Before;' > conftest.java
12663     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12664         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12665     else
12666         AC_MSG_ERROR(
12667 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12668  specify its pathname via --with-junit=..., or disable it via --without-junit])
12669     fi
12670     rm -f conftest.class conftest.java
12671     if test $OOO_JUNIT_JAR != ""; then
12672     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12673     fi
12675 AC_SUBST(OOO_JUNIT_JAR)
12677 HAMCREST_JAR=
12678 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12679     AC_MSG_CHECKING([for included Hamcrest])
12680     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12681     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12682         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12683     else
12684         AC_MSG_RESULT([Not included])
12685         AC_MSG_CHECKING([for standalone hamcrest jar.])
12686         if test "$with_hamcrest" = "yes"; then
12687             if test -e /usr/share/lib/java/hamcrest.jar; then
12688                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12689             elif test -e /usr/share/java/hamcrest/core.jar; then
12690                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12691             else
12692                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12693             fi
12694         else
12695             HAMCREST_JAR=$with_hamcrest
12696         fi
12697         if test "$_os" = "WINNT"; then
12698             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12699         fi
12700         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12701             AC_MSG_RESULT([$HAMCREST_JAR])
12702         else
12703             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),
12704                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12705         fi
12706     fi
12707     rm -f conftest.class conftest.java
12709 AC_SUBST(HAMCREST_JAR)
12712 AC_SUBST(SCPDEFS)
12715 # check for wget and curl
12717 WGET=
12718 CURL=
12720 if test "$enable_fetch_external" != "no"; then
12722 CURL=`which curl 2>/dev/null`
12724 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12725     # wget new enough?
12726     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12727     if test $? -eq 0; then
12728         WGET=$i
12729         break
12730     fi
12731 done
12733 if test -z "$WGET" -a -z "$CURL"; then
12734     AC_MSG_ERROR([neither wget nor curl found!])
12739 AC_SUBST(WGET)
12740 AC_SUBST(CURL)
12743 # check for sha256sum
12745 SHA256SUM=
12747 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12748     eval "$i -a 256 --version" > /dev/null 2>&1
12749     ret=$?
12750     if test $ret -eq 0; then
12751         SHA256SUM="$i -a 256"
12752         break
12753     fi
12754 done
12756 if test -z "$SHA256SUM"; then
12757     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12758         eval "$i --version" > /dev/null 2>&1
12759         ret=$?
12760         if test $ret -eq 0; then
12761             SHA256SUM=$i
12762             break
12763         fi
12764     done
12767 if test -z "$SHA256SUM"; then
12768     AC_MSG_ERROR([no sha256sum found!])
12771 AC_SUBST(SHA256SUM)
12773 dnl ===================================================================
12774 dnl Dealing with l10n options
12775 dnl ===================================================================
12776 AC_MSG_CHECKING([which languages to be built])
12777 # get list of all languages
12778 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12779 # the sed command does the following:
12780 #   + if a line ends with a backslash, append the next line to it
12781 #   + adds " on the beginning of the value (after =)
12782 #   + adds " at the end of the value
12783 #   + removes en-US; we want to put it on the beginning
12784 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12785 [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)]
12786 ALL_LANGS="en-US $completelangiso"
12787 # check the configured localizations
12788 WITH_LANG="$with_lang"
12790 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12791 # (Norwegian is "nb" and "nn".)
12792 if test "$WITH_LANG" = "no"; then
12793     WITH_LANG=
12796 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12797     AC_MSG_RESULT([en-US])
12798 else
12799     AC_MSG_RESULT([$WITH_LANG])
12800     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12801     if test -z "$MSGFMT"; then
12802         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12803             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12804         elif test -x "/opt/lo/bin/msgfmt"; then
12805             MSGFMT="/opt/lo/bin/msgfmt"
12806         else
12807             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12808             if test -z "$MSGFMT"; then
12809                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12810             fi
12811         fi
12812     fi
12813     if test -z "$MSGUNIQ"; then
12814         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12815             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12816         elif test -x "/opt/lo/bin/msguniq"; then
12817             MSGUNIQ="/opt/lo/bin/msguniq"
12818         else
12819             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12820             if test -z "$MSGUNIQ"; then
12821                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12822             fi
12823         fi
12824     fi
12826 AC_SUBST(MSGFMT)
12827 AC_SUBST(MSGUNIQ)
12828 # check that the list is valid
12829 for lang in $WITH_LANG; do
12830     test "$lang" = "ALL" && continue
12831     # need to check for the exact string, so add space before and after the list of all languages
12832     for vl in $ALL_LANGS; do
12833         if test "$vl" = "$lang"; then
12834            break
12835         fi
12836     done
12837     if test "$vl" != "$lang"; then
12838         # if you're reading this - you prolly quoted your languages remove the quotes ...
12839         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12840     fi
12841 done
12842 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12843     echo $WITH_LANG | grep -q en-US
12844     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12846 # list with substituted ALL
12847 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12848 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12849 test "$WITH_LANG" = "en-US" && WITH_LANG=
12850 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12851     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12852     ALL_LANGS=`echo $ALL_LANGS qtz`
12854 AC_SUBST(ALL_LANGS)
12855 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12856 AC_SUBST(WITH_LANG)
12857 AC_SUBST(WITH_LANG_LIST)
12858 AC_SUBST(GIT_NEEDED_SUBMODULES)
12860 WITH_POOR_HELP_LOCALIZATIONS=
12861 if test -d "$SRC_ROOT/translations/source"; then
12862     for l in `ls -1 $SRC_ROOT/translations/source`; do
12863         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12864             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12865         fi
12866     done
12868 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12870 if test -n "$with_locales"; then
12871     WITH_LOCALES="$with_locales"
12873     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12874     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12875     # config_host/config_locales.h.in
12876     for locale in $WITH_LOCALES; do
12877         lang=${locale%_*}
12879         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12881         case $lang in
12882         hi|mr*ne)
12883             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12884             ;;
12885         bg|ru)
12886             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12887             ;;
12888         esac
12889     done
12890 else
12891     AC_DEFINE(WITH_LOCALE_ALL)
12893 AC_SUBST(WITH_LOCALES)
12895 dnl git submodule update --reference
12896 dnl ===================================================================
12897 if test -n "${GIT_REFERENCE_SRC}"; then
12898     for repo in ${GIT_NEEDED_SUBMODULES}; do
12899         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12900             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12901         fi
12902     done
12904 AC_SUBST(GIT_REFERENCE_SRC)
12906 dnl git submodules linked dirs
12907 dnl ===================================================================
12908 if test -n "${GIT_LINK_SRC}"; then
12909     for repo in ${GIT_NEEDED_SUBMODULES}; do
12910         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12911             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12912         fi
12913     done
12915 AC_SUBST(GIT_LINK_SRC)
12917 dnl branding
12918 dnl ===================================================================
12919 AC_MSG_CHECKING([for alternative branding images directory])
12920 # initialize mapped arrays
12921 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
12922 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg about.svg"
12924 if test -z "$with_branding" -o "$with_branding" = "no"; then
12925     AC_MSG_RESULT([none])
12926     DEFAULT_BRAND_IMAGES="$brand_files"
12927 else
12928     if ! test -d $with_branding ; then
12929         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12930     else
12931         AC_MSG_RESULT([$with_branding])
12932         CUSTOM_BRAND_DIR="$with_branding"
12933         for lfile in $brand_files
12934         do
12935             if ! test -f $with_branding/$lfile ; then
12936                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12937                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12938             else
12939                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12940             fi
12941         done
12942         check_for_progress="yes"
12943     fi
12945 AC_SUBST([BRAND_INTRO_IMAGES])
12946 AC_SUBST([CUSTOM_BRAND_DIR])
12947 AC_SUBST([CUSTOM_BRAND_IMAGES])
12948 AC_SUBST([DEFAULT_BRAND_IMAGES])
12951 AC_MSG_CHECKING([for 'intro' progress settings])
12952 PROGRESSBARCOLOR=
12953 PROGRESSSIZE=
12954 PROGRESSPOSITION=
12955 PROGRESSFRAMECOLOR=
12956 PROGRESSTEXTCOLOR=
12957 PROGRESSTEXTBASELINE=
12959 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12960     source "$with_branding/progress.conf"
12961     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12962 else
12963     AC_MSG_RESULT([none])
12966 AC_SUBST(PROGRESSBARCOLOR)
12967 AC_SUBST(PROGRESSSIZE)
12968 AC_SUBST(PROGRESSPOSITION)
12969 AC_SUBST(PROGRESSFRAMECOLOR)
12970 AC_SUBST(PROGRESSTEXTCOLOR)
12971 AC_SUBST(PROGRESSTEXTBASELINE)
12974 dnl ===================================================================
12975 dnl Custom build version
12976 dnl ===================================================================
12977 AC_MSG_CHECKING([for extra build ID])
12978 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12979     EXTRA_BUILDID="$with_extra_buildid"
12981 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12982 if test -n "$EXTRA_BUILDID" ; then
12983     AC_MSG_RESULT([$EXTRA_BUILDID])
12984 else
12985     AC_MSG_RESULT([not set])
12987 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12989 OOO_VENDOR=
12990 AC_MSG_CHECKING([for vendor])
12991 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12992     OOO_VENDOR="$USERNAME"
12994     if test -z "$OOO_VENDOR"; then
12995         OOO_VENDOR="$USER"
12996     fi
12998     if test -z "$OOO_VENDOR"; then
12999         OOO_VENDOR="`id -u -n`"
13000     fi
13002     AC_MSG_RESULT([not set, using $OOO_VENDOR])
13003 else
13004     OOO_VENDOR="$with_vendor"
13005     AC_MSG_RESULT([$OOO_VENDOR])
13007 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13008 AC_SUBST(OOO_VENDOR)
13010 if test "$_os" = "Android" ; then
13011     ANDROID_PACKAGE_NAME=
13012     AC_MSG_CHECKING([for Android package name])
13013     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13014         if test -n "$ENABLE_DEBUG"; then
13015             # Default to the package name that makes ndk-gdb happy.
13016             ANDROID_PACKAGE_NAME="org.libreoffice"
13017         else
13018             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13019         fi
13021         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13022     else
13023         ANDROID_PACKAGE_NAME="$with_android_package_name"
13024         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13025     fi
13026     AC_SUBST(ANDROID_PACKAGE_NAME)
13029 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13030 if test "$with_compat_oowrappers" = "yes"; then
13031     WITH_COMPAT_OOWRAPPERS=TRUE
13032     AC_MSG_RESULT(yes)
13033 else
13034     WITH_COMPAT_OOWRAPPERS=
13035     AC_MSG_RESULT(no)
13037 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13039 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
13040 AC_MSG_CHECKING([for install dirname])
13041 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13042     INSTALLDIRNAME="$with_install_dirname"
13044 AC_MSG_RESULT([$INSTALLDIRNAME])
13045 AC_SUBST(INSTALLDIRNAME)
13047 AC_MSG_CHECKING([for prefix])
13048 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13049 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13050 PREFIXDIR="$prefix"
13051 AC_MSG_RESULT([$PREFIXDIR])
13052 AC_SUBST(PREFIXDIR)
13054 LIBDIR=[$(eval echo $(eval echo $libdir))]
13055 AC_SUBST(LIBDIR)
13057 DATADIR=[$(eval echo $(eval echo $datadir))]
13058 AC_SUBST(DATADIR)
13060 MANDIR=[$(eval echo $(eval echo $mandir))]
13061 AC_SUBST(MANDIR)
13063 DOCDIR=[$(eval echo $(eval echo $docdir))]
13064 AC_SUBST(DOCDIR)
13066 BINDIR=[$(eval echo $(eval echo $bindir))]
13067 AC_SUBST(BINDIR)
13069 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13070 AC_SUBST(INSTALLDIR)
13072 TESTINSTALLDIR="${BUILDDIR}/test-install"
13073 AC_SUBST(TESTINSTALLDIR)
13076 # ===================================================================
13077 # OAuth2 id and secrets
13078 # ===================================================================
13080 AC_MSG_CHECKING([for Google Drive client id and secret])
13081 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13082     AC_MSG_RESULT([not set])
13083     GDRIVE_CLIENT_ID="\"\""
13084     GDRIVE_CLIENT_SECRET="\"\""
13085 else
13086     AC_MSG_RESULT([set])
13087     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13088     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13090 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13091 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13093 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13094 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13095     AC_MSG_RESULT([not set])
13096     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13097     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13098 else
13099     AC_MSG_RESULT([set])
13100     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13101     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13103 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13104 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13106 AC_MSG_CHECKING([for OneDrive client id and secret])
13107 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13108     AC_MSG_RESULT([not set])
13109     ONEDRIVE_CLIENT_ID="\"\""
13110     ONEDRIVE_CLIENT_SECRET="\"\""
13111 else
13112     AC_MSG_RESULT([set])
13113     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13114     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13116 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13117 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13120 dnl ===================================================================
13121 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13122 dnl --enable-dependency-tracking configure option
13123 dnl ===================================================================
13124 AC_MSG_CHECKING([whether to enable dependency tracking])
13125 if test "$enable_dependency_tracking" = "no"; then
13126     nodep=TRUE
13127     AC_MSG_RESULT([no])
13128 else
13129     AC_MSG_RESULT([yes])
13131 AC_SUBST(nodep)
13133 dnl ===================================================================
13134 dnl Number of CPUs to use during the build
13135 dnl ===================================================================
13136 AC_MSG_CHECKING([for number of processors to use])
13137 # plain --with-parallelism is just the default
13138 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13139     if test "$with_parallelism" = "no"; then
13140         PARALLELISM=0
13141     else
13142         PARALLELISM=$with_parallelism
13143     fi
13144 else
13145     if test "$enable_icecream" = "yes"; then
13146         PARALLELISM="40"
13147     else
13148         case `uname -s` in
13150         Darwin|FreeBSD|NetBSD|OpenBSD)
13151             PARALLELISM=`sysctl -n hw.ncpu`
13152             ;;
13154         Linux)
13155             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13156         ;;
13157         # what else than above does profit here *and* has /proc?
13158         *)
13159             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13160             ;;
13161         esac
13163         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13164         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13165     fi
13168 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13169     if test -z "$with_parallelism"; then
13170             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13171             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13172             PARALLELISM="1"
13173     else
13174         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."
13175     fi
13178 if test $PARALLELISM -eq 0; then
13179     AC_MSG_RESULT([explicit make -j option needed])
13180 else
13181     AC_MSG_RESULT([$PARALLELISM])
13183 AC_SUBST(PARALLELISM)
13185 IWYU_PATH="$with_iwyu"
13186 AC_SUBST(IWYU_PATH)
13187 if test ! -z "$IWYU_PATH"; then
13188     if test ! -f "$IWYU_PATH"; then
13189         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13190     fi
13194 # Set up ILIB for MSVC build
13196 ILIB1=
13197 if test "$build_os" = "cygwin"; then
13198     ILIB="."
13199     if test -n "$JAVA_HOME"; then
13200         ILIB="$ILIB;$JAVA_HOME/lib"
13201     fi
13202     ILIB1=-link
13203     if test "$BITNESS_OVERRIDE" = 64; then
13204         ILIB="$ILIB;$COMPATH/lib/x64"
13205         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
13206         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
13207         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
13208         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13209             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
13210             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
13211         fi
13212         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
13213         ucrtlibpath_formatted=$formatted_path
13214         ILIB="$ILIB;$ucrtlibpath_formatted"
13215         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13216     else
13217         ILIB="$ILIB;$COMPATH/lib/x86"
13218         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
13219         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
13220         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
13221         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13222             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
13223             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
13224         fi
13225         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
13226         ucrtlibpath_formatted=$formatted_path
13227         ILIB="$ILIB;$ucrtlibpath_formatted"
13228         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13229     fi
13230     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13231         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13232     else
13233         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
13234     fi
13236     AC_SUBST(ILIB)
13239 # ===================================================================
13240 # Creating bigger shared library to link against
13241 # ===================================================================
13242 AC_MSG_CHECKING([whether to create huge library])
13243 MERGELIBS=
13245 if test $_os = iOS -o $_os = Android; then
13246     # Never any point in mergelibs for these as we build just static
13247     # libraries anyway...
13248     enable_mergelibs=no
13251 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
13252     if test $_os != Linux -a $_os != WINNT; then
13253         add_warning "--enable-mergelibs is not tested for this platform"
13254     fi
13255     MERGELIBS="TRUE"
13256     AC_MSG_RESULT([yes])
13257     AC_DEFINE(ENABLE_MERGELIBS)
13258 else
13259     AC_MSG_RESULT([no])
13261 AC_SUBST([MERGELIBS])
13263 dnl ===================================================================
13264 dnl icerun is a wrapper that stops us spawning tens of processes
13265 dnl locally - for tools that can't be executed on the compile cluster
13266 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
13267 dnl ===================================================================
13268 AC_MSG_CHECKING([whether to use icerun wrapper])
13269 ICECREAM_RUN=
13270 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
13271     ICECREAM_RUN=icerun
13272     AC_MSG_RESULT([yes])
13273 else
13274     AC_MSG_RESULT([no])
13276 AC_SUBST(ICECREAM_RUN)
13278 dnl ===================================================================
13279 dnl Setup the ICECC_VERSION for the build the same way it was set for
13280 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
13281 dnl ===================================================================
13282 x_ICECC_VERSION=[\#]
13283 if test -n "$ICECC_VERSION" ; then
13284     x_ICECC_VERSION=
13286 AC_SUBST(x_ICECC_VERSION)
13287 AC_SUBST(ICECC_VERSION)
13289 dnl ===================================================================
13291 AC_MSG_CHECKING([MPL subset])
13292 MPL_SUBSET=
13294 if test "$enable_mpl_subset" = "yes"; then
13295     warn_report=false
13296     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13297         warn_report=true
13298     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
13299         warn_report=true
13300     fi
13301     if test "$warn_report" = "true"; then
13302         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
13303     fi
13304     if test "x$enable_postgresql_sdbc" != "xno"; then
13305         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
13306     fi
13307     if test "$enable_lotuswordpro" = "yes"; then
13308         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
13309     fi
13310     if test "$WITH_WEBDAV" = "neon"; then
13311         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
13312     fi
13313     if test -n "$ENABLE_POPPLER"; then
13314         if test "x$SYSTEM_POPPLER" = "x"; then
13315             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
13316         fi
13317     fi
13318     # cf. m4/libo_check_extension.m4
13319     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
13320         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
13321     fi
13322     for theme in $WITH_THEMES; do
13323         case $theme in
13324         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
13325             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
13326         *) : ;;
13327         esac
13328     done
13330     ENABLE_OPENGL_TRANSITIONS=
13332     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
13333         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
13334     fi
13336     MPL_SUBSET="TRUE"
13337     AC_DEFINE(MPL_HAVE_SUBSET)
13338     AC_MSG_RESULT([only])
13339 else
13340     AC_MSG_RESULT([no restrictions])
13342 AC_SUBST(MPL_SUBSET)
13344 dnl ===================================================================
13346 AC_MSG_CHECKING([formula logger])
13347 ENABLE_FORMULA_LOGGER=
13349 if test "x$enable_formula_logger" = "xyes"; then
13350     AC_MSG_RESULT([yes])
13351     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13352     ENABLE_FORMULA_LOGGER=TRUE
13353 elif test -n "$ENABLE_DBGUTIL" ; then
13354     AC_MSG_RESULT([yes])
13355     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13356     ENABLE_FORMULA_LOGGER=TRUE
13357 else
13358     AC_MSG_RESULT([no])
13361 AC_SUBST(ENABLE_FORMULA_LOGGER)
13363 dnl ===================================================================
13364 dnl Checking for active Antivirus software.
13365 dnl ===================================================================
13367 if test $_os = WINNT ; then
13368     AC_MSG_CHECKING([for active Antivirus software])
13369     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
13370     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
13371         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
13372             AC_MSG_RESULT([found])
13373             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
13374             echo $EICAR_STRING > $SRC_ROOT/eicar
13375             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
13376             rm $SRC_ROOT/eicar
13377             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13378                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13379             fi
13380             echo $EICAR_STRING > $BUILDDIR/eicar
13381             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
13382             rm $BUILDDIR/eicar
13383             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13384                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13385             fi
13386             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"
13387         else
13388             AC_MSG_RESULT([not found])
13389         fi
13390     else
13391         AC_MSG_RESULT([n/a])
13392     fi
13395 dnl ===================================================================
13396 dnl Setting up the environment.
13397 dnl ===================================================================
13398 AC_MSG_NOTICE([setting up the build environment variables...])
13400 AC_SUBST(COMPATH)
13402 if test "$build_os" = "cygwin"; then
13403     if test -d "$COMPATH/atlmfc/lib/spectre"; then
13404         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
13405         ATL_INCLUDE="$COMPATH/atlmfc/include"
13406     elif test -d "$COMPATH/atlmfc/lib"; then
13407         ATL_LIB="$COMPATH/atlmfc/lib"
13408         ATL_INCLUDE="$COMPATH/atlmfc/include"
13409     else
13410         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
13411         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
13412     fi
13413     if test "$BITNESS_OVERRIDE" = 64; then
13414         ATL_LIB="$ATL_LIB/x64"
13415     else
13416         ATL_LIB="$ATL_LIB/x86"
13417     fi
13418     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
13419     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
13421     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
13422     PathFormat "/usr/bin/find.exe"
13423     FIND="$formatted_path"
13424     PathFormat "/usr/bin/sort.exe"
13425     SORT="$formatted_path"
13426     PathFormat "/usr/bin/grep.exe"
13427     WIN_GREP="$formatted_path"
13428     PathFormat "/usr/bin/ls.exe"
13429     WIN_LS="$formatted_path"
13430     PathFormat "/usr/bin/touch.exe"
13431     WIN_TOUCH="$formatted_path"
13432 else
13433     FIND=find
13434     SORT=sort
13437 AC_SUBST(ATL_INCLUDE)
13438 AC_SUBST(ATL_LIB)
13439 AC_SUBST(FIND)
13440 AC_SUBST(SORT)
13441 AC_SUBST(WIN_GREP)
13442 AC_SUBST(WIN_LS)
13443 AC_SUBST(WIN_TOUCH)
13445 AC_SUBST(BUILD_TYPE)
13447 AC_SUBST(SOLARINC)
13449 PathFormat "$PERL"
13450 PERL="$formatted_path"
13451 AC_SUBST(PERL)
13453 if test -n "$TMPDIR"; then
13454     TEMP_DIRECTORY="$TMPDIR"
13455 else
13456     TEMP_DIRECTORY="/tmp"
13458 if test "$build_os" = "cygwin"; then
13459     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
13461 AC_SUBST(TEMP_DIRECTORY)
13463 # setup the PATH for the environment
13464 if test -n "$LO_PATH_FOR_BUILD"; then
13465     LO_PATH="$LO_PATH_FOR_BUILD"
13466 else
13467     LO_PATH="$PATH"
13469     case "$host_os" in
13471     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13472         if test "$ENABLE_JAVA" != ""; then
13473             pathmunge "$JAVA_HOME/bin" "after"
13474         fi
13475         ;;
13477     cygwin*)
13478         # Win32 make needs native paths
13479         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13480             LO_PATH=`cygpath -p -m "$PATH"`
13481         fi
13482         if test "$BITNESS_OVERRIDE" = 64; then
13483             # needed for msi packaging
13484             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13485         fi
13486         # .NET 4.6 and higher don't have bin directory
13487         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13488             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13489         fi
13490         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13491         pathmunge "$CSC_PATH" "before"
13492         pathmunge "$MIDL_PATH" "before"
13493         pathmunge "$AL_PATH" "before"
13494         pathmunge "$MSPDB_PATH" "before"
13495         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13496             pathmunge "$CL_PATH" "before"
13497         fi
13498         if test -n "$MSBUILD_PATH" ; then
13499             pathmunge "$MSBUILD_PATH" "before"
13500         fi
13501         if test "$BITNESS_OVERRIDE" = 64; then
13502             pathmunge "$COMPATH/bin/amd64" "before"
13503             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13504         else
13505             pathmunge "$COMPATH/bin" "before"
13506             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13507         fi
13508         if test "$ENABLE_JAVA" != ""; then
13509             if test -d "$JAVA_HOME/jre/bin/client"; then
13510                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13511             fi
13512             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13513                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13514             fi
13515             pathmunge "$JAVA_HOME/bin" "before"
13516         fi
13517         ;;
13519     solaris*)
13520         pathmunge "/usr/css/bin" "before"
13521         if test "$ENABLE_JAVA" != ""; then
13522             pathmunge "$JAVA_HOME/bin" "after"
13523         fi
13524         ;;
13525     esac
13528 AC_SUBST(LO_PATH)
13530 libo_FUZZ_SUMMARY
13532 # Generate a configuration sha256 we can use for deps
13533 if test -f config_host.mk; then
13534     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13536 if test -f config_host_lang.mk; then
13537     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13540 CFLAGS=$my_original_CFLAGS
13541 CXXFLAGS=$my_original_CXXFLAGS
13542 CPPFLAGS=$my_original_CPPFLAGS
13544 AC_LINK_FILES([include], [include])
13546 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
13547 # BUILD platform configuration] - otherwise breaks cross building
13548 AC_CONFIG_FILES([config_host.mk
13549                  config_host_lang.mk
13550                  Makefile
13551                  bin/bffvalidator.sh
13552                  bin/odfvalidator.sh
13553                  bin/officeotron.sh
13554                  hardened_runtime.xcent
13555                  instsetoo_native/util/openoffice.lst
13556                  sysui/desktop/macosx/Info.plist])
13557 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13558 AC_CONFIG_HEADERS([config_host/config_clang.h])
13559 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13560 AC_CONFIG_HEADERS([config_host/config_eot.h])
13561 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13562 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13563 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13564 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13565 AC_CONFIG_HEADERS([config_host/config_features.h])
13566 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13567 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13568 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13569 AC_CONFIG_HEADERS([config_host/config_folders.h])
13570 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13571 AC_CONFIG_HEADERS([config_host/config_gio.h])
13572 AC_CONFIG_HEADERS([config_host/config_global.h])
13573 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13574 AC_CONFIG_HEADERS([config_host/config_java.h])
13575 AC_CONFIG_HEADERS([config_host/config_langs.h])
13576 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13577 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13578 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13579 AC_CONFIG_HEADERS([config_host/config_locales.h])
13580 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13581 AC_CONFIG_HEADERS([config_host/config_oox.h])
13582 AC_CONFIG_HEADERS([config_host/config_options.h])
13583 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13584 AC_CONFIG_HEADERS([config_host/config_skia.h])
13585 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13586 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13587 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13588 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13589 AC_CONFIG_HEADERS([config_host/config_version.h])
13590 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13591 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13592 AC_CONFIG_HEADERS([config_host/config_python.h])
13593 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13594 AC_OUTPUT
13596 if test "$CROSS_COMPILING" = TRUE; then
13597     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13600 # touch the config timestamp file
13601 if test ! -f config_host.mk.stamp; then
13602     echo > config_host.mk.stamp
13603 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13604     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13605 else
13606     echo > config_host.mk.stamp
13609 # touch the config lang timestamp file
13610 if test ! -f config_host_lang.mk.stamp; then
13611     echo > config_host_lang.mk.stamp
13612 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13613     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13614 else
13615     echo > config_host_lang.mk.stamp
13619 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13620         -a "$build_os" = "cygwin"; then
13622 cat << _EOS
13623 ****************************************************************************
13624 WARNING:
13625 Your make version is known to be horribly slow, and hard to debug
13626 problems with. To get a reasonably functional make please do:
13628 to install a pre-compiled binary make for Win32
13630  mkdir -p /opt/lo/bin
13631  cd /opt/lo/bin
13632  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13633  cp make-4.2.1-msvc.exe make
13634  chmod +x make
13636 to install from source:
13637 place yourself in a working directory of you choice.
13639  git clone git://git.savannah.gnu.org/make.git
13641  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
13642  set PATH=%PATH%;C:\Cygwin\bin
13643  [or Cygwin64, if that is what you have]
13644  cd path-to-make-repo-you-cloned-above
13645  build_w32.bat --without-guile
13647 should result in a WinRel/gnumake.exe.
13648 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13650 Then re-run autogen.sh
13652 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13653 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13655 _EOS
13656 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13657     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13662 cat << _EOF
13663 ****************************************************************************
13665 To build, run:
13666 $GNUMAKE
13668 To view some help, run:
13669 $GNUMAKE help
13671 _EOF
13673 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13674     cat << _EOF
13675 After the build has finished successfully, you can immediately run what you built using the command:
13676 _EOF
13678     if test $_os = Darwin; then
13679         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
13680     else
13681         echo instdir/program/soffice
13682     fi
13683     cat << _EOF
13685 If you want to run the smoketest, run:
13686 $GNUMAKE check
13688 _EOF
13691 if test -f warn; then
13692     cat warn
13693     rm warn
13696 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: