tdf#132911: sw_uiwriter: Add unittest
[LibreOffice.git] / configure.ac
blobf651056fc11c56ee5a7389a86a799a055362937e
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 case "$host_os" in
604 solaris*)
605     build_gstreamer_1_0=yes
606     test_freetype=yes
607     build_skia=yes
608     _os=SunOS
610     dnl ===========================================================
611     dnl Check whether we're using Solaris 10 - SPARC or Intel.
612     dnl ===========================================================
613     AC_MSG_CHECKING([the Solaris operating system release])
614     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
615     if test "$_os_release" -lt "10"; then
616         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
617     else
618         AC_MSG_RESULT([ok ($_os_release)])
619     fi
621     dnl Check whether we're using a SPARC or i386 processor
622     AC_MSG_CHECKING([the processor type])
623     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
624         AC_MSG_RESULT([ok ($host_cpu)])
625     else
626         AC_MSG_ERROR([only SPARC and i386 processors are supported])
627     fi
628     ;;
630 linux-gnu*|k*bsd*-gnu*)
631     build_gstreamer_1_0=yes
632     test_kf5=yes
633     test_gtk3_kde5=yes
634     build_skia=yes
635     test_gdb_index=yes
636     test_split_debug=yes
637     if test "$enable_fuzzers" != yes; then
638         test_freetype=yes
639         test_fontconfig=yes
640     else
641         test_freetype=no
642         test_fontconfig=no
643         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
644     fi
645     _os=Linux
646     ;;
648 gnu)
649     test_randr=no
650     test_xrender=no
651     _os=GNU
652      ;;
654 cygwin*|interix*)
656     # When building on Windows normally with MSVC under Cygwin,
657     # configure thinks that the host platform (the platform the
658     # built code will run on) is Cygwin, even if it obviously is
659     # Windows, which in Autoconf terminology is called
660     # "mingw32". (Which is misleading as MinGW is the name of the
661     # tool-chain, not an operating system.)
663     # Somewhat confusing, yes. But this configure script doesn't
664     # look at $host etc that much, it mostly uses its own $_os
665     # variable, set here in this case statement.
667     test_cups=no
668     test_dbus=no
669     test_randr=no
670     test_xrender=no
671     test_freetype=no
672     test_fontconfig=no
673     build_skia=yes
674     _os=WINNT
676     DLLPOST=".dll"
677     LINKFLAGSNOUNDEFS=
678     ;;
680 darwin*|macos*) # macOS
681     test_randr=no
682     test_xrender=no
683     test_freetype=no
684     test_fontconfig=no
685     test_dbus=no
686     if test -n "$LODE_HOME" ; then
687         mac_sanitize_path
688         AC_MSG_NOTICE([sanitized the PATH to $PATH])
689     fi
690     _os=Darwin
691     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
692     INSTROOTCONTENTSUFFIX=/Contents
693     SDKDIRNAME=${PRODUCTNAME}${PRODUCTVERSION}_SDK
694     # See comment above the case "$host_os"
695     LINKFLAGSSHL="-dynamiclib -single_module"
697     # -fPIC is default
698     PICSWITCH=""
700     DLLPOST=".dylib"
702     # -undefined error is the default
703     LINKFLAGSNOUNDEFS=""
704     if test "$host_cpu" = arm64; then
705         # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
706         # the "macos" part so be sure to use arm64-apple-darwin for now.
707         HOST_PLATFORM=arm64-apple-darwin
708     fi
711 ios*) # iOS
712     test_randr=no
713     test_xrender=no
714     test_freetype=no
715     test_fontconfig=no
716     test_dbus=no
717     if test -n "$LODE_HOME" ; then
718         mac_sanitize_path
719         AC_MSG_NOTICE([sanitized the PATH to $PATH])
720     fi
721     enable_gpgmepp=no
722     _os=iOS
723     test_cups=no
724     enable_mpl_subset=yes
725     enable_lotuswordpro=no
726     enable_coinmp=no
727     enable_lpsolve=no
728     enable_postgresql_sdbc=no
729     enable_extension_integration=no
730     enable_report_builder=no
731     with_ppds=no
732     if test "$enable_ios_simulator" = "yes"; then
733         host=x86_64-apple-darwin
734     fi
735     # See comment above the case "$host_os"
736     LINKFLAGSSHL="-dynamiclib -single_module"
738     # -fPIC is default
739     PICSWITCH=""
741     DLLPOST=".dylib"
743     # -undefined error is the default
744     LINKFLAGSNOUNDEFS=""
746     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios" part,
747     # so use arm64-apple-darwin as before for now.
748     HOST_PLATFORM=arm64-apple-darwin
751 freebsd*)
752     build_gstreamer_1_0=yes
753     test_kf5=yes
754     test_gtk3_kde5=yes
755     test_freetype=yes
756     build_skia=yes
757     AC_MSG_CHECKING([the FreeBSD operating system release])
758     if test -n "$with_os_version"; then
759         OSVERSION="$with_os_version"
760     else
761         OSVERSION=`/sbin/sysctl -n kern.osreldate`
762     fi
763     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
764     AC_MSG_CHECKING([which thread library to use])
765     if test "$OSVERSION" -lt "500016"; then
766         PTHREAD_CFLAGS="-D_THREAD_SAFE"
767         PTHREAD_LIBS="-pthread"
768     elif test "$OSVERSION" -lt "502102"; then
769         PTHREAD_CFLAGS="-D_THREAD_SAFE"
770         PTHREAD_LIBS="-lc_r"
771     else
772         PTHREAD_CFLAGS=""
773         PTHREAD_LIBS="-pthread"
774     fi
775     AC_MSG_RESULT([$PTHREAD_LIBS])
776     _os=FreeBSD
777     ;;
779 *netbsd*)
780     build_gstreamer_1_0=yes
781     test_kf5=yes
782     test_gtk3_kde5=yes
783     test_freetype=yes
784     build_skia=yes
785     PTHREAD_LIBS="-pthread -lpthread"
786     _os=NetBSD
787     ;;
789 aix*)
790     test_randr=no
791     test_freetype=yes
792     PTHREAD_LIBS=-pthread
793     _os=AIX
794     ;;
796 openbsd*)
797     test_freetype=yes
798     PTHREAD_CFLAGS="-D_THREAD_SAFE"
799     PTHREAD_LIBS="-pthread"
800     _os=OpenBSD
801     ;;
803 dragonfly*)
804     build_gstreamer_1_0=yes
805     test_kf5=yes
806     test_gtk3_kde5=yes
807     test_freetype=yes
808     build_skia=yes
809     PTHREAD_LIBS="-pthread"
810     _os=DragonFly
811     ;;
813 linux-android*)
814     build_gstreamer_1_0=no
815     enable_lotuswordpro=no
816     enable_mpl_subset=yes
817     enable_coinmp=yes
818     enable_lpsolve=no
819     enable_report_builder=no
820     enable_odk=no
821     enable_postgresql_sdbc=no
822     enable_python=no
823     test_cups=no
824     test_dbus=no
825     test_fontconfig=no
826     test_freetype=no
827     test_kf5=no
828     test_qt5=no
829     test_gtk3_kde5=no
830     test_randr=no
831     test_xrender=no
832     _os=Android
834     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
835     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
836     ;;
838 haiku*)
839     test_cups=no
840     test_dbus=no
841     test_randr=no
842     test_xrender=no
843     test_freetype=yes
844     enable_odk=no
845     enable_gstreamer_1_0=no
846     enable_vlc=no
847     enable_coinmp=no
848     enable_pdfium=no
849     enable_sdremote=no
850     enable_postgresql_sdbc=no
851     enable_firebird_sdbc=no
852     _os=Haiku
853     ;;
856     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
857     ;;
858 esac
860 AC_SUBST(HOST_PLATFORM)
862 if test "$_os" = "Android" ; then
863     # Verify that the NDK and SDK options are proper
864     if test -z "$with_android_ndk"; then
865         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
866     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
867         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
868     fi
870     if test -z "$ANDROID_SDK_HOME"; then
871         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
872     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
873         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
874     fi
876     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
877     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
878         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
879                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
880                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
881         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
882         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
883         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
884     fi
885     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
886         AC_MSG_WARN([android support repository not found - install with
887                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
888                      to allow the build to download the specified version of the android support libraries])
889         add_warning "android support repository not found - install with"
890         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
891         add_warning "to allow the build to download the specified version of the android support libraries"
892     fi
895 if test "$_os" = "AIX"; then
896     AC_PATH_PROG(GAWK, gawk)
897     if test -z "$GAWK"; then
898         AC_MSG_ERROR([gawk not found in \$PATH])
899     fi
902 AC_SUBST(SDKDIRNAME)
904 AC_SUBST(PTHREAD_CFLAGS)
905 AC_SUBST(PTHREAD_LIBS)
907 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
908 # By default use the ones specified by our build system,
909 # but explicit override is possible.
910 AC_MSG_CHECKING(for explicit AFLAGS)
911 if test -n "$AFLAGS"; then
912     AC_MSG_RESULT([$AFLAGS])
913     x_AFLAGS=
914 else
915     AC_MSG_RESULT(no)
916     x_AFLAGS=[\#]
918 AC_MSG_CHECKING(for explicit CFLAGS)
919 if test -n "$CFLAGS"; then
920     AC_MSG_RESULT([$CFLAGS])
921     x_CFLAGS=
922 else
923     AC_MSG_RESULT(no)
924     x_CFLAGS=[\#]
926 AC_MSG_CHECKING(for explicit CXXFLAGS)
927 if test -n "$CXXFLAGS"; then
928     AC_MSG_RESULT([$CXXFLAGS])
929     x_CXXFLAGS=
930 else
931     AC_MSG_RESULT(no)
932     x_CXXFLAGS=[\#]
934 AC_MSG_CHECKING(for explicit OBJCFLAGS)
935 if test -n "$OBJCFLAGS"; then
936     AC_MSG_RESULT([$OBJCFLAGS])
937     x_OBJCFLAGS=
938 else
939     AC_MSG_RESULT(no)
940     x_OBJCFLAGS=[\#]
942 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
943 if test -n "$OBJCXXFLAGS"; then
944     AC_MSG_RESULT([$OBJCXXFLAGS])
945     x_OBJCXXFLAGS=
946 else
947     AC_MSG_RESULT(no)
948     x_OBJCXXFLAGS=[\#]
950 AC_MSG_CHECKING(for explicit LDFLAGS)
951 if test -n "$LDFLAGS"; then
952     AC_MSG_RESULT([$LDFLAGS])
953     x_LDFLAGS=
954 else
955     AC_MSG_RESULT(no)
956     x_LDFLAGS=[\#]
958 AC_SUBST(AFLAGS)
959 AC_SUBST(CFLAGS)
960 AC_SUBST(CXXFLAGS)
961 AC_SUBST(OBJCFLAGS)
962 AC_SUBST(OBJCXXFLAGS)
963 AC_SUBST(LDFLAGS)
964 AC_SUBST(x_AFLAGS)
965 AC_SUBST(x_CFLAGS)
966 AC_SUBST(x_CXXFLAGS)
967 AC_SUBST(x_OBJCFLAGS)
968 AC_SUBST(x_OBJCXXFLAGS)
969 AC_SUBST(x_LDFLAGS)
971 dnl These are potentially set for MSVC, in the code checking for UCRT below:
972 my_original_CFLAGS=$CFLAGS
973 my_original_CXXFLAGS=$CXXFLAGS
974 my_original_CPPFLAGS=$CPPFLAGS
976 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
977 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
978 dnl AC_PROG_CC internally.
979 if test "$_os" != "WINNT"; then
980     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
981     save_CFLAGS=$CFLAGS
982     AC_PROG_CC
983     CFLAGS=$save_CFLAGS
984     if test -z "$CC_BASE"; then
985         CC_BASE=`first_arg_basename "$CC"`
986     fi
989 if test "$_os" != "WINNT"; then
990     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
991 else
992     ENDIANNESS=little
994 AC_SUBST(ENDIANNESS)
996 if test $_os != "WINNT"; then
997     save_LIBS="$LIBS"
998     AC_SEARCH_LIBS([dlsym], [dl],
999         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1000         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1001     LIBS="$save_LIBS"
1003 AC_SUBST(DLOPEN_LIBS)
1005 AC_ARG_ENABLE(ios-simulator,
1006     AS_HELP_STRING([--enable-ios-simulator],
1007         [build i386 or x86_64 for ios simulator])
1010 AC_ARG_ENABLE(ios-libreofficelight-app,
1011     AS_HELP_STRING([--enable-ios-libreofficelight-app],
1012         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
1013          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
1014          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
1017 ENABLE_IOS_LIBREOFFICELIGHT_APP=
1018 if test "$enable_ios_libreofficelight_app" = yes; then
1019     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
1021 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
1023 ###############################################################################
1024 # Extensions switches --enable/--disable
1025 ###############################################################################
1026 # By default these should be enabled unless having extra dependencies.
1027 # If there is extra dependency over configure options then the enable should
1028 # be automagic based on whether the requiring feature is enabled or not.
1029 # All this options change anything only with --enable-extension-integration.
1031 # The name of this option and its help string makes it sound as if
1032 # extensions are built anyway, just not integrated in the installer,
1033 # if you use --disable-extension-integration. Is that really the
1034 # case?
1036 libo_FUZZ_ARG_ENABLE(extension-integration,
1037     AS_HELP_STRING([--disable-extension-integration],
1038         [Disable integration of the built extensions in the installer of the
1039          product. Use this switch to disable the integration.])
1042 AC_ARG_ENABLE(avmedia,
1043     AS_HELP_STRING([--disable-avmedia],
1044         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1047 AC_ARG_ENABLE(database-connectivity,
1048     AS_HELP_STRING([--disable-database-connectivity],
1049         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1052 # This doesn't mean not building (or "integrating") extensions
1053 # (although it probably should; i.e. it should imply
1054 # --disable-extension-integration I guess), it means not supporting
1055 # any extension mechanism at all
1056 libo_FUZZ_ARG_ENABLE(extensions,
1057     AS_HELP_STRING([--disable-extensions],
1058         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1061 AC_ARG_ENABLE(scripting,
1062     AS_HELP_STRING([--disable-scripting],
1063         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1066 # This is mainly for Android and iOS, but could potentially be used in some
1067 # special case otherwise, too, so factored out as a separate setting
1069 AC_ARG_ENABLE(dynamic-loading,
1070     AS_HELP_STRING([--disable-dynamic-loading],
1071         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1074 libo_FUZZ_ARG_ENABLE(report-builder,
1075     AS_HELP_STRING([--disable-report-builder],
1076         [Disable the Report Builder.])
1079 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1080     AS_HELP_STRING([--enable-ext-wiki-publisher],
1081         [Enable the Wiki Publisher extension.])
1084 libo_FUZZ_ARG_ENABLE(lpsolve,
1085     AS_HELP_STRING([--disable-lpsolve],
1086         [Disable compilation of the lp solve solver ])
1088 libo_FUZZ_ARG_ENABLE(coinmp,
1089     AS_HELP_STRING([--disable-coinmp],
1090         [Disable compilation of the CoinMP solver ])
1093 libo_FUZZ_ARG_ENABLE(pdfimport,
1094     AS_HELP_STRING([--disable-pdfimport],
1095         [Disable building the PDF import feature.])
1098 libo_FUZZ_ARG_ENABLE(pdfium,
1099     AS_HELP_STRING([--disable-pdfium],
1100         [Disable building PDFium.])
1103 libo_FUZZ_ARG_ENABLE(skia,
1104     AS_HELP_STRING([--disable-skia],
1105         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1108 ###############################################################################
1110 dnl ---------- *** ----------
1112 libo_FUZZ_ARG_ENABLE(mergelibs,
1113     AS_HELP_STRING([--enable-mergelibs],
1114         [Merge several of the smaller libraries into one big, "merged", one.])
1117 libo_FUZZ_ARG_ENABLE(breakpad,
1118     AS_HELP_STRING([--enable-breakpad],
1119         [Enables breakpad for crash reporting.])
1122 libo_FUZZ_ARG_ENABLE(crashdump,
1123     AS_HELP_STRING([--disable-crashdump],
1124         [Disable dump.ini and dump-file, when --enable-breakpad])
1127 AC_ARG_ENABLE(fetch-external,
1128     AS_HELP_STRING([--disable-fetch-external],
1129         [Disables fetching external tarballs from web sources.])
1132 AC_ARG_ENABLE(fuzzers,
1133     AS_HELP_STRING([--enable-fuzzers],
1134         [Enables building libfuzzer targets for fuzz testing.])
1137 libo_FUZZ_ARG_ENABLE(pch,
1138     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1139         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1140          Using 'system' will include only external headers, 'base' will add also headers
1141          from base modules, 'normal' will also add all headers except from the module built,
1142          'full' will use all suitable headers even from a module itself.])
1145 libo_FUZZ_ARG_ENABLE(epm,
1146     AS_HELP_STRING([--enable-epm],
1147         [LibreOffice includes self-packaging code, that requires epm, however epm is
1148          useless for large scale package building.])
1151 libo_FUZZ_ARG_ENABLE(odk,
1152     AS_HELP_STRING([--disable-odk],
1153         [LibreOffice includes an ODK, office development kit which some packagers may
1154          wish to build without.])
1157 AC_ARG_ENABLE(mpl-subset,
1158     AS_HELP_STRING([--enable-mpl-subset],
1159         [Don't compile any pieces which are not MPL or more liberally licensed])
1162 libo_FUZZ_ARG_ENABLE(evolution2,
1163     AS_HELP_STRING([--enable-evolution2],
1164         [Allows the built-in evolution 2 addressbook connectivity build to be
1165          enabled.])
1168 AC_ARG_ENABLE(avahi,
1169     AS_HELP_STRING([--enable-avahi],
1170         [Determines whether to use Avahi to advertise Impress to remote controls.])
1173 libo_FUZZ_ARG_ENABLE(werror,
1174     AS_HELP_STRING([--enable-werror],
1175         [Turn warnings to errors. (Has no effect in modules where the treating
1176          of warnings as errors is disabled explicitly.)]),
1179 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1180     AS_HELP_STRING([--enable-assert-always-abort],
1181         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1184 libo_FUZZ_ARG_ENABLE(dbgutil,
1185     AS_HELP_STRING([--enable-dbgutil],
1186         [Provide debugging support from --enable-debug and include additional debugging
1187          utilities such as object counting or more expensive checks.
1188          This is the recommended option for developers.
1189          Note that this makes the build ABI incompatible, it is not possible to mix object
1190          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1192 libo_FUZZ_ARG_ENABLE(debug,
1193     AS_HELP_STRING([--enable-debug],
1194         [Include debugging information, disable compiler optimization and inlining plus
1195          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1197 libo_FUZZ_ARG_ENABLE(split-debug,
1198     AS_HELP_STRING([--disable-split-debug],
1199         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1200          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1202 libo_FUZZ_ARG_ENABLE(gdb-index,
1203     AS_HELP_STRING([--disable-gdb-index],
1204         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1205          The feature requires the gold or lld linker.]))
1207 libo_FUZZ_ARG_ENABLE(sal-log,
1208     AS_HELP_STRING([--enable-sal-log],
1209         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1211 libo_FUZZ_ARG_ENABLE(symbols,
1212     AS_HELP_STRING([--enable-symbols],
1213         [Generate debug information.
1214          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1215          otherwise. It is possible to explicitly specify gbuild build targets
1216          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1217          everything in the directory; there is no ordering, more specific overrides
1218          more general, and disabling takes precedence).
1219          Example: --enable-symbols="all -sw/ -Library_sc".]))
1221 libo_FUZZ_ARG_ENABLE(optimized,
1222     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1223         [Whether to compile with optimization flags.
1224          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1225          otherwise. Using 'debug' will try to use only optimizations that should
1226          not interfere with debugging.]))
1228 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1229     AS_HELP_STRING([--disable-runtime-optimizations],
1230         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1231          JVM JIT) that are known to interact badly with certain dynamic analysis
1232          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1233          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1234          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1236 AC_ARG_WITH(valgrind,
1237     AS_HELP_STRING([--with-valgrind],
1238         [Make availability of Valgrind headers a hard requirement.]))
1240 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1241     AS_HELP_STRING([--enable-compiler-plugins],
1242         [Enable compiler plugins that will perform additional checks during
1243          building. Enabled automatically by --enable-dbgutil.
1244          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1245 COMPILER_PLUGINS_DEBUG=
1246 if test "$enable_compiler_plugins" = debug; then
1247     enable_compiler_plugins=yes
1248     COMPILER_PLUGINS_DEBUG=TRUE
1251 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1252     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1253         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1254          relevant in the --disable-compiler-plugins case.]))
1256 libo_FUZZ_ARG_ENABLE(ooenv,
1257     AS_HELP_STRING([--disable-ooenv],
1258         [Disable ooenv for the instdir installation.]))
1260 AC_ARG_ENABLE(lto,
1261     AS_HELP_STRING([--enable-lto],
1262         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1263          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1264          linker. For MSVC, this option is broken at the moment. This is experimental work
1265          in progress that shouldn't be used unless you are working on it.)]))
1267 AC_ARG_ENABLE(python,
1268     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1269         [Enables or disables Python support at run-time.
1270          Also specifies what Python to use at build-time.
1271          'fully-internal' even forces the internal version for uses of Python
1272          during the build.
1273          On macOS the only choices are
1274          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1275          ]))
1277 libo_FUZZ_ARG_ENABLE(gtk3,
1278     AS_HELP_STRING([--disable-gtk3],
1279         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1280 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1282 AC_ARG_ENABLE(introspection,
1283     AS_HELP_STRING([--enable-introspection],
1284         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1285          Linux distributions.)]))
1287 AC_ARG_ENABLE(split-app-modules,
1288     AS_HELP_STRING([--enable-split-app-modules],
1289         [Split file lists for app modules, e.g. base, calc.
1290          Has effect only with make distro-pack-install]),
1293 AC_ARG_ENABLE(split-opt-features,
1294     AS_HELP_STRING([--enable-split-opt-features],
1295         [Split file lists for some optional features, e.g. pyuno, testtool.
1296          Has effect only with make distro-pack-install]),
1299 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1300     AS_HELP_STRING([--disable-cairo-canvas],
1301         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1304 libo_FUZZ_ARG_ENABLE(dbus,
1305     AS_HELP_STRING([--disable-dbus],
1306         [Determines whether to enable features that depend on dbus.
1307          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1308 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1310 libo_FUZZ_ARG_ENABLE(sdremote,
1311     AS_HELP_STRING([--disable-sdremote],
1312         [Determines whether to enable Impress remote control (i.e. the server component).]),
1313 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1315 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1316     AS_HELP_STRING([--disable-sdremote-bluetooth],
1317         [Determines whether to build sdremote with bluetooth support.
1318          Requires dbus on Linux.]))
1320 libo_FUZZ_ARG_ENABLE(gio,
1321     AS_HELP_STRING([--disable-gio],
1322         [Determines whether to use the GIO support.]),
1323 ,test "${enable_gio+set}" = set || enable_gio=yes)
1325 AC_ARG_ENABLE(qt5,
1326     AS_HELP_STRING([--enable-qt5],
1327         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1328          available.]),
1331 AC_ARG_ENABLE(kf5,
1332     AS_HELP_STRING([--enable-kf5],
1333         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1334          KF5 are available.]),
1337 AC_ARG_ENABLE(kde5,
1338     AS_HELP_STRING([--enable-kde5],
1339         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1342 AC_ARG_ENABLE(gtk3_kde5,
1343     AS_HELP_STRING([--enable-gtk3-kde5],
1344         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1345          platforms where Gtk3, Qt5 and Plasma is available.]),
1348 AC_ARG_ENABLE(gui,
1349     AS_HELP_STRING([--disable-gui],
1350         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1351 ,enable_gui=yes)
1353 libo_FUZZ_ARG_ENABLE(randr,
1354     AS_HELP_STRING([--disable-randr],
1355         [Disable RandR support in the vcl project.]),
1356 ,test "${enable_randr+set}" = set || enable_randr=yes)
1358 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1359     AS_HELP_STRING([--disable-gstreamer-1-0],
1360         [Disable building with the gstreamer 1.0 avmedia backend.]),
1361 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1363 libo_FUZZ_ARG_ENABLE(vlc,
1364     AS_HELP_STRING([--enable-vlc],
1365         [Enable building with the (experimental) VLC avmedia backend.]),
1366 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1368 libo_FUZZ_ARG_ENABLE(neon,
1369     AS_HELP_STRING([--disable-neon],
1370         [Disable neon and the compilation of webdav binding.]),
1373 libo_FUZZ_ARG_ENABLE([eot],
1374     [AS_HELP_STRING([--enable-eot],
1375         [Enable support for Embedded OpenType fonts.])],
1376 ,test "${enable_eot+set}" = set || enable_eot=no)
1378 libo_FUZZ_ARG_ENABLE(cve-tests,
1379     AS_HELP_STRING([--disable-cve-tests],
1380         [Prevent CVE tests to be executed]),
1383 libo_FUZZ_ARG_ENABLE(chart-tests,
1384     AS_HELP_STRING([--enable-chart-tests],
1385         [Executes chart XShape tests. In a perfect world these tests would be
1386          stable and everyone could run them, in reality it is best to run them
1387          only on a few machines that are known to work and maintained by people
1388          who can judge if a test failure is a regression or not.]),
1391 AC_ARG_ENABLE(build-unowinreg,
1392     AS_HELP_STRING([--enable-build-unowinreg],
1393         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1394          compiler is needed on Linux.]),
1397 AC_ARG_ENABLE(build-opensymbol,
1398     AS_HELP_STRING([--enable-build-opensymbol],
1399         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1400          fontforge installed.]),
1403 AC_ARG_ENABLE(dependency-tracking,
1404     AS_HELP_STRING([--enable-dependency-tracking],
1405         [Do not reject slow dependency extractors.])[
1406   --disable-dependency-tracking
1407                           Disables generation of dependency information.
1408                           Speed up one-time builds.],
1411 AC_ARG_ENABLE(icecream,
1412     AS_HELP_STRING([--enable-icecream],
1413         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1414          It defaults to /opt/icecream for the location of the icecream gcc/g++
1415          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1418 AC_ARG_ENABLE(ld,
1419     AS_HELP_STRING([--enable-ld=<linker>],
1420         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1421          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1422          If <linker> contains any ':', the part before the first ':' is used as the value of
1423          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1424          needed for Clang 12).]),
1427 libo_FUZZ_ARG_ENABLE(cups,
1428     AS_HELP_STRING([--disable-cups],
1429         [Do not build cups support.])
1432 AC_ARG_ENABLE(ccache,
1433     AS_HELP_STRING([--disable-ccache],
1434         [Do not try to use ccache automatically.
1435          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1436          CC/CXX are not yet set, and --enable-icecream is not given, we
1437          attempt to use ccache. --disable-ccache disables ccache completely.
1438          Additionally ccache's depend mode is enabled if possible,
1439          use --enable-ccache=nodepend to enable ccache without depend mode.
1443 AC_ARG_ENABLE(64-bit,
1444     AS_HELP_STRING([--enable-64-bit],
1445         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1446          At the moment meaningful only for Windows.]), ,)
1448 libo_FUZZ_ARG_ENABLE(online-update,
1449     AS_HELP_STRING([--enable-online-update],
1450         [Enable the online update service that will check for new versions of
1451          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1452          If the value is "mar", the experimental Mozilla-like update will be
1453          enabled instead of the traditional update mechanism.]),
1456 AC_ARG_WITH(update-config,
1457     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1458                    [Path to the update config ini file]))
1460 libo_FUZZ_ARG_ENABLE(extension-update,
1461     AS_HELP_STRING([--disable-extension-update],
1462         [Disable possibility to update installed extensions.]),
1465 libo_FUZZ_ARG_ENABLE(release-build,
1466     AS_HELP_STRING([--enable-release-build],
1467         [Enable release build. Note that the "release build" choice is orthogonal to
1468          whether symbols are present, debug info is generated, or optimization
1469          is done.
1470          See http://wiki.documentfoundation.org/Development/DevBuild]),
1473 AC_ARG_ENABLE(windows-build-signing,
1474     AS_HELP_STRING([--enable-windows-build-signing],
1475         [Enable signing of windows binaries (*.exe, *.dll)]),
1478 AC_ARG_ENABLE(silent-msi,
1479     AS_HELP_STRING([--enable-silent-msi],
1480         [Enable MSI with LIMITUI=1 (silent install).]),
1483 AC_ARG_ENABLE(macosx-code-signing,
1484     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1485         [Sign executables, dylibs, frameworks and the app bundle. If you
1486          don't provide an identity the first suitable certificate
1487          in your keychain is used.]),
1490 AC_ARG_ENABLE(macosx-package-signing,
1491     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1492         [Create a .pkg suitable for uploading to the Mac App Store and sign
1493          it. If you don't provide an identity the first suitable certificate
1494          in your keychain is used.]),
1497 AC_ARG_ENABLE(macosx-sandbox,
1498     AS_HELP_STRING([--enable-macosx-sandbox],
1499         [Make the app bundle run in a sandbox. Requires code signing.
1500          Is required by apps distributed in the Mac App Store, and implies
1501          adherence to App Store rules.]),
1504 AC_ARG_WITH(macosx-bundle-identifier,
1505     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1506         [Define the macOS bundle identifier. Default is the somewhat weird
1507          org.libreoffice.script ("script", huh?).]),
1508 ,with_macosx_bundle_identifier=org.libreoffice.script)
1510 AC_ARG_WITH(product-name,
1511     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1512         [Define the product name. Default is AC_PACKAGE_NAME.]),
1513 ,with_product_name=$PRODUCTNAME)
1515 AC_ARG_WITH(package-version,
1516     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1517         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1520 libo_FUZZ_ARG_ENABLE(readonly-installset,
1521     AS_HELP_STRING([--enable-readonly-installset],
1522         [Prevents any attempts by LibreOffice to write into its installation. That means
1523          at least that no "system-wide" extensions can be added. Partly experimental work in
1524          progress, probably not fully implemented. Always enabled for macOS.]),
1527 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1528     AS_HELP_STRING([--disable-postgresql-sdbc],
1529         [Disable the build of the PostgreSQL-SDBC driver.])
1532 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1533     AS_HELP_STRING([--disable-lotuswordpro],
1534         [Disable the build of the Lotus Word Pro filter.]),
1535 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1537 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1538     AS_HELP_STRING([--disable-firebird-sdbc],
1539         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1540 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1542 AC_ARG_ENABLE(bogus-pkg-config,
1543     AS_HELP_STRING([--enable-bogus-pkg-config],
1544         [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.]),
1547 AC_ARG_ENABLE(openssl,
1548     AS_HELP_STRING([--disable-openssl],
1549         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1550          components will either use GNUTLS or NSS. Work in progress,
1551          use only if you are hacking on it.]),
1552 ,enable_openssl=yes)
1554 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1555     AS_HELP_STRING([--enable-cipher-openssl-backend],
1556         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1557          Requires --enable-openssl.]))
1559 AC_ARG_ENABLE(library-bin-tar,
1560     AS_HELP_STRING([--enable-library-bin-tar],
1561         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1562         Some libraries can save their build result in a tarball
1563         stored in TARFILE_LOCATION. That binary tarball is
1564         uniquely identified by the source tarball,
1565         the content of the config_host.mk file and the content
1566         of the top-level directory in core for that library
1567         If this option is enabled, then if such a tarfile exist, it will be untarred
1568         instead of the source tarfile, and the build step will be skipped for that
1569         library.
1570         If a proper tarfile does not exist, then the normal source-based
1571         build is done for that library and a proper binary tarfile is created
1572         for the next time.]),
1575 AC_ARG_ENABLE(dconf,
1576     AS_HELP_STRING([--disable-dconf],
1577         [Disable the dconf configuration backend (enabled by default where
1578          available).]))
1580 libo_FUZZ_ARG_ENABLE(formula-logger,
1581     AS_HELP_STRING(
1582         [--enable-formula-logger],
1583         [Enable formula logger for logging formula calculation flow in Calc.]
1584     )
1587 AC_ARG_ENABLE(ldap,
1588     AS_HELP_STRING([--disable-ldap],
1589         [Disable LDAP support.]),
1590 ,enable_ldap=yes)
1592 dnl ===================================================================
1593 dnl Optional Packages (--with/without-)
1594 dnl ===================================================================
1596 AC_ARG_WITH(gcc-home,
1597     AS_HELP_STRING([--with-gcc-home],
1598         [Specify the location of gcc/g++ manually. This can be used in conjunction
1599          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1600          non-default path.]),
1603 AC_ARG_WITH(gnu-patch,
1604     AS_HELP_STRING([--with-gnu-patch],
1605         [Specify location of GNU patch on Solaris or FreeBSD.]),
1608 AC_ARG_WITH(build-platform-configure-options,
1609     AS_HELP_STRING([--with-build-platform-configure-options],
1610         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1613 AC_ARG_WITH(gnu-cp,
1614     AS_HELP_STRING([--with-gnu-cp],
1615         [Specify location of GNU cp on Solaris or FreeBSD.]),
1618 AC_ARG_WITH(external-tar,
1619     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1620         [Specify an absolute path of where to find (and store) tarfiles.]),
1621     TARFILE_LOCATION=$withval ,
1624 AC_ARG_WITH(referenced-git,
1625     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1626         [Specify another checkout directory to reference. This makes use of
1627                  git submodule update --reference, and saves a lot of diskspace
1628                  when having multiple trees side-by-side.]),
1629     GIT_REFERENCE_SRC=$withval ,
1632 AC_ARG_WITH(linked-git,
1633     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1634         [Specify a directory where the repositories of submodules are located.
1635          This uses a method similar to git-new-workdir to get submodules.]),
1636     GIT_LINK_SRC=$withval ,
1639 AC_ARG_WITH(galleries,
1640     AS_HELP_STRING([--with-galleries],
1641         [Specify how galleries should be built. It is possible either to
1642          build these internally from source ("build"),
1643          or to disable them ("no")]),
1646 AC_ARG_WITH(theme,
1647     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1648         [Choose which themes to include. By default those themes with an '*' are included.
1649          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1650          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
1653 libo_FUZZ_ARG_WITH(helppack-integration,
1654     AS_HELP_STRING([--without-helppack-integration],
1655         [It will not integrate the helppacks to the installer
1656          of the product. Please use this switch to use the online help
1657          or separate help packages.]),
1660 libo_FUZZ_ARG_WITH(fonts,
1661     AS_HELP_STRING([--without-fonts],
1662         [LibreOffice includes some third-party fonts to provide a reliable basis for
1663          help content, templates, samples, etc. When these fonts are already
1664          known to be available on the system then you should use this option.]),
1667 AC_ARG_WITH(epm,
1668     AS_HELP_STRING([--with-epm],
1669         [Decides which epm to use. Default is to use the one from the system if
1670          one is built. When either this is not there or you say =internal epm
1671          will be built.]),
1674 AC_ARG_WITH(package-format,
1675     AS_HELP_STRING([--with-package-format],
1676         [Specify package format(s) for LibreOffice installation sets. The
1677          implicit --without-package-format leads to no installation sets being
1678          generated. Possible values: aix, archive, bsd, deb, dmg,
1679          installed, msi, pkg, and rpm.
1680          Example: --with-package-format='deb rpm']),
1683 AC_ARG_WITH(tls,
1684     AS_HELP_STRING([--with-tls],
1685         [Decides which TLS/SSL and cryptographic implementations to use for
1686          LibreOffice's code. Notice that this doesn't apply for depending
1687          libraries like "neon", for example. Default is to use NSS
1688          although OpenSSL is also possible. Notice that selecting NSS restricts
1689          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1690          restrict by now the usage of NSS in LO's code. Possible values:
1691          openssl, nss. Example: --with-tls="nss"]),
1694 AC_ARG_WITH(system-libs,
1695     AS_HELP_STRING([--with-system-libs],
1696         [Use libraries already on system -- enables all --with-system-* flags.]),
1699 AC_ARG_WITH(system-bzip2,
1700     AS_HELP_STRING([--with-system-bzip2],
1701         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1702     [with_system_bzip2="$with_system_libs"])
1704 AC_ARG_WITH(system-headers,
1705     AS_HELP_STRING([--with-system-headers],
1706         [Use headers already on system -- enables all --with-system-* flags for
1707          external packages whose headers are the only entities used i.e.
1708          boost/odbc/sane-header(s).]),,
1709     [with_system_headers="$with_system_libs"])
1711 AC_ARG_WITH(system-jars,
1712     AS_HELP_STRING([--without-system-jars],
1713         [When building with --with-system-libs, also the needed jars are expected
1714          on the system. Use this to disable that]),,
1715     [with_system_jars="$with_system_libs"])
1717 AC_ARG_WITH(system-cairo,
1718     AS_HELP_STRING([--with-system-cairo],
1719         [Use cairo libraries already on system.  Happens automatically for
1720          (implicit) --enable-gtk3.]))
1722 AC_ARG_WITH(system-epoxy,
1723     AS_HELP_STRING([--with-system-epoxy],
1724         [Use epoxy libraries already on system.  Happens automatically for
1725          (implicit) --enable-gtk3.]),,
1726        [with_system_epoxy="$with_system_libs"])
1728 AC_ARG_WITH(myspell-dicts,
1729     AS_HELP_STRING([--with-myspell-dicts],
1730         [Adds myspell dictionaries to the LibreOffice installation set]),
1733 AC_ARG_WITH(system-dicts,
1734     AS_HELP_STRING([--without-system-dicts],
1735         [Do not use dictionaries from system paths.]),
1738 AC_ARG_WITH(external-dict-dir,
1739     AS_HELP_STRING([--with-external-dict-dir],
1740         [Specify external dictionary dir.]),
1743 AC_ARG_WITH(external-hyph-dir,
1744     AS_HELP_STRING([--with-external-hyph-dir],
1745         [Specify external hyphenation pattern dir.]),
1748 AC_ARG_WITH(external-thes-dir,
1749     AS_HELP_STRING([--with-external-thes-dir],
1750         [Specify external thesaurus dir.]),
1753 AC_ARG_WITH(system-zlib,
1754     AS_HELP_STRING([--with-system-zlib],
1755         [Use zlib already on system.]),,
1756     [with_system_zlib=auto])
1758 AC_ARG_WITH(system-jpeg,
1759     AS_HELP_STRING([--with-system-jpeg],
1760         [Use jpeg already on system.]),,
1761     [with_system_jpeg="$with_system_libs"])
1763 AC_ARG_WITH(system-clucene,
1764     AS_HELP_STRING([--with-system-clucene],
1765         [Use clucene already on system.]),,
1766     [with_system_clucene="$with_system_libs"])
1768 AC_ARG_WITH(system-expat,
1769     AS_HELP_STRING([--with-system-expat],
1770         [Use expat already on system.]),,
1771     [with_system_expat="$with_system_libs"])
1773 AC_ARG_WITH(system-libxml,
1774     AS_HELP_STRING([--with-system-libxml],
1775         [Use libxml/libxslt already on system.]),,
1776     [with_system_libxml=auto])
1778 AC_ARG_WITH(system-icu,
1779     AS_HELP_STRING([--with-system-icu],
1780         [Use icu already on system.]),,
1781     [with_system_icu="$with_system_libs"])
1783 AC_ARG_WITH(system-ucpp,
1784     AS_HELP_STRING([--with-system-ucpp],
1785         [Use ucpp already on system.]),,
1786     [])
1788 AC_ARG_WITH(system-openldap,
1789     AS_HELP_STRING([--with-system-openldap],
1790         [Use the OpenLDAP LDAP SDK already on system.]),,
1791     [with_system_openldap="$with_system_libs"])
1793 libo_FUZZ_ARG_ENABLE(poppler,
1794     AS_HELP_STRING([--disable-poppler],
1795         [Disable building Poppler.])
1798 AC_ARG_WITH(system-poppler,
1799     AS_HELP_STRING([--with-system-poppler],
1800         [Use system poppler (only needed for PDF import).]),,
1801     [with_system_poppler="$with_system_libs"])
1803 libo_FUZZ_ARG_ENABLE(gpgmepp,
1804     AS_HELP_STRING([--disable-gpgmepp],
1805         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
1808 AC_ARG_WITH(system-gpgmepp,
1809     AS_HELP_STRING([--with-system-gpgmepp],
1810         [Use gpgmepp already on system]),,
1811     [with_system_gpgmepp="$with_system_libs"])
1813 AC_ARG_WITH(system-apache-commons,
1814     AS_HELP_STRING([--with-system-apache-commons],
1815         [Use Apache commons libraries already on system.]),,
1816     [with_system_apache_commons="$with_system_jars"])
1818 AC_ARG_WITH(system-mariadb,
1819     AS_HELP_STRING([--with-system-mariadb],
1820         [Use MariaDB/MySQL libraries already on system.]),,
1821     [with_system_mariadb="$with_system_libs"])
1823 AC_ARG_ENABLE(bundle-mariadb,
1824     AS_HELP_STRING([--enable-bundle-mariadb],
1825         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1828 AC_ARG_WITH(system-postgresql,
1829     AS_HELP_STRING([--with-system-postgresql],
1830         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1831          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1832     [with_system_postgresql="$with_system_libs"])
1834 AC_ARG_WITH(libpq-path,
1835     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1836         [Use this PostgreSQL C interface (libpq) installation for building
1837          the PostgreSQL-SDBC extension.]),
1840 AC_ARG_WITH(system-firebird,
1841     AS_HELP_STRING([--with-system-firebird],
1842         [Use Firebird libraries already on system, for building the Firebird-SDBC
1843          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1844     [with_system_firebird="$with_system_libs"])
1846 AC_ARG_WITH(system-libtommath,
1847             AS_HELP_STRING([--with-system-libtommath],
1848                            [Use libtommath already on system]),,
1849             [with_system_libtommath="$with_system_libs"])
1851 AC_ARG_WITH(system-hsqldb,
1852     AS_HELP_STRING([--with-system-hsqldb],
1853         [Use hsqldb already on system.]))
1855 AC_ARG_WITH(hsqldb-jar,
1856     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1857         [Specify path to jarfile manually.]),
1858     HSQLDB_JAR=$withval)
1860 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1861     AS_HELP_STRING([--disable-scripting-beanshell],
1862         [Disable support for scripts in BeanShell.]),
1866 AC_ARG_WITH(system-beanshell,
1867     AS_HELP_STRING([--with-system-beanshell],
1868         [Use beanshell already on system.]),,
1869     [with_system_beanshell="$with_system_jars"])
1871 AC_ARG_WITH(beanshell-jar,
1872     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1873         [Specify path to jarfile manually.]),
1874     BSH_JAR=$withval)
1876 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1877     AS_HELP_STRING([--disable-scripting-javascript],
1878         [Disable support for scripts in JavaScript.]),
1882 AC_ARG_WITH(system-rhino,
1883     AS_HELP_STRING([--with-system-rhino],
1884         [Use rhino already on system.]),,)
1885 #    [with_system_rhino="$with_system_jars"])
1886 # Above is not used as we have different debug interface
1887 # patched into internal rhino. This code needs to be fixed
1888 # before we can enable it by default.
1890 AC_ARG_WITH(rhino-jar,
1891     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1892         [Specify path to jarfile manually.]),
1893     RHINO_JAR=$withval)
1895 AC_ARG_WITH(commons-logging-jar,
1896     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1897         [Specify path to jarfile manually.]),
1898     COMMONS_LOGGING_JAR=$withval)
1900 AC_ARG_WITH(system-jfreereport,
1901     AS_HELP_STRING([--with-system-jfreereport],
1902         [Use JFreeReport already on system.]),,
1903     [with_system_jfreereport="$with_system_jars"])
1905 AC_ARG_WITH(sac-jar,
1906     AS_HELP_STRING([--with-sac-jar=JARFILE],
1907         [Specify path to jarfile manually.]),
1908     SAC_JAR=$withval)
1910 AC_ARG_WITH(libxml-jar,
1911     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1912         [Specify path to jarfile manually.]),
1913     LIBXML_JAR=$withval)
1915 AC_ARG_WITH(flute-jar,
1916     AS_HELP_STRING([--with-flute-jar=JARFILE],
1917         [Specify path to jarfile manually.]),
1918     FLUTE_JAR=$withval)
1920 AC_ARG_WITH(jfreereport-jar,
1921     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1922         [Specify path to jarfile manually.]),
1923     JFREEREPORT_JAR=$withval)
1925 AC_ARG_WITH(liblayout-jar,
1926     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1927         [Specify path to jarfile manually.]),
1928     LIBLAYOUT_JAR=$withval)
1930 AC_ARG_WITH(libloader-jar,
1931     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1932         [Specify path to jarfile manually.]),
1933     LIBLOADER_JAR=$withval)
1935 AC_ARG_WITH(libformula-jar,
1936     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1937         [Specify path to jarfile manually.]),
1938     LIBFORMULA_JAR=$withval)
1940 AC_ARG_WITH(librepository-jar,
1941     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1942         [Specify path to jarfile manually.]),
1943     LIBREPOSITORY_JAR=$withval)
1945 AC_ARG_WITH(libfonts-jar,
1946     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1947         [Specify path to jarfile manually.]),
1948     LIBFONTS_JAR=$withval)
1950 AC_ARG_WITH(libserializer-jar,
1951     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1952         [Specify path to jarfile manually.]),
1953     LIBSERIALIZER_JAR=$withval)
1955 AC_ARG_WITH(libbase-jar,
1956     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1957         [Specify path to jarfile manually.]),
1958     LIBBASE_JAR=$withval)
1960 AC_ARG_WITH(system-odbc,
1961     AS_HELP_STRING([--with-system-odbc],
1962         [Use the odbc headers already on system.]),,
1963     [with_system_odbc="auto"])
1965 AC_ARG_WITH(system-sane,
1966     AS_HELP_STRING([--with-system-sane],
1967         [Use sane.h already on system.]),,
1968     [with_system_sane="$with_system_headers"])
1970 AC_ARG_WITH(system-bluez,
1971     AS_HELP_STRING([--with-system-bluez],
1972         [Use bluetooth.h already on system.]),,
1973     [with_system_bluez="$with_system_headers"])
1975 AC_ARG_WITH(system-curl,
1976     AS_HELP_STRING([--with-system-curl],
1977         [Use curl already on system.]),,
1978     [with_system_curl=auto])
1980 AC_ARG_WITH(system-boost,
1981     AS_HELP_STRING([--with-system-boost],
1982         [Use boost already on system.]),,
1983     [with_system_boost="$with_system_headers"])
1985 AC_ARG_WITH(system-glm,
1986     AS_HELP_STRING([--with-system-glm],
1987         [Use glm already on system.]),,
1988     [with_system_glm="$with_system_headers"])
1990 AC_ARG_WITH(system-hunspell,
1991     AS_HELP_STRING([--with-system-hunspell],
1992         [Use libhunspell already on system.]),,
1993     [with_system_hunspell="$with_system_libs"])
1995 AC_ARG_WITH(system-qrcodegen,
1996     AS_HELP_STRING([--with-system-qrcodegen],
1997         [Use libqrcodegen already on system.]),,
1998     [with_system_qrcodegen="$with_system_libs"])
2000 AC_ARG_WITH(system-box2d,
2001     AS_HELP_STRING([--with-system-box2d],
2002         [Use box2d already on system.]),,
2003     [with_system_box2d="$with_system_libs"])
2005 AC_ARG_WITH(system-mythes,
2006     AS_HELP_STRING([--with-system-mythes],
2007         [Use mythes already on system.]),,
2008     [with_system_mythes="$with_system_libs"])
2010 AC_ARG_WITH(system-altlinuxhyph,
2011     AS_HELP_STRING([--with-system-altlinuxhyph],
2012         [Use ALTLinuxhyph already on system.]),,
2013     [with_system_altlinuxhyph="$with_system_libs"])
2015 AC_ARG_WITH(system-lpsolve,
2016     AS_HELP_STRING([--with-system-lpsolve],
2017         [Use lpsolve already on system.]),,
2018     [with_system_lpsolve="$with_system_libs"])
2020 AC_ARG_WITH(system-coinmp,
2021     AS_HELP_STRING([--with-system-coinmp],
2022         [Use CoinMP already on system.]),,
2023     [with_system_coinmp="$with_system_libs"])
2025 AC_ARG_WITH(system-liblangtag,
2026     AS_HELP_STRING([--with-system-liblangtag],
2027         [Use liblangtag library already on system.]),,
2028     [with_system_liblangtag="$with_system_libs"])
2030 AC_ARG_WITH(webdav,
2031     AS_HELP_STRING([--with-webdav],
2032         [Specify which library to use for webdav implementation.
2033          Possible values: "neon", "serf", "no". The default value is "neon".
2034          Example: --with-webdav="serf"]),
2035     WITH_WEBDAV=$withval,
2036     WITH_WEBDAV="neon")
2038 AC_ARG_WITH(linker-hash-style,
2039     AS_HELP_STRING([--with-linker-hash-style],
2040         [Use linker with --hash-style=<style> when linking shared objects.
2041          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2042          if supported on the build system, and "sysv" otherwise.]))
2044 AC_ARG_WITH(jdk-home,
2045     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2046         [If you have installed JDK 9 or later on your system please supply the
2047          path here. Note that this is not the location of the java command but the
2048          location of the entire distribution.]),
2051 AC_ARG_WITH(help,
2052     AS_HELP_STRING([--with-help],
2053         [Enable the build of help. There is a special parameter "common" that
2054          can be used to bundle only the common part, .e.g help-specific icons.
2055          This is useful when you build the helpcontent separately.])
2056     [
2057                           Usage:     --with-help    build the old local help
2058                                  --without-help     no local help (default)
2059                                  --with-help=html   build the new HTML local help
2060                                  --with-help=online build the new HTML online help
2061     ],
2064 AC_ARG_WITH(omindex,
2065    AS_HELP_STRING([--with-omindex],
2066         [Enable the support of xapian-omega index for online help.])
2067    [
2068                          Usage: --with-omindex=server prepare the pages for omindex
2069                                 but let xapian-omega be built in server.
2070                                 --with-omindex=noxap do not prepare online pages
2071                                 for xapian-omega
2072   ],
2075 libo_FUZZ_ARG_WITH(java,
2076     AS_HELP_STRING([--with-java=<java command>],
2077         [Specify the name of the Java interpreter command. Typically "java"
2078          which is the default.
2080          To build without support for Java components, applets, accessibility
2081          or the XML filters written in Java, use --without-java or --with-java=no.]),
2082     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2083     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2086 AC_ARG_WITH(jvm-path,
2087     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2088         [Use a specific JVM search path at runtime.
2089          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2092 AC_ARG_WITH(ant-home,
2093     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2094         [If you have installed Apache Ant on your system, please supply the path here.
2095          Note that this is not the location of the Ant binary but the location
2096          of the entire distribution.]),
2099 AC_ARG_WITH(symbol-config,
2100     AS_HELP_STRING([--with-symbol-config],
2101         [Configuration for the crashreport symbol upload]),
2102         [],
2103         [with_symbol_config=no])
2105 AC_ARG_WITH(export-validation,
2106     AS_HELP_STRING([--without-export-validation],
2107         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2108 ,with_export_validation=auto)
2110 AC_ARG_WITH(bffvalidator,
2111     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2112         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2113          Requires installed Microsoft Office Binary File Format Validator.
2114          Note: export-validation (--with-export-validation) is required to be turned on.
2115          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2116 ,with_bffvalidator=no)
2118 libo_FUZZ_ARG_WITH(junit,
2119     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2120         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2121          --without-junit disables those tests. Not relevant in the --without-java case.]),
2122 ,with_junit=yes)
2124 AC_ARG_WITH(hamcrest,
2125     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2126         [Specifies the hamcrest jar file to use for JUnit-based tests.
2127          --without-junit disables those tests. Not relevant in the --without-java case.]),
2128 ,with_hamcrest=yes)
2130 AC_ARG_WITH(perl-home,
2131     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2132         [If you have installed Perl 5 Distribution, on your system, please
2133          supply the path here. Note that this is not the location of the Perl
2134          binary but the location of the entire distribution.]),
2137 libo_FUZZ_ARG_WITH(doxygen,
2138     AS_HELP_STRING(
2139         [--with-doxygen=<absolute path to doxygen executable>],
2140         [Specifies the doxygen executable to use when generating ODK C/C++
2141          documentation. --without-doxygen disables generation of ODK C/C++
2142          documentation. Not relevant in the --disable-odk case.]),
2143 ,with_doxygen=yes)
2145 AC_ARG_WITH(visual-studio,
2146     AS_HELP_STRING([--with-visual-studio=<2019>],
2147         [Specify which Visual Studio version to use in case several are
2148          installed. Currently only 2019 (default) is supported.]),
2151 AC_ARG_WITH(windows-sdk,
2152     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2153         [Specify which Windows SDK, or "Windows Kit", version to use
2154          in case the one that came with the selected Visual Studio
2155          is not what you want for some reason. Note that not all compiler/SDK
2156          combinations are supported. The intent is that this option should not
2157          be needed.]),
2160 AC_ARG_WITH(lang,
2161     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2162         [Use this option to build LibreOffice with additional UI language support.
2163          English (US) is always included by default.
2164          Separate multiple languages with space.
2165          For all languages, use --with-lang=ALL.]),
2168 AC_ARG_WITH(locales,
2169     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2170         [Use this option to limit the locale information built in.
2171          Separate multiple locales with space.
2172          Very experimental and might well break stuff.
2173          Just a desperate measure to shrink code and data size.
2174          By default all the locales available is included.
2175          This option is completely unrelated to --with-lang.])
2176     [
2177                           Affects also our character encoding conversion
2178                           tables for encodings mainly targeted for a
2179                           particular locale, like EUC-CN and EUC-TW for
2180                           zh, ISO-2022-JP for ja.
2182                           Affects also our add-on break iterator data for
2183                           some languages.
2185                           For the default, all locales, don't use this switch at all.
2186                           Specifying just the language part of a locale means all matching
2187                           locales will be included.
2188     ],
2191 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2192 libo_FUZZ_ARG_WITH(krb5,
2193     AS_HELP_STRING([--with-krb5],
2194         [Enable MIT Kerberos 5 support in modules that support it.
2195          By default automatically enabled on platforms
2196          where a good system Kerberos 5 is available.]),
2199 libo_FUZZ_ARG_WITH(gssapi,
2200     AS_HELP_STRING([--with-gssapi],
2201         [Enable GSSAPI support in modules that support it.
2202          By default automatically enabled on platforms
2203          where a good system GSSAPI is available.]),
2206 AC_ARG_WITH(iwyu,
2207     AS_HELP_STRING([--with-iwyu],
2208         [Use given IWYU binary path to check unneeded includes instead of building.
2209          Use only if you are hacking on it.]),
2212 libo_FUZZ_ARG_WITH(lxml,
2213     AS_HELP_STRING([--without-lxml],
2214         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2215          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2216          report widget classes and ids.]),
2219 libo_FUZZ_ARG_WITH(latest-c++,
2220     AS_HELP_STRING([--with-latest-c++],
2221         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2222          published standard.]),,
2223         [with_latest_c__=no])
2225 dnl ===================================================================
2226 dnl Branding
2227 dnl ===================================================================
2229 AC_ARG_WITH(branding,
2230     AS_HELP_STRING([--with-branding=/path/to/images],
2231         [Use given path to retrieve branding images set.])
2232     [
2233                           Search for intro.png about.svg and logo.svg.
2234                           If any is missing, default ones will be used instead.
2236                           Search also progress.conf for progress
2237                           settings on intro screen :
2239                           PROGRESSBARCOLOR="255,255,255" Set color of
2240                           progress bar. Comma separated RGB decimal values.
2241                           PROGRESSSIZE="407,6" Set size of progress bar.
2242                           Comma separated decimal values (width, height).
2243                           PROGRESSPOSITION="61,317" Set position of progress
2244                           bar from left,top. Comma separated decimal values.
2245                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2246                           bar frame. Comma separated RGB decimal values.
2247                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2248                           bar text. Comma separated RGB decimal values.
2249                           PROGRESSTEXTBASELINE="287" Set vertical position of
2250                           progress bar text from top. Decimal value.
2252                           Default values will be used if not found.
2253     ],
2257 AC_ARG_WITH(extra-buildid,
2258     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2259         [Show addition build identification in about dialog.]),
2263 AC_ARG_WITH(vendor,
2264     AS_HELP_STRING([--with-vendor="John the Builder"],
2265         [Set vendor of the build.]),
2268 AC_ARG_WITH(android-package-name,
2269     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2270         [Set Android package name of the build.]),
2273 AC_ARG_WITH(compat-oowrappers,
2274     AS_HELP_STRING([--with-compat-oowrappers],
2275         [Install oo* wrappers in parallel with
2276          lo* ones to keep backward compatibility.
2277          Has effect only with make distro-pack-install]),
2280 AC_ARG_WITH(os-version,
2281     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2282         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2285 AC_ARG_WITH(mingw-cross-compiler,
2286     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2287         [Specify the MinGW cross-compiler to use.
2288          When building on the ODK on Unix and building unowinreg.dll,
2289          specify the MinGW C++ cross-compiler.]),
2292 AC_ARG_WITH(idlc-cpp,
2293     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2294         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2297 AC_ARG_WITH(parallelism,
2298     AS_HELP_STRING([--with-parallelism],
2299         [Number of jobs to run simultaneously during build. Parallel builds can
2300         save a lot of time on multi-cpu machines. Defaults to the number of
2301         CPUs on the machine, unless you configure --enable-icecream - then to
2302         40.]),
2305 AC_ARG_WITH(all-tarballs,
2306     AS_HELP_STRING([--with-all-tarballs],
2307         [Download all external tarballs unconditionally]))
2309 AC_ARG_WITH(gdrive-client-id,
2310     AS_HELP_STRING([--with-gdrive-client-id],
2311         [Provides the client id of the application for OAuth2 authentication
2312         on Google Drive. If either this or --with-gdrive-client-secret is
2313         empty, the feature will be disabled]),
2316 AC_ARG_WITH(gdrive-client-secret,
2317     AS_HELP_STRING([--with-gdrive-client-secret],
2318         [Provides the client secret of the application for OAuth2
2319         authentication on Google Drive. If either this or
2320         --with-gdrive-client-id is empty, the feature will be disabled]),
2323 AC_ARG_WITH(alfresco-cloud-client-id,
2324     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2325         [Provides the client id of the application for OAuth2 authentication
2326         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2327         empty, the feature will be disabled]),
2330 AC_ARG_WITH(alfresco-cloud-client-secret,
2331     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2332         [Provides the client secret of the application for OAuth2
2333         authentication on Alfresco Cloud. If either this or
2334         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2337 AC_ARG_WITH(onedrive-client-id,
2338     AS_HELP_STRING([--with-onedrive-client-id],
2339         [Provides the client id of the application for OAuth2 authentication
2340         on OneDrive. If either this or --with-onedrive-client-secret is
2341         empty, the feature will be disabled]),
2344 AC_ARG_WITH(onedrive-client-secret,
2345     AS_HELP_STRING([--with-onedrive-client-secret],
2346         [Provides the client secret of the application for OAuth2
2347         authentication on OneDrive. If either this or
2348         --with-onedrive-client-id is empty, the feature will be disabled]),
2350 dnl ===================================================================
2351 dnl Do we want to use pre-build binary tarball for recompile
2352 dnl ===================================================================
2354 if test "$enable_library_bin_tar" = "yes" ; then
2355     USE_LIBRARY_BIN_TAR=TRUE
2356 else
2357     USE_LIBRARY_BIN_TAR=
2359 AC_SUBST(USE_LIBRARY_BIN_TAR)
2361 dnl ===================================================================
2362 dnl Test whether build target is Release Build
2363 dnl ===================================================================
2364 AC_MSG_CHECKING([whether build target is Release Build])
2365 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2366     AC_MSG_RESULT([no])
2367     ENABLE_RELEASE_BUILD=
2368     GET_TASK_ALLOW_ENTITLEMENT='
2369         <!-- We want to be able to debug a hardened process when not building for release -->
2370         <key>com.apple.security.get-task-allow</key>
2371         <true/>'
2372 else
2373     AC_MSG_RESULT([yes])
2374     ENABLE_RELEASE_BUILD=TRUE
2375     GET_TASK_ALLOW_ENTITLEMENT=''
2377 AC_SUBST(ENABLE_RELEASE_BUILD)
2378 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2380 dnl ===================================================================
2381 dnl Test whether to sign Windows Build
2382 dnl ===================================================================
2383 AC_MSG_CHECKING([whether to sign windows build])
2384 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2385     AC_MSG_RESULT([yes])
2386     WINDOWS_BUILD_SIGNING="TRUE"
2387 else
2388     AC_MSG_RESULT([no])
2389     WINDOWS_BUILD_SIGNING="FALSE"
2391 AC_SUBST(WINDOWS_BUILD_SIGNING)
2393 dnl ===================================================================
2394 dnl MacOSX build and runtime environment options
2395 dnl ===================================================================
2397 AC_ARG_WITH(macosx-sdk,
2398     AS_HELP_STRING([--with-macosx-sdk=<version>],
2399         [Prefer a specific SDK for building.])
2400     [
2401                           If the requested SDK is not available, a search for the oldest one will be done.
2402                           With current Xcode versions, only the latest SDK is included, so this option is
2403                           not terribly useful. It works fine to build with a new SDK and run the result
2404                           on an older OS.
2406                           e. g.: --with-macosx-sdk=10.10
2408                           there are 3 options to control the MacOSX build:
2409                           --with-macosx-sdk (referred as 'sdk' below)
2410                           --with-macosx-version-min-required (referred as 'min' below)
2411                           --with-macosx-version-max-allowed (referred as 'max' below)
2413                           the connection between these value and the default they take is as follow:
2414                           ( ? means not specified on the command line, s means the SDK version found,
2415                           constraint: 8 <= x <= y <= z)
2417                           ==========================================
2418                            command line      || config result
2419                           ==========================================
2420                           min  | max  | sdk  || min   | max  | sdk  |
2421                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2422                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2423                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2424                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2425                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2426                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2427                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2428                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2431                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2432                           for a detailed technical explanation of these variables
2434                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2435     ],
2438 AC_ARG_WITH(macosx-version-min-required,
2439     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2440         [set the minimum OS version needed to run the built LibreOffice])
2441     [
2442                           e. g.: --with-macos-version-min-required=10.10
2443                           see --with-macosx-sdk for more info
2444     ],
2447 AC_ARG_WITH(macosx-version-max-allowed,
2448     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2449         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2450     [
2451                           e. g.: --with-macos-version-max-allowed=10.10
2452                           see --with-macosx-sdk for more info
2453     ],
2457 dnl ===================================================================
2458 dnl options for stuff used during cross-compilation build
2459 dnl Not quite superseded by --with-build-platform-configure-options.
2460 dnl TODO: check, if the "force" option is still needed anywhere.
2461 dnl ===================================================================
2463 AC_ARG_WITH(system-icu-for-build,
2464     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2465         [Use icu already on system for build tools (cross-compilation only).]))
2468 dnl ===================================================================
2469 dnl Check for incompatible options set by fuzzing, and reset those
2470 dnl automatically to working combinations
2471 dnl ===================================================================
2473 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2474         "$enable_dbus" != "$enable_avahi"; then
2475     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2476     enable_avahi=$enable_dbus
2479 add_lopath_after ()
2481     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2482         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2483     fi
2486 add_lopath_before ()
2488     local IFS=${P_SEP}
2489     local path_cleanup
2490     local dir
2491     for dir in $LO_PATH ; do
2492         if test "$dir" != "$1" ; then
2493             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2494         fi
2495     done
2496     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2499 dnl ===================================================================
2500 dnl check for required programs (grep, awk, sed, bash)
2501 dnl ===================================================================
2503 pathmunge ()
2505     if test -n "$1"; then
2506         if test "$build_os" = "cygwin"; then
2507             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2508                 PathFormat "$1"
2509                 new_path=`cygpath -sm "$formatted_path"`
2510             else
2511                 PathFormat "$1"
2512                 new_path=`cygpath -u "$formatted_path"`
2513             fi
2514         else
2515             new_path="$1"
2516         fi
2517         if test "$2" = "after"; then
2518             add_lopath_after "$new_path"
2519         else
2520             add_lopath_before "$new_path"
2521         fi
2522         unset new_path
2523     fi
2526 AC_PROG_AWK
2527 AC_PATH_PROG( AWK, $AWK)
2528 if test -z "$AWK"; then
2529     AC_MSG_ERROR([install awk to run this script])
2532 AC_PATH_PROG(BASH, bash)
2533 if test -z "$BASH"; then
2534     AC_MSG_ERROR([bash not found in \$PATH])
2536 AC_SUBST(BASH)
2538 AC_MSG_CHECKING([for GNU or BSD tar])
2539 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2540     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2541     if test $? -eq 0;  then
2542         GNUTAR=$a
2543         break
2544     fi
2545 done
2546 AC_MSG_RESULT($GNUTAR)
2547 if test -z "$GNUTAR"; then
2548     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2550 AC_SUBST(GNUTAR)
2552 AC_MSG_CHECKING([for tar's option to strip components])
2553 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2554 if test $? -eq 0; then
2555     STRIP_COMPONENTS="--strip-components"
2556 else
2557     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2558     if test $? -eq 0; then
2559         STRIP_COMPONENTS="--strip-path"
2560     else
2561         STRIP_COMPONENTS="unsupported"
2562     fi
2564 AC_MSG_RESULT($STRIP_COMPONENTS)
2565 if test x$STRIP_COMPONENTS = xunsupported; then
2566     AC_MSG_ERROR([you need a tar that is able to strip components.])
2568 AC_SUBST(STRIP_COMPONENTS)
2570 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2571 dnl desktop OSes from "mobile" ones.
2573 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2574 dnl In other words, that when building for an OS that is not a
2575 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2577 dnl Note the direction of the implication; there is no assumption that
2578 dnl cross-compiling would imply a non-desktop OS.
2580 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2581     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2582     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2583     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2586 # Whether to build "avmedia" functionality or not.
2588 if test -z "$enable_avmedia"; then
2589     enable_avmedia=yes
2592 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2593 if test "$enable_avmedia" = yes; then
2594     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2595 else
2596     USE_AVMEDIA_DUMMY='TRUE'
2598 AC_SUBST(USE_AVMEDIA_DUMMY)
2600 # Decide whether to build database connectivity stuff (including
2601 # Base) or not. We probably don't want to on non-desktop OSes.
2602 if test -z "$enable_database_connectivity"; then
2603     # --disable-database-connectivity is unfinished work in progress
2604     # and the iOS test app doesn't link if we actually try to use it.
2605     # if test $_os != iOS -a $_os != Android; then
2606     if test $_os != iOS; then
2607         enable_database_connectivity=yes
2608     fi
2611 if test "$enable_database_connectivity" = yes; then
2612     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2613     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2616 if test -z "$enable_extensions"; then
2617     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2618     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2619         enable_extensions=yes
2620     fi
2623 if test "$enable_extensions" = yes; then
2624     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2625     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2628 if test -z "$enable_scripting"; then
2629     # Disable scripting for iOS unless specifically overridden
2630     # with --enable-scripting.
2631     if test $_os != iOS; then
2632         enable_scripting=yes
2633     fi
2636 DISABLE_SCRIPTING=''
2637 if test "$enable_scripting" = yes; then
2638     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2639     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2640 else
2641     DISABLE_SCRIPTING='TRUE'
2642     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2645 if test $_os = iOS -o $_os = Android; then
2646     # Disable dynamic_loading always for iOS and Android
2647     enable_dynamic_loading=no
2648 elif test -z "$enable_dynamic_loading"; then
2649     # Otherwise enable it unless specifically disabled
2650     enable_dynamic_loading=yes
2653 DISABLE_DYNLOADING=''
2654 if test "$enable_dynamic_loading" = yes; then
2655     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2656 else
2657     DISABLE_DYNLOADING='TRUE'
2659 AC_SUBST(DISABLE_DYNLOADING)
2661 # remember SYSBASE value
2662 AC_SUBST(SYSBASE)
2664 dnl ===================================================================
2665 dnl  Sort out various gallery compilation options
2666 dnl ===================================================================
2667 AC_MSG_CHECKING([how to build and package galleries])
2668 if test -n "${with_galleries}"; then
2669     if test "$with_galleries" = "build"; then
2670         WITH_GALLERY_BUILD=TRUE
2671         AC_MSG_RESULT([build from source images internally])
2672     elif test "$with_galleries" = "no"; then
2673         WITH_GALLERY_BUILD=
2674         AC_MSG_RESULT([disable non-internal gallery build])
2675     else
2676         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2677     fi
2678 else
2679     if test $_os != iOS -a $_os != Android; then
2680         WITH_GALLERY_BUILD=TRUE
2681         AC_MSG_RESULT([internal src images for desktop])
2682     else
2683         WITH_GALLERY_BUILD=
2684         AC_MSG_RESULT([disable src image build])
2685     fi
2687 AC_SUBST(WITH_GALLERY_BUILD)
2689 dnl ===================================================================
2690 dnl  Checks if ccache is available
2691 dnl ===================================================================
2692 CCACHE_DEPEND_MODE=
2693 if test "$_os" = "WINNT"; then
2694     # on windows/VC build do not use ccache
2695     CCACHE=""
2696 elif test "$enable_ccache" = "no"; then
2697     CCACHE=""
2698 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2699     case "%$CC%$CXX%" in
2700     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2701     # assume that's good then
2702     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2703         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2704         CCACHE_DEPEND_MODE=1
2705         ;;
2706     *)
2707         AC_PATH_PROG([CCACHE],[ccache],[not found])
2708         if test "$CCACHE" = "not found"; then
2709             CCACHE=""
2710         else
2711             CCACHE_DEPEND_MODE=1
2712             # Need to check for ccache version: otherwise prevents
2713             # caching of the results (like "-x objective-c++" for Mac)
2714             if test $_os = Darwin -o $_os = iOS; then
2715                 # Check ccache version
2716                 AC_MSG_CHECKING([whether version of ccache is suitable])
2717                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2718                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2719                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2720                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2721                 else
2722                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2723                     CCACHE=""
2724                     CCACHE_DEPEND_MODE=
2725                 fi
2726             fi
2727         fi
2728         ;;
2729     esac
2730 else
2731     CCACHE=""
2733 if test "$enable_ccache" = "nodepend"; then
2734     CCACHE_DEPEND_MODE=""
2736 AC_SUBST(CCACHE_DEPEND_MODE)
2738 if test "$CCACHE" != ""; then
2739     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2740     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2741     if test "$ccache_size" = ""; then
2742         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2743         if test "$ccache_size" = ""; then
2744             ccache_size=0
2745         fi
2746         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2747         if test $ccache_size -lt 1024; then
2748             CCACHE=""
2749             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2750             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2751         else
2752             # warn that ccache may be too small for debug build
2753             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2754             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2755         fi
2756     else
2757         if test $ccache_size -lt 5; then
2758             #warn that ccache may be too small for debug build
2759             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2760             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2761         fi
2762     fi
2765 dnl ===================================================================
2766 dnl  Checks for C compiler,
2767 dnl  The check for the C++ compiler is later on.
2768 dnl ===================================================================
2769 if test "$_os" != "WINNT"; then
2770     GCC_HOME_SET="true"
2771     AC_MSG_CHECKING([gcc home])
2772     if test -z "$with_gcc_home"; then
2773         if test "$enable_icecream" = "yes"; then
2774             if test -d "/usr/lib/icecc/bin"; then
2775                 GCC_HOME="/usr/lib/icecc/"
2776             elif test -d "/usr/libexec/icecc/bin"; then
2777                 GCC_HOME="/usr/libexec/icecc/"
2778             elif test -d "/opt/icecream/bin"; then
2779                 GCC_HOME="/opt/icecream/"
2780             else
2781                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2783             fi
2784         else
2785             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2786             GCC_HOME_SET="false"
2787         fi
2788     else
2789         GCC_HOME="$with_gcc_home"
2790     fi
2791     AC_MSG_RESULT($GCC_HOME)
2792     AC_SUBST(GCC_HOME)
2794     if test "$GCC_HOME_SET" = "true"; then
2795         if test -z "$CC"; then
2796             CC="$GCC_HOME/bin/gcc"
2797             CC_BASE="gcc"
2798         fi
2799         if test -z "$CXX"; then
2800             CXX="$GCC_HOME/bin/g++"
2801             CXX_BASE="g++"
2802         fi
2803     fi
2806 COMPATH=`dirname "$CC"`
2807 if test "$COMPATH" = "."; then
2808     AC_PATH_PROGS(COMPATH, $CC)
2809     dnl double square bracket to get single because of M4 quote...
2810     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2812 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2814 dnl ===================================================================
2815 dnl Java support
2816 dnl ===================================================================
2817 AC_MSG_CHECKING([whether to build with Java support])
2818 if test "$with_java" != "no"; then
2819     if test "$DISABLE_SCRIPTING" = TRUE; then
2820         AC_MSG_RESULT([no, overridden by --disable-scripting])
2821         ENABLE_JAVA=""
2822         with_java=no
2823     else
2824         AC_MSG_RESULT([yes])
2825         ENABLE_JAVA="TRUE"
2826         AC_DEFINE(HAVE_FEATURE_JAVA)
2827     fi
2828 else
2829     AC_MSG_RESULT([no])
2830     ENABLE_JAVA=""
2833 AC_SUBST(ENABLE_JAVA)
2835 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2837 dnl ENABLE_JAVA="" indicate no Java support at all
2839 dnl ===================================================================
2840 dnl Check macOS SDK and compiler
2841 dnl ===================================================================
2843 if test $_os = Darwin; then
2845     # If no --with-macosx-sdk option is given, look for one
2847     # The intent is that for "most" Mac-based developers, a suitable
2848     # SDK will be found automatically without any configure options.
2850     # For developers with a current Xcode, the lowest-numbered SDK
2851     # higher than or equal to the minimum required should be found.
2853     AC_MSG_CHECKING([what macOS SDK to use])
2854     for _macosx_sdk in ${with_macosx_sdk-11.0 10.15 10.14 10.13}; do
2855         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2856         if test -d "$MACOSX_SDK_PATH"; then
2857             with_macosx_sdk="${_macosx_sdk}"
2858             break
2859         else
2860             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2861             if test -d "$MACOSX_SDK_PATH"; then
2862                 with_macosx_sdk="${_macosx_sdk}"
2863                 break
2864             fi
2865         fi
2866     done
2867     if test ! -d "$MACOSX_SDK_PATH"; then
2868         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2869     fi
2871     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2873     case $with_macosx_sdk in
2874     10.13)
2875         MACOSX_SDK_VERSION=101300
2876         ;;
2877     10.14)
2878         MACOSX_SDK_VERSION=101400
2879         ;;
2880     10.15)
2881         MACOSX_SDK_VERSION=101500
2882         ;;
2883     11.0)
2884         MACOSX_SDK_VERSION=110000
2885         ;;
2886     *)
2887         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.0])
2888         ;;
2889     esac
2891     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
2892         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
2893     fi
2895     if test "$with_macosx_version_min_required" = "" ; then
2896         if test "$host_cpu" = x86_64; then
2897             with_macosx_version_min_required="10.10";
2898         else
2899             with_macosx_version_min_required="11.0";
2900         fi
2901     fi
2903     if test "$with_macosx_version_max_allowed" = "" ; then
2904         with_macosx_version_max_allowed="$with_macosx_sdk"
2905     fi
2907     # export this so that "xcrun" invocations later return matching values
2908     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2909     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2910     export DEVELOPER_DIR
2911     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2912     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2914     AC_MSG_CHECKING([whether Xcode is new enough])
2915     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2916     my_xcode_ver2=${my_xcode_ver1#Xcode }
2917     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2918     if test "$my_xcode_ver3" -ge 1103; then
2919         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2920     else
2921         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
2922     fi
2924     case "$with_macosx_version_min_required" in
2925     10.10)
2926         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2927         ;;
2928     10.11)
2929         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2930         ;;
2931     10.12)
2932         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2933         ;;
2934     10.13)
2935         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2936         ;;
2937     10.14)
2938         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2939         ;;
2940     10.15)
2941         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2942         ;;
2943     11.0)
2944         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
2945         ;;
2946     *)
2947         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])
2948         ;;
2949     esac
2951     LIBTOOL=/usr/bin/libtool
2952     INSTALL_NAME_TOOL=install_name_tool
2953     if test -z "$save_CC"; then
2954         stdlib=-stdlib=libc++
2955         if test "$ENABLE_LTO" = TRUE; then
2956             lto=-flto
2957         fi
2959         AC_MSG_CHECKING([what C compiler to use])
2960         CC="`xcrun -find clang`"
2961         CC_BASE=`first_arg_basename "$CC"`
2962         if test "$host_cpu" = x86_64; then
2963             CC+=" -target x86_64-apple-macos"
2964         else
2965             CC+=" -target arm64-apple-macos"
2966         fi
2967         CC+=" $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2968         AC_MSG_RESULT([$CC])
2970         AC_MSG_CHECKING([what C++ compiler to use])
2971         CXX="`xcrun -find clang++`"
2972         CXX_BASE=`first_arg_basename "$CXX"`
2973         if test "$host_cpu" = x86_64; then
2974             CXX+=" -target x86_64-apple-macos"
2975         else
2976             CXX+=" -target arm64-apple-macos"
2977         fi
2978         CXX+=" $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2979         AC_MSG_RESULT([$CXX])
2981         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2982         AR=`xcrun -find ar`
2983         NM=`xcrun -find nm`
2984         STRIP=`xcrun -find strip`
2985         LIBTOOL=`xcrun -find libtool`
2986         RANLIB=`xcrun -find ranlib`
2987     fi
2989     case "$with_macosx_version_max_allowed" in
2990     10.10)
2991         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2992         ;;
2993     10.11)
2994         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2995         ;;
2996     10.12)
2997         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2998         ;;
2999     10.13)
3000         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3001         ;;
3002     10.14)
3003         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3004         ;;
3005     10.15)
3006         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3007         ;;
3008     11.0)
3009         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3010         ;;
3011     *)
3012         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])
3013         ;;
3014     esac
3016     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3017     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3018         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])
3019     else
3020         AC_MSG_RESULT([ok])
3021     fi
3023     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3024     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3025         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3026     else
3027         AC_MSG_RESULT([ok])
3028     fi
3029     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3030     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3032     AC_MSG_CHECKING([whether to do code signing])
3034     if test "$enable_macosx_code_signing" = yes; then
3035         # By default use the first suitable certificate (?).
3037         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3038         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3039         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3040         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3041         # "Developer ID Application" one.
3043         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3044         if test -n "$identity"; then
3045             MACOSX_CODESIGNING_IDENTITY=$identity
3046             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3047             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3048         else
3049             AC_MSG_ERROR([cannot determine identity to use])
3050         fi
3051     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3052         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3053         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3054         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3055     else
3056         AC_MSG_RESULT([no])
3057     fi
3059     AC_MSG_CHECKING([whether to create a Mac App Store package])
3061     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3062         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3063     elif test "$enable_macosx_package_signing" = yes; then
3064         # By default use the first suitable certificate.
3065         # It should be a "3rd Party Mac Developer Installer" one
3067         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3068         if test -n "$identity"; then
3069             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3070             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3071             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3072         else
3073             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3074         fi
3075     elif test -n "$enable_macosx_package_signing"; then
3076         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3077         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3078         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3079     else
3080         AC_MSG_RESULT([no])
3081     fi
3083     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3084         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3085     fi
3087     AC_MSG_CHECKING([whether to sandbox the application])
3089     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3090         AC_MSG_ERROR([macOS sandboxing requires code signing])
3091     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3092         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3093     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3094         ENABLE_MACOSX_SANDBOX=TRUE
3095         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3096         AC_MSG_RESULT([yes])
3097     else
3098         AC_MSG_RESULT([no])
3099     fi
3101     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3102     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3103     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3105 AC_SUBST(MACOSX_SDK_PATH)
3106 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3107 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3108 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3109 AC_SUBST(INSTALL_NAME_TOOL)
3110 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3111 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3112 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3113 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3114 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3116 dnl ===================================================================
3117 dnl Check iOS SDK and compiler
3118 dnl ===================================================================
3120 if test $_os = iOS; then
3121     AC_MSG_CHECKING([what iOS SDK to use])
3122     current_sdk_ver=14.0
3123     older_sdk_vers="13.6 13.5 13.4 13.2 13.1 13.0 12.4 12.2"
3124     if test "$enable_ios_simulator" = "yes"; then
3125         platform=iPhoneSimulator
3126         versionmin=-mios-simulator-version-min=12.2
3127     else
3128         platform=iPhoneOS
3129         versionmin=-miphoneos-version-min=12.2
3130     fi
3131     xcode_developer=`xcode-select -print-path`
3133     for sdkver in $current_sdk_ver $older_sdk_vers; do
3134         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3135         if test -d $t; then
3136             sysroot=$t
3137             break
3138         fi
3139     done
3141     if test -z "$sysroot"; then
3142         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3143     fi
3145     AC_MSG_RESULT($sysroot)
3147     # LTO is not really recommended for iOS builds,
3148     # the link time will be astronomical
3149     if test "$ENABLE_LTO" = TRUE; then
3150         lto=-flto
3151     fi
3153     stdlib="-stdlib=libc++"
3155     AC_MSG_CHECKING([what C compiler to use])
3156     CC="`xcrun -find clang`"
3157     CC_BASE=`first_arg_basename "$CC"`
3158     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3159     AC_MSG_RESULT([$CC])
3161     AC_MSG_CHECKING([what C++ compiler to use])
3162     CXX="`xcrun -find clang++`"
3163     CXX_BASE=`first_arg_basename "$CXX"`
3164     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3165     AC_MSG_RESULT([$CXX])
3167     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3168     AR=`xcrun -find ar`
3169     NM=`xcrun -find nm`
3170     STRIP=`xcrun -find strip`
3171     LIBTOOL=`xcrun -find libtool`
3172     RANLIB=`xcrun -find ranlib`
3175 AC_MSG_CHECKING([whether to treat the installation as read-only])
3177 if test $_os = Darwin; then
3178     enable_readonly_installset=yes
3179 elif test "$enable_extensions" != yes; then
3180     enable_readonly_installset=yes
3182 if test "$enable_readonly_installset" = yes; then
3183     AC_MSG_RESULT([yes])
3184     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3185 else
3186     AC_MSG_RESULT([no])
3189 dnl ===================================================================
3190 dnl Structure of install set
3191 dnl ===================================================================
3193 if test $_os = Darwin; then
3194     LIBO_BIN_FOLDER=MacOS
3195     LIBO_ETC_FOLDER=Resources
3196     LIBO_LIBEXEC_FOLDER=MacOS
3197     LIBO_LIB_FOLDER=Frameworks
3198     LIBO_LIB_PYUNO_FOLDER=Resources
3199     LIBO_SHARE_FOLDER=Resources
3200     LIBO_SHARE_HELP_FOLDER=Resources/help
3201     LIBO_SHARE_JAVA_FOLDER=Resources/java
3202     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3203     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3204     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3205     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3206     LIBO_URE_BIN_FOLDER=MacOS
3207     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3208     LIBO_URE_LIB_FOLDER=Frameworks
3209     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3210     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3211 elif test $_os = WINNT; then
3212     LIBO_BIN_FOLDER=program
3213     LIBO_ETC_FOLDER=program
3214     LIBO_LIBEXEC_FOLDER=program
3215     LIBO_LIB_FOLDER=program
3216     LIBO_LIB_PYUNO_FOLDER=program
3217     LIBO_SHARE_FOLDER=share
3218     LIBO_SHARE_HELP_FOLDER=help
3219     LIBO_SHARE_JAVA_FOLDER=program/classes
3220     LIBO_SHARE_PRESETS_FOLDER=presets
3221     LIBO_SHARE_READMES_FOLDER=readmes
3222     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3223     LIBO_SHARE_SHELL_FOLDER=program/shell
3224     LIBO_URE_BIN_FOLDER=program
3225     LIBO_URE_ETC_FOLDER=program
3226     LIBO_URE_LIB_FOLDER=program
3227     LIBO_URE_MISC_FOLDER=program
3228     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3229 else
3230     LIBO_BIN_FOLDER=program
3231     LIBO_ETC_FOLDER=program
3232     LIBO_LIBEXEC_FOLDER=program
3233     LIBO_LIB_FOLDER=program
3234     LIBO_LIB_PYUNO_FOLDER=program
3235     LIBO_SHARE_FOLDER=share
3236     LIBO_SHARE_HELP_FOLDER=help
3237     LIBO_SHARE_JAVA_FOLDER=program/classes
3238     LIBO_SHARE_PRESETS_FOLDER=presets
3239     LIBO_SHARE_READMES_FOLDER=readmes
3240     if test "$enable_fuzzers" != yes; then
3241         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3242     else
3243         LIBO_SHARE_RESOURCE_FOLDER=resource
3244     fi
3245     LIBO_SHARE_SHELL_FOLDER=program/shell
3246     LIBO_URE_BIN_FOLDER=program
3247     LIBO_URE_ETC_FOLDER=program
3248     LIBO_URE_LIB_FOLDER=program
3249     LIBO_URE_MISC_FOLDER=program
3250     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3252 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3253 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3254 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3255 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3256 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3257 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3258 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3259 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3260 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3261 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3262 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3263 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3264 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3265 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3266 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3267 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3269 # Not all of them needed in config_host.mk, add more if need arises
3270 AC_SUBST(LIBO_BIN_FOLDER)
3271 AC_SUBST(LIBO_ETC_FOLDER)
3272 AC_SUBST(LIBO_LIB_FOLDER)
3273 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3274 AC_SUBST(LIBO_SHARE_FOLDER)
3275 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3276 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3277 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3278 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3279 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3280 AC_SUBST(LIBO_URE_BIN_FOLDER)
3281 AC_SUBST(LIBO_URE_ETC_FOLDER)
3282 AC_SUBST(LIBO_URE_LIB_FOLDER)
3283 AC_SUBST(LIBO_URE_MISC_FOLDER)
3284 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3286 dnl ===================================================================
3287 dnl Windows specific tests and stuff
3288 dnl ===================================================================
3290 reg_get_value()
3292     # Return value: $regvalue
3293     unset regvalue
3295     local _regentry="/proc/registry${1}/${2}"
3296     if test -f "$_regentry"; then
3297         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3298         # Registry keys read via /proc/registry* are always \0 terminated!
3299         local _regvalue=$(tr -d '\0' < "$_regentry")
3300         if test $? -eq 0; then
3301             regvalue=$_regvalue
3302         fi
3303     fi
3306 # Get a value from the 32-bit side of the Registry
3307 reg_get_value_32()
3309     reg_get_value "32" "$1"
3312 # Get a value from the 64-bit side of the Registry
3313 reg_get_value_64()
3315     reg_get_value "64" "$1"
3318 if test "$_os" = "WINNT"; then
3319     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3320     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3321         AC_MSG_RESULT([no])
3322         WINDOWS_SDK_ARCH="x86"
3323     else
3324         AC_MSG_RESULT([yes])
3325         WINDOWS_SDK_ARCH="x64"
3326         BITNESS_OVERRIDE=64
3327     fi
3329 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3330     cross_compiling="yes"
3332 if test "$cross_compiling" = "yes"; then
3333     export CROSS_COMPILING=TRUE
3334 else
3335     CROSS_COMPILING=
3336     BUILD_TYPE="$BUILD_TYPE NATIVE"
3338 AC_SUBST(CROSS_COMPILING)
3340 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3341 # NOTE: must _not_ be used for bundled external libraries!
3342 ISYSTEM=
3343 if test "$GCC" = "yes"; then
3344     AC_MSG_CHECKING( for -isystem )
3345     save_CFLAGS=$CFLAGS
3346     CFLAGS="$CFLAGS -Werror"
3347     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3348     CFLAGS=$save_CFLAGS
3349     if test -n "$ISYSTEM"; then
3350         AC_MSG_RESULT(yes)
3351     else
3352         AC_MSG_RESULT(no)
3353     fi
3355 if test -z "$ISYSTEM"; then
3356     # fall back to using -I
3357     ISYSTEM=-I
3359 AC_SUBST(ISYSTEM)
3361 dnl ===================================================================
3362 dnl  Check which Visual Studio compiler is used
3363 dnl ===================================================================
3365 map_vs_year_to_version()
3367     # Return value: $vsversion
3369     unset vsversion
3371     case $1 in
3372     2019)
3373         vsversion=16;;
3374     *)
3375         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3376     esac
3379 vs_versions_to_check()
3381     # Args: $1 (optional) : versions to check, in the order of preference
3382     # Return value: $vsversions
3384     unset vsversions
3386     if test -n "$1"; then
3387         map_vs_year_to_version "$1"
3388         vsversions=$vsversion
3389     else
3390         # We accept only 2019
3391         vsversions="16"
3392     fi
3395 win_get_env_from_vsvars32bat()
3397     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3398     # Also seems to be located in another directory under the same name: vsvars32.bat
3399     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3400     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3401     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3402     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3403     chmod +x $WRAPPERBATCHFILEPATH
3404     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3405     rm -f $WRAPPERBATCHFILEPATH
3406     printf '%s' "$_win_get_env_from_vsvars32bat"
3409 find_ucrt()
3411     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3412     if test -n "$regvalue"; then
3413         PathFormat "$regvalue"
3414         UCRTSDKDIR=$formatted_path
3415         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3416         UCRTVERSION=$regvalue
3417         # Rest if not exist
3418         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3419           UCRTSDKDIR=
3420         fi
3421     fi
3422     if test -z "$UCRTSDKDIR"; then
3423         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3424         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3425         if test -f "$ide_env_file"; then
3426             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3427             UCRTSDKDIR=$formatted_path
3428             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3429             dnl Hack needed at least by tml:
3430             if test "$UCRTVERSION" = 10.0.15063.0 \
3431                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3432                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3433             then
3434                 UCRTVERSION=10.0.14393.0
3435             fi
3436         else
3437           AC_MSG_ERROR([No UCRT found])
3438         fi
3439     fi
3442 find_msvc()
3444     # Find Visual C++ 2019
3445     # Args: $1 (optional) : The VS version year
3446     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3448     unset vctest vcnum vcnumwithdot vcbuildnumber
3450     vs_versions_to_check "$1"
3451     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3452     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3453     PathFormat "$vswhere"
3454     vswhere=$formatted_path
3455     for ver in $vsversions; do
3456         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3457         # Fall back to all MS products (this includes VC++ Build Tools)
3458         if ! test -n "$vswhereoutput"; then
3459             AC_MSG_CHECKING([VC++ Build Tools and similar])
3460             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3461         fi
3462         if test -n "$vswhereoutput"; then
3463             PathFormat "$vswhereoutput"
3464             vctest=$formatted_path
3465             break
3466         fi
3467     done
3469     if test -n "$vctest"; then
3470         vcnumwithdot="$ver.0"
3471         case "$vcnumwithdot" in
3472         16.0)
3473             vcyear=2019
3474             vcnum=160
3475             ;;
3476         esac
3477         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3479     fi
3482 SOLARINC=
3483 MSBUILD_PATH=
3484 DEVENV=
3485 if test "$_os" = "WINNT"; then
3486     AC_MSG_CHECKING([Visual C++])
3487     find_msvc "$with_visual_studio"
3488     if test -z "$vctest"; then
3489         if test -n "$with_visual_studio"; then
3490             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3491         else
3492             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3493         fi
3494     fi
3496     if test "$BITNESS_OVERRIDE" = ""; then
3497         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3498             VC_PRODUCT_DIR=$vctest/VC
3499         else
3500             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3501         fi
3502     else
3503         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3504             VC_PRODUCT_DIR=$vctest/VC
3505         else
3506             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3507         fi
3508     fi
3509     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3511     AC_MSG_CHECKING([for short pathname of VC product directory])
3512     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3513     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3515     UCRTSDKDIR=
3516     UCRTVERSION=
3518     AC_MSG_CHECKING([for UCRT location])
3519     find_ucrt
3520     # find_ucrt errors out if it doesn't find it
3521     AC_MSG_RESULT([found])
3522     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3523     ucrtincpath_formatted=$formatted_path
3524     # SOLARINC is used for external modules and must be set too.
3525     # And no, it's not sufficient to set SOLARINC only, as configure
3526     # itself doesn't honour it.
3527     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3528     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3529     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3530     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3532     AC_SUBST(UCRTSDKDIR)
3533     AC_SUBST(UCRTVERSION)
3535     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3536     # Find the proper version of MSBuild.exe to use based on the VS version
3537     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3538     if test -n "$regvalue" ; then
3539         AC_MSG_RESULT([found: $regvalue])
3540         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3541     else
3542         if test "$vcnumwithdot" = "16.0"; then
3543             if test "$BITNESS_OVERRIDE" = ""; then
3544                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3545             else
3546                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3547             fi
3548         else
3549             if test "$BITNESS_OVERRIDE" = ""; then
3550                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3551             else
3552                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3553             fi
3554         fi
3555         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3556         AC_MSG_RESULT([$regvalue])
3557     fi
3559     # Find the version of devenv.exe
3560     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3561     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3562     if test ! -e "$DEVENV"; then
3563         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3564     fi
3566     dnl ===========================================================
3567     dnl  Check for the corresponding mspdb*.dll
3568     dnl ===========================================================
3570     VC_HOST_DIR=
3571     MSPDB_PATH=
3572     CL_PATH=
3574     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3575         VC_HOST_DIR="HostX64"
3576         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3577     else
3578         VC_HOST_DIR="HostX86"
3579         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3580     fi
3582     if test "$BITNESS_OVERRIDE" = ""; then
3583         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3584     else
3585         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3586     fi
3588     # MSVC 15.0 has libraries from 14.0?
3589     mspdbnum="140"
3591     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3592         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3593     fi
3595     dnl The path needs to be added before cl is called
3596     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3597     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3599     AC_MSG_CHECKING([cl.exe])
3601     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3602     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3603     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3604     # is not enough?
3606     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3607     dnl needed when building CLR code:
3608     if test -z "$MSVC_CXX"; then
3609         if test -f "$CL_PATH/cl.exe"; then
3610             MSVC_CXX="$CL_PATH/cl.exe"
3611         fi
3613         # This gives us a posix path with 8.3 filename restrictions
3614         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3615     fi
3617     if test -z "$CC"; then
3618         CC=$MSVC_CXX
3619         CC_BASE=`first_arg_basename "$CC"`
3620     fi
3621     if test -z "$CXX"; then
3622         CXX=$MSVC_CXX
3623         CXX_BASE=`first_arg_basename "$CXX"`
3624     fi
3626     if test -n "$CC"; then
3627         # Remove /cl.exe from CC case insensitive
3628         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3629         if test "$BITNESS_OVERRIDE" = ""; then
3630            COMPATH="$VC_PRODUCT_DIR"
3631         else
3632             if test -n "$VC_PRODUCT_DIR"; then
3633                 COMPATH=$VC_PRODUCT_DIR
3634             fi
3635         fi
3637         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3639         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3641         PathFormat "$COMPATH"
3642         COMPATH=`win_short_path_for_make "$formatted_path"`
3644         VCVER=$vcnum
3646         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3647         # are always "better", we list them in reverse chronological order.
3649         case "$vcnum" in
3650         160)
3651             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3652             ;;
3653         esac
3655         # The expectation is that --with-windows-sdk should not need to be used
3656         if test -n "$with_windows_sdk"; then
3657             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3658             *" "$with_windows_sdk" "*)
3659                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3660                 ;;
3661             *)
3662                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
3663                 ;;
3664             esac
3665         fi
3667         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3668         ac_objext=obj
3669         ac_exeext=exe
3671     else
3672         AC_MSG_ERROR([Visual C++ not found after all, huh])
3673     fi
3675     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
3676     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3677         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3678         // between Visual Studio versions and _MSC_VER:
3679         #if _MSC_VER < 1924
3680         #error
3681         #endif
3682     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3684     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3685     # version of the Explorer extension (and maybe other small
3686     # bits, too) needed when installing a 32-bit LibreOffice on a
3687     # 64-bit OS. The 64-bit Explorer extension is a feature that
3688     # has been present since long in OOo. Don't confuse it with
3689     # building LibreOffice itself as 64-bit code.
3691     BUILD_X64=
3692     CXX_X64_BINARY=
3694     if test "$BITNESS_OVERRIDE" = ""; then
3695         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3696         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3697              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3698             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3699                 BUILD_X64=TRUE
3700                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3701             fi
3702         fi
3703         if test "$BUILD_X64" = TRUE; then
3704             AC_MSG_RESULT([found])
3705         else
3706             AC_MSG_RESULT([not found])
3707             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3708         fi
3709     else
3710         CXX_X64_BINARY=$CXX
3711     fi
3712     AC_SUBST(BUILD_X64)
3714     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3715     AC_SUBST(CXX_X64_BINARY)
3717     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3718     # needed to support TWAIN scan on both 32- and 64-bit systems
3720     BUILD_X86=
3722     if test "$BITNESS_OVERRIDE" = "64"; then
3723         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3724         if test -n "$CXX_X86_BINARY"; then
3725             BUILD_X86=TRUE
3726             AC_MSG_RESULT([preset])
3727         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3728             BUILD_X86=TRUE
3729             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3730             CXX_X86_BINARY+=" /arch:SSE"
3731             AC_MSG_RESULT([found])
3732         else
3733             CXX_X86_BINARY=
3734             AC_MSG_RESULT([not found])
3735             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3736         fi
3737     else
3738         BUILD_X86=TRUE
3739         CXX_X86_BINARY=$MSVC_CXX
3740     fi
3741     AC_SUBST(BUILD_X86)
3742     AC_SUBST(CXX_X86_BINARY)
3744 AC_SUBST(VCVER)
3745 AC_SUBST(DEVENV)
3746 AC_SUBST(MSVC_CXX)
3749 # unowinreg.dll
3751 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3752 AC_SUBST(UNOWINREG_DLL)
3754 COM_IS_CLANG=
3755 AC_MSG_CHECKING([whether the compiler is actually Clang])
3756 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3757     #ifndef __clang__
3758     you lose
3759     #endif
3760     int foo=42;
3761     ]])],
3762     [AC_MSG_RESULT([yes])
3763      COM_IS_CLANG=TRUE],
3764     [AC_MSG_RESULT([no])])
3765 AC_SUBST(COM_IS_CLANG)
3767 CC_PLAIN=$CC
3768 CLANGVER=
3769 if test "$COM_IS_CLANG" = TRUE; then
3770     AC_MSG_CHECKING([whether Clang is new enough])
3771     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3772         #if !defined __apple_build_version__
3773         #error
3774         #endif
3775         ]])],
3776         [my_apple_clang=yes],[my_apple_clang=])
3777     if test "$my_apple_clang" = yes; then
3778         AC_MSG_RESULT([assumed yes (Apple Clang)])
3779     else
3780         if test "$_os" = WINNT; then
3781             dnl In which case, assume clang-cl:
3782             my_args="/EP /TC"
3783             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3784             dnl clang-cl:
3785             CC_PLAIN=
3786             for i in $CC; do
3787                 case $i in
3788                 -FIIntrin.h)
3789                     ;;
3790                 *)
3791                     CC_PLAIN="$CC_PLAIN $i"
3792                     ;;
3793                 esac
3794             done
3795         else
3796             my_args="-E -P"
3797         fi
3798         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3799         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3800         CLANGVER=`echo $clang_version \
3801             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3802         if test "$CLANGVER" -ge 50002; then
3803             AC_MSG_RESULT([yes ($clang_version)])
3804         else
3805             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3806         fi
3807         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3808         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3809     fi
3812 SHOWINCLUDES_PREFIX=
3813 if test "$_os" = WINNT; then
3814     dnl We need to guess the prefix of the -showIncludes output, it can be
3815     dnl localized
3816     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3817     echo "#include <stdlib.h>" > conftest.c
3818     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3819         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3820     rm -f conftest.c conftest.obj
3821     if test -z "$SHOWINCLUDES_PREFIX"; then
3822         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3823     else
3824         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3825     fi
3827 AC_SUBST(SHOWINCLUDES_PREFIX)
3830 # prefix C with ccache if needed
3832 if test "$CCACHE" != ""; then
3833     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3835     AC_LANG_PUSH([C])
3836     save_CFLAGS=$CFLAGS
3837     CFLAGS="$CFLAGS --ccache-skip -O2"
3838     dnl an empty program will do, we're checking the compiler flags
3839     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3840                       [use_ccache=yes], [use_ccache=no])
3841     if test $use_ccache = yes; then
3842         AC_MSG_RESULT([yes])
3843     else
3844         CC="$CCACHE $CC"
3845         CC_BASE="ccache $CC_BASE"
3846         AC_MSG_RESULT([no])
3847     fi
3848     CFLAGS=$save_CFLAGS
3849     AC_LANG_POP([C])
3852 # ===================================================================
3853 # check various GCC options that Clang does not support now but maybe
3854 # will somewhen in the future, check them even for GCC, so that the
3855 # flags are set
3856 # ===================================================================
3858 HAVE_GCC_GGDB2=
3859 if test "$GCC" = "yes"; then
3860     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3861     save_CFLAGS=$CFLAGS
3862     CFLAGS="$CFLAGS -Werror -ggdb2"
3863     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3864     CFLAGS=$save_CFLAGS
3865     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3866         AC_MSG_RESULT([yes])
3867     else
3868         AC_MSG_RESULT([no])
3869     fi
3871     if test "$host_cpu" = "m68k"; then
3872         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3873         save_CFLAGS=$CFLAGS
3874         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3875         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3876         CFLAGS=$save_CFLAGS
3877         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3878             AC_MSG_RESULT([yes])
3879         else
3880             AC_MSG_ERROR([no])
3881         fi
3882     fi
3884 AC_SUBST(HAVE_GCC_GGDB2)
3886 dnl ===================================================================
3887 dnl  Test the gcc version
3888 dnl ===================================================================
3889 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3890     AC_MSG_CHECKING([the GCC version])
3891     _gcc_version=`$CC -dumpversion`
3892     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3893         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3894     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3896     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3898     if test "$gcc_full_version" -lt 70000; then
3899         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3900     fi
3901 else
3902     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3903     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3904     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3905     # (which reports itself as GCC 4.2.1).
3906     GCC_VERSION=
3908 AC_SUBST(GCC_VERSION)
3910 dnl Set the ENABLE_DBGUTIL variable
3911 dnl ===================================================================
3912 AC_MSG_CHECKING([whether to build with additional debug utilities])
3913 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3914     ENABLE_DBGUTIL="TRUE"
3915     # this is an extra var so it can have different default on different MSVC
3916     # versions (in case there are version specific problems with it)
3917     MSVC_USE_DEBUG_RUNTIME="TRUE"
3919     AC_MSG_RESULT([yes])
3920     # cppunit and graphite expose STL in public headers
3921     if test "$with_system_cppunit" = "yes"; then
3922         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3923     else
3924         with_system_cppunit=no
3925     fi
3926     if test "$with_system_graphite" = "yes"; then
3927         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3928     else
3929         with_system_graphite=no
3930     fi
3931     if test "$with_system_orcus" = "yes"; then
3932         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3933     else
3934         with_system_orcus=no
3935     fi
3936     if test "$with_system_libcmis" = "yes"; then
3937         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3938     else
3939         with_system_libcmis=no
3940     fi
3941     if test "$with_system_hunspell" = "yes"; then
3942         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3943     else
3944         with_system_hunspell=no
3945     fi
3946     if test "$with_system_gpgmepp" = "yes"; then
3947         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3948     else
3949         with_system_gpgmepp=no
3950     fi
3951     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3952     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3953     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3954     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3955     # of those two is using the system variant:
3956     if test "$with_system_libnumbertext" = "yes"; then
3957         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3958     else
3959         with_system_libnumbertext=no
3960     fi
3961     if test "$with_system_libwps" = "yes"; then
3962         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3963     else
3964         with_system_libwps=no
3965     fi
3966 else
3967     ENABLE_DBGUTIL=""
3968     MSVC_USE_DEBUG_RUNTIME=""
3969     AC_MSG_RESULT([no])
3971 AC_SUBST(ENABLE_DBGUTIL)
3972 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3974 dnl Set the ENABLE_DEBUG variable.
3975 dnl ===================================================================
3976 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3977     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3979 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3980     if test -z "$libo_fuzzed_enable_debug"; then
3981         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3982     else
3983         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3984         enable_debug=yes
3985     fi
3988 AC_MSG_CHECKING([whether to do a debug build])
3989 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3990     ENABLE_DEBUG="TRUE"
3991     if test -n "$ENABLE_DBGUTIL" ; then
3992         AC_MSG_RESULT([yes (dbgutil)])
3993     else
3994         AC_MSG_RESULT([yes])
3995     fi
3996 else
3997     ENABLE_DEBUG=""
3998     AC_MSG_RESULT([no])
4000 AC_SUBST(ENABLE_DEBUG)
4002 dnl ===================================================================
4003 dnl Select the linker to use (gold/lld/ld.bfd).
4004 dnl This is done only after compiler checks (need to know if Clang is
4005 dnl used, for different defaults) and after checking if a debug build
4006 dnl is wanted (non-debug builds get the default linker if not explicitly
4007 dnl specified otherwise).
4008 dnl All checks for linker features/options should come after this.
4009 dnl ===================================================================
4010 check_use_ld()
4012     use_ld=-fuse-ld=${1%%:*}
4013     use_ld_path=${1#*:}
4014     if test "$use_ld_path" != "$1"; then
4015         use_ld="$use_ld --ld-path=$use_ld_path"
4016     fi
4017     use_ld_fail_if_error=$2
4018     use_ld_ok=
4019     AC_MSG_CHECKING([for $use_ld linker support])
4020     use_ld_ldflags_save="$LDFLAGS"
4021     LDFLAGS="$LDFLAGS $use_ld"
4022     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4023 #include <stdio.h>
4024         ],[
4025 printf ("hello world\n");
4026         ])], USE_LD=$use_ld, [])
4027     if test -n "$USE_LD"; then
4028         AC_MSG_RESULT( yes )
4029         use_ld_ok=yes
4030     else
4031         if test -n "$use_ld_fail_if_error"; then
4032             AC_MSG_ERROR( no )
4033         else
4034             AC_MSG_RESULT( no )
4035         fi
4036     fi
4037     if test -n "$use_ld_ok"; then
4038         dnl keep the value of LDFLAGS
4039         return 0
4040     fi
4041     LDFLAGS="$use_ld_ldflags_save"
4042     return 1
4044 USE_LD=
4045 if test "$enable_ld" != "no"; then
4046     if test "$GCC" = "yes"; then
4047         if test -n "$enable_ld"; then
4048             check_use_ld "$enable_ld" fail_if_error
4049         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4050             dnl non-debug builds default to the default linker
4051             true
4052         elif test -n "$COM_IS_CLANG"; then
4053             check_use_ld lld
4054             if test $? -ne 0; then
4055                 check_use_ld gold
4056             fi
4057         else
4058             # For gcc first try gold, new versions also support lld.
4059             check_use_ld gold
4060             if test $? -ne 0; then
4061                 check_use_ld lld
4062             fi
4063         fi
4064         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4065         rm conftest.out
4066         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4067         if test -z "$ld_used"; then
4068             ld_used="unknown"
4069         fi
4070         AC_MSG_CHECKING([for linker that is used])
4071         AC_MSG_RESULT([$ld_used])
4072         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4073             if echo "$ld_used" | grep -q "^GNU ld"; then
4074                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4075                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4076             fi
4077         fi
4078     else
4079         if test "$enable_ld" = "yes"; then
4080             AC_MSG_ERROR([--enable-ld not supported])
4081         fi
4082     fi
4084 AC_SUBST(USE_LD)
4086 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4087 if test "$GCC" = "yes"; then
4088     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4089     bsymbolic_functions_ldflags_save=$LDFLAGS
4090     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4091     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4092 #include <stdio.h>
4093         ],[
4094 printf ("hello world\n");
4095         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4096     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4097         AC_MSG_RESULT( found )
4098     else
4099         AC_MSG_RESULT( not found )
4100     fi
4101     LDFLAGS=$bsymbolic_functions_ldflags_save
4103 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4105 LD_GC_SECTIONS=
4106 if test "$GCC" = "yes"; then
4107     for flag in "--gc-sections" "-dead_strip"; do
4108         AC_MSG_CHECKING([for $flag linker support])
4109         ldflags_save=$LDFLAGS
4110         LDFLAGS="$LDFLAGS -Wl,$flag"
4111         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4112 #include <stdio.h>
4113             ],[
4114 printf ("hello world\n");
4115             ])],[
4116             LD_GC_SECTIONS="-Wl,$flag"
4117             AC_MSG_RESULT( found )
4118             ], [
4119             AC_MSG_RESULT( not found )
4120             ])
4121         LDFLAGS=$ldflags_save
4122         if test -n "$LD_GC_SECTIONS"; then
4123             break
4124         fi
4125     done
4127 AC_SUBST(LD_GC_SECTIONS)
4129 HAVE_GSPLIT_DWARF=
4130 if test "$enable_split_debug" != no; then
4131     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4132     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4133         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4134         save_CFLAGS=$CFLAGS
4135         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4136         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4137         CFLAGS=$save_CFLAGS
4138         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4139             AC_MSG_RESULT([yes])
4140         else
4141             if test "$enable_split_debug" = yes; then
4142                 AC_MSG_ERROR([no])
4143             else
4144                 AC_MSG_RESULT([no])
4145             fi
4146         fi
4147     fi
4148     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4149         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4150         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4151     fi
4153 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4155 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4156 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4157 save_CFLAGS=$CFLAGS
4158 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4159 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4160 CFLAGS=$save_CFLAGS
4161 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4162     AC_MSG_RESULT([yes])
4163 else
4164     AC_MSG_RESULT([no])
4166 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4168 ENABLE_GDB_INDEX=
4169 if test "$enable_gdb_index" != "no"; then
4170     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4171     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4172         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4173         save_CFLAGS=$CFLAGS
4174         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4175         have_ggnu_pubnames=
4176         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4177         if test "$have_ggnu_pubnames" != "TRUE"; then
4178             if test "$enable_gdb_index" = "yes"; then
4179                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4180             else
4181                 AC_MSG_RESULT( no )
4182             fi
4183         else
4184             AC_MSG_RESULT( yes )
4185             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4186             ldflags_save=$LDFLAGS
4187             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4188             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4189 #include <stdio.h>
4190                 ],[
4191 printf ("hello world\n");
4192                 ])], ENABLE_GDB_INDEX=TRUE, [])
4193             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4194                 AC_MSG_RESULT( yes )
4195             else
4196                 if test "$enable_gdb_index" = "yes"; then
4197                     AC_MSG_ERROR( no )
4198                 else
4199                     AC_MSG_RESULT( no )
4200                 fi
4201             fi
4202             LDFLAGS=$ldflags_save
4203         fi
4204         CFLAGS=$save_CFLAGS
4205         fi
4206     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4207         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4208         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4209     fi
4211 AC_SUBST(ENABLE_GDB_INDEX)
4213 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4214     enable_sal_log=yes
4216 if test "$enable_sal_log" = yes; then
4217     ENABLE_SAL_LOG=TRUE
4219 AC_SUBST(ENABLE_SAL_LOG)
4221 dnl Check for enable symbols option
4222 dnl ===================================================================
4223 AC_MSG_CHECKING([whether to generate debug information])
4224 if test -z "$enable_symbols"; then
4225     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4226         enable_symbols=yes
4227     else
4228         enable_symbols=no
4229     fi
4231 if test "$enable_symbols" = yes; then
4232     ENABLE_SYMBOLS_FOR=all
4233     AC_MSG_RESULT([yes])
4234 elif test "$enable_symbols" = no; then
4235     ENABLE_SYMBOLS_FOR=
4236     AC_MSG_RESULT([no])
4237 else
4238     # Selective debuginfo.
4239     ENABLE_SYMBOLS_FOR="$enable_symbols"
4240     AC_MSG_RESULT([for "$enable_symbols"])
4242 AC_SUBST(ENABLE_SYMBOLS_FOR)
4244 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4245     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4246     AC_MSG_CHECKING([whether enough memory is available for linking])
4247     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4248     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4249     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4250         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4251     else
4252         AC_MSG_RESULT([yes])
4253     fi
4256 ENABLE_OPTIMIZED=
4257 ENABLE_OPTIMIZED_DEBUG=
4258 AC_MSG_CHECKING([whether to compile with optimization flags])
4259 if test -z "$enable_optimized"; then
4260     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4261         enable_optimized=no
4262     else
4263         enable_optimized=yes
4264     fi
4266 if test "$enable_optimized" = yes; then
4267     ENABLE_OPTIMIZED=TRUE
4268     AC_MSG_RESULT([yes])
4269 elif test "$enable_optimized" = debug; then
4270     ENABLE_OPTIMIZED_DEBUG=TRUE
4271     AC_MSG_RESULT([yes (debug)])
4272     HAVE_GCC_OG=
4273     if test "$GCC" = "yes"; then
4274         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4275         save_CFLAGS=$CFLAGS
4276         CFLAGS="$CFLAGS -Werror -Og"
4277         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4278         CFLAGS=$save_CFLAGS
4279         if test "$HAVE_GCC_OG" = "TRUE"; then
4280             AC_MSG_RESULT([yes])
4281         else
4282             AC_MSG_RESULT([no])
4283         fi
4284     fi
4285     if test -z "$HAVE_GCC_OG"; then
4286         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4287     fi
4288 else
4289     AC_MSG_RESULT([no])
4291 AC_SUBST(ENABLE_OPTIMIZED)
4292 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4295 # determine CPUNAME, OS, ...
4296 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4298 case "$host_os" in
4300 aix*)
4301     COM=GCC
4302     CPUNAME=POWERPC
4303     USING_X11=TRUE
4304     OS=AIX
4305     RTL_OS=AIX
4306     RTL_ARCH=PowerPC
4307     PLATFORMID=aix_powerpc
4308     P_SEP=:
4309     ;;
4311 cygwin*)
4312     COM=MSC
4313     USING_X11=
4314     OS=WNT
4315     RTL_OS=Windows
4316     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4317         P_SEP=";"
4318     else
4319         P_SEP=:
4320     fi
4321     case "$host_cpu" in
4322     i*86|x86_64)
4323         if test "$BITNESS_OVERRIDE" = 64; then
4324             CPUNAME=X86_64
4325             RTL_ARCH=X86_64
4326             PLATFORMID=windows_x86_64
4327             WINDOWS_X64=1
4328             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4329         else
4330             CPUNAME=INTEL
4331             RTL_ARCH=x86
4332             PLATFORMID=windows_x86
4333         fi
4334         ;;
4335     *)
4336         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4337         ;;
4338     esac
4339     SCPDEFS="$SCPDEFS -D_MSC_VER"
4340     ;;
4342 darwin*|macos*)
4343     COM=GCC
4344     USING_X11=
4345     OS=MACOSX
4346     RTL_OS=MacOSX
4347     P_SEP=:
4349     case "$host_cpu" in
4350     arm64)
4351         if test "$enable_ios_simulator" = "yes"; then
4352             OS=iOS
4353         else
4354             CPUNAME=ARM64
4355             RTL_ARCH=AARCH
4356             PLATFORMID=macosx_arm64
4357         fi
4358         ;;
4359     x86_64)
4360         if test "$enable_ios_simulator" = "yes"; then
4361             OS=iOS
4362         fi
4363         CPUNAME=X86_64
4364         RTL_ARCH=X86_64
4365         PLATFORMID=macosx_x86_64
4366         ;;
4367     *)
4368         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4369         ;;
4370     esac
4371     ;;
4373 ios*)
4374     COM=GCC
4375     USING_X11=
4376     OS=iOS
4377     RTL_OS=iOS
4378     P_SEP=:
4380     case "$host_cpu" in
4381     arm64)
4382         if test "$enable_ios_simulator" = "yes"; then
4383             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4384         fi
4385         ;;
4386     *)
4387         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4388         ;;
4389     esac
4390     CPUNAME=ARM64
4391     RTL_ARCH=ARM_EABI
4392     PLATFORMID=ios_arm64
4393     ;;
4395 dragonfly*)
4396     COM=GCC
4397     USING_X11=TRUE
4398     OS=DRAGONFLY
4399     RTL_OS=DragonFly
4400     P_SEP=:
4402     case "$host_cpu" in
4403     i*86)
4404         CPUNAME=INTEL
4405         RTL_ARCH=x86
4406         PLATFORMID=dragonfly_x86
4407         ;;
4408     x86_64)
4409         CPUNAME=X86_64
4410         RTL_ARCH=X86_64
4411         PLATFORMID=dragonfly_x86_64
4412         ;;
4413     *)
4414         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4415         ;;
4416     esac
4417     ;;
4419 freebsd*)
4420     COM=GCC
4421     USING_X11=TRUE
4422     RTL_OS=FreeBSD
4423     OS=FREEBSD
4424     P_SEP=:
4426     case "$host_cpu" in
4427     i*86)
4428         CPUNAME=INTEL
4429         RTL_ARCH=x86
4430         PLATFORMID=freebsd_x86
4431         ;;
4432     x86_64|amd64)
4433         CPUNAME=X86_64
4434         RTL_ARCH=X86_64
4435         PLATFORMID=freebsd_x86_64
4436         ;;
4437     *)
4438         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4439         ;;
4440     esac
4441     ;;
4443 haiku*)
4444     COM=GCC
4445     USING_X11=
4446     GUIBASE=haiku
4447     RTL_OS=Haiku
4448     OS=HAIKU
4449     P_SEP=:
4451     case "$host_cpu" in
4452     i*86)
4453         CPUNAME=INTEL
4454         RTL_ARCH=x86
4455         PLATFORMID=haiku_x86
4456         ;;
4457     x86_64|amd64)
4458         CPUNAME=X86_64
4459         RTL_ARCH=X86_64
4460         PLATFORMID=haiku_x86_64
4461         ;;
4462     *)
4463         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4464         ;;
4465     esac
4466     ;;
4468 kfreebsd*)
4469     COM=GCC
4470     USING_X11=TRUE
4471     OS=LINUX
4472     RTL_OS=kFreeBSD
4473     P_SEP=:
4475     case "$host_cpu" in
4477     i*86)
4478         CPUNAME=INTEL
4479         RTL_ARCH=x86
4480         PLATFORMID=kfreebsd_x86
4481         ;;
4482     x86_64)
4483         CPUNAME=X86_64
4484         RTL_ARCH=X86_64
4485         PLATFORMID=kfreebsd_x86_64
4486         ;;
4487     *)
4488         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4489         ;;
4490     esac
4491     ;;
4493 linux-gnu*)
4494     COM=GCC
4495     USING_X11=TRUE
4496     OS=LINUX
4497     RTL_OS=Linux
4498     P_SEP=:
4500     case "$host_cpu" in
4502     aarch64)
4503         CPUNAME=AARCH64
4504         PLATFORMID=linux_aarch64
4505         RTL_ARCH=AARCH64
4506         ;;
4507     alpha)
4508         CPUNAME=AXP
4509         RTL_ARCH=ALPHA
4510         PLATFORMID=linux_alpha
4511         ;;
4512     arm*)
4513         CPUNAME=ARM
4514         EPM_FLAGS="-a arm"
4515         RTL_ARCH=ARM_EABI
4516         PLATFORMID=linux_arm_eabi
4517         case "$host_cpu" in
4518         arm*-linux)
4519             RTL_ARCH=ARM_OABI
4520             PLATFORMID=linux_arm_oabi
4521             ;;
4522         esac
4523         ;;
4524     hppa)
4525         CPUNAME=HPPA
4526         RTL_ARCH=HPPA
4527         EPM_FLAGS="-a hppa"
4528         PLATFORMID=linux_hppa
4529         ;;
4530     i*86)
4531         CPUNAME=INTEL
4532         RTL_ARCH=x86
4533         PLATFORMID=linux_x86
4534         ;;
4535     ia64)
4536         CPUNAME=IA64
4537         RTL_ARCH=IA64
4538         PLATFORMID=linux_ia64
4539         ;;
4540     mips)
4541         CPUNAME=GODSON
4542         RTL_ARCH=MIPS_EB
4543         EPM_FLAGS="-a mips"
4544         PLATFORMID=linux_mips_eb
4545         ;;
4546     mips64)
4547         CPUNAME=GODSON64
4548         RTL_ARCH=MIPS64_EB
4549         EPM_FLAGS="-a mips64"
4550         PLATFORMID=linux_mips64_eb
4551         ;;
4552     mips64el)
4553         CPUNAME=GODSON64
4554         RTL_ARCH=MIPS64_EL
4555         EPM_FLAGS="-a mips64el"
4556         PLATFORMID=linux_mips64_el
4557         ;;
4558     mipsel)
4559         CPUNAME=GODSON
4560         RTL_ARCH=MIPS_EL
4561         EPM_FLAGS="-a mipsel"
4562         PLATFORMID=linux_mips_el
4563         ;;
4564     m68k)
4565         CPUNAME=M68K
4566         RTL_ARCH=M68K
4567         PLATFORMID=linux_m68k
4568         ;;
4569     powerpc)
4570         CPUNAME=POWERPC
4571         RTL_ARCH=PowerPC
4572         PLATFORMID=linux_powerpc
4573         ;;
4574     powerpc64)
4575         CPUNAME=POWERPC64
4576         RTL_ARCH=PowerPC_64
4577         PLATFORMID=linux_powerpc64
4578         ;;
4579     powerpc64le)
4580         CPUNAME=POWERPC64
4581         RTL_ARCH=PowerPC_64_LE
4582         PLATFORMID=linux_powerpc64_le
4583         ;;
4584     sparc)
4585         CPUNAME=SPARC
4586         RTL_ARCH=SPARC
4587         PLATFORMID=linux_sparc
4588         ;;
4589     sparc64)
4590         CPUNAME=SPARC64
4591         RTL_ARCH=SPARC64
4592         PLATFORMID=linux_sparc64
4593         ;;
4594     s390)
4595         CPUNAME=S390
4596         RTL_ARCH=S390
4597         PLATFORMID=linux_s390
4598         ;;
4599     s390x)
4600         CPUNAME=S390X
4601         RTL_ARCH=S390x
4602         PLATFORMID=linux_s390x
4603         ;;
4604     x86_64)
4605         CPUNAME=X86_64
4606         RTL_ARCH=X86_64
4607         PLATFORMID=linux_x86_64
4608         ;;
4609     *)
4610         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4611         ;;
4612     esac
4613     ;;
4615 linux-android*)
4616     COM=GCC
4617     USING_X11=
4618     OS=ANDROID
4619     RTL_OS=Android
4620     P_SEP=:
4622     case "$host_cpu" in
4624     arm|armel)
4625         CPUNAME=ARM
4626         RTL_ARCH=ARM_EABI
4627         PLATFORMID=android_arm_eabi
4628         ;;
4629     aarch64)
4630         CPUNAME=AARCH64
4631         RTL_ARCH=AARCH64
4632         PLATFORMID=android_aarch64
4633         ;;
4634     i*86)
4635         CPUNAME=INTEL
4636         RTL_ARCH=x86
4637         PLATFORMID=android_x86
4638         ;;
4639     x86_64)
4640         CPUNAME=X86_64
4641         RTL_ARCH=X86_64
4642         PLATFORMID=android_x86_64
4643         ;;
4644     *)
4645         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4646         ;;
4647     esac
4648     ;;
4650 *netbsd*)
4651     COM=GCC
4652     USING_X11=TRUE
4653     OS=NETBSD
4654     RTL_OS=NetBSD
4655     P_SEP=:
4657     case "$host_cpu" in
4658     i*86)
4659         CPUNAME=INTEL
4660         RTL_ARCH=x86
4661         PLATFORMID=netbsd_x86
4662         ;;
4663     powerpc)
4664         CPUNAME=POWERPC
4665         RTL_ARCH=PowerPC
4666         PLATFORMID=netbsd_powerpc
4667         ;;
4668     sparc)
4669         CPUNAME=SPARC
4670         RTL_ARCH=SPARC
4671         PLATFORMID=netbsd_sparc
4672         ;;
4673     x86_64)
4674         CPUNAME=X86_64
4675         RTL_ARCH=X86_64
4676         PLATFORMID=netbsd_x86_64
4677         ;;
4678     *)
4679         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4680         ;;
4681     esac
4682     ;;
4684 openbsd*)
4685     COM=GCC
4686     USING_X11=TRUE
4687     OS=OPENBSD
4688     RTL_OS=OpenBSD
4689     P_SEP=:
4691     case "$host_cpu" in
4692     i*86)
4693         CPUNAME=INTEL
4694         RTL_ARCH=x86
4695         PLATFORMID=openbsd_x86
4696         ;;
4697     x86_64)
4698         CPUNAME=X86_64
4699         RTL_ARCH=X86_64
4700         PLATFORMID=openbsd_x86_64
4701         ;;
4702     *)
4703         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4704         ;;
4705     esac
4706     SOLARINC="$SOLARINC -I/usr/local/include"
4707     ;;
4709 solaris*)
4710     COM=GCC
4711     USING_X11=TRUE
4712     OS=SOLARIS
4713     RTL_OS=Solaris
4714     P_SEP=:
4716     case "$host_cpu" in
4717     i*86)
4718         CPUNAME=INTEL
4719         RTL_ARCH=x86
4720         PLATFORMID=solaris_x86
4721         ;;
4722     sparc)
4723         CPUNAME=SPARC
4724         RTL_ARCH=SPARC
4725         PLATFORMID=solaris_sparc
4726         ;;
4727     sparc64)
4728         CPUNAME=SPARC64
4729         RTL_ARCH=SPARC64
4730         PLATFORMID=solaris_sparc64
4731         ;;
4732     *)
4733         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4734         ;;
4735     esac
4736     SOLARINC="$SOLARINC -I/usr/local/include"
4737     ;;
4740     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4741     ;;
4742 esac
4744 if test "$with_x" = "no"; then
4745     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4748 DISABLE_GUI=""
4749 if test "$enable_gui" = "no"; then
4750     if test "$USING_X11" != TRUE; then
4751         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4752     fi
4753     USING_X11=
4754     DISABLE_GUI=TRUE
4755     AC_DEFINE(HAVE_FEATURE_UI,0)
4756     test_cairo=yes
4758 AC_SUBST(DISABLE_GUI)
4760 WORKDIR="${BUILDDIR}/workdir"
4761 INSTDIR="${BUILDDIR}/instdir"
4762 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4763 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4764 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4765 AC_SUBST(COM)
4766 AC_SUBST(CPUNAME)
4767 AC_SUBST(RTL_OS)
4768 AC_SUBST(RTL_ARCH)
4769 AC_SUBST(EPM_FLAGS)
4770 AC_SUBST(USING_X11)
4771 AC_SUBST([INSTDIR])
4772 AC_SUBST([INSTROOT])
4773 AC_SUBST([INSTROOTBASE])
4774 AC_SUBST(OS)
4775 AC_SUBST(P_SEP)
4776 AC_SUBST(WORKDIR)
4777 AC_SUBST(PLATFORMID)
4778 AC_SUBST(WINDOWS_X64)
4779 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4781 dnl ===================================================================
4782 dnl Test which package format to use
4783 dnl ===================================================================
4784 AC_MSG_CHECKING([which package format to use])
4785 if test -n "$with_package_format" -a "$with_package_format" != no; then
4786     for i in $with_package_format; do
4787         case "$i" in
4788         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4789             ;;
4790         *)
4791             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4792 aix - AIX software distribution
4793 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4794 deb - Debian software distribution
4795 pkg - Solaris software distribution
4796 rpm - RedHat software distribution
4798 LibreOffice additionally supports:
4799 archive - .tar.gz or .zip
4800 dmg - macOS .dmg
4801 installed - installation tree
4802 msi - Windows .msi
4803         ])
4804             ;;
4805         esac
4806     done
4807     # fakeroot is needed to ensure correct file ownerships/permissions
4808     # inside deb packages and tar archives created on Linux and Solaris.
4809     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4810         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4811         if test "$FAKEROOT" = "no"; then
4812             AC_MSG_ERROR(
4813                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4814         fi
4815     fi
4816     PKGFORMAT="$with_package_format"
4817     AC_MSG_RESULT([$PKGFORMAT])
4818 else
4819     PKGFORMAT=
4820     AC_MSG_RESULT([none])
4822 AC_SUBST(PKGFORMAT)
4824 dnl ===================================================================
4825 dnl Set up a different compiler to produce tools to run on the build
4826 dnl machine when doing cross-compilation
4827 dnl ===================================================================
4829 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4830 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4831 if test "$cross_compiling" = "yes"; then
4832     AC_MSG_CHECKING([for BUILD platform configuration])
4833     echo
4834     rm -rf CONF-FOR-BUILD config_build.mk
4835     mkdir CONF-FOR-BUILD
4836     # Here must be listed all files needed when running the configure script. In particular, also
4837     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4838     # keep them in the same order as there.
4839     (cd $SRC_ROOT && tar cf - \
4840         config.guess \
4841         bin/get_config_variables \
4842         solenv/bin/getcompver.awk \
4843         solenv/inc/langlist.mk \
4844         download.lst \
4845         config_host.mk.in \
4846         config_host_lang.mk.in \
4847         Makefile.in \
4848         bin/bffvalidator.sh.in \
4849         bin/odfvalidator.sh.in \
4850         bin/officeotron.sh.in \
4851         hardened_runtime.xcent.in \
4852         instsetoo_native/util/openoffice.lst.in \
4853         config_host/*.in \
4854         sysui/desktop/macosx/Info.plist.in) \
4855     | (cd CONF-FOR-BUILD && tar xf -)
4856     cp configure CONF-FOR-BUILD
4857     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4858     (
4859     unset COM USING_X11 OS CPUNAME
4860     unset CC CXX SYSBASE CFLAGS
4861     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4862     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4863     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4864     if test -n "$CC_FOR_BUILD"; then
4865         export CC="$CC_FOR_BUILD"
4866         CC_BASE=`first_arg_basename "$CC"`
4867     fi
4868     if test -n "$CXX_FOR_BUILD"; then
4869         export CXX="$CXX_FOR_BUILD"
4870         CXX_BASE=`first_arg_basename "$CXX"`
4871     fi
4872     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4873     cd CONF-FOR-BUILD
4874     sub_conf_opts=""
4875     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4876     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4877     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4878     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4879     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4880     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4881     # Don't bother having configure look for stuff not needed for the build platform anyway
4882     ./configure \
4883         --disable-cups \
4884         --disable-gpgmepp \
4885         --disable-gstreamer-1-0 \
4886         --disable-gtk3 \
4887         --disable-pdfimport \
4888         --disable-postgresql-sdbc \
4889         --enable-icecream="$enable_icecream" \
4890         --with-parallelism="$with_parallelism" \
4891         --without-doxygen \
4892         --without-java \
4893         $sub_conf_opts \
4894         --srcdir=$srcdir \
4895         2>&1 | sed -e 's/^/    /'
4896     test -f ./config_host.mk 2>/dev/null || exit
4897     cp config_host.mk ../config_build.mk
4898     cp config_host_lang.mk ../config_build_lang.mk
4899     mv config.log ../config.Build.log
4900     mkdir -p ../config_build
4901     mv config_host/*.h ../config_build
4902     . ./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
4904     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
4905         VV='$'$V
4906         VV=`eval "echo $VV"`
4907         if test -n "$VV"; then
4908             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4909             echo "$line" >>build-config
4910         fi
4911     done
4913     for V in INSTDIR INSTROOT WORKDIR; do
4914         VV='$'$V
4915         VV=`eval "echo $VV"`
4916         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4917         if test -n "$VV"; then
4918             line="${V}_FOR_BUILD='$VV'"
4919             echo "$line" >>build-config
4920         fi
4921     done
4923     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4924     echo "$line" >>build-config
4926     )
4927     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4928     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])
4929     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4930              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4932     eval `cat CONF-FOR-BUILD/build-config`
4934     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4936     rm -rf CONF-FOR-BUILD
4937 else
4938     OS_FOR_BUILD="$OS"
4939     CC_FOR_BUILD="$CC"
4940     CXX_FOR_BUILD="$CXX"
4941     INSTDIR_FOR_BUILD="$INSTDIR"
4942     INSTROOT_FOR_BUILD="$INSTROOT"
4943     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4944     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4945     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4946     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4947     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4948     WORKDIR_FOR_BUILD="$WORKDIR"
4950 AC_SUBST(OS_FOR_BUILD)
4951 AC_SUBST(INSTDIR_FOR_BUILD)
4952 AC_SUBST(INSTROOT_FOR_BUILD)
4953 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4954 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4955 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4956 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4957 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4958 AC_SUBST(WORKDIR_FOR_BUILD)
4960 dnl ===================================================================
4961 dnl Check for syslog header
4962 dnl ===================================================================
4963 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4965 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4966 dnl ===================================================================
4967 AC_MSG_CHECKING([whether to turn warnings to errors])
4968 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4969     ENABLE_WERROR="TRUE"
4970     AC_MSG_RESULT([yes])
4971 else
4972     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4973         ENABLE_WERROR="TRUE"
4974         AC_MSG_RESULT([yes])
4975     else
4976         AC_MSG_RESULT([no])
4977     fi
4979 AC_SUBST(ENABLE_WERROR)
4981 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4982 dnl ===================================================================
4983 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4984 if test -z "$enable_assert_always_abort"; then
4985    if test "$ENABLE_DEBUG" = TRUE; then
4986        enable_assert_always_abort=yes
4987    else
4988        enable_assert_always_abort=no
4989    fi
4991 if test "$enable_assert_always_abort" = "yes"; then
4992     ASSERT_ALWAYS_ABORT="TRUE"
4993     AC_MSG_RESULT([yes])
4994 else
4995     ASSERT_ALWAYS_ABORT="FALSE"
4996     AC_MSG_RESULT([no])
4998 AC_SUBST(ASSERT_ALWAYS_ABORT)
5000 # Determine whether to use ooenv for the instdir installation
5001 # ===================================================================
5002 if test $_os != "WINNT" -a $_os != "Darwin"; then
5003     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5004     if test "$enable_ooenv" = "no"; then
5005         AC_MSG_RESULT([no])
5006     else
5007         ENABLE_OOENV="TRUE"
5008         AC_MSG_RESULT([yes])
5009     fi
5011 AC_SUBST(ENABLE_OOENV)
5013 if test "$USING_X11" != TRUE; then
5014     # be sure to do not mess with unneeded stuff
5015     test_randr=no
5016     test_xrender=no
5017     test_cups=no
5018     test_dbus=no
5019     build_gstreamer_1_0=no
5020     test_kf5=no
5021     test_qt5=no
5022     test_gtk3_kde5=no
5023     enable_cairo_canvas=no
5026 if test "$OS" = "HAIKU"; then
5027     enable_cairo_canvas=yes
5028     test_kf5=yes
5031 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5032     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!])
5033     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!"
5034     enable_kf5=yes
5037 if test "$test_kf5" = "yes"; then
5038     test_qt5=yes
5041 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5042     if test "$enable_qt5" = "no"; then
5043         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5044     else
5045         enable_qt5=yes
5046     fi
5049 dnl ===================================================================
5050 dnl check for cups support
5051 dnl ===================================================================
5052 ENABLE_CUPS=""
5054 if test "$enable_cups" = "no"; then
5055     test_cups=no
5058 AC_MSG_CHECKING([whether to enable CUPS support])
5059 if test "$test_cups" = "yes"; then
5060     ENABLE_CUPS="TRUE"
5061     AC_MSG_RESULT([yes])
5063     AC_MSG_CHECKING([whether cups support is present])
5064     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5065     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5066     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5067         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5068     fi
5070 else
5071     AC_MSG_RESULT([no])
5074 AC_SUBST(ENABLE_CUPS)
5076 # fontconfig checks
5077 if test "$test_fontconfig" = "yes"; then
5078     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5079     SYSTEM_FONTCONFIG=TRUE
5080     FilterLibs "${FONTCONFIG_LIBS}"
5081     FONTCONFIG_LIBS="${filteredlibs}"
5083 AC_SUBST(FONTCONFIG_CFLAGS)
5084 AC_SUBST(FONTCONFIG_LIBS)
5085 AC_SUBST([SYSTEM_FONTCONFIG])
5087 dnl whether to find & fetch external tarballs?
5088 dnl ===================================================================
5089 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5090    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5091        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5092    else
5093        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5094    fi
5096 if test -z "$TARFILE_LOCATION"; then
5097     if test -d "$SRC_ROOT/src" ; then
5098         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5099         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5100     fi
5101     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5102 else
5103     AbsolutePath "$TARFILE_LOCATION"
5104     PathFormat "${absolute_path}"
5105     TARFILE_LOCATION="${formatted_path}"
5107 AC_SUBST(TARFILE_LOCATION)
5109 AC_MSG_CHECKING([whether we want to fetch tarballs])
5110 if test "$enable_fetch_external" != "no"; then
5111     if test "$with_all_tarballs" = "yes"; then
5112         AC_MSG_RESULT([yes, all of them])
5113         DO_FETCH_TARBALLS="ALL"
5114     else
5115         AC_MSG_RESULT([yes, if we use them])
5116         DO_FETCH_TARBALLS="TRUE"
5117     fi
5118 else
5119     AC_MSG_RESULT([no])
5120     DO_FETCH_TARBALLS=
5122 AC_SUBST(DO_FETCH_TARBALLS)
5124 AC_MSG_CHECKING([whether to build help])
5125 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5126     BUILD_TYPE="$BUILD_TYPE HELP"
5127     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5128     case "$with_help" in
5129     "html")
5130         ENABLE_HTMLHELP=TRUE
5131         SCPDEFS="$SCPDEFS -DWITH_HELP"
5132         AC_MSG_RESULT([HTML])
5133         ;;
5134     "online")
5135         ENABLE_HTMLHELP=TRUE
5136         HELP_ONLINE=TRUE
5137         AC_MSG_RESULT([HTML])
5138         ;;
5139     yes)
5140         SCPDEFS="$SCPDEFS -DWITH_HELP"
5141         AC_MSG_RESULT([yes])
5142         ;;
5143     *)
5144         AC_MSG_ERROR([Unknown --with-help=$with_help])
5145         ;;
5146     esac
5147 else
5148     AC_MSG_RESULT([no])
5150 AC_SUBST([ENABLE_HTMLHELP])
5151 AC_SUBST([HELP_ONLINE])
5153 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5154 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5155     BUILD_TYPE="$BUILD_TYPE HELP"
5156     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5157     case "$with_omindex" in
5158     "server")
5159         ENABLE_HTMLHELP=TRUE
5160         HELP_ONLINE=TRUE
5161         HELP_OMINDEX_PAGE=TRUE
5162         AC_MSG_RESULT([SERVER])
5163         ;;
5164     "noxap")
5165         ENABLE_HTMLHELP=TRUE
5166         HELP_ONLINE=TRUE
5167         HELP_OMINDEX_PAGE=FALSE
5168         AC_MSG_RESULT([NOXAP])
5169         ;;
5170     *)
5171         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5172         ;;
5173     esac
5174 else
5175     HELP_OMINDEX_PAGE=FALSE
5176     AC_MSG_RESULT([no])
5178 AC_SUBST([ENABLE_HTMLHELP])
5179 AC_SUBST([HELP_OMINDEX_PAGE])
5180 AC_SUBST([HELP_ONLINE])
5183 dnl Test whether to include MySpell dictionaries
5184 dnl ===================================================================
5185 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5186 if test "$with_myspell_dicts" = "yes"; then
5187     AC_MSG_RESULT([yes])
5188     WITH_MYSPELL_DICTS=TRUE
5189     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5190     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5191 else
5192     AC_MSG_RESULT([no])
5193     WITH_MYSPELL_DICTS=
5195 AC_SUBST(WITH_MYSPELL_DICTS)
5197 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5198 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5199     if test "$with_system_dicts" = yes; then
5200         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5201     fi
5202     with_system_dicts=no
5205 AC_MSG_CHECKING([whether to use dicts from external paths])
5206 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5207     AC_MSG_RESULT([yes])
5208     SYSTEM_DICTS=TRUE
5209     AC_MSG_CHECKING([for spelling dictionary directory])
5210     if test -n "$with_external_dict_dir"; then
5211         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5212     else
5213         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5214         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5215             DICT_SYSTEM_DIR=file:///usr/share/myspell
5216         fi
5217     fi
5218     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5219     AC_MSG_CHECKING([for hyphenation patterns directory])
5220     if test -n "$with_external_hyph_dir"; then
5221         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5222     else
5223         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5224     fi
5225     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5226     AC_MSG_CHECKING([for thesaurus directory])
5227     if test -n "$with_external_thes_dir"; then
5228         THES_SYSTEM_DIR=file://$with_external_thes_dir
5229     else
5230         THES_SYSTEM_DIR=file:///usr/share/mythes
5231     fi
5232     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5233 else
5234     AC_MSG_RESULT([no])
5235     SYSTEM_DICTS=
5237 AC_SUBST(SYSTEM_DICTS)
5238 AC_SUBST(DICT_SYSTEM_DIR)
5239 AC_SUBST(HYPH_SYSTEM_DIR)
5240 AC_SUBST(THES_SYSTEM_DIR)
5242 dnl ===================================================================
5243 dnl Precompiled headers.
5244 ENABLE_PCH=""
5245 AC_MSG_CHECKING([whether to enable pch feature])
5246 if test -z "$enable_pch"; then
5247     if test "$_os" = "WINNT"; then
5248         # Enabled by default on Windows.
5249         enable_pch=yes
5250     else
5251         enable_pch=no
5252     fi
5254 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5255     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5257 if test "$enable_pch" = "system"; then
5258     ENABLE_PCH="1"
5259     AC_MSG_RESULT([yes (system headers)])
5260 elif test "$enable_pch" = "base"; then
5261     ENABLE_PCH="2"
5262     AC_MSG_RESULT([yes (system and base headers)])
5263 elif test "$enable_pch" = "normal"; then
5264     ENABLE_PCH="3"
5265     AC_MSG_RESULT([yes (normal)])
5266 elif test "$enable_pch" = "full"; then
5267     ENABLE_PCH="4"
5268     AC_MSG_RESULT([yes (full)])
5269 elif test "$enable_pch" = "yes"; then
5270     # Pick a suitable default.
5271     if test "$GCC" = "yes"; then
5272         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5273         # while making the PCHs larger and rebuilds more likely.
5274         ENABLE_PCH="2"
5275         AC_MSG_RESULT([yes (system and base headers)])
5276     else
5277         # With MSVC the highest level makes a significant difference,
5278         # and it was the default when there used to be no PCH levels.
5279         ENABLE_PCH="4"
5280         AC_MSG_RESULT([yes (full)])
5281     fi
5282 elif test "$enable_pch" = "no"; then
5283     AC_MSG_RESULT([no])
5284 else
5285     AC_MSG_ERROR([Unknown value for --enable-pch])
5287 AC_SUBST(ENABLE_PCH)
5288 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5289 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5290     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5291     if test "$CCACHE_BIN" != "not found"; then
5292         AC_MSG_CHECKING([ccache version])
5293         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5294         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5295         AC_MSG_RESULT([$CCACHE_VERSION])
5296         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5297         if test "$CCACHE_NUMVER" -gt "030701"; then
5298             AC_MSG_RESULT([yes])
5299         else
5300             AC_MSG_RESULT([no (not newer than 3.7.1)])
5301             CCACHE_DEPEND_MODE=
5302         fi
5303     fi
5306 PCH_INSTANTIATE_TEMPLATES=
5307 if test -n "$ENABLE_PCH"; then
5308     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5309     save_CFLAGS=$CFLAGS
5310     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5311     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5312     CFLAGS=$save_CFLAGS
5313     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5314         AC_MSG_RESULT(yes)
5315     else
5316         AC_MSG_RESULT(no)
5317     fi
5318     CFLAGS=$save_CFLAGS
5320 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5322 BUILDING_PCH_WITH_OBJ=
5323 if test -n "$ENABLE_PCH"; then
5324     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5325     save_CFLAGS=$CFLAGS
5326     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5327     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5328     CFLAGS=$save_CFLAGS
5329     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5330         AC_MSG_RESULT(yes)
5331     else
5332         AC_MSG_RESULT(no)
5333     fi
5335 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5337 PCH_MODULES_CODEGEN=
5338 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5339     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-codegen])
5340     save_CFLAGS=$CFLAGS
5341     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-codegen"
5342     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_CODEGEN="-Xclang -fmodules-codegen" ],[])
5343     CFLAGS=$save_CFLAGS
5344     if test -n "$PCH_MODULES_CODEGEN"; then
5345         AC_MSG_RESULT(yes)
5346     else
5347         AC_MSG_RESULT(no)
5348     fi
5349     CFLAGS=$save_CFLAGS
5351 AC_SUBST(PCH_MODULES_CODEGEN)
5352 PCH_MODULES_DEBUGINFO=
5353 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5354     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-debuginfo])
5355     save_CFLAGS=$CFLAGS
5356     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-debuginfo"
5357     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_DEBUGINFO="-Xclang -fmodules-debuginfo" ],[])
5358     CFLAGS=$save_CFLAGS
5359     if test -n "$PCH_MODULES_DEBUGINFO"; then
5360         AC_MSG_RESULT(yes)
5361     else
5362         AC_MSG_RESULT(no)
5363     fi
5364     CFLAGS=$save_CFLAGS
5366 AC_SUBST(PCH_MODULES_DEBUGINFO)
5368 TAB=`printf '\t'`
5370 AC_MSG_CHECKING([the GNU Make version])
5371 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5372 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5373 if test "$_make_longver" -ge "038200"; then
5374     AC_MSG_RESULT([$GNUMAKE $_make_version])
5376 elif test "$_make_longver" -ge "038100"; then
5377     if test "$build_os" = "cygwin"; then
5378         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5379     fi
5380     AC_MSG_RESULT([$GNUMAKE $_make_version])
5382     dnl ===================================================================
5383     dnl Search all the common names for sha1sum
5384     dnl ===================================================================
5385     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5386     if test -z "$SHA1SUM"; then
5387         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5388     elif test "$SHA1SUM" = "openssl"; then
5389         SHA1SUM="openssl sha1"
5390     fi
5391     AC_MSG_CHECKING([for GNU Make bug 20033])
5392     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5393     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5394 A := \$(wildcard *.a)
5396 .PHONY: all
5397 all: \$(A:.a=.b)
5398 <TAB>@echo survived bug20033.
5400 .PHONY: setup
5401 setup:
5402 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5404 define d1
5405 @echo lala \$(1)
5406 @sleep 1
5407 endef
5409 define d2
5410 @echo tyty \$(1)
5411 @sleep 1
5412 endef
5414 %.b : %.a
5415 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5416 <TAB>\$(call d1,\$(CHECKSUM)),\
5417 <TAB>\$(call d2,\$(CHECKSUM)))
5419     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5420         no_parallelism_make="YES"
5421         AC_MSG_RESULT([yes, disable parallelism])
5422     else
5423         AC_MSG_RESULT([no, keep parallelism enabled])
5424     fi
5425     rm -rf $TESTGMAKEBUG20033
5426 else
5427     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5430 # find if gnumake support file function
5431 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5432 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5433 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5434     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5436 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5437 \$(file >test.txt,Success )
5439 .PHONY: all
5440 all:
5441 <TAB>@cat test.txt
5444 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5445 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5446     HAVE_GNUMAKE_FILE_FUNC=TRUE
5447     AC_MSG_RESULT([yes])
5448 else
5449     AC_MSG_RESULT([no])
5451 rm -rf $TESTGMAKEFILEFUNC
5452 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5453 AC_SUBST(GNUMAKE_WIN_NATIVE)
5455 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5456 STALE_MAKE=
5457 if test "$_make_ver_check" = ""; then
5458    STALE_MAKE=TRUE
5461 HAVE_LD_HASH_STYLE=FALSE
5462 WITH_LINKER_HASH_STYLE=
5463 AC_MSG_CHECKING([for --hash-style gcc linker support])
5464 if test "$GCC" = "yes"; then
5465     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5466         hash_styles="gnu sysv"
5467     elif test "$with_linker_hash_style" = "no"; then
5468         hash_styles=
5469     else
5470         hash_styles="$with_linker_hash_style"
5471     fi
5473     for hash_style in $hash_styles; do
5474         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5475         hash_style_ldflags_save=$LDFLAGS
5476         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5478         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5479             [
5480 #include <stdio.h>
5481             ],[
5482 printf ("");
5483             ])],
5484             [
5485                   HAVE_LD_HASH_STYLE=TRUE
5486                   WITH_LINKER_HASH_STYLE=$hash_style
5487             ],
5488             [HAVE_LD_HASH_STYLE=FALSE],
5489             [HAVE_LD_HASH_STYLE=FALSE])
5490         LDFLAGS=$hash_style_ldflags_save
5491     done
5493     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5494         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5495     else
5496         AC_MSG_RESULT( no )
5497     fi
5498     LDFLAGS=$hash_style_ldflags_save
5499 else
5500     AC_MSG_RESULT( no )
5502 AC_SUBST(HAVE_LD_HASH_STYLE)
5503 AC_SUBST(WITH_LINKER_HASH_STYLE)
5505 dnl ===================================================================
5506 dnl Check whether there's a Perl version available.
5507 dnl ===================================================================
5508 if test -z "$with_perl_home"; then
5509     AC_PATH_PROG(PERL, perl)
5510 else
5511     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5512     _perl_path="$with_perl_home/bin/perl"
5513     if test -x "$_perl_path"; then
5514         PERL=$_perl_path
5515     else
5516         AC_MSG_ERROR([$_perl_path not found])
5517     fi
5520 dnl ===================================================================
5521 dnl Testing for Perl version 5 or greater.
5522 dnl $] is the Perl version variable, it is returned as an integer
5523 dnl ===================================================================
5524 if test "$PERL"; then
5525     AC_MSG_CHECKING([the Perl version])
5526     ${PERL} -e "exit($]);"
5527     _perl_version=$?
5528     if test "$_perl_version" -lt 5; then
5529         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5530     fi
5531     AC_MSG_RESULT([Perl $_perl_version])
5532 else
5533     AC_MSG_ERROR([Perl not found, install Perl 5])
5536 dnl ===================================================================
5537 dnl Testing for required Perl modules
5538 dnl ===================================================================
5540 AC_MSG_CHECKING([for required Perl modules])
5541 perl_use_string="use Cwd ; use Digest::MD5"
5542 if test "$_os" = "WINNT"; then
5543     if test -n "$PKGFORMAT"; then
5544         for i in $PKGFORMAT; do
5545             case "$i" in
5546             msi)
5547                 # for getting fonts versions to use in MSI
5548                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5549                 ;;
5550             esac
5551         done
5552     fi
5554 if test "$with_system_hsqldb" = "yes"; then
5555     perl_use_string="$perl_use_string ; use Archive::Zip"
5557 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5558     AC_MSG_RESULT([all modules found])
5559 else
5560     AC_MSG_RESULT([failed to find some modules])
5561     # Find out which modules are missing.
5562     for i in $perl_use_string; do
5563         if test "$i" != "use" -a "$i" != ";"; then
5564             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5565                 missing_perl_modules="$missing_perl_modules $i"
5566             fi
5567         fi
5568     done
5569     AC_MSG_ERROR([
5570     The missing Perl modules are: $missing_perl_modules
5571     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5574 dnl ===================================================================
5575 dnl Check for pkg-config
5576 dnl ===================================================================
5577 if test "$_os" != "WINNT"; then
5578     PKG_PROG_PKG_CONFIG
5581 if test "$_os" != "WINNT"; then
5583     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5584     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5585     # explicitly. Or put /path/to/compiler in PATH yourself.
5587     # Use wrappers for LTO
5588     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5589         AC_CHECK_TOOL(AR,gcc-ar)
5590         AC_CHECK_TOOL(NM,gcc-nm)
5591         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5592     else
5593         AC_CHECK_TOOL(AR,ar)
5594         AC_CHECK_TOOL(NM,nm)
5595         AC_CHECK_TOOL(RANLIB,ranlib)
5596     fi
5597     AC_CHECK_TOOL(OBJDUMP,objdump)
5598     AC_CHECK_TOOL(READELF,readelf)
5599     AC_CHECK_TOOL(STRIP,strip)
5600     if test "$_os" = "WINNT"; then
5601         AC_CHECK_TOOL(DLLTOOL,dlltool)
5602         AC_CHECK_TOOL(WINDRES,windres)
5603     fi
5605 AC_SUBST(AR)
5606 AC_SUBST(DLLTOOL)
5607 AC_SUBST(NM)
5608 AC_SUBST(OBJDUMP)
5609 AC_SUBST(PKG_CONFIG)
5610 AC_SUBST(RANLIB)
5611 AC_SUBST(READELF)
5612 AC_SUBST(STRIP)
5613 AC_SUBST(WINDRES)
5615 dnl ===================================================================
5616 dnl pkg-config checks on macOS
5617 dnl ===================================================================
5619 if test $_os = Darwin; then
5620     AC_MSG_CHECKING([for bogus pkg-config])
5621     if test -n "$PKG_CONFIG"; then
5622         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5623             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5624         else
5625             if test "$enable_bogus_pkg_config" = "yes"; then
5626                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5627             else
5628                 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.])
5629             fi
5630         fi
5631     else
5632         AC_MSG_RESULT([no, good])
5633     fi
5636 find_csc()
5638     # Return value: $csctest
5640     unset csctest
5642     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5643     if test -n "$regvalue"; then
5644         csctest=$regvalue
5645         return
5646     fi
5649 find_al()
5651     # Return value: $altest
5653     unset altest
5655     # We need this check to detect 4.6.1 or above.
5656     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5657         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5658         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5659             altest=$regvalue
5660             return
5661         fi
5662     done
5664     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5665         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5666         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5667             altest=$regvalue
5668             return
5669         fi
5670     done
5675 find_dotnetsdk46()
5677     unset frametest
5679     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5680         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5681         if test -n "$regvalue"; then
5682             frametest=$regvalue
5683             return
5684         fi
5685     done
5688 find_winsdk_version()
5690     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5691     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5693     unset winsdktest winsdkbinsubdir winsdklibsubdir
5695     case "$1" in
5696     8.0|8.0A)
5697         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5698         if test -n "$regvalue"; then
5699             winsdktest=$regvalue
5700             winsdklibsubdir=win8
5701             return
5702         fi
5703         ;;
5704     8.1|8.1A)
5705         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5706         if test -n "$regvalue"; then
5707             winsdktest=$regvalue
5708             winsdklibsubdir=winv6.3
5709             return
5710         fi
5711         ;;
5712     10.0)
5713         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5714         if test -n "$regvalue"; then
5715             winsdktest=$regvalue
5716             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5717             if test -n "$regvalue"; then
5718                 winsdkbinsubdir="$regvalue".0
5719                 winsdklibsubdir=$winsdkbinsubdir
5720                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5721                 # test exist the SDK path
5722                 if test -d "$tmppath"; then
5723                    # when path is convertible to a short path then path is okay
5724                    cygpath -d "$tmppath" >/dev/null 2>&1
5725                    if test $? -ne 0; then
5726                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5727                    fi
5728                 else
5729                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5730                 fi
5731             fi
5732             return
5733         fi
5734         ;;
5735     esac
5738 find_winsdk()
5740     # Return value: From find_winsdk_version
5742     unset winsdktest
5744     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5745         find_winsdk_version $ver
5746         if test -n "$winsdktest"; then
5747             return
5748         fi
5749     done
5752 find_msms()
5754     AC_MSG_CHECKING([for MSVC merge modules directory])
5755     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5756     case "$VCVER" in
5757         160)
5758         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5759         ;;
5760     esac
5761     for f in $my_msm_files; do
5762         echo "$as_me:$LINENO: searching for $f" >&5
5763     done
5765     msmdir=
5766     for ver in 14.0 15.0; do
5767         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5768         if test -n "$regvalue"; then
5769             for f in ${my_msm_files}; do
5770                 if test -e "$regvalue/${f}"; then
5771                     msmdir=$regvalue
5772                     break
5773                 fi
5774             done
5775         fi
5776     done
5777     dnl Is the following fallback really necessary, or was it added in response
5778     dnl to never having started Visual Studio on a given machine, so the
5779     dnl registry keys checked above had presumably not yet been created?
5780     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5781     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5782     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5783     dnl expanding to "C:\Program Files\Common Files"), which would need
5784     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5785     dnl obtain its value from cygwin:
5786     if test -z "$msmdir"; then
5787         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5788         for f in ${my_msm_files}; do
5789             if test -e "$my_msm_dir/${f}"; then
5790                 msmdir=$my_msm_dir
5791             fi
5792         done
5793     fi
5795     dnl Starting from MSVC 15.0, merge modules are located in different directory
5796     case "$VCVER" in
5797     160)
5798         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5799             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5800             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5801             for f in ${my_msm_files}; do
5802                 if test -e "$my_msm_dir/${f}"; then
5803                     msmdir=$my_msm_dir
5804                     break
5805                 fi
5806             done
5807         done
5808         ;;
5809     esac
5811     if test -n "$msmdir"; then
5812         msmdir=`cygpath -m "$msmdir"`
5813         AC_MSG_RESULT([$msmdir])
5814     else
5815         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5816             AC_MSG_FAILURE([not found])
5817         else
5818             AC_MSG_WARN([not found (check config.log)])
5819             add_warning "MSM none of ${my_msm_files} found"
5820         fi
5821     fi
5824 find_msvc_x64_dlls()
5826     AC_MSG_CHECKING([for MSVC x64 DLL path])
5827     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5828     case "$VCVER" in
5829     160)
5830         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5831             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5832             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5833                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5834                 break
5835             fi
5836             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5837             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5838                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5839                 break
5840             fi
5841         done
5842         ;;
5843     esac
5844     AC_MSG_RESULT([$msvcdllpath])
5845     AC_MSG_CHECKING([for MSVC x64 DLLs])
5846     msvcdlls="msvcp140.dll vcruntime140.dll"
5847     for dll in $msvcdlls; do
5848         if ! test -f "$msvcdllpath/$dll"; then
5849             AC_MSG_FAILURE([missing $dll])
5850         fi
5851     done
5852     AC_MSG_RESULT([found all ($msvcdlls)])
5855 dnl =========================================
5856 dnl Check for the Windows  SDK.
5857 dnl =========================================
5858 if test "$_os" = "WINNT"; then
5859     AC_MSG_CHECKING([for Windows SDK])
5860     if test "$build_os" = "cygwin"; then
5861         find_winsdk
5862         WINDOWS_SDK_HOME=$winsdktest
5864         # normalize if found
5865         if test -n "$WINDOWS_SDK_HOME"; then
5866             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5867             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5868         fi
5870         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5871     fi
5873     if test -n "$WINDOWS_SDK_HOME"; then
5874         # Remove a possible trailing backslash
5875         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5877         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5878              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5879              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5880             have_windows_sdk_headers=yes
5881         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5882              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5883              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5884             have_windows_sdk_headers=yes
5885         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5886              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5887              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5888             have_windows_sdk_headers=yes
5889         else
5890             have_windows_sdk_headers=no
5891         fi
5893         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5894             have_windows_sdk_libs=yes
5895         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5896             have_windows_sdk_libs=yes
5897         else
5898             have_windows_sdk_libs=no
5899         fi
5901         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5902             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5903 the  Windows SDK are installed.])
5904         fi
5905     fi
5907     if test -z "$WINDOWS_SDK_HOME"; then
5908         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5909     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5910         WINDOWS_SDK_VERSION=80
5911         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5912     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5913         WINDOWS_SDK_VERSION=81
5914         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5915     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5916         WINDOWS_SDK_VERSION=10
5917         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5918     else
5919         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5920     fi
5921     PathFormat "$WINDOWS_SDK_HOME"
5922     WINDOWS_SDK_HOME="$formatted_path"
5923     if test "$build_os" = "cygwin"; then
5924         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5925         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5926             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5927         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5928             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5929         fi
5930     fi
5932     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5933     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5934     dnl but not in v8.0), so allow this to be overridden with a
5935     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5936     dnl and configuration error if no WiLangId.vbs is found would arguably be
5937     dnl better, but I do not know under which conditions exactly it is needed by
5938     dnl msiglobal.pm:
5939     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5940         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5941         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5942             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5943         fi
5944         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5945             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5946         fi
5947         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5948             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5949         fi
5950     fi
5951     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5952         if test -n "$with_package_format" -a "$with_package_format" != no; then
5953             for i in "$with_package_format"; do
5954                 if test "$i" = "msi"; then
5955                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5956                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5957                     fi
5958                 fi
5959             done
5960         fi
5961     fi
5963 AC_SUBST(WINDOWS_SDK_HOME)
5964 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5965 AC_SUBST(WINDOWS_SDK_VERSION)
5966 AC_SUBST(WINDOWS_SDK_WILANGID)
5968 if test "$build_os" = "cygwin"; then
5969     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5970     dnl dir, it also determines that dir's path w/o an arch segment if any,
5971     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5972     AC_MSG_CHECKING([for midl.exe])
5974     find_winsdk
5975     if test -n "$winsdkbinsubdir" \
5976         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5977     then
5978         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5979         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5980     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5981         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5982         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5983     elif test -f "$winsdktest/Bin/midl.exe"; then
5984         MIDL_PATH=$winsdktest/Bin
5985         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5986     fi
5987     if test ! -f "$MIDL_PATH/midl.exe"; then
5988         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5989     else
5990         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5991     fi
5993     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5994     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5996     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5997          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5998          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5999          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6000     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6001          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6002          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6003          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6004     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6005          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6006          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6007          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6008     else
6009         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6010     fi
6012     dnl Check csc.exe
6013     AC_MSG_CHECKING([for csc.exe])
6014     find_csc
6015     if test -f "$csctest/csc.exe"; then
6016         CSC_PATH="$csctest"
6017     fi
6018     if test ! -f "$CSC_PATH/csc.exe"; then
6019         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6020     else
6021         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6022     fi
6024     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6026     dnl Check al.exe
6027     AC_MSG_CHECKING([for al.exe])
6028     find_winsdk
6029     if test -n "$winsdkbinsubdir" \
6030         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
6031     then
6032         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
6033     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
6034         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
6035     elif test -f "$winsdktest/Bin/al.exe"; then
6036         AL_PATH="$winsdktest/Bin"
6037     fi
6039     if test -z "$AL_PATH"; then
6040         find_al
6041         if test -f "$altest/bin/al.exe"; then
6042             AL_PATH="$altest/bin"
6043         elif test -f "$altest/al.exe"; then
6044             AL_PATH="$altest"
6045         fi
6046     fi
6047     if test ! -f "$AL_PATH/al.exe"; then
6048         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6049     else
6050         AC_MSG_RESULT([$AL_PATH/al.exe])
6051     fi
6053     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6055     dnl Check mscoree.lib / .NET Framework dir
6056     AC_MSG_CHECKING(.NET Framework)
6057     find_dotnetsdk46
6058     PathFormat "$frametest"
6059     frametest="$formatted_path"
6060     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6061         DOTNET_FRAMEWORK_HOME="$frametest"
6062     else
6063         find_winsdk
6064         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6065             DOTNET_FRAMEWORK_HOME="$winsdktest"
6066         fi
6067     fi
6068     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
6069         AC_MSG_ERROR([mscoree.lib not found])
6070     fi
6071     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6073     PathFormat "$MIDL_PATH"
6074     MIDL_PATH="$formatted_path"
6076     PathFormat "$AL_PATH"
6077     AL_PATH="$formatted_path"
6079     PathFormat "$DOTNET_FRAMEWORK_HOME"
6080     DOTNET_FRAMEWORK_HOME="$formatted_path"
6082     PathFormat "$CSC_PATH"
6083     CSC_PATH="$formatted_path"
6086 dnl ===================================================================
6087 dnl Check if stdc headers are available excluding MSVC.
6088 dnl ===================================================================
6089 if test "$_os" != "WINNT"; then
6090     AC_HEADER_STDC
6093 dnl ===================================================================
6094 dnl Testing for C++ compiler and version...
6095 dnl ===================================================================
6097 if test "$_os" != "WINNT"; then
6098     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6099     save_CXXFLAGS=$CXXFLAGS
6100     AC_PROG_CXX
6101     CXXFLAGS=$save_CXXFLAGS
6102     if test -z "$CXX_BASE"; then
6103         CXX_BASE=`first_arg_basename "$CXX"`
6104     fi
6107 dnl check for GNU C++ compiler version
6108 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6109     AC_MSG_CHECKING([the GNU C++ compiler version])
6111     _gpp_version=`$CXX -dumpversion`
6112     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6114     if test "$_gpp_majmin" -lt "700"; then
6115         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6116     else
6117         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6118     fi
6120     dnl see https://code.google.com/p/android/issues/detail?id=41770
6121         glibcxx_threads=no
6122         AC_LANG_PUSH([C++])
6123         AC_REQUIRE_CPP
6124         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6125         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6126             #include <bits/c++config.h>]],[[
6127             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6128             && !defined(_GLIBCXX__PTHREADS) \
6129             && !defined(_GLIBCXX_HAS_GTHREADS)
6130             choke me
6131             #endif
6132         ]])],[AC_MSG_RESULT([yes])
6133         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6134         AC_LANG_POP([C++])
6135         if test $glibcxx_threads = yes; then
6136             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6137         fi
6139 AC_SUBST(BOOST_CXXFLAGS)
6142 # prefx CXX with ccache if needed
6144 if test "$CCACHE" != ""; then
6145     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6146     AC_LANG_PUSH([C++])
6147     save_CXXFLAGS=$CXXFLAGS
6148     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6149     dnl an empty program will do, we're checking the compiler flags
6150     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6151                       [use_ccache=yes], [use_ccache=no])
6152     if test $use_ccache = yes; then
6153         AC_MSG_RESULT([yes])
6154     else
6155         CXX="$CCACHE $CXX"
6156         CXX_BASE="ccache $CXX_BASE"
6157         AC_MSG_RESULT([no])
6158     fi
6159     CXXFLAGS=$save_CXXFLAGS
6160     AC_LANG_POP([C++])
6163 dnl ===================================================================
6164 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6165 dnl ===================================================================
6167 if test "$_os" != "WINNT"; then
6168     AC_PROG_CXXCPP
6170     dnl Check whether there's a C pre-processor.
6171     AC_PROG_CPP
6175 dnl ===================================================================
6176 dnl Find integral type sizes and alignments
6177 dnl ===================================================================
6179 if test "$_os" != "WINNT"; then
6181 if test "$_os" = "iOS"; then
6182     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6183     ac_cv_sizeof_long=8
6184     ac_cv_sizeof_short=2
6185     ac_cv_sizeof_int=4
6186     ac_cv_sizeof_long_long=8
6187     ac_cv_sizeof_double=8
6188     ac_cv_sizeof_voidp=8
6189 else
6190     AC_CHECK_SIZEOF(long)
6191     AC_CHECK_SIZEOF(short)
6192     AC_CHECK_SIZEOF(int)
6193     AC_CHECK_SIZEOF(long long)
6194     AC_CHECK_SIZEOF(double)
6195     AC_CHECK_SIZEOF(void*)
6198     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6199     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6200     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6201     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6202     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6204     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6205     m4_pattern_allow([AC_CHECK_ALIGNOF])
6206     m4_ifdef([AC_CHECK_ALIGNOF],
6207         [
6208             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6209             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6210             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6211             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6212         ],
6213         [
6214             case "$_os-$host_cpu" in
6215             Linux-i686)
6216                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6217                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6218                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6219                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6220                 ;;
6221             Linux-x86_64)
6222                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6223                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6224                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6225                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6226                 ;;
6227             *)
6228                 if test -z "$ac_cv_alignof_short" -o \
6229                         -z "$ac_cv_alignof_int" -o \
6230                         -z "$ac_cv_alignof_long" -o \
6231                         -z "$ac_cv_alignof_double"; then
6232                    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.])
6233                 fi
6234                 ;;
6235             esac
6236         ])
6238     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6239     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6240     if test $ac_cv_sizeof_long -eq 8; then
6241         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6242     elif test $ac_cv_sizeof_double -eq 8; then
6243         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6244     else
6245         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6246     fi
6248     dnl Check for large file support
6249     AC_SYS_LARGEFILE
6250     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6251         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6252     fi
6253     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6254         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6255     fi
6256 else
6257     # Hardcode for MSVC
6258     SAL_TYPES_SIZEOFSHORT=2
6259     SAL_TYPES_SIZEOFINT=4
6260     SAL_TYPES_SIZEOFLONG=4
6261     SAL_TYPES_SIZEOFLONGLONG=8
6262     if test "$BITNESS_OVERRIDE" = ""; then
6263         SAL_TYPES_SIZEOFPOINTER=4
6264     else
6265         SAL_TYPES_SIZEOFPOINTER=8
6266     fi
6267     SAL_TYPES_ALIGNMENT2=2
6268     SAL_TYPES_ALIGNMENT4=4
6269     SAL_TYPES_ALIGNMENT8=8
6270     LFS_CFLAGS=''
6272 AC_SUBST(LFS_CFLAGS)
6274 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6275 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6276 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6277 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6278 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6279 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6280 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6281 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6283 dnl ===================================================================
6284 dnl Check whether to enable runtime optimizations
6285 dnl ===================================================================
6286 ENABLE_RUNTIME_OPTIMIZATIONS=
6287 AC_MSG_CHECKING([whether to enable runtime optimizations])
6288 if test -z "$enable_runtime_optimizations"; then
6289     for i in $CC; do
6290         case $i in
6291         -fsanitize=*)
6292             enable_runtime_optimizations=no
6293             break
6294             ;;
6295         esac
6296     done
6298 if test "$enable_runtime_optimizations" != no; then
6299     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6300     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6301     AC_MSG_RESULT([yes])
6302 else
6303     AC_MSG_RESULT([no])
6305 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6307 dnl ===================================================================
6308 dnl Check if valgrind headers are available
6309 dnl ===================================================================
6310 ENABLE_VALGRIND=
6311 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6312     prev_cppflags=$CPPFLAGS
6313     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6314     # or where does it come from?
6315     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6316     AC_CHECK_HEADER([valgrind/valgrind.h],
6317         [ENABLE_VALGRIND=TRUE])
6318     CPPFLAGS=$prev_cppflags
6320 AC_SUBST([ENABLE_VALGRIND])
6321 if test -z "$ENABLE_VALGRIND"; then
6322     if test "$with_valgrind" = yes; then
6323         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6324     fi
6325     VALGRIND_CFLAGS=
6327 AC_SUBST([VALGRIND_CFLAGS])
6330 dnl ===================================================================
6331 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6332 dnl ===================================================================
6334 # We need at least the sys/sdt.h include header.
6335 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6336 if test "$SDT_H_FOUND" = "TRUE"; then
6337     # Found sys/sdt.h header, now make sure the c++ compiler works.
6338     # Old g++ versions had problems with probes in constructors/destructors.
6339     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6340     AC_LANG_PUSH([C++])
6341     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6342     #include <sys/sdt.h>
6343     class ProbeClass
6344     {
6345     private:
6346       int& ref;
6347       const char *name;
6349     public:
6350       ProbeClass(int& v, const char *n) : ref(v), name(n)
6351       {
6352         DTRACE_PROBE2(_test_, cons, name, ref);
6353       }
6355       void method(int min)
6356       {
6357         DTRACE_PROBE3(_test_, meth, name, ref, min);
6358         ref -= min;
6359       }
6361       ~ProbeClass()
6362       {
6363         DTRACE_PROBE2(_test_, dest, name, ref);
6364       }
6365     };
6366     ]],[[
6367     int i = 64;
6368     DTRACE_PROBE1(_test_, call, i);
6369     ProbeClass inst = ProbeClass(i, "call");
6370     inst.method(24);
6371     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6372           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6373     AC_LANG_POP([C++])
6375 AC_CONFIG_HEADERS([config_host/config_probes.h])
6377 dnl ===================================================================
6378 dnl GCC features
6379 dnl ===================================================================
6380 HAVE_GCC_STACK_CLASH_PROTECTION=
6381 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6382     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6383     save_CFLAGS=$CFLAGS
6384     CFLAGS="$CFLAGS -fstack-clash-protection"
6385     AC_LINK_IFELSE(
6386         [AC_LANG_PROGRAM(, [[return 0;]])],
6387         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6388         [AC_MSG_RESULT([no])])
6389     CFLAGS=$save_CFLAGS
6391     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6392     save_CFLAGS=$CFLAGS
6393     CFLAGS="$CFLAGS -Werror -mno-avx"
6394     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6395     CFLAGS=$save_CFLAGS
6396     if test "$HAVE_GCC_AVX" = "TRUE"; then
6397         AC_MSG_RESULT([yes])
6398     else
6399         AC_MSG_RESULT([no])
6400     fi
6402     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6403     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6404     int v = 0;
6405     if (__sync_add_and_fetch(&v, 1) != 1 ||
6406         __sync_sub_and_fetch(&v, 1) != 0)
6407         return 1;
6408     __sync_synchronize();
6409     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6410         v != 1)
6411         return 1;
6412     return 0;
6413 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6414     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6415         AC_MSG_RESULT([yes])
6416         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6417     else
6418         AC_MSG_RESULT([no])
6419     fi
6421     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6422     AC_LANG_PUSH([C++])
6423     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6424             #include <cstddef>
6425             #include <cxxabi.h>
6426             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6427         ])], [
6428             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6429             AC_MSG_RESULT([yes])
6430         ], [AC_MSG_RESULT([no])])
6431     AC_LANG_POP([C++])
6433     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6434     AC_LANG_PUSH([C++])
6435     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6436             #include <cstddef>
6437             #include <cxxabi.h>
6438             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6439         ])], [
6440             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6441             AC_MSG_RESULT([yes])
6442         ], [AC_MSG_RESULT([no])])
6443     AC_LANG_POP([C++])
6445     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6446     AC_LANG_PUSH([C++])
6447     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6448             #include <cxxabi.h>
6449             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6450         ])], [
6451             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6452             AC_MSG_RESULT([yes])
6453         ], [AC_MSG_RESULT([no])])
6454     AC_LANG_POP([C++])
6456     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6457     AC_LANG_PUSH([C++])
6458     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6459             #include <cstddef>
6460             #include <cxxabi.h>
6461             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6462         ])], [
6463             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6464             AC_MSG_RESULT([yes])
6465         ], [AC_MSG_RESULT([no])])
6466     AC_LANG_POP([C++])
6468     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6469     AC_LANG_PUSH([C++])
6470     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6471             #include <cstddef>
6472             #include <cxxabi.h>
6473             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6474         ])], [
6475             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6476             AC_MSG_RESULT([yes])
6477         ], [AC_MSG_RESULT([no])])
6478     AC_LANG_POP([C++])
6480     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6481     AC_LANG_PUSH([C++])
6482     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6483             #include <cxxabi.h>
6484             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6485         ])], [
6486             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6487             AC_MSG_RESULT([yes])
6488         ], [AC_MSG_RESULT([no])])
6489     AC_LANG_POP([C++])
6491     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6492     AC_LANG_PUSH([C++])
6493     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6494             #include <cxxabi.h>
6495             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6496         ])], [
6497             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6498             AC_MSG_RESULT([yes])
6499         ], [AC_MSG_RESULT([no])])
6500     AC_LANG_POP([C++])
6502     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6503     AC_LANG_PUSH([C++])
6504     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6505             #include <cxxabi.h>
6506             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6507         ])], [
6508             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6509             AC_MSG_RESULT([yes])
6510         ], [AC_MSG_RESULT([no])])
6511     AC_LANG_POP([C++])
6513     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6514     AC_LANG_PUSH([C++])
6515     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6516             #include <cstddef>
6517             #include <cxxabi.h>
6518             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6519         ])], [
6520             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6521             AC_MSG_RESULT([yes])
6522         ], [AC_MSG_RESULT([no])])
6523     AC_LANG_POP([C++])
6525     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6526     AC_LANG_PUSH([C++])
6527     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6528             #include <cstddef>
6529             #include <cxxabi.h>
6530             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6531         ])], [
6532             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6533             AC_MSG_RESULT([yes])
6534         ], [AC_MSG_RESULT([no])])
6535     AC_LANG_POP([C++])
6538 AC_SUBST(HAVE_GCC_AVX)
6539 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6540 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6542 dnl ===================================================================
6543 dnl Identify the C++ library
6544 dnl ===================================================================
6546 AC_MSG_CHECKING([what the C++ library is])
6547 AC_LANG_PUSH([C++])
6548 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6549 #include <utility>
6550 #ifndef __GLIBCXX__
6551 foo bar
6552 #endif
6553 ]])],
6554     [CPP_LIBRARY=GLIBCXX
6555      cpp_library_name="GNU libstdc++"
6556     ],
6557     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6558 #include <utility>
6559 #ifndef _LIBCPP_VERSION
6560 foo bar
6561 #endif
6562 ]])],
6563     [CPP_LIBRARY=LIBCPP
6564      cpp_library_name="LLVM libc++"
6565      AC_DEFINE([HAVE_LIBCXX])
6566     ],
6567     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6568 #include <utility>
6569 #ifndef _MSC_VER
6570 foo bar
6571 #endif
6572 ]])],
6573     [CPP_LIBRARY=MSVCRT
6574      cpp_library_name="Microsoft"
6575     ],
6576     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6577 AC_MSG_RESULT([$cpp_library_name])
6578 AC_LANG_POP([C++])
6580 dnl ===================================================================
6581 dnl Check for gperf
6582 dnl ===================================================================
6583 AC_PATH_PROG(GPERF, gperf)
6584 if test -z "$GPERF"; then
6585     AC_MSG_ERROR([gperf not found but needed. Install it.])
6587 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6588     GPERF=`cygpath -m $GPERF`
6590 AC_MSG_CHECKING([whether gperf is new enough])
6591 my_gperf_ver1=$($GPERF --version | head -n 1)
6592 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6593 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6594 if test "$my_gperf_ver3" -ge 301; then
6595     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6596 else
6597     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6599 AC_SUBST(GPERF)
6601 dnl ===================================================================
6602 dnl Check for system libcmis
6603 dnl ===================================================================
6604 # libcmis requires curl and we can't build curl for iOS
6605 if test $_os != iOS; then
6606     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6607     ENABLE_LIBCMIS=TRUE
6608 else
6609     ENABLE_LIBCMIS=
6611 AC_SUBST(ENABLE_LIBCMIS)
6613 dnl ===================================================================
6614 dnl C++11
6615 dnl ===================================================================
6617 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6618 CXXFLAGS_CXX11=
6619 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6620     if test "$with_latest_c__" = yes; then
6621         CXXFLAGS_CXX11=-std:c++latest
6622     else
6623         CXXFLAGS_CXX11=-std:c++17
6624     fi
6625     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6626 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6627     my_flags='-std=c++17 -std=c++1z'
6628     if test "$with_latest_c__" = yes; then
6629         my_flags="-std=c++20 -std=c++2a $my_flags"
6630     fi
6631     for flag in $my_flags; do
6632         if test "$COM" = MSC; then
6633             flag="-Xclang $flag"
6634         fi
6635         save_CXXFLAGS=$CXXFLAGS
6636         CXXFLAGS="$CXXFLAGS $flag -Werror"
6637         if test "$SYSTEM_LIBCMIS" = TRUE; then
6638             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6639         fi
6640         AC_LANG_PUSH([C++])
6641         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6642             #include <algorithm>
6643             #include <functional>
6644             #include <vector>
6646             #if defined SYSTEM_LIBCMIS
6647             // See ucb/source/ucp/cmis/auth_provider.hxx:
6648             #if !defined __clang__
6649             #pragma GCC diagnostic push
6650             #pragma GCC diagnostic ignored "-Wdeprecated"
6651             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6652             #endif
6653             #include <libcmis/libcmis.hxx>
6654             #if !defined __clang__
6655             #pragma GCC diagnostic pop
6656             #endif
6657             #endif
6659             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6660                 std::sort(v.begin(), v.end(), fn);
6661             }
6662             ]])],[CXXFLAGS_CXX11=$flag])
6663         AC_LANG_POP([C++])
6664         CXXFLAGS=$save_CXXFLAGS
6665         if test -n "$CXXFLAGS_CXX11"; then
6666             break
6667         fi
6668     done
6670 if test -n "$CXXFLAGS_CXX11"; then
6671     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6672 else
6673     AC_MSG_ERROR(no)
6675 AC_SUBST(CXXFLAGS_CXX11)
6677 if test "$GCC" = "yes"; then
6678     save_CXXFLAGS=$CXXFLAGS
6679     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6680     CHECK_L_ATOMIC
6681     CXXFLAGS=$save_CXXFLAGS
6682     AC_SUBST(ATOMIC_LIB)
6685 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6686 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6687 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6688 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6689 dnl again towards 4.7.2:
6690 if test $CPP_LIBRARY = GLIBCXX; then
6691     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6692     AC_LANG_PUSH([C++])
6693     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6694 #include <list>
6695 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6696     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6697     //   GCC 4.7.0: 20120322
6698     //   GCC 4.7.1: 20120614
6699     // and using a range check is not possible as the mapping between
6700     // __GLIBCXX__ values and GCC versions is not monotonic
6701 /* ok */
6702 #else
6703 abi broken
6704 #endif
6705         ]])], [AC_MSG_RESULT(no, ok)],
6706         [AC_MSG_ERROR(yes)])
6707     AC_LANG_POP([C++])
6710 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6711 save_CXXFLAGS=$CXXFLAGS
6712 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6713 AC_LANG_PUSH([C++])
6715 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6716 #include <stddef.h>
6718 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6720 namespace
6722         struct b
6723         {
6724                 int i;
6725                 int j;
6726         };
6728 ]], [[
6729 struct a
6731         int i;
6732         int j;
6734 a thinga[]={{0,0}, {1,1}};
6735 b thingb[]={{0,0}, {1,1}};
6736 size_t i = sizeof(sal_n_array_size(thinga));
6737 size_t j = sizeof(sal_n_array_size(thingb));
6738 return !(i != 0 && j != 0);
6740     ], [ AC_MSG_RESULT(yes) ],
6741     [ AC_MSG_ERROR(no)])
6742 AC_LANG_POP([C++])
6743 CXXFLAGS=$save_CXXFLAGS
6745 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6746 if test "$GCC" = yes; then
6747     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6748     AC_LANG_PUSH([C++])
6749     save_CXXFLAGS=$CXXFLAGS
6750     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6751     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6752     CXXFLAGS=$save_CXXFLAGS
6753     AC_LANG_POP([C++])
6754     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6755         AC_MSG_RESULT([yes])
6756     else
6757         AC_MSG_RESULT([no])
6758     fi
6760 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6762 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6763 AC_LANG_PUSH([C++])
6764 save_CXXFLAGS=$CXXFLAGS
6765 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6766 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6767         #include <algorithm>
6768         #include <initializer_list>
6769         #include <vector>
6770         template<typename T> class S {
6771         private:
6772             std::vector<T> v_;
6773         public:
6774             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6775         };
6776         constinit S<int> s{3, 2, 1};
6777     ])], [
6778         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6779         AC_MSG_RESULT([yes])
6780     ], [AC_MSG_RESULT([no])])
6781 CXXFLAGS=$save_CXXFLAGS
6782 AC_LANG_POP([C++])
6784 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6785 AC_LANG_PUSH([C++])
6786 save_CXXFLAGS=$CXXFLAGS
6787 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6788 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6789         #include <span>
6790         #include <type_traits>
6791         // Don't check size_type directly, as it was called index_type before P1872R0:
6792         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6793     ])], [
6794         AC_DEFINE([HAVE_CPP_SPAN],[1])
6795         AC_MSG_RESULT([yes])
6796     ], [AC_MSG_RESULT([no])])
6797 CXXFLAGS=$save_CXXFLAGS
6798 AC_LANG_POP([C++])
6800 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
6801 AC_LANG_PUSH([C++])
6802 save_CXXFLAGS=$CXXFLAGS
6803 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6804 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6805         struct S1 { S1(S1 &&); };
6806         struct S2: S1 {};
6807         S1 f(S2 s) { return s; }
6808     ])], [
6809         AC_DEFINE([HAVE_P1155R3],[1])
6810         AC_MSG_RESULT([yes])
6811     ], [AC_MSG_RESULT([no])])
6812 CXXFLAGS=$save_CXXFLAGS
6813 AC_LANG_POP([C++])
6815 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
6816 dnl which is included in -Wextra anyway):
6817 HAVE_WDEPRECATED_COPY_DTOR=
6818 if test "$GCC" = yes; then
6819     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
6820     AC_LANG_PUSH([C++])
6821     save_CXXFLAGS=$CXXFLAGS
6822     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
6823     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
6824             HAVE_WDEPRECATED_COPY_DTOR=TRUE
6825             AC_MSG_RESULT([yes])
6826         ], [AC_MSG_RESULT([no])])
6827     CXXFLAGS=$save_CXXFLAGS
6828     AC_LANG_POP([C++])
6830 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
6832 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6833 dnl uninitialized warning for code like
6835 dnl   OString f();
6836 dnl   boost::optional<OString> * g(bool b) {
6837 dnl       boost::optional<OString> o;
6838 dnl       if (b) o = f();
6839 dnl       return new boost::optional<OString>(o);
6840 dnl   }
6842 dnl (as is e.g. present, in a slightly more elaborate form, in
6843 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6844 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6845 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6846 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6847     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6848     AC_LANG_PUSH([C++])
6849     save_CXXFLAGS=$CXXFLAGS
6850     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6851     if test "$ENABLE_OPTIMIZED" = TRUE; then
6852         CXXFLAGS="$CXXFLAGS -O2"
6853     else
6854         CXXFLAGS="$CXXFLAGS -O0"
6855     fi
6856     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6857             #include <new>
6858             void f1(int);
6859             struct S1 {
6860                 ~S1() { f1(n); }
6861                 int n = 0;
6862             };
6863             struct S2 {
6864                 S2() {}
6865                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6866                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6867                 void set(S1 s) {
6868                     new (stg) S1(s);
6869                     init = true;
6870                 }
6871                 bool init = false;
6872                 char stg[sizeof (S1)];
6873             } ;
6874             S1 f2();
6875             S2 * f3(bool b) {
6876                 S2 o;
6877                 if (b) o.set(f2());
6878                 return new S2(o);
6879             }
6880         ]])], [AC_MSG_RESULT([no])], [
6881             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6882             AC_MSG_RESULT([yes])
6883         ])
6884     CXXFLAGS=$save_CXXFLAGS
6885     AC_LANG_POP([C++])
6887 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6889 dnl ===================================================================
6890 dnl CPU Intrinsics support - SSE, AVX
6891 dnl ===================================================================
6893 CXXFLAGS_INTRINSICS_SSE2=
6894 CXXFLAGS_INTRINSICS_SSSE3=
6895 CXXFLAGS_INTRINSICS_SSE41=
6896 CXXFLAGS_INTRINSICS_SSE42=
6897 CXXFLAGS_INTRINSICS_AVX=
6898 CXXFLAGS_INTRINSICS_AVX2=
6899 CXXFLAGS_INTRINSICS_AVX512=
6900 CXXFLAGS_INTRINSICS_F16C=
6901 CXXFLAGS_INTRINSICS_FMA=
6903 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6904     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
6905     flag_sse2=-msse2
6906     flag_ssse3=-mssse3
6907     flag_sse41=-msse4.1
6908     flag_sse42=-msse4.2
6909     flag_avx=-mavx
6910     flag_avx2=-mavx2
6911     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
6912     flag_f16c=-mf16c
6913     flag_fma=-mfma
6914 else
6915     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
6916     # MSVC seems to differentiate only between SSE and SSE2, where in fact
6917     # SSE2 seems to be SSE2+.
6918     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
6919     # is not empty (and can be tested in gbuild).
6920     flag_sse2=-arch:SSE2
6921     flag_ssse3=-arch:SSE2
6922     flag_sse41=-arch:SSE2
6923     flag_sse42=-arch:SSE2
6924     flag_avx=-arch:AVX
6925     flag_avx2=-arch:AVX2
6926     flag_avx512=-arch:AVX512
6927     # These are part of -arch:AVX2
6928     flag_f16c=-arch:AVX2
6929     flag_fma=-arch:AVX2
6932 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6933 AC_LANG_PUSH([C++])
6934 save_CXXFLAGS=$CXXFLAGS
6935 CXXFLAGS="$CXXFLAGS $flag_sse2"
6936 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6937     #include <emmintrin.h>
6938     int main () {
6939         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6940         c = _mm_xor_si128 (a, b);
6941         return 0;
6942     }
6943     ])],
6944     [can_compile_sse2=yes],
6945     [can_compile_sse2=no])
6946 AC_LANG_POP([C++])
6947 CXXFLAGS=$save_CXXFLAGS
6948 AC_MSG_RESULT([${can_compile_sse2}])
6949 if test "${can_compile_sse2}" = "yes" ; then
6950     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
6953 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6954 AC_LANG_PUSH([C++])
6955 save_CXXFLAGS=$CXXFLAGS
6956 CXXFLAGS="$CXXFLAGS $flag_ssse3"
6957 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6958     #include <tmmintrin.h>
6959     int main () {
6960         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6961         c = _mm_maddubs_epi16 (a, b);
6962         return 0;
6963     }
6964     ])],
6965     [can_compile_ssse3=yes],
6966     [can_compile_ssse3=no])
6967 AC_LANG_POP([C++])
6968 CXXFLAGS=$save_CXXFLAGS
6969 AC_MSG_RESULT([${can_compile_ssse3}])
6970 if test "${can_compile_ssse3}" = "yes" ; then
6971     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
6974 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
6975 AC_LANG_PUSH([C++])
6976 save_CXXFLAGS=$CXXFLAGS
6977 CXXFLAGS="$CXXFLAGS $flag_sse41"
6978 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6979     #include <smmintrin.h>
6980     int main () {
6981         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6982         c = _mm_cmpeq_epi64 (a, b);
6983         return 0;
6984     }
6985     ])],
6986     [can_compile_sse41=yes],
6987     [can_compile_sse41=no])
6988 AC_LANG_POP([C++])
6989 CXXFLAGS=$save_CXXFLAGS
6990 AC_MSG_RESULT([${can_compile_sse41}])
6991 if test "${can_compile_sse41}" = "yes" ; then
6992     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
6995 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
6996 AC_LANG_PUSH([C++])
6997 save_CXXFLAGS=$CXXFLAGS
6998 CXXFLAGS="$CXXFLAGS $flag_sse42"
6999 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7000     #include <nmmintrin.h>
7001     int main () {
7002         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7003         c = _mm_cmpgt_epi64 (a, b);
7004         return 0;
7005     }
7006     ])],
7007     [can_compile_sse42=yes],
7008     [can_compile_sse42=no])
7009 AC_LANG_POP([C++])
7010 CXXFLAGS=$save_CXXFLAGS
7011 AC_MSG_RESULT([${can_compile_sse42}])
7012 if test "${can_compile_sse42}" = "yes" ; then
7013     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7016 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7017 AC_LANG_PUSH([C++])
7018 save_CXXFLAGS=$CXXFLAGS
7019 CXXFLAGS="$CXXFLAGS $flag_avx"
7020 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7021     #include <immintrin.h>
7022     int main () {
7023         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7024         c = _mm256_xor_ps(a, b);
7025         return 0;
7026     }
7027     ])],
7028     [can_compile_avx=yes],
7029     [can_compile_avx=no])
7030 AC_LANG_POP([C++])
7031 CXXFLAGS=$save_CXXFLAGS
7032 AC_MSG_RESULT([${can_compile_avx}])
7033 if test "${can_compile_avx}" = "yes" ; then
7034     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7037 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7038 AC_LANG_PUSH([C++])
7039 save_CXXFLAGS=$CXXFLAGS
7040 CXXFLAGS="$CXXFLAGS $flag_avx2"
7041 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7042     #include <immintrin.h>
7043     int main () {
7044         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7045         c = _mm256_maddubs_epi16(a, b);
7046         return 0;
7047     }
7048     ])],
7049     [can_compile_avx2=yes],
7050     [can_compile_avx2=no])
7051 AC_LANG_POP([C++])
7052 CXXFLAGS=$save_CXXFLAGS
7053 AC_MSG_RESULT([${can_compile_avx2}])
7054 if test "${can_compile_avx2}" = "yes" ; then
7055     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7058 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7059 AC_LANG_PUSH([C++])
7060 save_CXXFLAGS=$CXXFLAGS
7061 CXXFLAGS="$CXXFLAGS $flag_avx512"
7062 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7063     #include <immintrin.h>
7064     int main () {
7065         __m512i a = _mm512_loadu_si512(0);
7066         return 0;
7067     }
7068     ])],
7069     [can_compile_avx512=yes],
7070     [can_compile_avx512=no])
7071 AC_LANG_POP([C++])
7072 CXXFLAGS=$save_CXXFLAGS
7073 AC_MSG_RESULT([${can_compile_avx512}])
7074 if test "${can_compile_avx512}" = "yes" ; then
7075     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7078 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7079 AC_LANG_PUSH([C++])
7080 save_CXXFLAGS=$CXXFLAGS
7081 CXXFLAGS="$CXXFLAGS $flag_f16c"
7082 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7083     #include <immintrin.h>
7084     int main () {
7085         __m128i a = _mm_set1_epi32 (0);
7086         __m128 c;
7087         c = _mm_cvtph_ps(a);
7088         return 0;
7089     }
7090     ])],
7091     [can_compile_f16c=yes],
7092     [can_compile_f16c=no])
7093 AC_LANG_POP([C++])
7094 CXXFLAGS=$save_CXXFLAGS
7095 AC_MSG_RESULT([${can_compile_f16c}])
7096 if test "${can_compile_f16c}" = "yes" ; then
7097     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7100 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7101 AC_LANG_PUSH([C++])
7102 save_CXXFLAGS=$CXXFLAGS
7103 CXXFLAGS="$CXXFLAGS $flag_fma"
7104 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7105     #include <immintrin.h>
7106     int main () {
7107         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7108         d = _mm256_fmadd_ps(a, b, c);
7109         return 0;
7110     }
7111     ])],
7112     [can_compile_fma=yes],
7113     [can_compile_fma=no])
7114 AC_LANG_POP([C++])
7115 CXXFLAGS=$save_CXXFLAGS
7116 AC_MSG_RESULT([${can_compile_fma}])
7117 if test "${can_compile_fma}" = "yes" ; then
7118     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7121 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7122 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7123 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7124 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7125 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7126 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7127 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7128 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7129 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7131 dnl ===================================================================
7132 dnl system stl sanity tests
7133 dnl ===================================================================
7134 if test "$_os" != "WINNT"; then
7136     AC_LANG_PUSH([C++])
7138     save_CPPFLAGS="$CPPFLAGS"
7139     if test -n "$MACOSX_SDK_PATH"; then
7140         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7141     fi
7143     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7144     # only.
7145     if test "$CPP_LIBRARY" = GLIBCXX; then
7146         dnl gcc#19664, gcc#22482, rhbz#162935
7147         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7148         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7149         AC_MSG_RESULT([$stlvisok])
7150         if test "$stlvisok" = "no"; then
7151             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7152         fi
7153     fi
7155     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7156     # when we don't make any dynamic libraries?
7157     if test "$DISABLE_DYNLOADING" = ""; then
7158         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7159         cat > conftestlib1.cc <<_ACEOF
7160 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7161 struct S2: S1<int> { virtual ~S2(); };
7162 S2::~S2() {}
7163 _ACEOF
7164         cat > conftestlib2.cc <<_ACEOF
7165 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7166 struct S2: S1<int> { virtual ~S2(); };
7167 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7168 _ACEOF
7169         gccvisinlineshiddenok=yes
7170         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7171             gccvisinlineshiddenok=no
7172         else
7173             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7174             dnl known to not work with -z defs (unsetting which makes the test
7175             dnl moot, though):
7176             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7177             if test "$COM_IS_CLANG" = TRUE; then
7178                 for i in $CXX $CXXFLAGS; do
7179                     case $i in
7180                     -fsanitize=*)
7181                         my_linkflagsnoundefs=
7182                         break
7183                         ;;
7184                     esac
7185                 done
7186             fi
7187             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7188                 gccvisinlineshiddenok=no
7189             fi
7190         fi
7192         rm -fr libconftest*
7193         AC_MSG_RESULT([$gccvisinlineshiddenok])
7194         if test "$gccvisinlineshiddenok" = "no"; then
7195             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7196         fi
7197     fi
7199    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7200     cat >visibility.cxx <<_ACEOF
7201 #pragma GCC visibility push(hidden)
7202 struct __attribute__ ((visibility ("default"))) TestStruct {
7203   static void Init();
7205 __attribute__ ((visibility ("default"))) void TestFunc() {
7206   TestStruct::Init();
7208 _ACEOF
7209     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7210         gccvisbroken=yes
7211     else
7212         case "$host_cpu" in
7213         i?86|x86_64)
7214             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7215                 gccvisbroken=no
7216             else
7217                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7218                     gccvisbroken=no
7219                 else
7220                     gccvisbroken=yes
7221                 fi
7222             fi
7223             ;;
7224         *)
7225             gccvisbroken=no
7226             ;;
7227         esac
7228     fi
7229     rm -f visibility.s visibility.cxx
7231     AC_MSG_RESULT([$gccvisbroken])
7232     if test "$gccvisbroken" = "yes"; then
7233         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7234     fi
7236     CPPFLAGS="$save_CPPFLAGS"
7238     AC_LANG_POP([C++])
7241 dnl ===================================================================
7242 dnl  Clang++ tests
7243 dnl ===================================================================
7245 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7246 if test "$GCC" = "yes"; then
7247     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7248     AC_LANG_PUSH([C++])
7249     save_CXXFLAGS=$CXXFLAGS
7250     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7251     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7252     CXXFLAGS=$save_CXXFLAGS
7253     AC_LANG_POP([C++])
7254     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7255         AC_MSG_RESULT([yes])
7256     else
7257         AC_MSG_RESULT([no])
7258     fi
7260 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7262 dnl ===================================================================
7263 dnl Compiler plugins
7264 dnl ===================================================================
7266 COMPILER_PLUGINS=
7267 # currently only Clang
7269 if test "$COM_IS_CLANG" != "TRUE"; then
7270     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7271         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7272         enable_compiler_plugins=no
7273     fi
7276 COMPILER_PLUGINS_COM_IS_CLANG=
7277 if test "$COM_IS_CLANG" = "TRUE"; then
7278     if test -n "$enable_compiler_plugins"; then
7279         compiler_plugins="$enable_compiler_plugins"
7280     elif test -n "$ENABLE_DBGUTIL"; then
7281         compiler_plugins=test
7282     else
7283         compiler_plugins=no
7284     fi
7285     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7286         if test "$CLANGVER" -lt 50002; then
7287             if test "$compiler_plugins" = yes; then
7288                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7289             else
7290                 compiler_plugins=no
7291             fi
7292         fi
7293     fi
7294     if test "$compiler_plugins" != "no"; then
7295         dnl The prefix where Clang resides, override to where Clang resides if
7296         dnl using a source build:
7297         if test -z "$CLANGDIR"; then
7298             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | head -n 1)))))
7299         fi
7300         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7301         if test -z "$COMPILER_PLUGINS_CXX"; then
7302             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7303         fi
7304         clangbindir=$CLANGDIR/bin
7305         if test "$build_os" = "cygwin"; then
7306             clangbindir=$(cygpath -u "$clangbindir")
7307         fi
7308         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7309         if test -n "$LLVM_CONFIG"; then
7310             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7311             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7312             if test -z "$CLANGLIBDIR"; then
7313                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7314             fi
7315             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7316             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7317             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7318             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7319                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7320             fi
7321             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7322             clangobjdir=$($LLVM_CONFIG --obj-root)
7323             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7324                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7325             fi
7326         fi
7327         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7328         AC_LANG_PUSH([C++])
7329         save_CXX=$CXX
7330         save_CXXCPP=$CXXCPP
7331         save_CPPFLAGS=$CPPFLAGS
7332         save_CXXFLAGS=$CXXFLAGS
7333         save_LDFLAGS=$LDFLAGS
7334         save_LIBS=$LIBS
7335         CXX=$COMPILER_PLUGINS_CXX
7336         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7337         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7338         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7339         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7340             [COMPILER_PLUGINS=TRUE],
7341             [
7342             if test "$compiler_plugins" = "yes"; then
7343                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7344             else
7345                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7346                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7347             fi
7348             ])
7349         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7350         dnl comment in compilerplugins/Makefile-clang.mk:
7351         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7352             LDFLAGS=""
7353             AC_MSG_CHECKING([for clang libraries to use])
7354             if test -z "$CLANGTOOLLIBS"; then
7355                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7356  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7357                 AC_LINK_IFELSE([
7358                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7359                         [[ clang::FullSourceLoc().dump(); ]])
7360                 ],[CLANGTOOLLIBS="$LIBS"],[])
7361             fi
7362             if test -z "$CLANGTOOLLIBS"; then
7363                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7364                 AC_LINK_IFELSE([
7365                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7366                         [[ clang::FullSourceLoc().dump(); ]])
7367                 ],[CLANGTOOLLIBS="$LIBS"],[])
7368             fi
7369             AC_MSG_RESULT([$CLANGTOOLLIBS])
7370             if test -z "$CLANGTOOLLIBS"; then
7371                 if test "$compiler_plugins" = "yes"; then
7372                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7373                 else
7374                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7375                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7376                 fi
7377                 COMPILER_PLUGINS=
7378             fi
7379             if test -n "$COMPILER_PLUGINS"; then
7380                 if test -z "$CLANGSYSINCLUDE"; then
7381                     if test -n "$LLVM_CONFIG"; then
7382                         # Path to the clang system headers (no idea if there's a better way to get it).
7383                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7384                     fi
7385                 fi
7386             fi
7387         fi
7388         CXX=$save_CXX
7389         CXXCPP=$save_CXXCPP
7390         CPPFLAGS=$save_CPPFLAGS
7391         CXXFLAGS=$save_CXXFLAGS
7392         LDFLAGS=$save_LDFLAGS
7393         LIBS="$save_LIBS"
7394         AC_LANG_POP([C++])
7396         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7397         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7398             #ifndef __clang__
7399             you lose
7400             #endif
7401             int foo=42;
7402             ]])],
7403             [AC_MSG_RESULT([yes])
7404              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7405             [AC_MSG_RESULT([no])])
7406         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7407     fi
7408 else
7409     if test "$enable_compiler_plugins" = "yes"; then
7410         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7411     fi
7413 COMPILER_PLUGINS_ANALYZER_PCH=
7414 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7415     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7417 AC_SUBST(COMPILER_PLUGINS)
7418 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7419 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7420 AC_SUBST(COMPILER_PLUGINS_CXX)
7421 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7422 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7423 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7424 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7425 AC_SUBST(CLANGDIR)
7426 AC_SUBST(CLANGLIBDIR)
7427 AC_SUBST(CLANGTOOLLIBS)
7428 AC_SUBST(CLANGSYSINCLUDE)
7430 # Plugin to help linker.
7431 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7432 # This makes --enable-lto build with clang work.
7433 AC_SUBST(LD_PLUGIN)
7435 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7436 AC_SUBST(HAVE_POSIX_FALLOCATE)
7438 JITC_PROCESSOR_TYPE=""
7439 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7440     # IBMs JDK needs this...
7441     JITC_PROCESSOR_TYPE=6
7442     export JITC_PROCESSOR_TYPE
7444 AC_SUBST([JITC_PROCESSOR_TYPE])
7446 # Misc Windows Stuff
7447 AC_ARG_WITH(ucrt-dir,
7448     AS_HELP_STRING([--with-ucrt-dir],
7449         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7450         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7451         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7452             Windows6.1-KB2999226-x64.msu
7453             Windows6.1-KB2999226-x86.msu
7454             Windows8.1-KB2999226-x64.msu
7455             Windows8.1-KB2999226-x86.msu
7456             Windows8-RT-KB2999226-x64.msu
7457             Windows8-RT-KB2999226-x86.msu
7458         A zip archive including those files is available from Microsoft site:
7459         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7461 UCRT_REDISTDIR="$with_ucrt_dir"
7462 if test $_os = "WINNT"; then
7463     find_msvc_x64_dlls
7464     for i in $PKGFORMAT; do
7465         if test "$i" = msi; then
7466             find_msms
7467             break
7468         fi
7469     done
7470     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7471     MSVC_DLLS="$msvcdlls"
7472     MSM_PATH=`win_short_path_for_make "$msmdir"`
7473     # MSVC 15.3 changed it to VC141
7474     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
7475         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
7476     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7477         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7478     else
7479         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7480     fi
7482     if test "$UCRT_REDISTDIR" = "no"; then
7483         dnl explicitly disabled
7484         UCRT_REDISTDIR=""
7485     else
7486         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7487                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7488                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7489                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7490                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7491                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7492             UCRT_REDISTDIR=""
7493             if test -n "$PKGFORMAT"; then
7494                for i in $PKGFORMAT; do
7495                    case "$i" in
7496                    msi)
7497                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7498                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7499                        ;;
7500                    esac
7501                done
7502             fi
7503         fi
7504     fi
7507 AC_SUBST(UCRT_REDISTDIR)
7508 AC_SUBST(MSVC_DLL_PATH)
7509 AC_SUBST(MSVC_DLLS)
7510 AC_SUBST(MSM_PATH)
7512 dnl ===================================================================
7513 dnl Checks for Java
7514 dnl ===================================================================
7515 if test "$ENABLE_JAVA" != ""; then
7517     # Windows-specific tests
7518     if test "$build_os" = "cygwin"; then
7519         if test "$BITNESS_OVERRIDE" = 64; then
7520             bitness=64
7521         else
7522             bitness=32
7523         fi
7525         if test -z "$with_jdk_home"; then
7526             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7527             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7528             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7529             if test -n "$regvalue"; then
7530                 ver=$regvalue
7531                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7532                 _jdk_home=$regvalue
7533             fi
7535             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7536                 with_jdk_home="$_jdk_home"
7537                 howfound="found automatically"
7538             else
7539                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK >= 9])
7540             fi
7541         else
7542             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7543             howfound="you passed"
7544         fi
7545     fi
7547     # 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.
7548     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7549     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7550         with_jdk_home=`/usr/libexec/java_home`
7551     fi
7553     JAVA_HOME=; export JAVA_HOME
7554     if test -z "$with_jdk_home"; then
7555         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7556     else
7557         _java_path="$with_jdk_home/bin/$with_java"
7558         dnl Check if there is a Java interpreter at all.
7559         if test -x "$_java_path"; then
7560             JAVAINTERPRETER=$_java_path
7561         else
7562             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7563         fi
7564     fi
7566     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7567     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7568     dnl loaded by java to run JunitTests:
7569     if test "$build_os" = "cygwin"; then
7570         shortjdkhome=`cygpath -d "$with_jdk_home"`
7571         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
7572             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7573             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7574         elif test "$BITNESS_OVERRIDE" = "" -a -f "$_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7575             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7576             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7577         fi
7579         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7580             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7581         fi
7582         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7583     elif test "$cross_compiling" != "yes"; then
7584         case $CPUNAME in
7585             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7586                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7587                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7588                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7589                 fi
7590                 ;;
7591             *) # assumption: everything else 32-bit
7592                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7593                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7594                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7595                 fi
7596                 ;;
7597         esac
7598     fi
7601 dnl ===================================================================
7602 dnl Checks for JDK.
7603 dnl ===================================================================
7605 # Note that JAVA_HOME as for now always means the *build* platform's
7606 # JAVA_HOME. Whether all the complexity here actually is needed any
7607 # more or not, no idea.
7609 if test "$ENABLE_JAVA" != ""; then
7610     _gij_longver=0
7611     AC_MSG_CHECKING([the installed JDK])
7612     if test -n "$JAVAINTERPRETER"; then
7613         dnl java -version sends output to stderr!
7614         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7615             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7616         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7617             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7618         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7619             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7620         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7621             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7622         else
7623             JDK=sun
7625             dnl Sun JDK specific tests
7626             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7627             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7629             if test "$_jdk_ver" -lt 10900; then
7630                 AC_MSG_ERROR([JDK is too old, you need at least 9])
7631             fi
7632             if test "$_jdk_ver" -gt 10900; then
7633                 JAVA_CLASSPATH_NOT_SET=TRUE
7634             fi
7636             AC_MSG_RESULT([found (JDK $_jdk)])
7637             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7638             if test "$_os" = "WINNT"; then
7639                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7640             fi
7642             # set to limit VM usage for JunitTests
7643             JAVAIFLAGS=-Xmx64M
7644             # set to limit VM usage for javac
7645             JAVAFLAGS=-J-Xmx128M
7646         fi
7647     else
7648         AC_MSG_ERROR([Java not found. You need at least JDK 9])
7649     fi
7650 else
7651     dnl Java disabled
7652     JAVA_HOME=
7653     export JAVA_HOME
7656 dnl ===================================================================
7657 dnl Checks for javac
7658 dnl ===================================================================
7659 if test "$ENABLE_JAVA" != ""; then
7660     javacompiler="javac"
7661     : ${JAVA_SOURCE_VER=8}
7662     : ${JAVA_TARGET_VER=8}
7663     if test -z "$with_jdk_home"; then
7664         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7665     else
7666         _javac_path="$with_jdk_home/bin/$javacompiler"
7667         dnl Check if there is a Java compiler at all.
7668         if test -x "$_javac_path"; then
7669             JAVACOMPILER=$_javac_path
7670         fi
7671     fi
7672     if test -z "$JAVACOMPILER"; then
7673         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7674     fi
7675     if test "$build_os" = "cygwin"; then
7676         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7677             JAVACOMPILER="${JAVACOMPILER}.exe"
7678         fi
7679         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7680     fi
7683 dnl ===================================================================
7684 dnl Checks for javadoc
7685 dnl ===================================================================
7686 if test "$ENABLE_JAVA" != ""; then
7687     if test -z "$with_jdk_home"; then
7688         AC_PATH_PROG(JAVADOC, javadoc)
7689     else
7690         _javadoc_path="$with_jdk_home/bin/javadoc"
7691         dnl Check if there is a javadoc at all.
7692         if test -x "$_javadoc_path"; then
7693             JAVADOC=$_javadoc_path
7694         else
7695             AC_PATH_PROG(JAVADOC, javadoc)
7696         fi
7697     fi
7698     if test -z "$JAVADOC"; then
7699         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7700     fi
7701     if test "$build_os" = "cygwin"; then
7702         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7703             JAVADOC="${JAVADOC}.exe"
7704         fi
7705         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7706     fi
7708     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7709     JAVADOCISGJDOC="yes"
7710     fi
7712 AC_SUBST(JAVADOCISGJDOC)
7714 if test "$ENABLE_JAVA" != ""; then
7715     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7716     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7717         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7718            # try to recover first by looking whether we have an alternative
7719            # system as in Debian or newer SuSEs where following /usr/bin/javac
7720            # over /etc/alternatives/javac leads to the right bindir where we
7721            # just need to strip a bit away to get a valid JAVA_HOME
7722            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7723         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7724             # maybe only one level of symlink (e.g. on Mac)
7725             JAVA_HOME=$(readlink $JAVACOMPILER)
7726             if test "$(dirname $JAVA_HOME)" = "."; then
7727                 # we've got no path to trim back
7728                 JAVA_HOME=""
7729             fi
7730         else
7731             # else warn
7732             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7733             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7734             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7735             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7736         fi
7737         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7738         if test "$JAVA_HOME" != "/usr"; then
7739             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7740                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7741                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7742                 dnl Tiger already returns a JDK path...
7743                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7744             else
7745                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7746                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7747                 dnl that checks which version to run
7748                 if test -f "$JAVA_HOME"; then
7749                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7750                 fi
7751             fi
7752         fi
7753     fi
7754     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7756     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7757     if test -z "$JAVA_HOME"; then
7758         if test "x$with_jdk_home" = "x"; then
7759             cat > findhome.java <<_ACEOF
7760 [import java.io.File;
7762 class findhome
7764     public static void main(String args[])
7765     {
7766         String jrelocation = System.getProperty("java.home");
7767         File jre = new File(jrelocation);
7768         System.out.println(jre.getParent());
7769     }
7771 _ACEOF
7772             AC_MSG_CHECKING([if javac works])
7773             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7774             AC_TRY_EVAL(javac_cmd)
7775             if test $? = 0 -a -f ./findhome.class; then
7776                 AC_MSG_RESULT([javac works])
7777             else
7778                 echo "configure: javac test failed" >&5
7779                 cat findhome.java >&5
7780                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7781             fi
7782             AC_MSG_CHECKING([if gij knows its java.home])
7783             JAVA_HOME=`$JAVAINTERPRETER findhome`
7784             if test $? = 0 -a "$JAVA_HOME" != ""; then
7785                 AC_MSG_RESULT([$JAVA_HOME])
7786             else
7787                 echo "configure: java test failed" >&5
7788                 cat findhome.java >&5
7789                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7790             fi
7791             # clean-up after ourselves
7792             rm -f ./findhome.java ./findhome.class
7793         else
7794             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7795         fi
7796     fi
7798     # now check if $JAVA_HOME is really valid
7799     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7800         case "${JAVA_HOME}" in
7801             /Library/Java/JavaVirtualMachines/*)
7802                 ;;
7803             *)
7804                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7805                 ;;
7806         esac
7807         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7808             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7809             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7810             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7811             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7812             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7813             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7814         fi
7815     fi
7816     PathFormat "$JAVA_HOME"
7817     JAVA_HOME="$formatted_path"
7820 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7821     "$_os" != Darwin
7822 then
7823     AC_MSG_CHECKING([for JAWT lib])
7824     if test "$_os" = WINNT; then
7825         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7826         JAWTLIB=jawt.lib
7827     else
7828         case "$host_cpu" in
7829         arm*)
7830             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7831             JAVA_ARCH=$my_java_arch
7832             ;;
7833         i*86)
7834             my_java_arch=i386
7835             ;;
7836         m68k)
7837             my_java_arch=m68k
7838             ;;
7839         powerpc)
7840             my_java_arch=ppc
7841             ;;
7842         powerpc64)
7843             my_java_arch=ppc64
7844             ;;
7845         powerpc64le)
7846             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7847             JAVA_ARCH=$my_java_arch
7848             ;;
7849         sparc64)
7850             my_java_arch=sparcv9
7851             ;;
7852         x86_64)
7853             my_java_arch=amd64
7854             ;;
7855         *)
7856             my_java_arch=$host_cpu
7857             ;;
7858         esac
7859         # This is where JDK9 puts the library
7860         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7861             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7862         else
7863             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7864         fi
7865         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7866     fi
7867     AC_MSG_RESULT([$JAWTLIB])
7869 AC_SUBST(JAWTLIB)
7871 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7872     case "$host_os" in
7874     aix*)
7875         JAVAINC="-I$JAVA_HOME/include"
7876         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7877         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7878         ;;
7880     cygwin*)
7881         JAVAINC="-I$JAVA_HOME/include/win32"
7882         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7883         ;;
7885     darwin*)
7886         if test -d "$JAVA_HOME/include/darwin"; then
7887             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7888         else
7889             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7890         fi
7891         ;;
7893     dragonfly*)
7894         JAVAINC="-I$JAVA_HOME/include"
7895         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7896         ;;
7898     freebsd*)
7899         JAVAINC="-I$JAVA_HOME/include"
7900         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7901         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7902         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7903         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7904         ;;
7906     k*bsd*-gnu*)
7907         JAVAINC="-I$JAVA_HOME/include"
7908         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7909         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7910         ;;
7912     linux-gnu*)
7913         JAVAINC="-I$JAVA_HOME/include"
7914         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7915         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7916         ;;
7918     *netbsd*)
7919         JAVAINC="-I$JAVA_HOME/include"
7920         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7921         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7922        ;;
7924     openbsd*)
7925         JAVAINC="-I$JAVA_HOME/include"
7926         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7927         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7928         ;;
7930     solaris*)
7931         JAVAINC="-I$JAVA_HOME/include"
7932         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7933         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7934         ;;
7935     esac
7937 SOLARINC="$SOLARINC $JAVAINC"
7939 AC_SUBST(JAVACOMPILER)
7940 AC_SUBST(JAVADOC)
7941 AC_SUBST(JAVAINTERPRETER)
7942 AC_SUBST(JAVAIFLAGS)
7943 AC_SUBST(JAVAFLAGS)
7944 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7945 AC_SUBST(JAVA_HOME)
7946 AC_SUBST(JAVA_SOURCE_VER)
7947 AC_SUBST(JAVA_TARGET_VER)
7948 AC_SUBST(JDK)
7951 dnl ===================================================================
7952 dnl Export file validation
7953 dnl ===================================================================
7954 AC_MSG_CHECKING([whether to enable export file validation])
7955 if test "$with_export_validation" != "no"; then
7956     if test -z "$ENABLE_JAVA"; then
7957         if test "$with_export_validation" = "yes"; then
7958             AC_MSG_ERROR([requested, but Java is disabled])
7959         else
7960             AC_MSG_RESULT([no, as Java is disabled])
7961         fi
7962     elif ! test -d "${SRC_ROOT}/schema"; then
7963         if test "$with_export_validation" = "yes"; then
7964             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7965         else
7966             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7967         fi
7968     else
7969         AC_MSG_RESULT([yes])
7970         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7972         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7973         if test -z "$ODFVALIDATOR"; then
7974             # remember to download the ODF toolkit with validator later
7975             AC_MSG_NOTICE([no odfvalidator found, will download it])
7976             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7977             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7979             # and fetch name of odfvalidator jar name from download.lst
7980             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7981             AC_SUBST(ODFVALIDATOR_JAR)
7983             if test -z "$ODFVALIDATOR_JAR"; then
7984                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7985             fi
7986         fi
7987         if test "$build_os" = "cygwin"; then
7988             # In case of Cygwin it will be executed from Windows,
7989             # so we need to run bash and absolute path to validator
7990             # so instead of "odfvalidator" it will be
7991             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7992             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7993         else
7994             ODFVALIDATOR="sh $ODFVALIDATOR"
7995         fi
7996         AC_SUBST(ODFVALIDATOR)
7999         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8000         if test -z "$OFFICEOTRON"; then
8001             # remember to download the officeotron with validator later
8002             AC_MSG_NOTICE([no officeotron found, will download it])
8003             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8004             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8006             # and fetch name of officeotron jar name from download.lst
8007             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8008             AC_SUBST(OFFICEOTRON_JAR)
8010             if test -z "$OFFICEOTRON_JAR"; then
8011                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8012             fi
8013         else
8014             # check version of existing officeotron
8015             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8016             if test 0"$OFFICEOTRON_VER" -lt 704; then
8017                 AC_MSG_ERROR([officeotron too old])
8018             fi
8019         fi
8020         if test "$build_os" = "cygwin"; then
8021             # In case of Cygwin it will be executed from Windows,
8022             # so we need to run bash and absolute path to validator
8023             # so instead of "odfvalidator" it will be
8024             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8025             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8026         else
8027             OFFICEOTRON="sh $OFFICEOTRON"
8028         fi
8029     fi
8030     AC_SUBST(OFFICEOTRON)
8031 else
8032     AC_MSG_RESULT([no])
8035 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8036 if test "$with_bffvalidator" != "no"; then
8037     AC_DEFINE(HAVE_BFFVALIDATOR)
8039     if test "$with_export_validation" = "no"; then
8040         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8041     fi
8043     if test "$with_bffvalidator" = "yes"; then
8044         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8045     else
8046         BFFVALIDATOR="$with_bffvalidator"
8047     fi
8049     if test "$build_os" = "cygwin"; then
8050         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8051             AC_MSG_RESULT($BFFVALIDATOR)
8052         else
8053             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8054         fi
8055     elif test -n "$BFFVALIDATOR"; then
8056         # We are not in Cygwin but need to run Windows binary with wine
8057         AC_PATH_PROGS(WINE, wine)
8059         # so swap in a shell wrapper that converts paths transparently
8060         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8061         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8062         AC_SUBST(BFFVALIDATOR_EXE)
8063         AC_MSG_RESULT($BFFVALIDATOR)
8064     else
8065         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8066     fi
8067     AC_SUBST(BFFVALIDATOR)
8068 else
8069     AC_MSG_RESULT([no])
8072 dnl ===================================================================
8073 dnl Check for C preprocessor to use
8074 dnl ===================================================================
8075 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8076 if test -n "$with_idlc_cpp"; then
8077     AC_MSG_RESULT([$with_idlc_cpp])
8078     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8079 else
8080     AC_MSG_RESULT([ucpp])
8081     AC_MSG_CHECKING([which ucpp tp use])
8082     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8083         AC_MSG_RESULT([external])
8084         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8085     else
8086         AC_MSG_RESULT([internal])
8087         BUILD_TYPE="$BUILD_TYPE UCPP"
8088     fi
8090 AC_SUBST(SYSTEM_UCPP)
8092 dnl ===================================================================
8093 dnl Check for epm (not needed for Windows)
8094 dnl ===================================================================
8095 AC_MSG_CHECKING([whether to enable EPM for packing])
8096 if test "$enable_epm" = "yes"; then
8097     AC_MSG_RESULT([yes])
8098     if test "$_os" != "WINNT"; then
8099         if test $_os = Darwin; then
8100             EPM=internal
8101         elif test -n "$with_epm"; then
8102             EPM=$with_epm
8103         else
8104             AC_PATH_PROG(EPM, epm, no)
8105         fi
8106         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8107             AC_MSG_NOTICE([EPM will be built.])
8108             BUILD_TYPE="$BUILD_TYPE EPM"
8109             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8110         else
8111             # Gentoo has some epm which is something different...
8112             AC_MSG_CHECKING([whether the found epm is the right epm])
8113             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8114                 AC_MSG_RESULT([yes])
8115             else
8116                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8117             fi
8118             AC_MSG_CHECKING([epm version])
8119             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8120             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8121                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8122                 AC_MSG_RESULT([OK, >= 3.7])
8123             else
8124                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8125                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8126             fi
8127         fi
8128     fi
8130     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8131         AC_MSG_CHECKING([for rpm])
8132         for a in "$RPM" rpmbuild rpm; do
8133             $a --usage >/dev/null 2> /dev/null
8134             if test $? -eq 0; then
8135                 RPM=$a
8136                 break
8137             else
8138                 $a --version >/dev/null 2> /dev/null
8139                 if test $? -eq 0; then
8140                     RPM=$a
8141                     break
8142                 fi
8143             fi
8144         done
8145         if test -z "$RPM"; then
8146             AC_MSG_ERROR([not found])
8147         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8148             RPM_PATH=`which $RPM`
8149             AC_MSG_RESULT([$RPM_PATH])
8150             SCPDEFS="$SCPDEFS -DWITH_RPM"
8151         else
8152             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8153         fi
8154     fi
8155     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8156         AC_PATH_PROG(DPKG, dpkg, no)
8157         if test "$DPKG" = "no"; then
8158             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8159         fi
8160     fi
8161     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8162        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8163         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8164             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8165                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8166                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8167                     AC_MSG_RESULT([yes])
8168                 else
8169                     AC_MSG_RESULT([no])
8170                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8171                         _pt="rpm"
8172                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8173                         add_warning "the rpms will need to be installed with --nodeps"
8174                     else
8175                         _pt="pkg"
8176                     fi
8177                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8178                     add_warning "the ${_pt}s will not be relocatable"
8179                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8180                                  relocation will work, you need to patch your epm with the
8181                                  patch in epm/epm-3.7.patch or build with
8182                                  --with-epm=internal which will build a suitable epm])
8183                 fi
8184             fi
8185         fi
8186     fi
8187     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8188         AC_PATH_PROG(PKGMK, pkgmk, no)
8189         if test "$PKGMK" = "no"; then
8190             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8191         fi
8192     fi
8193     AC_SUBST(RPM)
8194     AC_SUBST(DPKG)
8195     AC_SUBST(PKGMK)
8196 else
8197     for i in $PKGFORMAT; do
8198         case "$i" in
8199         aix | bsd | deb | pkg | rpm | native | portable)
8200             AC_MSG_ERROR(
8201                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8202             ;;
8203         esac
8204     done
8205     AC_MSG_RESULT([no])
8206     EPM=NO
8208 AC_SUBST(EPM)
8210 ENABLE_LWP=
8211 if test "$enable_lotuswordpro" = "yes"; then
8212     ENABLE_LWP="TRUE"
8214 AC_SUBST(ENABLE_LWP)
8216 dnl ===================================================================
8217 dnl Check for building ODK
8218 dnl ===================================================================
8219 if test "$enable_odk" = no; then
8220     unset DOXYGEN
8221 else
8222     if test "$with_doxygen" = no; then
8223         AC_MSG_CHECKING([for doxygen])
8224         unset DOXYGEN
8225         AC_MSG_RESULT([no])
8226     else
8227         if test "$with_doxygen" = yes; then
8228             AC_PATH_PROG([DOXYGEN], [doxygen])
8229             if test -z "$DOXYGEN"; then
8230                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8231             fi
8232             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8233                 if ! dot -V 2>/dev/null; then
8234                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8235                 fi
8236             fi
8237         else
8238             AC_MSG_CHECKING([for doxygen])
8239             DOXYGEN=$with_doxygen
8240             AC_MSG_RESULT([$DOXYGEN])
8241         fi
8242         if test -n "$DOXYGEN"; then
8243             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8244             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8245             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8246                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8247             fi
8248         fi
8249     fi
8251 AC_SUBST([DOXYGEN])
8253 AC_MSG_CHECKING([whether to build the ODK])
8254 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8255     AC_MSG_RESULT([yes])
8257     if test "$with_java" != "no"; then
8258         AC_MSG_CHECKING([whether to build unowinreg.dll])
8259         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8260             # build on Win by default
8261             enable_build_unowinreg=yes
8262         fi
8263         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8264             AC_MSG_RESULT([no])
8265             BUILD_UNOWINREG=
8266         else
8267             AC_MSG_RESULT([yes])
8268             BUILD_UNOWINREG=TRUE
8269         fi
8270         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8271             if test -z "$with_mingw_cross_compiler"; then
8272                 dnl Guess...
8273                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8274             elif test -x "$with_mingw_cross_compiler"; then
8275                  MINGWCXX="$with_mingw_cross_compiler"
8276             else
8277                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8278             fi
8280             if test "$MINGWCXX" = "false"; then
8281                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8282             fi
8284             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8285             if test -x "$mingwstrip_test"; then
8286                 MINGWSTRIP="$mingwstrip_test"
8287             else
8288                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8289             fi
8291             if test "$MINGWSTRIP" = "false"; then
8292                 AC_MSG_ERROR(MinGW32 binutils not found.)
8293             fi
8294         fi
8295     fi
8296     BUILD_TYPE="$BUILD_TYPE ODK"
8297 else
8298     AC_MSG_RESULT([no])
8299     BUILD_UNOWINREG=
8301 AC_SUBST(BUILD_UNOWINREG)
8302 AC_SUBST(MINGWCXX)
8303 AC_SUBST(MINGWSTRIP)
8305 dnl ===================================================================
8306 dnl Check for system zlib
8307 dnl ===================================================================
8308 if test "$with_system_zlib" = "auto"; then
8309     case "$_os" in
8310     WINNT)
8311         with_system_zlib="$with_system_libs"
8312         ;;
8313     *)
8314         if test "$enable_fuzzers" != "yes"; then
8315             with_system_zlib=yes
8316         else
8317             with_system_zlib=no
8318         fi
8319         ;;
8320     esac
8323 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8324 dnl and has no pkg-config for it at least on some tinderboxes,
8325 dnl so leaving that out for now
8326 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8327 AC_MSG_CHECKING([which zlib to use])
8328 if test "$with_system_zlib" = "yes"; then
8329     AC_MSG_RESULT([external])
8330     SYSTEM_ZLIB=TRUE
8331     AC_CHECK_HEADER(zlib.h, [],
8332         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8333     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8334         [AC_MSG_ERROR(zlib not found or functional)], [])
8335 else
8336     AC_MSG_RESULT([internal])
8337     SYSTEM_ZLIB=
8338     BUILD_TYPE="$BUILD_TYPE ZLIB"
8339     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8340     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8342 AC_SUBST(ZLIB_CFLAGS)
8343 AC_SUBST(ZLIB_LIBS)
8344 AC_SUBST(SYSTEM_ZLIB)
8346 dnl ===================================================================
8347 dnl Check for system jpeg
8348 dnl ===================================================================
8349 AC_MSG_CHECKING([which libjpeg to use])
8350 if test "$with_system_jpeg" = "yes"; then
8351     AC_MSG_RESULT([external])
8352     SYSTEM_LIBJPEG=TRUE
8353     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8354         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8355     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8356         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8357 else
8358     SYSTEM_LIBJPEG=
8359     AC_MSG_RESULT([internal, libjpeg-turbo])
8360     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8361     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8362     if test "$COM" = "MSC"; then
8363         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8364     else
8365         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8366     fi
8368     case "$host_cpu" in
8369     x86_64 | amd64 | i*86 | x86 | ia32)
8370         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8371         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8372             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8373                 NASM="$LODE_HOME/opt/bin/nasm"
8374             elif test -x "/opt/lo/bin/nasm"; then
8375                 NASM="/opt/lo/bin/nasm"
8376             fi
8377         fi
8379         if test -n "$NASM"; then
8380             AC_MSG_CHECKING([for object file format of host system])
8381             case "$host_os" in
8382               cygwin* | mingw* | pw32* | interix*)
8383                 case "$host_cpu" in
8384                   x86_64)
8385                     objfmt='Win64-COFF'
8386                     ;;
8387                   *)
8388                     objfmt='Win32-COFF'
8389                     ;;
8390                 esac
8391               ;;
8392               msdosdjgpp* | go32*)
8393                 objfmt='COFF'
8394               ;;
8395               os2-emx*) # not tested
8396                 objfmt='MSOMF' # obj
8397               ;;
8398               linux*coff* | linux*oldld*)
8399                 objfmt='COFF' # ???
8400               ;;
8401               linux*aout*)
8402                 objfmt='a.out'
8403               ;;
8404               linux*)
8405                 case "$host_cpu" in
8406                   x86_64)
8407                     objfmt='ELF64'
8408                     ;;
8409                   *)
8410                     objfmt='ELF'
8411                     ;;
8412                 esac
8413               ;;
8414               kfreebsd* | freebsd* | netbsd* | openbsd*)
8415                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8416                   objfmt='BSD-a.out'
8417                 else
8418                   case "$host_cpu" in
8419                     x86_64 | amd64)
8420                       objfmt='ELF64'
8421                       ;;
8422                     *)
8423                       objfmt='ELF'
8424                       ;;
8425                   esac
8426                 fi
8427               ;;
8428               solaris* | sunos* | sysv* | sco*)
8429                 case "$host_cpu" in
8430                   x86_64)
8431                     objfmt='ELF64'
8432                     ;;
8433                   *)
8434                     objfmt='ELF'
8435                     ;;
8436                 esac
8437               ;;
8438               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8439                 case "$host_cpu" in
8440                   x86_64)
8441                     objfmt='Mach-O64'
8442                     ;;
8443                   *)
8444                     objfmt='Mach-O'
8445                     ;;
8446                 esac
8447               ;;
8448               *)
8449                 objfmt='ELF ?'
8450               ;;
8451             esac
8453             AC_MSG_RESULT([$objfmt])
8454             if test "$objfmt" = 'ELF ?'; then
8455               objfmt='ELF'
8456               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8457             fi
8459             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8460             case "$objfmt" in
8461               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8462               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8463               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8464               COFF)       NAFLAGS='-fcoff -DCOFF';;
8465               a.out)      NAFLAGS='-faout -DAOUT';;
8466               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8467               ELF)        NAFLAGS='-felf -DELF';;
8468               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8469               RDF)        NAFLAGS='-frdf -DRDF';;
8470               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8471               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8472             esac
8473             AC_MSG_RESULT([$NAFLAGS])
8475             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8476             cat > conftest.asm << EOF
8477             [%line __oline__ "configure"
8478                     section .text
8479                     global  _main,main
8480             _main:
8481             main:   xor     eax,eax
8482                     ret
8483             ]
8485             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8486             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8487               AC_MSG_RESULT(yes)
8488             else
8489               echo "configure: failed program was:" >&AC_FD_CC
8490               cat conftest.asm >&AC_FD_CC
8491               rm -rf conftest*
8492               AC_MSG_RESULT(no)
8493               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8494               NASM=""
8495             fi
8497         fi
8499         if test -z "$NASM"; then
8500 cat << _EOS
8501 ****************************************************************************
8502 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8503 To get one please:
8505 _EOS
8506             if test "$build_os" = "cygwin"; then
8507 cat << _EOS
8508 install a pre-compiled binary for Win32
8510 mkdir -p /opt/lo/bin
8511 cd /opt/lo/bin
8512 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8513 chmod +x nasm
8515 or get and install one from http://www.nasm.us/
8517 Then re-run autogen.sh
8519 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8520 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8522 _EOS
8523             else
8524 cat << _EOS
8525 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8527 _EOS
8528             fi
8529             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8530             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8531         fi
8532       ;;
8533     esac
8536 AC_SUBST(NASM)
8537 AC_SUBST(LIBJPEG_CFLAGS)
8538 AC_SUBST(LIBJPEG_LIBS)
8539 AC_SUBST(SYSTEM_LIBJPEG)
8541 dnl ===================================================================
8542 dnl Check for system clucene
8543 dnl ===================================================================
8544 dnl we should rather be using
8545 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8546 dnl but the contribs-lib check seems tricky
8547 AC_MSG_CHECKING([which clucene to use])
8548 if test "$with_system_clucene" = "yes"; then
8549     AC_MSG_RESULT([external])
8550     SYSTEM_CLUCENE=TRUE
8551     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8552     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8553     FilterLibs "${CLUCENE_LIBS}"
8554     CLUCENE_LIBS="${filteredlibs}"
8555     AC_LANG_PUSH([C++])
8556     save_CXXFLAGS=$CXXFLAGS
8557     save_CPPFLAGS=$CPPFLAGS
8558     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8559     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8560     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8561     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8562     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8563                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8564     CXXFLAGS=$save_CXXFLAGS
8565     CPPFLAGS=$save_CPPFLAGS
8566     AC_LANG_POP([C++])
8568     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8569 else
8570     AC_MSG_RESULT([internal])
8571     SYSTEM_CLUCENE=
8572     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8574 AC_SUBST(SYSTEM_CLUCENE)
8575 AC_SUBST(CLUCENE_CFLAGS)
8576 AC_SUBST(CLUCENE_LIBS)
8578 dnl ===================================================================
8579 dnl Check for system expat
8580 dnl ===================================================================
8581 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8583 dnl ===================================================================
8584 dnl Check for system xmlsec
8585 dnl ===================================================================
8586 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8588 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8589 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8590     ENABLE_EOT="TRUE"
8591     AC_DEFINE([ENABLE_EOT])
8592     AC_MSG_RESULT([yes])
8594     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8595 else
8596     ENABLE_EOT=
8597     AC_MSG_RESULT([no])
8599 AC_SUBST([ENABLE_EOT])
8601 dnl ===================================================================
8602 dnl Check for DLP libs
8603 dnl ===================================================================
8604 AS_IF([test "$COM" = "MSC"],
8605       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8606       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8608 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8610 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8612 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8614 AS_IF([test "$COM" = "MSC"],
8615       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8616       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8618 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8620 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8622 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8623 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.11])
8625 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8627 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8629 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8631 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8632 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.16])
8634 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8635 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8637 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8639 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8640 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8642 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8644 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8646 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8648 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8650 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8651 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
8653 dnl ===================================================================
8654 dnl Check for system lcms2
8655 dnl ===================================================================
8656 if test "$with_system_lcms2" != "yes"; then
8657     SYSTEM_LCMS2=
8659 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8660 if test "$GCC" = "yes"; then
8661     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8663 if test "$COM" = "MSC"; then # override the above
8664     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8667 dnl ===================================================================
8668 dnl Check for system cppunit
8669 dnl ===================================================================
8670 if test "$_os" != "Android" ; then
8671     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8674 dnl ===================================================================
8675 dnl Check whether freetype is available
8676 dnl ===================================================================
8677 if test  "$test_freetype" = "yes"; then
8678     AC_MSG_CHECKING([whether freetype is available])
8679     # FreeType has 3 different kinds of versions
8680     # * release, like 2.4.10
8681     # * libtool, like 13.0.7 (this what pkg-config returns)
8682     # * soname
8683     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8684     #
8685     # 9.9.3 is 2.2.0
8686     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8687     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8688     FilterLibs "${FREETYPE_LIBS}"
8689     FREETYPE_LIBS="${filteredlibs}"
8690     SYSTEM_FREETYPE=TRUE
8691 else
8692     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8693     if test "x$ac_config_site_64bit_host" = xYES; then
8694         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8695     else
8696         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8697     fi
8699 AC_SUBST(FREETYPE_CFLAGS)
8700 AC_SUBST(FREETYPE_LIBS)
8701 AC_SUBST([SYSTEM_FREETYPE])
8703 # ===================================================================
8704 # Check for system libxslt
8705 # to prevent incompatibilities between internal libxml2 and external libxslt,
8706 # or vice versa, use with_system_libxml here
8707 # ===================================================================
8708 if test "$with_system_libxml" = "auto"; then
8709     case "$_os" in
8710     WINNT|iOS|Android)
8711         with_system_libxml="$with_system_libs"
8712         ;;
8713     *)
8714         if test "$enable_fuzzers" != "yes"; then
8715             with_system_libxml=yes
8716         else
8717             with_system_libxml=no
8718         fi
8719         ;;
8720     esac
8723 AC_MSG_CHECKING([which libxslt to use])
8724 if test "$with_system_libxml" = "yes"; then
8725     AC_MSG_RESULT([external])
8726     SYSTEM_LIBXSLT=TRUE
8727     if test "$_os" = "Darwin"; then
8728         dnl make sure to use SDK path
8729         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8730         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8731         dnl omit -L/usr/lib
8732         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8733         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8734     else
8735         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8736         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8737         FilterLibs "${LIBXSLT_LIBS}"
8738         LIBXSLT_LIBS="${filteredlibs}"
8739         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8740         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8741         FilterLibs "${LIBEXSLT_LIBS}"
8742         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8743     fi
8745     dnl Check for xsltproc
8746     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8747     if test "$XSLTPROC" = "no"; then
8748         AC_MSG_ERROR([xsltproc is required])
8749     fi
8750 else
8751     AC_MSG_RESULT([internal])
8752     SYSTEM_LIBXSLT=
8753     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8755     if test "$cross_compiling" = "yes"; then
8756         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8757         if test "$XSLTPROC" = "no"; then
8758             AC_MSG_ERROR([xsltproc is required])
8759         fi
8760     fi
8762 AC_SUBST(SYSTEM_LIBXSLT)
8763 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8764     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8766 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8768 AC_SUBST(LIBEXSLT_CFLAGS)
8769 AC_SUBST(LIBEXSLT_LIBS)
8770 AC_SUBST(LIBXSLT_CFLAGS)
8771 AC_SUBST(LIBXSLT_LIBS)
8772 AC_SUBST(XSLTPROC)
8774 # ===================================================================
8775 # Check for system libxml
8776 # ===================================================================
8777 AC_MSG_CHECKING([which libxml to use])
8778 if test "$with_system_libxml" = "yes"; then
8779     AC_MSG_RESULT([external])
8780     SYSTEM_LIBXML=TRUE
8781     if test "$_os" = "Darwin"; then
8782         dnl make sure to use SDK path
8783         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8784         dnl omit -L/usr/lib
8785         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8786     elif test $_os = iOS; then
8787         dnl make sure to use SDK path
8788         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8789         LIBXML_CFLAGS="-I$usr/include/libxml2"
8790         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8791     else
8792         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8793         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8794         FilterLibs "${LIBXML_LIBS}"
8795         LIBXML_LIBS="${filteredlibs}"
8796     fi
8798     dnl Check for xmllint
8799     AC_PATH_PROG(XMLLINT, xmllint, no)
8800     if test "$XMLLINT" = "no"; then
8801         AC_MSG_ERROR([xmllint is required])
8802     fi
8803 else
8804     AC_MSG_RESULT([internal])
8805     SYSTEM_LIBXML=
8806     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8807     if test "$COM" = "MSC"; then
8808         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8809     fi
8810     if test "$COM" = "MSC"; then
8811         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8812     else
8813         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8814     fi
8815     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8817 AC_SUBST(SYSTEM_LIBXML)
8818 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8819     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8821 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8822 AC_SUBST(LIBXML_CFLAGS)
8823 AC_SUBST(LIBXML_LIBS)
8824 AC_SUBST(XMLLINT)
8826 # =====================================================================
8827 # Checking for a Python interpreter with version >= 3.3.
8828 # Optionally user can pass an option to configure, i. e.
8829 # ./configure PYTHON=/usr/bin/python
8830 # =====================================================================
8831 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
8832     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
8833     enable_python=internal
8835 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8836     if test -n "$PYTHON"; then
8837         PYTHON_FOR_BUILD=$PYTHON
8838     else
8839         # This allows a lack of system python with no error, we use internal one in that case.
8840         AM_PATH_PYTHON([3.3],, [:])
8841         # Clean PYTHON_VERSION checked below if cross-compiling
8842         PYTHON_VERSION=""
8843         if test "$PYTHON" != ":"; then
8844             PYTHON_FOR_BUILD=$PYTHON
8845         fi
8846     fi
8848 AC_SUBST(PYTHON_FOR_BUILD)
8850 # Checks for Python to use for Pyuno
8851 AC_MSG_CHECKING([which Python to use for Pyuno])
8852 case "$enable_python" in
8853 no|disable)
8854     if test -z $PYTHON_FOR_BUILD; then
8855         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8856         # requirement from the choice whether to include Python stuff in the installer, but why
8857         # bother?
8858         AC_MSG_ERROR([Python is required at build time.])
8859     fi
8860     enable_python=no
8861     AC_MSG_RESULT([none])
8862     ;;
8863 ""|yes|auto)
8864     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8865         AC_MSG_RESULT([no, overridden by --disable-scripting])
8866         enable_python=no
8867     elif test $build_os = cygwin; then
8868         dnl When building on Windows we don't attempt to use any installed
8869         dnl "system"  Python.
8870         AC_MSG_RESULT([fully internal])
8871         enable_python=internal
8872     elif test "$cross_compiling" = yes; then
8873         AC_MSG_RESULT([system])
8874         enable_python=system
8875     else
8876         # Unset variables set by the above AM_PATH_PYTHON so that
8877         # we actually do check anew.
8878         AC_MSG_RESULT([])
8879         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
8880         AM_PATH_PYTHON([3.3],, [:])
8881         AC_MSG_CHECKING([which Python to use for Pyuno])
8882         if test "$PYTHON" = ":"; then
8883             if test -z "$PYTHON_FOR_BUILD"; then
8884                 AC_MSG_RESULT([fully internal])
8885             else
8886                 AC_MSG_RESULT([internal])
8887             fi
8888             enable_python=internal
8889         else
8890             AC_MSG_RESULT([system])
8891             enable_python=system
8892         fi
8893     fi
8894     ;;
8895 internal)
8896     AC_MSG_RESULT([internal])
8897     ;;
8898 fully-internal)
8899     AC_MSG_RESULT([fully internal])
8900     enable_python=internal
8901     ;;
8902 system)
8903     AC_MSG_RESULT([system])
8904     if test "$_os" = Darwin; then
8905         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
8906     fi
8907     ;;
8909     AC_MSG_ERROR([Incorrect --enable-python option])
8910     ;;
8911 esac
8913 if test $enable_python != no; then
8914     BUILD_TYPE="$BUILD_TYPE PYUNO"
8917 if test $enable_python = system; then
8918     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8919         # Fallback: Accept these in the environment, or as set above
8920         # for MacOSX.
8921         :
8922     elif test "$cross_compiling" != yes; then
8923         # Unset variables set by the above AM_PATH_PYTHON so that
8924         # we actually do check anew.
8925         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
8926         # This causes an error if no python command is found
8927         AM_PATH_PYTHON([3.3])
8928         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8929         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8930         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8931         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8932         if test -z "$PKG_CONFIG"; then
8933             PYTHON_CFLAGS="-I$python_include"
8934             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8935         elif $PKG_CONFIG --exists python-$python_version-embed; then
8936             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8937             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8938         elif $PKG_CONFIG --exists python-$python_version; then
8939             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8940             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8941         else
8942             PYTHON_CFLAGS="-I$python_include"
8943             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8944         fi
8945         FilterLibs "${PYTHON_LIBS}"
8946         PYTHON_LIBS="${filteredlibs}"
8947     else
8948         dnl How to find out the cross-compilation Python installation path?
8949         AC_MSG_CHECKING([for python version])
8950         AS_IF([test -n "$PYTHON_VERSION"],
8951               [AC_MSG_RESULT([$PYTHON_VERSION])],
8952               [AC_MSG_RESULT([not found])
8953                AC_MSG_ERROR([no usable python found])])
8954         test -n "$PYTHON_CFLAGS" && break
8955     fi
8957     dnl Check if the headers really work
8958     save_CPPFLAGS="$CPPFLAGS"
8959     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8960     AC_CHECK_HEADER(Python.h)
8961     CPPFLAGS="$save_CPPFLAGS"
8963     # let the PYTHON_FOR_BUILD match the same python installation that
8964     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8965     # better for PythonTests.
8966     PYTHON_FOR_BUILD=$PYTHON
8969 if test "$with_lxml" != no; then
8970     if test -z "$PYTHON_FOR_BUILD"; then
8971         case $build_os in
8972             cygwin)
8973                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8974                 ;;
8975             *)
8976                 if test "$cross_compiling" != yes ; then
8977                     BUILD_TYPE="$BUILD_TYPE LXML"
8978                 fi
8979                 ;;
8980         esac
8981     else
8982         AC_MSG_CHECKING([for python lxml])
8983         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8984             AC_MSG_RESULT([yes])
8985         else
8986             case $build_os in
8987                 cygwin)
8988                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8989                     ;;
8990                 *)
8991                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8992                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8993                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8994                         else
8995                             BUILD_TYPE="$BUILD_TYPE LXML"
8996                             AC_MSG_RESULT([no, using internal lxml])
8997                         fi
8998                     else
8999                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9000                     fi
9001                     ;;
9002             esac
9003         fi
9004     fi
9007 dnl By now enable_python should be "system", "internal" or "no"
9008 case $enable_python in
9009 system)
9010     SYSTEM_PYTHON=TRUE
9012     if test "x$ac_cv_header_Python_h" != "xyes"; then
9013        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9014     fi
9016     AC_LANG_PUSH(C)
9017     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9018     AC_MSG_CHECKING([for correct python library version])
9019        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9020 #include <Python.h>
9022 int main(int argc, char **argv) {
9023    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9024    else return 1;
9026        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9027     CFLAGS=$save_CFLAGS
9028     AC_LANG_POP(C)
9030     dnl FIXME Check if the Python library can be linked with, too?
9031     ;;
9033 internal)
9034     SYSTEM_PYTHON=
9035     PYTHON_VERSION_MAJOR=3
9036     PYTHON_VERSION_MINOR=8
9037     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
9038     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9039         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9040     fi
9041     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9042     BUILD_TYPE="$BUILD_TYPE PYTHON"
9043     if test "$OS" = LINUX -o "$OS" = WNT ; then
9044         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9045     fi
9046     # Embedded Python dies without Home set
9047     if test "$HOME" = ""; then
9048         export HOME=""
9049     fi
9050     ;;
9052     DISABLE_PYTHON=TRUE
9053     SYSTEM_PYTHON=
9054     ;;
9056     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9057     ;;
9058 esac
9060 AC_SUBST(DISABLE_PYTHON)
9061 AC_SUBST(SYSTEM_PYTHON)
9062 AC_SUBST(PYTHON_CFLAGS)
9063 AC_SUBST(PYTHON_LIBS)
9064 AC_SUBST(PYTHON_VERSION)
9065 AC_SUBST(PYTHON_VERSION_MAJOR)
9066 AC_SUBST(PYTHON_VERSION_MINOR)
9068 ENABLE_MARIADBC=TRUE
9069 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
9070     ENABLE_MARIADBC=
9072 MARIADBC_MAJOR=1
9073 MARIADBC_MINOR=0
9074 MARIADBC_MICRO=2
9075 if test "$ENABLE_MARIADBC" = "TRUE"; then
9076     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9079 AC_SUBST(ENABLE_MARIADBC)
9080 AC_SUBST(MARIADBC_MAJOR)
9081 AC_SUBST(MARIADBC_MINOR)
9082 AC_SUBST(MARIADBC_MICRO)
9084 if test "$ENABLE_MARIADBC" = "TRUE"; then
9085     dnl ===================================================================
9086     dnl Check for system MariaDB
9087     dnl ===================================================================
9088     AC_MSG_CHECKING([which MariaDB to use])
9089     if test "$with_system_mariadb" = "yes"; then
9090         AC_MSG_RESULT([external])
9091         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9092         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9093         if test -z "$MARIADBCONFIG"; then
9094             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9095             if test -z "$MARIADBCONFIG"; then
9096                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9097                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9098             fi
9099         fi
9100         AC_MSG_CHECKING([MariaDB version])
9101         MARIADB_VERSION=`$MARIADBCONFIG --version`
9102         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9103         if test "$MARIADB_MAJOR" -ge "5"; then
9104             AC_MSG_RESULT([OK])
9105         else
9106             AC_MSG_ERROR([too old, use 5.0.x or later])
9107         fi
9108         AC_MSG_CHECKING([for MariaDB Client library])
9109         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9110         if test "$COM_IS_CLANG" = TRUE; then
9111             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9112         fi
9113         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9114         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9115         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9116         dnl linux32:
9117         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9118             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9119             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9120                 | sed -e 's|/lib64/|/lib/|')
9121         fi
9122         FilterLibs "${MARIADB_LIBS}"
9123         MARIADB_LIBS="${filteredlibs}"
9124         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9125         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9126         if test "$enable_bundle_mariadb" = "yes"; then
9127             AC_MSG_RESULT([yes])
9128             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9129             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9131 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9133 /g' | grep -E '(mysqlclient|mariadb)')
9134             if test "$_os" = "Darwin"; then
9135                 LIBMARIADB=${LIBMARIADB}.dylib
9136             elif test "$_os" = "WINNT"; then
9137                 LIBMARIADB=${LIBMARIADB}.dll
9138             else
9139                 LIBMARIADB=${LIBMARIADB}.so
9140             fi
9141             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9142             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9143             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9144                 AC_MSG_RESULT([found.])
9145                 PathFormat "$LIBMARIADB_PATH"
9146                 LIBMARIADB_PATH="$formatted_path"
9147             else
9148                 AC_MSG_ERROR([not found.])
9149             fi
9150         else
9151             AC_MSG_RESULT([no])
9152             BUNDLE_MARIADB_CONNECTOR_C=
9153         fi
9154     else
9155         AC_MSG_RESULT([internal])
9156         SYSTEM_MARIADB_CONNECTOR_C=
9157         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9158         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9159         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9160     fi
9162     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9163     AC_SUBST(MARIADB_CFLAGS)
9164     AC_SUBST(MARIADB_LIBS)
9165     AC_SUBST(LIBMARIADB)
9166     AC_SUBST(LIBMARIADB_PATH)
9167     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9170 dnl ===================================================================
9171 dnl Check for system hsqldb
9172 dnl ===================================================================
9173 if test "$with_java" != "no"; then
9174     HSQLDB_USE_JDBC_4_1=
9175     AC_MSG_CHECKING([which hsqldb to use])
9176     if test "$with_system_hsqldb" = "yes"; then
9177         AC_MSG_RESULT([external])
9178         SYSTEM_HSQLDB=TRUE
9179         if test -z $HSQLDB_JAR; then
9180             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9181         fi
9182         if ! test -f $HSQLDB_JAR; then
9183                AC_MSG_ERROR(hsqldb.jar not found.)
9184         fi
9185         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9186         export HSQLDB_JAR
9187         if $PERL -e \
9188            'use Archive::Zip;
9189             my $file = "$ENV{'HSQLDB_JAR'}";
9190             my $zip = Archive::Zip->new( $file );
9191             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9192             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9193             {
9194                 push @l, split(/\n/, $mf);
9195                 foreach my $line (@l)
9196                 {
9197                     if ($line =~ m/Specification-Version:/)
9198                     {
9199                         ($t, $version) = split (/:/,$line);
9200                         $version =~ s/^\s//;
9201                         ($a, $b, $c, $d) = split (/\./,$version);
9202                         if ($c == "0" && $d > "8")
9203                         {
9204                             exit 0;
9205                         }
9206                         else
9207                         {
9208                             exit 1;
9209                         }
9210                     }
9211                 }
9212             }
9213             else
9214             {
9215                 exit 1;
9216             }'; then
9217             AC_MSG_RESULT([yes])
9218         else
9219             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9220         fi
9221     else
9222         AC_MSG_RESULT([internal])
9223         SYSTEM_HSQLDB=
9224         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9225         NEED_ANT=TRUE
9226         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9227         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9228         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9229             AC_MSG_RESULT([yes])
9230             HSQLDB_USE_JDBC_4_1=TRUE
9231         else
9232             AC_MSG_RESULT([no])
9233         fi
9234     fi
9235     AC_SUBST(SYSTEM_HSQLDB)
9236     AC_SUBST(HSQLDB_JAR)
9237     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9240 dnl ===================================================================
9241 dnl Check for PostgreSQL stuff
9242 dnl ===================================================================
9243 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9244 if test "x$enable_postgresql_sdbc" != "xno"; then
9245     AC_MSG_RESULT([yes])
9246     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9248     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9249         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9250     fi
9251     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9252         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9253     fi
9255     postgres_interface=""
9256     if test "$with_system_postgresql" = "yes"; then
9257         postgres_interface="external PostgreSQL"
9258         SYSTEM_POSTGRESQL=TRUE
9259         if test "$_os" = Darwin; then
9260             supp_path=''
9261             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9262                 pg_supp_path="$P_SEP$d$pg_supp_path"
9263             done
9264         fi
9265         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9266         if test -n "$PGCONFIG"; then
9267             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9268             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9269         else
9270             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9271               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9272               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9273             ],[
9274               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9275             ])
9276         fi
9277         FilterLibs "${POSTGRESQL_LIB}"
9278         POSTGRESQL_LIB="${filteredlibs}"
9279     else
9280         # if/when anything else than PostgreSQL uses Kerberos,
9281         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9282         WITH_KRB5=
9283         WITH_GSSAPI=
9284         case "$_os" in
9285         Darwin)
9286             # macOS has system MIT Kerberos 5 since 10.4
9287             if test "$with_krb5" != "no"; then
9288                 WITH_KRB5=TRUE
9289                 save_LIBS=$LIBS
9290                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9291                 # that the libraries where these functions are located on macOS will change, is it?
9292                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9293                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9294                 KRB5_LIBS=$LIBS
9295                 LIBS=$save_LIBS
9296                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9297                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9298                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9299                 LIBS=$save_LIBS
9300             fi
9301             if test "$with_gssapi" != "no"; then
9302                 WITH_GSSAPI=TRUE
9303                 save_LIBS=$LIBS
9304                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9305                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9306                 GSSAPI_LIBS=$LIBS
9307                 LIBS=$save_LIBS
9308             fi
9309             ;;
9310         WINNT)
9311             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9312                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9313             fi
9314             ;;
9315         Linux|GNU|*BSD|DragonFly)
9316             if test "$with_krb5" != "no"; then
9317                 WITH_KRB5=TRUE
9318                 save_LIBS=$LIBS
9319                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9320                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9321                 KRB5_LIBS=$LIBS
9322                 LIBS=$save_LIBS
9323                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9324                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9325                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9326                 LIBS=$save_LIBS
9327             fi
9328             if test "$with_gssapi" != "no"; then
9329                 WITH_GSSAPI=TRUE
9330                 save_LIBS=$LIBS
9331                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9332                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9333                 GSSAPI_LIBS=$LIBS
9334                 LIBS=$save_LIBS
9335             fi
9336             ;;
9337         *)
9338             if test "$with_krb5" = "yes"; then
9339                 WITH_KRB5=TRUE
9340                 save_LIBS=$LIBS
9341                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9342                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9343                 KRB5_LIBS=$LIBS
9344                 LIBS=$save_LIBS
9345                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9346                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9347                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9348                 LIBS=$save_LIBS
9349             fi
9350             if test "$with_gssapi" = "yes"; then
9351                 WITH_GSSAPI=TRUE
9352                 save_LIBS=$LIBS
9353                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9354                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9355                 LIBS=$save_LIBS
9356                 GSSAPI_LIBS=$LIBS
9357             fi
9358         esac
9360         if test -n "$with_libpq_path"; then
9361             SYSTEM_POSTGRESQL=TRUE
9362             postgres_interface="external libpq"
9363             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9364             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9365         else
9366             SYSTEM_POSTGRESQL=
9367             postgres_interface="internal"
9368             POSTGRESQL_LIB=""
9369             POSTGRESQL_INC="%OVERRIDE_ME%"
9370             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9371         fi
9372     fi
9374     AC_MSG_CHECKING([PostgreSQL C interface])
9375     AC_MSG_RESULT([$postgres_interface])
9377     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9378         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9379         save_CFLAGS=$CFLAGS
9380         save_CPPFLAGS=$CPPFLAGS
9381         save_LIBS=$LIBS
9382         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9383         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9384         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9385         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9386             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9387         CFLAGS=$save_CFLAGS
9388         CPPFLAGS=$save_CPPFLAGS
9389         LIBS=$save_LIBS
9390     fi
9391     BUILD_POSTGRESQL_SDBC=TRUE
9392 else
9393     AC_MSG_RESULT([no])
9395 AC_SUBST(WITH_KRB5)
9396 AC_SUBST(WITH_GSSAPI)
9397 AC_SUBST(GSSAPI_LIBS)
9398 AC_SUBST(KRB5_LIBS)
9399 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9400 AC_SUBST(SYSTEM_POSTGRESQL)
9401 AC_SUBST(POSTGRESQL_INC)
9402 AC_SUBST(POSTGRESQL_LIB)
9404 dnl ===================================================================
9405 dnl Check for Firebird stuff
9406 dnl ===================================================================
9407 ENABLE_FIREBIRD_SDBC=
9408 if test "$enable_firebird_sdbc" = "yes" ; then
9409     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9411     dnl ===================================================================
9412     dnl Check for system Firebird
9413     dnl ===================================================================
9414     AC_MSG_CHECKING([which Firebird to use])
9415     if test "$with_system_firebird" = "yes"; then
9416         AC_MSG_RESULT([external])
9417         SYSTEM_FIREBIRD=TRUE
9418         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9419         if test -z "$FIREBIRDCONFIG"; then
9420             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9421             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9422                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9423             ])
9424             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9425         else
9426             AC_MSG_NOTICE([fb_config found])
9427             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9428             AC_MSG_CHECKING([for Firebird Client library])
9429             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9430             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9431             FilterLibs "${FIREBIRD_LIBS}"
9432             FIREBIRD_LIBS="${filteredlibs}"
9433         fi
9434         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9435         AC_MSG_CHECKING([Firebird version])
9436         if test -n "${FIREBIRD_VERSION}"; then
9437             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9438             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9439             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9440                 AC_MSG_RESULT([OK])
9441             else
9442                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9443             fi
9444         else
9445             __save_CFLAGS="${CFLAGS}"
9446             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9447             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9448 #if defined(FB_API_VER) && FB_API_VER == 30
9449 int fb_api_is_30(void) { return 0; }
9450 #else
9451 #error "Wrong Firebird API version"
9452 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9453             CFLAGS="${__save_CFLAGS}"
9454         fi
9455         ENABLE_FIREBIRD_SDBC=TRUE
9456         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9457     elif test "$enable_database_connectivity" != yes; then
9458         AC_MSG_RESULT([none])
9459     elif test "$cross_compiling" = "yes"; then
9460         AC_MSG_RESULT([none])
9461     else
9462         dnl Embedded Firebird has version 3.0
9463         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9464         dnl We need libatomic_ops for any non X86/X64 system
9465         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9466             dnl ===================================================================
9467             dnl Check for system libatomic_ops
9468             dnl ===================================================================
9469             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9470             if test "$with_system_libatomic_ops" = "yes"; then
9471                 SYSTEM_LIBATOMIC_OPS=TRUE
9472                 AC_CHECK_HEADERS(atomic_ops.h, [],
9473                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9474             else
9475                 SYSTEM_LIBATOMIC_OPS=
9476                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9477                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9478                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9479             fi
9480         fi
9482         AC_MSG_RESULT([internal])
9483         SYSTEM_FIREBIRD=
9484         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9485         FIREBIRD_LIBS="-lfbclient"
9487         if test "$with_system_libtommath" = "yes"; then
9488             SYSTEM_LIBTOMMATH=TRUE
9489             dnl check for tommath presence
9490             save_LIBS=$LIBS
9491             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9492             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9493             LIBS=$save_LIBS
9494         else
9495             SYSTEM_LIBTOMMATH=
9496             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9497             LIBTOMMATH_LIBS="-ltommath"
9498             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9499         fi
9501         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9502         ENABLE_FIREBIRD_SDBC=TRUE
9503         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9504     fi
9506 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9507 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9508 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9509 AC_SUBST(LIBATOMIC_OPS_LIBS)
9510 AC_SUBST(SYSTEM_FIREBIRD)
9511 AC_SUBST(FIREBIRD_CFLAGS)
9512 AC_SUBST(FIREBIRD_LIBS)
9513 AC_SUBST([TOMMATH_CFLAGS])
9514 AC_SUBST([TOMMATH_LIBS])
9516 dnl ===================================================================
9517 dnl Check for system curl
9518 dnl ===================================================================
9519 AC_MSG_CHECKING([which libcurl to use])
9520 if test "$with_system_curl" = "auto"; then
9521     with_system_curl="$with_system_libs"
9524 if test "$with_system_curl" = "yes"; then
9525     AC_MSG_RESULT([external])
9526     SYSTEM_CURL=TRUE
9528     # First try PKGCONFIG and then fall back
9529     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9531     if test -n "$CURL_PKG_ERRORS"; then
9532         AC_PATH_PROG(CURLCONFIG, curl-config)
9533         if test -z "$CURLCONFIG"; then
9534             AC_MSG_ERROR([curl development files not found])
9535         fi
9536         CURL_LIBS=`$CURLCONFIG --libs`
9537         FilterLibs "${CURL_LIBS}"
9538         CURL_LIBS="${filteredlibs}"
9539         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9540         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9542         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9543         case $curl_version in
9544         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9545         dnl so they need to be doubled to end up in the configure script
9546         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9547             AC_MSG_RESULT([yes])
9548             ;;
9549         *)
9550             AC_MSG_ERROR([no, you have $curl_version])
9551             ;;
9552         esac
9553     fi
9555     ENABLE_CURL=TRUE
9556 elif test $_os = iOS; then
9557     # Let's see if we need curl, I think not?
9558     AC_MSG_RESULT([none])
9559     ENABLE_CURL=
9560 else
9561     AC_MSG_RESULT([internal])
9562     SYSTEM_CURL=
9563     BUILD_TYPE="$BUILD_TYPE CURL"
9564     ENABLE_CURL=TRUE
9566 AC_SUBST(SYSTEM_CURL)
9567 AC_SUBST(CURL_CFLAGS)
9568 AC_SUBST(CURL_LIBS)
9569 AC_SUBST(ENABLE_CURL)
9571 dnl ===================================================================
9572 dnl Check for system boost
9573 dnl ===================================================================
9574 AC_MSG_CHECKING([which boost to use])
9575 if test "$with_system_boost" = "yes"; then
9576     AC_MSG_RESULT([external])
9577     SYSTEM_BOOST=TRUE
9578     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
9579     AX_BOOST_DATE_TIME
9580     AX_BOOST_FILESYSTEM
9581     AX_BOOST_IOSTREAMS
9582     AX_BOOST_LOCALE
9583     AC_LANG_PUSH([C++])
9584     save_CXXFLAGS=$CXXFLAGS
9585     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9586     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9587        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9588     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9589        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9590     CXXFLAGS=$save_CXXFLAGS
9591     AC_LANG_POP([C++])
9592     # this is in m4/ax_boost_base.m4
9593     FilterLibs "${BOOST_LDFLAGS}"
9594     BOOST_LDFLAGS="${filteredlibs}"
9595 else
9596     AC_MSG_RESULT([internal])
9597     BUILD_TYPE="$BUILD_TYPE BOOST"
9598     SYSTEM_BOOST=
9599     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9600         # use warning-suppressing wrapper headers
9601         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9602     else
9603         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9604     fi
9606 AC_SUBST(SYSTEM_BOOST)
9608 dnl ===================================================================
9609 dnl Check for system mdds
9610 dnl ===================================================================
9611 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9613 dnl ===================================================================
9614 dnl Check for system glm
9615 dnl ===================================================================
9616 AC_MSG_CHECKING([which glm to use])
9617 if test "$with_system_glm" = "yes"; then
9618     AC_MSG_RESULT([external])
9619     SYSTEM_GLM=TRUE
9620     AC_LANG_PUSH([C++])
9621     AC_CHECK_HEADER([glm/glm.hpp], [],
9622        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9623     AC_LANG_POP([C++])
9624 else
9625     AC_MSG_RESULT([internal])
9626     BUILD_TYPE="$BUILD_TYPE GLM"
9627     SYSTEM_GLM=
9628     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9630 AC_SUBST([GLM_CFLAGS])
9631 AC_SUBST([SYSTEM_GLM])
9633 dnl ===================================================================
9634 dnl Check for system odbc
9635 dnl ===================================================================
9636 AC_MSG_CHECKING([which odbc headers to use])
9637 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
9638     AC_MSG_RESULT([external])
9639     SYSTEM_ODBC_HEADERS=TRUE
9641     if test "$build_os" = "cygwin"; then
9642         save_CPPFLAGS=$CPPFLAGS
9643         find_winsdk
9644         PathFormat "$winsdktest"
9645         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"
9646         AC_CHECK_HEADER(sqlext.h, [],
9647             [AC_MSG_ERROR(odbc not found. install odbc)],
9648             [#include <windows.h>])
9649         CPPFLAGS=$save_CPPFLAGS
9650     else
9651         AC_CHECK_HEADER(sqlext.h, [],
9652             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9653     fi
9654 elif test "$enable_database_connectivity" != yes; then
9655     AC_MSG_RESULT([none])
9656 else
9657     AC_MSG_RESULT([internal])
9658     SYSTEM_ODBC_HEADERS=
9660 AC_SUBST(SYSTEM_ODBC_HEADERS)
9662 dnl ===================================================================
9663 dnl Enable LDAP support
9664 dnl ===================================================================
9666 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9667 AC_MSG_CHECKING([whether to enable LDAP support])
9668     if test "$enable_ldap" != "yes"; then
9669         AC_MSG_RESULT([no])
9670         ENABLE_LDAP=""
9671         enable_ldap=no
9672     else
9673         AC_MSG_RESULT([yes])
9674         ENABLE_LDAP="TRUE"
9675     fi
9677 AC_SUBST(ENABLE_LDAP)
9679 dnl ===================================================================
9680 dnl Check for system openldap
9681 dnl ===================================================================
9683 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9684 AC_MSG_CHECKING([which openldap library to use])
9685 if test "$with_system_openldap" = "yes"; then
9686     AC_MSG_RESULT([external])
9687     SYSTEM_OPENLDAP=TRUE
9688     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9689     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9690     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9691 else
9692     AC_MSG_RESULT([internal])
9693     SYSTEM_OPENLDAP=
9694     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9697 AC_SUBST(SYSTEM_OPENLDAP)
9699 dnl ===================================================================
9700 dnl Check for system NSS
9701 dnl ===================================================================
9702 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9703     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9704     AC_DEFINE(HAVE_FEATURE_NSS)
9705     ENABLE_NSS="TRUE"
9706     AC_DEFINE(ENABLE_NSS)
9707 elif test $_os != iOS ; then
9708     with_tls=openssl
9710 AC_SUBST(ENABLE_NSS)
9712 dnl ===================================================================
9713 dnl Check for TLS/SSL and cryptographic implementation to use
9714 dnl ===================================================================
9715 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9716 if test -n "$with_tls"; then
9717     case $with_tls in
9718     openssl)
9719         AC_DEFINE(USE_TLS_OPENSSL)
9720         TLS=OPENSSL
9722         if test "$enable_openssl" != "yes"; then
9723             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9724         fi
9726         # warn that OpenSSL has been selected but not all TLS code has this option
9727         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9728         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9729         ;;
9730     nss)
9731         AC_DEFINE(USE_TLS_NSS)
9732         TLS=NSS
9733         ;;
9734     no)
9735         AC_MSG_WARN([Skipping TLS/SSL])
9736         ;;
9737     *)
9738         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9739 openssl - OpenSSL
9740 nss - Mozilla's Network Security Services (NSS)
9741     ])
9742         ;;
9743     esac
9744 else
9745     # default to using NSS, it results in smaller oox lib
9746     AC_DEFINE(USE_TLS_NSS)
9747     TLS=NSS
9749 AC_MSG_RESULT([$TLS])
9750 AC_SUBST(TLS)
9752 dnl ===================================================================
9753 dnl Check for system sane
9754 dnl ===================================================================
9755 AC_MSG_CHECKING([which sane header to use])
9756 if test "$with_system_sane" = "yes"; then
9757     AC_MSG_RESULT([external])
9758     AC_CHECK_HEADER(sane/sane.h, [],
9759       [AC_MSG_ERROR(sane not found. install sane)], [])
9760 else
9761     AC_MSG_RESULT([internal])
9762     BUILD_TYPE="$BUILD_TYPE SANE"
9765 dnl ===================================================================
9766 dnl Check for system icu
9767 dnl ===================================================================
9768 SYSTEM_GENBRK=
9769 SYSTEM_GENCCODE=
9770 SYSTEM_GENCMN=
9772 ICU_MAJOR=67
9773 ICU_MINOR=1
9774 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9775 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9776 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9777 AC_MSG_CHECKING([which icu to use])
9778 if test "$with_system_icu" = "yes"; then
9779     AC_MSG_RESULT([external])
9780     SYSTEM_ICU=TRUE
9781     AC_LANG_PUSH([C++])
9782     AC_MSG_CHECKING([for unicode/rbbi.h])
9783     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9784     AC_LANG_POP([C++])
9786     if test "$cross_compiling" != "yes"; then
9787         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9788         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9789         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9790         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9791     fi
9793     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9794         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9795         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9796         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9797         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9798         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9799             AC_MSG_RESULT([yes])
9800         else
9801             AC_MSG_RESULT([no])
9802             if test "$with_system_icu_for_build" != "force"; then
9803                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9804 You can use --with-system-icu-for-build=force to use it anyway.])
9805             fi
9806         fi
9807     fi
9809     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9810         # using the system icu tools can lead to version confusion, use the
9811         # ones from the build environment when cross-compiling
9812         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9813         if test -z "$SYSTEM_GENBRK"; then
9814             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9815         fi
9816         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9817         if test -z "$SYSTEM_GENCCODE"; then
9818             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9819         fi
9820         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9821         if test -z "$SYSTEM_GENCMN"; then
9822             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9823         fi
9824         if test "$ICU_MAJOR" -ge "49"; then
9825             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9826             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9827             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9828         else
9829             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9830             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9831             ICU_RECLASSIFIED_HEBREW_LETTER=
9832         fi
9833     fi
9835     if test "$cross_compiling" = "yes"; then
9836         if test "$ICU_MAJOR" -ge "50"; then
9837             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9838             ICU_MINOR=""
9839         fi
9840     fi
9841 else
9842     AC_MSG_RESULT([internal])
9843     SYSTEM_ICU=
9844     BUILD_TYPE="$BUILD_TYPE ICU"
9845     # surprisingly set these only for "internal" (to be used by various other
9846     # external libs): the system icu-config is quite unhelpful and spits out
9847     # dozens of weird flags and also default path -I/usr/include
9848     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9849     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9851 if test "$ICU_MAJOR" -ge "59"; then
9852     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9853     # with -std=c++11 but not all external libraries can be built with that,
9854     # for those use a bit-compatible typedef uint16_t UChar; see
9855     # icu/source/common/unicode/umachine.h
9856     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9857 else
9858     ICU_UCHAR_TYPE=""
9860 AC_SUBST(SYSTEM_ICU)
9861 AC_SUBST(SYSTEM_GENBRK)
9862 AC_SUBST(SYSTEM_GENCCODE)
9863 AC_SUBST(SYSTEM_GENCMN)
9864 AC_SUBST(ICU_MAJOR)
9865 AC_SUBST(ICU_MINOR)
9866 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9867 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9868 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9869 AC_SUBST(ICU_CFLAGS)
9870 AC_SUBST(ICU_LIBS)
9871 AC_SUBST(ICU_UCHAR_TYPE)
9873 dnl ==================================================================
9874 dnl Breakpad
9875 dnl ==================================================================
9876 DEFAULT_CRASHDUMP_VALUE="true"
9877 AC_MSG_CHECKING([whether to enable breakpad])
9878 if test "$enable_breakpad" != yes; then
9879     AC_MSG_RESULT([no])
9880 else
9881     AC_MSG_RESULT([yes])
9882     ENABLE_BREAKPAD="TRUE"
9883     AC_DEFINE(ENABLE_BREAKPAD)
9884     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9885     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9887     AC_MSG_CHECKING([for disable crash dump])
9888     if test "$enable_crashdump" = no; then
9889         DEFAULT_CRASHDUMP_VALUE="false"
9890         AC_MSG_RESULT([yes])
9891     else
9892        AC_MSG_RESULT([no])
9893     fi
9895     AC_MSG_CHECKING([for crashreport config])
9896     if test "$with_symbol_config" = "no"; then
9897         BREAKPAD_SYMBOL_CONFIG="invalid"
9898         AC_MSG_RESULT([no])
9899     else
9900         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9901         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9902         AC_MSG_RESULT([yes])
9903     fi
9904     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9906 AC_SUBST(ENABLE_BREAKPAD)
9907 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9909 dnl ==================================================================
9910 dnl libfuzzer
9911 dnl ==================================================================
9912 AC_MSG_CHECKING([whether to enable fuzzers])
9913 if test "$enable_fuzzers" != yes; then
9914     AC_MSG_RESULT([no])
9915 else
9916     AC_MSG_RESULT([yes])
9917     ENABLE_FUZZERS="TRUE"
9918     AC_DEFINE([ENABLE_FUZZERS],1)
9919     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9921 AC_SUBST(ENABLE_FUZZERS)
9923 dnl ===================================================================
9924 dnl Orcus
9925 dnl ===================================================================
9926 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9927 if test "$with_system_orcus" != "yes"; then
9928     if test "$SYSTEM_BOOST" = "TRUE"; then
9929         # ===========================================================
9930         # Determine if we are going to need to link with Boost.System
9931         # ===========================================================
9932         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9933         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9934         dnl in documentation has no effect.
9935         AC_MSG_CHECKING([if we need to link with Boost.System])
9936         AC_LANG_PUSH([C++])
9937         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9938                 @%:@include <boost/version.hpp>
9939             ]],[[
9940                 #if BOOST_VERSION >= 105000
9941                 #   error yes, we need to link with Boost.System
9942                 #endif
9943             ]])],[
9944                 AC_MSG_RESULT([no])
9945             ],[
9946                 AC_MSG_RESULT([yes])
9947                 AX_BOOST_SYSTEM
9948         ])
9949         AC_LANG_POP([C++])
9950     fi
9952 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9953 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9954 AC_SUBST([BOOST_SYSTEM_LIB])
9955 AC_SUBST(SYSTEM_LIBORCUS)
9957 dnl ===================================================================
9958 dnl HarfBuzz
9959 dnl ===================================================================
9960 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9961                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9962                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9964 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9965                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9966                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9968 if test "$COM" = "MSC"; then # override the above
9969     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9970     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9973 if test "$with_system_harfbuzz" = "yes"; then
9974     if test "$with_system_graphite" = "no"; then
9975         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9976     fi
9977     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9978     _save_libs="$LIBS"
9979     _save_cflags="$CFLAGS"
9980     LIBS="$LIBS $HARFBUZZ_LIBS"
9981     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9982     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9983     LIBS="$_save_libs"
9984     CFLAGS="$_save_cflags"
9985 else
9986     if test "$with_system_graphite" = "yes"; then
9987         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9988     fi
9991 AC_MSG_CHECKING([whether to use X11])
9992 dnl ***************************************
9993 dnl testing for X libraries and includes...
9994 dnl ***************************************
9995 if test "$USING_X11" = TRUE; then
9996     AC_DEFINE(HAVE_FEATURE_X11)
9998 AC_MSG_RESULT([$USING_X11])
10000 if test "$USING_X11" = TRUE; then
10001     AC_PATH_X
10002     AC_PATH_XTRA
10003     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10005     if test -z "$x_includes"; then
10006         x_includes="default_x_includes"
10007     fi
10008     if test -z "$x_libraries"; then
10009         x_libraries="default_x_libraries"
10010     fi
10011     CFLAGS="$CFLAGS $X_CFLAGS"
10012     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10013     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10014 else
10015     x_includes="no_x_includes"
10016     x_libraries="no_x_libraries"
10019 if test "$USING_X11" = TRUE; then
10020     dnl ===================================================================
10021     dnl Check for extension headers
10022     dnl ===================================================================
10023     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10024      [#include <X11/extensions/shape.h>])
10026     # vcl needs ICE and SM
10027     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10028     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10029         [AC_MSG_ERROR(ICE library not found)])
10030     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10031     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10032         [AC_MSG_ERROR(SM library not found)])
10035 dnl ===================================================================
10036 dnl Check for system Xrender
10037 dnl ===================================================================
10038 AC_MSG_CHECKING([whether to use Xrender])
10039 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10040     AC_MSG_RESULT([yes])
10041     PKG_CHECK_MODULES(XRENDER, xrender)
10042     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10043     FilterLibs "${XRENDER_LIBS}"
10044     XRENDER_LIBS="${filteredlibs}"
10045     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10046       [AC_MSG_ERROR(libXrender not found or functional)], [])
10047     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10048       [AC_MSG_ERROR(Xrender not found. install X)], [])
10049 else
10050     AC_MSG_RESULT([no])
10052 AC_SUBST(XRENDER_CFLAGS)
10053 AC_SUBST(XRENDER_LIBS)
10055 dnl ===================================================================
10056 dnl Check for XRandr
10057 dnl ===================================================================
10058 AC_MSG_CHECKING([whether to enable RandR support])
10059 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10060     AC_MSG_RESULT([yes])
10061     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10062     if test "$ENABLE_RANDR" != "TRUE"; then
10063         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10064                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10065         XRANDR_CFLAGS=" "
10066         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10067           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10068         XRANDR_LIBS="-lXrandr "
10069         ENABLE_RANDR="TRUE"
10070     fi
10071     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10072     FilterLibs "${XRANDR_LIBS}"
10073     XRANDR_LIBS="${filteredlibs}"
10074 else
10075     ENABLE_RANDR=""
10076     AC_MSG_RESULT([no])
10078 AC_SUBST(XRANDR_CFLAGS)
10079 AC_SUBST(XRANDR_LIBS)
10080 AC_SUBST(ENABLE_RANDR)
10082 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10083     WITH_WEBDAV="serf"
10085 if test $_os = iOS -o $_os = Android; then
10086     WITH_WEBDAV="no"
10088 AC_MSG_CHECKING([for webdav library])
10089 case "$WITH_WEBDAV" in
10090 serf)
10091     AC_MSG_RESULT([serf])
10092     # Check for system apr-util
10093     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10094                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10095                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10096     if test "$COM" = "MSC"; then
10097         APR_LIB_DIR="LibR"
10098         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10099         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10100     fi
10102     # Check for system serf
10103     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
10104                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
10105     if test "$COM" = "MSC"; then
10106         SERF_LIB_DIR="Release"
10107         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
10108         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
10109     fi
10110     ;;
10111 neon)
10112     AC_MSG_RESULT([neon])
10113     # Check for system neon
10114     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.1])
10115     if test "$with_system_neon" = "yes"; then
10116         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10117     else
10118         NEON_VERSION=0311
10119     fi
10120     AC_SUBST(NEON_VERSION)
10121     ;;
10123     AC_MSG_RESULT([none, disabled])
10124     WITH_WEBDAV=""
10125     ;;
10126 esac
10127 AC_SUBST(WITH_WEBDAV)
10129 dnl ===================================================================
10130 dnl Check for disabling cve_tests
10131 dnl ===================================================================
10132 AC_MSG_CHECKING([whether to execute CVE tests])
10133 # If not explicitly enabled or disabled, default
10134 if test -z "$enable_cve_tests"; then
10135     case "$OS" in
10136     WNT)
10137         # Default cves off for Windows with its wild and wonderful
10138         # variety of AV software kicking in and panicking
10139         enable_cve_tests=no
10140         ;;
10141     *)
10142         # otherwise yes
10143         enable_cve_tests=yes
10144         ;;
10145     esac
10147 if test "$enable_cve_tests" = "no"; then
10148     AC_MSG_RESULT([no])
10149     DISABLE_CVE_TESTS=TRUE
10150     AC_SUBST(DISABLE_CVE_TESTS)
10151 else
10152     AC_MSG_RESULT([yes])
10155 dnl ===================================================================
10156 dnl Check for enabling chart XShape tests
10157 dnl ===================================================================
10158 AC_MSG_CHECKING([whether to execute chart XShape tests])
10159 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10160     AC_MSG_RESULT([yes])
10161     ENABLE_CHART_TESTS=TRUE
10162     AC_SUBST(ENABLE_CHART_TESTS)
10163 else
10164     AC_MSG_RESULT([no])
10167 dnl ===================================================================
10168 dnl Check for system openssl
10169 dnl ===================================================================
10170 DISABLE_OPENSSL=
10171 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10172 if test "$enable_openssl" = "yes"; then
10173     AC_MSG_RESULT([no])
10174     if test "$_os" = Darwin ; then
10175         # OpenSSL is deprecated when building for 10.7 or later.
10176         #
10177         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10178         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10180         with_system_openssl=no
10181         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10182     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10183             && test "$with_system_openssl" != "no"; then
10184         with_system_openssl=yes
10185         SYSTEM_OPENSSL=TRUE
10186         OPENSSL_CFLAGS=
10187         OPENSSL_LIBS="-lssl -lcrypto"
10188     else
10189         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10190     fi
10191     if test "$with_system_openssl" = "yes"; then
10192         AC_MSG_CHECKING([whether openssl supports SHA512])
10193         AC_LANG_PUSH([C])
10194         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10195             SHA512_CTX context;
10196 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10197         AC_LANG_POP(C)
10198     fi
10199 else
10200     AC_MSG_RESULT([yes])
10201     DISABLE_OPENSSL=TRUE
10203     # warn that although OpenSSL is disabled, system libraries may depend on it
10204     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10205     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10208 AC_SUBST([DISABLE_OPENSSL])
10210 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10211     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10212         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10213         enable_cipher_openssl_backend=no
10214     else
10215         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10216     fi
10218 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10219 ENABLE_CIPHER_OPENSSL_BACKEND=
10220 if test "$enable_cipher_openssl_backend" = yes; then
10221     AC_MSG_RESULT([yes])
10222     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10223 else
10224     AC_MSG_RESULT([no])
10226 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10228 dnl ===================================================================
10229 dnl Check for building gnutls
10230 dnl ===================================================================
10231 AC_MSG_CHECKING([whether to use gnutls])
10232 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10233     AC_MSG_RESULT([yes])
10234     AM_PATH_LIBGCRYPT()
10235     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10236         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10237                       available in the system to use as replacement.]]))
10238     FilterLibs "${LIBGCRYPT_LIBS}"
10239     LIBGCRYPT_LIBS="${filteredlibs}"
10240 else
10241     AC_MSG_RESULT([no])
10244 AC_SUBST([LIBGCRYPT_CFLAGS])
10245 AC_SUBST([LIBGCRYPT_LIBS])
10247 dnl ===================================================================
10248 dnl Check for system redland
10249 dnl ===================================================================
10250 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10251 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10252 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10253 if test "$with_system_redland" = "yes"; then
10254     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10255             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10256 else
10257     RAPTOR_MAJOR="0"
10258     RASQAL_MAJOR="3"
10259     REDLAND_MAJOR="0"
10261 AC_SUBST(RAPTOR_MAJOR)
10262 AC_SUBST(RASQAL_MAJOR)
10263 AC_SUBST(REDLAND_MAJOR)
10265 dnl ===================================================================
10266 dnl Check for system hunspell
10267 dnl ===================================================================
10268 AC_MSG_CHECKING([which libhunspell to use])
10269 if test "$_os" = iOS; then
10270    AC_MSG_RESULT([none])
10271 elif test "$with_system_hunspell" = "yes"; then
10272     AC_MSG_RESULT([external])
10273     SYSTEM_HUNSPELL=TRUE
10274     AC_LANG_PUSH([C++])
10275     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10276     if test "$HUNSPELL_PC" != "TRUE"; then
10277         AC_CHECK_HEADER(hunspell.hxx, [],
10278             [
10279             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10280             [AC_MSG_ERROR(hunspell headers not found.)], [])
10281             ], [])
10282         AC_CHECK_LIB([hunspell], [main], [:],
10283            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10284         HUNSPELL_LIBS=-lhunspell
10285     fi
10286     AC_LANG_POP([C++])
10287     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10288     FilterLibs "${HUNSPELL_LIBS}"
10289     HUNSPELL_LIBS="${filteredlibs}"
10290 else
10291     AC_MSG_RESULT([internal])
10292     SYSTEM_HUNSPELL=
10293     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10294     if test "$COM" = "MSC"; then
10295         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10296     else
10297         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10298     fi
10299     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10301 AC_SUBST(SYSTEM_HUNSPELL)
10302 AC_SUBST(HUNSPELL_CFLAGS)
10303 AC_SUBST(HUNSPELL_LIBS)
10305 dnl ===================================================================
10306 dnl Check for system qrcodegen
10307 dnl ===================================================================
10308 AC_MSG_CHECKING([which libqrcodegen to use])
10309 if test "$with_system_qrcodegen" = "yes"; then
10310     AC_MSG_RESULT([external])
10311     SYSTEM_QRCODEGEN=TRUE
10312     AC_LANG_PUSH([C++])
10313     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10314         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10315     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10316         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10317     QRCODEGEN_LIBS=-lqrcodegencpp
10318     AC_LANG_POP([C++])
10319     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10320     FilterLibs "${QRCODEGEN_LIBS}"
10321     QRCODEGEN_LIBS="${filteredlibs}"
10322 else
10323     AC_MSG_RESULT([internal])
10324     SYSTEM_QRCODEGEN=
10325     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10327 AC_SUBST(SYSTEM_QRCODEGEN)
10328 AC_SUBST(QRCODEGEN_CFLAGS)
10329 AC_SUBST(QRCODEGEN_LIBS)
10331 dnl ===================================================================
10332 dnl Check for system box2d
10333 dnl ===================================================================
10334 AC_MSG_CHECKING([which box2d to use])
10335 if test "$with_system_box2d" = "yes"; then
10336     AC_MSG_RESULT([external])
10337     SYSTEM_BOX2D=TRUE
10338     AC_LANG_PUSH([C++])
10339     AC_CHECK_HEADER(Box2D/Box2D.h, [],
10340         [AC_MSG_ERROR(box2d headers not found.)], [])
10341     AC_CHECK_LIB([Box2D], [main], [:],
10342         [ AC_MSG_ERROR(box2d library not found.) ], [])
10343     BOX2D_LIBS=-lBox2D
10344     AC_LANG_POP([C++])
10345     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10346     FilterLibs "${BOX2D_LIBS}"
10347     BOX2D_LIBS="${filteredlibs}"
10348 else
10349     AC_MSG_RESULT([internal])
10350     SYSTEM_BOX2D=
10351     BUILD_TYPE="$BUILD_TYPE BOX2D"
10353 AC_SUBST(SYSTEM_BOX2D)
10354 AC_SUBST(BOX2D_CFLAGS)
10355 AC_SUBST(BOX2D_LIBS)
10357 dnl ===================================================================
10358 dnl Checking for altlinuxhyph
10359 dnl ===================================================================
10360 AC_MSG_CHECKING([which altlinuxhyph to use])
10361 if test "$with_system_altlinuxhyph" = "yes"; then
10362     AC_MSG_RESULT([external])
10363     SYSTEM_HYPH=TRUE
10364     AC_CHECK_HEADER(hyphen.h, [],
10365        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10366     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10367        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10368        [#include <hyphen.h>])
10369     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10370         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10371     if test -z "$HYPHEN_LIB"; then
10372         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10373            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10374     fi
10375     if test -z "$HYPHEN_LIB"; then
10376         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10377            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10378     fi
10379 else
10380     AC_MSG_RESULT([internal])
10381     SYSTEM_HYPH=
10382     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10383     if test "$COM" = "MSC"; then
10384         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10385     else
10386         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10387     fi
10389 AC_SUBST(SYSTEM_HYPH)
10390 AC_SUBST(HYPHEN_LIB)
10392 dnl ===================================================================
10393 dnl Checking for mythes
10394 dnl ===================================================================
10395 AC_MSG_CHECKING([which mythes to use])
10396 if test "$_os" = iOS; then
10397    AC_MSG_RESULT([none])
10398 elif test "$with_system_mythes" = "yes"; then
10399     AC_MSG_RESULT([external])
10400     SYSTEM_MYTHES=TRUE
10401     AC_LANG_PUSH([C++])
10402     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10403     if test "$MYTHES_PKGCONFIG" = "no"; then
10404         AC_CHECK_HEADER(mythes.hxx, [],
10405             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10406         AC_CHECK_LIB([mythes-1.2], [main], [:],
10407             [ MYTHES_FOUND=no], [])
10408     if test "$MYTHES_FOUND" = "no"; then
10409         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10410                 [ MYTHES_FOUND=no], [])
10411     fi
10412     if test "$MYTHES_FOUND" = "no"; then
10413         AC_MSG_ERROR([mythes library not found!.])
10414     fi
10415     fi
10416     AC_LANG_POP([C++])
10417     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10418     FilterLibs "${MYTHES_LIBS}"
10419     MYTHES_LIBS="${filteredlibs}"
10420 else
10421     AC_MSG_RESULT([internal])
10422     SYSTEM_MYTHES=
10423     BUILD_TYPE="$BUILD_TYPE MYTHES"
10424     if test "$COM" = "MSC"; then
10425         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10426     else
10427         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10428     fi
10430 AC_SUBST(SYSTEM_MYTHES)
10431 AC_SUBST(MYTHES_CFLAGS)
10432 AC_SUBST(MYTHES_LIBS)
10434 dnl ===================================================================
10435 dnl How should we build the linear programming solver ?
10436 dnl ===================================================================
10438 ENABLE_COINMP=
10439 AC_MSG_CHECKING([whether to build with CoinMP])
10440 if test "$enable_coinmp" != "no"; then
10441     ENABLE_COINMP=TRUE
10442     AC_MSG_RESULT([yes])
10443     if test "$with_system_coinmp" = "yes"; then
10444         SYSTEM_COINMP=TRUE
10445         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10446         FilterLibs "${COINMP_LIBS}"
10447         COINMP_LIBS="${filteredlibs}"
10448     else
10449         BUILD_TYPE="$BUILD_TYPE COINMP"
10450     fi
10451 else
10452     AC_MSG_RESULT([no])
10454 AC_SUBST(ENABLE_COINMP)
10455 AC_SUBST(SYSTEM_COINMP)
10456 AC_SUBST(COINMP_CFLAGS)
10457 AC_SUBST(COINMP_LIBS)
10459 ENABLE_LPSOLVE=
10460 AC_MSG_CHECKING([whether to build with lpsolve])
10461 if test "$enable_lpsolve" != "no"; then
10462     ENABLE_LPSOLVE=TRUE
10463     AC_MSG_RESULT([yes])
10464 else
10465     AC_MSG_RESULT([no])
10467 AC_SUBST(ENABLE_LPSOLVE)
10469 if test "$ENABLE_LPSOLVE" = TRUE; then
10470     AC_MSG_CHECKING([which lpsolve to use])
10471     if test "$with_system_lpsolve" = "yes"; then
10472         AC_MSG_RESULT([external])
10473         SYSTEM_LPSOLVE=TRUE
10474         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10475            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10476         save_LIBS=$LIBS
10477         # some systems need this. Like Ubuntu...
10478         AC_CHECK_LIB(m, floor)
10479         AC_CHECK_LIB(dl, dlopen)
10480         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10481             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10482         LIBS=$save_LIBS
10483     else
10484         AC_MSG_RESULT([internal])
10485         SYSTEM_LPSOLVE=
10486         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10487     fi
10489 AC_SUBST(SYSTEM_LPSOLVE)
10491 dnl ===================================================================
10492 dnl Checking for libexttextcat
10493 dnl ===================================================================
10494 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10495 if test "$with_system_libexttextcat" = "yes"; then
10496     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10498 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10500 dnl ===================================================================
10501 dnl Checking for libnumbertext
10502 dnl ===================================================================
10503 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10504 if test "$with_system_libnumbertext" = "yes"; then
10505     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10506     SYSTEM_LIBNUMBERTEXT=YES
10507 else
10508     SYSTEM_LIBNUMBERTEXT=
10509     AC_LANG_PUSH([C++])
10510     save_CPPFLAGS=$CPPFLAGS
10511     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10512     AC_CHECK_HEADERS([codecvt regex])
10513     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10514             [ LIBNUMBERTEXT_CFLAGS=''
10515               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10516                            Enable libnumbertext fallback (missing number to number name conversion).])
10517             ])
10518     CPPFLAGS=$save_CPPFLAGS
10519     AC_LANG_POP([C++])
10521 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10522 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10523 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10525 dnl ***************************************
10526 dnl testing libc version for Linux...
10527 dnl ***************************************
10528 if test "$_os" = "Linux"; then
10529     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10530     exec 6>/dev/null # no output
10531     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10532     exec 6>&1 # output on again
10533     if test "$HAVE_LIBC"; then
10534         AC_MSG_RESULT([yes])
10535     else
10536         AC_MSG_ERROR([no, upgrade libc])
10537     fi
10540 dnl =========================================
10541 dnl Check for uuidgen
10542 dnl =========================================
10543 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10544     # presence is already tested above in the WINDOWS_SDK_HOME check
10545     UUIDGEN=uuidgen.exe
10546     AC_SUBST(UUIDGEN)
10547 else
10548     AC_PATH_PROG([UUIDGEN], [uuidgen])
10549     if test -z "$UUIDGEN"; then
10550         AC_MSG_WARN([uuid is needed for building installation sets])
10551     fi
10554 dnl ***************************************
10555 dnl Checking for bison and flex
10556 dnl ***************************************
10557 AC_PATH_PROG(BISON, bison)
10558 if test -z "$BISON"; then
10559     AC_MSG_ERROR([no bison found in \$PATH, install it])
10560 else
10561     AC_MSG_CHECKING([the bison version])
10562     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10563     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10564     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
10565     dnl cause
10566     dnl
10567     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]
10568     dnl   typedef union YYSTYPE
10569     dnl           ~~~~~~^~~~~~~
10570     dnl
10571     dnl while at least 3.4.1 is know to be good:
10572     if test "$COMPILER_PLUGINS" = TRUE; then
10573         if test "$_bison_longver" -lt 2004; then
10574             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
10575         fi
10576     else
10577         if test "$_bison_longver" -lt 2000; then
10578             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10579         fi
10580     fi
10582 AC_SUBST([BISON])
10584 AC_PATH_PROG(FLEX, flex)
10585 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10586     FLEX=`cygpath -m $FLEX`
10588 if test -z "$FLEX"; then
10589     AC_MSG_ERROR([no flex found in \$PATH, install it])
10590 else
10591     AC_MSG_CHECKING([the flex version])
10592     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10593     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10594         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10595     fi
10597 AC_SUBST([FLEX])
10598 dnl ***************************************
10599 dnl Checking for patch
10600 dnl ***************************************
10601 AC_PATH_PROG(PATCH, patch)
10602 if test -z "$PATCH"; then
10603     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10606 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10607 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10608     if test -z "$with_gnu_patch"; then
10609         GNUPATCH=$PATCH
10610     else
10611         if test -x "$with_gnu_patch"; then
10612             GNUPATCH=$with_gnu_patch
10613         else
10614             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10615         fi
10616     fi
10618     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10619     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10620         AC_MSG_RESULT([yes])
10621     else
10622         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10623     fi
10624 else
10625     GNUPATCH=$PATCH
10628 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10629     GNUPATCH=`cygpath -m $GNUPATCH`
10632 dnl We also need to check for --with-gnu-cp
10634 if test -z "$with_gnu_cp"; then
10635     # check the place where the good stuff is hidden on Solaris...
10636     if test -x /usr/gnu/bin/cp; then
10637         GNUCP=/usr/gnu/bin/cp
10638     else
10639         AC_PATH_PROGS(GNUCP, gnucp cp)
10640     fi
10641     if test -z $GNUCP; then
10642         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10643     fi
10644 else
10645     if test -x "$with_gnu_cp"; then
10646         GNUCP=$with_gnu_cp
10647     else
10648         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10649     fi
10652 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10653     GNUCP=`cygpath -m $GNUCP`
10656 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10657 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10658     AC_MSG_RESULT([yes])
10659 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10660     AC_MSG_RESULT([yes])
10661 else
10662     case "$build_os" in
10663     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10664         x_GNUCP=[\#]
10665         GNUCP=''
10666         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10667         ;;
10668     *)
10669         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10670         ;;
10671     esac
10674 AC_SUBST(GNUPATCH)
10675 AC_SUBST(GNUCP)
10676 AC_SUBST(x_GNUCP)
10678 dnl ***************************************
10679 dnl testing assembler path
10680 dnl ***************************************
10681 ML_EXE=""
10682 if test "$_os" = "WINNT"; then
10683     if test "$BITNESS_OVERRIDE" = ""; then
10684         assembler=ml.exe
10685     else
10686         assembler=ml64.exe
10687     fi
10689     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10690     if test -f "$CL_PATH/$assembler"; then
10691         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10692         AC_MSG_RESULT([$ML_EXE])
10693     else
10694         AC_MSG_ERROR([not found])
10695     fi
10698 AC_SUBST(ML_EXE)
10700 dnl ===================================================================
10701 dnl We need zip and unzip
10702 dnl ===================================================================
10703 AC_PATH_PROG(ZIP, zip)
10704 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10705 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10706     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],,)
10709 AC_PATH_PROG(UNZIP, unzip)
10710 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10712 dnl ===================================================================
10713 dnl Zip must be a specific type for different build types.
10714 dnl ===================================================================
10715 if test $build_os = cygwin; then
10716     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10717         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10718     fi
10721 dnl ===================================================================
10722 dnl We need touch with -h option support.
10723 dnl ===================================================================
10724 AC_PATH_PROG(TOUCH, touch)
10725 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10726 touch warn
10727 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10728     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],,)
10731 dnl ===================================================================
10732 dnl Check for system epoxy
10733 dnl ===================================================================
10734 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10736 dnl ===================================================================
10737 dnl Set vcl option: coordinate device in double or sal_Int32
10738 dnl ===================================================================
10740 dnl disabled for now, we don't want subtle differences between OSs
10741 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10742 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10743 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10744 dnl     AC_MSG_RESULT([double])
10745 dnl else
10746 dnl     AC_MSG_RESULT([sal_Int32])
10747 dnl fi
10749 dnl ===================================================================
10750 dnl Test which vclplugs have to be built.
10751 dnl ===================================================================
10752 R=""
10753 if test "$USING_X11" != TRUE; then
10754     enable_gtk3=no
10757 ENABLE_GTK3=""
10758 if test "x$enable_gtk3" = "xyes"; then
10759     ENABLE_GTK3="TRUE"
10760     AC_DEFINE(ENABLE_GTK3)
10761     R="$R gtk3"
10763 AC_SUBST(ENABLE_GTK3)
10765 ENABLE_GTK3_KDE5=""
10766 if test "x$enable_gtk3_kde5" = "xyes"; then
10767     ENABLE_GTK3_KDE5="TRUE"
10768     AC_DEFINE(ENABLE_GTK3_KDE5)
10769     R="$R gtk3_kde5"
10771 AC_SUBST(ENABLE_GTK3_KDE5)
10773 ENABLE_QT5=""
10774 if test "x$enable_qt5" = "xyes"; then
10775     ENABLE_QT5="TRUE"
10776     AC_DEFINE(ENABLE_QT5)
10777     R="$R qt5"
10779 AC_SUBST(ENABLE_QT5)
10781 ENABLE_KF5=""
10782 if test "x$enable_kf5" = "xyes"; then
10783     ENABLE_KF5="TRUE"
10784     AC_DEFINE(ENABLE_KF5)
10785     R="$R kf5"
10787 AC_SUBST(ENABLE_KF5)
10789 GTK3_CFLAGS=""
10790 GTK3_LIBS=""
10791 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
10792     if test "$with_system_cairo" = no; then
10793         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10794     fi
10795     : ${with_system_cairo:=yes}
10796     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)
10797     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10798     FilterLibs "${GTK3_LIBS}"
10799     GTK3_LIBS="${filteredlibs}"
10801     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10802     if test "$with_system_epoxy" != "yes"; then
10803         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10804         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10805                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10806     fi
10808 AC_SUBST(GTK3_LIBS)
10809 AC_SUBST(GTK3_CFLAGS)
10811 if test "$enable_introspection" = yes; then
10812     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
10813         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10814     else
10815         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10816     fi
10819 if test "$_os" = "WINNT"; then
10820     R="$R win"
10821 elif test "$_os" = "Darwin"; then
10822     R="$R osx"
10823 elif test "$_os" = "iOS"; then
10824     R="ios (builtin)"
10827 build_vcl_plugins="$R"
10828 if test -z "$build_vcl_plugins"; then
10829     build_vcl_plugins="none"
10831 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10833 dnl ===================================================================
10834 dnl check for dbus support
10835 dnl ===================================================================
10836 ENABLE_DBUS=""
10837 DBUS_CFLAGS=""
10838 DBUS_LIBS=""
10839 DBUS_GLIB_CFLAGS=""
10840 DBUS_GLIB_LIBS=""
10841 DBUS_HAVE_GLIB=""
10843 if test "$enable_dbus" = "no"; then
10844     test_dbus=no
10847 AC_MSG_CHECKING([whether to enable DBUS support])
10848 if test "$test_dbus" = "yes"; then
10849     ENABLE_DBUS="TRUE"
10850     AC_MSG_RESULT([yes])
10851     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10852     AC_DEFINE(ENABLE_DBUS)
10853     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10854     FilterLibs "${DBUS_LIBS}"
10855     DBUS_LIBS="${filteredlibs}"
10857     # Glib is needed for BluetoothServer
10858     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10859     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10860         [
10861             DBUS_HAVE_GLIB="TRUE"
10862             AC_DEFINE(DBUS_HAVE_GLIB,1)
10863         ],
10864         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10865     )
10866 else
10867     AC_MSG_RESULT([no])
10870 AC_SUBST(ENABLE_DBUS)
10871 AC_SUBST(DBUS_CFLAGS)
10872 AC_SUBST(DBUS_LIBS)
10873 AC_SUBST(DBUS_GLIB_CFLAGS)
10874 AC_SUBST(DBUS_GLIB_LIBS)
10875 AC_SUBST(DBUS_HAVE_GLIB)
10877 AC_MSG_CHECKING([whether to enable Impress remote control])
10878 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10879     AC_MSG_RESULT([yes])
10880     ENABLE_SDREMOTE=TRUE
10881     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10883     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
10884         # The Bluetooth code doesn't compile with macOS SDK 10.15
10885         if test "$enable_sdremote_bluetooth" = yes; then
10886             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
10887         fi
10888         enable_sdremote_bluetooth=no
10889     fi
10890     # If not explicitly enabled or disabled, default
10891     if test -z "$enable_sdremote_bluetooth"; then
10892         case "$OS" in
10893         LINUX|MACOSX|WNT)
10894             # Default to yes for these
10895             enable_sdremote_bluetooth=yes
10896             ;;
10897         *)
10898             # otherwise no
10899             enable_sdremote_bluetooth=no
10900             ;;
10901         esac
10902     fi
10903     # $enable_sdremote_bluetooth is guaranteed non-empty now
10905     if test "$enable_sdremote_bluetooth" != "no"; then
10906         if test "$OS" = "LINUX"; then
10907             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10908                 AC_MSG_RESULT([yes])
10909                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10910                 dnl ===================================================================
10911                 dnl Check for system bluez
10912                 dnl ===================================================================
10913                 AC_MSG_CHECKING([which Bluetooth header to use])
10914                 if test "$with_system_bluez" = "yes"; then
10915                     AC_MSG_RESULT([external])
10916                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10917                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10918                     SYSTEM_BLUEZ=TRUE
10919                 else
10920                     AC_MSG_RESULT([internal])
10921                     SYSTEM_BLUEZ=
10922                 fi
10923             else
10924                 AC_MSG_RESULT([no, dbus disabled])
10925                 ENABLE_SDREMOTE_BLUETOOTH=
10926                 SYSTEM_BLUEZ=
10927             fi
10928         else
10929             AC_MSG_RESULT([yes])
10930             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10931             SYSTEM_BLUEZ=
10932         fi
10933     else
10934         AC_MSG_RESULT([no])
10935         ENABLE_SDREMOTE_BLUETOOTH=
10936         SYSTEM_BLUEZ=
10937     fi
10938 else
10939     ENABLE_SDREMOTE=
10940     SYSTEM_BLUEZ=
10941     AC_MSG_RESULT([no])
10943 AC_SUBST(ENABLE_SDREMOTE)
10944 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10945 AC_SUBST(SYSTEM_BLUEZ)
10947 dnl ===================================================================
10948 dnl Check whether to enable GIO support
10949 dnl ===================================================================
10950 if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
10951     AC_MSG_CHECKING([whether to enable GIO support])
10952     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10953         dnl Need at least 2.26 for the dbus support.
10954         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10955                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10956         if test "$ENABLE_GIO" = "TRUE"; then
10957             AC_DEFINE(ENABLE_GIO)
10958             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10959             FilterLibs "${GIO_LIBS}"
10960             GIO_LIBS="${filteredlibs}"
10961         fi
10962     else
10963         AC_MSG_RESULT([no])
10964     fi
10966 AC_SUBST(ENABLE_GIO)
10967 AC_SUBST(GIO_CFLAGS)
10968 AC_SUBST(GIO_LIBS)
10971 dnl ===================================================================
10973 SPLIT_APP_MODULES=""
10974 if test "$enable_split_app_modules" = "yes"; then
10975     SPLIT_APP_MODULES="TRUE"
10977 AC_SUBST(SPLIT_APP_MODULES)
10979 SPLIT_OPT_FEATURES=""
10980 if test "$enable_split_opt_features" = "yes"; then
10981     SPLIT_OPT_FEATURES="TRUE"
10983 AC_SUBST(SPLIT_OPT_FEATURES)
10985 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10986     if test "$enable_cairo_canvas" = yes; then
10987         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10988     fi
10989     enable_cairo_canvas=no
10990 elif test -z "$enable_cairo_canvas"; then
10991     enable_cairo_canvas=yes
10994 ENABLE_CAIRO_CANVAS=""
10995 if test "$enable_cairo_canvas" = "yes"; then
10996     test_cairo=yes
10997     ENABLE_CAIRO_CANVAS="TRUE"
10998     AC_DEFINE(ENABLE_CAIRO_CANVAS)
11000 AC_SUBST(ENABLE_CAIRO_CANVAS)
11002 dnl ===================================================================
11003 dnl Check whether the GStreamer libraries are available.
11004 dnl ===================================================================
11006 ENABLE_GSTREAMER_1_0=""
11008 if test "$build_gstreamer_1_0" = "yes"; then
11010     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11011     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11012         ENABLE_GSTREAMER_1_0="TRUE"
11013         AC_MSG_RESULT([yes])
11014         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11015         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11016         FilterLibs "${GSTREAMER_1_0_LIBS}"
11017         GSTREAMER_1_0_LIBS="${filteredlibs}"
11018         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11019     else
11020         AC_MSG_RESULT([no])
11021     fi
11023 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11024 AC_SUBST(GSTREAMER_1_0_LIBS)
11025 AC_SUBST(ENABLE_GSTREAMER_1_0)
11027 dnl ===================================================================
11028 dnl Check whether to build the VLC avmedia backend
11029 dnl ===================================================================
11031 ENABLE_VLC=""
11033 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
11034 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
11035     ENABLE_VLC="TRUE"
11036     AC_MSG_RESULT([yes])
11037 else
11038     AC_MSG_RESULT([no])
11040 AC_SUBST(ENABLE_VLC)
11042 ENABLE_OPENGL_TRANSITIONS=
11043 ENABLE_OPENGL_CANVAS=
11044 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11045    : # disable
11046 elif test "$_os" = "Darwin"; then
11047     # We use frameworks on macOS, no need for detail checks
11048     ENABLE_OPENGL_TRANSITIONS=TRUE
11049     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11050     ENABLE_OPENGL_CANVAS=TRUE
11051 elif test $_os = WINNT; then
11052     ENABLE_OPENGL_TRANSITIONS=TRUE
11053     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11054     ENABLE_OPENGL_CANVAS=TRUE
11055 else
11056     if test "$USING_X11" = TRUE; then
11057         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11058         ENABLE_OPENGL_TRANSITIONS=TRUE
11059         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11060         ENABLE_OPENGL_CANVAS=TRUE
11061     fi
11064 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11065 AC_SUBST(ENABLE_OPENGL_CANVAS)
11067 dnl =================================================
11068 dnl Check whether to build with OpenCL support.
11069 dnl =================================================
11071 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
11072     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11073     # platform (optional at run-time, used through clew).
11074     BUILD_TYPE="$BUILD_TYPE OPENCL"
11075     AC_DEFINE(HAVE_FEATURE_OPENCL)
11078 dnl =================================================
11079 dnl Check whether to build with dconf support.
11080 dnl =================================================
11082 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11083     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11084         if test "$enable_dconf" = yes; then
11085             AC_MSG_ERROR([dconf not found])
11086         else
11087             enable_dconf=no
11088         fi])
11090 AC_MSG_CHECKING([whether to enable dconf])
11091 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11092     DCONF_CFLAGS=
11093     DCONF_LIBS=
11094     ENABLE_DCONF=
11095     AC_MSG_RESULT([no])
11096 else
11097     ENABLE_DCONF=TRUE
11098     AC_DEFINE(ENABLE_DCONF)
11099     AC_MSG_RESULT([yes])
11101 AC_SUBST([DCONF_CFLAGS])
11102 AC_SUBST([DCONF_LIBS])
11103 AC_SUBST([ENABLE_DCONF])
11105 # pdf import?
11106 AC_MSG_CHECKING([whether to build the PDF import feature])
11107 ENABLE_PDFIMPORT=
11108 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
11109     AC_MSG_RESULT([yes])
11110     ENABLE_PDFIMPORT=TRUE
11111     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11112 else
11113     AC_MSG_RESULT([no])
11116 # Pdfium?
11117 AC_MSG_CHECKING([whether to build PDFium])
11118 ENABLE_PDFIUM=
11119 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11120     AC_MSG_RESULT([yes])
11121     ENABLE_PDFIUM=TRUE
11122     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11123     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11124 else
11125     AC_MSG_RESULT([no])
11127 AC_SUBST(ENABLE_PDFIUM)
11129 dnl ===================================================================
11130 dnl Check for poppler
11131 dnl ===================================================================
11132 ENABLE_POPPLER=
11133 AC_MSG_CHECKING([whether to build Poppler])
11134 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11135     AC_MSG_RESULT([yes])
11136     ENABLE_POPPLER=TRUE
11137     AC_DEFINE(HAVE_FEATURE_POPPLER)
11138 else
11139     AC_MSG_RESULT([no])
11141 AC_SUBST(ENABLE_POPPLER)
11143 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11144     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11147 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11148     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11151 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11152     dnl ===================================================================
11153     dnl Check for system poppler
11154     dnl ===================================================================
11155     AC_MSG_CHECKING([which PDF import poppler to use])
11156     if test "$with_system_poppler" = "yes"; then
11157         AC_MSG_RESULT([external])
11158         SYSTEM_POPPLER=TRUE
11159         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11160         AC_LANG_PUSH([C++])
11161         save_CXXFLAGS=$CXXFLAGS
11162         save_CPPFLAGS=$CPPFLAGS
11163         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11164         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11165         AC_CHECK_HEADER([cpp/poppler-version.h],
11166             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11167             [])
11168         CXXFLAGS=$save_CXXFLAGS
11169         CPPFLAGS=$save_CPPFLAGS
11170         AC_LANG_POP([C++])
11171         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11173         FilterLibs "${POPPLER_LIBS}"
11174         POPPLER_LIBS="${filteredlibs}"
11175     else
11176         AC_MSG_RESULT([internal])
11177         SYSTEM_POPPLER=
11178         BUILD_TYPE="$BUILD_TYPE POPPLER"
11179         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11180     fi
11181     AC_DEFINE([ENABLE_PDFIMPORT],1)
11183 AC_SUBST(ENABLE_PDFIMPORT)
11184 AC_SUBST(SYSTEM_POPPLER)
11185 AC_SUBST(POPPLER_CFLAGS)
11186 AC_SUBST(POPPLER_LIBS)
11188 # Skia?
11189 AC_MSG_CHECKING([whether to build Skia])
11190 ENABLE_SKIA=
11191 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
11192     if test "$enable_skia" = "debug"; then
11193         AC_MSG_RESULT([yes (debug)])
11194         ENABLE_SKIA_DEBUG=TRUE
11195     else
11196         AC_MSG_RESULT([yes])
11197         ENABLE_SKIA_DEBUG=
11198     fi
11199     ENABLE_SKIA=TRUE
11200     AC_DEFINE(HAVE_FEATURE_SKIA)
11201     BUILD_TYPE="$BUILD_TYPE SKIA"
11202 else
11203     AC_MSG_RESULT([no])
11205 AC_SUBST(ENABLE_SKIA)
11206 AC_SUBST(ENABLE_SKIA_DEBUG)
11208 CLANG_CXXFLAGS_INTRINSICS_SSE2=
11209 CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11210 CLANG_CXXFLAGS_INTRINSICS_SSE41=
11211 CLANG_CXXFLAGS_INTRINSICS_SSE42=
11212 CLANG_CXXFLAGS_INTRINSICS_AVX=
11213 CLANG_CXXFLAGS_INTRINSICS_AVX2=
11214 CLANG_CXXFLAGS_INTRINSICS_AVX512=
11215 CLANG_CXXFLAGS_INTRINSICS_F16C=
11216 CLANG_CXXFLAGS_INTRINSICS_FMA=
11218 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
11219     if test -n "$CLANG_CC" -a -n "$CLANG_CXX"; then
11220         AC_MSG_CHECKING([for Clang])
11221         AC_MSG_RESULT([$CLANG_CC / $CLANG_CXX])
11222     else
11223         if test "$_os" = "WINNT"; then
11224             AC_MSG_CHECKING([for clang-cl])
11225             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11226                 CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11227                 dnl explicitly set -m32/-m64
11228                 if test "$BITNESS_OVERRIDE" = ""; then
11229                     CLANG_CC="$CLANG_CC -m32"
11230                 else
11231                     CLANG_CC="$CLANG_CC -m64"
11232                 fi
11233                 CLANG_CXX="$CLANG_CC"
11234                 AC_MSG_RESULT([$CLANG_CC])
11235             else
11236                 AC_MSG_RESULT([no])
11237             fi
11238         else
11239             AC_CHECK_PROG(CLANG_CC,clang,clang,[])
11240             AC_CHECK_PROG(CLANG_CXX,clang++,clang++,[])
11241         fi
11242     fi
11243     if test -n "$CLANG_CC" -a -n "$CLANG_CXX"; then
11244         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CLANG_CC -E - | tail -1 | sed 's/ //g'`
11245         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11246         if test "$clang2_ver" -lt 50002; then
11247             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11248             CLANG_CC=
11249             CLANG_CXX=
11250         fi
11251     fi
11252     if test -z "$CLANG_CC" -o -z "$CLANG_CXX"; then
11253         # Skia is the default on Windows, so hard-require Clang.
11254         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11255         if test "$_os" = "WINNT"; then
11256             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11257         else
11258             AC_MSG_WARN([Clang compiler not found.])
11259         fi
11260     else
11262         save_CXX="$CXX"
11263         CXX="$CLANG_CXX"
11264         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11265         flag_sse2=-msse2
11266         flag_ssse3=-mssse3
11267         flag_sse41=-msse4.1
11268         flag_sse42=-msse4.2
11269         flag_avx=-mavx
11270         flag_avx2=-mavx2
11271         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
11272         flag_f16c=-mf16c
11273         flag_fma=-mfma
11275         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11276         AC_LANG_PUSH([C++])
11277         save_CXXFLAGS=$CXXFLAGS
11278         CXXFLAGS="$CXXFLAGS $flag_sse2"
11279         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11280             #include <emmintrin.h>
11281             int main () {
11282                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11283                 c = _mm_xor_si128 (a, b);
11284                 return 0;
11285             }
11286             ])],
11287             [can_compile_sse2=yes],
11288             [can_compile_sse2=no])
11289         AC_LANG_POP([C++])
11290         CXXFLAGS=$save_CXXFLAGS
11291         AC_MSG_RESULT([${can_compile_sse2}])
11292         if test "${can_compile_sse2}" = "yes" ; then
11293             CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11294         fi
11296         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11297         AC_LANG_PUSH([C++])
11298         save_CXXFLAGS=$CXXFLAGS
11299         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11300         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11301             #include <tmmintrin.h>
11302             int main () {
11303                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11304                 c = _mm_maddubs_epi16 (a, b);
11305                 return 0;
11306             }
11307             ])],
11308             [can_compile_ssse3=yes],
11309             [can_compile_ssse3=no])
11310         AC_LANG_POP([C++])
11311         CXXFLAGS=$save_CXXFLAGS
11312         AC_MSG_RESULT([${can_compile_ssse3}])
11313         if test "${can_compile_ssse3}" = "yes" ; then
11314             CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
11315         fi
11317         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
11318         AC_LANG_PUSH([C++])
11319         save_CXXFLAGS=$CXXFLAGS
11320         CXXFLAGS="$CXXFLAGS $flag_sse41"
11321         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11322             #include <smmintrin.h>
11323             int main () {
11324                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11325                 c = _mm_cmpeq_epi64 (a, b);
11326                 return 0;
11327             }
11328             ])],
11329             [can_compile_sse41=yes],
11330             [can_compile_sse41=no])
11331         AC_LANG_POP([C++])
11332         CXXFLAGS=$save_CXXFLAGS
11333         AC_MSG_RESULT([${can_compile_sse41}])
11334         if test "${can_compile_sse41}" = "yes" ; then
11335             CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
11336         fi
11338         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
11339         AC_LANG_PUSH([C++])
11340         save_CXXFLAGS=$CXXFLAGS
11341         CXXFLAGS="$CXXFLAGS $flag_sse42"
11342         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11343             #include <nmmintrin.h>
11344             int main () {
11345                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11346                 c = _mm_cmpgt_epi64 (a, b);
11347                 return 0;
11348             }
11349             ])],
11350             [can_compile_sse42=yes],
11351             [can_compile_sse42=no])
11352         AC_LANG_POP([C++])
11353         CXXFLAGS=$save_CXXFLAGS
11354         AC_MSG_RESULT([${can_compile_sse42}])
11355         if test "${can_compile_sse42}" = "yes" ; then
11356             CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
11357         fi
11359         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
11360         AC_LANG_PUSH([C++])
11361         save_CXXFLAGS=$CXXFLAGS
11362         CXXFLAGS="$CXXFLAGS $flag_avx"
11363         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11364             #include <immintrin.h>
11365             int main () {
11366                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
11367                 c = _mm256_xor_ps(a, b);
11368                 return 0;
11369             }
11370             ])],
11371             [can_compile_avx=yes],
11372             [can_compile_avx=no])
11373         AC_LANG_POP([C++])
11374         CXXFLAGS=$save_CXXFLAGS
11375         AC_MSG_RESULT([${can_compile_avx}])
11376         if test "${can_compile_avx}" = "yes" ; then
11377             CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
11378         fi
11380         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
11381         AC_LANG_PUSH([C++])
11382         save_CXXFLAGS=$CXXFLAGS
11383         CXXFLAGS="$CXXFLAGS $flag_avx2"
11384         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11385             #include <immintrin.h>
11386             int main () {
11387                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
11388                 c = _mm256_maddubs_epi16(a, b);
11389                 return 0;
11390             }
11391             ])],
11392             [can_compile_avx2=yes],
11393             [can_compile_avx2=no])
11394         AC_LANG_POP([C++])
11395         CXXFLAGS=$save_CXXFLAGS
11396         AC_MSG_RESULT([${can_compile_avx2}])
11397         if test "${can_compile_avx2}" = "yes" ; then
11398             CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
11399         fi
11401         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
11402         AC_LANG_PUSH([C++])
11403         save_CXXFLAGS=$CXXFLAGS
11404         CXXFLAGS="$CXXFLAGS $flag_avx512"
11405         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11406             #include <immintrin.h>
11407             int main () {
11408                 __m512i a = _mm512_loadu_si512(0);
11409                 return 0;
11410             }
11411             ])],
11412             [can_compile_avx512=yes],
11413             [can_compile_avx512=no])
11414         AC_LANG_POP([C++])
11415         CXXFLAGS=$save_CXXFLAGS
11416         AC_MSG_RESULT([${can_compile_avx512}])
11417         if test "${can_compile_avx512}" = "yes" ; then
11418             CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
11419         fi
11421         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
11422         AC_LANG_PUSH([C++])
11423         save_CXXFLAGS=$CXXFLAGS
11424         CXXFLAGS="$CXXFLAGS $flag_f16c"
11425         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11426             #include <immintrin.h>
11427             int main () {
11428                 __m128i a = _mm_set1_epi32 (0);
11429                 __m128 c;
11430                 c = _mm_cvtph_ps(a);
11431                 return 0;
11432             }
11433             ])],
11434             [can_compile_f16c=yes],
11435             [can_compile_f16c=no])
11436         AC_LANG_POP([C++])
11437         CXXFLAGS=$save_CXXFLAGS
11438         AC_MSG_RESULT([${can_compile_f16c}])
11439         if test "${can_compile_f16c}" = "yes" ; then
11440             CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
11441         fi
11443         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
11444         AC_LANG_PUSH([C++])
11445         save_CXXFLAGS=$CXXFLAGS
11446         CXXFLAGS="$CXXFLAGS $flag_fma"
11447         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11448             #include <immintrin.h>
11449             int main () {
11450                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
11451                 d = _mm256_fmadd_ps(a, b, c);
11452                 return 0;
11453             }
11454             ])],
11455             [can_compile_fma=yes],
11456             [can_compile_fma=no])
11457         AC_LANG_POP([C++])
11458         CXXFLAGS=$save_CXXFLAGS
11459         AC_MSG_RESULT([${can_compile_fma}])
11460         if test "${can_compile_fma}" = "yes" ; then
11461             CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
11462         fi
11464         CXX="$save_CXX"
11465     fi
11467 AC_SUBST(CLANG_CC)
11468 AC_SUBST(CLANG_CXX)
11469 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE2)
11470 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSSE3)
11471 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE41)
11472 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE42)
11473 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX)
11474 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX2)
11475 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX512)
11476 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_F16C)
11477 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_FMA)
11479 SYSTEM_GPGMEPP=
11481 if test "$enable_gpgmepp" = no; then
11482     AC_MSG_CHECKING([whether to enable gpgmepp])
11483     AC_MSG_RESULT([no])
11484 elif test "$enable_mpl_subset" = "yes"; then
11485     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11486     AC_MSG_RESULT([yes])
11487 elif test "$enable_fuzzers" = "yes"; then
11488     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11489     AC_MSG_RESULT([yes])
11490 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11491     dnl ===================================================================
11492     dnl Check for system gpgme
11493     dnl ===================================================================
11494     AC_MSG_CHECKING([which gpgmepp to use])
11495     if test "$with_system_gpgmepp" = "yes"; then
11496         AC_MSG_RESULT([external])
11497         SYSTEM_GPGMEPP=TRUE
11499         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11500         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11501             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11502         # progress_callback is the only func with plain C linkage
11503         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11504         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11505             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11506         AC_CHECK_HEADER(gpgme.h, [],
11507             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11508     else
11509         AC_MSG_RESULT([internal])
11510         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11511         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11513         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11514         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11515         if test "$_os" != "WINNT"; then
11516             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11517             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11518         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11519             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11520         fi
11521     fi
11522     ENABLE_GPGMEPP=TRUE
11523     AC_DEFINE([HAVE_FEATURE_GPGME])
11524     AC_PATH_PROG(GPG, gpg)
11525     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11526     # so let's exclude that manually for the moment
11527     if test -n "$GPG" -a "$_os" != "WINNT"; then
11528         # make sure we not only have a working gpgme, but a full working
11529         # gpg installation to run OpenPGP signature verification
11530         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11531     fi
11532     if test "$_os" = "Linux"; then
11533       uid=`id -u`
11534       AC_MSG_CHECKING([for /run/user/$uid])
11535       if test -d /run/user/$uid; then
11536         AC_MSG_RESULT([yes])
11537         AC_PATH_PROG(GPGCONF, gpgconf)
11539         # Older versions of gpgconf are not working as expected, since
11540         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11541         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11542         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11543         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11544         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11545         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11546         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11547           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11548           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11549           if $GPGCONF --dump-options > /dev/null ; then
11550             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11551               AC_MSG_RESULT([yes])
11552               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11553               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11554             else
11555               AC_MSG_RESULT([no])
11556             fi
11557           else
11558             AC_MSG_RESULT([no. missing or broken gpgconf?])
11559           fi
11560         else
11561           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11562         fi
11563       else
11564         AC_MSG_RESULT([no])
11565      fi
11566    fi
11568 AC_SUBST(ENABLE_GPGMEPP)
11569 AC_SUBST(SYSTEM_GPGMEPP)
11570 AC_SUBST(GPG_ERROR_CFLAGS)
11571 AC_SUBST(GPG_ERROR_LIBS)
11572 AC_SUBST(LIBASSUAN_CFLAGS)
11573 AC_SUBST(LIBASSUAN_LIBS)
11574 AC_SUBST(GPGMEPP_CFLAGS)
11575 AC_SUBST(GPGMEPP_LIBS)
11577 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11578 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11579     AC_MSG_RESULT([yes])
11580     ENABLE_MEDIAWIKI=TRUE
11581     BUILD_TYPE="$BUILD_TYPE XSLTML"
11582     if test  "x$with_java" = "xno"; then
11583         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11584     fi
11585 else
11586     AC_MSG_RESULT([no])
11587     ENABLE_MEDIAWIKI=
11588     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11590 AC_SUBST(ENABLE_MEDIAWIKI)
11592 AC_MSG_CHECKING([whether to build the Report Builder])
11593 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11594     AC_MSG_RESULT([yes])
11595     ENABLE_REPORTBUILDER=TRUE
11596     AC_MSG_CHECKING([which jfreereport libs to use])
11597     if test "$with_system_jfreereport" = "yes"; then
11598         SYSTEM_JFREEREPORT=TRUE
11599         AC_MSG_RESULT([external])
11600         if test -z $SAC_JAR; then
11601             SAC_JAR=/usr/share/java/sac.jar
11602         fi
11603         if ! test -f $SAC_JAR; then
11604              AC_MSG_ERROR(sac.jar not found.)
11605         fi
11607         if test -z $LIBXML_JAR; then
11608             if test -f /usr/share/java/libxml-1.0.0.jar; then
11609                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11610             elif test -f /usr/share/java/libxml.jar; then
11611                 LIBXML_JAR=/usr/share/java/libxml.jar
11612             else
11613                 AC_MSG_ERROR(libxml.jar replacement not found.)
11614             fi
11615         elif ! test -f $LIBXML_JAR; then
11616             AC_MSG_ERROR(libxml.jar not found.)
11617         fi
11619         if test -z $FLUTE_JAR; then
11620             if test -f /usr/share/java/flute-1.3.0.jar; then
11621                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11622             elif test -f /usr/share/java/flute.jar; then
11623                 FLUTE_JAR=/usr/share/java/flute.jar
11624             else
11625                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11626             fi
11627         elif ! test -f $FLUTE_JAR; then
11628             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11629         fi
11631         if test -z $JFREEREPORT_JAR; then
11632             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11633                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11634             elif test -f /usr/share/java/flow-engine.jar; then
11635                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11636             else
11637                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11638             fi
11639         elif ! test -f  $JFREEREPORT_JAR; then
11640                 AC_MSG_ERROR(jfreereport.jar not found.)
11641         fi
11643         if test -z $LIBLAYOUT_JAR; then
11644             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11645                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11646             elif test -f /usr/share/java/liblayout.jar; then
11647                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11648             else
11649                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11650             fi
11651         elif ! test -f $LIBLAYOUT_JAR; then
11652                 AC_MSG_ERROR(liblayout.jar not found.)
11653         fi
11655         if test -z $LIBLOADER_JAR; then
11656             if test -f /usr/share/java/libloader-1.0.0.jar; then
11657                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11658             elif test -f /usr/share/java/libloader.jar; then
11659                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11660             else
11661                 AC_MSG_ERROR(libloader.jar replacement not found.)
11662             fi
11663         elif ! test -f  $LIBLOADER_JAR; then
11664             AC_MSG_ERROR(libloader.jar not found.)
11665         fi
11667         if test -z $LIBFORMULA_JAR; then
11668             if test -f /usr/share/java/libformula-0.2.0.jar; then
11669                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11670             elif test -f /usr/share/java/libformula.jar; then
11671                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11672             else
11673                 AC_MSG_ERROR(libformula.jar replacement not found.)
11674             fi
11675         elif ! test -f $LIBFORMULA_JAR; then
11676                 AC_MSG_ERROR(libformula.jar not found.)
11677         fi
11679         if test -z $LIBREPOSITORY_JAR; then
11680             if test -f /usr/share/java/librepository-1.0.0.jar; then
11681                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11682             elif test -f /usr/share/java/librepository.jar; then
11683                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11684             else
11685                 AC_MSG_ERROR(librepository.jar replacement not found.)
11686             fi
11687         elif ! test -f $LIBREPOSITORY_JAR; then
11688             AC_MSG_ERROR(librepository.jar not found.)
11689         fi
11691         if test -z $LIBFONTS_JAR; then
11692             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11693                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11694             elif test -f /usr/share/java/libfonts.jar; then
11695                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11696             else
11697                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11698             fi
11699         elif ! test -f $LIBFONTS_JAR; then
11700                 AC_MSG_ERROR(libfonts.jar not found.)
11701         fi
11703         if test -z $LIBSERIALIZER_JAR; then
11704             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11705                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11706             elif test -f /usr/share/java/libserializer.jar; then
11707                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11708             else
11709                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11710             fi
11711         elif ! test -f $LIBSERIALIZER_JAR; then
11712                 AC_MSG_ERROR(libserializer.jar not found.)
11713         fi
11715         if test -z $LIBBASE_JAR; then
11716             if test -f /usr/share/java/libbase-1.0.0.jar; then
11717                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11718             elif test -f /usr/share/java/libbase.jar; then
11719                 LIBBASE_JAR=/usr/share/java/libbase.jar
11720             else
11721                 AC_MSG_ERROR(libbase.jar replacement not found.)
11722             fi
11723         elif ! test -f $LIBBASE_JAR; then
11724             AC_MSG_ERROR(libbase.jar not found.)
11725         fi
11727     else
11728         AC_MSG_RESULT([internal])
11729         SYSTEM_JFREEREPORT=
11730         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11731         NEED_ANT=TRUE
11732     fi
11733 else
11734     AC_MSG_RESULT([no])
11735     ENABLE_REPORTBUILDER=
11736     SYSTEM_JFREEREPORT=
11738 AC_SUBST(ENABLE_REPORTBUILDER)
11739 AC_SUBST(SYSTEM_JFREEREPORT)
11740 AC_SUBST(SAC_JAR)
11741 AC_SUBST(LIBXML_JAR)
11742 AC_SUBST(FLUTE_JAR)
11743 AC_SUBST(JFREEREPORT_JAR)
11744 AC_SUBST(LIBBASE_JAR)
11745 AC_SUBST(LIBLAYOUT_JAR)
11746 AC_SUBST(LIBLOADER_JAR)
11747 AC_SUBST(LIBFORMULA_JAR)
11748 AC_SUBST(LIBREPOSITORY_JAR)
11749 AC_SUBST(LIBFONTS_JAR)
11750 AC_SUBST(LIBSERIALIZER_JAR)
11752 # this has to be here because both the Wiki Publisher and the SRB use
11753 # commons-logging
11754 COMMONS_LOGGING_VERSION=1.2
11755 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11756     AC_MSG_CHECKING([which Apache commons-* libs to use])
11757     if test "$with_system_apache_commons" = "yes"; then
11758         SYSTEM_APACHE_COMMONS=TRUE
11759         AC_MSG_RESULT([external])
11760         if test -z $COMMONS_LOGGING_JAR; then
11761             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11762                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11763            elif test -f /usr/share/java/commons-logging.jar; then
11764                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11765             else
11766                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11767             fi
11768         elif ! test -f $COMMONS_LOGGING_JAR; then
11769             AC_MSG_ERROR(commons-logging.jar not found.)
11770         fi
11771     else
11772         AC_MSG_RESULT([internal])
11773         SYSTEM_APACHE_COMMONS=
11774         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11775         NEED_ANT=TRUE
11776     fi
11778 AC_SUBST(SYSTEM_APACHE_COMMONS)
11779 AC_SUBST(COMMONS_LOGGING_JAR)
11780 AC_SUBST(COMMONS_LOGGING_VERSION)
11782 # scripting provider for BeanShell?
11783 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11784 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11785     AC_MSG_RESULT([yes])
11786     ENABLE_SCRIPTING_BEANSHELL=TRUE
11788     dnl ===================================================================
11789     dnl Check for system beanshell
11790     dnl ===================================================================
11791     AC_MSG_CHECKING([which beanshell to use])
11792     if test "$with_system_beanshell" = "yes"; then
11793         AC_MSG_RESULT([external])
11794         SYSTEM_BSH=TRUE
11795         if test -z $BSH_JAR; then
11796             BSH_JAR=/usr/share/java/bsh.jar
11797         fi
11798         if ! test -f $BSH_JAR; then
11799             AC_MSG_ERROR(bsh.jar not found.)
11800         fi
11801     else
11802         AC_MSG_RESULT([internal])
11803         SYSTEM_BSH=
11804         BUILD_TYPE="$BUILD_TYPE BSH"
11805     fi
11806 else
11807     AC_MSG_RESULT([no])
11808     ENABLE_SCRIPTING_BEANSHELL=
11809     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11811 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11812 AC_SUBST(SYSTEM_BSH)
11813 AC_SUBST(BSH_JAR)
11815 # scripting provider for JavaScript?
11816 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11817 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11818     AC_MSG_RESULT([yes])
11819     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11821     dnl ===================================================================
11822     dnl Check for system rhino
11823     dnl ===================================================================
11824     AC_MSG_CHECKING([which rhino to use])
11825     if test "$with_system_rhino" = "yes"; then
11826         AC_MSG_RESULT([external])
11827         SYSTEM_RHINO=TRUE
11828         if test -z $RHINO_JAR; then
11829             RHINO_JAR=/usr/share/java/js.jar
11830         fi
11831         if ! test -f $RHINO_JAR; then
11832             AC_MSG_ERROR(js.jar not found.)
11833         fi
11834     else
11835         AC_MSG_RESULT([internal])
11836         SYSTEM_RHINO=
11837         BUILD_TYPE="$BUILD_TYPE RHINO"
11838         NEED_ANT=TRUE
11839     fi
11840 else
11841     AC_MSG_RESULT([no])
11842     ENABLE_SCRIPTING_JAVASCRIPT=
11843     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11845 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11846 AC_SUBST(SYSTEM_RHINO)
11847 AC_SUBST(RHINO_JAR)
11849 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11850 # paths should be added to library search path. So lets put all 64-bit
11851 # platforms there.
11852 supports_multilib=
11853 case "$host_cpu" in
11854 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11855     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11856         supports_multilib="yes"
11857     fi
11858     ;;
11860     ;;
11861 esac
11863 dnl ===================================================================
11864 dnl QT5 Integration
11865 dnl ===================================================================
11867 QT5_CFLAGS=""
11868 QT5_LIBS=""
11869 QMAKE5="qmake"
11870 MOC5="moc"
11871 QT5_GOBJECT_CFLAGS=""
11872 QT5_GOBJECT_LIBS=""
11873 QT5_HAVE_GOBJECT=""
11874 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11875         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11876         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11877 then
11878     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11879     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11881     if test -n "$supports_multilib"; then
11882         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11883     fi
11885     qt5_test_include="QtWidgets/qapplication.h"
11886     qt5_test_library="libQt5Widgets.so"
11888     dnl Check for qmake5
11889     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11890     if test "$QMAKE5" = "no"; then
11891         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11892     else
11893         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11894         if test -z "$qmake5_test_ver"; then
11895             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11896         fi
11897         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11898         qt5_minimal_minor="6"
11899         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11900             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11901         else
11902             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11903         fi
11904     fi
11906     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11907     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11909     AC_MSG_CHECKING([for Qt5 headers])
11910     qt5_incdir="no"
11911     for inc_dir in $qt5_incdirs; do
11912         if test -r "$inc_dir/$qt5_test_include"; then
11913             qt5_incdir="$inc_dir"
11914             break
11915         fi
11916     done
11917     AC_MSG_RESULT([$qt5_incdir])
11918     if test "x$qt5_incdir" = "xno"; then
11919         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11920     fi
11921     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
11922     AC_LANG_PUSH([C++])
11923     save_CPPFLAGS=$CPPFLAGS
11924     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
11925     AC_CHECK_HEADER(QtCore/qconfig.h, [],
11926         [AC_MSG_ERROR(qconfig.h header not found.)], [])
11927     CPPFLAGS=$save_CPPFLAGS
11928     AC_LANG_POP([C++])
11930     AC_MSG_CHECKING([for Qt5 libraries])
11931     qt5_libdir="no"
11932     for lib_dir in $qt5_libdirs; do
11933         if test -r "$lib_dir/$qt5_test_library"; then
11934             qt5_libdir="$lib_dir"
11935             break
11936         fi
11937     done
11938     AC_MSG_RESULT([$qt5_libdir])
11939     if test "x$qt5_libdir" = "xno"; then
11940         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11941     fi
11943     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11944     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11945     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11947     if test "$USING_X11" = TRUE; then
11948         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11949         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11950             QT5_HAVE_XCB_ICCCM=1
11951             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11952         ],[
11953             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)])
11954             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11955         ])
11956         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11957         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11958         QT5_USING_X11=1
11959         AC_DEFINE(QT5_USING_X11)
11960     fi
11962     dnl Check for Meta Object Compiler
11964     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11965     if test "$MOC5" = "no"; then
11966         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11967 the root of your Qt installation by exporting QT5DIR before running "configure".])
11968     fi
11970     if test "$build_gstreamer_1_0" = "yes"; then
11971         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11972                 QT5_HAVE_GOBJECT=1
11973                 AC_DEFINE(QT5_HAVE_GOBJECT)
11974             ],
11975             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11976         )
11977     fi
11979 AC_SUBST(QT5_CFLAGS)
11980 AC_SUBST(QT5_LIBS)
11981 AC_SUBST(MOC5)
11982 AC_SUBST(QT5_GOBJECT_CFLAGS)
11983 AC_SUBST(QT5_GOBJECT_LIBS)
11984 AC_SUBST(QT5_HAVE_GOBJECT)
11986 dnl ===================================================================
11987 dnl KF5 Integration
11988 dnl ===================================================================
11990 KF5_CFLAGS=""
11991 KF5_LIBS=""
11992 KF5_CONFIG="kf5-config"
11993 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11994         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11995 then
11996     if test "$OS" = "HAIKU"; then
11997         haiku_arch="`echo $RTL_ARCH | tr X x`"
11998         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11999         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12000     fi
12002     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12003     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12004     if test -n "$supports_multilib"; then
12005         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12006     fi
12008     kf5_test_include="KF5/kcoreaddons_version.h"
12009     kf5_test_library="libKF5CoreAddons.so"
12010     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12012     dnl kf5 KDE4 support compatibility installed
12013     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12014     if test "$KF5_CONFIG" != "no"; then
12015         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12016         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12017     fi
12019     dnl Check for KF5 headers
12020     AC_MSG_CHECKING([for KF5 headers])
12021     kf5_incdir="no"
12022     for kf5_check in $kf5_incdirs; do
12023         if test -r "$kf5_check/$kf5_test_include"; then
12024             kf5_incdir="$kf5_check/KF5"
12025             break
12026         fi
12027     done
12028     AC_MSG_RESULT([$kf5_incdir])
12029     if test "x$kf5_incdir" = "xno"; then
12030         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12031     fi
12033     dnl Check for KF5 libraries
12034     AC_MSG_CHECKING([for KF5 libraries])
12035     kf5_libdir="no"
12036     for kf5_check in $kf5_libdirs; do
12037         if test -r "$kf5_check/$kf5_test_library"; then
12038             kf5_libdir="$kf5_check"
12039             break
12040         fi
12041     done
12043     AC_MSG_RESULT([$kf5_libdir])
12044     if test "x$kf5_libdir" = "xno"; then
12045         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12046     fi
12048     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"
12049     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12050     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12052     if test "$USING_X11" = TRUE; then
12053         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12054     fi
12056     AC_LANG_PUSH([C++])
12057     save_CXXFLAGS=$CXXFLAGS
12058     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12059     AC_MSG_CHECKING([whether KDE is >= 5.0])
12060        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12061 #include <kcoreaddons_version.h>
12063 int main(int argc, char **argv) {
12064        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12065        else return 1;
12067        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12068     CXXFLAGS=$save_CXXFLAGS
12069     AC_LANG_POP([C++])
12071 AC_SUBST(KF5_CFLAGS)
12072 AC_SUBST(KF5_LIBS)
12074 dnl ===================================================================
12075 dnl Test whether to include Evolution 2 support
12076 dnl ===================================================================
12077 AC_MSG_CHECKING([whether to enable evolution 2 support])
12078 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
12079     AC_MSG_RESULT([yes])
12080     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12081     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12082     FilterLibs "${GOBJECT_LIBS}"
12083     GOBJECT_LIBS="${filteredlibs}"
12084     ENABLE_EVOAB2="TRUE"
12085 else
12086     ENABLE_EVOAB2=""
12087     AC_MSG_RESULT([no])
12089 AC_SUBST(ENABLE_EVOAB2)
12090 AC_SUBST(GOBJECT_CFLAGS)
12091 AC_SUBST(GOBJECT_LIBS)
12093 dnl ===================================================================
12094 dnl Test which themes to include
12095 dnl ===================================================================
12096 AC_MSG_CHECKING([which themes to include])
12097 # if none given use default subset of available themes
12098 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12099     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"
12102 WITH_THEMES=""
12103 if test "x$with_theme" != "xno"; then
12104     for theme in $with_theme; do
12105         case $theme in
12106         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" ;;
12107         default) real_theme=colibre ;;
12108         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12109         esac
12110         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12111     done
12113 AC_MSG_RESULT([$WITH_THEMES])
12114 AC_SUBST([WITH_THEMES])
12115 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12116 for theme in $with_theme; do
12117     case $theme in
12118     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12119     *) ;;
12120     esac
12121 done
12123 dnl ===================================================================
12124 dnl Test whether to integrate helppacks into the product's installer
12125 dnl ===================================================================
12126 AC_MSG_CHECKING([for helppack integration])
12127 if test "$with_helppack_integration" = "no"; then
12128     AC_MSG_RESULT([no integration])
12129 else
12130     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12131     AC_MSG_RESULT([integration])
12134 ###############################################################################
12135 # Extensions checking
12136 ###############################################################################
12137 AC_MSG_CHECKING([for extensions integration])
12138 if test "x$enable_extension_integration" != "xno"; then
12139     WITH_EXTENSION_INTEGRATION=TRUE
12140     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12141     AC_MSG_RESULT([yes, use integration])
12142 else
12143     WITH_EXTENSION_INTEGRATION=
12144     AC_MSG_RESULT([no, do not integrate])
12146 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12148 dnl Should any extra extensions be included?
12149 dnl There are standalone tests for each of these below.
12150 WITH_EXTRA_EXTENSIONS=
12151 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12153 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12154 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12155 if test "x$with_java" != "xno"; then
12156     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12157     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12160 AC_MSG_CHECKING([whether to build opens___.ttf])
12161 if test "$enable_build_opensymbol" = "yes"; then
12162     AC_MSG_RESULT([yes])
12163     AC_PATH_PROG(FONTFORGE, fontforge)
12164     if test -z "$FONTFORGE"; then
12165         AC_MSG_ERROR([fontforge not installed])
12166     fi
12167 else
12168     AC_MSG_RESULT([no])
12169     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
12170     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12172 AC_SUBST(OPENSYMBOL_TTF)
12173 AC_SUBST(FONTFORGE)
12175 dnl ===================================================================
12176 dnl Test whether to include fonts
12177 dnl ===================================================================
12178 AC_MSG_CHECKING([whether to include third-party fonts])
12179 if test "$with_fonts" != "no"; then
12180     AC_MSG_RESULT([yes])
12181     WITH_FONTS=TRUE
12182     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12183     AC_DEFINE(HAVE_MORE_FONTS)
12184 else
12185     AC_MSG_RESULT([no])
12186     WITH_FONTS=
12187     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12189 AC_SUBST(WITH_FONTS)
12192 dnl ===================================================================
12193 dnl Test whether to enable online update service
12194 dnl ===================================================================
12195 AC_MSG_CHECKING([whether to enable online update])
12196 ENABLE_ONLINE_UPDATE=
12197 ENABLE_ONLINE_UPDATE_MAR=
12198 UPDATE_CONFIG=
12199 if test "$enable_online_update" = ""; then
12200     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12201         AC_MSG_RESULT([yes])
12202         ENABLE_ONLINE_UPDATE="TRUE"
12203     else
12204         AC_MSG_RESULT([no])
12205     fi
12206 else
12207     if test "$enable_online_update" = "mar"; then
12208         AC_MSG_RESULT([yes - MAR-based online update])
12209         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12210         if test "$with_update_config" = ""; then
12211             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12212         fi
12213         UPDATE_CONFIG="$with_update_config"
12214         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12215     elif test "$enable_online_update" = "yes"; then
12216         AC_MSG_RESULT([yes])
12217         ENABLE_ONLINE_UPDATE="TRUE"
12218     else
12219         AC_MSG_RESULT([no])
12220     fi
12222 AC_SUBST(ENABLE_ONLINE_UPDATE)
12223 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
12224 AC_SUBST(UPDATE_CONFIG)
12226 dnl ===================================================================
12227 dnl Test whether we need bzip2
12228 dnl ===================================================================
12229 SYSTEM_BZIP2=
12230 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
12231     AC_MSG_CHECKING([whether to use system bzip2])
12232     if test "$with_system_bzip2" = yes; then
12233         SYSTEM_BZIP2=TRUE
12234         AC_MSG_RESULT([yes])
12235         PKG_CHECK_MODULES(BZIP2, bzip2)
12236         FilterLibs "${BZIP2_LIBS}"
12237         BZIP2_LIBS="${filteredlibs}"
12238     else
12239         AC_MSG_RESULT([no])
12240         BUILD_TYPE="$BUILD_TYPE BZIP2"
12241     fi
12243 AC_SUBST(SYSTEM_BZIP2)
12244 AC_SUBST(BZIP2_CFLAGS)
12245 AC_SUBST(BZIP2_LIBS)
12247 dnl ===================================================================
12248 dnl Test whether to enable extension update
12249 dnl ===================================================================
12250 AC_MSG_CHECKING([whether to enable extension update])
12251 ENABLE_EXTENSION_UPDATE=
12252 if test "x$enable_extension_update" = "xno"; then
12253     AC_MSG_RESULT([no])
12254 else
12255     AC_MSG_RESULT([yes])
12256     ENABLE_EXTENSION_UPDATE="TRUE"
12257     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
12258     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
12260 AC_SUBST(ENABLE_EXTENSION_UPDATE)
12263 dnl ===================================================================
12264 dnl Test whether to create MSI with LIMITUI=1 (silent install)
12265 dnl ===================================================================
12266 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
12267 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
12268     AC_MSG_RESULT([no])
12269     ENABLE_SILENT_MSI=
12270 else
12271     AC_MSG_RESULT([yes])
12272     ENABLE_SILENT_MSI=TRUE
12273     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
12275 AC_SUBST(ENABLE_SILENT_MSI)
12277 AC_MSG_CHECKING([whether and how to use Xinerama])
12278 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
12279     if test "$x_libraries" = "default_x_libraries"; then
12280         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
12281         if test "x$XINERAMALIB" = x; then
12282            XINERAMALIB="/usr/lib"
12283         fi
12284     else
12285         XINERAMALIB="$x_libraries"
12286     fi
12287     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
12288         # we have both versions, let the user decide but use the dynamic one
12289         # per default
12290         USE_XINERAMA=TRUE
12291         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
12292             XINERAMA_LINK=dynamic
12293         else
12294             XINERAMA_LINK=static
12295         fi
12296     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
12297         # we have only the dynamic version
12298         USE_XINERAMA=TRUE
12299         XINERAMA_LINK=dynamic
12300     elif test -e "$XINERAMALIB/libXinerama.a"; then
12301         # static version
12302         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
12303             USE_XINERAMA=TRUE
12304             XINERAMA_LINK=static
12305         else
12306             USE_XINERAMA=
12307             XINERAMA_LINK=none
12308         fi
12309     else
12310         # no Xinerama
12311         USE_XINERAMA=
12312         XINERAMA_LINK=none
12313     fi
12314     if test "$USE_XINERAMA" = "TRUE"; then
12315         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
12316         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
12317             [AC_MSG_ERROR(Xinerama header not found.)], [])
12318         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
12319         if test "x$XEXTLIB" = x; then
12320            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
12321         fi
12322         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
12323         if test "$_os" = "FreeBSD"; then
12324             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
12325         fi
12326         if test "$_os" = "Linux"; then
12327             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
12328         fi
12329         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
12330             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
12331     else
12332         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
12333     fi
12334 else
12335     USE_XINERAMA=
12336     XINERAMA_LINK=none
12337     AC_MSG_RESULT([no])
12339 AC_SUBST(USE_XINERAMA)
12340 AC_SUBST(XINERAMA_LINK)
12342 dnl ===================================================================
12343 dnl Test whether to build cairo or rely on the system version
12344 dnl ===================================================================
12346 if test "$USING_X11" = TRUE; then
12347     # Used in vcl/Library_vclplug_gen.mk
12348     test_cairo=yes
12351 if test "$test_cairo" = "yes"; then
12352     AC_MSG_CHECKING([whether to use the system cairo])
12354     : ${with_system_cairo:=$with_system_libs}
12355     if test "$with_system_cairo" = "yes"; then
12356         SYSTEM_CAIRO=TRUE
12357         AC_MSG_RESULT([yes])
12359         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
12360         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12361         FilterLibs "${CAIRO_LIBS}"
12362         CAIRO_LIBS="${filteredlibs}"
12364         if test "$test_xrender" = "yes"; then
12365             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
12366             AC_LANG_PUSH([C])
12367             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
12368 #ifdef PictStandardA8
12369 #else
12370       return fail;
12371 #endif
12372 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
12374             AC_LANG_POP([C])
12375         fi
12376     else
12377         SYSTEM_CAIRO=
12378         AC_MSG_RESULT([no])
12380         BUILD_TYPE="$BUILD_TYPE CAIRO"
12381     fi
12384 AC_SUBST(SYSTEM_CAIRO)
12385 AC_SUBST(CAIRO_CFLAGS)
12386 AC_SUBST(CAIRO_LIBS)
12388 dnl ===================================================================
12389 dnl Test whether to use avahi
12390 dnl ===================================================================
12391 if test "$_os" = "WINNT"; then
12392     # Windows uses bundled mDNSResponder
12393     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
12394 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12395     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12396                       [ENABLE_AVAHI="TRUE"])
12397     AC_DEFINE(HAVE_FEATURE_AVAHI)
12398     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12399     FilterLibs "${AVAHI_LIBS}"
12400     AVAHI_LIBS="${filteredlibs}"
12403 AC_SUBST(ENABLE_AVAHI)
12404 AC_SUBST(AVAHI_CFLAGS)
12405 AC_SUBST(AVAHI_LIBS)
12407 dnl ===================================================================
12408 dnl Test whether to use liblangtag
12409 dnl ===================================================================
12410 SYSTEM_LIBLANGTAG=
12411 AC_MSG_CHECKING([whether to use system liblangtag])
12412 if test "$with_system_liblangtag" = yes; then
12413     SYSTEM_LIBLANGTAG=TRUE
12414     AC_MSG_RESULT([yes])
12415     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12416     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12417     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12418     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12419     FilterLibs "${LIBLANGTAG_LIBS}"
12420     LIBLANGTAG_LIBS="${filteredlibs}"
12421 else
12422     SYSTEM_LIBLANGTAG=
12423     AC_MSG_RESULT([no])
12424     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12425     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12426     if test "$COM" = "MSC"; then
12427         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12428     else
12429         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12430     fi
12432 AC_SUBST(SYSTEM_LIBLANGTAG)
12433 AC_SUBST(LIBLANGTAG_CFLAGS)
12434 AC_SUBST(LIBLANGTAG_LIBS)
12436 dnl ===================================================================
12437 dnl Test whether to build libpng or rely on the system version
12438 dnl ===================================================================
12440 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12442 dnl ===================================================================
12443 dnl Check for runtime JVM search path
12444 dnl ===================================================================
12445 if test "$ENABLE_JAVA" != ""; then
12446     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12447     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12448         AC_MSG_RESULT([yes])
12449         if ! test -d "$with_jvm_path"; then
12450             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12451         fi
12452         if ! test -d "$with_jvm_path"jvm; then
12453             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12454         fi
12455         JVM_ONE_PATH_CHECK="$with_jvm_path"
12456         AC_SUBST(JVM_ONE_PATH_CHECK)
12457     else
12458         AC_MSG_RESULT([no])
12459     fi
12462 dnl ===================================================================
12463 dnl Test for the presence of Ant and that it works
12464 dnl ===================================================================
12466 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12467     ANT_HOME=; export ANT_HOME
12468     WITH_ANT_HOME=; export WITH_ANT_HOME
12469     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12470         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12471             if test "$_os" = "WINNT"; then
12472                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12473             else
12474                 with_ant_home="$LODE_HOME/opt/ant"
12475             fi
12476         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12477             with_ant_home="$LODE_HOME/opt/ant"
12478         fi
12479     fi
12480     if test -z "$with_ant_home"; then
12481         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12482     else
12483         if test "$_os" = "WINNT"; then
12484             # AC_PATH_PROGS needs unix path
12485             with_ant_home=`cygpath -u "$with_ant_home"`
12486         fi
12487         AbsolutePath "$with_ant_home"
12488         with_ant_home=$absolute_path
12489         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12490         WITH_ANT_HOME=$with_ant_home
12491         ANT_HOME=$with_ant_home
12492     fi
12494     if test -z "$ANT"; then
12495         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12496     else
12497         # resolve relative or absolute symlink
12498         while test -h "$ANT"; do
12499             a_cwd=`pwd`
12500             a_basename=`basename "$ANT"`
12501             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12502             cd "`dirname "$ANT"`"
12503             cd "`dirname "$a_script"`"
12504             ANT="`pwd`"/"`basename "$a_script"`"
12505             cd "$a_cwd"
12506         done
12508         AC_MSG_CHECKING([if $ANT works])
12509         mkdir -p conftest.dir
12510         a_cwd=$(pwd)
12511         cd conftest.dir
12512         cat > conftest.java << EOF
12513         public class conftest {
12514             int testmethod(int a, int b) {
12515                     return a + b;
12516             }
12517         }
12520         cat > conftest.xml << EOF
12521         <project name="conftest" default="conftest">
12522         <target name="conftest">
12523             <javac srcdir="." includes="conftest.java">
12524             </javac>
12525         </target>
12526         </project>
12529         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12530         if test $? = 0 -a -f ./conftest.class; then
12531             AC_MSG_RESULT([Ant works])
12532             if test -z "$WITH_ANT_HOME"; then
12533                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12534                 if test -z "$ANT_HOME"; then
12535                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12536                 fi
12537             else
12538                 ANT_HOME="$WITH_ANT_HOME"
12539             fi
12540         else
12541             echo "configure: Ant test failed" >&5
12542             cat conftest.java >&5
12543             cat conftest.xml >&5
12544             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12545         fi
12546         cd "$a_cwd"
12547         rm -fr conftest.dir
12548     fi
12549     if test -z "$ANT_HOME"; then
12550         ANT_HOME="NO_ANT_HOME"
12551     else
12552         PathFormat "$ANT_HOME"
12553         ANT_HOME="$formatted_path"
12554         PathFormat "$ANT"
12555         ANT="$formatted_path"
12556     fi
12557     AC_SUBST(ANT_HOME)
12558     AC_SUBST(ANT)
12560     dnl Checking for ant.jar
12561     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12562         AC_MSG_CHECKING([Ant lib directory])
12563         if test -f $ANT_HOME/lib/ant.jar; then
12564             ANT_LIB="$ANT_HOME/lib"
12565         else
12566             if test -f $ANT_HOME/ant.jar; then
12567                 ANT_LIB="$ANT_HOME"
12568             else
12569                 if test -f /usr/share/java/ant.jar; then
12570                     ANT_LIB=/usr/share/java
12571                 else
12572                     if test -f /usr/share/ant-core/lib/ant.jar; then
12573                         ANT_LIB=/usr/share/ant-core/lib
12574                     else
12575                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12576                             ANT_LIB="$ANT_HOME/lib/ant"
12577                         else
12578                             if test -f /usr/share/lib/ant/ant.jar; then
12579                                 ANT_LIB=/usr/share/lib/ant
12580                             else
12581                                 AC_MSG_ERROR([Ant libraries not found!])
12582                             fi
12583                         fi
12584                     fi
12585                 fi
12586             fi
12587         fi
12588         PathFormat "$ANT_LIB"
12589         ANT_LIB="$formatted_path"
12590         AC_MSG_RESULT([Ant lib directory found.])
12591     fi
12592     AC_SUBST(ANT_LIB)
12594     ant_minver=1.6.0
12595     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12597     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12598     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12599     ant_version_major=`echo $ant_version | cut -d. -f1`
12600     ant_version_minor=`echo $ant_version | cut -d. -f2`
12601     echo "configure: ant_version $ant_version " >&5
12602     echo "configure: ant_version_major $ant_version_major " >&5
12603     echo "configure: ant_version_minor $ant_version_minor " >&5
12604     if test "$ant_version_major" -ge "2"; then
12605         AC_MSG_RESULT([yes, $ant_version])
12606     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12607         AC_MSG_RESULT([yes, $ant_version])
12608     else
12609         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12610     fi
12612     rm -f conftest* core core.* *.core
12615 OOO_JUNIT_JAR=
12616 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12617     AC_MSG_CHECKING([for JUnit 4])
12618     if test "$with_junit" = "yes"; then
12619         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12620             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12621         elif test -e /usr/share/java/junit4.jar; then
12622             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12623         else
12624            if test -e /usr/share/lib/java/junit.jar; then
12625               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12626            else
12627               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12628            fi
12629         fi
12630     else
12631         OOO_JUNIT_JAR=$with_junit
12632     fi
12633     if test "$_os" = "WINNT"; then
12634         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12635     fi
12636     printf 'import org.junit.Before;' > conftest.java
12637     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12638         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12639     else
12640         AC_MSG_ERROR(
12641 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12642  specify its pathname via --with-junit=..., or disable it via --without-junit])
12643     fi
12644     rm -f conftest.class conftest.java
12645     if test $OOO_JUNIT_JAR != ""; then
12646     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12647     fi
12649 AC_SUBST(OOO_JUNIT_JAR)
12651 HAMCREST_JAR=
12652 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12653     AC_MSG_CHECKING([for included Hamcrest])
12654     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12655     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12656         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12657     else
12658         AC_MSG_RESULT([Not included])
12659         AC_MSG_CHECKING([for standalone hamcrest jar.])
12660         if test "$with_hamcrest" = "yes"; then
12661             if test -e /usr/share/lib/java/hamcrest.jar; then
12662                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12663             elif test -e /usr/share/java/hamcrest/core.jar; then
12664                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12665             else
12666                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12667             fi
12668         else
12669             HAMCREST_JAR=$with_hamcrest
12670         fi
12671         if test "$_os" = "WINNT"; then
12672             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12673         fi
12674         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12675             AC_MSG_RESULT([$HAMCREST_JAR])
12676         else
12677             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),
12678                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12679         fi
12680     fi
12681     rm -f conftest.class conftest.java
12683 AC_SUBST(HAMCREST_JAR)
12686 AC_SUBST(SCPDEFS)
12689 # check for wget and curl
12691 WGET=
12692 CURL=
12694 if test "$enable_fetch_external" != "no"; then
12696 CURL=`which curl 2>/dev/null`
12698 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12699     # wget new enough?
12700     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12701     if test $? -eq 0; then
12702         WGET=$i
12703         break
12704     fi
12705 done
12707 if test -z "$WGET" -a -z "$CURL"; then
12708     AC_MSG_ERROR([neither wget nor curl found!])
12713 AC_SUBST(WGET)
12714 AC_SUBST(CURL)
12717 # check for sha256sum
12719 SHA256SUM=
12721 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12722     eval "$i -a 256 --version" > /dev/null 2>&1
12723     ret=$?
12724     if test $ret -eq 0; then
12725         SHA256SUM="$i -a 256"
12726         break
12727     fi
12728 done
12730 if test -z "$SHA256SUM"; then
12731     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12732         eval "$i --version" > /dev/null 2>&1
12733         ret=$?
12734         if test $ret -eq 0; then
12735             SHA256SUM=$i
12736             break
12737         fi
12738     done
12741 if test -z "$SHA256SUM"; then
12742     AC_MSG_ERROR([no sha256sum found!])
12745 AC_SUBST(SHA256SUM)
12747 dnl ===================================================================
12748 dnl Dealing with l10n options
12749 dnl ===================================================================
12750 AC_MSG_CHECKING([which languages to be built])
12751 # get list of all languages
12752 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12753 # the sed command does the following:
12754 #   + if a line ends with a backslash, append the next line to it
12755 #   + adds " on the beginning of the value (after =)
12756 #   + adds " at the end of the value
12757 #   + removes en-US; we want to put it on the beginning
12758 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12759 [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)]
12760 ALL_LANGS="en-US $completelangiso"
12761 # check the configured localizations
12762 WITH_LANG="$with_lang"
12764 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12765 # (Norwegian is "nb" and "nn".)
12766 if test "$WITH_LANG" = "no"; then
12767     WITH_LANG=
12770 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12771     AC_MSG_RESULT([en-US])
12772 else
12773     AC_MSG_RESULT([$WITH_LANG])
12774     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12775     if test -z "$MSGFMT"; then
12776         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12777             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12778         elif test -x "/opt/lo/bin/msgfmt"; then
12779             MSGFMT="/opt/lo/bin/msgfmt"
12780         else
12781             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12782             if test -z "$MSGFMT"; then
12783                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12784             fi
12785         fi
12786     fi
12787     if test -z "$MSGUNIQ"; then
12788         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12789             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12790         elif test -x "/opt/lo/bin/msguniq"; then
12791             MSGUNIQ="/opt/lo/bin/msguniq"
12792         else
12793             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12794             if test -z "$MSGUNIQ"; then
12795                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12796             fi
12797         fi
12798     fi
12800 AC_SUBST(MSGFMT)
12801 AC_SUBST(MSGUNIQ)
12802 # check that the list is valid
12803 for lang in $WITH_LANG; do
12804     test "$lang" = "ALL" && continue
12805     # need to check for the exact string, so add space before and after the list of all languages
12806     for vl in $ALL_LANGS; do
12807         if test "$vl" = "$lang"; then
12808            break
12809         fi
12810     done
12811     if test "$vl" != "$lang"; then
12812         # if you're reading this - you prolly quoted your languages remove the quotes ...
12813         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12814     fi
12815 done
12816 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12817     echo $WITH_LANG | grep -q en-US
12818     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12820 # list with substituted ALL
12821 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12822 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12823 test "$WITH_LANG" = "en-US" && WITH_LANG=
12824 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12825     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12826     ALL_LANGS=`echo $ALL_LANGS qtz`
12828 AC_SUBST(ALL_LANGS)
12829 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12830 AC_SUBST(WITH_LANG)
12831 AC_SUBST(WITH_LANG_LIST)
12832 AC_SUBST(GIT_NEEDED_SUBMODULES)
12834 WITH_POOR_HELP_LOCALIZATIONS=
12835 if test -d "$SRC_ROOT/translations/source"; then
12836     for l in `ls -1 $SRC_ROOT/translations/source`; do
12837         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12838             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12839         fi
12840     done
12842 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12844 if test -n "$with_locales"; then
12845     WITH_LOCALES="$with_locales"
12847     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12848     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12849     # config_host/config_locales.h.in
12850     for locale in $WITH_LOCALES; do
12851         lang=${locale%_*}
12853         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12855         case $lang in
12856         hi|mr*ne)
12857             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12858             ;;
12859         bg|ru)
12860             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12861             ;;
12862         esac
12863     done
12864 else
12865     AC_DEFINE(WITH_LOCALE_ALL)
12867 AC_SUBST(WITH_LOCALES)
12869 dnl git submodule update --reference
12870 dnl ===================================================================
12871 if test -n "${GIT_REFERENCE_SRC}"; then
12872     for repo in ${GIT_NEEDED_SUBMODULES}; do
12873         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12874             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12875         fi
12876     done
12878 AC_SUBST(GIT_REFERENCE_SRC)
12880 dnl git submodules linked dirs
12881 dnl ===================================================================
12882 if test -n "${GIT_LINK_SRC}"; then
12883     for repo in ${GIT_NEEDED_SUBMODULES}; do
12884         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12885             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12886         fi
12887     done
12889 AC_SUBST(GIT_LINK_SRC)
12891 dnl branding
12892 dnl ===================================================================
12893 AC_MSG_CHECKING([for alternative branding images directory])
12894 # initialize mapped arrays
12895 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
12896 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg about.svg"
12898 if test -z "$with_branding" -o "$with_branding" = "no"; then
12899     AC_MSG_RESULT([none])
12900     DEFAULT_BRAND_IMAGES="$brand_files"
12901 else
12902     if ! test -d $with_branding ; then
12903         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12904     else
12905         AC_MSG_RESULT([$with_branding])
12906         CUSTOM_BRAND_DIR="$with_branding"
12907         for lfile in $brand_files
12908         do
12909             if ! test -f $with_branding/$lfile ; then
12910                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12911                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12912             else
12913                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12914             fi
12915         done
12916         check_for_progress="yes"
12917     fi
12919 AC_SUBST([BRAND_INTRO_IMAGES])
12920 AC_SUBST([CUSTOM_BRAND_DIR])
12921 AC_SUBST([CUSTOM_BRAND_IMAGES])
12922 AC_SUBST([DEFAULT_BRAND_IMAGES])
12925 AC_MSG_CHECKING([for 'intro' progress settings])
12926 PROGRESSBARCOLOR=
12927 PROGRESSSIZE=
12928 PROGRESSPOSITION=
12929 PROGRESSFRAMECOLOR=
12930 PROGRESSTEXTCOLOR=
12931 PROGRESSTEXTBASELINE=
12933 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12934     source "$with_branding/progress.conf"
12935     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12936 else
12937     AC_MSG_RESULT([none])
12940 AC_SUBST(PROGRESSBARCOLOR)
12941 AC_SUBST(PROGRESSSIZE)
12942 AC_SUBST(PROGRESSPOSITION)
12943 AC_SUBST(PROGRESSFRAMECOLOR)
12944 AC_SUBST(PROGRESSTEXTCOLOR)
12945 AC_SUBST(PROGRESSTEXTBASELINE)
12948 dnl ===================================================================
12949 dnl Custom build version
12950 dnl ===================================================================
12951 AC_MSG_CHECKING([for extra build ID])
12952 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12953     EXTRA_BUILDID="$with_extra_buildid"
12955 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12956 if test -n "$EXTRA_BUILDID" ; then
12957     AC_MSG_RESULT([$EXTRA_BUILDID])
12958 else
12959     AC_MSG_RESULT([not set])
12961 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12963 OOO_VENDOR=
12964 AC_MSG_CHECKING([for vendor])
12965 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12966     OOO_VENDOR="$USERNAME"
12968     if test -z "$OOO_VENDOR"; then
12969         OOO_VENDOR="$USER"
12970     fi
12972     if test -z "$OOO_VENDOR"; then
12973         OOO_VENDOR="`id -u -n`"
12974     fi
12976     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12977 else
12978     OOO_VENDOR="$with_vendor"
12979     AC_MSG_RESULT([$OOO_VENDOR])
12981 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12982 AC_SUBST(OOO_VENDOR)
12984 if test "$_os" = "Android" ; then
12985     ANDROID_PACKAGE_NAME=
12986     AC_MSG_CHECKING([for Android package name])
12987     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12988         if test -n "$ENABLE_DEBUG"; then
12989             # Default to the package name that makes ndk-gdb happy.
12990             ANDROID_PACKAGE_NAME="org.libreoffice"
12991         else
12992             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12993         fi
12995         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12996     else
12997         ANDROID_PACKAGE_NAME="$with_android_package_name"
12998         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12999     fi
13000     AC_SUBST(ANDROID_PACKAGE_NAME)
13003 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13004 if test "$with_compat_oowrappers" = "yes"; then
13005     WITH_COMPAT_OOWRAPPERS=TRUE
13006     AC_MSG_RESULT(yes)
13007 else
13008     WITH_COMPAT_OOWRAPPERS=
13009     AC_MSG_RESULT(no)
13011 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13013 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
13014 AC_MSG_CHECKING([for install dirname])
13015 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13016     INSTALLDIRNAME="$with_install_dirname"
13018 AC_MSG_RESULT([$INSTALLDIRNAME])
13019 AC_SUBST(INSTALLDIRNAME)
13021 AC_MSG_CHECKING([for prefix])
13022 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13023 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13024 PREFIXDIR="$prefix"
13025 AC_MSG_RESULT([$PREFIXDIR])
13026 AC_SUBST(PREFIXDIR)
13028 LIBDIR=[$(eval echo $(eval echo $libdir))]
13029 AC_SUBST(LIBDIR)
13031 DATADIR=[$(eval echo $(eval echo $datadir))]
13032 AC_SUBST(DATADIR)
13034 MANDIR=[$(eval echo $(eval echo $mandir))]
13035 AC_SUBST(MANDIR)
13037 DOCDIR=[$(eval echo $(eval echo $docdir))]
13038 AC_SUBST(DOCDIR)
13040 BINDIR=[$(eval echo $(eval echo $bindir))]
13041 AC_SUBST(BINDIR)
13043 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13044 AC_SUBST(INSTALLDIR)
13046 TESTINSTALLDIR="${BUILDDIR}/test-install"
13047 AC_SUBST(TESTINSTALLDIR)
13050 # ===================================================================
13051 # OAuth2 id and secrets
13052 # ===================================================================
13054 AC_MSG_CHECKING([for Google Drive client id and secret])
13055 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13056     AC_MSG_RESULT([not set])
13057     GDRIVE_CLIENT_ID="\"\""
13058     GDRIVE_CLIENT_SECRET="\"\""
13059 else
13060     AC_MSG_RESULT([set])
13061     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13062     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13064 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13065 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13067 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13068 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13069     AC_MSG_RESULT([not set])
13070     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13071     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13072 else
13073     AC_MSG_RESULT([set])
13074     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13075     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13077 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13078 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13080 AC_MSG_CHECKING([for OneDrive client id and secret])
13081 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13082     AC_MSG_RESULT([not set])
13083     ONEDRIVE_CLIENT_ID="\"\""
13084     ONEDRIVE_CLIENT_SECRET="\"\""
13085 else
13086     AC_MSG_RESULT([set])
13087     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13088     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13090 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13091 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13094 dnl ===================================================================
13095 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13096 dnl --enable-dependency-tracking configure option
13097 dnl ===================================================================
13098 AC_MSG_CHECKING([whether to enable dependency tracking])
13099 if test "$enable_dependency_tracking" = "no"; then
13100     nodep=TRUE
13101     AC_MSG_RESULT([no])
13102 else
13103     AC_MSG_RESULT([yes])
13105 AC_SUBST(nodep)
13107 dnl ===================================================================
13108 dnl Number of CPUs to use during the build
13109 dnl ===================================================================
13110 AC_MSG_CHECKING([for number of processors to use])
13111 # plain --with-parallelism is just the default
13112 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13113     if test "$with_parallelism" = "no"; then
13114         PARALLELISM=0
13115     else
13116         PARALLELISM=$with_parallelism
13117     fi
13118 else
13119     if test "$enable_icecream" = "yes"; then
13120         PARALLELISM="40"
13121     else
13122         case `uname -s` in
13124         Darwin|FreeBSD|NetBSD|OpenBSD)
13125             PARALLELISM=`sysctl -n hw.ncpu`
13126             ;;
13128         Linux)
13129             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13130         ;;
13131         # what else than above does profit here *and* has /proc?
13132         *)
13133             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13134             ;;
13135         esac
13137         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13138         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13139     fi
13142 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13143     if test -z "$with_parallelism"; then
13144             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13145             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13146             PARALLELISM="1"
13147     else
13148         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."
13149     fi
13152 if test $PARALLELISM -eq 0; then
13153     AC_MSG_RESULT([explicit make -j option needed])
13154 else
13155     AC_MSG_RESULT([$PARALLELISM])
13157 AC_SUBST(PARALLELISM)
13159 IWYU_PATH="$with_iwyu"
13160 AC_SUBST(IWYU_PATH)
13161 if test ! -z "$IWYU_PATH"; then
13162     if test ! -f "$IWYU_PATH"; then
13163         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13164     fi
13168 # Set up ILIB for MSVC build
13170 ILIB1=
13171 if test "$build_os" = "cygwin"; then
13172     ILIB="."
13173     if test -n "$JAVA_HOME"; then
13174         ILIB="$ILIB;$JAVA_HOME/lib"
13175     fi
13176     ILIB1=-link
13177     if test "$BITNESS_OVERRIDE" = 64; then
13178         ILIB="$ILIB;$COMPATH/lib/x64"
13179         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
13180         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
13181         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
13182         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13183             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
13184             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
13185         fi
13186         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
13187         ucrtlibpath_formatted=$formatted_path
13188         ILIB="$ILIB;$ucrtlibpath_formatted"
13189         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13190     else
13191         ILIB="$ILIB;$COMPATH/lib/x86"
13192         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
13193         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
13194         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
13195         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13196             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
13197             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
13198         fi
13199         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
13200         ucrtlibpath_formatted=$formatted_path
13201         ILIB="$ILIB;$ucrtlibpath_formatted"
13202         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13203     fi
13204     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13205         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13206     else
13207         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
13208     fi
13210     AC_SUBST(ILIB)
13213 # ===================================================================
13214 # Creating bigger shared library to link against
13215 # ===================================================================
13216 AC_MSG_CHECKING([whether to create huge library])
13217 MERGELIBS=
13219 if test $_os = iOS -o $_os = Android; then
13220     # Never any point in mergelibs for these as we build just static
13221     # libraries anyway...
13222     enable_mergelibs=no
13225 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
13226     if test $_os != Linux -a $_os != WINNT; then
13227         add_warning "--enable-mergelibs is not tested for this platform"
13228     fi
13229     MERGELIBS="TRUE"
13230     AC_MSG_RESULT([yes])
13231     AC_DEFINE(ENABLE_MERGELIBS)
13232 else
13233     AC_MSG_RESULT([no])
13235 AC_SUBST([MERGELIBS])
13237 dnl ===================================================================
13238 dnl icerun is a wrapper that stops us spawning tens of processes
13239 dnl locally - for tools that can't be executed on the compile cluster
13240 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
13241 dnl ===================================================================
13242 AC_MSG_CHECKING([whether to use icerun wrapper])
13243 ICECREAM_RUN=
13244 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
13245     ICECREAM_RUN=icerun
13246     AC_MSG_RESULT([yes])
13247 else
13248     AC_MSG_RESULT([no])
13250 AC_SUBST(ICECREAM_RUN)
13252 dnl ===================================================================
13253 dnl Setup the ICECC_VERSION for the build the same way it was set for
13254 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
13255 dnl ===================================================================
13256 x_ICECC_VERSION=[\#]
13257 if test -n "$ICECC_VERSION" ; then
13258     x_ICECC_VERSION=
13260 AC_SUBST(x_ICECC_VERSION)
13261 AC_SUBST(ICECC_VERSION)
13263 dnl ===================================================================
13265 AC_MSG_CHECKING([MPL subset])
13266 MPL_SUBSET=
13268 if test "$enable_mpl_subset" = "yes"; then
13269     warn_report=false
13270     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13271         warn_report=true
13272     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
13273         warn_report=true
13274     fi
13275     if test "$warn_report" = "true"; then
13276         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
13277     fi
13278     if test "x$enable_postgresql_sdbc" != "xno"; then
13279         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
13280     fi
13281     if test "$enable_lotuswordpro" = "yes"; then
13282         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
13283     fi
13284     if test "$WITH_WEBDAV" = "neon"; then
13285         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
13286     fi
13287     if test -n "$ENABLE_POPPLER"; then
13288         if test "x$SYSTEM_POPPLER" = "x"; then
13289             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
13290         fi
13291     fi
13292     # cf. m4/libo_check_extension.m4
13293     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
13294         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
13295     fi
13296     for theme in $WITH_THEMES; do
13297         case $theme in
13298         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sukapura|sukapura_svg) #denylist of icon themes under GPL or LGPL
13299             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
13300         *) : ;;
13301         esac
13302     done
13304     ENABLE_OPENGL_TRANSITIONS=
13306     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
13307         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
13308     fi
13310     MPL_SUBSET="TRUE"
13311     AC_DEFINE(MPL_HAVE_SUBSET)
13312     AC_MSG_RESULT([only])
13313 else
13314     AC_MSG_RESULT([no restrictions])
13316 AC_SUBST(MPL_SUBSET)
13318 dnl ===================================================================
13320 AC_MSG_CHECKING([formula logger])
13321 ENABLE_FORMULA_LOGGER=
13323 if test "x$enable_formula_logger" = "xyes"; then
13324     AC_MSG_RESULT([yes])
13325     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13326     ENABLE_FORMULA_LOGGER=TRUE
13327 elif test -n "$ENABLE_DBGUTIL" ; then
13328     AC_MSG_RESULT([yes])
13329     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13330     ENABLE_FORMULA_LOGGER=TRUE
13331 else
13332     AC_MSG_RESULT([no])
13335 AC_SUBST(ENABLE_FORMULA_LOGGER)
13337 dnl ===================================================================
13338 dnl Checking for active Antivirus software.
13339 dnl ===================================================================
13341 if test $_os = WINNT ; then
13342     AC_MSG_CHECKING([for active Antivirus software])
13343     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
13344     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
13345         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
13346             AC_MSG_RESULT([found])
13347             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
13348             echo $EICAR_STRING > $SRC_ROOT/eicar
13349             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
13350             rm $SRC_ROOT/eicar
13351             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13352                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13353             fi
13354             echo $EICAR_STRING > $BUILDDIR/eicar
13355             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
13356             rm $BUILDDIR/eicar
13357             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13358                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13359             fi
13360             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"
13361         else
13362             AC_MSG_RESULT([not found])
13363         fi
13364     else
13365         AC_MSG_RESULT([n/a])
13366     fi
13369 dnl ===================================================================
13370 dnl Setting up the environment.
13371 dnl ===================================================================
13372 AC_MSG_NOTICE([setting up the build environment variables...])
13374 AC_SUBST(COMPATH)
13376 if test "$build_os" = "cygwin"; then
13377     if test -d "$COMPATH/atlmfc/lib/spectre"; then
13378         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
13379         ATL_INCLUDE="$COMPATH/atlmfc/include"
13380     elif test -d "$COMPATH/atlmfc/lib"; then
13381         ATL_LIB="$COMPATH/atlmfc/lib"
13382         ATL_INCLUDE="$COMPATH/atlmfc/include"
13383     else
13384         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
13385         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
13386     fi
13387     if test "$BITNESS_OVERRIDE" = 64; then
13388         ATL_LIB="$ATL_LIB/x64"
13389     else
13390         ATL_LIB="$ATL_LIB/x86"
13391     fi
13392     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
13393     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
13395     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
13396     PathFormat "/usr/bin/find.exe"
13397     FIND="$formatted_path"
13398     PathFormat "/usr/bin/sort.exe"
13399     SORT="$formatted_path"
13400     PathFormat "/usr/bin/grep.exe"
13401     WIN_GREP="$formatted_path"
13402     PathFormat "/usr/bin/ls.exe"
13403     WIN_LS="$formatted_path"
13404     PathFormat "/usr/bin/touch.exe"
13405     WIN_TOUCH="$formatted_path"
13406 else
13407     FIND=find
13408     SORT=sort
13411 AC_SUBST(ATL_INCLUDE)
13412 AC_SUBST(ATL_LIB)
13413 AC_SUBST(FIND)
13414 AC_SUBST(SORT)
13415 AC_SUBST(WIN_GREP)
13416 AC_SUBST(WIN_LS)
13417 AC_SUBST(WIN_TOUCH)
13419 AC_SUBST(BUILD_TYPE)
13421 AC_SUBST(SOLARINC)
13423 PathFormat "$PERL"
13424 PERL="$formatted_path"
13425 AC_SUBST(PERL)
13427 if test -n "$TMPDIR"; then
13428     TEMP_DIRECTORY="$TMPDIR"
13429 else
13430     TEMP_DIRECTORY="/tmp"
13432 if test "$build_os" = "cygwin"; then
13433     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
13435 AC_SUBST(TEMP_DIRECTORY)
13437 # setup the PATH for the environment
13438 if test -n "$LO_PATH_FOR_BUILD"; then
13439     LO_PATH="$LO_PATH_FOR_BUILD"
13440 else
13441     LO_PATH="$PATH"
13443     case "$host_os" in
13445     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13446         if test "$ENABLE_JAVA" != ""; then
13447             pathmunge "$JAVA_HOME/bin" "after"
13448         fi
13449         ;;
13451     cygwin*)
13452         # Win32 make needs native paths
13453         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13454             LO_PATH=`cygpath -p -m "$PATH"`
13455         fi
13456         if test "$BITNESS_OVERRIDE" = 64; then
13457             # needed for msi packaging
13458             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13459         fi
13460         # .NET 4.6 and higher don't have bin directory
13461         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13462             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13463         fi
13464         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13465         pathmunge "$CSC_PATH" "before"
13466         pathmunge "$MIDL_PATH" "before"
13467         pathmunge "$AL_PATH" "before"
13468         pathmunge "$MSPDB_PATH" "before"
13469         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13470             pathmunge "$CL_PATH" "before"
13471         fi
13472         if test -n "$MSBUILD_PATH" ; then
13473             pathmunge "$MSBUILD_PATH" "before"
13474         fi
13475         if test "$BITNESS_OVERRIDE" = 64; then
13476             pathmunge "$COMPATH/bin/amd64" "before"
13477             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13478         else
13479             pathmunge "$COMPATH/bin" "before"
13480             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13481         fi
13482         if test "$ENABLE_JAVA" != ""; then
13483             if test -d "$JAVA_HOME/jre/bin/client"; then
13484                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13485             fi
13486             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13487                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13488             fi
13489             pathmunge "$JAVA_HOME/bin" "before"
13490         fi
13491         ;;
13493     solaris*)
13494         pathmunge "/usr/css/bin" "before"
13495         if test "$ENABLE_JAVA" != ""; then
13496             pathmunge "$JAVA_HOME/bin" "after"
13497         fi
13498         ;;
13499     esac
13502 AC_SUBST(LO_PATH)
13504 libo_FUZZ_SUMMARY
13506 # Generate a configuration sha256 we can use for deps
13507 if test -f config_host.mk; then
13508     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13510 if test -f config_host_lang.mk; then
13511     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13514 CFLAGS=$my_original_CFLAGS
13515 CXXFLAGS=$my_original_CXXFLAGS
13516 CPPFLAGS=$my_original_CPPFLAGS
13518 AC_LINK_FILES([include], [include])
13520 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
13521 # BUILD platform configuration] - otherwise breaks cross building
13522 AC_CONFIG_FILES([config_host.mk
13523                  config_host_lang.mk
13524                  Makefile
13525                  bin/bffvalidator.sh
13526                  bin/odfvalidator.sh
13527                  bin/officeotron.sh
13528                  hardened_runtime.xcent
13529                  instsetoo_native/util/openoffice.lst
13530                  sysui/desktop/macosx/Info.plist])
13531 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13532 AC_CONFIG_HEADERS([config_host/config_clang.h])
13533 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13534 AC_CONFIG_HEADERS([config_host/config_eot.h])
13535 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13536 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13537 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13538 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13539 AC_CONFIG_HEADERS([config_host/config_features.h])
13540 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13541 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13542 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13543 AC_CONFIG_HEADERS([config_host/config_folders.h])
13544 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13545 AC_CONFIG_HEADERS([config_host/config_gio.h])
13546 AC_CONFIG_HEADERS([config_host/config_global.h])
13547 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13548 AC_CONFIG_HEADERS([config_host/config_java.h])
13549 AC_CONFIG_HEADERS([config_host/config_langs.h])
13550 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13551 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13552 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13553 AC_CONFIG_HEADERS([config_host/config_locales.h])
13554 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13555 AC_CONFIG_HEADERS([config_host/config_oox.h])
13556 AC_CONFIG_HEADERS([config_host/config_options.h])
13557 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13558 AC_CONFIG_HEADERS([config_host/config_skia.h])
13559 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13560 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13561 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13562 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13563 AC_CONFIG_HEADERS([config_host/config_version.h])
13564 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13565 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13566 AC_CONFIG_HEADERS([config_host/config_python.h])
13567 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13568 AC_OUTPUT
13570 if test "$CROSS_COMPILING" = TRUE; then
13571     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13574 # touch the config timestamp file
13575 if test ! -f config_host.mk.stamp; then
13576     echo > config_host.mk.stamp
13577 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13578     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13579 else
13580     echo > config_host.mk.stamp
13583 # touch the config lang timestamp file
13584 if test ! -f config_host_lang.mk.stamp; then
13585     echo > config_host_lang.mk.stamp
13586 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13587     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13588 else
13589     echo > config_host_lang.mk.stamp
13593 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13594         -a "$build_os" = "cygwin"; then
13596 cat << _EOS
13597 ****************************************************************************
13598 WARNING:
13599 Your make version is known to be horribly slow, and hard to debug
13600 problems with. To get a reasonably functional make please do:
13602 to install a pre-compiled binary make for Win32
13604  mkdir -p /opt/lo/bin
13605  cd /opt/lo/bin
13606  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13607  cp make-4.2.1-msvc.exe make
13608  chmod +x make
13610 to install from source:
13611 place yourself in a working directory of you choice.
13613  git clone git://git.savannah.gnu.org/make.git
13615  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
13616  set PATH=%PATH%;C:\Cygwin\bin
13617  [or Cygwin64, if that is what you have]
13618  cd path-to-make-repo-you-cloned-above
13619  build_w32.bat --without-guile
13621 should result in a WinRel/gnumake.exe.
13622 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13624 Then re-run autogen.sh
13626 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13627 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13629 _EOS
13630 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13631     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13636 cat << _EOF
13637 ****************************************************************************
13639 To build, run:
13640 $GNUMAKE
13642 To view some help, run:
13643 $GNUMAKE help
13645 _EOF
13647 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13648     cat << _EOF
13649 After the build has finished successfully, you can immediately run what you built using the command:
13650 _EOF
13652     if test $_os = Darwin; then
13653         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
13654     else
13655         echo instdir/program/soffice
13656     fi
13657     cat << _EOF
13659 If you want to run the smoketest, run:
13660 $GNUMAKE check
13662 _EOF
13665 if test -f warn; then
13666     cat warn
13667     rm warn
13670 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: