Disable flavour in title bar for Linux.
[LibreOffice.git] / configure.ac
blobd477665acc28fde553a4e2ef84ecdf7fe2eb9411
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=""
706 ios*) # iOS
707     test_randr=no
708     test_xrender=no
709     test_freetype=no
710     test_fontconfig=no
711     test_dbus=no
712     if test -n "$LODE_HOME" ; then
713         mac_sanitize_path
714         AC_MSG_NOTICE([sanitized the PATH to $PATH])
715     fi
716     enable_gpgmepp=no
717     _os=iOS
718     test_cups=no
719     enable_mpl_subset=yes
720     enable_lotuswordpro=no
721     enable_coinmp=no
722     enable_lpsolve=no
723     enable_postgresql_sdbc=no
724     enable_extension_integration=no
725     enable_report_builder=no
726     with_ppds=no
727     if test "$enable_ios_simulator" = "yes"; then
728         host=x86_64-apple-darwin
729     fi
730     # See comment above the case "$host_os"
731     LINKFLAGSSHL="-dynamiclib -single_module"
733     # -fPIC is default
734     PICSWITCH=""
736     DLLPOST=".dylib"
738     # -undefined error is the default
739     LINKFLAGSNOUNDEFS=""
741     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios" part,
742     # so use arm64-apple-darwin as before for now.
743     HOST_PLATFORM=arm64-apple-darwin
746 freebsd*)
747     build_gstreamer_1_0=yes
748     test_kf5=yes
749     test_gtk3_kde5=yes
750     test_freetype=yes
751     build_skia=yes
752     AC_MSG_CHECKING([the FreeBSD operating system release])
753     if test -n "$with_os_version"; then
754         OSVERSION="$with_os_version"
755     else
756         OSVERSION=`/sbin/sysctl -n kern.osreldate`
757     fi
758     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
759     AC_MSG_CHECKING([which thread library to use])
760     if test "$OSVERSION" -lt "500016"; then
761         PTHREAD_CFLAGS="-D_THREAD_SAFE"
762         PTHREAD_LIBS="-pthread"
763     elif test "$OSVERSION" -lt "502102"; then
764         PTHREAD_CFLAGS="-D_THREAD_SAFE"
765         PTHREAD_LIBS="-lc_r"
766     else
767         PTHREAD_CFLAGS=""
768         PTHREAD_LIBS="-pthread"
769     fi
770     AC_MSG_RESULT([$PTHREAD_LIBS])
771     _os=FreeBSD
772     ;;
774 *netbsd*)
775     build_gstreamer_1_0=yes
776     test_kf5=yes
777     test_gtk3_kde5=yes
778     test_freetype=yes
779     build_skia=yes
780     PTHREAD_LIBS="-pthread -lpthread"
781     _os=NetBSD
782     ;;
784 aix*)
785     test_randr=no
786     test_freetype=yes
787     PTHREAD_LIBS=-pthread
788     _os=AIX
789     ;;
791 openbsd*)
792     test_freetype=yes
793     PTHREAD_CFLAGS="-D_THREAD_SAFE"
794     PTHREAD_LIBS="-pthread"
795     _os=OpenBSD
796     ;;
798 dragonfly*)
799     build_gstreamer_1_0=yes
800     test_kf5=yes
801     test_gtk3_kde5=yes
802     test_freetype=yes
803     build_skia=yes
804     PTHREAD_LIBS="-pthread"
805     _os=DragonFly
806     ;;
808 linux-android*)
809     build_gstreamer_1_0=no
810     enable_lotuswordpro=no
811     enable_mpl_subset=yes
812     enable_coinmp=yes
813     enable_lpsolve=no
814     enable_report_builder=no
815     enable_odk=no
816     enable_postgresql_sdbc=no
817     enable_python=no
818     test_cups=no
819     test_dbus=no
820     test_fontconfig=no
821     test_freetype=no
822     test_kf5=no
823     test_qt5=no
824     test_gtk3_kde5=no
825     test_randr=no
826     test_xrender=no
827     _os=Android
829     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
830     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
831     ;;
833 haiku*)
834     test_cups=no
835     test_dbus=no
836     test_randr=no
837     test_xrender=no
838     test_freetype=yes
839     enable_odk=no
840     enable_gstreamer_1_0=no
841     enable_vlc=no
842     enable_coinmp=no
843     enable_pdfium=no
844     enable_sdremote=no
845     enable_postgresql_sdbc=no
846     enable_firebird_sdbc=no
847     _os=Haiku
848     ;;
851     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
852     ;;
853 esac
855 AC_SUBST(HOST_PLATFORM)
857 if test "$_os" = "Android" ; then
858     # Verify that the NDK and SDK options are proper
859     if test -z "$with_android_ndk"; then
860         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
861     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
862         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
863     fi
865     if test -z "$ANDROID_SDK_HOME"; then
866         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
867     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
868         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
869     fi
871     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
872     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
873         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
874                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
875                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
876         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
877         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
878         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
879     fi
880     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
881         AC_MSG_WARN([android support repository not found - install with
882                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
883                      to allow the build to download the specified version of the android support libraries])
884         add_warning "android support repository not found - install with"
885         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
886         add_warning "to allow the build to download the specified version of the android support libraries"
887     fi
890 if test "$_os" = "AIX"; then
891     AC_PATH_PROG(GAWK, gawk)
892     if test -z "$GAWK"; then
893         AC_MSG_ERROR([gawk not found in \$PATH])
894     fi
897 AC_SUBST(SDKDIRNAME)
899 AC_SUBST(PTHREAD_CFLAGS)
900 AC_SUBST(PTHREAD_LIBS)
902 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
903 # By default use the ones specified by our build system,
904 # but explicit override is possible.
905 AC_MSG_CHECKING(for explicit AFLAGS)
906 if test -n "$AFLAGS"; then
907     AC_MSG_RESULT([$AFLAGS])
908     x_AFLAGS=
909 else
910     AC_MSG_RESULT(no)
911     x_AFLAGS=[\#]
913 AC_MSG_CHECKING(for explicit CFLAGS)
914 if test -n "$CFLAGS"; then
915     AC_MSG_RESULT([$CFLAGS])
916     x_CFLAGS=
917 else
918     AC_MSG_RESULT(no)
919     x_CFLAGS=[\#]
921 AC_MSG_CHECKING(for explicit CXXFLAGS)
922 if test -n "$CXXFLAGS"; then
923     AC_MSG_RESULT([$CXXFLAGS])
924     x_CXXFLAGS=
925 else
926     AC_MSG_RESULT(no)
927     x_CXXFLAGS=[\#]
929 AC_MSG_CHECKING(for explicit OBJCFLAGS)
930 if test -n "$OBJCFLAGS"; then
931     AC_MSG_RESULT([$OBJCFLAGS])
932     x_OBJCFLAGS=
933 else
934     AC_MSG_RESULT(no)
935     x_OBJCFLAGS=[\#]
937 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
938 if test -n "$OBJCXXFLAGS"; then
939     AC_MSG_RESULT([$OBJCXXFLAGS])
940     x_OBJCXXFLAGS=
941 else
942     AC_MSG_RESULT(no)
943     x_OBJCXXFLAGS=[\#]
945 AC_MSG_CHECKING(for explicit LDFLAGS)
946 if test -n "$LDFLAGS"; then
947     AC_MSG_RESULT([$LDFLAGS])
948     x_LDFLAGS=
949 else
950     AC_MSG_RESULT(no)
951     x_LDFLAGS=[\#]
953 AC_SUBST(AFLAGS)
954 AC_SUBST(CFLAGS)
955 AC_SUBST(CXXFLAGS)
956 AC_SUBST(OBJCFLAGS)
957 AC_SUBST(OBJCXXFLAGS)
958 AC_SUBST(LDFLAGS)
959 AC_SUBST(x_AFLAGS)
960 AC_SUBST(x_CFLAGS)
961 AC_SUBST(x_CXXFLAGS)
962 AC_SUBST(x_OBJCFLAGS)
963 AC_SUBST(x_OBJCXXFLAGS)
964 AC_SUBST(x_LDFLAGS)
966 dnl These are potentially set for MSVC, in the code checking for UCRT below:
967 my_original_CFLAGS=$CFLAGS
968 my_original_CXXFLAGS=$CXXFLAGS
969 my_original_CPPFLAGS=$CPPFLAGS
971 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
972 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
973 dnl AC_PROG_CC internally.
974 if test "$_os" != "WINNT"; then
975     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
976     save_CFLAGS=$CFLAGS
977     AC_PROG_CC
978     CFLAGS=$save_CFLAGS
979     if test -z "$CC_BASE"; then
980         CC_BASE=`first_arg_basename "$CC"`
981     fi
984 if test "$_os" != "WINNT"; then
985     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
986 else
987     ENDIANNESS=little
989 AC_SUBST(ENDIANNESS)
991 if test $_os != "WINNT"; then
992     save_LIBS="$LIBS"
993     AC_SEARCH_LIBS([dlsym], [dl],
994         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
995         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
996     LIBS="$save_LIBS"
998 AC_SUBST(DLOPEN_LIBS)
1000 AC_ARG_ENABLE(ios-simulator,
1001     AS_HELP_STRING([--enable-ios-simulator],
1002         [build i386 or x86_64 for ios simulator])
1005 AC_ARG_ENABLE(ios-libreofficelight-app,
1006     AS_HELP_STRING([--enable-ios-libreofficelight-app],
1007         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
1008          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
1009          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
1012 ENABLE_IOS_LIBREOFFICELIGHT_APP=
1013 if test "$enable_ios_libreofficelight_app" = yes; then
1014     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
1016 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
1018 ###############################################################################
1019 # Extensions switches --enable/--disable
1020 ###############################################################################
1021 # By default these should be enabled unless having extra dependencies.
1022 # If there is extra dependency over configure options then the enable should
1023 # be automagic based on whether the requiring feature is enabled or not.
1024 # All this options change anything only with --enable-extension-integration.
1026 # The name of this option and its help string makes it sound as if
1027 # extensions are built anyway, just not integrated in the installer,
1028 # if you use --disable-extension-integration. Is that really the
1029 # case?
1031 libo_FUZZ_ARG_ENABLE(extension-integration,
1032     AS_HELP_STRING([--disable-extension-integration],
1033         [Disable integration of the built extensions in the installer of the
1034          product. Use this switch to disable the integration.])
1037 AC_ARG_ENABLE(avmedia,
1038     AS_HELP_STRING([--disable-avmedia],
1039         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1042 AC_ARG_ENABLE(database-connectivity,
1043     AS_HELP_STRING([--disable-database-connectivity],
1044         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1047 # This doesn't mean not building (or "integrating") extensions
1048 # (although it probably should; i.e. it should imply
1049 # --disable-extension-integration I guess), it means not supporting
1050 # any extension mechanism at all
1051 libo_FUZZ_ARG_ENABLE(extensions,
1052     AS_HELP_STRING([--disable-extensions],
1053         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1056 AC_ARG_ENABLE(scripting,
1057     AS_HELP_STRING([--disable-scripting],
1058         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1061 # This is mainly for Android and iOS, but could potentially be used in some
1062 # special case otherwise, too, so factored out as a separate setting
1064 AC_ARG_ENABLE(dynamic-loading,
1065     AS_HELP_STRING([--disable-dynamic-loading],
1066         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1069 libo_FUZZ_ARG_ENABLE(report-builder,
1070     AS_HELP_STRING([--disable-report-builder],
1071         [Disable the Report Builder.])
1074 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1075     AS_HELP_STRING([--enable-ext-wiki-publisher],
1076         [Enable the Wiki Publisher extension.])
1079 libo_FUZZ_ARG_ENABLE(lpsolve,
1080     AS_HELP_STRING([--disable-lpsolve],
1081         [Disable compilation of the lp solve solver ])
1083 libo_FUZZ_ARG_ENABLE(coinmp,
1084     AS_HELP_STRING([--disable-coinmp],
1085         [Disable compilation of the CoinMP solver ])
1088 libo_FUZZ_ARG_ENABLE(pdfimport,
1089     AS_HELP_STRING([--disable-pdfimport],
1090         [Disable building the PDF import feature.])
1093 libo_FUZZ_ARG_ENABLE(pdfium,
1094     AS_HELP_STRING([--disable-pdfium],
1095         [Disable building PDFium.])
1098 libo_FUZZ_ARG_ENABLE(skia,
1099     AS_HELP_STRING([--disable-skia],
1100         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1103 ###############################################################################
1105 dnl ---------- *** ----------
1107 libo_FUZZ_ARG_ENABLE(mergelibs,
1108     AS_HELP_STRING([--enable-mergelibs],
1109         [Merge several of the smaller libraries into one big, "merged", one.])
1112 libo_FUZZ_ARG_ENABLE(breakpad,
1113     AS_HELP_STRING([--enable-breakpad],
1114         [Enables breakpad for crash reporting.])
1117 libo_FUZZ_ARG_ENABLE(crashdump,
1118     AS_HELP_STRING([--disable-crashdump],
1119         [Disable dump.ini and dump-file, when --enable-breakpad])
1122 AC_ARG_ENABLE(fetch-external,
1123     AS_HELP_STRING([--disable-fetch-external],
1124         [Disables fetching external tarballs from web sources.])
1127 AC_ARG_ENABLE(fuzzers,
1128     AS_HELP_STRING([--enable-fuzzers],
1129         [Enables building libfuzzer targets for fuzz testing.])
1132 libo_FUZZ_ARG_ENABLE(pch,
1133     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1134         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1135          Using 'system' will include only external headers, 'base' will add also headers
1136          from base modules, 'normal' will also add all headers except from the module built,
1137          'full' will use all suitable headers even from a module itself.])
1140 libo_FUZZ_ARG_ENABLE(epm,
1141     AS_HELP_STRING([--enable-epm],
1142         [LibreOffice includes self-packaging code, that requires epm, however epm is
1143          useless for large scale package building.])
1146 libo_FUZZ_ARG_ENABLE(odk,
1147     AS_HELP_STRING([--disable-odk],
1148         [LibreOffice includes an ODK, office development kit which some packagers may
1149          wish to build without.])
1152 AC_ARG_ENABLE(mpl-subset,
1153     AS_HELP_STRING([--enable-mpl-subset],
1154         [Don't compile any pieces which are not MPL or more liberally licensed])
1157 libo_FUZZ_ARG_ENABLE(evolution2,
1158     AS_HELP_STRING([--enable-evolution2],
1159         [Allows the built-in evolution 2 addressbook connectivity build to be
1160          enabled.])
1163 AC_ARG_ENABLE(avahi,
1164     AS_HELP_STRING([--enable-avahi],
1165         [Determines whether to use Avahi to advertise Impress to remote controls.])
1168 libo_FUZZ_ARG_ENABLE(werror,
1169     AS_HELP_STRING([--enable-werror],
1170         [Turn warnings to errors. (Has no effect in modules where the treating
1171          of warnings as errors is disabled explicitly.)]),
1174 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1175     AS_HELP_STRING([--enable-assert-always-abort],
1176         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1179 libo_FUZZ_ARG_ENABLE(dbgutil,
1180     AS_HELP_STRING([--enable-dbgutil],
1181         [Provide debugging support from --enable-debug and include additional debugging
1182          utilities such as object counting or more expensive checks.
1183          This is the recommended option for developers.
1184          Note that this makes the build ABI incompatible, it is not possible to mix object
1185          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1187 libo_FUZZ_ARG_ENABLE(debug,
1188     AS_HELP_STRING([--enable-debug],
1189         [Include debugging information, disable compiler optimization and inlining plus
1190          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1192 libo_FUZZ_ARG_ENABLE(split-debug,
1193     AS_HELP_STRING([--disable-split-debug],
1194         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1195          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1197 libo_FUZZ_ARG_ENABLE(gdb-index,
1198     AS_HELP_STRING([--disable-gdb-index],
1199         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1200          The feature requires the gold or lld linker.]))
1202 libo_FUZZ_ARG_ENABLE(sal-log,
1203     AS_HELP_STRING([--enable-sal-log],
1204         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1206 libo_FUZZ_ARG_ENABLE(symbols,
1207     AS_HELP_STRING([--enable-symbols],
1208         [Generate debug information.
1209          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1210          otherwise. It is possible to explicitly specify gbuild build targets
1211          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1212          everything in the directory; there is no ordering, more specific overrides
1213          more general, and disabling takes precedence).
1214          Example: --enable-symbols="all -sw/ -Library_sc".]))
1216 libo_FUZZ_ARG_ENABLE(optimized,
1217     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1218         [Whether to compile with optimization flags.
1219          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1220          otherwise. Using 'debug' will try to use only optimizations that should
1221          not interfere with debugging.]))
1223 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1224     AS_HELP_STRING([--disable-runtime-optimizations],
1225         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1226          JVM JIT) that are known to interact badly with certain dynamic analysis
1227          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1228          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1229          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1231 AC_ARG_WITH(valgrind,
1232     AS_HELP_STRING([--with-valgrind],
1233         [Make availability of Valgrind headers a hard requirement.]))
1235 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1236     AS_HELP_STRING([--enable-compiler-plugins],
1237         [Enable compiler plugins that will perform additional checks during
1238          building. Enabled automatically by --enable-dbgutil.
1239          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1240 COMPILER_PLUGINS_DEBUG=
1241 if test "$enable_compiler_plugins" = debug; then
1242     enable_compiler_plugins=yes
1243     COMPILER_PLUGINS_DEBUG=TRUE
1246 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1247     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1248         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1249          relevant in the --disable-compiler-plugins case.]))
1251 libo_FUZZ_ARG_ENABLE(ooenv,
1252     AS_HELP_STRING([--disable-ooenv],
1253         [Disable ooenv for the instdir installation.]))
1255 AC_ARG_ENABLE(lto,
1256     AS_HELP_STRING([--enable-lto],
1257         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1258          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1259          linker. For MSVC, this option is broken at the moment. This is experimental work
1260          in progress that shouldn't be used unless you are working on it.)]))
1262 AC_ARG_ENABLE(python,
1263     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1264         [Enables or disables Python support at run-time.
1265          Also specifies what Python to use at build-time.
1266          'fully-internal' even forces the internal version for uses of Python
1267          during the build.
1268          On macOS the only choices are
1269          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1270          ]))
1272 libo_FUZZ_ARG_ENABLE(gtk3,
1273     AS_HELP_STRING([--disable-gtk3],
1274         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1275 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1277 AC_ARG_ENABLE(introspection,
1278     AS_HELP_STRING([--enable-introspection],
1279         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1280          Linux distributions.)]))
1282 AC_ARG_ENABLE(split-app-modules,
1283     AS_HELP_STRING([--enable-split-app-modules],
1284         [Split file lists for app modules, e.g. base, calc.
1285          Has effect only with make distro-pack-install]),
1288 AC_ARG_ENABLE(split-opt-features,
1289     AS_HELP_STRING([--enable-split-opt-features],
1290         [Split file lists for some optional features, e.g. pyuno, testtool.
1291          Has effect only with make distro-pack-install]),
1294 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1295     AS_HELP_STRING([--disable-cairo-canvas],
1296         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1299 libo_FUZZ_ARG_ENABLE(dbus,
1300     AS_HELP_STRING([--disable-dbus],
1301         [Determines whether to enable features that depend on dbus.
1302          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1303 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1305 libo_FUZZ_ARG_ENABLE(sdremote,
1306     AS_HELP_STRING([--disable-sdremote],
1307         [Determines whether to enable Impress remote control (i.e. the server component).]),
1308 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1310 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1311     AS_HELP_STRING([--disable-sdremote-bluetooth],
1312         [Determines whether to build sdremote with bluetooth support.
1313          Requires dbus on Linux.]))
1315 libo_FUZZ_ARG_ENABLE(gio,
1316     AS_HELP_STRING([--disable-gio],
1317         [Determines whether to use the GIO support.]),
1318 ,test "${enable_gio+set}" = set || enable_gio=yes)
1320 AC_ARG_ENABLE(qt5,
1321     AS_HELP_STRING([--enable-qt5],
1322         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1323          available.]),
1326 AC_ARG_ENABLE(kf5,
1327     AS_HELP_STRING([--enable-kf5],
1328         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1329          KF5 are available.]),
1332 AC_ARG_ENABLE(kde5,
1333     AS_HELP_STRING([--enable-kde5],
1334         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1337 AC_ARG_ENABLE(gtk3_kde5,
1338     AS_HELP_STRING([--enable-gtk3-kde5],
1339         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1340          platforms where Gtk3, Qt5 and Plasma is available.]),
1343 AC_ARG_ENABLE(gui,
1344     AS_HELP_STRING([--disable-gui],
1345         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1346 ,enable_gui=yes)
1348 libo_FUZZ_ARG_ENABLE(randr,
1349     AS_HELP_STRING([--disable-randr],
1350         [Disable RandR support in the vcl project.]),
1351 ,test "${enable_randr+set}" = set || enable_randr=yes)
1353 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1354     AS_HELP_STRING([--disable-gstreamer-1-0],
1355         [Disable building with the gstreamer 1.0 avmedia backend.]),
1356 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1358 libo_FUZZ_ARG_ENABLE(vlc,
1359     AS_HELP_STRING([--enable-vlc],
1360         [Enable building with the (experimental) VLC avmedia backend.]),
1361 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1363 libo_FUZZ_ARG_ENABLE(neon,
1364     AS_HELP_STRING([--disable-neon],
1365         [Disable neon and the compilation of webdav binding.]),
1368 libo_FUZZ_ARG_ENABLE([eot],
1369     [AS_HELP_STRING([--enable-eot],
1370         [Enable support for Embedded OpenType fonts.])],
1371 ,test "${enable_eot+set}" = set || enable_eot=no)
1373 libo_FUZZ_ARG_ENABLE(cve-tests,
1374     AS_HELP_STRING([--disable-cve-tests],
1375         [Prevent CVE tests to be executed]),
1378 libo_FUZZ_ARG_ENABLE(chart-tests,
1379     AS_HELP_STRING([--enable-chart-tests],
1380         [Executes chart XShape tests. In a perfect world these tests would be
1381          stable and everyone could run them, in reality it is best to run them
1382          only on a few machines that are known to work and maintained by people
1383          who can judge if a test failure is a regression or not.]),
1386 AC_ARG_ENABLE(build-unowinreg,
1387     AS_HELP_STRING([--enable-build-unowinreg],
1388         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1389          compiler is needed on Linux.]),
1392 AC_ARG_ENABLE(build-opensymbol,
1393     AS_HELP_STRING([--enable-build-opensymbol],
1394         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1395          fontforge installed.]),
1398 AC_ARG_ENABLE(dependency-tracking,
1399     AS_HELP_STRING([--enable-dependency-tracking],
1400         [Do not reject slow dependency extractors.])[
1401   --disable-dependency-tracking
1402                           Disables generation of dependency information.
1403                           Speed up one-time builds.],
1406 AC_ARG_ENABLE(icecream,
1407     AS_HELP_STRING([--enable-icecream],
1408         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1409          It defaults to /opt/icecream for the location of the icecream gcc/g++
1410          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1413 AC_ARG_ENABLE(ld,
1414     AS_HELP_STRING([--enable-ld=<linker>],
1415         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1416          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1419 libo_FUZZ_ARG_ENABLE(cups,
1420     AS_HELP_STRING([--disable-cups],
1421         [Do not build cups support.])
1424 AC_ARG_ENABLE(ccache,
1425     AS_HELP_STRING([--disable-ccache],
1426         [Do not try to use ccache automatically.
1427          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1428          CC/CXX are not yet set, and --enable-icecream is not given, we
1429          attempt to use ccache. --disable-ccache disables ccache completely.
1430          Additionally ccache's depend mode is enabled if possible,
1431          use --enable-ccache=nodepend to enable ccache without depend mode.
1435 AC_ARG_ENABLE(64-bit,
1436     AS_HELP_STRING([--enable-64-bit],
1437         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1438          At the moment meaningful only for Windows.]), ,)
1440 libo_FUZZ_ARG_ENABLE(online-update,
1441     AS_HELP_STRING([--enable-online-update],
1442         [Enable the online update service that will check for new versions of
1443          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1444          If the value is "mar", the experimental Mozilla-like update will be
1445          enabled instead of the traditional update mechanism.]),
1448 AC_ARG_WITH(update-config,
1449     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1450                    [Path to the update config ini file]))
1452 libo_FUZZ_ARG_ENABLE(extension-update,
1453     AS_HELP_STRING([--disable-extension-update],
1454         [Disable possibility to update installed extensions.]),
1457 libo_FUZZ_ARG_ENABLE(release-build,
1458     AS_HELP_STRING([--enable-release-build],
1459         [Enable release build. Note that the "release build" choice is orthogonal to
1460          whether symbols are present, debug info is generated, or optimization
1461          is done.
1462          See http://wiki.documentfoundation.org/Development/DevBuild]),
1465 AC_ARG_ENABLE(windows-build-signing,
1466     AS_HELP_STRING([--enable-windows-build-signing],
1467         [Enable signing of windows binaries (*.exe, *.dll)]),
1470 AC_ARG_ENABLE(silent-msi,
1471     AS_HELP_STRING([--enable-silent-msi],
1472         [Enable MSI with LIMITUI=1 (silent install).]),
1475 AC_ARG_ENABLE(macosx-code-signing,
1476     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1477         [Sign executables, dylibs, frameworks and the app bundle. If you
1478          don't provide an identity the first suitable certificate
1479          in your keychain is used.]),
1482 AC_ARG_ENABLE(macosx-package-signing,
1483     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1484         [Create a .pkg suitable for uploading to the Mac App Store and sign
1485          it. If you don't provide an identity the first suitable certificate
1486          in your keychain is used.]),
1489 AC_ARG_ENABLE(macosx-sandbox,
1490     AS_HELP_STRING([--enable-macosx-sandbox],
1491         [Make the app bundle run in a sandbox. Requires code signing.
1492          Is required by apps distributed in the Mac App Store, and implies
1493          adherence to App Store rules.]),
1496 AC_ARG_WITH(macosx-bundle-identifier,
1497     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1498         [Define the macOS bundle identifier. Default is the somewhat weird
1499          org.libreoffice.script ("script", huh?).]),
1500 ,with_macosx_bundle_identifier=org.libreoffice.script)
1502 AC_ARG_WITH(product-name,
1503     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1504         [Define the product name. Default is AC_PACKAGE_NAME.]),
1505 ,with_product_name=$PRODUCTNAME)
1507 AC_ARG_WITH(product-flavor,
1508     AS_HELP_STRING([--with-product-flavor='My Own Personal Flavor'],
1509         [Define the product flavor. Default is Personal.]),
1510 ,with_product_flavor=Personal)
1512 AC_ARG_WITH(package-version,
1513     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1514         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1517 libo_FUZZ_ARG_ENABLE(readonly-installset,
1518     AS_HELP_STRING([--enable-readonly-installset],
1519         [Prevents any attempts by LibreOffice to write into its installation. That means
1520          at least that no "system-wide" extensions can be added. Partly experimental work in
1521          progress, probably not fully implemented. Always enabled for macOS.]),
1524 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1525     AS_HELP_STRING([--disable-postgresql-sdbc],
1526         [Disable the build of the PostgreSQL-SDBC driver.])
1529 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1530     AS_HELP_STRING([--disable-lotuswordpro],
1531         [Disable the build of the Lotus Word Pro filter.]),
1532 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1534 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1535     AS_HELP_STRING([--disable-firebird-sdbc],
1536         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1537 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1539 AC_ARG_ENABLE(bogus-pkg-config,
1540     AS_HELP_STRING([--enable-bogus-pkg-config],
1541         [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.]),
1544 AC_ARG_ENABLE(openssl,
1545     AS_HELP_STRING([--disable-openssl],
1546         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1547          components will either use GNUTLS or NSS. Work in progress,
1548          use only if you are hacking on it.]),
1549 ,enable_openssl=yes)
1551 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1552     AS_HELP_STRING([--enable-cipher-openssl-backend],
1553         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1554          Requires --enable-openssl.]))
1556 AC_ARG_ENABLE(library-bin-tar,
1557     AS_HELP_STRING([--enable-library-bin-tar],
1558         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1559         Some libraries can save their build result in a tarball
1560         stored in TARFILE_LOCATION. That binary tarball is
1561         uniquely identified by the source tarball,
1562         the content of the config_host.mk file and the content
1563         of the top-level directory in core for that library
1564         If this option is enabled, then if such a tarfile exist, it will be untarred
1565         instead of the source tarfile, and the build step will be skipped for that
1566         library.
1567         If a proper tarfile does not exist, then the normal source-based
1568         build is done for that library and a proper binary tarfile is created
1569         for the next time.]),
1572 AC_ARG_ENABLE(dconf,
1573     AS_HELP_STRING([--disable-dconf],
1574         [Disable the dconf configuration backend (enabled by default where
1575          available).]))
1577 libo_FUZZ_ARG_ENABLE(formula-logger,
1578     AS_HELP_STRING(
1579         [--enable-formula-logger],
1580         [Enable formula logger for logging formula calculation flow in Calc.]
1581     )
1584 AC_ARG_ENABLE(ldap,
1585     AS_HELP_STRING([--disable-ldap],
1586         [Disable LDAP support.]),
1587 ,enable_ldap=yes)
1589 dnl ===================================================================
1590 dnl Optional Packages (--with/without-)
1591 dnl ===================================================================
1593 AC_ARG_WITH(gcc-home,
1594     AS_HELP_STRING([--with-gcc-home],
1595         [Specify the location of gcc/g++ manually. This can be used in conjunction
1596          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1597          non-default path.]),
1600 AC_ARG_WITH(gnu-patch,
1601     AS_HELP_STRING([--with-gnu-patch],
1602         [Specify location of GNU patch on Solaris or FreeBSD.]),
1605 AC_ARG_WITH(build-platform-configure-options,
1606     AS_HELP_STRING([--with-build-platform-configure-options],
1607         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1610 AC_ARG_WITH(gnu-cp,
1611     AS_HELP_STRING([--with-gnu-cp],
1612         [Specify location of GNU cp on Solaris or FreeBSD.]),
1615 AC_ARG_WITH(external-tar,
1616     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1617         [Specify an absolute path of where to find (and store) tarfiles.]),
1618     TARFILE_LOCATION=$withval ,
1621 AC_ARG_WITH(referenced-git,
1622     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1623         [Specify another checkout directory to reference. This makes use of
1624                  git submodule update --reference, and saves a lot of diskspace
1625                  when having multiple trees side-by-side.]),
1626     GIT_REFERENCE_SRC=$withval ,
1629 AC_ARG_WITH(linked-git,
1630     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1631         [Specify a directory where the repositories of submodules are located.
1632          This uses a method similar to git-new-workdir to get submodules.]),
1633     GIT_LINK_SRC=$withval ,
1636 AC_ARG_WITH(galleries,
1637     AS_HELP_STRING([--with-galleries],
1638         [Specify how galleries should be built. It is possible either to
1639          build these internally from source ("build"),
1640          or to disable them ("no")]),
1643 AC_ARG_WITH(theme,
1644     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1645         [Choose which themes to include. By default those themes with an '*' are included.
1646          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1647          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
1650 libo_FUZZ_ARG_WITH(helppack-integration,
1651     AS_HELP_STRING([--without-helppack-integration],
1652         [It will not integrate the helppacks to the installer
1653          of the product. Please use this switch to use the online help
1654          or separate help packages.]),
1657 libo_FUZZ_ARG_WITH(fonts,
1658     AS_HELP_STRING([--without-fonts],
1659         [LibreOffice includes some third-party fonts to provide a reliable basis for
1660          help content, templates, samples, etc. When these fonts are already
1661          known to be available on the system then you should use this option.]),
1664 AC_ARG_WITH(epm,
1665     AS_HELP_STRING([--with-epm],
1666         [Decides which epm to use. Default is to use the one from the system if
1667          one is built. When either this is not there or you say =internal epm
1668          will be built.]),
1671 AC_ARG_WITH(package-format,
1672     AS_HELP_STRING([--with-package-format],
1673         [Specify package format(s) for LibreOffice installation sets. The
1674          implicit --without-package-format leads to no installation sets being
1675          generated. Possible values: aix, archive, bsd, deb, dmg,
1676          installed, msi, pkg, and rpm.
1677          Example: --with-package-format='deb rpm']),
1680 AC_ARG_WITH(tls,
1681     AS_HELP_STRING([--with-tls],
1682         [Decides which TLS/SSL and cryptographic implementations to use for
1683          LibreOffice's code. Notice that this doesn't apply for depending
1684          libraries like "neon", for example. Default is to use NSS
1685          although OpenSSL is also possible. Notice that selecting NSS restricts
1686          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1687          restrict by now the usage of NSS in LO's code. Possible values:
1688          openssl, nss. Example: --with-tls="nss"]),
1691 AC_ARG_WITH(system-libs,
1692     AS_HELP_STRING([--with-system-libs],
1693         [Use libraries already on system -- enables all --with-system-* flags.]),
1696 AC_ARG_WITH(system-bzip2,
1697     AS_HELP_STRING([--with-system-bzip2],
1698         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1699     [with_system_bzip2="$with_system_libs"])
1701 AC_ARG_WITH(system-headers,
1702     AS_HELP_STRING([--with-system-headers],
1703         [Use headers already on system -- enables all --with-system-* flags for
1704          external packages whose headers are the only entities used i.e.
1705          boost/odbc/sane-header(s).]),,
1706     [with_system_headers="$with_system_libs"])
1708 AC_ARG_WITH(system-jars,
1709     AS_HELP_STRING([--without-system-jars],
1710         [When building with --with-system-libs, also the needed jars are expected
1711          on the system. Use this to disable that]),,
1712     [with_system_jars="$with_system_libs"])
1714 AC_ARG_WITH(system-cairo,
1715     AS_HELP_STRING([--with-system-cairo],
1716         [Use cairo libraries already on system.  Happens automatically for
1717          (implicit) --enable-gtk3.]))
1719 AC_ARG_WITH(system-epoxy,
1720     AS_HELP_STRING([--with-system-epoxy],
1721         [Use epoxy libraries already on system.  Happens automatically for
1722          (implicit) --enable-gtk3.]),,
1723        [with_system_epoxy="$with_system_libs"])
1725 AC_ARG_WITH(myspell-dicts,
1726     AS_HELP_STRING([--with-myspell-dicts],
1727         [Adds myspell dictionaries to the LibreOffice installation set]),
1730 AC_ARG_WITH(system-dicts,
1731     AS_HELP_STRING([--without-system-dicts],
1732         [Do not use dictionaries from system paths.]),
1735 AC_ARG_WITH(external-dict-dir,
1736     AS_HELP_STRING([--with-external-dict-dir],
1737         [Specify external dictionary dir.]),
1740 AC_ARG_WITH(external-hyph-dir,
1741     AS_HELP_STRING([--with-external-hyph-dir],
1742         [Specify external hyphenation pattern dir.]),
1745 AC_ARG_WITH(external-thes-dir,
1746     AS_HELP_STRING([--with-external-thes-dir],
1747         [Specify external thesaurus dir.]),
1750 AC_ARG_WITH(system-zlib,
1751     AS_HELP_STRING([--with-system-zlib],
1752         [Use zlib already on system.]),,
1753     [with_system_zlib=auto])
1755 AC_ARG_WITH(system-jpeg,
1756     AS_HELP_STRING([--with-system-jpeg],
1757         [Use jpeg already on system.]),,
1758     [with_system_jpeg="$with_system_libs"])
1760 AC_ARG_WITH(system-clucene,
1761     AS_HELP_STRING([--with-system-clucene],
1762         [Use clucene already on system.]),,
1763     [with_system_clucene="$with_system_libs"])
1765 AC_ARG_WITH(system-expat,
1766     AS_HELP_STRING([--with-system-expat],
1767         [Use expat already on system.]),,
1768     [with_system_expat="$with_system_libs"])
1770 AC_ARG_WITH(system-libxml,
1771     AS_HELP_STRING([--with-system-libxml],
1772         [Use libxml/libxslt already on system.]),,
1773     [with_system_libxml=auto])
1775 AC_ARG_WITH(system-icu,
1776     AS_HELP_STRING([--with-system-icu],
1777         [Use icu already on system.]),,
1778     [with_system_icu="$with_system_libs"])
1780 AC_ARG_WITH(system-ucpp,
1781     AS_HELP_STRING([--with-system-ucpp],
1782         [Use ucpp already on system.]),,
1783     [])
1785 AC_ARG_WITH(system-openldap,
1786     AS_HELP_STRING([--with-system-openldap],
1787         [Use the OpenLDAP LDAP SDK already on system.]),,
1788     [with_system_openldap="$with_system_libs"])
1790 libo_FUZZ_ARG_ENABLE(poppler,
1791     AS_HELP_STRING([--disable-poppler],
1792         [Disable building Poppler.])
1795 AC_ARG_WITH(system-poppler,
1796     AS_HELP_STRING([--with-system-poppler],
1797         [Use system poppler (only needed for PDF import).]),,
1798     [with_system_poppler="$with_system_libs"])
1800 libo_FUZZ_ARG_ENABLE(gpgmepp,
1801     AS_HELP_STRING([--disable-gpgmepp],
1802         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
1805 AC_ARG_WITH(system-gpgmepp,
1806     AS_HELP_STRING([--with-system-gpgmepp],
1807         [Use gpgmepp already on system]),,
1808     [with_system_gpgmepp="$with_system_libs"])
1810 AC_ARG_WITH(system-apache-commons,
1811     AS_HELP_STRING([--with-system-apache-commons],
1812         [Use Apache commons libraries already on system.]),,
1813     [with_system_apache_commons="$with_system_jars"])
1815 AC_ARG_WITH(system-mariadb,
1816     AS_HELP_STRING([--with-system-mariadb],
1817         [Use MariaDB/MySQL libraries already on system.]),,
1818     [with_system_mariadb="$with_system_libs"])
1820 AC_ARG_ENABLE(bundle-mariadb,
1821     AS_HELP_STRING([--enable-bundle-mariadb],
1822         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1825 AC_ARG_WITH(system-postgresql,
1826     AS_HELP_STRING([--with-system-postgresql],
1827         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1828          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1829     [with_system_postgresql="$with_system_libs"])
1831 AC_ARG_WITH(libpq-path,
1832     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1833         [Use this PostgreSQL C interface (libpq) installation for building
1834          the PostgreSQL-SDBC extension.]),
1837 AC_ARG_WITH(system-firebird,
1838     AS_HELP_STRING([--with-system-firebird],
1839         [Use Firebird libraries already on system, for building the Firebird-SDBC
1840          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1841     [with_system_firebird="$with_system_libs"])
1843 AC_ARG_WITH(system-libtommath,
1844             AS_HELP_STRING([--with-system-libtommath],
1845                            [Use libtommath already on system]),,
1846             [with_system_libtommath="$with_system_libs"])
1848 AC_ARG_WITH(system-hsqldb,
1849     AS_HELP_STRING([--with-system-hsqldb],
1850         [Use hsqldb already on system.]))
1852 AC_ARG_WITH(hsqldb-jar,
1853     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     HSQLDB_JAR=$withval)
1857 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1858     AS_HELP_STRING([--disable-scripting-beanshell],
1859         [Disable support for scripts in BeanShell.]),
1863 AC_ARG_WITH(system-beanshell,
1864     AS_HELP_STRING([--with-system-beanshell],
1865         [Use beanshell already on system.]),,
1866     [with_system_beanshell="$with_system_jars"])
1868 AC_ARG_WITH(beanshell-jar,
1869     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1870         [Specify path to jarfile manually.]),
1871     BSH_JAR=$withval)
1873 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1874     AS_HELP_STRING([--disable-scripting-javascript],
1875         [Disable support for scripts in JavaScript.]),
1879 AC_ARG_WITH(system-rhino,
1880     AS_HELP_STRING([--with-system-rhino],
1881         [Use rhino already on system.]),,)
1882 #    [with_system_rhino="$with_system_jars"])
1883 # Above is not used as we have different debug interface
1884 # patched into internal rhino. This code needs to be fixed
1885 # before we can enable it by default.
1887 AC_ARG_WITH(rhino-jar,
1888     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     RHINO_JAR=$withval)
1892 AC_ARG_WITH(commons-logging-jar,
1893     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1894         [Specify path to jarfile manually.]),
1895     COMMONS_LOGGING_JAR=$withval)
1897 AC_ARG_WITH(system-jfreereport,
1898     AS_HELP_STRING([--with-system-jfreereport],
1899         [Use JFreeReport already on system.]),,
1900     [with_system_jfreereport="$with_system_jars"])
1902 AC_ARG_WITH(sac-jar,
1903     AS_HELP_STRING([--with-sac-jar=JARFILE],
1904         [Specify path to jarfile manually.]),
1905     SAC_JAR=$withval)
1907 AC_ARG_WITH(libxml-jar,
1908     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1909         [Specify path to jarfile manually.]),
1910     LIBXML_JAR=$withval)
1912 AC_ARG_WITH(flute-jar,
1913     AS_HELP_STRING([--with-flute-jar=JARFILE],
1914         [Specify path to jarfile manually.]),
1915     FLUTE_JAR=$withval)
1917 AC_ARG_WITH(jfreereport-jar,
1918     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1919         [Specify path to jarfile manually.]),
1920     JFREEREPORT_JAR=$withval)
1922 AC_ARG_WITH(liblayout-jar,
1923     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1924         [Specify path to jarfile manually.]),
1925     LIBLAYOUT_JAR=$withval)
1927 AC_ARG_WITH(libloader-jar,
1928     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1929         [Specify path to jarfile manually.]),
1930     LIBLOADER_JAR=$withval)
1932 AC_ARG_WITH(libformula-jar,
1933     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1934         [Specify path to jarfile manually.]),
1935     LIBFORMULA_JAR=$withval)
1937 AC_ARG_WITH(librepository-jar,
1938     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1939         [Specify path to jarfile manually.]),
1940     LIBREPOSITORY_JAR=$withval)
1942 AC_ARG_WITH(libfonts-jar,
1943     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1944         [Specify path to jarfile manually.]),
1945     LIBFONTS_JAR=$withval)
1947 AC_ARG_WITH(libserializer-jar,
1948     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1949         [Specify path to jarfile manually.]),
1950     LIBSERIALIZER_JAR=$withval)
1952 AC_ARG_WITH(libbase-jar,
1953     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1954         [Specify path to jarfile manually.]),
1955     LIBBASE_JAR=$withval)
1957 AC_ARG_WITH(system-odbc,
1958     AS_HELP_STRING([--with-system-odbc],
1959         [Use the odbc headers already on system.]),,
1960     [with_system_odbc="auto"])
1962 AC_ARG_WITH(system-sane,
1963     AS_HELP_STRING([--with-system-sane],
1964         [Use sane.h already on system.]),,
1965     [with_system_sane="$with_system_headers"])
1967 AC_ARG_WITH(system-bluez,
1968     AS_HELP_STRING([--with-system-bluez],
1969         [Use bluetooth.h already on system.]),,
1970     [with_system_bluez="$with_system_headers"])
1972 AC_ARG_WITH(system-curl,
1973     AS_HELP_STRING([--with-system-curl],
1974         [Use curl already on system.]),,
1975     [with_system_curl=auto])
1977 AC_ARG_WITH(system-boost,
1978     AS_HELP_STRING([--with-system-boost],
1979         [Use boost already on system.]),,
1980     [with_system_boost="$with_system_headers"])
1982 AC_ARG_WITH(system-glm,
1983     AS_HELP_STRING([--with-system-glm],
1984         [Use glm already on system.]),,
1985     [with_system_glm="$with_system_headers"])
1987 AC_ARG_WITH(system-hunspell,
1988     AS_HELP_STRING([--with-system-hunspell],
1989         [Use libhunspell already on system.]),,
1990     [with_system_hunspell="$with_system_libs"])
1992 AC_ARG_WITH(system-qrcodegen,
1993     AS_HELP_STRING([--with-system-qrcodegen],
1994         [Use libqrcodegen already on system.]),,
1995     [with_system_qrcodegen="$with_system_libs"])
1997 AC_ARG_WITH(system-box2d,
1998     AS_HELP_STRING([--with-system-box2d],
1999         [Use box2d already on system.]),,
2000     [with_system_box2d="$with_system_libs"])
2002 AC_ARG_WITH(system-mythes,
2003     AS_HELP_STRING([--with-system-mythes],
2004         [Use mythes already on system.]),,
2005     [with_system_mythes="$with_system_libs"])
2007 AC_ARG_WITH(system-altlinuxhyph,
2008     AS_HELP_STRING([--with-system-altlinuxhyph],
2009         [Use ALTLinuxhyph already on system.]),,
2010     [with_system_altlinuxhyph="$with_system_libs"])
2012 AC_ARG_WITH(system-lpsolve,
2013     AS_HELP_STRING([--with-system-lpsolve],
2014         [Use lpsolve already on system.]),,
2015     [with_system_lpsolve="$with_system_libs"])
2017 AC_ARG_WITH(system-coinmp,
2018     AS_HELP_STRING([--with-system-coinmp],
2019         [Use CoinMP already on system.]),,
2020     [with_system_coinmp="$with_system_libs"])
2022 AC_ARG_WITH(system-liblangtag,
2023     AS_HELP_STRING([--with-system-liblangtag],
2024         [Use liblangtag library already on system.]),,
2025     [with_system_liblangtag="$with_system_libs"])
2027 AC_ARG_WITH(webdav,
2028     AS_HELP_STRING([--with-webdav],
2029         [Specify which library to use for webdav implementation.
2030          Possible values: "neon", "serf", "no". The default value is "neon".
2031          Example: --with-webdav="serf"]),
2032     WITH_WEBDAV=$withval,
2033     WITH_WEBDAV="neon")
2035 AC_ARG_WITH(linker-hash-style,
2036     AS_HELP_STRING([--with-linker-hash-style],
2037         [Use linker with --hash-style=<style> when linking shared objects.
2038          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2039          if supported on the build system, and "sysv" otherwise.]))
2041 AC_ARG_WITH(jdk-home,
2042     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2043         [If you have installed JDK 9 or later on your system please supply the
2044          path here. Note that this is not the location of the java command but the
2045          location of the entire distribution.]),
2048 AC_ARG_WITH(help,
2049     AS_HELP_STRING([--with-help],
2050         [Enable the build of help. There is a special parameter "common" that
2051          can be used to bundle only the common part, .e.g help-specific icons.
2052          This is useful when you build the helpcontent separately.])
2053     [
2054                           Usage:     --with-help    build the old local help
2055                                  --without-help     no local help (default)
2056                                  --with-help=html   build the new HTML local help
2057                                  --with-help=online build the new HTML online help
2058     ],
2061 AC_ARG_WITH(omindex,
2062    AS_HELP_STRING([--with-omindex],
2063         [Enable the support of xapian-omega index for online help.])
2064    [
2065                          Usage: --with-omindex=server prepare the pages for omindex
2066                                 but let xapian-omega be built in server.
2067                                 --with-omindex=noxap do not prepare online pages
2068                                 for xapian-omega
2069   ],
2072 libo_FUZZ_ARG_WITH(java,
2073     AS_HELP_STRING([--with-java=<java command>],
2074         [Specify the name of the Java interpreter command. Typically "java"
2075          which is the default.
2077          To build without support for Java components, applets, accessibility
2078          or the XML filters written in Java, use --without-java or --with-java=no.]),
2079     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2080     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2083 AC_ARG_WITH(jvm-path,
2084     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2085         [Use a specific JVM search path at runtime.
2086          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2089 AC_ARG_WITH(ant-home,
2090     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2091         [If you have installed Apache Ant on your system, please supply the path here.
2092          Note that this is not the location of the Ant binary but the location
2093          of the entire distribution.]),
2096 AC_ARG_WITH(symbol-config,
2097     AS_HELP_STRING([--with-symbol-config],
2098         [Configuration for the crashreport symbol upload]),
2099         [],
2100         [with_symbol_config=no])
2102 AC_ARG_WITH(export-validation,
2103     AS_HELP_STRING([--without-export-validation],
2104         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2105 ,with_export_validation=auto)
2107 AC_ARG_WITH(bffvalidator,
2108     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2109         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2110          Requires installed Microsoft Office Binary File Format Validator.
2111          Note: export-validation (--with-export-validation) is required to be turned on.
2112          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2113 ,with_bffvalidator=no)
2115 libo_FUZZ_ARG_WITH(junit,
2116     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2117         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2118          --without-junit disables those tests. Not relevant in the --without-java case.]),
2119 ,with_junit=yes)
2121 AC_ARG_WITH(hamcrest,
2122     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2123         [Specifies the hamcrest jar file to use for JUnit-based tests.
2124          --without-junit disables those tests. Not relevant in the --without-java case.]),
2125 ,with_hamcrest=yes)
2127 AC_ARG_WITH(perl-home,
2128     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2129         [If you have installed Perl 5 Distribution, on your system, please
2130          supply the path here. Note that this is not the location of the Perl
2131          binary but the location of the entire distribution.]),
2134 libo_FUZZ_ARG_WITH(doxygen,
2135     AS_HELP_STRING(
2136         [--with-doxygen=<absolute path to doxygen executable>],
2137         [Specifies the doxygen executable to use when generating ODK C/C++
2138          documentation. --without-doxygen disables generation of ODK C/C++
2139          documentation. Not relevant in the --disable-odk case.]),
2140 ,with_doxygen=yes)
2142 AC_ARG_WITH(visual-studio,
2143     AS_HELP_STRING([--with-visual-studio=<2019>],
2144         [Specify which Visual Studio version to use in case several are
2145          installed. Currently only 2019 (default) is supported.]),
2148 AC_ARG_WITH(windows-sdk,
2149     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2150         [Specify which Windows SDK, or "Windows Kit", version to use
2151          in case the one that came with the selected Visual Studio
2152          is not what you want for some reason. Note that not all compiler/SDK
2153          combinations are supported. The intent is that this option should not
2154          be needed.]),
2157 AC_ARG_WITH(lang,
2158     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2159         [Use this option to build LibreOffice with additional UI language support.
2160          English (US) is always included by default.
2161          Separate multiple languages with space.
2162          For all languages, use --with-lang=ALL.]),
2165 AC_ARG_WITH(locales,
2166     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2167         [Use this option to limit the locale information built in.
2168          Separate multiple locales with space.
2169          Very experimental and might well break stuff.
2170          Just a desperate measure to shrink code and data size.
2171          By default all the locales available is included.
2172          This option is completely unrelated to --with-lang.])
2173     [
2174                           Affects also our character encoding conversion
2175                           tables for encodings mainly targeted for a
2176                           particular locale, like EUC-CN and EUC-TW for
2177                           zh, ISO-2022-JP for ja.
2179                           Affects also our add-on break iterator data for
2180                           some languages.
2182                           For the default, all locales, don't use this switch at all.
2183                           Specifying just the language part of a locale means all matching
2184                           locales will be included.
2185     ],
2188 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2189 libo_FUZZ_ARG_WITH(krb5,
2190     AS_HELP_STRING([--with-krb5],
2191         [Enable MIT Kerberos 5 support in modules that support it.
2192          By default automatically enabled on platforms
2193          where a good system Kerberos 5 is available.]),
2196 libo_FUZZ_ARG_WITH(gssapi,
2197     AS_HELP_STRING([--with-gssapi],
2198         [Enable GSSAPI support in modules that support it.
2199          By default automatically enabled on platforms
2200          where a good system GSSAPI is available.]),
2203 AC_ARG_WITH(iwyu,
2204     AS_HELP_STRING([--with-iwyu],
2205         [Use given IWYU binary path to check unneeded includes instead of building.
2206          Use only if you are hacking on it.]),
2209 libo_FUZZ_ARG_WITH(lxml,
2210     AS_HELP_STRING([--without-lxml],
2211         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2212          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2213          report widget classes and ids.]),
2216 libo_FUZZ_ARG_WITH(latest-c++,
2217     AS_HELP_STRING([--with-latest-c++],
2218         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2219          published standard.]),,
2220         [with_latest_c__=no])
2222 dnl ===================================================================
2223 dnl Branding
2224 dnl ===================================================================
2226 AC_ARG_WITH(branding,
2227     AS_HELP_STRING([--with-branding=/path/to/images],
2228         [Use given path to retrieve branding images set.])
2229     [
2230                           Search for intro.png about.svg and logo.svg.
2231                           If any is missing, default ones will be used instead.
2233                           Search also progress.conf for progress
2234                           settings on intro screen :
2236                           PROGRESSBARCOLOR="255,255,255" Set color of
2237                           progress bar. Comma separated RGB decimal values.
2238                           PROGRESSSIZE="407,6" Set size of progress bar.
2239                           Comma separated decimal values (width, height).
2240                           PROGRESSPOSITION="61,317" Set position of progress
2241                           bar from left,top. Comma separated decimal values.
2242                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2243                           bar frame. Comma separated RGB decimal values.
2244                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2245                           bar text. Comma separated RGB decimal values.
2246                           PROGRESSTEXTBASELINE="287" Set vertical position of
2247                           progress bar text from top. Decimal value.
2249                           Default values will be used if not found.
2250     ],
2254 AC_ARG_WITH(extra-buildid,
2255     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2256         [Show addition build identification in about dialog.]),
2260 AC_ARG_WITH(vendor,
2261     AS_HELP_STRING([--with-vendor="John the Builder"],
2262         [Set vendor of the build.]),
2265 AC_ARG_WITH(android-package-name,
2266     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2267         [Set Android package name of the build.]),
2270 AC_ARG_WITH(compat-oowrappers,
2271     AS_HELP_STRING([--with-compat-oowrappers],
2272         [Install oo* wrappers in parallel with
2273          lo* ones to keep backward compatibility.
2274          Has effect only with make distro-pack-install]),
2277 AC_ARG_WITH(os-version,
2278     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2279         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2282 AC_ARG_WITH(mingw-cross-compiler,
2283     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2284         [Specify the MinGW cross-compiler to use.
2285          When building on the ODK on Unix and building unowinreg.dll,
2286          specify the MinGW C++ cross-compiler.]),
2289 AC_ARG_WITH(idlc-cpp,
2290     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2291         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2294 AC_ARG_WITH(build-version,
2295     AS_HELP_STRING([--with-build-version="Built by Jim"],
2296         [Allows the builder to add a custom version tag that will appear in the
2297          Help/About box for QA purposes.]),
2298 with_build_version=$withval,
2301 AC_ARG_WITH(parallelism,
2302     AS_HELP_STRING([--with-parallelism],
2303         [Number of jobs to run simultaneously during build. Parallel builds can
2304         save a lot of time on multi-cpu machines. Defaults to the number of
2305         CPUs on the machine, unless you configure --enable-icecream - then to
2306         40.]),
2309 AC_ARG_WITH(all-tarballs,
2310     AS_HELP_STRING([--with-all-tarballs],
2311         [Download all external tarballs unconditionally]))
2313 AC_ARG_WITH(gdrive-client-id,
2314     AS_HELP_STRING([--with-gdrive-client-id],
2315         [Provides the client id of the application for OAuth2 authentication
2316         on Google Drive. If either this or --with-gdrive-client-secret is
2317         empty, the feature will be disabled]),
2320 AC_ARG_WITH(gdrive-client-secret,
2321     AS_HELP_STRING([--with-gdrive-client-secret],
2322         [Provides the client secret of the application for OAuth2
2323         authentication on Google Drive. If either this or
2324         --with-gdrive-client-id is empty, the feature will be disabled]),
2327 AC_ARG_WITH(alfresco-cloud-client-id,
2328     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2329         [Provides the client id of the application for OAuth2 authentication
2330         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2331         empty, the feature will be disabled]),
2334 AC_ARG_WITH(alfresco-cloud-client-secret,
2335     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2336         [Provides the client secret of the application for OAuth2
2337         authentication on Alfresco Cloud. If either this or
2338         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2341 AC_ARG_WITH(onedrive-client-id,
2342     AS_HELP_STRING([--with-onedrive-client-id],
2343         [Provides the client id of the application for OAuth2 authentication
2344         on OneDrive. If either this or --with-onedrive-client-secret is
2345         empty, the feature will be disabled]),
2348 AC_ARG_WITH(onedrive-client-secret,
2349     AS_HELP_STRING([--with-onedrive-client-secret],
2350         [Provides the client secret of the application for OAuth2
2351         authentication on OneDrive. If either this or
2352         --with-onedrive-client-id is empty, the feature will be disabled]),
2354 dnl ===================================================================
2355 dnl Do we want to use pre-build binary tarball for recompile
2356 dnl ===================================================================
2358 if test "$enable_library_bin_tar" = "yes" ; then
2359     USE_LIBRARY_BIN_TAR=TRUE
2360 else
2361     USE_LIBRARY_BIN_TAR=
2363 AC_SUBST(USE_LIBRARY_BIN_TAR)
2365 dnl ===================================================================
2366 dnl Test whether build target is Release Build
2367 dnl ===================================================================
2368 AC_MSG_CHECKING([whether build target is Release Build])
2369 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2370     AC_MSG_RESULT([no])
2371     ENABLE_RELEASE_BUILD=
2372     GET_TASK_ALLOW_ENTITLEMENT='
2373         <!-- We want to be able to debug a hardened process when not building for release -->
2374         <key>com.apple.security.get-task-allow</key>
2375         <true/>'
2376 else
2377     AC_MSG_RESULT([yes])
2378     ENABLE_RELEASE_BUILD=TRUE
2379     GET_TASK_ALLOW_ENTITLEMENT=''
2381 AC_SUBST(ENABLE_RELEASE_BUILD)
2382 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2384 AC_MSG_CHECKING([for product flavor])
2385 if test "$with_product_flavor" = "no"; then
2386     PRODUCTFLAVOR=""
2387 elif test -n "$with_product_flavor"; then
2388     PRODUCTFLAVOR="$with_product_flavor"
2390 AC_MSG_RESULT([$PRODUCTFLAVOR])
2391 AC_DEFINE_UNQUOTED([PRODUCTFLAVOR], ["$PRODUCTFLAVOR"])
2393 dnl ===================================================================
2394 dnl Test whether to sign Windows Build
2395 dnl ===================================================================
2396 AC_MSG_CHECKING([whether to sign windows build])
2397 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2398     AC_MSG_RESULT([yes])
2399     WINDOWS_BUILD_SIGNING="TRUE"
2400 else
2401     AC_MSG_RESULT([no])
2402     WINDOWS_BUILD_SIGNING="FALSE"
2404 AC_SUBST(WINDOWS_BUILD_SIGNING)
2406 dnl ===================================================================
2407 dnl MacOSX build and runtime environment options
2408 dnl ===================================================================
2410 AC_ARG_WITH(macosx-sdk,
2411     AS_HELP_STRING([--with-macosx-sdk=<version>],
2412         [Prefer a specific SDK for building.])
2413     [
2414                           If the requested SDK is not available, a search for the oldest one will be done.
2415                           With current Xcode versions, only the latest SDK is included, so this option is
2416                           not terribly useful. It works fine to build with a new SDK and run the result
2417                           on an older OS.
2419                           e. g.: --with-macosx-sdk=10.10
2421                           there are 3 options to control the MacOSX build:
2422                           --with-macosx-sdk (referred as 'sdk' below)
2423                           --with-macosx-version-min-required (referred as 'min' below)
2424                           --with-macosx-version-max-allowed (referred as 'max' below)
2426                           the connection between these value and the default they take is as follow:
2427                           ( ? means not specified on the command line, s means the SDK version found,
2428                           constraint: 8 <= x <= y <= z)
2430                           ==========================================
2431                            command line      || config result
2432                           ==========================================
2433                           min  | max  | sdk  || min   | max  | sdk  |
2434                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2435                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2436                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2437                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2438                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2439                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2440                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2441                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2444                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2445                           for a detailed technical explanation of these variables
2447                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2448     ],
2451 AC_ARG_WITH(macosx-version-min-required,
2452     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2453         [set the minimum OS version needed to run the built LibreOffice])
2454     [
2455                           e. g.: --with-macos-version-min-required=10.10
2456                           see --with-macosx-sdk for more info
2457     ],
2460 AC_ARG_WITH(macosx-version-max-allowed,
2461     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2462         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2463     [
2464                           e. g.: --with-macos-version-max-allowed=10.10
2465                           see --with-macosx-sdk for more info
2466     ],
2470 dnl ===================================================================
2471 dnl options for stuff used during cross-compilation build
2472 dnl Not quite superseded by --with-build-platform-configure-options.
2473 dnl TODO: check, if the "force" option is still needed anywhere.
2474 dnl ===================================================================
2476 AC_ARG_WITH(system-icu-for-build,
2477     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2478         [Use icu already on system for build tools (cross-compilation only).]))
2481 dnl ===================================================================
2482 dnl Check for incompatible options set by fuzzing, and reset those
2483 dnl automatically to working combinations
2484 dnl ===================================================================
2486 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2487         "$enable_dbus" != "$enable_avahi"; then
2488     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2489     enable_avahi=$enable_dbus
2492 add_lopath_after ()
2494     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2495         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2496     fi
2499 add_lopath_before ()
2501     local IFS=${P_SEP}
2502     local path_cleanup
2503     local dir
2504     for dir in $LO_PATH ; do
2505         if test "$dir" != "$1" ; then
2506             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2507         fi
2508     done
2509     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2512 dnl ===================================================================
2513 dnl check for required programs (grep, awk, sed, bash)
2514 dnl ===================================================================
2516 pathmunge ()
2518     if test -n "$1"; then
2519         if test "$build_os" = "cygwin"; then
2520             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2521                 PathFormat "$1"
2522                 new_path=`cygpath -sm "$formatted_path"`
2523             else
2524                 PathFormat "$1"
2525                 new_path=`cygpath -u "$formatted_path"`
2526             fi
2527         else
2528             new_path="$1"
2529         fi
2530         if test "$2" = "after"; then
2531             add_lopath_after "$new_path"
2532         else
2533             add_lopath_before "$new_path"
2534         fi
2535         unset new_path
2536     fi
2539 AC_PROG_AWK
2540 AC_PATH_PROG( AWK, $AWK)
2541 if test -z "$AWK"; then
2542     AC_MSG_ERROR([install awk to run this script])
2545 AC_PATH_PROG(BASH, bash)
2546 if test -z "$BASH"; then
2547     AC_MSG_ERROR([bash not found in \$PATH])
2549 AC_SUBST(BASH)
2551 AC_MSG_CHECKING([for GNU or BSD tar])
2552 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2553     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2554     if test $? -eq 0;  then
2555         GNUTAR=$a
2556         break
2557     fi
2558 done
2559 AC_MSG_RESULT($GNUTAR)
2560 if test -z "$GNUTAR"; then
2561     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2563 AC_SUBST(GNUTAR)
2565 AC_MSG_CHECKING([for tar's option to strip components])
2566 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2567 if test $? -eq 0; then
2568     STRIP_COMPONENTS="--strip-components"
2569 else
2570     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2571     if test $? -eq 0; then
2572         STRIP_COMPONENTS="--strip-path"
2573     else
2574         STRIP_COMPONENTS="unsupported"
2575     fi
2577 AC_MSG_RESULT($STRIP_COMPONENTS)
2578 if test x$STRIP_COMPONENTS = xunsupported; then
2579     AC_MSG_ERROR([you need a tar that is able to strip components.])
2581 AC_SUBST(STRIP_COMPONENTS)
2583 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2584 dnl desktop OSes from "mobile" ones.
2586 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2587 dnl In other words, that when building for an OS that is not a
2588 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2590 dnl Note the direction of the implication; there is no assumption that
2591 dnl cross-compiling would imply a non-desktop OS.
2593 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2594     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2595     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2596     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2599 # Whether to build "avmedia" functionality or not.
2601 if test -z "$enable_avmedia"; then
2602     enable_avmedia=yes
2605 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2606 if test "$enable_avmedia" = yes; then
2607     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2608 else
2609     USE_AVMEDIA_DUMMY='TRUE'
2611 AC_SUBST(USE_AVMEDIA_DUMMY)
2613 # Decide whether to build database connectivity stuff (including
2614 # Base) or not. We probably don't want to on non-desktop OSes.
2615 if test -z "$enable_database_connectivity"; then
2616     # --disable-database-connectivity is unfinished work in progress
2617     # and the iOS test app doesn't link if we actually try to use it.
2618     # if test $_os != iOS -a $_os != Android; then
2619     if test $_os != iOS; then
2620         enable_database_connectivity=yes
2621     fi
2624 if test "$enable_database_connectivity" = yes; then
2625     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2626     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2629 if test -z "$enable_extensions"; then
2630     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2631     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2632         enable_extensions=yes
2633     fi
2636 if test "$enable_extensions" = yes; then
2637     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2638     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2641 if test -z "$enable_scripting"; then
2642     # Disable scripting for iOS unless specifically overridden
2643     # with --enable-scripting.
2644     if test $_os != iOS; then
2645         enable_scripting=yes
2646     fi
2649 DISABLE_SCRIPTING=''
2650 if test "$enable_scripting" = yes; then
2651     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2652     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2653 else
2654     DISABLE_SCRIPTING='TRUE'
2655     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2658 if test $_os = iOS -o $_os = Android; then
2659     # Disable dynamic_loading always for iOS and Android
2660     enable_dynamic_loading=no
2661 elif test -z "$enable_dynamic_loading"; then
2662     # Otherwise enable it unless specifically disabled
2663     enable_dynamic_loading=yes
2666 DISABLE_DYNLOADING=''
2667 if test "$enable_dynamic_loading" = yes; then
2668     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2669 else
2670     DISABLE_DYNLOADING='TRUE'
2672 AC_SUBST(DISABLE_DYNLOADING)
2674 # remember SYSBASE value
2675 AC_SUBST(SYSBASE)
2677 dnl ===================================================================
2678 dnl  Sort out various gallery compilation options
2679 dnl ===================================================================
2680 AC_MSG_CHECKING([how to build and package galleries])
2681 if test -n "${with_galleries}"; then
2682     if test "$with_galleries" = "build"; then
2683         WITH_GALLERY_BUILD=TRUE
2684         AC_MSG_RESULT([build from source images internally])
2685     elif test "$with_galleries" = "no"; then
2686         WITH_GALLERY_BUILD=
2687         AC_MSG_RESULT([disable non-internal gallery build])
2688     else
2689         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2690     fi
2691 else
2692     if test $_os != iOS -a $_os != Android; then
2693         WITH_GALLERY_BUILD=TRUE
2694         AC_MSG_RESULT([internal src images for desktop])
2695     else
2696         WITH_GALLERY_BUILD=
2697         AC_MSG_RESULT([disable src image build])
2698     fi
2700 AC_SUBST(WITH_GALLERY_BUILD)
2702 dnl ===================================================================
2703 dnl  Checks if ccache is available
2704 dnl ===================================================================
2705 CCACHE_DEPEND_MODE=
2706 if test "$_os" = "WINNT"; then
2707     # on windows/VC build do not use ccache
2708     CCACHE=""
2709 elif test "$enable_ccache" = "no"; then
2710     CCACHE=""
2711 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2712     case "%$CC%$CXX%" in
2713     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2714     # assume that's good then
2715     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2716         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2717         CCACHE_DEPEND_MODE=1
2718         ;;
2719     *)
2720         AC_PATH_PROG([CCACHE],[ccache],[not found])
2721         if test "$CCACHE" = "not found"; then
2722             CCACHE=""
2723         else
2724             CCACHE_DEPEND_MODE=1
2725             # Need to check for ccache version: otherwise prevents
2726             # caching of the results (like "-x objective-c++" for Mac)
2727             if test $_os = Darwin -o $_os = iOS; then
2728                 # Check ccache version
2729                 AC_MSG_CHECKING([whether version of ccache is suitable])
2730                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2731                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2732                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2733                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2734                 else
2735                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2736                     CCACHE=""
2737                     CCACHE_DEPEND_MODE=
2738                 fi
2739             fi
2740         fi
2741         ;;
2742     esac
2743 else
2744     CCACHE=""
2746 if test "$enable_ccache" = "nodepend"; then
2747     CCACHE_DEPEND_MODE=""
2749 AC_SUBST(CCACHE_DEPEND_MODE)
2751 if test "$CCACHE" != ""; then
2752     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2753     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2754     if test "$ccache_size" = ""; then
2755         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2756         if test "$ccache_size" = ""; then
2757             ccache_size=0
2758         fi
2759         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2760         if test $ccache_size -lt 1024; then
2761             CCACHE=""
2762             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2763             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2764         else
2765             # warn that ccache may be too small for debug build
2766             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2767             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2768         fi
2769     else
2770         if test $ccache_size -lt 5; then
2771             #warn that ccache may be too small for debug build
2772             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2773             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2774         fi
2775     fi
2778 dnl ===================================================================
2779 dnl  Checks for C compiler,
2780 dnl  The check for the C++ compiler is later on.
2781 dnl ===================================================================
2782 if test "$_os" != "WINNT"; then
2783     GCC_HOME_SET="true"
2784     AC_MSG_CHECKING([gcc home])
2785     if test -z "$with_gcc_home"; then
2786         if test "$enable_icecream" = "yes"; then
2787             if test -d "/usr/lib/icecc/bin"; then
2788                 GCC_HOME="/usr/lib/icecc/"
2789             elif test -d "/usr/libexec/icecc/bin"; then
2790                 GCC_HOME="/usr/libexec/icecc/"
2791             elif test -d "/opt/icecream/bin"; then
2792                 GCC_HOME="/opt/icecream/"
2793             else
2794                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2796             fi
2797         else
2798             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2799             GCC_HOME_SET="false"
2800         fi
2801     else
2802         GCC_HOME="$with_gcc_home"
2803     fi
2804     AC_MSG_RESULT($GCC_HOME)
2805     AC_SUBST(GCC_HOME)
2807     if test "$GCC_HOME_SET" = "true"; then
2808         if test -z "$CC"; then
2809             CC="$GCC_HOME/bin/gcc"
2810             CC_BASE="gcc"
2811         fi
2812         if test -z "$CXX"; then
2813             CXX="$GCC_HOME/bin/g++"
2814             CXX_BASE="g++"
2815         fi
2816     fi
2819 COMPATH=`dirname "$CC"`
2820 if test "$COMPATH" = "."; then
2821     AC_PATH_PROGS(COMPATH, $CC)
2822     dnl double square bracket to get single because of M4 quote...
2823     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2825 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2827 dnl ===================================================================
2828 dnl Java support
2829 dnl ===================================================================
2830 AC_MSG_CHECKING([whether to build with Java support])
2831 if test "$with_java" != "no"; then
2832     if test "$DISABLE_SCRIPTING" = TRUE; then
2833         AC_MSG_RESULT([no, overridden by --disable-scripting])
2834         ENABLE_JAVA=""
2835         with_java=no
2836     else
2837         AC_MSG_RESULT([yes])
2838         ENABLE_JAVA="TRUE"
2839         AC_DEFINE(HAVE_FEATURE_JAVA)
2840     fi
2841 else
2842     AC_MSG_RESULT([no])
2843     ENABLE_JAVA=""
2846 AC_SUBST(ENABLE_JAVA)
2848 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2850 dnl ENABLE_JAVA="" indicate no Java support at all
2852 dnl ===================================================================
2853 dnl Check macOS SDK and compiler
2854 dnl ===================================================================
2856 if test $_os = Darwin; then
2858     # If no --with-macosx-sdk option is given, look for one
2860     # The intent is that for "most" Mac-based developers, a suitable
2861     # SDK will be found automatically without any configure options.
2863     # For developers with a current Xcode, the lowest-numbered SDK
2864     # higher than or equal to the minimum required should be found.
2866     AC_MSG_CHECKING([what macOS SDK to use])
2867     for _macosx_sdk in ${with_macosx_sdk-11.0 10.15 10.14 10.13}; do
2868         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2869         if test -d "$MACOSX_SDK_PATH"; then
2870             with_macosx_sdk="${_macosx_sdk}"
2871             break
2872         else
2873             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2874             if test -d "$MACOSX_SDK_PATH"; then
2875                 with_macosx_sdk="${_macosx_sdk}"
2876                 break
2877             fi
2878         fi
2879     done
2880     if test ! -d "$MACOSX_SDK_PATH"; then
2881         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2882     fi
2884     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2886     case $with_macosx_sdk in
2887     10.13)
2888         MACOSX_SDK_VERSION=101300
2889         ;;
2890     10.14)
2891         MACOSX_SDK_VERSION=101400
2892         ;;
2893     10.15)
2894         MACOSX_SDK_VERSION=101500
2895         ;;
2896     11.0)
2897         MACOSX_SDK_VERSION=110000
2898         ;;
2899     *)
2900         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.0])
2901         ;;
2902     esac
2904     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
2905         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
2906     fi
2908     if test "$with_macosx_version_min_required" = "" ; then
2909         if test "$host_cpu" = x86_64; then
2910             with_macosx_version_min_required="10.10";
2911         else
2912             with_macosx_version_min_required="11.0";
2913         fi
2914     fi
2916     if test "$with_macosx_version_max_allowed" = "" ; then
2917         with_macosx_version_max_allowed="$with_macosx_sdk"
2918     fi
2920     # export this so that "xcrun" invocations later return matching values
2921     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2922     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2923     export DEVELOPER_DIR
2924     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2925     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2927     AC_MSG_CHECKING([whether Xcode is new enough])
2928     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2929     my_xcode_ver2=${my_xcode_ver1#Xcode }
2930     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2931     if test "$my_xcode_ver3" -ge 1103; then
2932         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2933     else
2934         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
2935     fi
2937     case "$with_macosx_version_min_required" in
2938     10.10)
2939         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2940         ;;
2941     10.11)
2942         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2943         ;;
2944     10.12)
2945         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2946         ;;
2947     10.13)
2948         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2949         ;;
2950     10.14)
2951         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2952         ;;
2953     10.15)
2954         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2955         ;;
2956     11.0)
2957         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
2958         ;;
2959     *)
2960         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])
2961         ;;
2962     esac
2964     LIBTOOL=/usr/bin/libtool
2965     INSTALL_NAME_TOOL=install_name_tool
2966     if test -z "$save_CC"; then
2967         stdlib=-stdlib=libc++
2968         if test "$ENABLE_LTO" = TRUE; then
2969             lto=-flto
2970         fi
2972         AC_MSG_CHECKING([what C compiler to use])
2973         CC="`xcrun -find clang`"
2974         CC_BASE=`first_arg_basename "$CC"`
2975         if test "$host_cpu" = x86_64; then
2976             CC+=" -target x86_64-apple-macos"
2977         else
2978             CC+=" -target arm64-apple-macos"
2979         fi
2980         CC+=" $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2981         AC_MSG_RESULT([$CC])
2983         AC_MSG_CHECKING([what C++ compiler to use])
2984         CXX="`xcrun -find clang++`"
2985         CXX_BASE=`first_arg_basename "$CXX"`
2986         if test "$host_cpu" = x86_64; then
2987             CXX+=" -target x86_64-apple-macos"
2988         else
2989             CXX+=" -target arm64-apple-macos"
2990         fi
2991         CXX+=" $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2992         AC_MSG_RESULT([$CXX])
2994         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2995         AR=`xcrun -find ar`
2996         NM=`xcrun -find nm`
2997         STRIP=`xcrun -find strip`
2998         LIBTOOL=`xcrun -find libtool`
2999         RANLIB=`xcrun -find ranlib`
3000     fi
3002     case "$with_macosx_version_max_allowed" in
3003     10.10)
3004         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3005         ;;
3006     10.11)
3007         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3008         ;;
3009     10.12)
3010         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3011         ;;
3012     10.13)
3013         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3014         ;;
3015     10.14)
3016         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3017         ;;
3018     10.15)
3019         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3020         ;;
3021     11.0)
3022         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3023         ;;
3024     *)
3025         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])
3026         ;;
3027     esac
3029     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3030     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3031         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])
3032     else
3033         AC_MSG_RESULT([ok])
3034     fi
3036     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3037     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3038         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3039     else
3040         AC_MSG_RESULT([ok])
3041     fi
3042     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3043     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3045     AC_MSG_CHECKING([whether to do code signing])
3047     if test "$enable_macosx_code_signing" = yes; then
3048         # By default use the first suitable certificate (?).
3050         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3051         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3052         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3053         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3054         # "Developer ID Application" one.
3056         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3057         if test -n "$identity"; then
3058             MACOSX_CODESIGNING_IDENTITY=$identity
3059             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3060             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3061         else
3062             AC_MSG_ERROR([cannot determine identity to use])
3063         fi
3064     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3065         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3066         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3067         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3068     else
3069         AC_MSG_RESULT([no])
3070     fi
3072     AC_MSG_CHECKING([whether to create a Mac App Store package])
3074     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3075         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3076     elif test "$enable_macosx_package_signing" = yes; then
3077         # By default use the first suitable certificate.
3078         # It should be a "3rd Party Mac Developer Installer" one
3080         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3081         if test -n "$identity"; then
3082             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3083             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3084             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3085         else
3086             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3087         fi
3088     elif test -n "$enable_macosx_package_signing"; then
3089         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3090         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3091         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3092     else
3093         AC_MSG_RESULT([no])
3094     fi
3096     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3097         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3098     fi
3100     AC_MSG_CHECKING([whether to sandbox the application])
3102     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3103         AC_MSG_ERROR([macOS sandboxing requires code signing])
3104     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3105         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3106     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3107         ENABLE_MACOSX_SANDBOX=TRUE
3108         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3109         AC_MSG_RESULT([yes])
3110     else
3111         AC_MSG_RESULT([no])
3112     fi
3114     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3115     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3116     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3118 AC_SUBST(MACOSX_SDK_PATH)
3119 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3120 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3121 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3122 AC_SUBST(INSTALL_NAME_TOOL)
3123 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3124 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3125 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3126 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3127 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3129 dnl ===================================================================
3130 dnl Check iOS SDK and compiler
3131 dnl ===================================================================
3133 if test $_os = iOS; then
3134     AC_MSG_CHECKING([what iOS SDK to use])
3135     current_sdk_ver=14.0
3136     older_sdk_vers="13.5 13.4 13.2 13.1 13.0 12.4 12.2"
3137     if test "$enable_ios_simulator" = "yes"; then
3138         platform=iPhoneSimulator
3139         versionmin=-mios-simulator-version-min=12.2
3140     else
3141         platform=iPhoneOS
3142         versionmin=-miphoneos-version-min=12.2
3143     fi
3144     xcode_developer=`xcode-select -print-path`
3146     for sdkver in $current_sdk_ver $older_sdk_vers; do
3147         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3148         if test -d $t; then
3149             sysroot=$t
3150             break
3151         fi
3152     done
3154     if test -z "$sysroot"; then
3155         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3156     fi
3158     AC_MSG_RESULT($sysroot)
3160     # LTO is not really recommended for iOS builds,
3161     # the link time will be astronomical
3162     if test "$ENABLE_LTO" = TRUE; then
3163         lto=-flto
3164     fi
3166     stdlib="-stdlib=libc++"
3168     AC_MSG_CHECKING([what C compiler to use])
3169     CC="`xcrun -find clang`"
3170     CC_BASE=`first_arg_basename "$CC"`
3171     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3172     AC_MSG_RESULT([$CC])
3174     AC_MSG_CHECKING([what C++ compiler to use])
3175     CXX="`xcrun -find clang++`"
3176     CXX_BASE=`first_arg_basename "$CXX"`
3177     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3178     AC_MSG_RESULT([$CXX])
3180     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3181     AR=`xcrun -find ar`
3182     NM=`xcrun -find nm`
3183     STRIP=`xcrun -find strip`
3184     LIBTOOL=`xcrun -find libtool`
3185     RANLIB=`xcrun -find ranlib`
3188 AC_MSG_CHECKING([whether to treat the installation as read-only])
3190 if test $_os = Darwin; then
3191     enable_readonly_installset=yes
3192 elif test "$enable_extensions" != yes; then
3193     enable_readonly_installset=yes
3195 if test "$enable_readonly_installset" = yes; then
3196     AC_MSG_RESULT([yes])
3197     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3198 else
3199     AC_MSG_RESULT([no])
3202 dnl ===================================================================
3203 dnl Structure of install set
3204 dnl ===================================================================
3206 if test $_os = Darwin; then
3207     LIBO_BIN_FOLDER=MacOS
3208     LIBO_ETC_FOLDER=Resources
3209     LIBO_LIBEXEC_FOLDER=MacOS
3210     LIBO_LIB_FOLDER=Frameworks
3211     LIBO_LIB_PYUNO_FOLDER=Resources
3212     LIBO_SHARE_FOLDER=Resources
3213     LIBO_SHARE_HELP_FOLDER=Resources/help
3214     LIBO_SHARE_JAVA_FOLDER=Resources/java
3215     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3216     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3217     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3218     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3219     LIBO_URE_BIN_FOLDER=MacOS
3220     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3221     LIBO_URE_LIB_FOLDER=Frameworks
3222     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3223     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3224 elif test $_os = WINNT; then
3225     LIBO_BIN_FOLDER=program
3226     LIBO_ETC_FOLDER=program
3227     LIBO_LIBEXEC_FOLDER=program
3228     LIBO_LIB_FOLDER=program
3229     LIBO_LIB_PYUNO_FOLDER=program
3230     LIBO_SHARE_FOLDER=share
3231     LIBO_SHARE_HELP_FOLDER=help
3232     LIBO_SHARE_JAVA_FOLDER=program/classes
3233     LIBO_SHARE_PRESETS_FOLDER=presets
3234     LIBO_SHARE_READMES_FOLDER=readmes
3235     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3236     LIBO_SHARE_SHELL_FOLDER=program/shell
3237     LIBO_URE_BIN_FOLDER=program
3238     LIBO_URE_ETC_FOLDER=program
3239     LIBO_URE_LIB_FOLDER=program
3240     LIBO_URE_MISC_FOLDER=program
3241     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3242 else
3243     LIBO_BIN_FOLDER=program
3244     LIBO_ETC_FOLDER=program
3245     LIBO_LIBEXEC_FOLDER=program
3246     LIBO_LIB_FOLDER=program
3247     LIBO_LIB_PYUNO_FOLDER=program
3248     LIBO_SHARE_FOLDER=share
3249     LIBO_SHARE_HELP_FOLDER=help
3250     LIBO_SHARE_JAVA_FOLDER=program/classes
3251     LIBO_SHARE_PRESETS_FOLDER=presets
3252     LIBO_SHARE_READMES_FOLDER=readmes
3253     if test "$enable_fuzzers" != yes; then
3254         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3255     else
3256         LIBO_SHARE_RESOURCE_FOLDER=resource
3257     fi
3258     LIBO_SHARE_SHELL_FOLDER=program/shell
3259     LIBO_URE_BIN_FOLDER=program
3260     LIBO_URE_ETC_FOLDER=program
3261     LIBO_URE_LIB_FOLDER=program
3262     LIBO_URE_MISC_FOLDER=program
3263     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3265 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3266 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3267 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3268 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3269 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3270 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3271 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3272 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3273 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3274 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3275 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3276 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3277 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3278 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3279 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3280 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3282 # Not all of them needed in config_host.mk, add more if need arises
3283 AC_SUBST(LIBO_BIN_FOLDER)
3284 AC_SUBST(LIBO_ETC_FOLDER)
3285 AC_SUBST(LIBO_LIB_FOLDER)
3286 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3287 AC_SUBST(LIBO_SHARE_FOLDER)
3288 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3289 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3290 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3291 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3292 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3293 AC_SUBST(LIBO_URE_BIN_FOLDER)
3294 AC_SUBST(LIBO_URE_ETC_FOLDER)
3295 AC_SUBST(LIBO_URE_LIB_FOLDER)
3296 AC_SUBST(LIBO_URE_MISC_FOLDER)
3297 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3299 dnl ===================================================================
3300 dnl Windows specific tests and stuff
3301 dnl ===================================================================
3303 reg_get_value()
3305     # Return value: $regvalue
3306     unset regvalue
3308     local _regentry="/proc/registry${1}/${2}"
3309     if test -f "$_regentry"; then
3310         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3311         # Registry keys read via /proc/registry* are always \0 terminated!
3312         local _regvalue=$(tr -d '\0' < "$_regentry")
3313         if test $? -eq 0; then
3314             regvalue=$_regvalue
3315         fi
3316     fi
3319 # Get a value from the 32-bit side of the Registry
3320 reg_get_value_32()
3322     reg_get_value "32" "$1"
3325 # Get a value from the 64-bit side of the Registry
3326 reg_get_value_64()
3328     reg_get_value "64" "$1"
3331 if test "$_os" = "WINNT"; then
3332     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3333     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3334         AC_MSG_RESULT([no])
3335         WINDOWS_SDK_ARCH="x86"
3336     else
3337         AC_MSG_RESULT([yes])
3338         WINDOWS_SDK_ARCH="x64"
3339         BITNESS_OVERRIDE=64
3340     fi
3342 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3343     cross_compiling="yes"
3345 if test "$cross_compiling" = "yes"; then
3346     export CROSS_COMPILING=TRUE
3347 else
3348     CROSS_COMPILING=
3349     BUILD_TYPE="$BUILD_TYPE NATIVE"
3351 AC_SUBST(CROSS_COMPILING)
3353 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3354 # NOTE: must _not_ be used for bundled external libraries!
3355 ISYSTEM=
3356 if test "$GCC" = "yes"; then
3357     AC_MSG_CHECKING( for -isystem )
3358     save_CFLAGS=$CFLAGS
3359     CFLAGS="$CFLAGS -Werror"
3360     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3361     CFLAGS=$save_CFLAGS
3362     if test -n "$ISYSTEM"; then
3363         AC_MSG_RESULT(yes)
3364     else
3365         AC_MSG_RESULT(no)
3366     fi
3368 if test -z "$ISYSTEM"; then
3369     # fall back to using -I
3370     ISYSTEM=-I
3372 AC_SUBST(ISYSTEM)
3374 dnl ===================================================================
3375 dnl  Check which Visual Studio compiler is used
3376 dnl ===================================================================
3378 map_vs_year_to_version()
3380     # Return value: $vsversion
3382     unset vsversion
3384     case $1 in
3385     2019)
3386         vsversion=16;;
3387     *)
3388         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3389     esac
3392 vs_versions_to_check()
3394     # Args: $1 (optional) : versions to check, in the order of preference
3395     # Return value: $vsversions
3397     unset vsversions
3399     if test -n "$1"; then
3400         map_vs_year_to_version "$1"
3401         vsversions=$vsversion
3402     else
3403         # We accept only 2019
3404         vsversions="16"
3405     fi
3408 win_get_env_from_vsvars32bat()
3410     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3411     # Also seems to be located in another directory under the same name: vsvars32.bat
3412     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3413     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3414     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3415     chmod +x $WRAPPERBATCHFILEPATH
3416     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3417     rm -f $WRAPPERBATCHFILEPATH
3418     printf '%s' "$_win_get_env_from_vsvars32bat"
3421 find_ucrt()
3423     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3424     if test -n "$regvalue"; then
3425         PathFormat "$regvalue"
3426         UCRTSDKDIR=$formatted_path
3427         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3428         UCRTVERSION=$regvalue
3429         # Rest if not exist
3430         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3431           UCRTSDKDIR=
3432         fi
3433     fi
3434     if test -z "$UCRTSDKDIR"; then
3435         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3436         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3437         if test -f "$ide_env_file"; then
3438             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3439             UCRTSDKDIR=$formatted_path
3440             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3441             dnl Hack needed at least by tml:
3442             if test "$UCRTVERSION" = 10.0.15063.0 \
3443                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3444                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3445             then
3446                 UCRTVERSION=10.0.14393.0
3447             fi
3448         else
3449           AC_MSG_ERROR([No UCRT found])
3450         fi
3451     fi
3454 find_msvc()
3456     # Find Visual C++ 2019
3457     # Args: $1 (optional) : The VS version year
3458     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3460     unset vctest vcnum vcnumwithdot vcbuildnumber
3462     vs_versions_to_check "$1"
3463     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3464     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3465     PathFormat "$vswhere"
3466     vswhere=$formatted_path
3467     for ver in $vsversions; do
3468         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3469         # Fall back to all MS products (this includes VC++ Build Tools)
3470         if ! test -n "$vswhereoutput"; then
3471             AC_MSG_CHECKING([VC++ Build Tools and similar])
3472             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3473         fi
3474         if test -n "$vswhereoutput"; then
3475             PathFormat "$vswhereoutput"
3476             vctest=$formatted_path
3477             break
3478         fi
3479     done
3481     if test -n "$vctest"; then
3482         vcnumwithdot="$ver.0"
3483         case "$vcnumwithdot" in
3484         16.0)
3485             vcyear=2019
3486             vcnum=160
3487             ;;
3488         esac
3489         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3491     fi
3494 SOLARINC=
3495 MSBUILD_PATH=
3496 DEVENV=
3497 if test "$_os" = "WINNT"; then
3498     AC_MSG_CHECKING([Visual C++])
3499     find_msvc "$with_visual_studio"
3500     if test -z "$vctest"; then
3501         if test -n "$with_visual_studio"; then
3502             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3503         else
3504             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3505         fi
3506     fi
3508     if test "$BITNESS_OVERRIDE" = ""; then
3509         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3510             VC_PRODUCT_DIR=$vctest/VC
3511         else
3512             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3513         fi
3514     else
3515         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3516             VC_PRODUCT_DIR=$vctest/VC
3517         else
3518             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3519         fi
3520     fi
3521     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3523     AC_MSG_CHECKING([for short pathname of VC product directory])
3524     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3525     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3527     UCRTSDKDIR=
3528     UCRTVERSION=
3530     AC_MSG_CHECKING([for UCRT location])
3531     find_ucrt
3532     # find_ucrt errors out if it doesn't find it
3533     AC_MSG_RESULT([found])
3534     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3535     ucrtincpath_formatted=$formatted_path
3536     # SOLARINC is used for external modules and must be set too.
3537     # And no, it's not sufficient to set SOLARINC only, as configure
3538     # itself doesn't honour it.
3539     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3540     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3541     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3542     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3544     AC_SUBST(UCRTSDKDIR)
3545     AC_SUBST(UCRTVERSION)
3547     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3548     # Find the proper version of MSBuild.exe to use based on the VS version
3549     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3550     if test -n "$regvalue" ; then
3551         AC_MSG_RESULT([found: $regvalue])
3552         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3553     else
3554         if test "$vcnumwithdot" = "16.0"; then
3555             if test "$BITNESS_OVERRIDE" = ""; then
3556                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3557             else
3558                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3559             fi
3560         else
3561             if test "$BITNESS_OVERRIDE" = ""; then
3562                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3563             else
3564                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3565             fi
3566         fi
3567         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3568         AC_MSG_RESULT([$regvalue])
3569     fi
3571     # Find the version of devenv.exe
3572     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3573     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3574     if test ! -e "$DEVENV"; then
3575         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3576     fi
3578     dnl ===========================================================
3579     dnl  Check for the corresponding mspdb*.dll
3580     dnl ===========================================================
3582     VC_HOST_DIR=
3583     MSPDB_PATH=
3584     CL_PATH=
3586     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3587         VC_HOST_DIR="HostX64"
3588         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3589     else
3590         VC_HOST_DIR="HostX86"
3591         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3592     fi
3594     if test "$BITNESS_OVERRIDE" = ""; then
3595         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3596     else
3597         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3598     fi
3600     # MSVC 15.0 has libraries from 14.0?
3601     mspdbnum="140"
3603     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3604         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3605     fi
3607     dnl The path needs to be added before cl is called
3608     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3609     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3611     AC_MSG_CHECKING([cl.exe])
3613     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3614     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3615     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3616     # is not enough?
3618     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3619     dnl needed when building CLR code:
3620     if test -z "$MSVC_CXX"; then
3621         if test -f "$CL_PATH/cl.exe"; then
3622             MSVC_CXX="$CL_PATH/cl.exe"
3623         fi
3625         # This gives us a posix path with 8.3 filename restrictions
3626         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3627     fi
3629     if test -z "$CC"; then
3630         CC=$MSVC_CXX
3631         CC_BASE=`first_arg_basename "$CC"`
3632     fi
3633     if test -z "$CXX"; then
3634         CXX=$MSVC_CXX
3635         CXX_BASE=`first_arg_basename "$CXX"`
3636     fi
3638     if test -n "$CC"; then
3639         # Remove /cl.exe from CC case insensitive
3640         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3641         if test "$BITNESS_OVERRIDE" = ""; then
3642            COMPATH="$VC_PRODUCT_DIR"
3643         else
3644             if test -n "$VC_PRODUCT_DIR"; then
3645                 COMPATH=$VC_PRODUCT_DIR
3646             fi
3647         fi
3649         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3651         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3653         PathFormat "$COMPATH"
3654         COMPATH=`win_short_path_for_make "$formatted_path"`
3656         VCVER=$vcnum
3658         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3659         # are always "better", we list them in reverse chronological order.
3661         case "$vcnum" in
3662         160)
3663             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3664             ;;
3665         esac
3667         # The expectation is that --with-windows-sdk should not need to be used
3668         if test -n "$with_windows_sdk"; then
3669             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3670             *" "$with_windows_sdk" "*)
3671                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3672                 ;;
3673             *)
3674                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
3675                 ;;
3676             esac
3677         fi
3679         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3680         ac_objext=obj
3681         ac_exeext=exe
3683     else
3684         AC_MSG_ERROR([Visual C++ not found after all, huh])
3685     fi
3687     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
3688     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3689         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3690         // between Visual Studio versions and _MSC_VER:
3691         #if _MSC_VER < 1924
3692         #error
3693         #endif
3694     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3696     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3697     # version of the Explorer extension (and maybe other small
3698     # bits, too) needed when installing a 32-bit LibreOffice on a
3699     # 64-bit OS. The 64-bit Explorer extension is a feature that
3700     # has been present since long in OOo. Don't confuse it with
3701     # building LibreOffice itself as 64-bit code.
3703     BUILD_X64=
3704     CXX_X64_BINARY=
3706     if test "$BITNESS_OVERRIDE" = ""; then
3707         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3708         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3709              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3710             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3711                 BUILD_X64=TRUE
3712                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3713             fi
3714         fi
3715         if test "$BUILD_X64" = TRUE; then
3716             AC_MSG_RESULT([found])
3717         else
3718             AC_MSG_RESULT([not found])
3719             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3720         fi
3721     else
3722         CXX_X64_BINARY=$CXX
3723     fi
3724     AC_SUBST(BUILD_X64)
3726     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3727     AC_SUBST(CXX_X64_BINARY)
3729     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3730     # needed to support TWAIN scan on both 32- and 64-bit systems
3732     BUILD_X86=
3734     if test "$BITNESS_OVERRIDE" = "64"; then
3735         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3736         if test -n "$CXX_X86_BINARY"; then
3737             BUILD_X86=TRUE
3738             AC_MSG_RESULT([preset])
3739         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3740             BUILD_X86=TRUE
3741             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3742             CXX_X86_BINARY+=" /arch:SSE"
3743             AC_MSG_RESULT([found])
3744         else
3745             CXX_X86_BINARY=
3746             AC_MSG_RESULT([not found])
3747             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3748         fi
3749     else
3750         BUILD_X86=TRUE
3751         CXX_X86_BINARY=$MSVC_CXX
3752     fi
3753     AC_SUBST(BUILD_X86)
3754     AC_SUBST(CXX_X86_BINARY)
3756 AC_SUBST(VCVER)
3757 AC_SUBST(DEVENV)
3758 AC_SUBST(MSVC_CXX)
3761 # unowinreg.dll
3763 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3764 AC_SUBST(UNOWINREG_DLL)
3766 COM_IS_CLANG=
3767 AC_MSG_CHECKING([whether the compiler is actually Clang])
3768 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3769     #ifndef __clang__
3770     you lose
3771     #endif
3772     int foo=42;
3773     ]])],
3774     [AC_MSG_RESULT([yes])
3775      COM_IS_CLANG=TRUE],
3776     [AC_MSG_RESULT([no])])
3777 AC_SUBST(COM_IS_CLANG)
3779 CC_PLAIN=$CC
3780 CLANGVER=
3781 if test "$COM_IS_CLANG" = TRUE; then
3782     AC_MSG_CHECKING([whether Clang is new enough])
3783     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3784         #if !defined __apple_build_version__
3785         #error
3786         #endif
3787         ]])],
3788         [my_apple_clang=yes],[my_apple_clang=])
3789     if test "$my_apple_clang" = yes; then
3790         AC_MSG_RESULT([assumed yes (Apple Clang)])
3791     else
3792         if test "$_os" = WINNT; then
3793             dnl In which case, assume clang-cl:
3794             my_args="/EP /TC"
3795             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3796             dnl clang-cl:
3797             CC_PLAIN=
3798             for i in $CC; do
3799                 case $i in
3800                 -FIIntrin.h)
3801                     ;;
3802                 *)
3803                     CC_PLAIN="$CC_PLAIN $i"
3804                     ;;
3805                 esac
3806             done
3807         else
3808             my_args="-E -P"
3809         fi
3810         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3811         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3812         CLANGVER=`echo $clang_version \
3813             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3814         if test "$CLANGVER" -ge 50002; then
3815             AC_MSG_RESULT([yes ($clang_version)])
3816         else
3817             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3818         fi
3819         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3820         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3821     fi
3824 SHOWINCLUDES_PREFIX=
3825 if test "$_os" = WINNT; then
3826     dnl We need to guess the prefix of the -showIncludes output, it can be
3827     dnl localized
3828     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3829     echo "#include <stdlib.h>" > conftest.c
3830     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3831         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3832     rm -f conftest.c conftest.obj
3833     if test -z "$SHOWINCLUDES_PREFIX"; then
3834         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3835     else
3836         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3837     fi
3839 AC_SUBST(SHOWINCLUDES_PREFIX)
3842 # prefix C with ccache if needed
3844 if test "$CCACHE" != ""; then
3845     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3847     AC_LANG_PUSH([C])
3848     save_CFLAGS=$CFLAGS
3849     CFLAGS="$CFLAGS --ccache-skip -O2"
3850     dnl an empty program will do, we're checking the compiler flags
3851     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3852                       [use_ccache=yes], [use_ccache=no])
3853     if test $use_ccache = yes; then
3854         AC_MSG_RESULT([yes])
3855     else
3856         CC="$CCACHE $CC"
3857         CC_BASE="ccache $CC_BASE"
3858         AC_MSG_RESULT([no])
3859     fi
3860     CFLAGS=$save_CFLAGS
3861     AC_LANG_POP([C])
3864 # ===================================================================
3865 # check various GCC options that Clang does not support now but maybe
3866 # will somewhen in the future, check them even for GCC, so that the
3867 # flags are set
3868 # ===================================================================
3870 HAVE_GCC_GGDB2=
3871 if test "$GCC" = "yes"; then
3872     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3873     save_CFLAGS=$CFLAGS
3874     CFLAGS="$CFLAGS -Werror -ggdb2"
3875     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3876     CFLAGS=$save_CFLAGS
3877     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3878         AC_MSG_RESULT([yes])
3879     else
3880         AC_MSG_RESULT([no])
3881     fi
3883     if test "$host_cpu" = "m68k"; then
3884         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3885         save_CFLAGS=$CFLAGS
3886         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3887         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3888         CFLAGS=$save_CFLAGS
3889         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3890             AC_MSG_RESULT([yes])
3891         else
3892             AC_MSG_ERROR([no])
3893         fi
3894     fi
3896 AC_SUBST(HAVE_GCC_GGDB2)
3898 dnl ===================================================================
3899 dnl  Test the gcc version
3900 dnl ===================================================================
3901 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3902     AC_MSG_CHECKING([the GCC version])
3903     _gcc_version=`$CC -dumpversion`
3904     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3905         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3906     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3908     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3910     if test "$gcc_full_version" -lt 70000; then
3911         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3912     fi
3913 else
3914     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3915     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3916     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3917     # (which reports itself as GCC 4.2.1).
3918     GCC_VERSION=
3920 AC_SUBST(GCC_VERSION)
3922 dnl Set the ENABLE_DBGUTIL variable
3923 dnl ===================================================================
3924 AC_MSG_CHECKING([whether to build with additional debug utilities])
3925 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3926     ENABLE_DBGUTIL="TRUE"
3927     # this is an extra var so it can have different default on different MSVC
3928     # versions (in case there are version specific problems with it)
3929     MSVC_USE_DEBUG_RUNTIME="TRUE"
3931     AC_MSG_RESULT([yes])
3932     # cppunit and graphite expose STL in public headers
3933     if test "$with_system_cppunit" = "yes"; then
3934         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3935     else
3936         with_system_cppunit=no
3937     fi
3938     if test "$with_system_graphite" = "yes"; then
3939         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3940     else
3941         with_system_graphite=no
3942     fi
3943     if test "$with_system_orcus" = "yes"; then
3944         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3945     else
3946         with_system_orcus=no
3947     fi
3948     if test "$with_system_libcmis" = "yes"; then
3949         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3950     else
3951         with_system_libcmis=no
3952     fi
3953     if test "$with_system_hunspell" = "yes"; then
3954         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3955     else
3956         with_system_hunspell=no
3957     fi
3958     if test "$with_system_gpgmepp" = "yes"; then
3959         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3960     else
3961         with_system_gpgmepp=no
3962     fi
3963     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3964     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3965     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3966     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3967     # of those two is using the system variant:
3968     if test "$with_system_libnumbertext" = "yes"; then
3969         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3970     else
3971         with_system_libnumbertext=no
3972     fi
3973     if test "$with_system_libwps" = "yes"; then
3974         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3975     else
3976         with_system_libwps=no
3977     fi
3978 else
3979     ENABLE_DBGUTIL=""
3980     MSVC_USE_DEBUG_RUNTIME=""
3981     AC_MSG_RESULT([no])
3983 AC_SUBST(ENABLE_DBGUTIL)
3984 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3986 dnl Set the ENABLE_DEBUG variable.
3987 dnl ===================================================================
3988 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3989     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3991 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3992     if test -z "$libo_fuzzed_enable_debug"; then
3993         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3994     else
3995         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3996         enable_debug=yes
3997     fi
4000 AC_MSG_CHECKING([whether to do a debug build])
4001 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4002     ENABLE_DEBUG="TRUE"
4003     if test -n "$ENABLE_DBGUTIL" ; then
4004         AC_MSG_RESULT([yes (dbgutil)])
4005     else
4006         AC_MSG_RESULT([yes])
4007     fi
4008 else
4009     ENABLE_DEBUG=""
4010     AC_MSG_RESULT([no])
4012 AC_SUBST(ENABLE_DEBUG)
4014 dnl ===================================================================
4015 dnl Select the linker to use (gold/lld/ld.bfd).
4016 dnl This is done only after compiler checks (need to know if Clang is
4017 dnl used, for different defaults) and after checking if a debug build
4018 dnl is wanted (non-debug builds get the default linker if not explicitly
4019 dnl specified otherwise).
4020 dnl All checks for linker features/options should come after this.
4021 dnl ===================================================================
4022 check_use_ld()
4024     use_ld=$1
4025     use_ld_fail_if_error=$2
4026     use_ld_ok=
4027     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
4028     use_ld_ldflags_save="$LDFLAGS"
4029     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
4030     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4031 #include <stdio.h>
4032         ],[
4033 printf ("hello world\n");
4034         ])], USE_LD=$use_ld, [])
4035     if test -n "$USE_LD"; then
4036         AC_MSG_RESULT( yes )
4037         use_ld_ok=yes
4038     else
4039         if test -n "$use_ld_fail_if_error"; then
4040             AC_MSG_ERROR( no )
4041         else
4042             AC_MSG_RESULT( no )
4043         fi
4044     fi
4045     if test -n "$use_ld_ok"; then
4046         dnl keep the value of LDFLAGS
4047         return 0
4048     fi
4049     LDFLAGS="$use_ld_ldflags_save"
4050     return 1
4052 USE_LD=
4053 if test "$enable_ld" != "no"; then
4054     if test "$GCC" = "yes"; then
4055         if test -n "$enable_ld"; then
4056             check_use_ld "$enable_ld" fail_if_error
4057         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4058             dnl non-debug builds default to the default linker
4059             true
4060         elif test -n "$COM_IS_CLANG"; then
4061             check_use_ld lld
4062             if test $? -ne 0; then
4063                 check_use_ld gold
4064             fi
4065         else
4066             # For gcc first try gold, new versions also support lld.
4067             check_use_ld gold
4068             if test $? -ne 0; then
4069                 check_use_ld lld
4070             fi
4071         fi
4072         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4073         rm conftest.out
4074         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4075         if test -z "$ld_used"; then
4076             ld_used="unknown"
4077         fi
4078         AC_MSG_CHECKING([for linker that is used])
4079         AC_MSG_RESULT([$ld_used])
4080         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4081             if echo "$ld_used" | grep -q "^GNU ld"; then
4082                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4083                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4084             fi
4085         fi
4086     else
4087         if test "$enable_ld" = "yes"; then
4088             AC_MSG_ERROR([--enable-ld not supported])
4089         fi
4090     fi
4092 AC_SUBST(USE_LD)
4094 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4095 if test "$GCC" = "yes"; then
4096     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4097     bsymbolic_functions_ldflags_save=$LDFLAGS
4098     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4099     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4100 #include <stdio.h>
4101         ],[
4102 printf ("hello world\n");
4103         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4104     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4105         AC_MSG_RESULT( found )
4106     else
4107         AC_MSG_RESULT( not found )
4108     fi
4109     LDFLAGS=$bsymbolic_functions_ldflags_save
4111 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4113 LD_GC_SECTIONS=
4114 if test "$GCC" = "yes"; then
4115     for flag in "--gc-sections" "-dead_strip"; do
4116         AC_MSG_CHECKING([for $flag linker support])
4117         ldflags_save=$LDFLAGS
4118         LDFLAGS="$LDFLAGS -Wl,$flag"
4119         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4120 #include <stdio.h>
4121             ],[
4122 printf ("hello world\n");
4123             ])],[
4124             LD_GC_SECTIONS="-Wl,$flag"
4125             AC_MSG_RESULT( found )
4126             ], [
4127             AC_MSG_RESULT( not found )
4128             ])
4129         LDFLAGS=$ldflags_save
4130         if test -n "$LD_GC_SECTIONS"; then
4131             break
4132         fi
4133     done
4135 AC_SUBST(LD_GC_SECTIONS)
4137 HAVE_GSPLIT_DWARF=
4138 if test "$enable_split_debug" != no; then
4139     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4140     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4141         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4142         save_CFLAGS=$CFLAGS
4143         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4144         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4145         CFLAGS=$save_CFLAGS
4146         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4147             AC_MSG_RESULT([yes])
4148         else
4149             if test "$enable_split_debug" = yes; then
4150                 AC_MSG_ERROR([no])
4151             else
4152                 AC_MSG_RESULT([no])
4153             fi
4154         fi
4155     fi
4156     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4157         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4158         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4159     fi
4161 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4163 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4164 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4165 save_CFLAGS=$CFLAGS
4166 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4167 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4168 CFLAGS=$save_CFLAGS
4169 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4170     AC_MSG_RESULT([yes])
4171 else
4172     AC_MSG_RESULT([no])
4174 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4176 ENABLE_GDB_INDEX=
4177 if test "$enable_gdb_index" != "no"; then
4178     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4179     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4180         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4181         save_CFLAGS=$CFLAGS
4182         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4183         have_ggnu_pubnames=
4184         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4185         if test "$have_ggnu_pubnames" != "TRUE"; then
4186             if test "$enable_gdb_index" = "yes"; then
4187                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4188             else
4189                 AC_MSG_RESULT( no )
4190             fi
4191         else
4192             AC_MSG_RESULT( yes )
4193             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4194             ldflags_save=$LDFLAGS
4195             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4196             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4197 #include <stdio.h>
4198                 ],[
4199 printf ("hello world\n");
4200                 ])], ENABLE_GDB_INDEX=TRUE, [])
4201             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4202                 AC_MSG_RESULT( yes )
4203             else
4204                 if test "$enable_gdb_index" = "yes"; then
4205                     AC_MSG_ERROR( no )
4206                 else
4207                     AC_MSG_RESULT( no )
4208                 fi
4209             fi
4210             LDFLAGS=$ldflags_save
4211         fi
4212         CFLAGS=$save_CFLAGS
4213         fi
4214     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4215         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4216         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4217     fi
4219 AC_SUBST(ENABLE_GDB_INDEX)
4221 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4222     enable_sal_log=yes
4224 if test "$enable_sal_log" = yes; then
4225     ENABLE_SAL_LOG=TRUE
4227 AC_SUBST(ENABLE_SAL_LOG)
4229 dnl Check for enable symbols option
4230 dnl ===================================================================
4231 AC_MSG_CHECKING([whether to generate debug information])
4232 if test -z "$enable_symbols"; then
4233     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4234         enable_symbols=yes
4235     else
4236         enable_symbols=no
4237     fi
4239 if test "$enable_symbols" = yes; then
4240     ENABLE_SYMBOLS_FOR=all
4241     AC_MSG_RESULT([yes])
4242 elif test "$enable_symbols" = no; then
4243     ENABLE_SYMBOLS_FOR=
4244     AC_MSG_RESULT([no])
4245 else
4246     # Selective debuginfo.
4247     ENABLE_SYMBOLS_FOR="$enable_symbols"
4248     AC_MSG_RESULT([for "$enable_symbols"])
4250 AC_SUBST(ENABLE_SYMBOLS_FOR)
4252 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4253     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4254     AC_MSG_CHECKING([whether enough memory is available for linking])
4255     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4256     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4257     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4258         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4259     else
4260         AC_MSG_RESULT([yes])
4261     fi
4264 ENABLE_OPTIMIZED=
4265 ENABLE_OPTIMIZED_DEBUG=
4266 AC_MSG_CHECKING([whether to compile with optimization flags])
4267 if test -z "$enable_optimized"; then
4268     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4269         enable_optimized=no
4270     else
4271         enable_optimized=yes
4272     fi
4274 if test "$enable_optimized" = yes; then
4275     ENABLE_OPTIMIZED=TRUE
4276     AC_MSG_RESULT([yes])
4277 elif test "$enable_optimized" = debug; then
4278     ENABLE_OPTIMIZED_DEBUG=TRUE
4279     AC_MSG_RESULT([yes (debug)])
4280     HAVE_GCC_OG=
4281     if test "$GCC" = "yes"; then
4282         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4283         save_CFLAGS=$CFLAGS
4284         CFLAGS="$CFLAGS -Werror -Og"
4285         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4286         CFLAGS=$save_CFLAGS
4287         if test "$HAVE_GCC_OG" = "TRUE"; then
4288             AC_MSG_RESULT([yes])
4289         else
4290             AC_MSG_RESULT([no])
4291         fi
4292     fi
4293     if test -z "$HAVE_GCC_OG"; then
4294         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4295     fi
4296 else
4297     AC_MSG_RESULT([no])
4299 AC_SUBST(ENABLE_OPTIMIZED)
4300 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4303 # determine CPUNAME, OS, ...
4304 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4306 case "$host_os" in
4308 aix*)
4309     COM=GCC
4310     CPUNAME=POWERPC
4311     USING_X11=TRUE
4312     OS=AIX
4313     RTL_OS=AIX
4314     RTL_ARCH=PowerPC
4315     PLATFORMID=aix_powerpc
4316     P_SEP=:
4317     ;;
4319 cygwin*)
4320     COM=MSC
4321     USING_X11=
4322     OS=WNT
4323     RTL_OS=Windows
4324     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4325         P_SEP=";"
4326     else
4327         P_SEP=:
4328     fi
4329     case "$host_cpu" in
4330     i*86|x86_64)
4331         if test "$BITNESS_OVERRIDE" = 64; then
4332             CPUNAME=X86_64
4333             RTL_ARCH=X86_64
4334             PLATFORMID=windows_x86_64
4335             WINDOWS_X64=1
4336             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4337         else
4338             CPUNAME=INTEL
4339             RTL_ARCH=x86
4340             PLATFORMID=windows_x86
4341         fi
4342         ;;
4343     *)
4344         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4345         ;;
4346     esac
4347     SCPDEFS="$SCPDEFS -D_MSC_VER"
4348     ;;
4350 darwin*|macos*)
4351     COM=GCC
4352     USING_X11=
4353     OS=MACOSX
4354     RTL_OS=MacOSX
4355     P_SEP=:
4357     case "$host_cpu" in
4358     arm64)
4359         if test "$enable_ios_simulator" = "yes"; then
4360             OS=iOS
4361         else
4362             CPUNAME=ARM64
4363             RTL_ARCH=AARCH
4364             PLATFORMID=macosx_arm64
4365         fi
4366         ;;
4367     x86_64)
4368         if test "$enable_ios_simulator" = "yes"; then
4369             OS=iOS
4370         fi
4371         CPUNAME=X86_64
4372         RTL_ARCH=X86_64
4373         PLATFORMID=macosx_x86_64
4374         ;;
4375     *)
4376         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4377         ;;
4378     esac
4379     ;;
4381 ios*)
4382     COM=GCC
4383     USING_X11=
4384     OS=iOS
4385     RTL_OS=iOS
4386     P_SEP=:
4388     case "$host_cpu" in
4389     arm64)
4390         if test "$enable_ios_simulator" = "yes"; then
4391             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4392         fi
4393         ;;
4394     *)
4395         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4396         ;;
4397     esac
4398     CPUNAME=ARM64
4399     RTL_ARCH=ARM_EABI
4400     PLATFORMID=ios_arm64
4401     ;;
4403 dragonfly*)
4404     COM=GCC
4405     USING_X11=TRUE
4406     OS=DRAGONFLY
4407     RTL_OS=DragonFly
4408     P_SEP=:
4410     case "$host_cpu" in
4411     i*86)
4412         CPUNAME=INTEL
4413         RTL_ARCH=x86
4414         PLATFORMID=dragonfly_x86
4415         ;;
4416     x86_64)
4417         CPUNAME=X86_64
4418         RTL_ARCH=X86_64
4419         PLATFORMID=dragonfly_x86_64
4420         ;;
4421     *)
4422         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4423         ;;
4424     esac
4425     ;;
4427 freebsd*)
4428     COM=GCC
4429     USING_X11=TRUE
4430     RTL_OS=FreeBSD
4431     OS=FREEBSD
4432     P_SEP=:
4434     case "$host_cpu" in
4435     i*86)
4436         CPUNAME=INTEL
4437         RTL_ARCH=x86
4438         PLATFORMID=freebsd_x86
4439         ;;
4440     x86_64|amd64)
4441         CPUNAME=X86_64
4442         RTL_ARCH=X86_64
4443         PLATFORMID=freebsd_x86_64
4444         ;;
4445     *)
4446         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4447         ;;
4448     esac
4449     ;;
4451 haiku*)
4452     COM=GCC
4453     USING_X11=
4454     GUIBASE=haiku
4455     RTL_OS=Haiku
4456     OS=HAIKU
4457     P_SEP=:
4459     case "$host_cpu" in
4460     i*86)
4461         CPUNAME=INTEL
4462         RTL_ARCH=x86
4463         PLATFORMID=haiku_x86
4464         ;;
4465     x86_64|amd64)
4466         CPUNAME=X86_64
4467         RTL_ARCH=X86_64
4468         PLATFORMID=haiku_x86_64
4469         ;;
4470     *)
4471         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4472         ;;
4473     esac
4474     ;;
4476 kfreebsd*)
4477     COM=GCC
4478     USING_X11=TRUE
4479     OS=LINUX
4480     RTL_OS=kFreeBSD
4481     P_SEP=:
4483     case "$host_cpu" in
4485     i*86)
4486         CPUNAME=INTEL
4487         RTL_ARCH=x86
4488         PLATFORMID=kfreebsd_x86
4489         ;;
4490     x86_64)
4491         CPUNAME=X86_64
4492         RTL_ARCH=X86_64
4493         PLATFORMID=kfreebsd_x86_64
4494         ;;
4495     *)
4496         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4497         ;;
4498     esac
4499     ;;
4501 linux-gnu*)
4502     COM=GCC
4503     USING_X11=TRUE
4504     OS=LINUX
4505     RTL_OS=Linux
4506     P_SEP=:
4508     case "$host_cpu" in
4510     aarch64)
4511         CPUNAME=AARCH64
4512         PLATFORMID=linux_aarch64
4513         RTL_ARCH=AARCH64
4514         ;;
4515     alpha)
4516         CPUNAME=AXP
4517         RTL_ARCH=ALPHA
4518         PLATFORMID=linux_alpha
4519         ;;
4520     arm*)
4521         CPUNAME=ARM
4522         EPM_FLAGS="-a arm"
4523         RTL_ARCH=ARM_EABI
4524         PLATFORMID=linux_arm_eabi
4525         case "$host_cpu" in
4526         arm*-linux)
4527             RTL_ARCH=ARM_OABI
4528             PLATFORMID=linux_arm_oabi
4529             ;;
4530         esac
4531         ;;
4532     hppa)
4533         CPUNAME=HPPA
4534         RTL_ARCH=HPPA
4535         EPM_FLAGS="-a hppa"
4536         PLATFORMID=linux_hppa
4537         ;;
4538     i*86)
4539         CPUNAME=INTEL
4540         RTL_ARCH=x86
4541         PLATFORMID=linux_x86
4542         ;;
4543     ia64)
4544         CPUNAME=IA64
4545         RTL_ARCH=IA64
4546         PLATFORMID=linux_ia64
4547         ;;
4548     mips)
4549         CPUNAME=GODSON
4550         RTL_ARCH=MIPS_EB
4551         EPM_FLAGS="-a mips"
4552         PLATFORMID=linux_mips_eb
4553         ;;
4554     mips64)
4555         CPUNAME=GODSON64
4556         RTL_ARCH=MIPS64_EB
4557         EPM_FLAGS="-a mips64"
4558         PLATFORMID=linux_mips64_eb
4559         ;;
4560     mips64el)
4561         CPUNAME=GODSON64
4562         RTL_ARCH=MIPS64_EL
4563         EPM_FLAGS="-a mips64el"
4564         PLATFORMID=linux_mips64_el
4565         ;;
4566     mipsel)
4567         CPUNAME=GODSON
4568         RTL_ARCH=MIPS_EL
4569         EPM_FLAGS="-a mipsel"
4570         PLATFORMID=linux_mips_el
4571         ;;
4572     m68k)
4573         CPUNAME=M68K
4574         RTL_ARCH=M68K
4575         PLATFORMID=linux_m68k
4576         ;;
4577     powerpc)
4578         CPUNAME=POWERPC
4579         RTL_ARCH=PowerPC
4580         PLATFORMID=linux_powerpc
4581         ;;
4582     powerpc64)
4583         CPUNAME=POWERPC64
4584         RTL_ARCH=PowerPC_64
4585         PLATFORMID=linux_powerpc64
4586         ;;
4587     powerpc64le)
4588         CPUNAME=POWERPC64
4589         RTL_ARCH=PowerPC_64_LE
4590         PLATFORMID=linux_powerpc64_le
4591         ;;
4592     sparc)
4593         CPUNAME=SPARC
4594         RTL_ARCH=SPARC
4595         PLATFORMID=linux_sparc
4596         ;;
4597     sparc64)
4598         CPUNAME=SPARC64
4599         RTL_ARCH=SPARC64
4600         PLATFORMID=linux_sparc64
4601         ;;
4602     s390)
4603         CPUNAME=S390
4604         RTL_ARCH=S390
4605         PLATFORMID=linux_s390
4606         ;;
4607     s390x)
4608         CPUNAME=S390X
4609         RTL_ARCH=S390x
4610         PLATFORMID=linux_s390x
4611         ;;
4612     x86_64)
4613         CPUNAME=X86_64
4614         RTL_ARCH=X86_64
4615         PLATFORMID=linux_x86_64
4616         ;;
4617     *)
4618         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4619         ;;
4620     esac
4621     ;;
4623 linux-android*)
4624     COM=GCC
4625     USING_X11=
4626     OS=ANDROID
4627     RTL_OS=Android
4628     P_SEP=:
4630     case "$host_cpu" in
4632     arm|armel)
4633         CPUNAME=ARM
4634         RTL_ARCH=ARM_EABI
4635         PLATFORMID=android_arm_eabi
4636         ;;
4637     aarch64)
4638         CPUNAME=AARCH64
4639         RTL_ARCH=AARCH64
4640         PLATFORMID=android_aarch64
4641         ;;
4642     i*86)
4643         CPUNAME=INTEL
4644         RTL_ARCH=x86
4645         PLATFORMID=android_x86
4646         ;;
4647     x86_64)
4648         CPUNAME=X86_64
4649         RTL_ARCH=X86_64
4650         PLATFORMID=android_x86_64
4651         ;;
4652     *)
4653         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4654         ;;
4655     esac
4656     ;;
4658 *netbsd*)
4659     COM=GCC
4660     USING_X11=TRUE
4661     OS=NETBSD
4662     RTL_OS=NetBSD
4663     P_SEP=:
4665     case "$host_cpu" in
4666     i*86)
4667         CPUNAME=INTEL
4668         RTL_ARCH=x86
4669         PLATFORMID=netbsd_x86
4670         ;;
4671     powerpc)
4672         CPUNAME=POWERPC
4673         RTL_ARCH=PowerPC
4674         PLATFORMID=netbsd_powerpc
4675         ;;
4676     sparc)
4677         CPUNAME=SPARC
4678         RTL_ARCH=SPARC
4679         PLATFORMID=netbsd_sparc
4680         ;;
4681     x86_64)
4682         CPUNAME=X86_64
4683         RTL_ARCH=X86_64
4684         PLATFORMID=netbsd_x86_64
4685         ;;
4686     *)
4687         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4688         ;;
4689     esac
4690     ;;
4692 openbsd*)
4693     COM=GCC
4694     USING_X11=TRUE
4695     OS=OPENBSD
4696     RTL_OS=OpenBSD
4697     P_SEP=:
4699     case "$host_cpu" in
4700     i*86)
4701         CPUNAME=INTEL
4702         RTL_ARCH=x86
4703         PLATFORMID=openbsd_x86
4704         ;;
4705     x86_64)
4706         CPUNAME=X86_64
4707         RTL_ARCH=X86_64
4708         PLATFORMID=openbsd_x86_64
4709         ;;
4710     *)
4711         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4712         ;;
4713     esac
4714     SOLARINC="$SOLARINC -I/usr/local/include"
4715     ;;
4717 solaris*)
4718     COM=GCC
4719     USING_X11=TRUE
4720     OS=SOLARIS
4721     RTL_OS=Solaris
4722     P_SEP=:
4724     case "$host_cpu" in
4725     i*86)
4726         CPUNAME=INTEL
4727         RTL_ARCH=x86
4728         PLATFORMID=solaris_x86
4729         ;;
4730     sparc)
4731         CPUNAME=SPARC
4732         RTL_ARCH=SPARC
4733         PLATFORMID=solaris_sparc
4734         ;;
4735     sparc64)
4736         CPUNAME=SPARC64
4737         RTL_ARCH=SPARC64
4738         PLATFORMID=solaris_sparc64
4739         ;;
4740     *)
4741         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4742         ;;
4743     esac
4744     SOLARINC="$SOLARINC -I/usr/local/include"
4745     ;;
4748     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4749     ;;
4750 esac
4752 if test "$with_x" = "no"; then
4753     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4756 DISABLE_GUI=""
4757 if test "$enable_gui" = "no"; then
4758     if test "$USING_X11" != TRUE; then
4759         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4760     fi
4761     USING_X11=
4762     DISABLE_GUI=TRUE
4763     AC_DEFINE(HAVE_FEATURE_UI,0)
4764     test_cairo=yes
4766 AC_SUBST(DISABLE_GUI)
4768 WORKDIR="${BUILDDIR}/workdir"
4769 INSTDIR="${BUILDDIR}/instdir"
4770 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4771 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4772 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4773 AC_SUBST(COM)
4774 AC_SUBST(CPUNAME)
4775 AC_SUBST(RTL_OS)
4776 AC_SUBST(RTL_ARCH)
4777 AC_SUBST(EPM_FLAGS)
4778 AC_SUBST(USING_X11)
4779 AC_SUBST([INSTDIR])
4780 AC_SUBST([INSTROOT])
4781 AC_SUBST([INSTROOTBASE])
4782 AC_SUBST(OS)
4783 AC_SUBST(P_SEP)
4784 AC_SUBST(WORKDIR)
4785 AC_SUBST(PLATFORMID)
4786 AC_SUBST(WINDOWS_X64)
4787 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4789 dnl ===================================================================
4790 dnl Test which package format to use
4791 dnl ===================================================================
4792 AC_MSG_CHECKING([which package format to use])
4793 if test -n "$with_package_format" -a "$with_package_format" != no; then
4794     for i in $with_package_format; do
4795         case "$i" in
4796         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4797             ;;
4798         *)
4799             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4800 aix - AIX software distribution
4801 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4802 deb - Debian software distribution
4803 pkg - Solaris software distribution
4804 rpm - RedHat software distribution
4806 LibreOffice additionally supports:
4807 archive - .tar.gz or .zip
4808 dmg - macOS .dmg
4809 installed - installation tree
4810 msi - Windows .msi
4811         ])
4812             ;;
4813         esac
4814     done
4815     # fakeroot is needed to ensure correct file ownerships/permissions
4816     # inside deb packages and tar archives created on Linux and Solaris.
4817     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4818         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4819         if test "$FAKEROOT" = "no"; then
4820             AC_MSG_ERROR(
4821                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4822         fi
4823     fi
4824     PKGFORMAT="$with_package_format"
4825     AC_MSG_RESULT([$PKGFORMAT])
4826 else
4827     PKGFORMAT=
4828     AC_MSG_RESULT([none])
4830 AC_SUBST(PKGFORMAT)
4832 dnl ===================================================================
4833 dnl Set up a different compiler to produce tools to run on the build
4834 dnl machine when doing cross-compilation
4835 dnl ===================================================================
4837 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4838 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4839 if test "$cross_compiling" = "yes"; then
4840     AC_MSG_CHECKING([for BUILD platform configuration])
4841     echo
4842     rm -rf CONF-FOR-BUILD config_build.mk
4843     mkdir CONF-FOR-BUILD
4844     # Here must be listed all files needed when running the configure script. In particular, also
4845     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4846     # keep them in the same order as there.
4847     (cd $SRC_ROOT && tar cf - \
4848         config.guess \
4849         bin/get_config_variables \
4850         solenv/bin/getcompver.awk \
4851         solenv/inc/langlist.mk \
4852         download.lst \
4853         config_host.mk.in \
4854         config_host_lang.mk.in \
4855         Makefile.in \
4856         bin/bffvalidator.sh.in \
4857         bin/odfvalidator.sh.in \
4858         bin/officeotron.sh.in \
4859         hardened_runtime.xcent.in \
4860         instsetoo_native/util/openoffice.lst.in \
4861         config_host/*.in \
4862         sysui/desktop/macosx/Info.plist.in) \
4863     | (cd CONF-FOR-BUILD && tar xf -)
4864     cp configure CONF-FOR-BUILD
4865     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4866     (
4867     unset COM USING_X11 OS CPUNAME
4868     unset CC CXX SYSBASE CFLAGS
4869     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4870     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4871     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4872     if test -n "$CC_FOR_BUILD"; then
4873         export CC="$CC_FOR_BUILD"
4874         CC_BASE=`first_arg_basename "$CC"`
4875     fi
4876     if test -n "$CXX_FOR_BUILD"; then
4877         export CXX="$CXX_FOR_BUILD"
4878         CXX_BASE=`first_arg_basename "$CXX"`
4879     fi
4880     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4881     cd CONF-FOR-BUILD
4882     sub_conf_opts=""
4883     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4884     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4885     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4886     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4887     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4888     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4889     # Don't bother having configure look for stuff not needed for the build platform anyway
4890     ./configure \
4891         --disable-cups \
4892         --disable-gpgmepp \
4893         --disable-gstreamer-1-0 \
4894         --disable-gtk3 \
4895         --disable-pdfimport \
4896         --disable-postgresql-sdbc \
4897         --enable-icecream="$enable_icecream" \
4898         --with-parallelism="$with_parallelism" \
4899         --without-doxygen \
4900         --without-java \
4901         $sub_conf_opts \
4902         --srcdir=$srcdir \
4903         2>&1 | sed -e 's/^/    /'
4904     test -f ./config_host.mk 2>/dev/null || exit
4905     cp config_host.mk ../config_build.mk
4906     cp config_host_lang.mk ../config_build_lang.mk
4907     mv config.log ../config.Build.log
4908     mkdir -p ../config_build
4909     mv config_host/*.h ../config_build
4910     . ./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
4912     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
4913         VV='$'$V
4914         VV=`eval "echo $VV"`
4915         if test -n "$VV"; then
4916             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4917             echo "$line" >>build-config
4918         fi
4919     done
4921     for V in INSTDIR INSTROOT WORKDIR; do
4922         VV='$'$V
4923         VV=`eval "echo $VV"`
4924         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4925         if test -n "$VV"; then
4926             line="${V}_FOR_BUILD='$VV'"
4927             echo "$line" >>build-config
4928         fi
4929     done
4931     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4932     echo "$line" >>build-config
4934     )
4935     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4936     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])
4937     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4938              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4940     eval `cat CONF-FOR-BUILD/build-config`
4942     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4944     rm -rf CONF-FOR-BUILD
4945 else
4946     OS_FOR_BUILD="$OS"
4947     CC_FOR_BUILD="$CC"
4948     CXX_FOR_BUILD="$CXX"
4949     INSTDIR_FOR_BUILD="$INSTDIR"
4950     INSTROOT_FOR_BUILD="$INSTROOT"
4951     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4952     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4953     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4954     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4955     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4956     WORKDIR_FOR_BUILD="$WORKDIR"
4958 AC_SUBST(OS_FOR_BUILD)
4959 AC_SUBST(INSTDIR_FOR_BUILD)
4960 AC_SUBST(INSTROOT_FOR_BUILD)
4961 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4962 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4963 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4964 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4965 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4966 AC_SUBST(WORKDIR_FOR_BUILD)
4968 dnl ===================================================================
4969 dnl Check for syslog header
4970 dnl ===================================================================
4971 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4973 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4974 dnl ===================================================================
4975 AC_MSG_CHECKING([whether to turn warnings to errors])
4976 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4977     ENABLE_WERROR="TRUE"
4978     AC_MSG_RESULT([yes])
4979 else
4980     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4981         ENABLE_WERROR="TRUE"
4982         AC_MSG_RESULT([yes])
4983     else
4984         AC_MSG_RESULT([no])
4985     fi
4987 AC_SUBST(ENABLE_WERROR)
4989 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4990 dnl ===================================================================
4991 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4992 if test -z "$enable_assert_always_abort"; then
4993    if test "$ENABLE_DEBUG" = TRUE; then
4994        enable_assert_always_abort=yes
4995    else
4996        enable_assert_always_abort=no
4997    fi
4999 if test "$enable_assert_always_abort" = "yes"; then
5000     ASSERT_ALWAYS_ABORT="TRUE"
5001     AC_MSG_RESULT([yes])
5002 else
5003     ASSERT_ALWAYS_ABORT="FALSE"
5004     AC_MSG_RESULT([no])
5006 AC_SUBST(ASSERT_ALWAYS_ABORT)
5008 # Determine whether to use ooenv for the instdir installation
5009 # ===================================================================
5010 if test $_os != "WINNT" -a $_os != "Darwin"; then
5011     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5012     if test "$enable_ooenv" = "no"; then
5013         AC_MSG_RESULT([no])
5014     else
5015         ENABLE_OOENV="TRUE"
5016         AC_MSG_RESULT([yes])
5017     fi
5019 AC_SUBST(ENABLE_OOENV)
5021 if test "$USING_X11" != TRUE; then
5022     # be sure to do not mess with unneeded stuff
5023     test_randr=no
5024     test_xrender=no
5025     test_cups=no
5026     test_dbus=no
5027     build_gstreamer_1_0=no
5028     test_kf5=no
5029     test_qt5=no
5030     test_gtk3_kde5=no
5031     enable_cairo_canvas=no
5034 if test "$OS" = "HAIKU"; then
5035     enable_cairo_canvas=yes
5036     test_kf5=yes
5039 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5040     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!])
5041     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!"
5042     enable_kf5=yes
5045 if test "$test_kf5" = "yes"; then
5046     test_qt5=yes
5049 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5050     if test "$enable_qt5" = "no"; then
5051         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5052     else
5053         enable_qt5=yes
5054     fi
5057 dnl ===================================================================
5058 dnl check for cups support
5059 dnl ===================================================================
5060 ENABLE_CUPS=""
5062 if test "$enable_cups" = "no"; then
5063     test_cups=no
5066 AC_MSG_CHECKING([whether to enable CUPS support])
5067 if test "$test_cups" = "yes"; then
5068     ENABLE_CUPS="TRUE"
5069     AC_MSG_RESULT([yes])
5071     AC_MSG_CHECKING([whether cups support is present])
5072     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5073     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5074     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5075         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5076     fi
5078 else
5079     AC_MSG_RESULT([no])
5082 AC_SUBST(ENABLE_CUPS)
5084 # fontconfig checks
5085 if test "$test_fontconfig" = "yes"; then
5086     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5087     SYSTEM_FONTCONFIG=TRUE
5088     FilterLibs "${FONTCONFIG_LIBS}"
5089     FONTCONFIG_LIBS="${filteredlibs}"
5091 AC_SUBST(FONTCONFIG_CFLAGS)
5092 AC_SUBST(FONTCONFIG_LIBS)
5093 AC_SUBST([SYSTEM_FONTCONFIG])
5095 dnl whether to find & fetch external tarballs?
5096 dnl ===================================================================
5097 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5098    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5099        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5100    else
5101        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5102    fi
5104 if test -z "$TARFILE_LOCATION"; then
5105     if test -d "$SRC_ROOT/src" ; then
5106         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5107         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5108     fi
5109     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5110 else
5111     AbsolutePath "$TARFILE_LOCATION"
5112     PathFormat "${absolute_path}"
5113     TARFILE_LOCATION="${formatted_path}"
5115 AC_SUBST(TARFILE_LOCATION)
5117 AC_MSG_CHECKING([whether we want to fetch tarballs])
5118 if test "$enable_fetch_external" != "no"; then
5119     if test "$with_all_tarballs" = "yes"; then
5120         AC_MSG_RESULT([yes, all of them])
5121         DO_FETCH_TARBALLS="ALL"
5122     else
5123         AC_MSG_RESULT([yes, if we use them])
5124         DO_FETCH_TARBALLS="TRUE"
5125     fi
5126 else
5127     AC_MSG_RESULT([no])
5128     DO_FETCH_TARBALLS=
5130 AC_SUBST(DO_FETCH_TARBALLS)
5132 AC_MSG_CHECKING([whether to build help])
5133 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5134     BUILD_TYPE="$BUILD_TYPE HELP"
5135     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5136     case "$with_help" in
5137     "html")
5138         ENABLE_HTMLHELP=TRUE
5139         SCPDEFS="$SCPDEFS -DWITH_HELP"
5140         AC_MSG_RESULT([HTML])
5141         ;;
5142     "online")
5143         ENABLE_HTMLHELP=TRUE
5144         HELP_ONLINE=TRUE
5145         AC_MSG_RESULT([HTML])
5146         ;;
5147     yes)
5148         SCPDEFS="$SCPDEFS -DWITH_HELP"
5149         AC_MSG_RESULT([yes])
5150         ;;
5151     *)
5152         AC_MSG_ERROR([Unknown --with-help=$with_help])
5153         ;;
5154     esac
5155 else
5156     AC_MSG_RESULT([no])
5158 AC_SUBST([ENABLE_HTMLHELP])
5159 AC_SUBST([HELP_ONLINE])
5161 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5162 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5163     BUILD_TYPE="$BUILD_TYPE HELP"
5164     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5165     case "$with_omindex" in
5166     "server")
5167         ENABLE_HTMLHELP=TRUE
5168         HELP_ONLINE=TRUE
5169         HELP_OMINDEX_PAGE=TRUE
5170         AC_MSG_RESULT([SERVER])
5171         ;;
5172     "noxap")
5173         ENABLE_HTMLHELP=TRUE
5174         HELP_ONLINE=TRUE
5175         HELP_OMINDEX_PAGE=FALSE
5176         AC_MSG_RESULT([NOXAP])
5177         ;;
5178     *)
5179         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5180         ;;
5181     esac
5182 else
5183     HELP_OMINDEX_PAGE=FALSE
5184     AC_MSG_RESULT([no])
5186 AC_SUBST([ENABLE_HTMLHELP])
5187 AC_SUBST([HELP_OMINDEX_PAGE])
5188 AC_SUBST([HELP_ONLINE])
5191 dnl Test whether to include MySpell dictionaries
5192 dnl ===================================================================
5193 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5194 if test "$with_myspell_dicts" = "yes"; then
5195     AC_MSG_RESULT([yes])
5196     WITH_MYSPELL_DICTS=TRUE
5197     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5198     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5199 else
5200     AC_MSG_RESULT([no])
5201     WITH_MYSPELL_DICTS=
5203 AC_SUBST(WITH_MYSPELL_DICTS)
5205 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5206 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5207     if test "$with_system_dicts" = yes; then
5208         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5209     fi
5210     with_system_dicts=no
5213 AC_MSG_CHECKING([whether to use dicts from external paths])
5214 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5215     AC_MSG_RESULT([yes])
5216     SYSTEM_DICTS=TRUE
5217     AC_MSG_CHECKING([for spelling dictionary directory])
5218     if test -n "$with_external_dict_dir"; then
5219         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5220     else
5221         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5222         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5223             DICT_SYSTEM_DIR=file:///usr/share/myspell
5224         fi
5225     fi
5226     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5227     AC_MSG_CHECKING([for hyphenation patterns directory])
5228     if test -n "$with_external_hyph_dir"; then
5229         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5230     else
5231         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5232     fi
5233     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5234     AC_MSG_CHECKING([for thesaurus directory])
5235     if test -n "$with_external_thes_dir"; then
5236         THES_SYSTEM_DIR=file://$with_external_thes_dir
5237     else
5238         THES_SYSTEM_DIR=file:///usr/share/mythes
5239     fi
5240     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5241 else
5242     AC_MSG_RESULT([no])
5243     SYSTEM_DICTS=
5245 AC_SUBST(SYSTEM_DICTS)
5246 AC_SUBST(DICT_SYSTEM_DIR)
5247 AC_SUBST(HYPH_SYSTEM_DIR)
5248 AC_SUBST(THES_SYSTEM_DIR)
5250 dnl ===================================================================
5251 dnl Precompiled headers.
5252 ENABLE_PCH=""
5253 AC_MSG_CHECKING([whether to enable pch feature])
5254 if test -z "$enable_pch"; then
5255     if test "$_os" = "WINNT"; then
5256         # Enabled by default on Windows.
5257         enable_pch=yes
5258     else
5259         enable_pch=no
5260     fi
5262 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5263     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5265 if test "$enable_pch" = "system"; then
5266     ENABLE_PCH="1"
5267     AC_MSG_RESULT([yes (system headers)])
5268 elif test "$enable_pch" = "base"; then
5269     ENABLE_PCH="2"
5270     AC_MSG_RESULT([yes (system and base headers)])
5271 elif test "$enable_pch" = "normal"; then
5272     ENABLE_PCH="3"
5273     AC_MSG_RESULT([yes (normal)])
5274 elif test "$enable_pch" = "full"; then
5275     ENABLE_PCH="4"
5276     AC_MSG_RESULT([yes (full)])
5277 elif test "$enable_pch" = "yes"; then
5278     # Pick a suitable default.
5279     if test "$GCC" = "yes"; then
5280         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5281         # while making the PCHs larger and rebuilds more likely.
5282         ENABLE_PCH="2"
5283         AC_MSG_RESULT([yes (system and base headers)])
5284     else
5285         # With MSVC the highest level makes a significant difference,
5286         # and it was the default when there used to be no PCH levels.
5287         ENABLE_PCH="4"
5288         AC_MSG_RESULT([yes (full)])
5289     fi
5290 elif test "$enable_pch" = "no"; then
5291     AC_MSG_RESULT([no])
5292 else
5293     AC_MSG_ERROR([Unknown value for --enable-pch])
5295 AC_SUBST(ENABLE_PCH)
5296 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5297 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5298     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5299     if test "$CCACHE_BIN" != "not found"; then
5300         AC_MSG_CHECKING([ccache version])
5301         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5302         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5303         AC_MSG_RESULT([$CCACHE_VERSION])
5304         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5305         if test "$CCACHE_NUMVER" -gt "030701"; then
5306             AC_MSG_RESULT([yes])
5307         else
5308             AC_MSG_RESULT([no (not newer than 3.7.1)])
5309             CCACHE_DEPEND_MODE=
5310         fi
5311     fi
5314 BUILDING_PCH_WITH_OBJ=
5315 if test -n "$ENABLE_PCH"; then
5316     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5317     save_CFLAGS=$CFLAGS
5318     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5319     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5320     CFLAGS=$save_CFLAGS
5321     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5322         AC_MSG_RESULT(yes)
5323     else
5324         AC_MSG_RESULT(no)
5325     fi
5327 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5329 PCH_MODULES_CODEGEN=
5330 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5331     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-codegen])
5332     save_CFLAGS=$CFLAGS
5333     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-codegen"
5334     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_CODEGEN="-Xclang -fmodules-codegen" ],[])
5335     CFLAGS=$save_CFLAGS
5336     if test -n "$PCH_MODULES_CODEGEN"; then
5337         AC_MSG_RESULT(yes)
5338     else
5339         AC_MSG_RESULT(no)
5340     fi
5341     CFLAGS=$save_CFLAGS
5343 AC_SUBST(PCH_MODULES_CODEGEN)
5344 PCH_MODULES_DEBUGINFO=
5345 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5346     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-debuginfo])
5347     save_CFLAGS=$CFLAGS
5348     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-debuginfo"
5349     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_DEBUGINFO="-Xclang -fmodules-debuginfo" ],[])
5350     CFLAGS=$save_CFLAGS
5351     if test -n "$PCH_MODULES_DEBUGINFO"; then
5352         AC_MSG_RESULT(yes)
5353     else
5354         AC_MSG_RESULT(no)
5355     fi
5356     CFLAGS=$save_CFLAGS
5358 AC_SUBST(PCH_MODULES_DEBUGINFO)
5360 TAB=`printf '\t'`
5362 AC_MSG_CHECKING([the GNU Make version])
5363 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5364 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5365 if test "$_make_longver" -ge "038200"; then
5366     AC_MSG_RESULT([$GNUMAKE $_make_version])
5368 elif test "$_make_longver" -ge "038100"; then
5369     if test "$build_os" = "cygwin"; then
5370         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5371     fi
5372     AC_MSG_RESULT([$GNUMAKE $_make_version])
5374     dnl ===================================================================
5375     dnl Search all the common names for sha1sum
5376     dnl ===================================================================
5377     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5378     if test -z "$SHA1SUM"; then
5379         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5380     elif test "$SHA1SUM" = "openssl"; then
5381         SHA1SUM="openssl sha1"
5382     fi
5383     AC_MSG_CHECKING([for GNU Make bug 20033])
5384     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5385     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5386 A := \$(wildcard *.a)
5388 .PHONY: all
5389 all: \$(A:.a=.b)
5390 <TAB>@echo survived bug20033.
5392 .PHONY: setup
5393 setup:
5394 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5396 define d1
5397 @echo lala \$(1)
5398 @sleep 1
5399 endef
5401 define d2
5402 @echo tyty \$(1)
5403 @sleep 1
5404 endef
5406 %.b : %.a
5407 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5408 <TAB>\$(call d1,\$(CHECKSUM)),\
5409 <TAB>\$(call d2,\$(CHECKSUM)))
5411     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5412         no_parallelism_make="YES"
5413         AC_MSG_RESULT([yes, disable parallelism])
5414     else
5415         AC_MSG_RESULT([no, keep parallelism enabled])
5416     fi
5417     rm -rf $TESTGMAKEBUG20033
5418 else
5419     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5422 # find if gnumake support file function
5423 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5424 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5425 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5426     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5428 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5429 \$(file >test.txt,Success )
5431 .PHONY: all
5432 all:
5433 <TAB>@cat test.txt
5436 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5437 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5438     HAVE_GNUMAKE_FILE_FUNC=TRUE
5439     AC_MSG_RESULT([yes])
5440 else
5441     AC_MSG_RESULT([no])
5443 rm -rf $TESTGMAKEFILEFUNC
5444 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5445 AC_SUBST(GNUMAKE_WIN_NATIVE)
5447 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5448 STALE_MAKE=
5449 if test "$_make_ver_check" = ""; then
5450    STALE_MAKE=TRUE
5453 HAVE_LD_HASH_STYLE=FALSE
5454 WITH_LINKER_HASH_STYLE=
5455 AC_MSG_CHECKING([for --hash-style gcc linker support])
5456 if test "$GCC" = "yes"; then
5457     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5458         hash_styles="gnu sysv"
5459     elif test "$with_linker_hash_style" = "no"; then
5460         hash_styles=
5461     else
5462         hash_styles="$with_linker_hash_style"
5463     fi
5465     for hash_style in $hash_styles; do
5466         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5467         hash_style_ldflags_save=$LDFLAGS
5468         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5470         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5471             [
5472 #include <stdio.h>
5473             ],[
5474 printf ("");
5475             ])],
5476             [
5477                   HAVE_LD_HASH_STYLE=TRUE
5478                   WITH_LINKER_HASH_STYLE=$hash_style
5479             ],
5480             [HAVE_LD_HASH_STYLE=FALSE],
5481             [HAVE_LD_HASH_STYLE=FALSE])
5482         LDFLAGS=$hash_style_ldflags_save
5483     done
5485     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5486         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5487     else
5488         AC_MSG_RESULT( no )
5489     fi
5490     LDFLAGS=$hash_style_ldflags_save
5491 else
5492     AC_MSG_RESULT( no )
5494 AC_SUBST(HAVE_LD_HASH_STYLE)
5495 AC_SUBST(WITH_LINKER_HASH_STYLE)
5497 dnl ===================================================================
5498 dnl Check whether there's a Perl version available.
5499 dnl ===================================================================
5500 if test -z "$with_perl_home"; then
5501     AC_PATH_PROG(PERL, perl)
5502 else
5503     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5504     _perl_path="$with_perl_home/bin/perl"
5505     if test -x "$_perl_path"; then
5506         PERL=$_perl_path
5507     else
5508         AC_MSG_ERROR([$_perl_path not found])
5509     fi
5512 dnl ===================================================================
5513 dnl Testing for Perl version 5 or greater.
5514 dnl $] is the Perl version variable, it is returned as an integer
5515 dnl ===================================================================
5516 if test "$PERL"; then
5517     AC_MSG_CHECKING([the Perl version])
5518     ${PERL} -e "exit($]);"
5519     _perl_version=$?
5520     if test "$_perl_version" -lt 5; then
5521         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5522     fi
5523     AC_MSG_RESULT([Perl $_perl_version])
5524 else
5525     AC_MSG_ERROR([Perl not found, install Perl 5])
5528 dnl ===================================================================
5529 dnl Testing for required Perl modules
5530 dnl ===================================================================
5532 AC_MSG_CHECKING([for required Perl modules])
5533 perl_use_string="use Cwd ; use Digest::MD5"
5534 if test "$_os" = "WINNT"; then
5535     if test -n "$PKGFORMAT"; then
5536         for i in $PKGFORMAT; do
5537             case "$i" in
5538             msi)
5539                 # for getting fonts versions to use in MSI
5540                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5541                 ;;
5542             esac
5543         done
5544     fi
5546 if test "$with_system_hsqldb" = "yes"; then
5547     perl_use_string="$perl_use_string ; use Archive::Zip"
5549 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5550     AC_MSG_RESULT([all modules found])
5551 else
5552     AC_MSG_RESULT([failed to find some modules])
5553     # Find out which modules are missing.
5554     for i in $perl_use_string; do
5555         if test "$i" != "use" -a "$i" != ";"; then
5556             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5557                 missing_perl_modules="$missing_perl_modules $i"
5558             fi
5559         fi
5560     done
5561     AC_MSG_ERROR([
5562     The missing Perl modules are: $missing_perl_modules
5563     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5566 dnl ===================================================================
5567 dnl Check for pkg-config
5568 dnl ===================================================================
5569 if test "$_os" != "WINNT"; then
5570     PKG_PROG_PKG_CONFIG
5573 if test "$_os" != "WINNT"; then
5575     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5576     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5577     # explicitly. Or put /path/to/compiler in PATH yourself.
5579     # Use wrappers for LTO
5580     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5581         AC_CHECK_TOOL(AR,gcc-ar)
5582         AC_CHECK_TOOL(NM,gcc-nm)
5583         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5584     else
5585         AC_CHECK_TOOL(AR,ar)
5586         AC_CHECK_TOOL(NM,nm)
5587         AC_CHECK_TOOL(RANLIB,ranlib)
5588     fi
5589     AC_CHECK_TOOL(OBJDUMP,objdump)
5590     AC_CHECK_TOOL(READELF,readelf)
5591     AC_CHECK_TOOL(STRIP,strip)
5592     if test "$_os" = "WINNT"; then
5593         AC_CHECK_TOOL(DLLTOOL,dlltool)
5594         AC_CHECK_TOOL(WINDRES,windres)
5595     fi
5597 AC_SUBST(AR)
5598 AC_SUBST(DLLTOOL)
5599 AC_SUBST(NM)
5600 AC_SUBST(OBJDUMP)
5601 AC_SUBST(PKG_CONFIG)
5602 AC_SUBST(RANLIB)
5603 AC_SUBST(READELF)
5604 AC_SUBST(STRIP)
5605 AC_SUBST(WINDRES)
5607 dnl ===================================================================
5608 dnl pkg-config checks on macOS
5609 dnl ===================================================================
5611 if test $_os = Darwin; then
5612     AC_MSG_CHECKING([for bogus pkg-config])
5613     if test -n "$PKG_CONFIG"; then
5614         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5615             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5616         else
5617             if test "$enable_bogus_pkg_config" = "yes"; then
5618                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5619             else
5620                 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.])
5621             fi
5622         fi
5623     else
5624         AC_MSG_RESULT([no, good])
5625     fi
5628 find_csc()
5630     # Return value: $csctest
5632     unset csctest
5634     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5635     if test -n "$regvalue"; then
5636         csctest=$regvalue
5637         return
5638     fi
5641 find_al()
5643     # Return value: $altest
5645     unset altest
5647     # We need this check to detect 4.6.1 or above.
5648     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5649         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5650         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5651             altest=$regvalue
5652             return
5653         fi
5654     done
5656     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5657         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/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
5667 find_dotnetsdk46()
5669     unset frametest
5671     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5672         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5673         if test -n "$regvalue"; then
5674             frametest=$regvalue
5675             return
5676         fi
5677     done
5680 find_winsdk_version()
5682     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5683     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5685     unset winsdktest winsdkbinsubdir winsdklibsubdir
5687     case "$1" in
5688     8.0|8.0A)
5689         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5690         if test -n "$regvalue"; then
5691             winsdktest=$regvalue
5692             winsdklibsubdir=win8
5693             return
5694         fi
5695         ;;
5696     8.1|8.1A)
5697         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5698         if test -n "$regvalue"; then
5699             winsdktest=$regvalue
5700             winsdklibsubdir=winv6.3
5701             return
5702         fi
5703         ;;
5704     10.0)
5705         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5706         if test -n "$regvalue"; then
5707             winsdktest=$regvalue
5708             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5709             if test -n "$regvalue"; then
5710                 winsdkbinsubdir="$regvalue".0
5711                 winsdklibsubdir=$winsdkbinsubdir
5712                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5713                 # test exist the SDK path
5714                 if test -d "$tmppath"; then
5715                    # when path is convertible to a short path then path is okay
5716                    cygpath -d "$tmppath" >/dev/null 2>&1
5717                    if test $? -ne 0; then
5718                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5719                    fi
5720                 else
5721                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5722                 fi
5723             fi
5724             return
5725         fi
5726         ;;
5727     esac
5730 find_winsdk()
5732     # Return value: From find_winsdk_version
5734     unset winsdktest
5736     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5737         find_winsdk_version $ver
5738         if test -n "$winsdktest"; then
5739             return
5740         fi
5741     done
5744 find_msms()
5746     AC_MSG_CHECKING([for MSVC merge modules directory])
5747     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5748     case "$VCVER" in
5749         160)
5750         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5751         ;;
5752     esac
5753     for f in $my_msm_files; do
5754         echo "$as_me:$LINENO: searching for $f" >&5
5755     done
5757     msmdir=
5758     for ver in 14.0 15.0; do
5759         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5760         if test -n "$regvalue"; then
5761             for f in ${my_msm_files}; do
5762                 if test -e "$regvalue/${f}"; then
5763                     msmdir=$regvalue
5764                     break
5765                 fi
5766             done
5767         fi
5768     done
5769     dnl Is the following fallback really necessary, or was it added in response
5770     dnl to never having started Visual Studio on a given machine, so the
5771     dnl registry keys checked above had presumably not yet been created?
5772     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5773     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5774     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5775     dnl expanding to "C:\Program Files\Common Files"), which would need
5776     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5777     dnl obtain its value from cygwin:
5778     if test -z "$msmdir"; then
5779         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5780         for f in ${my_msm_files}; do
5781             if test -e "$my_msm_dir/${f}"; then
5782                 msmdir=$my_msm_dir
5783             fi
5784         done
5785     fi
5787     dnl Starting from MSVC 15.0, merge modules are located in different directory
5788     case "$VCVER" in
5789     160)
5790         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5791             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5792             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5793             for f in ${my_msm_files}; do
5794                 if test -e "$my_msm_dir/${f}"; then
5795                     msmdir=$my_msm_dir
5796                     break
5797                 fi
5798             done
5799         done
5800         ;;
5801     esac
5803     if test -n "$msmdir"; then
5804         msmdir=`cygpath -m "$msmdir"`
5805         AC_MSG_RESULT([$msmdir])
5806     else
5807         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5808             AC_MSG_FAILURE([not found])
5809         else
5810             AC_MSG_WARN([not found (check config.log)])
5811             add_warning "MSM none of ${my_msm_files} found"
5812         fi
5813     fi
5816 find_msvc_x64_dlls()
5818     AC_MSG_CHECKING([for MSVC x64 DLL path])
5819     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5820     case "$VCVER" in
5821     160)
5822         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5823             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5824             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5825                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5826                 break
5827             fi
5828             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5829             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5830                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5831                 break
5832             fi
5833         done
5834         ;;
5835     esac
5836     AC_MSG_RESULT([$msvcdllpath])
5837     AC_MSG_CHECKING([for MSVC x64 DLLs])
5838     msvcdlls="msvcp140.dll vcruntime140.dll"
5839     for dll in $msvcdlls; do
5840         if ! test -f "$msvcdllpath/$dll"; then
5841             AC_MSG_FAILURE([missing $dll])
5842         fi
5843     done
5844     AC_MSG_RESULT([found all ($msvcdlls)])
5847 dnl =========================================
5848 dnl Check for the Windows  SDK.
5849 dnl =========================================
5850 if test "$_os" = "WINNT"; then
5851     AC_MSG_CHECKING([for Windows SDK])
5852     if test "$build_os" = "cygwin"; then
5853         find_winsdk
5854         WINDOWS_SDK_HOME=$winsdktest
5856         # normalize if found
5857         if test -n "$WINDOWS_SDK_HOME"; then
5858             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5859             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5860         fi
5862         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5863     fi
5865     if test -n "$WINDOWS_SDK_HOME"; then
5866         # Remove a possible trailing backslash
5867         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5869         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5870              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5871              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5872             have_windows_sdk_headers=yes
5873         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5874              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5875              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5876             have_windows_sdk_headers=yes
5877         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5878              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5879              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5880             have_windows_sdk_headers=yes
5881         else
5882             have_windows_sdk_headers=no
5883         fi
5885         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5886             have_windows_sdk_libs=yes
5887         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5888             have_windows_sdk_libs=yes
5889         else
5890             have_windows_sdk_libs=no
5891         fi
5893         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5894             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5895 the  Windows SDK are installed.])
5896         fi
5897     fi
5899     if test -z "$WINDOWS_SDK_HOME"; then
5900         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5901     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5902         WINDOWS_SDK_VERSION=80
5903         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5904     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5905         WINDOWS_SDK_VERSION=81
5906         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5907     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5908         WINDOWS_SDK_VERSION=10
5909         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5910     else
5911         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5912     fi
5913     PathFormat "$WINDOWS_SDK_HOME"
5914     WINDOWS_SDK_HOME="$formatted_path"
5915     if test "$build_os" = "cygwin"; then
5916         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5917         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5918             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5919         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5920             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5921         fi
5922     fi
5924     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5925     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5926     dnl but not in v8.0), so allow this to be overridden with a
5927     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5928     dnl and configuration error if no WiLangId.vbs is found would arguably be
5929     dnl better, but I do not know under which conditions exactly it is needed by
5930     dnl msiglobal.pm:
5931     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5932         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5933         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5934             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5935         fi
5936         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5937             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5938         fi
5939         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5940             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5941         fi
5942     fi
5943     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5944         if test -n "$with_package_format" -a "$with_package_format" != no; then
5945             for i in "$with_package_format"; do
5946                 if test "$i" = "msi"; then
5947                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5948                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5949                     fi
5950                 fi
5951             done
5952         fi
5953     fi
5955 AC_SUBST(WINDOWS_SDK_HOME)
5956 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5957 AC_SUBST(WINDOWS_SDK_VERSION)
5958 AC_SUBST(WINDOWS_SDK_WILANGID)
5960 if test "$build_os" = "cygwin"; then
5961     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5962     dnl dir, it also determines that dir's path w/o an arch segment if any,
5963     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5964     AC_MSG_CHECKING([for midl.exe])
5966     find_winsdk
5967     if test -n "$winsdkbinsubdir" \
5968         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5969     then
5970         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5971         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5972     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5973         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5974         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5975     elif test -f "$winsdktest/Bin/midl.exe"; then
5976         MIDL_PATH=$winsdktest/Bin
5977         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5978     fi
5979     if test ! -f "$MIDL_PATH/midl.exe"; then
5980         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5981     else
5982         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5983     fi
5985     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5986     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5988     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5989          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5990          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5991          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5992     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5993          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5994          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5995          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5996     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5997          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5998          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5999          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6000     else
6001         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6002     fi
6004     dnl Check csc.exe
6005     AC_MSG_CHECKING([for csc.exe])
6006     find_csc
6007     if test -f "$csctest/csc.exe"; then
6008         CSC_PATH="$csctest"
6009     fi
6010     if test ! -f "$CSC_PATH/csc.exe"; then
6011         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6012     else
6013         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6014     fi
6016     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6018     dnl Check al.exe
6019     AC_MSG_CHECKING([for al.exe])
6020     find_winsdk
6021     if test -n "$winsdkbinsubdir" \
6022         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
6023     then
6024         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
6025     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
6026         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
6027     elif test -f "$winsdktest/Bin/al.exe"; then
6028         AL_PATH="$winsdktest/Bin"
6029     fi
6031     if test -z "$AL_PATH"; then
6032         find_al
6033         if test -f "$altest/bin/al.exe"; then
6034             AL_PATH="$altest/bin"
6035         elif test -f "$altest/al.exe"; then
6036             AL_PATH="$altest"
6037         fi
6038     fi
6039     if test ! -f "$AL_PATH/al.exe"; then
6040         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6041     else
6042         AC_MSG_RESULT([$AL_PATH/al.exe])
6043     fi
6045     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6047     dnl Check mscoree.lib / .NET Framework dir
6048     AC_MSG_CHECKING(.NET Framework)
6049     find_dotnetsdk46
6050     PathFormat "$frametest"
6051     frametest="$formatted_path"
6052     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6053         DOTNET_FRAMEWORK_HOME="$frametest"
6054     else
6055         find_winsdk
6056         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6057             DOTNET_FRAMEWORK_HOME="$winsdktest"
6058         fi
6059     fi
6060     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
6061         AC_MSG_ERROR([mscoree.lib not found])
6062     fi
6063     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6065     PathFormat "$MIDL_PATH"
6066     MIDL_PATH="$formatted_path"
6068     PathFormat "$AL_PATH"
6069     AL_PATH="$formatted_path"
6071     PathFormat "$DOTNET_FRAMEWORK_HOME"
6072     DOTNET_FRAMEWORK_HOME="$formatted_path"
6074     PathFormat "$CSC_PATH"
6075     CSC_PATH="$formatted_path"
6078 dnl ===================================================================
6079 dnl Check if stdc headers are available excluding MSVC.
6080 dnl ===================================================================
6081 if test "$_os" != "WINNT"; then
6082     AC_HEADER_STDC
6085 dnl ===================================================================
6086 dnl Testing for C++ compiler and version...
6087 dnl ===================================================================
6089 if test "$_os" != "WINNT"; then
6090     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6091     save_CXXFLAGS=$CXXFLAGS
6092     AC_PROG_CXX
6093     CXXFLAGS=$save_CXXFLAGS
6094     if test -z "$CXX_BASE"; then
6095         CXX_BASE=`first_arg_basename "$CXX"`
6096     fi
6099 dnl check for GNU C++ compiler version
6100 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6101     AC_MSG_CHECKING([the GNU C++ compiler version])
6103     _gpp_version=`$CXX -dumpversion`
6104     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6106     if test "$_gpp_majmin" -lt "700"; then
6107         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6108     else
6109         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6110     fi
6112     dnl see https://code.google.com/p/android/issues/detail?id=41770
6113         glibcxx_threads=no
6114         AC_LANG_PUSH([C++])
6115         AC_REQUIRE_CPP
6116         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6117         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6118             #include <bits/c++config.h>]],[[
6119             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6120             && !defined(_GLIBCXX__PTHREADS) \
6121             && !defined(_GLIBCXX_HAS_GTHREADS)
6122             choke me
6123             #endif
6124         ]])],[AC_MSG_RESULT([yes])
6125         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6126         AC_LANG_POP([C++])
6127         if test $glibcxx_threads = yes; then
6128             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6129         fi
6131 AC_SUBST(BOOST_CXXFLAGS)
6134 # prefx CXX with ccache if needed
6136 if test "$CCACHE" != ""; then
6137     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6138     AC_LANG_PUSH([C++])
6139     save_CXXFLAGS=$CXXFLAGS
6140     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6141     dnl an empty program will do, we're checking the compiler flags
6142     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6143                       [use_ccache=yes], [use_ccache=no])
6144     if test $use_ccache = yes; then
6145         AC_MSG_RESULT([yes])
6146     else
6147         CXX="$CCACHE $CXX"
6148         CXX_BASE="ccache $CXX_BASE"
6149         AC_MSG_RESULT([no])
6150     fi
6151     CXXFLAGS=$save_CXXFLAGS
6152     AC_LANG_POP([C++])
6155 dnl ===================================================================
6156 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6157 dnl ===================================================================
6159 if test "$_os" != "WINNT"; then
6160     AC_PROG_CXXCPP
6162     dnl Check whether there's a C pre-processor.
6163     AC_PROG_CPP
6167 dnl ===================================================================
6168 dnl Find integral type sizes and alignments
6169 dnl ===================================================================
6171 if test "$_os" != "WINNT"; then
6173 if test "$_os" = "iOS"; then
6174     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6175     ac_cv_sizeof_long=8
6176     ac_cv_sizeof_short=2
6177     ac_cv_sizeof_int=4
6178     ac_cv_sizeof_long_long=8
6179     ac_cv_sizeof_double=8
6180     ac_cv_sizeof_voidp=8
6181 else
6182     AC_CHECK_SIZEOF(long)
6183     AC_CHECK_SIZEOF(short)
6184     AC_CHECK_SIZEOF(int)
6185     AC_CHECK_SIZEOF(long long)
6186     AC_CHECK_SIZEOF(double)
6187     AC_CHECK_SIZEOF(void*)
6190     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6191     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6192     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6193     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6194     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6196     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6197     m4_pattern_allow([AC_CHECK_ALIGNOF])
6198     m4_ifdef([AC_CHECK_ALIGNOF],
6199         [
6200             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6201             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6202             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6203             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6204         ],
6205         [
6206             case "$_os-$host_cpu" in
6207             Linux-i686)
6208                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6209                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6210                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6211                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6212                 ;;
6213             Linux-x86_64)
6214                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6215                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6216                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6217                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6218                 ;;
6219             *)
6220                 if test -z "$ac_cv_alignof_short" -o \
6221                         -z "$ac_cv_alignof_int" -o \
6222                         -z "$ac_cv_alignof_long" -o \
6223                         -z "$ac_cv_alignof_double"; then
6224                    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.])
6225                 fi
6226                 ;;
6227             esac
6228         ])
6230     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6231     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6232     if test $ac_cv_sizeof_long -eq 8; then
6233         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6234     elif test $ac_cv_sizeof_double -eq 8; then
6235         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6236     else
6237         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6238     fi
6240     dnl Check for large file support
6241     AC_SYS_LARGEFILE
6242     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6243         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6244     fi
6245     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6246         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6247     fi
6248 else
6249     # Hardcode for MSVC
6250     SAL_TYPES_SIZEOFSHORT=2
6251     SAL_TYPES_SIZEOFINT=4
6252     SAL_TYPES_SIZEOFLONG=4
6253     SAL_TYPES_SIZEOFLONGLONG=8
6254     if test "$BITNESS_OVERRIDE" = ""; then
6255         SAL_TYPES_SIZEOFPOINTER=4
6256     else
6257         SAL_TYPES_SIZEOFPOINTER=8
6258     fi
6259     SAL_TYPES_ALIGNMENT2=2
6260     SAL_TYPES_ALIGNMENT4=4
6261     SAL_TYPES_ALIGNMENT8=8
6262     LFS_CFLAGS=''
6264 AC_SUBST(LFS_CFLAGS)
6266 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6267 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6268 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6269 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6270 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6271 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6272 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6273 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6275 dnl ===================================================================
6276 dnl Check whether to enable runtime optimizations
6277 dnl ===================================================================
6278 ENABLE_RUNTIME_OPTIMIZATIONS=
6279 AC_MSG_CHECKING([whether to enable runtime optimizations])
6280 if test -z "$enable_runtime_optimizations"; then
6281     for i in $CC; do
6282         case $i in
6283         -fsanitize=*)
6284             enable_runtime_optimizations=no
6285             break
6286             ;;
6287         esac
6288     done
6290 if test "$enable_runtime_optimizations" != no; then
6291     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6292     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6293     AC_MSG_RESULT([yes])
6294 else
6295     AC_MSG_RESULT([no])
6297 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6299 dnl ===================================================================
6300 dnl Check if valgrind headers are available
6301 dnl ===================================================================
6302 ENABLE_VALGRIND=
6303 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6304     prev_cppflags=$CPPFLAGS
6305     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6306     # or where does it come from?
6307     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6308     AC_CHECK_HEADER([valgrind/valgrind.h],
6309         [ENABLE_VALGRIND=TRUE])
6310     CPPFLAGS=$prev_cppflags
6312 AC_SUBST([ENABLE_VALGRIND])
6313 if test -z "$ENABLE_VALGRIND"; then
6314     if test "$with_valgrind" = yes; then
6315         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6316     fi
6317     VALGRIND_CFLAGS=
6319 AC_SUBST([VALGRIND_CFLAGS])
6322 dnl ===================================================================
6323 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6324 dnl ===================================================================
6326 # We need at least the sys/sdt.h include header.
6327 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6328 if test "$SDT_H_FOUND" = "TRUE"; then
6329     # Found sys/sdt.h header, now make sure the c++ compiler works.
6330     # Old g++ versions had problems with probes in constructors/destructors.
6331     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6332     AC_LANG_PUSH([C++])
6333     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6334     #include <sys/sdt.h>
6335     class ProbeClass
6336     {
6337     private:
6338       int& ref;
6339       const char *name;
6341     public:
6342       ProbeClass(int& v, const char *n) : ref(v), name(n)
6343       {
6344         DTRACE_PROBE2(_test_, cons, name, ref);
6345       }
6347       void method(int min)
6348       {
6349         DTRACE_PROBE3(_test_, meth, name, ref, min);
6350         ref -= min;
6351       }
6353       ~ProbeClass()
6354       {
6355         DTRACE_PROBE2(_test_, dest, name, ref);
6356       }
6357     };
6358     ]],[[
6359     int i = 64;
6360     DTRACE_PROBE1(_test_, call, i);
6361     ProbeClass inst = ProbeClass(i, "call");
6362     inst.method(24);
6363     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6364           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6365     AC_LANG_POP([C++])
6367 AC_CONFIG_HEADERS([config_host/config_probes.h])
6369 dnl ===================================================================
6370 dnl GCC features
6371 dnl ===================================================================
6372 HAVE_GCC_STACK_CLASH_PROTECTION=
6373 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6374     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6375     save_CFLAGS=$CFLAGS
6376     CFLAGS="$CFLAGS -fstack-clash-protection"
6377     AC_LINK_IFELSE(
6378         [AC_LANG_PROGRAM(, [[return 0;]])],
6379         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6380         [AC_MSG_RESULT([no])])
6381     CFLAGS=$save_CFLAGS
6383     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6384     save_CFLAGS=$CFLAGS
6385     CFLAGS="$CFLAGS -Werror -mno-avx"
6386     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6387     CFLAGS=$save_CFLAGS
6388     if test "$HAVE_GCC_AVX" = "TRUE"; then
6389         AC_MSG_RESULT([yes])
6390     else
6391         AC_MSG_RESULT([no])
6392     fi
6394     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6395     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6396     int v = 0;
6397     if (__sync_add_and_fetch(&v, 1) != 1 ||
6398         __sync_sub_and_fetch(&v, 1) != 0)
6399         return 1;
6400     __sync_synchronize();
6401     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6402         v != 1)
6403         return 1;
6404     return 0;
6405 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6406     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6407         AC_MSG_RESULT([yes])
6408         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6409     else
6410         AC_MSG_RESULT([no])
6411     fi
6413     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6414     AC_LANG_PUSH([C++])
6415     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6416             #include <cstddef>
6417             #include <cxxabi.h>
6418             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6419         ])], [
6420             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6421             AC_MSG_RESULT([yes])
6422         ], [AC_MSG_RESULT([no])])
6423     AC_LANG_POP([C++])
6425     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6426     AC_LANG_PUSH([C++])
6427     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6428             #include <cstddef>
6429             #include <cxxabi.h>
6430             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6431         ])], [
6432             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6433             AC_MSG_RESULT([yes])
6434         ], [AC_MSG_RESULT([no])])
6435     AC_LANG_POP([C++])
6437     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6438     AC_LANG_PUSH([C++])
6439     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6440             #include <cxxabi.h>
6441             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6442         ])], [
6443             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6444             AC_MSG_RESULT([yes])
6445         ], [AC_MSG_RESULT([no])])
6446     AC_LANG_POP([C++])
6448     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6449     AC_LANG_PUSH([C++])
6450     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6451             #include <cstddef>
6452             #include <cxxabi.h>
6453             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6454         ])], [
6455             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6456             AC_MSG_RESULT([yes])
6457         ], [AC_MSG_RESULT([no])])
6458     AC_LANG_POP([C++])
6460     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6461     AC_LANG_PUSH([C++])
6462     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6463             #include <cstddef>
6464             #include <cxxabi.h>
6465             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6466         ])], [
6467             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6468             AC_MSG_RESULT([yes])
6469         ], [AC_MSG_RESULT([no])])
6470     AC_LANG_POP([C++])
6472     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6473     AC_LANG_PUSH([C++])
6474     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6475             #include <cxxabi.h>
6476             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6477         ])], [
6478             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6479             AC_MSG_RESULT([yes])
6480         ], [AC_MSG_RESULT([no])])
6481     AC_LANG_POP([C++])
6483     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6484     AC_LANG_PUSH([C++])
6485     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6486             #include <cxxabi.h>
6487             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6488         ])], [
6489             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6490             AC_MSG_RESULT([yes])
6491         ], [AC_MSG_RESULT([no])])
6492     AC_LANG_POP([C++])
6494     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6495     AC_LANG_PUSH([C++])
6496     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6497             #include <cxxabi.h>
6498             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6499         ])], [
6500             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6501             AC_MSG_RESULT([yes])
6502         ], [AC_MSG_RESULT([no])])
6503     AC_LANG_POP([C++])
6505     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6506     AC_LANG_PUSH([C++])
6507     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6508             #include <cstddef>
6509             #include <cxxabi.h>
6510             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6511         ])], [
6512             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6513             AC_MSG_RESULT([yes])
6514         ], [AC_MSG_RESULT([no])])
6515     AC_LANG_POP([C++])
6517     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6518     AC_LANG_PUSH([C++])
6519     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6520             #include <cstddef>
6521             #include <cxxabi.h>
6522             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6523         ])], [
6524             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6525             AC_MSG_RESULT([yes])
6526         ], [AC_MSG_RESULT([no])])
6527     AC_LANG_POP([C++])
6530 AC_SUBST(HAVE_GCC_AVX)
6531 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6532 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6534 dnl ===================================================================
6535 dnl Identify the C++ library
6536 dnl ===================================================================
6538 AC_MSG_CHECKING([what the C++ library is])
6539 AC_LANG_PUSH([C++])
6540 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6541 #include <utility>
6542 #ifndef __GLIBCXX__
6543 foo bar
6544 #endif
6545 ]])],
6546     [CPP_LIBRARY=GLIBCXX
6547      cpp_library_name="GNU libstdc++"
6548     ],
6549     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6550 #include <utility>
6551 #ifndef _LIBCPP_VERSION
6552 foo bar
6553 #endif
6554 ]])],
6555     [CPP_LIBRARY=LIBCPP
6556      cpp_library_name="LLVM libc++"
6557      AC_DEFINE([HAVE_LIBCXX])
6558     ],
6559     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6560 #include <utility>
6561 #ifndef _MSC_VER
6562 foo bar
6563 #endif
6564 ]])],
6565     [CPP_LIBRARY=MSVCRT
6566      cpp_library_name="Microsoft"
6567     ],
6568     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6569 AC_MSG_RESULT([$cpp_library_name])
6570 AC_LANG_POP([C++])
6572 dnl ===================================================================
6573 dnl Check for gperf
6574 dnl ===================================================================
6575 AC_PATH_PROG(GPERF, gperf)
6576 if test -z "$GPERF"; then
6577     AC_MSG_ERROR([gperf not found but needed. Install it.])
6579 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6580     GPERF=`cygpath -m $GPERF`
6582 AC_MSG_CHECKING([whether gperf is new enough])
6583 my_gperf_ver1=$($GPERF --version | head -n 1)
6584 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6585 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6586 if test "$my_gperf_ver3" -ge 301; then
6587     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6588 else
6589     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6591 AC_SUBST(GPERF)
6593 dnl ===================================================================
6594 dnl Check for system libcmis
6595 dnl ===================================================================
6596 # libcmis requires curl and we can't build curl for iOS
6597 if test $_os != iOS; then
6598     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6599     ENABLE_LIBCMIS=TRUE
6600 else
6601     ENABLE_LIBCMIS=
6603 AC_SUBST(ENABLE_LIBCMIS)
6605 dnl ===================================================================
6606 dnl C++11
6607 dnl ===================================================================
6609 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6610 CXXFLAGS_CXX11=
6611 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6612     if test "$with_latest_c__" = yes; then
6613         CXXFLAGS_CXX11=-std:c++latest
6614     else
6615         CXXFLAGS_CXX11=-std:c++17
6616     fi
6617     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6618 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6619     my_flags='-std=c++17 -std=c++1z'
6620     if test "$with_latest_c__" = yes; then
6621         my_flags="-std=c++20 -std=c++2a $my_flags"
6622     fi
6623     for flag in $my_flags; do
6624         if test "$COM" = MSC; then
6625             flag="-Xclang $flag"
6626         fi
6627         save_CXXFLAGS=$CXXFLAGS
6628         CXXFLAGS="$CXXFLAGS $flag -Werror"
6629         if test "$SYSTEM_LIBCMIS" = TRUE; then
6630             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6631         fi
6632         AC_LANG_PUSH([C++])
6633         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6634             #include <algorithm>
6635             #include <functional>
6636             #include <vector>
6638             #if defined SYSTEM_LIBCMIS
6639             // See ucb/source/ucp/cmis/auth_provider.hxx:
6640             #if !defined __clang__
6641             #pragma GCC diagnostic push
6642             #pragma GCC diagnostic ignored "-Wdeprecated"
6643             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6644             #endif
6645             #include <libcmis/libcmis.hxx>
6646             #if !defined __clang__
6647             #pragma GCC diagnostic pop
6648             #endif
6649             #endif
6651             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6652                 std::sort(v.begin(), v.end(), fn);
6653             }
6654             ]])],[CXXFLAGS_CXX11=$flag])
6655         AC_LANG_POP([C++])
6656         CXXFLAGS=$save_CXXFLAGS
6657         if test -n "$CXXFLAGS_CXX11"; then
6658             break
6659         fi
6660     done
6662 if test -n "$CXXFLAGS_CXX11"; then
6663     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6664 else
6665     AC_MSG_ERROR(no)
6667 AC_SUBST(CXXFLAGS_CXX11)
6669 if test "$GCC" = "yes"; then
6670     save_CXXFLAGS=$CXXFLAGS
6671     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6672     CHECK_L_ATOMIC
6673     CXXFLAGS=$save_CXXFLAGS
6674     AC_SUBST(ATOMIC_LIB)
6677 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6678 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6679 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6680 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6681 dnl again towards 4.7.2:
6682 if test $CPP_LIBRARY = GLIBCXX; then
6683     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6684     AC_LANG_PUSH([C++])
6685     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6686 #include <list>
6687 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6688     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6689     //   GCC 4.7.0: 20120322
6690     //   GCC 4.7.1: 20120614
6691     // and using a range check is not possible as the mapping between
6692     // __GLIBCXX__ values and GCC versions is not monotonic
6693 /* ok */
6694 #else
6695 abi broken
6696 #endif
6697         ]])], [AC_MSG_RESULT(no, ok)],
6698         [AC_MSG_ERROR(yes)])
6699     AC_LANG_POP([C++])
6702 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6703 save_CXXFLAGS=$CXXFLAGS
6704 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6705 AC_LANG_PUSH([C++])
6707 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6708 #include <stddef.h>
6710 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6712 namespace
6714         struct b
6715         {
6716                 int i;
6717                 int j;
6718         };
6720 ]], [[
6721 struct a
6723         int i;
6724         int j;
6726 a thinga[]={{0,0}, {1,1}};
6727 b thingb[]={{0,0}, {1,1}};
6728 size_t i = sizeof(sal_n_array_size(thinga));
6729 size_t j = sizeof(sal_n_array_size(thingb));
6730 return !(i != 0 && j != 0);
6732     ], [ AC_MSG_RESULT(yes) ],
6733     [ AC_MSG_ERROR(no)])
6734 AC_LANG_POP([C++])
6735 CXXFLAGS=$save_CXXFLAGS
6737 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6738 if test "$GCC" = yes; then
6739     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6740     AC_LANG_PUSH([C++])
6741     save_CXXFLAGS=$CXXFLAGS
6742     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6743     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6744     CXXFLAGS=$save_CXXFLAGS
6745     AC_LANG_POP([C++])
6746     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6747         AC_MSG_RESULT([yes])
6748     else
6749         AC_MSG_RESULT([no])
6750     fi
6752 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6754 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6755 AC_LANG_PUSH([C++])
6756 save_CXXFLAGS=$CXXFLAGS
6757 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6758 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6759         #include <algorithm>
6760         #include <initializer_list>
6761         #include <vector>
6762         template<typename T> class S {
6763         private:
6764             std::vector<T> v_;
6765         public:
6766             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6767         };
6768         constinit S<int> s{3, 2, 1};
6769     ])], [
6770         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6771         AC_MSG_RESULT([yes])
6772     ], [AC_MSG_RESULT([no])])
6773 CXXFLAGS=$save_CXXFLAGS
6774 AC_LANG_POP([C++])
6776 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6777 AC_LANG_PUSH([C++])
6778 save_CXXFLAGS=$CXXFLAGS
6779 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6780 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6781         #include <span>
6782         #include <type_traits>
6783         // Don't check size_type directly, as it was called index_type before P1872R0:
6784         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6785     ])], [
6786         AC_DEFINE([HAVE_CPP_SPAN],[1])
6787         AC_MSG_RESULT([yes])
6788     ], [AC_MSG_RESULT([no])])
6789 CXXFLAGS=$save_CXXFLAGS
6790 AC_LANG_POP([C++])
6792 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
6793 AC_LANG_PUSH([C++])
6794 save_CXXFLAGS=$CXXFLAGS
6795 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6796 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6797         struct S1 { S1(S1 &&); };
6798         struct S2: S1 {};
6799         S1 f(S2 s) { return s; }
6800     ])], [
6801         AC_DEFINE([HAVE_P1155R3],[1])
6802         AC_MSG_RESULT([yes])
6803     ], [AC_MSG_RESULT([no])])
6804 CXXFLAGS=$save_CXXFLAGS
6805 AC_LANG_POP([C++])
6807 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
6808 dnl which is included in -Wextra anyway):
6809 HAVE_WDEPRECATED_COPY_DTOR=
6810 if test "$GCC" = yes; then
6811     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
6812     AC_LANG_PUSH([C++])
6813     save_CXXFLAGS=$CXXFLAGS
6814     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
6815     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
6816             HAVE_WDEPRECATED_COPY_DTOR=TRUE
6817             AC_MSG_RESULT([yes])
6818         ], [AC_MSG_RESULT([no])])
6819     CXXFLAGS=$save_CXXFLAGS
6820     AC_LANG_POP([C++])
6822 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
6824 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6825 dnl uninitialized warning for code like
6827 dnl   OString f();
6828 dnl   boost::optional<OString> * g(bool b) {
6829 dnl       boost::optional<OString> o;
6830 dnl       if (b) o = f();
6831 dnl       return new boost::optional<OString>(o);
6832 dnl   }
6834 dnl (as is e.g. present, in a slightly more elaborate form, in
6835 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6836 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6837 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6838 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6839     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6840     AC_LANG_PUSH([C++])
6841     save_CXXFLAGS=$CXXFLAGS
6842     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6843     if test "$ENABLE_OPTIMIZED" = TRUE; then
6844         CXXFLAGS="$CXXFLAGS -O2"
6845     else
6846         CXXFLAGS="$CXXFLAGS -O0"
6847     fi
6848     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6849             #include <new>
6850             void f1(int);
6851             struct S1 {
6852                 ~S1() { f1(n); }
6853                 int n = 0;
6854             };
6855             struct S2 {
6856                 S2() {}
6857                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6858                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6859                 void set(S1 s) {
6860                     new (stg) S1(s);
6861                     init = true;
6862                 }
6863                 bool init = false;
6864                 char stg[sizeof (S1)];
6865             } ;
6866             S1 f2();
6867             S2 * f3(bool b) {
6868                 S2 o;
6869                 if (b) o.set(f2());
6870                 return new S2(o);
6871             }
6872         ]])], [AC_MSG_RESULT([no])], [
6873             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6874             AC_MSG_RESULT([yes])
6875         ])
6876     CXXFLAGS=$save_CXXFLAGS
6877     AC_LANG_POP([C++])
6879 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6881 dnl ===================================================================
6882 dnl CPU Intrinsics support - SSE, AVX
6883 dnl ===================================================================
6885 CXXFLAGS_INTRINSICS_SSE2=
6886 CXXFLAGS_INTRINSICS_SSSE3=
6887 CXXFLAGS_INTRINSICS_SSE41=
6888 CXXFLAGS_INTRINSICS_SSE42=
6889 CXXFLAGS_INTRINSICS_AVX=
6890 CXXFLAGS_INTRINSICS_AVX2=
6891 CXXFLAGS_INTRINSICS_AVX512=
6892 CXXFLAGS_INTRINSICS_F16C=
6893 CXXFLAGS_INTRINSICS_FMA=
6895 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6896     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
6897     flag_sse2=-msse2
6898     flag_ssse3=-mssse3
6899     flag_sse41=-msse4.1
6900     flag_sse42=-msse4.2
6901     flag_avx=-mavx
6902     flag_avx2=-mavx2
6903     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
6904     flag_f16c=-mf16c
6905     flag_fma=-mfma
6906 else
6907     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
6908     # MSVC seems to differentiate only between SSE and SSE2, where in fact
6909     # SSE2 seems to be SSE2+.
6910     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
6911     # is not empty (and can be tested in gbuild).
6912     flag_sse2=-arch:SSE2
6913     flag_ssse3=-arch:SSE2
6914     flag_sse41=-arch:SSE2
6915     flag_sse42=-arch:SSE2
6916     flag_avx=-arch:AVX
6917     flag_avx2=-arch:AVX2
6918     flag_avx512=-arch:AVX512
6919     # These are part of -arch:AVX2
6920     flag_f16c=-arch:AVX2
6921     flag_fma=-arch:AVX2
6924 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6925 AC_LANG_PUSH([C++])
6926 save_CXXFLAGS=$CXXFLAGS
6927 CXXFLAGS="$CXXFLAGS $flag_sse2"
6928 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6929     #include <emmintrin.h>
6930     int main () {
6931         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6932         c = _mm_xor_si128 (a, b);
6933         return 0;
6934     }
6935     ])],
6936     [can_compile_sse2=yes],
6937     [can_compile_sse2=no])
6938 AC_LANG_POP([C++])
6939 CXXFLAGS=$save_CXXFLAGS
6940 AC_MSG_RESULT([${can_compile_sse2}])
6941 if test "${can_compile_sse2}" = "yes" ; then
6942     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
6945 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6946 AC_LANG_PUSH([C++])
6947 save_CXXFLAGS=$CXXFLAGS
6948 CXXFLAGS="$CXXFLAGS $flag_ssse3"
6949 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6950     #include <tmmintrin.h>
6951     int main () {
6952         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6953         c = _mm_maddubs_epi16 (a, b);
6954         return 0;
6955     }
6956     ])],
6957     [can_compile_ssse3=yes],
6958     [can_compile_ssse3=no])
6959 AC_LANG_POP([C++])
6960 CXXFLAGS=$save_CXXFLAGS
6961 AC_MSG_RESULT([${can_compile_ssse3}])
6962 if test "${can_compile_ssse3}" = "yes" ; then
6963     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
6966 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
6967 AC_LANG_PUSH([C++])
6968 save_CXXFLAGS=$CXXFLAGS
6969 CXXFLAGS="$CXXFLAGS $flag_sse41"
6970 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6971     #include <smmintrin.h>
6972     int main () {
6973         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6974         c = _mm_cmpeq_epi64 (a, b);
6975         return 0;
6976     }
6977     ])],
6978     [can_compile_sse41=yes],
6979     [can_compile_sse41=no])
6980 AC_LANG_POP([C++])
6981 CXXFLAGS=$save_CXXFLAGS
6982 AC_MSG_RESULT([${can_compile_sse41}])
6983 if test "${can_compile_sse41}" = "yes" ; then
6984     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
6987 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
6988 AC_LANG_PUSH([C++])
6989 save_CXXFLAGS=$CXXFLAGS
6990 CXXFLAGS="$CXXFLAGS $flag_sse42"
6991 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6992     #include <nmmintrin.h>
6993     int main () {
6994         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6995         c = _mm_cmpgt_epi64 (a, b);
6996         return 0;
6997     }
6998     ])],
6999     [can_compile_sse42=yes],
7000     [can_compile_sse42=no])
7001 AC_LANG_POP([C++])
7002 CXXFLAGS=$save_CXXFLAGS
7003 AC_MSG_RESULT([${can_compile_sse42}])
7004 if test "${can_compile_sse42}" = "yes" ; then
7005     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7008 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7009 AC_LANG_PUSH([C++])
7010 save_CXXFLAGS=$CXXFLAGS
7011 CXXFLAGS="$CXXFLAGS $flag_avx"
7012 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7013     #include <immintrin.h>
7014     int main () {
7015         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7016         c = _mm256_xor_ps(a, b);
7017         return 0;
7018     }
7019     ])],
7020     [can_compile_avx=yes],
7021     [can_compile_avx=no])
7022 AC_LANG_POP([C++])
7023 CXXFLAGS=$save_CXXFLAGS
7024 AC_MSG_RESULT([${can_compile_avx}])
7025 if test "${can_compile_avx}" = "yes" ; then
7026     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7029 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7030 AC_LANG_PUSH([C++])
7031 save_CXXFLAGS=$CXXFLAGS
7032 CXXFLAGS="$CXXFLAGS $flag_avx2"
7033 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7034     #include <immintrin.h>
7035     int main () {
7036         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7037         c = _mm256_maddubs_epi16(a, b);
7038         return 0;
7039     }
7040     ])],
7041     [can_compile_avx2=yes],
7042     [can_compile_avx2=no])
7043 AC_LANG_POP([C++])
7044 CXXFLAGS=$save_CXXFLAGS
7045 AC_MSG_RESULT([${can_compile_avx2}])
7046 if test "${can_compile_avx2}" = "yes" ; then
7047     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7050 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7051 AC_LANG_PUSH([C++])
7052 save_CXXFLAGS=$CXXFLAGS
7053 CXXFLAGS="$CXXFLAGS $flag_avx512"
7054 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7055     #include <immintrin.h>
7056     int main () {
7057         __m512i a = _mm512_loadu_si512(0);
7058         return 0;
7059     }
7060     ])],
7061     [can_compile_avx512=yes],
7062     [can_compile_avx512=no])
7063 AC_LANG_POP([C++])
7064 CXXFLAGS=$save_CXXFLAGS
7065 AC_MSG_RESULT([${can_compile_avx512}])
7066 if test "${can_compile_avx512}" = "yes" ; then
7067     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7070 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7071 AC_LANG_PUSH([C++])
7072 save_CXXFLAGS=$CXXFLAGS
7073 CXXFLAGS="$CXXFLAGS $flag_f16c"
7074 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7075     #include <immintrin.h>
7076     int main () {
7077         __m128i a = _mm_set1_epi32 (0);
7078         __m128 c;
7079         c = _mm_cvtph_ps(a);
7080         return 0;
7081     }
7082     ])],
7083     [can_compile_f16c=yes],
7084     [can_compile_f16c=no])
7085 AC_LANG_POP([C++])
7086 CXXFLAGS=$save_CXXFLAGS
7087 AC_MSG_RESULT([${can_compile_f16c}])
7088 if test "${can_compile_f16c}" = "yes" ; then
7089     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7092 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7093 AC_LANG_PUSH([C++])
7094 save_CXXFLAGS=$CXXFLAGS
7095 CXXFLAGS="$CXXFLAGS $flag_fma"
7096 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7097     #include <immintrin.h>
7098     int main () {
7099         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7100         d = _mm256_fmadd_ps(a, b, c);
7101         return 0;
7102     }
7103     ])],
7104     [can_compile_fma=yes],
7105     [can_compile_fma=no])
7106 AC_LANG_POP([C++])
7107 CXXFLAGS=$save_CXXFLAGS
7108 AC_MSG_RESULT([${can_compile_fma}])
7109 if test "${can_compile_fma}" = "yes" ; then
7110     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7113 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7114 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7115 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7116 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7117 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7118 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7119 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7120 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7121 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7123 dnl ===================================================================
7124 dnl system stl sanity tests
7125 dnl ===================================================================
7126 if test "$_os" != "WINNT"; then
7128     AC_LANG_PUSH([C++])
7130     save_CPPFLAGS="$CPPFLAGS"
7131     if test -n "$MACOSX_SDK_PATH"; then
7132         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7133     fi
7135     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7136     # only.
7137     if test "$CPP_LIBRARY" = GLIBCXX; then
7138         dnl gcc#19664, gcc#22482, rhbz#162935
7139         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7140         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7141         AC_MSG_RESULT([$stlvisok])
7142         if test "$stlvisok" = "no"; then
7143             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7144         fi
7145     fi
7147     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7148     # when we don't make any dynamic libraries?
7149     if test "$DISABLE_DYNLOADING" = ""; then
7150         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7151         cat > conftestlib1.cc <<_ACEOF
7152 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7153 struct S2: S1<int> { virtual ~S2(); };
7154 S2::~S2() {}
7155 _ACEOF
7156         cat > conftestlib2.cc <<_ACEOF
7157 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7158 struct S2: S1<int> { virtual ~S2(); };
7159 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7160 _ACEOF
7161         gccvisinlineshiddenok=yes
7162         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7163             gccvisinlineshiddenok=no
7164         else
7165             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7166             dnl known to not work with -z defs (unsetting which makes the test
7167             dnl moot, though):
7168             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7169             if test "$COM_IS_CLANG" = TRUE; then
7170                 for i in $CXX $CXXFLAGS; do
7171                     case $i in
7172                     -fsanitize=*)
7173                         my_linkflagsnoundefs=
7174                         break
7175                         ;;
7176                     esac
7177                 done
7178             fi
7179             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7180                 gccvisinlineshiddenok=no
7181             fi
7182         fi
7184         rm -fr libconftest*
7185         AC_MSG_RESULT([$gccvisinlineshiddenok])
7186         if test "$gccvisinlineshiddenok" = "no"; then
7187             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7188         fi
7189     fi
7191    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7192     cat >visibility.cxx <<_ACEOF
7193 #pragma GCC visibility push(hidden)
7194 struct __attribute__ ((visibility ("default"))) TestStruct {
7195   static void Init();
7197 __attribute__ ((visibility ("default"))) void TestFunc() {
7198   TestStruct::Init();
7200 _ACEOF
7201     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7202         gccvisbroken=yes
7203     else
7204         case "$host_cpu" in
7205         i?86|x86_64)
7206             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7207                 gccvisbroken=no
7208             else
7209                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7210                     gccvisbroken=no
7211                 else
7212                     gccvisbroken=yes
7213                 fi
7214             fi
7215             ;;
7216         *)
7217             gccvisbroken=no
7218             ;;
7219         esac
7220     fi
7221     rm -f visibility.s visibility.cxx
7223     AC_MSG_RESULT([$gccvisbroken])
7224     if test "$gccvisbroken" = "yes"; then
7225         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7226     fi
7228     CPPFLAGS="$save_CPPFLAGS"
7230     AC_LANG_POP([C++])
7233 dnl ===================================================================
7234 dnl  Clang++ tests
7235 dnl ===================================================================
7237 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7238 if test "$GCC" = "yes"; then
7239     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7240     AC_LANG_PUSH([C++])
7241     save_CXXFLAGS=$CXXFLAGS
7242     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7243     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7244     CXXFLAGS=$save_CXXFLAGS
7245     AC_LANG_POP([C++])
7246     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7247         AC_MSG_RESULT([yes])
7248     else
7249         AC_MSG_RESULT([no])
7250     fi
7252 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7254 dnl ===================================================================
7255 dnl Compiler plugins
7256 dnl ===================================================================
7258 COMPILER_PLUGINS=
7259 # currently only Clang
7261 if test "$COM_IS_CLANG" != "TRUE"; then
7262     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7263         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7264         enable_compiler_plugins=no
7265     fi
7268 COMPILER_PLUGINS_COM_IS_CLANG=
7269 if test "$COM_IS_CLANG" = "TRUE"; then
7270     if test -n "$enable_compiler_plugins"; then
7271         compiler_plugins="$enable_compiler_plugins"
7272     elif test -n "$ENABLE_DBGUTIL"; then
7273         compiler_plugins=test
7274     else
7275         compiler_plugins=no
7276     fi
7277     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7278         if test "$CLANGVER" -lt 50002; then
7279             if test "$compiler_plugins" = yes; then
7280                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7281             else
7282                 compiler_plugins=no
7283             fi
7284         fi
7285     fi
7286     if test "$compiler_plugins" != "no"; then
7287         dnl The prefix where Clang resides, override to where Clang resides if
7288         dnl using a source build:
7289         if test -z "$CLANGDIR"; then
7290             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | head -n 1)))))
7291         fi
7292         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7293         if test -z "$COMPILER_PLUGINS_CXX"; then
7294             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7295         fi
7296         clangbindir=$CLANGDIR/bin
7297         if test "$build_os" = "cygwin"; then
7298             clangbindir=$(cygpath -u "$clangbindir")
7299         fi
7300         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7301         if test -n "$LLVM_CONFIG"; then
7302             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7303             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7304             if test -z "$CLANGLIBDIR"; then
7305                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7306             fi
7307             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7308             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7309             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7310             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7311                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7312             fi
7313             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7314             clangobjdir=$($LLVM_CONFIG --obj-root)
7315             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7316                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7317             fi
7318         fi
7319         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7320         AC_LANG_PUSH([C++])
7321         save_CXX=$CXX
7322         save_CXXCPP=$CXXCPP
7323         save_CPPFLAGS=$CPPFLAGS
7324         save_CXXFLAGS=$CXXFLAGS
7325         save_LDFLAGS=$LDFLAGS
7326         save_LIBS=$LIBS
7327         CXX=$COMPILER_PLUGINS_CXX
7328         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7329         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7330         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7331         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7332             [COMPILER_PLUGINS=TRUE],
7333             [
7334             if test "$compiler_plugins" = "yes"; then
7335                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7336             else
7337                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7338                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7339             fi
7340             ])
7341         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7342         dnl comment in compilerplugins/Makefile-clang.mk:
7343         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7344             LDFLAGS=""
7345             AC_MSG_CHECKING([for clang libraries to use])
7346             if test -z "$CLANGTOOLLIBS"; then
7347                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7348  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7349                 AC_LINK_IFELSE([
7350                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7351                         [[ clang::FullSourceLoc().dump(); ]])
7352                 ],[CLANGTOOLLIBS="$LIBS"],[])
7353             fi
7354             if test -z "$CLANGTOOLLIBS"; then
7355                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7356                 AC_LINK_IFELSE([
7357                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7358                         [[ clang::FullSourceLoc().dump(); ]])
7359                 ],[CLANGTOOLLIBS="$LIBS"],[])
7360             fi
7361             AC_MSG_RESULT([$CLANGTOOLLIBS])
7362             if test -z "$CLANGTOOLLIBS"; then
7363                 if test "$compiler_plugins" = "yes"; then
7364                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7365                 else
7366                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7367                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7368                 fi
7369                 COMPILER_PLUGINS=
7370             fi
7371             if test -n "$COMPILER_PLUGINS"; then
7372                 if test -z "$CLANGSYSINCLUDE"; then
7373                     if test -n "$LLVM_CONFIG"; then
7374                         # Path to the clang system headers (no idea if there's a better way to get it).
7375                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7376                     fi
7377                 fi
7378             fi
7379         fi
7380         CXX=$save_CXX
7381         CXXCPP=$save_CXXCPP
7382         CPPFLAGS=$save_CPPFLAGS
7383         CXXFLAGS=$save_CXXFLAGS
7384         LDFLAGS=$save_LDFLAGS
7385         LIBS="$save_LIBS"
7386         AC_LANG_POP([C++])
7388         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7389         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7390             #ifndef __clang__
7391             you lose
7392             #endif
7393             int foo=42;
7394             ]])],
7395             [AC_MSG_RESULT([yes])
7396              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7397             [AC_MSG_RESULT([no])])
7398         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7399     fi
7400 else
7401     if test "$enable_compiler_plugins" = "yes"; then
7402         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7403     fi
7405 COMPILER_PLUGINS_ANALYZER_PCH=
7406 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7407     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7409 AC_SUBST(COMPILER_PLUGINS)
7410 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7411 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7412 AC_SUBST(COMPILER_PLUGINS_CXX)
7413 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7414 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7415 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7416 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7417 AC_SUBST(CLANGDIR)
7418 AC_SUBST(CLANGLIBDIR)
7419 AC_SUBST(CLANGTOOLLIBS)
7420 AC_SUBST(CLANGSYSINCLUDE)
7422 # Plugin to help linker.
7423 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7424 # This makes --enable-lto build with clang work.
7425 AC_SUBST(LD_PLUGIN)
7427 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7428 AC_SUBST(HAVE_POSIX_FALLOCATE)
7430 dnl ===================================================================
7431 dnl Custom build version
7432 dnl ===================================================================
7434 AC_MSG_CHECKING([whether to add custom build version])
7435 if test "$with_build_version" != ""; then
7436     BUILD_VER_STRING=$with_build_version
7437     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7438 else
7439     BUILD_VER_STRING=
7440     AC_MSG_RESULT([no])
7442 AC_SUBST(BUILD_VER_STRING)
7444 JITC_PROCESSOR_TYPE=""
7445 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7446     # IBMs JDK needs this...
7447     JITC_PROCESSOR_TYPE=6
7448     export JITC_PROCESSOR_TYPE
7450 AC_SUBST([JITC_PROCESSOR_TYPE])
7452 # Misc Windows Stuff
7453 AC_ARG_WITH(ucrt-dir,
7454     AS_HELP_STRING([--with-ucrt-dir],
7455         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7456         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7457         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7458             Windows6.1-KB2999226-x64.msu
7459             Windows6.1-KB2999226-x86.msu
7460             Windows8.1-KB2999226-x64.msu
7461             Windows8.1-KB2999226-x86.msu
7462             Windows8-RT-KB2999226-x64.msu
7463             Windows8-RT-KB2999226-x86.msu
7464         A zip archive including those files is available from Microsoft site:
7465         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7467 UCRT_REDISTDIR="$with_ucrt_dir"
7468 if test $_os = "WINNT"; then
7469     find_msvc_x64_dlls
7470     for i in $PKGFORMAT; do
7471         if test "$i" = msi; then
7472             find_msms
7473             break
7474         fi
7475     done
7476     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7477     MSVC_DLLS="$msvcdlls"
7478     MSM_PATH=`win_short_path_for_make "$msmdir"`
7479     # MSVC 15.3 changed it to VC141
7480     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
7481         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
7482     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7483         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7484     else
7485         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7486     fi
7488     if test "$UCRT_REDISTDIR" = "no"; then
7489         dnl explicitly disabled
7490         UCRT_REDISTDIR=""
7491     else
7492         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7493                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7494                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7495                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7496                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7497                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7498             UCRT_REDISTDIR=""
7499             if test -n "$PKGFORMAT"; then
7500                for i in $PKGFORMAT; do
7501                    case "$i" in
7502                    msi)
7503                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7504                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7505                        ;;
7506                    esac
7507                done
7508             fi
7509         fi
7510     fi
7513 AC_SUBST(UCRT_REDISTDIR)
7514 AC_SUBST(MSVC_DLL_PATH)
7515 AC_SUBST(MSVC_DLLS)
7516 AC_SUBST(MSM_PATH)
7518 dnl ===================================================================
7519 dnl Checks for Java
7520 dnl ===================================================================
7521 if test "$ENABLE_JAVA" != ""; then
7523     # Windows-specific tests
7524     if test "$build_os" = "cygwin"; then
7525         if test "$BITNESS_OVERRIDE" = 64; then
7526             bitness=64
7527         else
7528             bitness=32
7529         fi
7531         if test -z "$with_jdk_home"; then
7532             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7533             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7534             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7535             if test -n "$regvalue"; then
7536                 ver=$regvalue
7537                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7538                 _jdk_home=$regvalue
7539             fi
7541             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7542                 with_jdk_home="$_jdk_home"
7543                 howfound="found automatically"
7544             else
7545                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK >= 9])
7546             fi
7547         else
7548             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7549             howfound="you passed"
7550         fi
7551     fi
7553     # 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.
7554     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7555     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7556         with_jdk_home=`/usr/libexec/java_home`
7557     fi
7559     JAVA_HOME=; export JAVA_HOME
7560     if test -z "$with_jdk_home"; then
7561         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7562     else
7563         _java_path="$with_jdk_home/bin/$with_java"
7564         dnl Check if there is a Java interpreter at all.
7565         if test -x "$_java_path"; then
7566             JAVAINTERPRETER=$_java_path
7567         else
7568             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7569         fi
7570     fi
7572     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7573     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7574     dnl loaded by java to run JunitTests:
7575     if test "$build_os" = "cygwin"; then
7576         shortjdkhome=`cygpath -d "$with_jdk_home"`
7577         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
7578             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7579             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7580         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
7581             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7582             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7583         fi
7585         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7586             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7587         fi
7588         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7589     elif test "$cross_compiling" != "yes"; then
7590         case $CPUNAME in
7591             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7592                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7593                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7594                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7595                 fi
7596                 ;;
7597             *) # assumption: everything else 32-bit
7598                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7599                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7600                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7601                 fi
7602                 ;;
7603         esac
7604     fi
7607 dnl ===================================================================
7608 dnl Checks for JDK.
7609 dnl ===================================================================
7611 # Note that JAVA_HOME as for now always means the *build* platform's
7612 # JAVA_HOME. Whether all the complexity here actually is needed any
7613 # more or not, no idea.
7615 if test "$ENABLE_JAVA" != ""; then
7616     _gij_longver=0
7617     AC_MSG_CHECKING([the installed JDK])
7618     if test -n "$JAVAINTERPRETER"; then
7619         dnl java -version sends output to stderr!
7620         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7621             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7622         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7623             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7624         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7625             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7626         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7627             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7628         else
7629             JDK=sun
7631             dnl Sun JDK specific tests
7632             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7633             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7635             if test "$_jdk_ver" -lt 10900; then
7636                 AC_MSG_ERROR([JDK is too old, you need at least 9])
7637             fi
7638             if test "$_jdk_ver" -gt 10900; then
7639                 JAVA_CLASSPATH_NOT_SET=TRUE
7640             fi
7642             AC_MSG_RESULT([found (JDK $_jdk)])
7643             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7644             if test "$_os" = "WINNT"; then
7645                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7646             fi
7648             # set to limit VM usage for JunitTests
7649             JAVAIFLAGS=-Xmx64M
7650             # set to limit VM usage for javac
7651             JAVAFLAGS=-J-Xmx128M
7652         fi
7653     else
7654         AC_MSG_ERROR([Java not found. You need at least JDK 9])
7655     fi
7656 else
7657     dnl Java disabled
7658     JAVA_HOME=
7659     export JAVA_HOME
7662 dnl ===================================================================
7663 dnl Checks for javac
7664 dnl ===================================================================
7665 if test "$ENABLE_JAVA" != ""; then
7666     javacompiler="javac"
7667     : ${JAVA_SOURCE_VER=8}
7668     : ${JAVA_TARGET_VER=8}
7669     if test -z "$with_jdk_home"; then
7670         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7671     else
7672         _javac_path="$with_jdk_home/bin/$javacompiler"
7673         dnl Check if there is a Java compiler at all.
7674         if test -x "$_javac_path"; then
7675             JAVACOMPILER=$_javac_path
7676         fi
7677     fi
7678     if test -z "$JAVACOMPILER"; then
7679         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7680     fi
7681     if test "$build_os" = "cygwin"; then
7682         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7683             JAVACOMPILER="${JAVACOMPILER}.exe"
7684         fi
7685         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7686     fi
7689 dnl ===================================================================
7690 dnl Checks for javadoc
7691 dnl ===================================================================
7692 if test "$ENABLE_JAVA" != ""; then
7693     if test -z "$with_jdk_home"; then
7694         AC_PATH_PROG(JAVADOC, javadoc)
7695     else
7696         _javadoc_path="$with_jdk_home/bin/javadoc"
7697         dnl Check if there is a javadoc at all.
7698         if test -x "$_javadoc_path"; then
7699             JAVADOC=$_javadoc_path
7700         else
7701             AC_PATH_PROG(JAVADOC, javadoc)
7702         fi
7703     fi
7704     if test -z "$JAVADOC"; then
7705         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7706     fi
7707     if test "$build_os" = "cygwin"; then
7708         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7709             JAVADOC="${JAVADOC}.exe"
7710         fi
7711         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7712     fi
7714     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7715     JAVADOCISGJDOC="yes"
7716     fi
7718 AC_SUBST(JAVADOCISGJDOC)
7720 if test "$ENABLE_JAVA" != ""; then
7721     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7722     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7723         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7724            # try to recover first by looking whether we have an alternative
7725            # system as in Debian or newer SuSEs where following /usr/bin/javac
7726            # over /etc/alternatives/javac leads to the right bindir where we
7727            # just need to strip a bit away to get a valid JAVA_HOME
7728            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7729         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7730             # maybe only one level of symlink (e.g. on Mac)
7731             JAVA_HOME=$(readlink $JAVACOMPILER)
7732             if test "$(dirname $JAVA_HOME)" = "."; then
7733                 # we've got no path to trim back
7734                 JAVA_HOME=""
7735             fi
7736         else
7737             # else warn
7738             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7739             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7740             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7741             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7742         fi
7743         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7744         if test "$JAVA_HOME" != "/usr"; then
7745             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7746                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7747                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7748                 dnl Tiger already returns a JDK path...
7749                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7750             else
7751                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7752                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7753                 dnl that checks which version to run
7754                 if test -f "$JAVA_HOME"; then
7755                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7756                 fi
7757             fi
7758         fi
7759     fi
7760     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7762     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7763     if test -z "$JAVA_HOME"; then
7764         if test "x$with_jdk_home" = "x"; then
7765             cat > findhome.java <<_ACEOF
7766 [import java.io.File;
7768 class findhome
7770     public static void main(String args[])
7771     {
7772         String jrelocation = System.getProperty("java.home");
7773         File jre = new File(jrelocation);
7774         System.out.println(jre.getParent());
7775     }
7777 _ACEOF
7778             AC_MSG_CHECKING([if javac works])
7779             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7780             AC_TRY_EVAL(javac_cmd)
7781             if test $? = 0 -a -f ./findhome.class; then
7782                 AC_MSG_RESULT([javac works])
7783             else
7784                 echo "configure: javac test failed" >&5
7785                 cat findhome.java >&5
7786                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7787             fi
7788             AC_MSG_CHECKING([if gij knows its java.home])
7789             JAVA_HOME=`$JAVAINTERPRETER findhome`
7790             if test $? = 0 -a "$JAVA_HOME" != ""; then
7791                 AC_MSG_RESULT([$JAVA_HOME])
7792             else
7793                 echo "configure: java test failed" >&5
7794                 cat findhome.java >&5
7795                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7796             fi
7797             # clean-up after ourselves
7798             rm -f ./findhome.java ./findhome.class
7799         else
7800             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7801         fi
7802     fi
7804     # now check if $JAVA_HOME is really valid
7805     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7806         case "${JAVA_HOME}" in
7807             /Library/Java/JavaVirtualMachines/*)
7808                 ;;
7809             *)
7810                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7811                 ;;
7812         esac
7813         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7814             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7815             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7816             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7817             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7818             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7819             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7820         fi
7821     fi
7822     PathFormat "$JAVA_HOME"
7823     JAVA_HOME="$formatted_path"
7826 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7827     "$_os" != Darwin
7828 then
7829     AC_MSG_CHECKING([for JAWT lib])
7830     if test "$_os" = WINNT; then
7831         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7832         JAWTLIB=jawt.lib
7833     else
7834         case "$host_cpu" in
7835         arm*)
7836             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7837             JAVA_ARCH=$my_java_arch
7838             ;;
7839         i*86)
7840             my_java_arch=i386
7841             ;;
7842         m68k)
7843             my_java_arch=m68k
7844             ;;
7845         powerpc)
7846             my_java_arch=ppc
7847             ;;
7848         powerpc64)
7849             my_java_arch=ppc64
7850             ;;
7851         powerpc64le)
7852             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7853             JAVA_ARCH=$my_java_arch
7854             ;;
7855         sparc64)
7856             my_java_arch=sparcv9
7857             ;;
7858         x86_64)
7859             my_java_arch=amd64
7860             ;;
7861         *)
7862             my_java_arch=$host_cpu
7863             ;;
7864         esac
7865         # This is where JDK9 puts the library
7866         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7867             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7868         else
7869             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7870         fi
7871         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7872     fi
7873     AC_MSG_RESULT([$JAWTLIB])
7875 AC_SUBST(JAWTLIB)
7877 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7878     case "$host_os" in
7880     aix*)
7881         JAVAINC="-I$JAVA_HOME/include"
7882         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7883         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7884         ;;
7886     cygwin*)
7887         JAVAINC="-I$JAVA_HOME/include/win32"
7888         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7889         ;;
7891     darwin*)
7892         if test -d "$JAVA_HOME/include/darwin"; then
7893             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7894         else
7895             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7896         fi
7897         ;;
7899     dragonfly*)
7900         JAVAINC="-I$JAVA_HOME/include"
7901         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7902         ;;
7904     freebsd*)
7905         JAVAINC="-I$JAVA_HOME/include"
7906         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7907         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
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     k*bsd*-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     linux-gnu*)
7919         JAVAINC="-I$JAVA_HOME/include"
7920         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7921         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7922         ;;
7924     *netbsd*)
7925         JAVAINC="-I$JAVA_HOME/include"
7926         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7927         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7928        ;;
7930     openbsd*)
7931         JAVAINC="-I$JAVA_HOME/include"
7932         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7933         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7934         ;;
7936     solaris*)
7937         JAVAINC="-I$JAVA_HOME/include"
7938         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7939         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7940         ;;
7941     esac
7943 SOLARINC="$SOLARINC $JAVAINC"
7945 AC_SUBST(JAVACOMPILER)
7946 AC_SUBST(JAVADOC)
7947 AC_SUBST(JAVAINTERPRETER)
7948 AC_SUBST(JAVAIFLAGS)
7949 AC_SUBST(JAVAFLAGS)
7950 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7951 AC_SUBST(JAVA_HOME)
7952 AC_SUBST(JAVA_SOURCE_VER)
7953 AC_SUBST(JAVA_TARGET_VER)
7954 AC_SUBST(JDK)
7957 dnl ===================================================================
7958 dnl Export file validation
7959 dnl ===================================================================
7960 AC_MSG_CHECKING([whether to enable export file validation])
7961 if test "$with_export_validation" != "no"; then
7962     if test -z "$ENABLE_JAVA"; then
7963         if test "$with_export_validation" = "yes"; then
7964             AC_MSG_ERROR([requested, but Java is disabled])
7965         else
7966             AC_MSG_RESULT([no, as Java is disabled])
7967         fi
7968     elif ! test -d "${SRC_ROOT}/schema"; then
7969         if test "$with_export_validation" = "yes"; then
7970             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7971         else
7972             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7973         fi
7974     else
7975         AC_MSG_RESULT([yes])
7976         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7978         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7979         if test -z "$ODFVALIDATOR"; then
7980             # remember to download the ODF toolkit with validator later
7981             AC_MSG_NOTICE([no odfvalidator found, will download it])
7982             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7983             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7985             # and fetch name of odfvalidator jar name from download.lst
7986             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7987             AC_SUBST(ODFVALIDATOR_JAR)
7989             if test -z "$ODFVALIDATOR_JAR"; then
7990                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7991             fi
7992         fi
7993         if test "$build_os" = "cygwin"; then
7994             # In case of Cygwin it will be executed from Windows,
7995             # so we need to run bash and absolute path to validator
7996             # so instead of "odfvalidator" it will be
7997             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7998             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7999         else
8000             ODFVALIDATOR="sh $ODFVALIDATOR"
8001         fi
8002         AC_SUBST(ODFVALIDATOR)
8005         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8006         if test -z "$OFFICEOTRON"; then
8007             # remember to download the officeotron with validator later
8008             AC_MSG_NOTICE([no officeotron found, will download it])
8009             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8010             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8012             # and fetch name of officeotron jar name from download.lst
8013             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8014             AC_SUBST(OFFICEOTRON_JAR)
8016             if test -z "$OFFICEOTRON_JAR"; then
8017                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8018             fi
8019         else
8020             # check version of existing officeotron
8021             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8022             if test 0"$OFFICEOTRON_VER" -lt 704; then
8023                 AC_MSG_ERROR([officeotron too old])
8024             fi
8025         fi
8026         if test "$build_os" = "cygwin"; then
8027             # In case of Cygwin it will be executed from Windows,
8028             # so we need to run bash and absolute path to validator
8029             # so instead of "odfvalidator" it will be
8030             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8031             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8032         else
8033             OFFICEOTRON="sh $OFFICEOTRON"
8034         fi
8035     fi
8036     AC_SUBST(OFFICEOTRON)
8037 else
8038     AC_MSG_RESULT([no])
8041 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8042 if test "$with_bffvalidator" != "no"; then
8043     AC_DEFINE(HAVE_BFFVALIDATOR)
8045     if test "$with_export_validation" = "no"; then
8046         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8047     fi
8049     if test "$with_bffvalidator" = "yes"; then
8050         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8051     else
8052         BFFVALIDATOR="$with_bffvalidator"
8053     fi
8055     if test "$build_os" = "cygwin"; then
8056         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8057             AC_MSG_RESULT($BFFVALIDATOR)
8058         else
8059             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8060         fi
8061     elif test -n "$BFFVALIDATOR"; then
8062         # We are not in Cygwin but need to run Windows binary with wine
8063         AC_PATH_PROGS(WINE, wine)
8065         # so swap in a shell wrapper that converts paths transparently
8066         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8067         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8068         AC_SUBST(BFFVALIDATOR_EXE)
8069         AC_MSG_RESULT($BFFVALIDATOR)
8070     else
8071         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8072     fi
8073     AC_SUBST(BFFVALIDATOR)
8074 else
8075     AC_MSG_RESULT([no])
8078 dnl ===================================================================
8079 dnl Check for C preprocessor to use
8080 dnl ===================================================================
8081 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8082 if test -n "$with_idlc_cpp"; then
8083     AC_MSG_RESULT([$with_idlc_cpp])
8084     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8085 else
8086     AC_MSG_RESULT([ucpp])
8087     AC_MSG_CHECKING([which ucpp tp use])
8088     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8089         AC_MSG_RESULT([external])
8090         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8091     else
8092         AC_MSG_RESULT([internal])
8093         BUILD_TYPE="$BUILD_TYPE UCPP"
8094     fi
8096 AC_SUBST(SYSTEM_UCPP)
8098 dnl ===================================================================
8099 dnl Check for epm (not needed for Windows)
8100 dnl ===================================================================
8101 AC_MSG_CHECKING([whether to enable EPM for packing])
8102 if test "$enable_epm" = "yes"; then
8103     AC_MSG_RESULT([yes])
8104     if test "$_os" != "WINNT"; then
8105         if test $_os = Darwin; then
8106             EPM=internal
8107         elif test -n "$with_epm"; then
8108             EPM=$with_epm
8109         else
8110             AC_PATH_PROG(EPM, epm, no)
8111         fi
8112         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8113             AC_MSG_NOTICE([EPM will be built.])
8114             BUILD_TYPE="$BUILD_TYPE EPM"
8115             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8116         else
8117             # Gentoo has some epm which is something different...
8118             AC_MSG_CHECKING([whether the found epm is the right epm])
8119             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8120                 AC_MSG_RESULT([yes])
8121             else
8122                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8123             fi
8124             AC_MSG_CHECKING([epm version])
8125             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8126             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8127                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8128                 AC_MSG_RESULT([OK, >= 3.7])
8129             else
8130                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8131                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8132             fi
8133         fi
8134     fi
8136     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8137         AC_MSG_CHECKING([for rpm])
8138         for a in "$RPM" rpmbuild rpm; do
8139             $a --usage >/dev/null 2> /dev/null
8140             if test $? -eq 0; then
8141                 RPM=$a
8142                 break
8143             else
8144                 $a --version >/dev/null 2> /dev/null
8145                 if test $? -eq 0; then
8146                     RPM=$a
8147                     break
8148                 fi
8149             fi
8150         done
8151         if test -z "$RPM"; then
8152             AC_MSG_ERROR([not found])
8153         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8154             RPM_PATH=`which $RPM`
8155             AC_MSG_RESULT([$RPM_PATH])
8156             SCPDEFS="$SCPDEFS -DWITH_RPM"
8157         else
8158             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8159         fi
8160     fi
8161     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8162         AC_PATH_PROG(DPKG, dpkg, no)
8163         if test "$DPKG" = "no"; then
8164             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8165         fi
8166     fi
8167     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8168        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8169         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8170             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8171                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8172                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8173                     AC_MSG_RESULT([yes])
8174                 else
8175                     AC_MSG_RESULT([no])
8176                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8177                         _pt="rpm"
8178                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8179                         add_warning "the rpms will need to be installed with --nodeps"
8180                     else
8181                         _pt="pkg"
8182                     fi
8183                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8184                     add_warning "the ${_pt}s will not be relocatable"
8185                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8186                                  relocation will work, you need to patch your epm with the
8187                                  patch in epm/epm-3.7.patch or build with
8188                                  --with-epm=internal which will build a suitable epm])
8189                 fi
8190             fi
8191         fi
8192     fi
8193     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8194         AC_PATH_PROG(PKGMK, pkgmk, no)
8195         if test "$PKGMK" = "no"; then
8196             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8197         fi
8198     fi
8199     AC_SUBST(RPM)
8200     AC_SUBST(DPKG)
8201     AC_SUBST(PKGMK)
8202 else
8203     for i in $PKGFORMAT; do
8204         case "$i" in
8205         aix | bsd | deb | pkg | rpm | native | portable)
8206             AC_MSG_ERROR(
8207                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8208             ;;
8209         esac
8210     done
8211     AC_MSG_RESULT([no])
8212     EPM=NO
8214 AC_SUBST(EPM)
8216 ENABLE_LWP=
8217 if test "$enable_lotuswordpro" = "yes"; then
8218     ENABLE_LWP="TRUE"
8220 AC_SUBST(ENABLE_LWP)
8222 dnl ===================================================================
8223 dnl Check for building ODK
8224 dnl ===================================================================
8225 if test "$enable_odk" = no; then
8226     unset DOXYGEN
8227 else
8228     if test "$with_doxygen" = no; then
8229         AC_MSG_CHECKING([for doxygen])
8230         unset DOXYGEN
8231         AC_MSG_RESULT([no])
8232     else
8233         if test "$with_doxygen" = yes; then
8234             AC_PATH_PROG([DOXYGEN], [doxygen])
8235             if test -z "$DOXYGEN"; then
8236                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8237             fi
8238             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8239                 if ! dot -V 2>/dev/null; then
8240                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8241                 fi
8242             fi
8243         else
8244             AC_MSG_CHECKING([for doxygen])
8245             DOXYGEN=$with_doxygen
8246             AC_MSG_RESULT([$DOXYGEN])
8247         fi
8248         if test -n "$DOXYGEN"; then
8249             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8250             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8251             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8252                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8253             fi
8254         fi
8255     fi
8257 AC_SUBST([DOXYGEN])
8259 AC_MSG_CHECKING([whether to build the ODK])
8260 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8261     AC_MSG_RESULT([yes])
8263     if test "$with_java" != "no"; then
8264         AC_MSG_CHECKING([whether to build unowinreg.dll])
8265         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8266             # build on Win by default
8267             enable_build_unowinreg=yes
8268         fi
8269         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8270             AC_MSG_RESULT([no])
8271             BUILD_UNOWINREG=
8272         else
8273             AC_MSG_RESULT([yes])
8274             BUILD_UNOWINREG=TRUE
8275         fi
8276         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8277             if test -z "$with_mingw_cross_compiler"; then
8278                 dnl Guess...
8279                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8280             elif test -x "$with_mingw_cross_compiler"; then
8281                  MINGWCXX="$with_mingw_cross_compiler"
8282             else
8283                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8284             fi
8286             if test "$MINGWCXX" = "false"; then
8287                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8288             fi
8290             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8291             if test -x "$mingwstrip_test"; then
8292                 MINGWSTRIP="$mingwstrip_test"
8293             else
8294                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8295             fi
8297             if test "$MINGWSTRIP" = "false"; then
8298                 AC_MSG_ERROR(MinGW32 binutils not found.)
8299             fi
8300         fi
8301     fi
8302     BUILD_TYPE="$BUILD_TYPE ODK"
8303 else
8304     AC_MSG_RESULT([no])
8305     BUILD_UNOWINREG=
8307 AC_SUBST(BUILD_UNOWINREG)
8308 AC_SUBST(MINGWCXX)
8309 AC_SUBST(MINGWSTRIP)
8311 dnl ===================================================================
8312 dnl Check for system zlib
8313 dnl ===================================================================
8314 if test "$with_system_zlib" = "auto"; then
8315     case "$_os" in
8316     WINNT)
8317         with_system_zlib="$with_system_libs"
8318         ;;
8319     *)
8320         if test "$enable_fuzzers" != "yes"; then
8321             with_system_zlib=yes
8322         else
8323             with_system_zlib=no
8324         fi
8325         ;;
8326     esac
8329 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8330 dnl and has no pkg-config for it at least on some tinderboxes,
8331 dnl so leaving that out for now
8332 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8333 AC_MSG_CHECKING([which zlib to use])
8334 if test "$with_system_zlib" = "yes"; then
8335     AC_MSG_RESULT([external])
8336     SYSTEM_ZLIB=TRUE
8337     AC_CHECK_HEADER(zlib.h, [],
8338         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8339     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8340         [AC_MSG_ERROR(zlib not found or functional)], [])
8341 else
8342     AC_MSG_RESULT([internal])
8343     SYSTEM_ZLIB=
8344     BUILD_TYPE="$BUILD_TYPE ZLIB"
8345     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8346     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8348 AC_SUBST(ZLIB_CFLAGS)
8349 AC_SUBST(ZLIB_LIBS)
8350 AC_SUBST(SYSTEM_ZLIB)
8352 dnl ===================================================================
8353 dnl Check for system jpeg
8354 dnl ===================================================================
8355 AC_MSG_CHECKING([which libjpeg to use])
8356 if test "$with_system_jpeg" = "yes"; then
8357     AC_MSG_RESULT([external])
8358     SYSTEM_LIBJPEG=TRUE
8359     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8360         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8361     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8362         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8363 else
8364     SYSTEM_LIBJPEG=
8365     AC_MSG_RESULT([internal, libjpeg-turbo])
8366     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8367     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8368     if test "$COM" = "MSC"; then
8369         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8370     else
8371         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8372     fi
8374     case "$host_cpu" in
8375     x86_64 | amd64 | i*86 | x86 | ia32)
8376         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8377         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8378             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8379                 NASM="$LODE_HOME/opt/bin/nasm"
8380             elif test -x "/opt/lo/bin/nasm"; then
8381                 NASM="/opt/lo/bin/nasm"
8382             fi
8383         fi
8385         if test -n "$NASM"; then
8386             AC_MSG_CHECKING([for object file format of host system])
8387             case "$host_os" in
8388               cygwin* | mingw* | pw32* | interix*)
8389                 case "$host_cpu" in
8390                   x86_64)
8391                     objfmt='Win64-COFF'
8392                     ;;
8393                   *)
8394                     objfmt='Win32-COFF'
8395                     ;;
8396                 esac
8397               ;;
8398               msdosdjgpp* | go32*)
8399                 objfmt='COFF'
8400               ;;
8401               os2-emx*) # not tested
8402                 objfmt='MSOMF' # obj
8403               ;;
8404               linux*coff* | linux*oldld*)
8405                 objfmt='COFF' # ???
8406               ;;
8407               linux*aout*)
8408                 objfmt='a.out'
8409               ;;
8410               linux*)
8411                 case "$host_cpu" in
8412                   x86_64)
8413                     objfmt='ELF64'
8414                     ;;
8415                   *)
8416                     objfmt='ELF'
8417                     ;;
8418                 esac
8419               ;;
8420               kfreebsd* | freebsd* | netbsd* | openbsd*)
8421                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8422                   objfmt='BSD-a.out'
8423                 else
8424                   case "$host_cpu" in
8425                     x86_64 | amd64)
8426                       objfmt='ELF64'
8427                       ;;
8428                     *)
8429                       objfmt='ELF'
8430                       ;;
8431                   esac
8432                 fi
8433               ;;
8434               solaris* | sunos* | sysv* | sco*)
8435                 case "$host_cpu" in
8436                   x86_64)
8437                     objfmt='ELF64'
8438                     ;;
8439                   *)
8440                     objfmt='ELF'
8441                     ;;
8442                 esac
8443               ;;
8444               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8445                 case "$host_cpu" in
8446                   x86_64)
8447                     objfmt='Mach-O64'
8448                     ;;
8449                   *)
8450                     objfmt='Mach-O'
8451                     ;;
8452                 esac
8453               ;;
8454               *)
8455                 objfmt='ELF ?'
8456               ;;
8457             esac
8459             AC_MSG_RESULT([$objfmt])
8460             if test "$objfmt" = 'ELF ?'; then
8461               objfmt='ELF'
8462               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8463             fi
8465             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8466             case "$objfmt" in
8467               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8468               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8469               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8470               COFF)       NAFLAGS='-fcoff -DCOFF';;
8471               a.out)      NAFLAGS='-faout -DAOUT';;
8472               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8473               ELF)        NAFLAGS='-felf -DELF';;
8474               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8475               RDF)        NAFLAGS='-frdf -DRDF';;
8476               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8477               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8478             esac
8479             AC_MSG_RESULT([$NAFLAGS])
8481             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8482             cat > conftest.asm << EOF
8483             [%line __oline__ "configure"
8484                     section .text
8485                     global  _main,main
8486             _main:
8487             main:   xor     eax,eax
8488                     ret
8489             ]
8491             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8492             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8493               AC_MSG_RESULT(yes)
8494             else
8495               echo "configure: failed program was:" >&AC_FD_CC
8496               cat conftest.asm >&AC_FD_CC
8497               rm -rf conftest*
8498               AC_MSG_RESULT(no)
8499               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8500               NASM=""
8501             fi
8503         fi
8505         if test -z "$NASM"; then
8506 cat << _EOS
8507 ****************************************************************************
8508 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8509 To get one please:
8511 _EOS
8512             if test "$build_os" = "cygwin"; then
8513 cat << _EOS
8514 install a pre-compiled binary for Win32
8516 mkdir -p /opt/lo/bin
8517 cd /opt/lo/bin
8518 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8519 chmod +x nasm
8521 or get and install one from http://www.nasm.us/
8523 Then re-run autogen.sh
8525 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8526 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8528 _EOS
8529             else
8530 cat << _EOS
8531 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8533 _EOS
8534             fi
8535             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8536             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8537         fi
8538       ;;
8539     esac
8542 AC_SUBST(NASM)
8543 AC_SUBST(LIBJPEG_CFLAGS)
8544 AC_SUBST(LIBJPEG_LIBS)
8545 AC_SUBST(SYSTEM_LIBJPEG)
8547 dnl ===================================================================
8548 dnl Check for system clucene
8549 dnl ===================================================================
8550 dnl we should rather be using
8551 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8552 dnl but the contribs-lib check seems tricky
8553 AC_MSG_CHECKING([which clucene to use])
8554 if test "$with_system_clucene" = "yes"; then
8555     AC_MSG_RESULT([external])
8556     SYSTEM_CLUCENE=TRUE
8557     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8558     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8559     FilterLibs "${CLUCENE_LIBS}"
8560     CLUCENE_LIBS="${filteredlibs}"
8561     AC_LANG_PUSH([C++])
8562     save_CXXFLAGS=$CXXFLAGS
8563     save_CPPFLAGS=$CPPFLAGS
8564     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8565     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8566     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8567     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8568     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8569                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8570     CXXFLAGS=$save_CXXFLAGS
8571     CPPFLAGS=$save_CPPFLAGS
8572     AC_LANG_POP([C++])
8574     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8575 else
8576     AC_MSG_RESULT([internal])
8577     SYSTEM_CLUCENE=
8578     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8580 AC_SUBST(SYSTEM_CLUCENE)
8581 AC_SUBST(CLUCENE_CFLAGS)
8582 AC_SUBST(CLUCENE_LIBS)
8584 dnl ===================================================================
8585 dnl Check for system expat
8586 dnl ===================================================================
8587 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8589 dnl ===================================================================
8590 dnl Check for system xmlsec
8591 dnl ===================================================================
8592 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8594 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8595 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8596     ENABLE_EOT="TRUE"
8597     AC_DEFINE([ENABLE_EOT])
8598     AC_MSG_RESULT([yes])
8600     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8601 else
8602     ENABLE_EOT=
8603     AC_MSG_RESULT([no])
8605 AC_SUBST([ENABLE_EOT])
8607 dnl ===================================================================
8608 dnl Check for DLP libs
8609 dnl ===================================================================
8610 AS_IF([test "$COM" = "MSC"],
8611       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8612       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8614 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8616 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8618 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8620 AS_IF([test "$COM" = "MSC"],
8621       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8622       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8624 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8626 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8628 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8629 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.11])
8631 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8633 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8635 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8637 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8638 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.16])
8640 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8641 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8643 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8645 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8646 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8648 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8650 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8652 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8654 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8656 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8657 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
8659 dnl ===================================================================
8660 dnl Check for system lcms2
8661 dnl ===================================================================
8662 if test "$with_system_lcms2" != "yes"; then
8663     SYSTEM_LCMS2=
8665 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8666 if test "$GCC" = "yes"; then
8667     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8669 if test "$COM" = "MSC"; then # override the above
8670     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8673 dnl ===================================================================
8674 dnl Check for system cppunit
8675 dnl ===================================================================
8676 if test "$_os" != "Android" ; then
8677     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8680 dnl ===================================================================
8681 dnl Check whether freetype is available
8682 dnl ===================================================================
8683 if test  "$test_freetype" = "yes"; then
8684     AC_MSG_CHECKING([whether freetype is available])
8685     # FreeType has 3 different kinds of versions
8686     # * release, like 2.4.10
8687     # * libtool, like 13.0.7 (this what pkg-config returns)
8688     # * soname
8689     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8690     #
8691     # 9.9.3 is 2.2.0
8692     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8693     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8694     FilterLibs "${FREETYPE_LIBS}"
8695     FREETYPE_LIBS="${filteredlibs}"
8696     SYSTEM_FREETYPE=TRUE
8697 else
8698     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8699     if test "x$ac_config_site_64bit_host" = xYES; then
8700         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8701     else
8702         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8703     fi
8705 AC_SUBST(FREETYPE_CFLAGS)
8706 AC_SUBST(FREETYPE_LIBS)
8707 AC_SUBST([SYSTEM_FREETYPE])
8709 # ===================================================================
8710 # Check for system libxslt
8711 # to prevent incompatibilities between internal libxml2 and external libxslt,
8712 # or vice versa, use with_system_libxml here
8713 # ===================================================================
8714 if test "$with_system_libxml" = "auto"; then
8715     case "$_os" in
8716     WINNT|iOS|Android)
8717         with_system_libxml="$with_system_libs"
8718         ;;
8719     *)
8720         if test "$enable_fuzzers" != "yes"; then
8721             with_system_libxml=yes
8722         else
8723             with_system_libxml=no
8724         fi
8725         ;;
8726     esac
8729 AC_MSG_CHECKING([which libxslt to use])
8730 if test "$with_system_libxml" = "yes"; then
8731     AC_MSG_RESULT([external])
8732     SYSTEM_LIBXSLT=TRUE
8733     if test "$_os" = "Darwin"; then
8734         dnl make sure to use SDK path
8735         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8736         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8737         dnl omit -L/usr/lib
8738         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8739         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8740     else
8741         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8742         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8743         FilterLibs "${LIBXSLT_LIBS}"
8744         LIBXSLT_LIBS="${filteredlibs}"
8745         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8746         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8747         FilterLibs "${LIBEXSLT_LIBS}"
8748         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8749     fi
8751     dnl Check for xsltproc
8752     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8753     if test "$XSLTPROC" = "no"; then
8754         AC_MSG_ERROR([xsltproc is required])
8755     fi
8756 else
8757     AC_MSG_RESULT([internal])
8758     SYSTEM_LIBXSLT=
8759     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8761     if test "$cross_compiling" = "yes"; then
8762         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8763         if test "$XSLTPROC" = "no"; then
8764             AC_MSG_ERROR([xsltproc is required])
8765         fi
8766     fi
8768 AC_SUBST(SYSTEM_LIBXSLT)
8769 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8770     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8772 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8774 AC_SUBST(LIBEXSLT_CFLAGS)
8775 AC_SUBST(LIBEXSLT_LIBS)
8776 AC_SUBST(LIBXSLT_CFLAGS)
8777 AC_SUBST(LIBXSLT_LIBS)
8778 AC_SUBST(XSLTPROC)
8780 # ===================================================================
8781 # Check for system libxml
8782 # ===================================================================
8783 AC_MSG_CHECKING([which libxml to use])
8784 if test "$with_system_libxml" = "yes"; then
8785     AC_MSG_RESULT([external])
8786     SYSTEM_LIBXML=TRUE
8787     if test "$_os" = "Darwin"; then
8788         dnl make sure to use SDK path
8789         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8790         dnl omit -L/usr/lib
8791         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8792     elif test $_os = iOS; then
8793         dnl make sure to use SDK path
8794         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8795         LIBXML_CFLAGS="-I$usr/include/libxml2"
8796         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8797     else
8798         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8799         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8800         FilterLibs "${LIBXML_LIBS}"
8801         LIBXML_LIBS="${filteredlibs}"
8802     fi
8804     dnl Check for xmllint
8805     AC_PATH_PROG(XMLLINT, xmllint, no)
8806     if test "$XMLLINT" = "no"; then
8807         AC_MSG_ERROR([xmllint is required])
8808     fi
8809 else
8810     AC_MSG_RESULT([internal])
8811     SYSTEM_LIBXML=
8812     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8813     if test "$COM" = "MSC"; then
8814         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8815     fi
8816     if test "$COM" = "MSC"; then
8817         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8818     else
8819         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8820     fi
8821     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8823 AC_SUBST(SYSTEM_LIBXML)
8824 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8825     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8827 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8828 AC_SUBST(LIBXML_CFLAGS)
8829 AC_SUBST(LIBXML_LIBS)
8830 AC_SUBST(XMLLINT)
8832 # =====================================================================
8833 # Checking for a Python interpreter with version >= 3.3.
8834 # Optionally user can pass an option to configure, i. e.
8835 # ./configure PYTHON=/usr/bin/python
8836 # =====================================================================
8837 if test $_os = Darwin -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
8838     # Only allowed choices for macOS are 'internal' (default) and 'fully-internal'
8839     enable_python=internal
8841 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8842     if test -n "$PYTHON"; then
8843         PYTHON_FOR_BUILD=$PYTHON
8844     else
8845         # This allows a lack of system python with no error, we use internal one in that case.
8846         AM_PATH_PYTHON([3.3],, [:])
8847         # Clean PYTHON_VERSION checked below if cross-compiling
8848         PYTHON_VERSION=""
8849         if test "$PYTHON" != ":"; then
8850             PYTHON_FOR_BUILD=$PYTHON
8851         fi
8852     fi
8854 AC_SUBST(PYTHON_FOR_BUILD)
8856 # Checks for Python to use for Pyuno
8857 AC_MSG_CHECKING([which Python to use for Pyuno])
8858 case "$enable_python" in
8859 no|disable)
8860     if test -z $PYTHON_FOR_BUILD; then
8861         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8862         # requirement from the choice whether to include Python stuff in the installer, but why
8863         # bother?
8864         AC_MSG_ERROR([Python is required at build time.])
8865     fi
8866     enable_python=no
8867     AC_MSG_RESULT([none])
8868     ;;
8869 ""|yes|auto)
8870     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8871         AC_MSG_RESULT([no, overridden by --disable-scripting])
8872         enable_python=no
8873     elif test $build_os = cygwin; then
8874         dnl When building on Windows we don't attempt to use any installed
8875         dnl "system"  Python.
8876         AC_MSG_RESULT([fully internal])
8877         enable_python=internal
8878     elif test "$cross_compiling" = yes; then
8879         AC_MSG_RESULT([system])
8880         enable_python=system
8881     else
8882         # Unset variables set by the above AM_PATH_PYTHON so that
8883         # we actually do check anew.
8884         AC_MSG_RESULT([])
8885         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
8886         AM_PATH_PYTHON([3.3],, [:])
8887         AC_MSG_CHECKING([which Python to use for Pyuno])
8888         if test "$PYTHON" = ":"; then
8889             if test -z "$PYTHON_FOR_BUILD"; then
8890                 AC_MSG_RESULT([fully internal])
8891             else
8892                 AC_MSG_RESULT([internal])
8893             fi
8894             enable_python=internal
8895         else
8896             AC_MSG_RESULT([system])
8897             enable_python=system
8898         fi
8899     fi
8900     ;;
8901 internal)
8902     AC_MSG_RESULT([internal])
8903     ;;
8904 fully-internal)
8905     AC_MSG_RESULT([fully internal])
8906     enable_python=internal
8907     ;;
8908 system)
8909     AC_MSG_RESULT([system])
8910     if test "$_os" = Darwin; then
8911         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
8912     fi
8913     ;;
8915     AC_MSG_ERROR([Incorrect --enable-python option])
8916     ;;
8917 esac
8919 if test $enable_python != no; then
8920     BUILD_TYPE="$BUILD_TYPE PYUNO"
8923 if test $enable_python = system; then
8924     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8925         # Fallback: Accept these in the environment, or as set above
8926         # for MacOSX.
8927         :
8928     elif test "$cross_compiling" != yes; then
8929         # Unset variables set by the above AM_PATH_PYTHON so that
8930         # we actually do check anew.
8931         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
8932         # This causes an error if no python command is found
8933         AM_PATH_PYTHON([3.3])
8934         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8935         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8936         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8937         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8938         if test -z "$PKG_CONFIG"; then
8939             PYTHON_CFLAGS="-I$python_include"
8940             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8941         elif $PKG_CONFIG --exists python-$python_version-embed; then
8942             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8943             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8944         elif $PKG_CONFIG --exists python-$python_version; then
8945             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8946             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8947         else
8948             PYTHON_CFLAGS="-I$python_include"
8949             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8950         fi
8951         FilterLibs "${PYTHON_LIBS}"
8952         PYTHON_LIBS="${filteredlibs}"
8953     else
8954         dnl How to find out the cross-compilation Python installation path?
8955         AC_MSG_CHECKING([for python version])
8956         AS_IF([test -n "$PYTHON_VERSION"],
8957               [AC_MSG_RESULT([$PYTHON_VERSION])],
8958               [AC_MSG_RESULT([not found])
8959                AC_MSG_ERROR([no usable python found])])
8960         test -n "$PYTHON_CFLAGS" && break
8961     fi
8963     dnl Check if the headers really work
8964     save_CPPFLAGS="$CPPFLAGS"
8965     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8966     AC_CHECK_HEADER(Python.h)
8967     CPPFLAGS="$save_CPPFLAGS"
8969     # let the PYTHON_FOR_BUILD match the same python installation that
8970     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8971     # better for PythonTests.
8972     PYTHON_FOR_BUILD=$PYTHON
8975 if test "$with_lxml" != no; then
8976     if test -z "$PYTHON_FOR_BUILD"; then
8977         case $build_os in
8978             cygwin)
8979                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8980                 ;;
8981             *)
8982                 if test "$cross_compiling" != yes ; then
8983                     BUILD_TYPE="$BUILD_TYPE LXML"
8984                 fi
8985                 ;;
8986         esac
8987     else
8988         AC_MSG_CHECKING([for python lxml])
8989         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8990             AC_MSG_RESULT([yes])
8991         else
8992             case $build_os in
8993                 cygwin)
8994                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8995                     ;;
8996                 *)
8997                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8998                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8999                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9000                         else
9001                             BUILD_TYPE="$BUILD_TYPE LXML"
9002                             AC_MSG_RESULT([no, using internal lxml])
9003                         fi
9004                     else
9005                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9006                     fi
9007                     ;;
9008             esac
9009         fi
9010     fi
9013 dnl By now enable_python should be "system", "internal" or "no"
9014 case $enable_python in
9015 system)
9016     SYSTEM_PYTHON=TRUE
9018     if test "x$ac_cv_header_Python_h" != "xyes"; then
9019        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9020     fi
9022     AC_LANG_PUSH(C)
9023     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9024     AC_MSG_CHECKING([for correct python library version])
9025        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9026 #include <Python.h>
9028 int main(int argc, char **argv) {
9029    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9030    else return 1;
9032        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9033     CFLAGS=$save_CFLAGS
9034     AC_LANG_POP(C)
9036     dnl FIXME Check if the Python library can be linked with, too?
9037     ;;
9039 internal)
9040     SYSTEM_PYTHON=
9041     PYTHON_VERSION_MAJOR=3
9042     PYTHON_VERSION_MINOR=7
9043     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
9044     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9045         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9046     fi
9047     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9048     BUILD_TYPE="$BUILD_TYPE PYTHON"
9049     if test "$OS" = LINUX; then
9050         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9051     fi
9052     # Embedded Python dies without Home set
9053     if test "$HOME" = ""; then
9054         export HOME=""
9055     fi
9056     ;;
9058     DISABLE_PYTHON=TRUE
9059     SYSTEM_PYTHON=
9060     ;;
9062     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9063     ;;
9064 esac
9066 AC_SUBST(DISABLE_PYTHON)
9067 AC_SUBST(SYSTEM_PYTHON)
9068 AC_SUBST(PYTHON_CFLAGS)
9069 AC_SUBST(PYTHON_LIBS)
9070 AC_SUBST(PYTHON_VERSION)
9071 AC_SUBST(PYTHON_VERSION_MAJOR)
9072 AC_SUBST(PYTHON_VERSION_MINOR)
9074 ENABLE_MARIADBC=TRUE
9075 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
9076     ENABLE_MARIADBC=
9078 MARIADBC_MAJOR=1
9079 MARIADBC_MINOR=0
9080 MARIADBC_MICRO=2
9081 if test "$ENABLE_MARIADBC" = "TRUE"; then
9082     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9085 AC_SUBST(ENABLE_MARIADBC)
9086 AC_SUBST(MARIADBC_MAJOR)
9087 AC_SUBST(MARIADBC_MINOR)
9088 AC_SUBST(MARIADBC_MICRO)
9090 if test "$ENABLE_MARIADBC" = "TRUE"; then
9091     dnl ===================================================================
9092     dnl Check for system MariaDB
9093     dnl ===================================================================
9094     AC_MSG_CHECKING([which MariaDB to use])
9095     if test "$with_system_mariadb" = "yes"; then
9096         AC_MSG_RESULT([external])
9097         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9098         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9099         if test -z "$MARIADBCONFIG"; then
9100             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9101             if test -z "$MARIADBCONFIG"; then
9102                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9103                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9104             fi
9105         fi
9106         AC_MSG_CHECKING([MariaDB version])
9107         MARIADB_VERSION=`$MARIADBCONFIG --version`
9108         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9109         if test "$MARIADB_MAJOR" -ge "5"; then
9110             AC_MSG_RESULT([OK])
9111         else
9112             AC_MSG_ERROR([too old, use 5.0.x or later])
9113         fi
9114         AC_MSG_CHECKING([for MariaDB Client library])
9115         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9116         if test "$COM_IS_CLANG" = TRUE; then
9117             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9118         fi
9119         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9120         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9121         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9122         dnl linux32:
9123         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9124             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9125             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9126                 | sed -e 's|/lib64/|/lib/|')
9127         fi
9128         FilterLibs "${MARIADB_LIBS}"
9129         MARIADB_LIBS="${filteredlibs}"
9130         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9131         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9132         if test "$enable_bundle_mariadb" = "yes"; then
9133             AC_MSG_RESULT([yes])
9134             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9135             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9137 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9139 /g' | grep -E '(mysqlclient|mariadb)')
9140             if test "$_os" = "Darwin"; then
9141                 LIBMARIADB=${LIBMARIADB}.dylib
9142             elif test "$_os" = "WINNT"; then
9143                 LIBMARIADB=${LIBMARIADB}.dll
9144             else
9145                 LIBMARIADB=${LIBMARIADB}.so
9146             fi
9147             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9148             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9149             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9150                 AC_MSG_RESULT([found.])
9151                 PathFormat "$LIBMARIADB_PATH"
9152                 LIBMARIADB_PATH="$formatted_path"
9153             else
9154                 AC_MSG_ERROR([not found.])
9155             fi
9156         else
9157             AC_MSG_RESULT([no])
9158             BUNDLE_MARIADB_CONNECTOR_C=
9159         fi
9160     else
9161         AC_MSG_RESULT([internal])
9162         SYSTEM_MARIADB_CONNECTOR_C=
9163         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9164         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9165         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9166     fi
9168     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9169     AC_SUBST(MARIADB_CFLAGS)
9170     AC_SUBST(MARIADB_LIBS)
9171     AC_SUBST(LIBMARIADB)
9172     AC_SUBST(LIBMARIADB_PATH)
9173     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9176 dnl ===================================================================
9177 dnl Check for system hsqldb
9178 dnl ===================================================================
9179 if test "$with_java" != "no"; then
9180     HSQLDB_USE_JDBC_4_1=
9181     AC_MSG_CHECKING([which hsqldb to use])
9182     if test "$with_system_hsqldb" = "yes"; then
9183         AC_MSG_RESULT([external])
9184         SYSTEM_HSQLDB=TRUE
9185         if test -z $HSQLDB_JAR; then
9186             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9187         fi
9188         if ! test -f $HSQLDB_JAR; then
9189                AC_MSG_ERROR(hsqldb.jar not found.)
9190         fi
9191         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9192         export HSQLDB_JAR
9193         if $PERL -e \
9194            'use Archive::Zip;
9195             my $file = "$ENV{'HSQLDB_JAR'}";
9196             my $zip = Archive::Zip->new( $file );
9197             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9198             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9199             {
9200                 push @l, split(/\n/, $mf);
9201                 foreach my $line (@l)
9202                 {
9203                     if ($line =~ m/Specification-Version:/)
9204                     {
9205                         ($t, $version) = split (/:/,$line);
9206                         $version =~ s/^\s//;
9207                         ($a, $b, $c, $d) = split (/\./,$version);
9208                         if ($c == "0" && $d > "8")
9209                         {
9210                             exit 0;
9211                         }
9212                         else
9213                         {
9214                             exit 1;
9215                         }
9216                     }
9217                 }
9218             }
9219             else
9220             {
9221                 exit 1;
9222             }'; then
9223             AC_MSG_RESULT([yes])
9224         else
9225             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9226         fi
9227     else
9228         AC_MSG_RESULT([internal])
9229         SYSTEM_HSQLDB=
9230         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9231         NEED_ANT=TRUE
9232         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9233         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9234         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9235             AC_MSG_RESULT([yes])
9236             HSQLDB_USE_JDBC_4_1=TRUE
9237         else
9238             AC_MSG_RESULT([no])
9239         fi
9240     fi
9241     AC_SUBST(SYSTEM_HSQLDB)
9242     AC_SUBST(HSQLDB_JAR)
9243     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9246 dnl ===================================================================
9247 dnl Check for PostgreSQL stuff
9248 dnl ===================================================================
9249 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9250 if test "x$enable_postgresql_sdbc" != "xno"; then
9251     AC_MSG_RESULT([yes])
9252     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9254     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9255         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9256     fi
9257     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9258         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9259     fi
9261     postgres_interface=""
9262     if test "$with_system_postgresql" = "yes"; then
9263         postgres_interface="external PostgreSQL"
9264         SYSTEM_POSTGRESQL=TRUE
9265         if test "$_os" = Darwin; then
9266             supp_path=''
9267             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9268                 pg_supp_path="$P_SEP$d$pg_supp_path"
9269             done
9270         fi
9271         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9272         if test -n "$PGCONFIG"; then
9273             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9274             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9275         else
9276             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9277               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9278               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9279             ],[
9280               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9281             ])
9282         fi
9283         FilterLibs "${POSTGRESQL_LIB}"
9284         POSTGRESQL_LIB="${filteredlibs}"
9285     else
9286         # if/when anything else than PostgreSQL uses Kerberos,
9287         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9288         WITH_KRB5=
9289         WITH_GSSAPI=
9290         case "$_os" in
9291         Darwin)
9292             # macOS has system MIT Kerberos 5 since 10.4
9293             if test "$with_krb5" != "no"; then
9294                 WITH_KRB5=TRUE
9295                 save_LIBS=$LIBS
9296                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9297                 # that the libraries where these functions are located on macOS will change, is it?
9298                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9299                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9300                 KRB5_LIBS=$LIBS
9301                 LIBS=$save_LIBS
9302                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9303                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9304                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9305                 LIBS=$save_LIBS
9306             fi
9307             if test "$with_gssapi" != "no"; then
9308                 WITH_GSSAPI=TRUE
9309                 save_LIBS=$LIBS
9310                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9311                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9312                 GSSAPI_LIBS=$LIBS
9313                 LIBS=$save_LIBS
9314             fi
9315             ;;
9316         WINNT)
9317             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9318                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9319             fi
9320             ;;
9321         Linux|GNU|*BSD|DragonFly)
9322             if test "$with_krb5" != "no"; then
9323                 WITH_KRB5=TRUE
9324                 save_LIBS=$LIBS
9325                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9326                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9327                 KRB5_LIBS=$LIBS
9328                 LIBS=$save_LIBS
9329                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9330                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9331                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9332                 LIBS=$save_LIBS
9333             fi
9334             if test "$with_gssapi" != "no"; then
9335                 WITH_GSSAPI=TRUE
9336                 save_LIBS=$LIBS
9337                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9338                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9339                 GSSAPI_LIBS=$LIBS
9340                 LIBS=$save_LIBS
9341             fi
9342             ;;
9343         *)
9344             if test "$with_krb5" = "yes"; then
9345                 WITH_KRB5=TRUE
9346                 save_LIBS=$LIBS
9347                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9348                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9349                 KRB5_LIBS=$LIBS
9350                 LIBS=$save_LIBS
9351                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9352                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9353                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9354                 LIBS=$save_LIBS
9355             fi
9356             if test "$with_gssapi" = "yes"; then
9357                 WITH_GSSAPI=TRUE
9358                 save_LIBS=$LIBS
9359                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9360                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9361                 LIBS=$save_LIBS
9362                 GSSAPI_LIBS=$LIBS
9363             fi
9364         esac
9366         if test -n "$with_libpq_path"; then
9367             SYSTEM_POSTGRESQL=TRUE
9368             postgres_interface="external libpq"
9369             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9370             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9371         else
9372             SYSTEM_POSTGRESQL=
9373             postgres_interface="internal"
9374             POSTGRESQL_LIB=""
9375             POSTGRESQL_INC="%OVERRIDE_ME%"
9376             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9377         fi
9378     fi
9380     AC_MSG_CHECKING([PostgreSQL C interface])
9381     AC_MSG_RESULT([$postgres_interface])
9383     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9384         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9385         save_CFLAGS=$CFLAGS
9386         save_CPPFLAGS=$CPPFLAGS
9387         save_LIBS=$LIBS
9388         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9389         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9390         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9391         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9392             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9393         CFLAGS=$save_CFLAGS
9394         CPPFLAGS=$save_CPPFLAGS
9395         LIBS=$save_LIBS
9396     fi
9397     BUILD_POSTGRESQL_SDBC=TRUE
9398 else
9399     AC_MSG_RESULT([no])
9401 AC_SUBST(WITH_KRB5)
9402 AC_SUBST(WITH_GSSAPI)
9403 AC_SUBST(GSSAPI_LIBS)
9404 AC_SUBST(KRB5_LIBS)
9405 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9406 AC_SUBST(SYSTEM_POSTGRESQL)
9407 AC_SUBST(POSTGRESQL_INC)
9408 AC_SUBST(POSTGRESQL_LIB)
9410 dnl ===================================================================
9411 dnl Check for Firebird stuff
9412 dnl ===================================================================
9413 ENABLE_FIREBIRD_SDBC=
9414 if test "$enable_firebird_sdbc" = "yes" ; then
9415     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9417     dnl ===================================================================
9418     dnl Check for system Firebird
9419     dnl ===================================================================
9420     AC_MSG_CHECKING([which Firebird to use])
9421     if test "$with_system_firebird" = "yes"; then
9422         AC_MSG_RESULT([external])
9423         SYSTEM_FIREBIRD=TRUE
9424         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9425         if test -z "$FIREBIRDCONFIG"; then
9426             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9427             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9428                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9429             ])
9430             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9431         else
9432             AC_MSG_NOTICE([fb_config found])
9433             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9434             AC_MSG_CHECKING([for Firebird Client library])
9435             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9436             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9437             FilterLibs "${FIREBIRD_LIBS}"
9438             FIREBIRD_LIBS="${filteredlibs}"
9439         fi
9440         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9441         AC_MSG_CHECKING([Firebird version])
9442         if test -n "${FIREBIRD_VERSION}"; then
9443             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9444             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9445             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9446                 AC_MSG_RESULT([OK])
9447             else
9448                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9449             fi
9450         else
9451             __save_CFLAGS="${CFLAGS}"
9452             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9453             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9454 #if defined(FB_API_VER) && FB_API_VER == 30
9455 int fb_api_is_30(void) { return 0; }
9456 #else
9457 #error "Wrong Firebird API version"
9458 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9459             CFLAGS="${__save_CFLAGS}"
9460         fi
9461         ENABLE_FIREBIRD_SDBC=TRUE
9462         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9463     elif test "$enable_database_connectivity" != yes; then
9464         AC_MSG_RESULT([none])
9465     elif test "$cross_compiling" = "yes"; then
9466         AC_MSG_RESULT([none])
9467     else
9468         dnl Embedded Firebird has version 3.0
9469         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9470         dnl We need libatomic_ops for any non X86/X64 system
9471         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9472             dnl ===================================================================
9473             dnl Check for system libatomic_ops
9474             dnl ===================================================================
9475             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9476             if test "$with_system_libatomic_ops" = "yes"; then
9477                 SYSTEM_LIBATOMIC_OPS=TRUE
9478                 AC_CHECK_HEADERS(atomic_ops.h, [],
9479                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9480             else
9481                 SYSTEM_LIBATOMIC_OPS=
9482                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9483                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9484                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9485             fi
9486         fi
9488         AC_MSG_RESULT([internal])
9489         SYSTEM_FIREBIRD=
9490         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9491         FIREBIRD_LIBS="-lfbclient"
9493         if test "$with_system_libtommath" = "yes"; then
9494             SYSTEM_LIBTOMMATH=TRUE
9495             dnl check for tommath presence
9496             save_LIBS=$LIBS
9497             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9498             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9499             LIBS=$save_LIBS
9500         else
9501             SYSTEM_LIBTOMMATH=
9502             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9503             LIBTOMMATH_LIBS="-ltommath"
9504             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9505         fi
9507         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9508         ENABLE_FIREBIRD_SDBC=TRUE
9509         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9510     fi
9512 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9513 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9514 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9515 AC_SUBST(LIBATOMIC_OPS_LIBS)
9516 AC_SUBST(SYSTEM_FIREBIRD)
9517 AC_SUBST(FIREBIRD_CFLAGS)
9518 AC_SUBST(FIREBIRD_LIBS)
9519 AC_SUBST([TOMMATH_CFLAGS])
9520 AC_SUBST([TOMMATH_LIBS])
9522 dnl ===================================================================
9523 dnl Check for system curl
9524 dnl ===================================================================
9525 AC_MSG_CHECKING([which libcurl to use])
9526 if test "$with_system_curl" = "auto"; then
9527     with_system_curl="$with_system_libs"
9530 if test "$with_system_curl" = "yes"; then
9531     AC_MSG_RESULT([external])
9532     SYSTEM_CURL=TRUE
9534     # First try PKGCONFIG and then fall back
9535     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9537     if test -n "$CURL_PKG_ERRORS"; then
9538         AC_PATH_PROG(CURLCONFIG, curl-config)
9539         if test -z "$CURLCONFIG"; then
9540             AC_MSG_ERROR([curl development files not found])
9541         fi
9542         CURL_LIBS=`$CURLCONFIG --libs`
9543         FilterLibs "${CURL_LIBS}"
9544         CURL_LIBS="${filteredlibs}"
9545         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9546         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9548         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9549         case $curl_version in
9550         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9551         dnl so they need to be doubled to end up in the configure script
9552         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9553             AC_MSG_RESULT([yes])
9554             ;;
9555         *)
9556             AC_MSG_ERROR([no, you have $curl_version])
9557             ;;
9558         esac
9559     fi
9561     ENABLE_CURL=TRUE
9562 elif test $_os = iOS; then
9563     # Let's see if we need curl, I think not?
9564     AC_MSG_RESULT([none])
9565     ENABLE_CURL=
9566 else
9567     AC_MSG_RESULT([internal])
9568     SYSTEM_CURL=
9569     BUILD_TYPE="$BUILD_TYPE CURL"
9570     ENABLE_CURL=TRUE
9572 AC_SUBST(SYSTEM_CURL)
9573 AC_SUBST(CURL_CFLAGS)
9574 AC_SUBST(CURL_LIBS)
9575 AC_SUBST(ENABLE_CURL)
9577 dnl ===================================================================
9578 dnl Check for system boost
9579 dnl ===================================================================
9580 AC_MSG_CHECKING([which boost to use])
9581 if test "$with_system_boost" = "yes"; then
9582     AC_MSG_RESULT([external])
9583     SYSTEM_BOOST=TRUE
9584     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
9585     AX_BOOST_DATE_TIME
9586     AX_BOOST_FILESYSTEM
9587     AX_BOOST_IOSTREAMS
9588     AX_BOOST_LOCALE
9589     AC_LANG_PUSH([C++])
9590     save_CXXFLAGS=$CXXFLAGS
9591     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9592     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9593        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9594     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9595        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9596     CXXFLAGS=$save_CXXFLAGS
9597     AC_LANG_POP([C++])
9598     # this is in m4/ax_boost_base.m4
9599     FilterLibs "${BOOST_LDFLAGS}"
9600     BOOST_LDFLAGS="${filteredlibs}"
9601 else
9602     AC_MSG_RESULT([internal])
9603     BUILD_TYPE="$BUILD_TYPE BOOST"
9604     SYSTEM_BOOST=
9605     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9606         # use warning-suppressing wrapper headers
9607         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9608     else
9609         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9610     fi
9612 AC_SUBST(SYSTEM_BOOST)
9614 dnl ===================================================================
9615 dnl Check for system mdds
9616 dnl ===================================================================
9617 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9619 dnl ===================================================================
9620 dnl Check for system glm
9621 dnl ===================================================================
9622 AC_MSG_CHECKING([which glm to use])
9623 if test "$with_system_glm" = "yes"; then
9624     AC_MSG_RESULT([external])
9625     SYSTEM_GLM=TRUE
9626     AC_LANG_PUSH([C++])
9627     AC_CHECK_HEADER([glm/glm.hpp], [],
9628        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9629     AC_LANG_POP([C++])
9630 else
9631     AC_MSG_RESULT([internal])
9632     BUILD_TYPE="$BUILD_TYPE GLM"
9633     SYSTEM_GLM=
9634     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9636 AC_SUBST([GLM_CFLAGS])
9637 AC_SUBST([SYSTEM_GLM])
9639 dnl ===================================================================
9640 dnl Check for system odbc
9641 dnl ===================================================================
9642 AC_MSG_CHECKING([which odbc headers to use])
9643 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
9644     AC_MSG_RESULT([external])
9645     SYSTEM_ODBC_HEADERS=TRUE
9647     if test "$build_os" = "cygwin"; then
9648         save_CPPFLAGS=$CPPFLAGS
9649         find_winsdk
9650         PathFormat "$winsdktest"
9651         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"
9652         AC_CHECK_HEADER(sqlext.h, [],
9653             [AC_MSG_ERROR(odbc not found. install odbc)],
9654             [#include <windows.h>])
9655         CPPFLAGS=$save_CPPFLAGS
9656     else
9657         AC_CHECK_HEADER(sqlext.h, [],
9658             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9659     fi
9660 elif test "$enable_database_connectivity" != yes; then
9661     AC_MSG_RESULT([none])
9662 else
9663     AC_MSG_RESULT([internal])
9664     SYSTEM_ODBC_HEADERS=
9666 AC_SUBST(SYSTEM_ODBC_HEADERS)
9668 dnl ===================================================================
9669 dnl Enable LDAP support
9670 dnl ===================================================================
9672 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9673 AC_MSG_CHECKING([whether to enable LDAP support])
9674     if test "$enable_ldap" != "yes"; then
9675         AC_MSG_RESULT([no])
9676         ENABLE_LDAP=""
9677         enable_ldap=no
9678     else
9679         AC_MSG_RESULT([yes])
9680         ENABLE_LDAP="TRUE"
9681     fi
9683 AC_SUBST(ENABLE_LDAP)
9685 dnl ===================================================================
9686 dnl Check for system openldap
9687 dnl ===================================================================
9689 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9690 AC_MSG_CHECKING([which openldap library to use])
9691 if test "$with_system_openldap" = "yes"; then
9692     AC_MSG_RESULT([external])
9693     SYSTEM_OPENLDAP=TRUE
9694     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9695     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9696     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9697 else
9698     AC_MSG_RESULT([internal])
9699     SYSTEM_OPENLDAP=
9700     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9703 AC_SUBST(SYSTEM_OPENLDAP)
9705 dnl ===================================================================
9706 dnl Check for system NSS
9707 dnl ===================================================================
9708 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9709     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9710     AC_DEFINE(HAVE_FEATURE_NSS)
9711     ENABLE_NSS="TRUE"
9712     AC_DEFINE(ENABLE_NSS)
9713 elif test $_os != iOS ; then
9714     with_tls=openssl
9716 AC_SUBST(ENABLE_NSS)
9718 dnl ===================================================================
9719 dnl Check for TLS/SSL and cryptographic implementation to use
9720 dnl ===================================================================
9721 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9722 if test -n "$with_tls"; then
9723     case $with_tls in
9724     openssl)
9725         AC_DEFINE(USE_TLS_OPENSSL)
9726         TLS=OPENSSL
9728         if test "$enable_openssl" != "yes"; then
9729             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9730         fi
9732         # warn that OpenSSL has been selected but not all TLS code has this option
9733         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9734         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9735         ;;
9736     nss)
9737         AC_DEFINE(USE_TLS_NSS)
9738         TLS=NSS
9739         ;;
9740     no)
9741         AC_MSG_WARN([Skipping TLS/SSL])
9742         ;;
9743     *)
9744         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9745 openssl - OpenSSL
9746 nss - Mozilla's Network Security Services (NSS)
9747     ])
9748         ;;
9749     esac
9750 else
9751     # default to using NSS, it results in smaller oox lib
9752     AC_DEFINE(USE_TLS_NSS)
9753     TLS=NSS
9755 AC_MSG_RESULT([$TLS])
9756 AC_SUBST(TLS)
9758 dnl ===================================================================
9759 dnl Check for system sane
9760 dnl ===================================================================
9761 AC_MSG_CHECKING([which sane header to use])
9762 if test "$with_system_sane" = "yes"; then
9763     AC_MSG_RESULT([external])
9764     AC_CHECK_HEADER(sane/sane.h, [],
9765       [AC_MSG_ERROR(sane not found. install sane)], [])
9766 else
9767     AC_MSG_RESULT([internal])
9768     BUILD_TYPE="$BUILD_TYPE SANE"
9771 dnl ===================================================================
9772 dnl Check for system icu
9773 dnl ===================================================================
9774 SYSTEM_GENBRK=
9775 SYSTEM_GENCCODE=
9776 SYSTEM_GENCMN=
9778 ICU_MAJOR=67
9779 ICU_MINOR=1
9780 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9781 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9782 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9783 AC_MSG_CHECKING([which icu to use])
9784 if test "$with_system_icu" = "yes"; then
9785     AC_MSG_RESULT([external])
9786     SYSTEM_ICU=TRUE
9787     AC_LANG_PUSH([C++])
9788     AC_MSG_CHECKING([for unicode/rbbi.h])
9789     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9790     AC_LANG_POP([C++])
9792     if test "$cross_compiling" != "yes"; then
9793         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9794         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9795         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9796         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9797     fi
9799     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9800         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9801         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9802         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9803         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9804         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9805             AC_MSG_RESULT([yes])
9806         else
9807             AC_MSG_RESULT([no])
9808             if test "$with_system_icu_for_build" != "force"; then
9809                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9810 You can use --with-system-icu-for-build=force to use it anyway.])
9811             fi
9812         fi
9813     fi
9815     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9816         # using the system icu tools can lead to version confusion, use the
9817         # ones from the build environment when cross-compiling
9818         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9819         if test -z "$SYSTEM_GENBRK"; then
9820             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9821         fi
9822         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9823         if test -z "$SYSTEM_GENCCODE"; then
9824             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9825         fi
9826         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9827         if test -z "$SYSTEM_GENCMN"; then
9828             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9829         fi
9830         if test "$ICU_MAJOR" -ge "49"; then
9831             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9832             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9833             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9834         else
9835             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9836             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9837             ICU_RECLASSIFIED_HEBREW_LETTER=
9838         fi
9839     fi
9841     if test "$cross_compiling" = "yes"; then
9842         if test "$ICU_MAJOR" -ge "50"; then
9843             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9844             ICU_MINOR=""
9845         fi
9846     fi
9847 else
9848     AC_MSG_RESULT([internal])
9849     SYSTEM_ICU=
9850     BUILD_TYPE="$BUILD_TYPE ICU"
9851     # surprisingly set these only for "internal" (to be used by various other
9852     # external libs): the system icu-config is quite unhelpful and spits out
9853     # dozens of weird flags and also default path -I/usr/include
9854     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9855     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9857 if test "$ICU_MAJOR" -ge "59"; then
9858     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9859     # with -std=c++11 but not all external libraries can be built with that,
9860     # for those use a bit-compatible typedef uint16_t UChar; see
9861     # icu/source/common/unicode/umachine.h
9862     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9863 else
9864     ICU_UCHAR_TYPE=""
9866 AC_SUBST(SYSTEM_ICU)
9867 AC_SUBST(SYSTEM_GENBRK)
9868 AC_SUBST(SYSTEM_GENCCODE)
9869 AC_SUBST(SYSTEM_GENCMN)
9870 AC_SUBST(ICU_MAJOR)
9871 AC_SUBST(ICU_MINOR)
9872 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9873 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9874 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9875 AC_SUBST(ICU_CFLAGS)
9876 AC_SUBST(ICU_LIBS)
9877 AC_SUBST(ICU_UCHAR_TYPE)
9879 dnl ==================================================================
9880 dnl Breakpad
9881 dnl ==================================================================
9882 DEFAULT_CRASHDUMP_VALUE="true"
9883 AC_MSG_CHECKING([whether to enable breakpad])
9884 if test "$enable_breakpad" != yes; then
9885     AC_MSG_RESULT([no])
9886 else
9887     AC_MSG_RESULT([yes])
9888     ENABLE_BREAKPAD="TRUE"
9889     AC_DEFINE(ENABLE_BREAKPAD)
9890     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9891     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9893     AC_MSG_CHECKING([for disable crash dump])
9894     if test "$enable_crashdump" = no; then
9895         DEFAULT_CRASHDUMP_VALUE="false"
9896         AC_MSG_RESULT([yes])
9897     else
9898        AC_MSG_RESULT([no])
9899     fi
9901     AC_MSG_CHECKING([for crashreport config])
9902     if test "$with_symbol_config" = "no"; then
9903         BREAKPAD_SYMBOL_CONFIG="invalid"
9904         AC_MSG_RESULT([no])
9905     else
9906         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9907         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9908         AC_MSG_RESULT([yes])
9909     fi
9910     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9912 AC_SUBST(ENABLE_BREAKPAD)
9913 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9915 dnl ==================================================================
9916 dnl libfuzzer
9917 dnl ==================================================================
9918 AC_MSG_CHECKING([whether to enable fuzzers])
9919 if test "$enable_fuzzers" != yes; then
9920     AC_MSG_RESULT([no])
9921 else
9922     AC_MSG_RESULT([yes])
9923     ENABLE_FUZZERS="TRUE"
9924     AC_DEFINE([ENABLE_FUZZERS],1)
9925     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9927 AC_SUBST(ENABLE_FUZZERS)
9929 dnl ===================================================================
9930 dnl Orcus
9931 dnl ===================================================================
9932 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9933 if test "$with_system_orcus" != "yes"; then
9934     if test "$SYSTEM_BOOST" = "TRUE"; then
9935         # ===========================================================
9936         # Determine if we are going to need to link with Boost.System
9937         # ===========================================================
9938         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9939         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9940         dnl in documentation has no effect.
9941         AC_MSG_CHECKING([if we need to link with Boost.System])
9942         AC_LANG_PUSH([C++])
9943         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9944                 @%:@include <boost/version.hpp>
9945             ]],[[
9946                 #if BOOST_VERSION >= 105000
9947                 #   error yes, we need to link with Boost.System
9948                 #endif
9949             ]])],[
9950                 AC_MSG_RESULT([no])
9951             ],[
9952                 AC_MSG_RESULT([yes])
9953                 AX_BOOST_SYSTEM
9954         ])
9955         AC_LANG_POP([C++])
9956     fi
9958 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9959 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9960 AC_SUBST([BOOST_SYSTEM_LIB])
9961 AC_SUBST(SYSTEM_LIBORCUS)
9963 dnl ===================================================================
9964 dnl HarfBuzz
9965 dnl ===================================================================
9966 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9967                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9968                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9970 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9971                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9972                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9974 if test "$COM" = "MSC"; then # override the above
9975     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9976     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9979 if test "$with_system_harfbuzz" = "yes"; then
9980     if test "$with_system_graphite" = "no"; then
9981         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9982     fi
9983     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9984     _save_libs="$LIBS"
9985     _save_cflags="$CFLAGS"
9986     LIBS="$LIBS $HARFBUZZ_LIBS"
9987     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9988     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9989     LIBS="$_save_libs"
9990     CFLAGS="$_save_cflags"
9991 else
9992     if test "$with_system_graphite" = "yes"; then
9993         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9994     fi
9997 AC_MSG_CHECKING([whether to use X11])
9998 dnl ***************************************
9999 dnl testing for X libraries and includes...
10000 dnl ***************************************
10001 if test "$USING_X11" = TRUE; then
10002     AC_DEFINE(HAVE_FEATURE_X11)
10004 AC_MSG_RESULT([$USING_X11])
10006 if test "$USING_X11" = TRUE; then
10007     AC_PATH_X
10008     AC_PATH_XTRA
10009     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10011     if test -z "$x_includes"; then
10012         x_includes="default_x_includes"
10013     fi
10014     if test -z "$x_libraries"; then
10015         x_libraries="default_x_libraries"
10016     fi
10017     CFLAGS="$CFLAGS $X_CFLAGS"
10018     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10019     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10020 else
10021     x_includes="no_x_includes"
10022     x_libraries="no_x_libraries"
10025 if test "$USING_X11" = TRUE; then
10026     dnl ===================================================================
10027     dnl Check for extension headers
10028     dnl ===================================================================
10029     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10030      [#include <X11/extensions/shape.h>])
10032     # vcl needs ICE and SM
10033     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10034     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10035         [AC_MSG_ERROR(ICE library not found)])
10036     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10037     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10038         [AC_MSG_ERROR(SM library not found)])
10041 dnl ===================================================================
10042 dnl Check for system Xrender
10043 dnl ===================================================================
10044 AC_MSG_CHECKING([whether to use Xrender])
10045 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10046     AC_MSG_RESULT([yes])
10047     PKG_CHECK_MODULES(XRENDER, xrender)
10048     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10049     FilterLibs "${XRENDER_LIBS}"
10050     XRENDER_LIBS="${filteredlibs}"
10051     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10052       [AC_MSG_ERROR(libXrender not found or functional)], [])
10053     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10054       [AC_MSG_ERROR(Xrender not found. install X)], [])
10055 else
10056     AC_MSG_RESULT([no])
10058 AC_SUBST(XRENDER_CFLAGS)
10059 AC_SUBST(XRENDER_LIBS)
10061 dnl ===================================================================
10062 dnl Check for XRandr
10063 dnl ===================================================================
10064 AC_MSG_CHECKING([whether to enable RandR support])
10065 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10066     AC_MSG_RESULT([yes])
10067     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10068     if test "$ENABLE_RANDR" != "TRUE"; then
10069         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10070                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10071         XRANDR_CFLAGS=" "
10072         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10073           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10074         XRANDR_LIBS="-lXrandr "
10075         ENABLE_RANDR="TRUE"
10076     fi
10077     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10078     FilterLibs "${XRANDR_LIBS}"
10079     XRANDR_LIBS="${filteredlibs}"
10080 else
10081     ENABLE_RANDR=""
10082     AC_MSG_RESULT([no])
10084 AC_SUBST(XRANDR_CFLAGS)
10085 AC_SUBST(XRANDR_LIBS)
10086 AC_SUBST(ENABLE_RANDR)
10088 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10089     WITH_WEBDAV="serf"
10091 if test $_os = iOS -o $_os = Android; then
10092     WITH_WEBDAV="no"
10094 AC_MSG_CHECKING([for webdav library])
10095 case "$WITH_WEBDAV" in
10096 serf)
10097     AC_MSG_RESULT([serf])
10098     # Check for system apr-util
10099     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10100                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10101                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10102     if test "$COM" = "MSC"; then
10103         APR_LIB_DIR="LibR"
10104         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10105         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10106     fi
10108     # Check for system serf
10109     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
10110                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
10111     if test "$COM" = "MSC"; then
10112         SERF_LIB_DIR="Release"
10113         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
10114         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
10115     fi
10116     ;;
10117 neon)
10118     AC_MSG_RESULT([neon])
10119     # Check for system neon
10120     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.1])
10121     if test "$with_system_neon" = "yes"; then
10122         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10123     else
10124         NEON_VERSION=0311
10125     fi
10126     AC_SUBST(NEON_VERSION)
10127     ;;
10129     AC_MSG_RESULT([none, disabled])
10130     WITH_WEBDAV=""
10131     ;;
10132 esac
10133 AC_SUBST(WITH_WEBDAV)
10135 dnl ===================================================================
10136 dnl Check for disabling cve_tests
10137 dnl ===================================================================
10138 AC_MSG_CHECKING([whether to execute CVE tests])
10139 # If not explicitly enabled or disabled, default
10140 if test -z "$enable_cve_tests"; then
10141     case "$OS" in
10142     WNT)
10143         # Default cves off for Windows with its wild and wonderful
10144         # variety of AV software kicking in and panicking
10145         enable_cve_tests=no
10146         ;;
10147     *)
10148         # otherwise yes
10149         enable_cve_tests=yes
10150         ;;
10151     esac
10153 if test "$enable_cve_tests" = "no"; then
10154     AC_MSG_RESULT([no])
10155     DISABLE_CVE_TESTS=TRUE
10156     AC_SUBST(DISABLE_CVE_TESTS)
10157 else
10158     AC_MSG_RESULT([yes])
10161 dnl ===================================================================
10162 dnl Check for enabling chart XShape tests
10163 dnl ===================================================================
10164 AC_MSG_CHECKING([whether to execute chart XShape tests])
10165 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10166     AC_MSG_RESULT([yes])
10167     ENABLE_CHART_TESTS=TRUE
10168     AC_SUBST(ENABLE_CHART_TESTS)
10169 else
10170     AC_MSG_RESULT([no])
10173 dnl ===================================================================
10174 dnl Check for system openssl
10175 dnl ===================================================================
10176 DISABLE_OPENSSL=
10177 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10178 if test "$enable_openssl" = "yes"; then
10179     AC_MSG_RESULT([no])
10180     if test "$_os" = Darwin ; then
10181         # OpenSSL is deprecated when building for 10.7 or later.
10182         #
10183         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10184         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10186         with_system_openssl=no
10187         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10188     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10189             && test "$with_system_openssl" != "no"; then
10190         with_system_openssl=yes
10191         SYSTEM_OPENSSL=TRUE
10192         OPENSSL_CFLAGS=
10193         OPENSSL_LIBS="-lssl -lcrypto"
10194     else
10195         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10196     fi
10197     if test "$with_system_openssl" = "yes"; then
10198         AC_MSG_CHECKING([whether openssl supports SHA512])
10199         AC_LANG_PUSH([C])
10200         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10201             SHA512_CTX context;
10202 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10203         AC_LANG_POP(C)
10204     fi
10205 else
10206     AC_MSG_RESULT([yes])
10207     DISABLE_OPENSSL=TRUE
10209     # warn that although OpenSSL is disabled, system libraries may depend on it
10210     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10211     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10214 AC_SUBST([DISABLE_OPENSSL])
10216 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10217     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10218         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10219         enable_cipher_openssl_backend=no
10220     else
10221         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10222     fi
10224 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10225 ENABLE_CIPHER_OPENSSL_BACKEND=
10226 if test "$enable_cipher_openssl_backend" = yes; then
10227     AC_MSG_RESULT([yes])
10228     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10229 else
10230     AC_MSG_RESULT([no])
10232 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10234 dnl ===================================================================
10235 dnl Check for building gnutls
10236 dnl ===================================================================
10237 AC_MSG_CHECKING([whether to use gnutls])
10238 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10239     AC_MSG_RESULT([yes])
10240     AM_PATH_LIBGCRYPT()
10241     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10242         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10243                       available in the system to use as replacement.]]))
10244     FilterLibs "${LIBGCRYPT_LIBS}"
10245     LIBGCRYPT_LIBS="${filteredlibs}"
10246 else
10247     AC_MSG_RESULT([no])
10250 AC_SUBST([LIBGCRYPT_CFLAGS])
10251 AC_SUBST([LIBGCRYPT_LIBS])
10253 dnl ===================================================================
10254 dnl Check for system redland
10255 dnl ===================================================================
10256 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10257 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10258 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10259 if test "$with_system_redland" = "yes"; then
10260     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10261             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10262 else
10263     RAPTOR_MAJOR="0"
10264     RASQAL_MAJOR="3"
10265     REDLAND_MAJOR="0"
10267 AC_SUBST(RAPTOR_MAJOR)
10268 AC_SUBST(RASQAL_MAJOR)
10269 AC_SUBST(REDLAND_MAJOR)
10271 dnl ===================================================================
10272 dnl Check for system hunspell
10273 dnl ===================================================================
10274 AC_MSG_CHECKING([which libhunspell to use])
10275 if test "$_os" = iOS; then
10276    AC_MSG_RESULT([none])
10277 elif test "$with_system_hunspell" = "yes"; then
10278     AC_MSG_RESULT([external])
10279     SYSTEM_HUNSPELL=TRUE
10280     AC_LANG_PUSH([C++])
10281     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10282     if test "$HUNSPELL_PC" != "TRUE"; then
10283         AC_CHECK_HEADER(hunspell.hxx, [],
10284             [
10285             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10286             [AC_MSG_ERROR(hunspell headers not found.)], [])
10287             ], [])
10288         AC_CHECK_LIB([hunspell], [main], [:],
10289            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10290         HUNSPELL_LIBS=-lhunspell
10291     fi
10292     AC_LANG_POP([C++])
10293     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10294     FilterLibs "${HUNSPELL_LIBS}"
10295     HUNSPELL_LIBS="${filteredlibs}"
10296 else
10297     AC_MSG_RESULT([internal])
10298     SYSTEM_HUNSPELL=
10299     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10300     if test "$COM" = "MSC"; then
10301         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10302     else
10303         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10304     fi
10305     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10307 AC_SUBST(SYSTEM_HUNSPELL)
10308 AC_SUBST(HUNSPELL_CFLAGS)
10309 AC_SUBST(HUNSPELL_LIBS)
10311 dnl ===================================================================
10312 dnl Check for system qrcodegen
10313 dnl ===================================================================
10314 AC_MSG_CHECKING([which libqrcodegen to use])
10315 if test "$with_system_qrcodegen" = "yes"; then
10316     AC_MSG_RESULT([external])
10317     SYSTEM_QRCODEGEN=TRUE
10318     AC_LANG_PUSH([C++])
10319     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10320         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10321     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10322         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10323     QRCODEGEN_LIBS=-lqrcodegencpp
10324     AC_LANG_POP([C++])
10325     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10326     FilterLibs "${QRCODEGEN_LIBS}"
10327     QRCODEGEN_LIBS="${filteredlibs}"
10328 else
10329     AC_MSG_RESULT([internal])
10330     SYSTEM_QRCODEGEN=
10331     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10333 AC_SUBST(SYSTEM_QRCODEGEN)
10334 AC_SUBST(QRCODEGEN_CFLAGS)
10335 AC_SUBST(QRCODEGEN_LIBS)
10337 dnl ===================================================================
10338 dnl Check for system box2d
10339 dnl ===================================================================
10340 AC_MSG_CHECKING([which box2d to use])
10341 if test "$with_system_box2d" = "yes"; then
10342     AC_MSG_RESULT([external])
10343     SYSTEM_BOX2D=TRUE
10344     AC_LANG_PUSH([C++])
10345     AC_CHECK_HEADER(Box2D/Box2D.h, [],
10346         [AC_MSG_ERROR(box2d headers not found.)], [])
10347     AC_CHECK_LIB([Box2D], [main], [:],
10348         [ AC_MSG_ERROR(box2d library not found.) ], [])
10349     BOX2D_LIBS=-lBox2D
10350     AC_LANG_POP([C++])
10351     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10352     FilterLibs "${BOX2D_LIBS}"
10353     BOX2D_LIBS="${filteredlibs}"
10354 else
10355     AC_MSG_RESULT([internal])
10356     SYSTEM_BOX2D=
10357     BUILD_TYPE="$BUILD_TYPE BOX2D"
10359 AC_SUBST(SYSTEM_BOX2D)
10360 AC_SUBST(BOX2D_CFLAGS)
10361 AC_SUBST(BOX2D_LIBS)
10363 dnl ===================================================================
10364 dnl Checking for altlinuxhyph
10365 dnl ===================================================================
10366 AC_MSG_CHECKING([which altlinuxhyph to use])
10367 if test "$with_system_altlinuxhyph" = "yes"; then
10368     AC_MSG_RESULT([external])
10369     SYSTEM_HYPH=TRUE
10370     AC_CHECK_HEADER(hyphen.h, [],
10371        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10372     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10373        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10374        [#include <hyphen.h>])
10375     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10376         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10377     if test -z "$HYPHEN_LIB"; then
10378         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10379            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10380     fi
10381     if test -z "$HYPHEN_LIB"; then
10382         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10383            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10384     fi
10385 else
10386     AC_MSG_RESULT([internal])
10387     SYSTEM_HYPH=
10388     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10389     if test "$COM" = "MSC"; then
10390         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10391     else
10392         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10393     fi
10395 AC_SUBST(SYSTEM_HYPH)
10396 AC_SUBST(HYPHEN_LIB)
10398 dnl ===================================================================
10399 dnl Checking for mythes
10400 dnl ===================================================================
10401 AC_MSG_CHECKING([which mythes to use])
10402 if test "$_os" = iOS; then
10403    AC_MSG_RESULT([none])
10404 elif test "$with_system_mythes" = "yes"; then
10405     AC_MSG_RESULT([external])
10406     SYSTEM_MYTHES=TRUE
10407     AC_LANG_PUSH([C++])
10408     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10409     if test "$MYTHES_PKGCONFIG" = "no"; then
10410         AC_CHECK_HEADER(mythes.hxx, [],
10411             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10412         AC_CHECK_LIB([mythes-1.2], [main], [:],
10413             [ MYTHES_FOUND=no], [])
10414     if test "$MYTHES_FOUND" = "no"; then
10415         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10416                 [ MYTHES_FOUND=no], [])
10417     fi
10418     if test "$MYTHES_FOUND" = "no"; then
10419         AC_MSG_ERROR([mythes library not found!.])
10420     fi
10421     fi
10422     AC_LANG_POP([C++])
10423     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10424     FilterLibs "${MYTHES_LIBS}"
10425     MYTHES_LIBS="${filteredlibs}"
10426 else
10427     AC_MSG_RESULT([internal])
10428     SYSTEM_MYTHES=
10429     BUILD_TYPE="$BUILD_TYPE MYTHES"
10430     if test "$COM" = "MSC"; then
10431         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10432     else
10433         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10434     fi
10436 AC_SUBST(SYSTEM_MYTHES)
10437 AC_SUBST(MYTHES_CFLAGS)
10438 AC_SUBST(MYTHES_LIBS)
10440 dnl ===================================================================
10441 dnl How should we build the linear programming solver ?
10442 dnl ===================================================================
10444 ENABLE_COINMP=
10445 AC_MSG_CHECKING([whether to build with CoinMP])
10446 if test "$enable_coinmp" != "no"; then
10447     ENABLE_COINMP=TRUE
10448     AC_MSG_RESULT([yes])
10449     if test "$with_system_coinmp" = "yes"; then
10450         SYSTEM_COINMP=TRUE
10451         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10452         FilterLibs "${COINMP_LIBS}"
10453         COINMP_LIBS="${filteredlibs}"
10454     else
10455         BUILD_TYPE="$BUILD_TYPE COINMP"
10456     fi
10457 else
10458     AC_MSG_RESULT([no])
10460 AC_SUBST(ENABLE_COINMP)
10461 AC_SUBST(SYSTEM_COINMP)
10462 AC_SUBST(COINMP_CFLAGS)
10463 AC_SUBST(COINMP_LIBS)
10465 ENABLE_LPSOLVE=
10466 AC_MSG_CHECKING([whether to build with lpsolve])
10467 if test "$enable_lpsolve" != "no"; then
10468     ENABLE_LPSOLVE=TRUE
10469     AC_MSG_RESULT([yes])
10470 else
10471     AC_MSG_RESULT([no])
10473 AC_SUBST(ENABLE_LPSOLVE)
10475 if test "$ENABLE_LPSOLVE" = TRUE; then
10476     AC_MSG_CHECKING([which lpsolve to use])
10477     if test "$with_system_lpsolve" = "yes"; then
10478         AC_MSG_RESULT([external])
10479         SYSTEM_LPSOLVE=TRUE
10480         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10481            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10482         save_LIBS=$LIBS
10483         # some systems need this. Like Ubuntu...
10484         AC_CHECK_LIB(m, floor)
10485         AC_CHECK_LIB(dl, dlopen)
10486         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10487             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10488         LIBS=$save_LIBS
10489     else
10490         AC_MSG_RESULT([internal])
10491         SYSTEM_LPSOLVE=
10492         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10493     fi
10495 AC_SUBST(SYSTEM_LPSOLVE)
10497 dnl ===================================================================
10498 dnl Checking for libexttextcat
10499 dnl ===================================================================
10500 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10501 if test "$with_system_libexttextcat" = "yes"; then
10502     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10504 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10506 dnl ===================================================================
10507 dnl Checking for libnumbertext
10508 dnl ===================================================================
10509 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10510 if test "$with_system_libnumbertext" = "yes"; then
10511     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10512     SYSTEM_LIBNUMBERTEXT=YES
10513 else
10514     SYSTEM_LIBNUMBERTEXT=
10515     AC_LANG_PUSH([C++])
10516     save_CPPFLAGS=$CPPFLAGS
10517     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10518     AC_CHECK_HEADERS([codecvt regex])
10519     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10520             [ LIBNUMBERTEXT_CFLAGS=''
10521               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10522                            Enable libnumbertext fallback (missing number to number name conversion).])
10523             ])
10524     CPPFLAGS=$save_CPPFLAGS
10525     AC_LANG_POP([C++])
10527 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10528 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10529 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10531 dnl ***************************************
10532 dnl testing libc version for Linux...
10533 dnl ***************************************
10534 if test "$_os" = "Linux"; then
10535     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10536     exec 6>/dev/null # no output
10537     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10538     exec 6>&1 # output on again
10539     if test "$HAVE_LIBC"; then
10540         AC_MSG_RESULT([yes])
10541     else
10542         AC_MSG_ERROR([no, upgrade libc])
10543     fi
10546 dnl =========================================
10547 dnl Check for uuidgen
10548 dnl =========================================
10549 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10550     # presence is already tested above in the WINDOWS_SDK_HOME check
10551     UUIDGEN=uuidgen.exe
10552     AC_SUBST(UUIDGEN)
10553 else
10554     AC_PATH_PROG([UUIDGEN], [uuidgen])
10555     if test -z "$UUIDGEN"; then
10556         AC_MSG_WARN([uuid is needed for building installation sets])
10557     fi
10560 dnl ***************************************
10561 dnl Checking for bison and flex
10562 dnl ***************************************
10563 AC_PATH_PROG(BISON, bison)
10564 if test -z "$BISON"; then
10565     AC_MSG_ERROR([no bison found in \$PATH, install it])
10566 else
10567     AC_MSG_CHECKING([the bison version])
10568     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10569     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10570     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
10571     dnl cause
10572     dnl
10573     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]
10574     dnl   typedef union YYSTYPE
10575     dnl           ~~~~~~^~~~~~~
10576     dnl
10577     dnl while at least 3.4.1 is know to be good:
10578     if test "$COMPILER_PLUGINS" = TRUE; then
10579         if test "$_bison_longver" -lt 2004; then
10580             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
10581         fi
10582     else
10583         if test "$_bison_longver" -lt 2000; then
10584             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10585         fi
10586     fi
10588 AC_SUBST([BISON])
10590 AC_PATH_PROG(FLEX, flex)
10591 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10592     FLEX=`cygpath -m $FLEX`
10594 if test -z "$FLEX"; then
10595     AC_MSG_ERROR([no flex found in \$PATH, install it])
10596 else
10597     AC_MSG_CHECKING([the flex version])
10598     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10599     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10600         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10601     fi
10603 AC_SUBST([FLEX])
10604 dnl ***************************************
10605 dnl Checking for patch
10606 dnl ***************************************
10607 AC_PATH_PROG(PATCH, patch)
10608 if test -z "$PATCH"; then
10609     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10612 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10613 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10614     if test -z "$with_gnu_patch"; then
10615         GNUPATCH=$PATCH
10616     else
10617         if test -x "$with_gnu_patch"; then
10618             GNUPATCH=$with_gnu_patch
10619         else
10620             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10621         fi
10622     fi
10624     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10625     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10626         AC_MSG_RESULT([yes])
10627     else
10628         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10629     fi
10630 else
10631     GNUPATCH=$PATCH
10634 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10635     GNUPATCH=`cygpath -m $GNUPATCH`
10638 dnl We also need to check for --with-gnu-cp
10640 if test -z "$with_gnu_cp"; then
10641     # check the place where the good stuff is hidden on Solaris...
10642     if test -x /usr/gnu/bin/cp; then
10643         GNUCP=/usr/gnu/bin/cp
10644     else
10645         AC_PATH_PROGS(GNUCP, gnucp cp)
10646     fi
10647     if test -z $GNUCP; then
10648         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10649     fi
10650 else
10651     if test -x "$with_gnu_cp"; then
10652         GNUCP=$with_gnu_cp
10653     else
10654         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10655     fi
10658 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10659     GNUCP=`cygpath -m $GNUCP`
10662 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10663 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10664     AC_MSG_RESULT([yes])
10665 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10666     AC_MSG_RESULT([yes])
10667 else
10668     case "$build_os" in
10669     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10670         x_GNUCP=[\#]
10671         GNUCP=''
10672         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10673         ;;
10674     *)
10675         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10676         ;;
10677     esac
10680 AC_SUBST(GNUPATCH)
10681 AC_SUBST(GNUCP)
10682 AC_SUBST(x_GNUCP)
10684 dnl ***************************************
10685 dnl testing assembler path
10686 dnl ***************************************
10687 ML_EXE=""
10688 if test "$_os" = "WINNT"; then
10689     if test "$BITNESS_OVERRIDE" = ""; then
10690         assembler=ml.exe
10691     else
10692         assembler=ml64.exe
10693     fi
10695     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10696     if test -f "$CL_PATH/$assembler"; then
10697         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10698         AC_MSG_RESULT([$ML_EXE])
10699     else
10700         AC_MSG_ERROR([not found])
10701     fi
10704 AC_SUBST(ML_EXE)
10706 dnl ===================================================================
10707 dnl We need zip and unzip
10708 dnl ===================================================================
10709 AC_PATH_PROG(ZIP, zip)
10710 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10711 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10712     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],,)
10715 AC_PATH_PROG(UNZIP, unzip)
10716 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10718 dnl ===================================================================
10719 dnl Zip must be a specific type for different build types.
10720 dnl ===================================================================
10721 if test $build_os = cygwin; then
10722     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10723         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10724     fi
10727 dnl ===================================================================
10728 dnl We need touch with -h option support.
10729 dnl ===================================================================
10730 AC_PATH_PROG(TOUCH, touch)
10731 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10732 touch warn
10733 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10734     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],,)
10737 dnl ===================================================================
10738 dnl Check for system epoxy
10739 dnl ===================================================================
10740 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10742 dnl ===================================================================
10743 dnl Set vcl option: coordinate device in double or sal_Int32
10744 dnl ===================================================================
10746 dnl disabled for now, we don't want subtle differences between OSs
10747 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10748 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10749 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10750 dnl     AC_MSG_RESULT([double])
10751 dnl else
10752 dnl     AC_MSG_RESULT([sal_Int32])
10753 dnl fi
10755 dnl ===================================================================
10756 dnl Test which vclplugs have to be built.
10757 dnl ===================================================================
10758 R=""
10759 if test "$USING_X11" != TRUE; then
10760     enable_gtk3=no
10763 ENABLE_GTK3=""
10764 if test "x$enable_gtk3" = "xyes"; then
10765     ENABLE_GTK3="TRUE"
10766     AC_DEFINE(ENABLE_GTK3)
10767     R="$R gtk3"
10769 AC_SUBST(ENABLE_GTK3)
10771 ENABLE_GTK3_KDE5=""
10772 if test "x$enable_gtk3_kde5" = "xyes"; then
10773     ENABLE_GTK3_KDE5="TRUE"
10774     AC_DEFINE(ENABLE_GTK3_KDE5)
10775     R="$R gtk3_kde5"
10777 AC_SUBST(ENABLE_GTK3_KDE5)
10779 ENABLE_QT5=""
10780 if test "x$enable_qt5" = "xyes"; then
10781     ENABLE_QT5="TRUE"
10782     AC_DEFINE(ENABLE_QT5)
10783     R="$R qt5"
10785 AC_SUBST(ENABLE_QT5)
10787 ENABLE_KF5=""
10788 if test "x$enable_kf5" = "xyes"; then
10789     ENABLE_KF5="TRUE"
10790     AC_DEFINE(ENABLE_KF5)
10791     R="$R kf5"
10793 AC_SUBST(ENABLE_KF5)
10795 GTK3_CFLAGS=""
10796 GTK3_LIBS=""
10797 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
10798     if test "$with_system_cairo" = no; then
10799         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10800     fi
10801     : ${with_system_cairo:=yes}
10802     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)
10803     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10804     FilterLibs "${GTK3_LIBS}"
10805     GTK3_LIBS="${filteredlibs}"
10807     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10808     if test "$with_system_epoxy" != "yes"; then
10809         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10810         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10811                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10812     fi
10814 AC_SUBST(GTK3_LIBS)
10815 AC_SUBST(GTK3_CFLAGS)
10817 if test "$enable_introspection" = yes; then
10818     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
10819         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10820     else
10821         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10822     fi
10825 if test "$_os" = "WINNT"; then
10826     R="$R win"
10827 elif test "$_os" = "Darwin"; then
10828     R="$R osx"
10829 elif test "$_os" = "iOS"; then
10830     R="ios (builtin)"
10833 build_vcl_plugins="$R"
10834 if test -z "$build_vcl_plugins"; then
10835     build_vcl_plugins="none"
10837 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10839 dnl ===================================================================
10840 dnl check for dbus support
10841 dnl ===================================================================
10842 ENABLE_DBUS=""
10843 DBUS_CFLAGS=""
10844 DBUS_LIBS=""
10845 DBUS_GLIB_CFLAGS=""
10846 DBUS_GLIB_LIBS=""
10847 DBUS_HAVE_GLIB=""
10849 if test "$enable_dbus" = "no"; then
10850     test_dbus=no
10853 AC_MSG_CHECKING([whether to enable DBUS support])
10854 if test "$test_dbus" = "yes"; then
10855     ENABLE_DBUS="TRUE"
10856     AC_MSG_RESULT([yes])
10857     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10858     AC_DEFINE(ENABLE_DBUS)
10859     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10860     FilterLibs "${DBUS_LIBS}"
10861     DBUS_LIBS="${filteredlibs}"
10863     # Glib is needed for BluetoothServer
10864     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10865     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10866         [
10867             DBUS_HAVE_GLIB="TRUE"
10868             AC_DEFINE(DBUS_HAVE_GLIB,1)
10869         ],
10870         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10871     )
10872 else
10873     AC_MSG_RESULT([no])
10876 AC_SUBST(ENABLE_DBUS)
10877 AC_SUBST(DBUS_CFLAGS)
10878 AC_SUBST(DBUS_LIBS)
10879 AC_SUBST(DBUS_GLIB_CFLAGS)
10880 AC_SUBST(DBUS_GLIB_LIBS)
10881 AC_SUBST(DBUS_HAVE_GLIB)
10883 AC_MSG_CHECKING([whether to enable Impress remote control])
10884 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10885     AC_MSG_RESULT([yes])
10886     ENABLE_SDREMOTE=TRUE
10887     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10889     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
10890         # The Bluetooth code doesn't compile with macOS SDK 10.15
10891         if test "$enable_sdremote_bluetooth" = yes; then
10892             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
10893         fi
10894         enable_sdremote_bluetooth=no
10895     fi
10896     # If not explicitly enabled or disabled, default
10897     if test -z "$enable_sdremote_bluetooth"; then
10898         case "$OS" in
10899         LINUX|MACOSX|WNT)
10900             # Default to yes for these
10901             enable_sdremote_bluetooth=yes
10902             ;;
10903         *)
10904             # otherwise no
10905             enable_sdremote_bluetooth=no
10906             ;;
10907         esac
10908     fi
10909     # $enable_sdremote_bluetooth is guaranteed non-empty now
10911     if test "$enable_sdremote_bluetooth" != "no"; then
10912         if test "$OS" = "LINUX"; then
10913             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10914                 AC_MSG_RESULT([yes])
10915                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10916                 dnl ===================================================================
10917                 dnl Check for system bluez
10918                 dnl ===================================================================
10919                 AC_MSG_CHECKING([which Bluetooth header to use])
10920                 if test "$with_system_bluez" = "yes"; then
10921                     AC_MSG_RESULT([external])
10922                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10923                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10924                     SYSTEM_BLUEZ=TRUE
10925                 else
10926                     AC_MSG_RESULT([internal])
10927                     SYSTEM_BLUEZ=
10928                 fi
10929             else
10930                 AC_MSG_RESULT([no, dbus disabled])
10931                 ENABLE_SDREMOTE_BLUETOOTH=
10932                 SYSTEM_BLUEZ=
10933             fi
10934         else
10935             AC_MSG_RESULT([yes])
10936             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10937             SYSTEM_BLUEZ=
10938         fi
10939     else
10940         AC_MSG_RESULT([no])
10941         ENABLE_SDREMOTE_BLUETOOTH=
10942         SYSTEM_BLUEZ=
10943     fi
10944 else
10945     ENABLE_SDREMOTE=
10946     SYSTEM_BLUEZ=
10947     AC_MSG_RESULT([no])
10949 AC_SUBST(ENABLE_SDREMOTE)
10950 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10951 AC_SUBST(SYSTEM_BLUEZ)
10953 dnl ===================================================================
10954 dnl Check whether to enable GIO support
10955 dnl ===================================================================
10956 if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
10957     AC_MSG_CHECKING([whether to enable GIO support])
10958     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10959         dnl Need at least 2.26 for the dbus support.
10960         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10961                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10962         if test "$ENABLE_GIO" = "TRUE"; then
10963             AC_DEFINE(ENABLE_GIO)
10964             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10965             FilterLibs "${GIO_LIBS}"
10966             GIO_LIBS="${filteredlibs}"
10967         fi
10968     else
10969         AC_MSG_RESULT([no])
10970     fi
10972 AC_SUBST(ENABLE_GIO)
10973 AC_SUBST(GIO_CFLAGS)
10974 AC_SUBST(GIO_LIBS)
10977 dnl ===================================================================
10979 SPLIT_APP_MODULES=""
10980 if test "$enable_split_app_modules" = "yes"; then
10981     SPLIT_APP_MODULES="TRUE"
10983 AC_SUBST(SPLIT_APP_MODULES)
10985 SPLIT_OPT_FEATURES=""
10986 if test "$enable_split_opt_features" = "yes"; then
10987     SPLIT_OPT_FEATURES="TRUE"
10989 AC_SUBST(SPLIT_OPT_FEATURES)
10991 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10992     if test "$enable_cairo_canvas" = yes; then
10993         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10994     fi
10995     enable_cairo_canvas=no
10996 elif test -z "$enable_cairo_canvas"; then
10997     enable_cairo_canvas=yes
11000 ENABLE_CAIRO_CANVAS=""
11001 if test "$enable_cairo_canvas" = "yes"; then
11002     test_cairo=yes
11003     ENABLE_CAIRO_CANVAS="TRUE"
11004     AC_DEFINE(ENABLE_CAIRO_CANVAS)
11006 AC_SUBST(ENABLE_CAIRO_CANVAS)
11008 dnl ===================================================================
11009 dnl Check whether the GStreamer libraries are available.
11010 dnl ===================================================================
11012 ENABLE_GSTREAMER_1_0=""
11014 if test "$build_gstreamer_1_0" = "yes"; then
11016     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11017     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11018         ENABLE_GSTREAMER_1_0="TRUE"
11019         AC_MSG_RESULT([yes])
11020         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11021         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11022         FilterLibs "${GSTREAMER_1_0_LIBS}"
11023         GSTREAMER_1_0_LIBS="${filteredlibs}"
11024         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11025     else
11026         AC_MSG_RESULT([no])
11027     fi
11029 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11030 AC_SUBST(GSTREAMER_1_0_LIBS)
11031 AC_SUBST(ENABLE_GSTREAMER_1_0)
11033 dnl ===================================================================
11034 dnl Check whether to build the VLC avmedia backend
11035 dnl ===================================================================
11037 ENABLE_VLC=""
11039 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
11040 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
11041     ENABLE_VLC="TRUE"
11042     AC_MSG_RESULT([yes])
11043 else
11044     AC_MSG_RESULT([no])
11046 AC_SUBST(ENABLE_VLC)
11048 ENABLE_OPENGL_TRANSITIONS=
11049 ENABLE_OPENGL_CANVAS=
11050 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11051    : # disable
11052 elif test "$_os" = "Darwin"; then
11053     # We use frameworks on macOS, no need for detail checks
11054     ENABLE_OPENGL_TRANSITIONS=TRUE
11055     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11056     ENABLE_OPENGL_CANVAS=TRUE
11057 elif test $_os = WINNT; then
11058     ENABLE_OPENGL_TRANSITIONS=TRUE
11059     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11060     ENABLE_OPENGL_CANVAS=TRUE
11061 else
11062     if test "$USING_X11" = TRUE; then
11063         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11064         ENABLE_OPENGL_TRANSITIONS=TRUE
11065         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11066         ENABLE_OPENGL_CANVAS=TRUE
11067     fi
11070 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11071 AC_SUBST(ENABLE_OPENGL_CANVAS)
11073 dnl =================================================
11074 dnl Check whether to build with OpenCL support.
11075 dnl =================================================
11077 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
11078     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11079     # platform (optional at run-time, used through clew).
11080     BUILD_TYPE="$BUILD_TYPE OPENCL"
11081     AC_DEFINE(HAVE_FEATURE_OPENCL)
11084 dnl =================================================
11085 dnl Check whether to build with dconf support.
11086 dnl =================================================
11088 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11089     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11090         if test "$enable_dconf" = yes; then
11091             AC_MSG_ERROR([dconf not found])
11092         else
11093             enable_dconf=no
11094         fi])
11096 AC_MSG_CHECKING([whether to enable dconf])
11097 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11098     DCONF_CFLAGS=
11099     DCONF_LIBS=
11100     ENABLE_DCONF=
11101     AC_MSG_RESULT([no])
11102 else
11103     ENABLE_DCONF=TRUE
11104     AC_DEFINE(ENABLE_DCONF)
11105     AC_MSG_RESULT([yes])
11107 AC_SUBST([DCONF_CFLAGS])
11108 AC_SUBST([DCONF_LIBS])
11109 AC_SUBST([ENABLE_DCONF])
11111 # pdf import?
11112 AC_MSG_CHECKING([whether to build the PDF import feature])
11113 ENABLE_PDFIMPORT=
11114 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
11115     AC_MSG_RESULT([yes])
11116     ENABLE_PDFIMPORT=TRUE
11117     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11118 else
11119     AC_MSG_RESULT([no])
11122 # Pdfium?
11123 AC_MSG_CHECKING([whether to build PDFium])
11124 ENABLE_PDFIUM=
11125 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11126     AC_MSG_RESULT([yes])
11127     ENABLE_PDFIUM=TRUE
11128     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11129     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11130 else
11131     AC_MSG_RESULT([no])
11133 AC_SUBST(ENABLE_PDFIUM)
11135 dnl ===================================================================
11136 dnl Check for poppler
11137 dnl ===================================================================
11138 ENABLE_POPPLER=
11139 AC_MSG_CHECKING([whether to build Poppler])
11140 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11141     AC_MSG_RESULT([yes])
11142     ENABLE_POPPLER=TRUE
11143     AC_DEFINE(HAVE_FEATURE_POPPLER)
11144 else
11145     AC_MSG_RESULT([no])
11147 AC_SUBST(ENABLE_POPPLER)
11149 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11150     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11153 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11154     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11157 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11158     dnl ===================================================================
11159     dnl Check for system poppler
11160     dnl ===================================================================
11161     AC_MSG_CHECKING([which PDF import poppler to use])
11162     if test "$with_system_poppler" = "yes"; then
11163         AC_MSG_RESULT([external])
11164         SYSTEM_POPPLER=TRUE
11165         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11166         AC_LANG_PUSH([C++])
11167         save_CXXFLAGS=$CXXFLAGS
11168         save_CPPFLAGS=$CPPFLAGS
11169         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11170         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11171         AC_CHECK_HEADER([cpp/poppler-version.h],
11172             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11173             [])
11174         CXXFLAGS=$save_CXXFLAGS
11175         CPPFLAGS=$save_CPPFLAGS
11176         AC_LANG_POP([C++])
11177         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11179         FilterLibs "${POPPLER_LIBS}"
11180         POPPLER_LIBS="${filteredlibs}"
11181     else
11182         AC_MSG_RESULT([internal])
11183         SYSTEM_POPPLER=
11184         BUILD_TYPE="$BUILD_TYPE POPPLER"
11185         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11186     fi
11187     AC_DEFINE([ENABLE_PDFIMPORT],1)
11189 AC_SUBST(ENABLE_PDFIMPORT)
11190 AC_SUBST(SYSTEM_POPPLER)
11191 AC_SUBST(POPPLER_CFLAGS)
11192 AC_SUBST(POPPLER_LIBS)
11194 # Skia?
11195 AC_MSG_CHECKING([whether to build Skia])
11196 ENABLE_SKIA=
11197 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
11198     if test "$enable_skia" = "debug"; then
11199         AC_MSG_RESULT([yes (debug)])
11200         ENABLE_SKIA_DEBUG=TRUE
11201     else
11202         AC_MSG_RESULT([yes])
11203         ENABLE_SKIA_DEBUG=
11204     fi
11205     ENABLE_SKIA=TRUE
11206     AC_DEFINE(HAVE_FEATURE_SKIA)
11207     BUILD_TYPE="$BUILD_TYPE SKIA"
11208 else
11209     AC_MSG_RESULT([no])
11211 AC_SUBST(ENABLE_SKIA)
11212 AC_SUBST(ENABLE_SKIA_DEBUG)
11214 CLANG_CXXFLAGS_INTRINSICS_SSE2=
11215 CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11216 CLANG_CXXFLAGS_INTRINSICS_SSE41=
11217 CLANG_CXXFLAGS_INTRINSICS_SSE42=
11218 CLANG_CXXFLAGS_INTRINSICS_AVX=
11219 CLANG_CXXFLAGS_INTRINSICS_AVX2=
11220 CLANG_CXXFLAGS_INTRINSICS_AVX512=
11221 CLANG_CXXFLAGS_INTRINSICS_F16C=
11222 CLANG_CXXFLAGS_INTRINSICS_FMA=
11224 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
11225     if test -n "$CLANG_CC" -a -n "$CLANG_CXX"; then
11226         AC_MSG_CHECKING([for Clang])
11227         AC_MSG_RESULT([$CLANG_CC / $CLANG_CXX])
11228     else
11229         if test "$_os" = "WINNT"; then
11230             AC_MSG_CHECKING([for clang-cl])
11231             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11232                 CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11233                 dnl explicitly set -m32/-m64
11234                 if test "$BITNESS_OVERRIDE" = ""; then
11235                     CLANG_CC="$CLANG_CC -m32"
11236                 else
11237                     CLANG_CC="$CLANG_CC -m64"
11238                 fi
11239                 CLANG_CXX="$CLANG_CC"
11240                 AC_MSG_RESULT([$CLANG_CC])
11241             else
11242                 AC_MSG_RESULT([no])
11243             fi
11244         else
11245             AC_CHECK_PROG(CLANG_CC,clang,clang,[])
11246             AC_CHECK_PROG(CLANG_CXX,clang++,clang++,[])
11247         fi
11248     fi
11249     if test -n "$CLANG_CC" -a -n "$CLANG_CXX"; then
11250         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CLANG_CC -E - | tail -1 | sed 's/ //g'`
11251         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11252         if test "$clang2_ver" -lt 50002; then
11253             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11254             CLANG_CC=
11255             CLANG_CXX=
11256         fi
11257     fi
11258     if test -z "$CLANG_CC" -o -z "$CLANG_CXX"; then
11259         # Skia is the default on Windows, so hard-require Clang.
11260         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11261         if test "$_os" = "WINNT"; then
11262             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11263         else
11264             AC_MSG_WARN([Clang compiler not found.])
11265         fi
11266     else
11268         save_CXX="$CXX"
11269         CXX="$CLANG_CXX"
11270         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11271         flag_sse2=-msse2
11272         flag_ssse3=-mssse3
11273         flag_sse41=-msse4.1
11274         flag_sse42=-msse4.2
11275         flag_avx=-mavx
11276         flag_avx2=-mavx2
11277         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
11278         flag_f16c=-mf16c
11279         flag_fma=-mfma
11281         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11282         AC_LANG_PUSH([C++])
11283         save_CXXFLAGS=$CXXFLAGS
11284         CXXFLAGS="$CXXFLAGS $flag_sse2"
11285         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11286             #include <emmintrin.h>
11287             int main () {
11288                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11289                 c = _mm_xor_si128 (a, b);
11290                 return 0;
11291             }
11292             ])],
11293             [can_compile_sse2=yes],
11294             [can_compile_sse2=no])
11295         AC_LANG_POP([C++])
11296         CXXFLAGS=$save_CXXFLAGS
11297         AC_MSG_RESULT([${can_compile_sse2}])
11298         if test "${can_compile_sse2}" = "yes" ; then
11299             CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11300         fi
11302         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11303         AC_LANG_PUSH([C++])
11304         save_CXXFLAGS=$CXXFLAGS
11305         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11306         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11307             #include <tmmintrin.h>
11308             int main () {
11309                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11310                 c = _mm_maddubs_epi16 (a, b);
11311                 return 0;
11312             }
11313             ])],
11314             [can_compile_ssse3=yes],
11315             [can_compile_ssse3=no])
11316         AC_LANG_POP([C++])
11317         CXXFLAGS=$save_CXXFLAGS
11318         AC_MSG_RESULT([${can_compile_ssse3}])
11319         if test "${can_compile_ssse3}" = "yes" ; then
11320             CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
11321         fi
11323         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
11324         AC_LANG_PUSH([C++])
11325         save_CXXFLAGS=$CXXFLAGS
11326         CXXFLAGS="$CXXFLAGS $flag_sse41"
11327         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11328             #include <smmintrin.h>
11329             int main () {
11330                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11331                 c = _mm_cmpeq_epi64 (a, b);
11332                 return 0;
11333             }
11334             ])],
11335             [can_compile_sse41=yes],
11336             [can_compile_sse41=no])
11337         AC_LANG_POP([C++])
11338         CXXFLAGS=$save_CXXFLAGS
11339         AC_MSG_RESULT([${can_compile_sse41}])
11340         if test "${can_compile_sse41}" = "yes" ; then
11341             CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
11342         fi
11344         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
11345         AC_LANG_PUSH([C++])
11346         save_CXXFLAGS=$CXXFLAGS
11347         CXXFLAGS="$CXXFLAGS $flag_sse42"
11348         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11349             #include <nmmintrin.h>
11350             int main () {
11351                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11352                 c = _mm_cmpgt_epi64 (a, b);
11353                 return 0;
11354             }
11355             ])],
11356             [can_compile_sse42=yes],
11357             [can_compile_sse42=no])
11358         AC_LANG_POP([C++])
11359         CXXFLAGS=$save_CXXFLAGS
11360         AC_MSG_RESULT([${can_compile_sse42}])
11361         if test "${can_compile_sse42}" = "yes" ; then
11362             CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
11363         fi
11365         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
11366         AC_LANG_PUSH([C++])
11367         save_CXXFLAGS=$CXXFLAGS
11368         CXXFLAGS="$CXXFLAGS $flag_avx"
11369         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11370             #include <immintrin.h>
11371             int main () {
11372                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
11373                 c = _mm256_xor_ps(a, b);
11374                 return 0;
11375             }
11376             ])],
11377             [can_compile_avx=yes],
11378             [can_compile_avx=no])
11379         AC_LANG_POP([C++])
11380         CXXFLAGS=$save_CXXFLAGS
11381         AC_MSG_RESULT([${can_compile_avx}])
11382         if test "${can_compile_avx}" = "yes" ; then
11383             CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
11384         fi
11386         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
11387         AC_LANG_PUSH([C++])
11388         save_CXXFLAGS=$CXXFLAGS
11389         CXXFLAGS="$CXXFLAGS $flag_avx2"
11390         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11391             #include <immintrin.h>
11392             int main () {
11393                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
11394                 c = _mm256_maddubs_epi16(a, b);
11395                 return 0;
11396             }
11397             ])],
11398             [can_compile_avx2=yes],
11399             [can_compile_avx2=no])
11400         AC_LANG_POP([C++])
11401         CXXFLAGS=$save_CXXFLAGS
11402         AC_MSG_RESULT([${can_compile_avx2}])
11403         if test "${can_compile_avx2}" = "yes" ; then
11404             CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
11405         fi
11407         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
11408         AC_LANG_PUSH([C++])
11409         save_CXXFLAGS=$CXXFLAGS
11410         CXXFLAGS="$CXXFLAGS $flag_avx512"
11411         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11412             #include <immintrin.h>
11413             int main () {
11414                 __m512i a = _mm512_loadu_si512(0);
11415                 return 0;
11416             }
11417             ])],
11418             [can_compile_avx512=yes],
11419             [can_compile_avx512=no])
11420         AC_LANG_POP([C++])
11421         CXXFLAGS=$save_CXXFLAGS
11422         AC_MSG_RESULT([${can_compile_avx512}])
11423         if test "${can_compile_avx512}" = "yes" ; then
11424             CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
11425         fi
11427         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
11428         AC_LANG_PUSH([C++])
11429         save_CXXFLAGS=$CXXFLAGS
11430         CXXFLAGS="$CXXFLAGS $flag_f16c"
11431         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11432             #include <immintrin.h>
11433             int main () {
11434                 __m128i a = _mm_set1_epi32 (0);
11435                 __m128 c;
11436                 c = _mm_cvtph_ps(a);
11437                 return 0;
11438             }
11439             ])],
11440             [can_compile_f16c=yes],
11441             [can_compile_f16c=no])
11442         AC_LANG_POP([C++])
11443         CXXFLAGS=$save_CXXFLAGS
11444         AC_MSG_RESULT([${can_compile_f16c}])
11445         if test "${can_compile_f16c}" = "yes" ; then
11446             CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
11447         fi
11449         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
11450         AC_LANG_PUSH([C++])
11451         save_CXXFLAGS=$CXXFLAGS
11452         CXXFLAGS="$CXXFLAGS $flag_fma"
11453         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11454             #include <immintrin.h>
11455             int main () {
11456                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
11457                 d = _mm256_fmadd_ps(a, b, c);
11458                 return 0;
11459             }
11460             ])],
11461             [can_compile_fma=yes],
11462             [can_compile_fma=no])
11463         AC_LANG_POP([C++])
11464         CXXFLAGS=$save_CXXFLAGS
11465         AC_MSG_RESULT([${can_compile_fma}])
11466         if test "${can_compile_fma}" = "yes" ; then
11467             CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
11468         fi
11470         CXX="$save_CXX"
11471     fi
11473 AC_SUBST(CLANG_CC)
11474 AC_SUBST(CLANG_CXX)
11475 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE2)
11476 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSSE3)
11477 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE41)
11478 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE42)
11479 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX)
11480 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX2)
11481 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX512)
11482 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_F16C)
11483 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_FMA)
11485 SYSTEM_GPGMEPP=
11487 if test "$enable_gpgmepp" = no; then
11488     AC_MSG_CHECKING([whether to enable gpgmepp])
11489     AC_MSG_RESULT([no])
11490 elif test "$enable_mpl_subset" = "yes"; then
11491     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11492     AC_MSG_RESULT([yes])
11493 elif test "$enable_fuzzers" = "yes"; then
11494     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11495     AC_MSG_RESULT([yes])
11496 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11497     dnl ===================================================================
11498     dnl Check for system gpgme
11499     dnl ===================================================================
11500     AC_MSG_CHECKING([which gpgmepp to use])
11501     if test "$with_system_gpgmepp" = "yes"; then
11502         AC_MSG_RESULT([external])
11503         SYSTEM_GPGMEPP=TRUE
11505         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11506         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11507             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11508         # progress_callback is the only func with plain C linkage
11509         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11510         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11511             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11512         AC_CHECK_HEADER(gpgme.h, [],
11513             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11514     else
11515         AC_MSG_RESULT([internal])
11516         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11517         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11519         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11520         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11521         if test "$_os" != "WINNT"; then
11522             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11523             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11524         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11525             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11526         fi
11527     fi
11528     ENABLE_GPGMEPP=TRUE
11529     AC_DEFINE([HAVE_FEATURE_GPGME])
11530     AC_PATH_PROG(GPG, gpg)
11531     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11532     # so let's exclude that manually for the moment
11533     if test -n "$GPG" -a "$_os" != "WINNT"; then
11534         # make sure we not only have a working gpgme, but a full working
11535         # gpg installation to run OpenPGP signature verification
11536         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11537     fi
11538     if test "$_os" = "Linux"; then
11539       uid=`id -u`
11540       AC_MSG_CHECKING([for /run/user/$uid])
11541       if test -d /run/user/$uid; then
11542         AC_MSG_RESULT([yes])
11543         AC_PATH_PROG(GPGCONF, gpgconf)
11545         # Older versions of gpgconf are not working as expected, since
11546         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11547         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11548         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11549         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11550         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11551         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11552         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11553           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11554           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11555           if $GPGCONF --dump-options > /dev/null ; then
11556             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11557               AC_MSG_RESULT([yes])
11558               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11559               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11560             else
11561               AC_MSG_RESULT([no])
11562             fi
11563           else
11564             AC_MSG_RESULT([no. missing or broken gpgconf?])
11565           fi
11566         else
11567           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11568         fi
11569       else
11570         AC_MSG_RESULT([no])
11571      fi
11572    fi
11574 AC_SUBST(ENABLE_GPGMEPP)
11575 AC_SUBST(SYSTEM_GPGMEPP)
11576 AC_SUBST(GPG_ERROR_CFLAGS)
11577 AC_SUBST(GPG_ERROR_LIBS)
11578 AC_SUBST(LIBASSUAN_CFLAGS)
11579 AC_SUBST(LIBASSUAN_LIBS)
11580 AC_SUBST(GPGMEPP_CFLAGS)
11581 AC_SUBST(GPGMEPP_LIBS)
11583 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11584 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11585     AC_MSG_RESULT([yes])
11586     ENABLE_MEDIAWIKI=TRUE
11587     BUILD_TYPE="$BUILD_TYPE XSLTML"
11588     if test  "x$with_java" = "xno"; then
11589         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11590     fi
11591 else
11592     AC_MSG_RESULT([no])
11593     ENABLE_MEDIAWIKI=
11594     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11596 AC_SUBST(ENABLE_MEDIAWIKI)
11598 AC_MSG_CHECKING([whether to build the Report Builder])
11599 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11600     AC_MSG_RESULT([yes])
11601     ENABLE_REPORTBUILDER=TRUE
11602     AC_MSG_CHECKING([which jfreereport libs to use])
11603     if test "$with_system_jfreereport" = "yes"; then
11604         SYSTEM_JFREEREPORT=TRUE
11605         AC_MSG_RESULT([external])
11606         if test -z $SAC_JAR; then
11607             SAC_JAR=/usr/share/java/sac.jar
11608         fi
11609         if ! test -f $SAC_JAR; then
11610              AC_MSG_ERROR(sac.jar not found.)
11611         fi
11613         if test -z $LIBXML_JAR; then
11614             if test -f /usr/share/java/libxml-1.0.0.jar; then
11615                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11616             elif test -f /usr/share/java/libxml.jar; then
11617                 LIBXML_JAR=/usr/share/java/libxml.jar
11618             else
11619                 AC_MSG_ERROR(libxml.jar replacement not found.)
11620             fi
11621         elif ! test -f $LIBXML_JAR; then
11622             AC_MSG_ERROR(libxml.jar not found.)
11623         fi
11625         if test -z $FLUTE_JAR; then
11626             if test -f /usr/share/java/flute-1.3.0.jar; then
11627                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11628             elif test -f /usr/share/java/flute.jar; then
11629                 FLUTE_JAR=/usr/share/java/flute.jar
11630             else
11631                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11632             fi
11633         elif ! test -f $FLUTE_JAR; then
11634             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11635         fi
11637         if test -z $JFREEREPORT_JAR; then
11638             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11639                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11640             elif test -f /usr/share/java/flow-engine.jar; then
11641                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11642             else
11643                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11644             fi
11645         elif ! test -f  $JFREEREPORT_JAR; then
11646                 AC_MSG_ERROR(jfreereport.jar not found.)
11647         fi
11649         if test -z $LIBLAYOUT_JAR; then
11650             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11651                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11652             elif test -f /usr/share/java/liblayout.jar; then
11653                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11654             else
11655                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11656             fi
11657         elif ! test -f $LIBLAYOUT_JAR; then
11658                 AC_MSG_ERROR(liblayout.jar not found.)
11659         fi
11661         if test -z $LIBLOADER_JAR; then
11662             if test -f /usr/share/java/libloader-1.0.0.jar; then
11663                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11664             elif test -f /usr/share/java/libloader.jar; then
11665                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11666             else
11667                 AC_MSG_ERROR(libloader.jar replacement not found.)
11668             fi
11669         elif ! test -f  $LIBLOADER_JAR; then
11670             AC_MSG_ERROR(libloader.jar not found.)
11671         fi
11673         if test -z $LIBFORMULA_JAR; then
11674             if test -f /usr/share/java/libformula-0.2.0.jar; then
11675                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11676             elif test -f /usr/share/java/libformula.jar; then
11677                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11678             else
11679                 AC_MSG_ERROR(libformula.jar replacement not found.)
11680             fi
11681         elif ! test -f $LIBFORMULA_JAR; then
11682                 AC_MSG_ERROR(libformula.jar not found.)
11683         fi
11685         if test -z $LIBREPOSITORY_JAR; then
11686             if test -f /usr/share/java/librepository-1.0.0.jar; then
11687                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11688             elif test -f /usr/share/java/librepository.jar; then
11689                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11690             else
11691                 AC_MSG_ERROR(librepository.jar replacement not found.)
11692             fi
11693         elif ! test -f $LIBREPOSITORY_JAR; then
11694             AC_MSG_ERROR(librepository.jar not found.)
11695         fi
11697         if test -z $LIBFONTS_JAR; then
11698             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11699                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11700             elif test -f /usr/share/java/libfonts.jar; then
11701                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11702             else
11703                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11704             fi
11705         elif ! test -f $LIBFONTS_JAR; then
11706                 AC_MSG_ERROR(libfonts.jar not found.)
11707         fi
11709         if test -z $LIBSERIALIZER_JAR; then
11710             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11711                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11712             elif test -f /usr/share/java/libserializer.jar; then
11713                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11714             else
11715                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11716             fi
11717         elif ! test -f $LIBSERIALIZER_JAR; then
11718                 AC_MSG_ERROR(libserializer.jar not found.)
11719         fi
11721         if test -z $LIBBASE_JAR; then
11722             if test -f /usr/share/java/libbase-1.0.0.jar; then
11723                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11724             elif test -f /usr/share/java/libbase.jar; then
11725                 LIBBASE_JAR=/usr/share/java/libbase.jar
11726             else
11727                 AC_MSG_ERROR(libbase.jar replacement not found.)
11728             fi
11729         elif ! test -f $LIBBASE_JAR; then
11730             AC_MSG_ERROR(libbase.jar not found.)
11731         fi
11733     else
11734         AC_MSG_RESULT([internal])
11735         SYSTEM_JFREEREPORT=
11736         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11737         NEED_ANT=TRUE
11738     fi
11739 else
11740     AC_MSG_RESULT([no])
11741     ENABLE_REPORTBUILDER=
11742     SYSTEM_JFREEREPORT=
11744 AC_SUBST(ENABLE_REPORTBUILDER)
11745 AC_SUBST(SYSTEM_JFREEREPORT)
11746 AC_SUBST(SAC_JAR)
11747 AC_SUBST(LIBXML_JAR)
11748 AC_SUBST(FLUTE_JAR)
11749 AC_SUBST(JFREEREPORT_JAR)
11750 AC_SUBST(LIBBASE_JAR)
11751 AC_SUBST(LIBLAYOUT_JAR)
11752 AC_SUBST(LIBLOADER_JAR)
11753 AC_SUBST(LIBFORMULA_JAR)
11754 AC_SUBST(LIBREPOSITORY_JAR)
11755 AC_SUBST(LIBFONTS_JAR)
11756 AC_SUBST(LIBSERIALIZER_JAR)
11758 # this has to be here because both the Wiki Publisher and the SRB use
11759 # commons-logging
11760 COMMONS_LOGGING_VERSION=1.2
11761 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11762     AC_MSG_CHECKING([which Apache commons-* libs to use])
11763     if test "$with_system_apache_commons" = "yes"; then
11764         SYSTEM_APACHE_COMMONS=TRUE
11765         AC_MSG_RESULT([external])
11766         if test -z $COMMONS_LOGGING_JAR; then
11767             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11768                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11769            elif test -f /usr/share/java/commons-logging.jar; then
11770                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11771             else
11772                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11773             fi
11774         elif ! test -f $COMMONS_LOGGING_JAR; then
11775             AC_MSG_ERROR(commons-logging.jar not found.)
11776         fi
11777     else
11778         AC_MSG_RESULT([internal])
11779         SYSTEM_APACHE_COMMONS=
11780         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11781         NEED_ANT=TRUE
11782     fi
11784 AC_SUBST(SYSTEM_APACHE_COMMONS)
11785 AC_SUBST(COMMONS_LOGGING_JAR)
11786 AC_SUBST(COMMONS_LOGGING_VERSION)
11788 # scripting provider for BeanShell?
11789 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11790 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11791     AC_MSG_RESULT([yes])
11792     ENABLE_SCRIPTING_BEANSHELL=TRUE
11794     dnl ===================================================================
11795     dnl Check for system beanshell
11796     dnl ===================================================================
11797     AC_MSG_CHECKING([which beanshell to use])
11798     if test "$with_system_beanshell" = "yes"; then
11799         AC_MSG_RESULT([external])
11800         SYSTEM_BSH=TRUE
11801         if test -z $BSH_JAR; then
11802             BSH_JAR=/usr/share/java/bsh.jar
11803         fi
11804         if ! test -f $BSH_JAR; then
11805             AC_MSG_ERROR(bsh.jar not found.)
11806         fi
11807     else
11808         AC_MSG_RESULT([internal])
11809         SYSTEM_BSH=
11810         BUILD_TYPE="$BUILD_TYPE BSH"
11811     fi
11812 else
11813     AC_MSG_RESULT([no])
11814     ENABLE_SCRIPTING_BEANSHELL=
11815     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11817 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11818 AC_SUBST(SYSTEM_BSH)
11819 AC_SUBST(BSH_JAR)
11821 # scripting provider for JavaScript?
11822 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11823 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11824     AC_MSG_RESULT([yes])
11825     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11827     dnl ===================================================================
11828     dnl Check for system rhino
11829     dnl ===================================================================
11830     AC_MSG_CHECKING([which rhino to use])
11831     if test "$with_system_rhino" = "yes"; then
11832         AC_MSG_RESULT([external])
11833         SYSTEM_RHINO=TRUE
11834         if test -z $RHINO_JAR; then
11835             RHINO_JAR=/usr/share/java/js.jar
11836         fi
11837         if ! test -f $RHINO_JAR; then
11838             AC_MSG_ERROR(js.jar not found.)
11839         fi
11840     else
11841         AC_MSG_RESULT([internal])
11842         SYSTEM_RHINO=
11843         BUILD_TYPE="$BUILD_TYPE RHINO"
11844         NEED_ANT=TRUE
11845     fi
11846 else
11847     AC_MSG_RESULT([no])
11848     ENABLE_SCRIPTING_JAVASCRIPT=
11849     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11851 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11852 AC_SUBST(SYSTEM_RHINO)
11853 AC_SUBST(RHINO_JAR)
11855 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11856 # paths should be added to library search path. So lets put all 64-bit
11857 # platforms there.
11858 supports_multilib=
11859 case "$host_cpu" in
11860 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11861     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11862         supports_multilib="yes"
11863     fi
11864     ;;
11866     ;;
11867 esac
11869 dnl ===================================================================
11870 dnl QT5 Integration
11871 dnl ===================================================================
11873 QT5_CFLAGS=""
11874 QT5_LIBS=""
11875 QMAKE5="qmake"
11876 MOC5="moc"
11877 QT5_GOBJECT_CFLAGS=""
11878 QT5_GOBJECT_LIBS=""
11879 QT5_HAVE_GOBJECT=""
11880 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11881         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11882         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11883 then
11884     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11885     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11887     if test -n "$supports_multilib"; then
11888         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11889     fi
11891     qt5_test_include="QtWidgets/qapplication.h"
11892     qt5_test_library="libQt5Widgets.so"
11894     dnl Check for qmake5
11895     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11896     if test "$QMAKE5" = "no"; then
11897         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11898     else
11899         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11900         if test -z "$qmake5_test_ver"; then
11901             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11902         fi
11903         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11904         qt5_minimal_minor="6"
11905         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11906             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11907         else
11908             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11909         fi
11910     fi
11912     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11913     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11915     AC_MSG_CHECKING([for Qt5 headers])
11916     qt5_incdir="no"
11917     for inc_dir in $qt5_incdirs; do
11918         if test -r "$inc_dir/$qt5_test_include"; then
11919             qt5_incdir="$inc_dir"
11920             break
11921         fi
11922     done
11923     AC_MSG_RESULT([$qt5_incdir])
11924     if test "x$qt5_incdir" = "xno"; then
11925         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11926     fi
11928     AC_MSG_CHECKING([for Qt5 libraries])
11929     qt5_libdir="no"
11930     for lib_dir in $qt5_libdirs; do
11931         if test -r "$lib_dir/$qt5_test_library"; then
11932             qt5_libdir="$lib_dir"
11933             break
11934         fi
11935     done
11936     AC_MSG_RESULT([$qt5_libdir])
11937     if test "x$qt5_libdir" = "xno"; then
11938         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11939     fi
11941     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11942     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11943     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11945     if test "$USING_X11" = TRUE; then
11946         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11947         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11948             QT5_HAVE_XCB_ICCCM=1
11949             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11950         ],[
11951             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)])
11952             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11953         ])
11954         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11955         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11956         QT5_USING_X11=1
11957         AC_DEFINE(QT5_USING_X11)
11958     fi
11960     dnl Check for Meta Object Compiler
11962     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11963     if test "$MOC5" = "no"; then
11964         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11965 the root of your Qt installation by exporting QT5DIR before running "configure".])
11966     fi
11968     if test "$build_gstreamer_1_0" = "yes"; then
11969         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11970                 QT5_HAVE_GOBJECT=1
11971                 AC_DEFINE(QT5_HAVE_GOBJECT)
11972             ],
11973             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11974         )
11975     fi
11977 AC_SUBST(QT5_CFLAGS)
11978 AC_SUBST(QT5_LIBS)
11979 AC_SUBST(MOC5)
11980 AC_SUBST(QT5_GOBJECT_CFLAGS)
11981 AC_SUBST(QT5_GOBJECT_LIBS)
11982 AC_SUBST(QT5_HAVE_GOBJECT)
11984 dnl ===================================================================
11985 dnl KF5 Integration
11986 dnl ===================================================================
11988 KF5_CFLAGS=""
11989 KF5_LIBS=""
11990 KF5_CONFIG="kf5-config"
11991 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11992         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11993 then
11994     if test "$OS" = "HAIKU"; then
11995         haiku_arch="`echo $RTL_ARCH | tr X x`"
11996         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11997         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11998     fi
12000     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12001     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12002     if test -n "$supports_multilib"; then
12003         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12004     fi
12006     kf5_test_include="KF5/kcoreaddons_version.h"
12007     kf5_test_library="libKF5CoreAddons.so"
12008     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12010     dnl kf5 KDE4 support compatibility installed
12011     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12012     if test "$KF5_CONFIG" != "no"; then
12013         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12014         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12015     fi
12017     dnl Check for KF5 headers
12018     AC_MSG_CHECKING([for KF5 headers])
12019     kf5_incdir="no"
12020     for kf5_check in $kf5_incdirs; do
12021         if test -r "$kf5_check/$kf5_test_include"; then
12022             kf5_incdir="$kf5_check/KF5"
12023             break
12024         fi
12025     done
12026     AC_MSG_RESULT([$kf5_incdir])
12027     if test "x$kf5_incdir" = "xno"; then
12028         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12029     fi
12031     dnl Check for KF5 libraries
12032     AC_MSG_CHECKING([for KF5 libraries])
12033     kf5_libdir="no"
12034     for kf5_check in $kf5_libdirs; do
12035         if test -r "$kf5_check/$kf5_test_library"; then
12036             kf5_libdir="$kf5_check"
12037             break
12038         fi
12039     done
12041     AC_MSG_RESULT([$kf5_libdir])
12042     if test "x$kf5_libdir" = "xno"; then
12043         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12044     fi
12046     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"
12047     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12048     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12050     if test "$USING_X11" = TRUE; then
12051         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12052     fi
12054     AC_LANG_PUSH([C++])
12055     save_CXXFLAGS=$CXXFLAGS
12056     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12057     AC_MSG_CHECKING([whether KDE is >= 5.0])
12058        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12059 #include <kcoreaddons_version.h>
12061 int main(int argc, char **argv) {
12062        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12063        else return 1;
12065        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12066     CXXFLAGS=$save_CXXFLAGS
12067     AC_LANG_POP([C++])
12069 AC_SUBST(KF5_CFLAGS)
12070 AC_SUBST(KF5_LIBS)
12072 dnl ===================================================================
12073 dnl Test whether to include Evolution 2 support
12074 dnl ===================================================================
12075 AC_MSG_CHECKING([whether to enable evolution 2 support])
12076 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
12077     AC_MSG_RESULT([yes])
12078     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12079     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12080     FilterLibs "${GOBJECT_LIBS}"
12081     GOBJECT_LIBS="${filteredlibs}"
12082     ENABLE_EVOAB2="TRUE"
12083 else
12084     ENABLE_EVOAB2=""
12085     AC_MSG_RESULT([no])
12087 AC_SUBST(ENABLE_EVOAB2)
12088 AC_SUBST(GOBJECT_CFLAGS)
12089 AC_SUBST(GOBJECT_LIBS)
12091 dnl ===================================================================
12092 dnl Test which themes to include
12093 dnl ===================================================================
12094 AC_MSG_CHECKING([which themes to include])
12095 # if none given use default subset of available themes
12096 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12097     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"
12100 WITH_THEMES=""
12101 if test "x$with_theme" != "xno"; then
12102     for theme in $with_theme; do
12103         case $theme in
12104         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" ;;
12105         default) real_theme=colibre ;;
12106         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12107         esac
12108         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12109     done
12111 AC_MSG_RESULT([$WITH_THEMES])
12112 AC_SUBST([WITH_THEMES])
12113 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12114 for theme in $with_theme; do
12115     case $theme in
12116     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12117     *) ;;
12118     esac
12119 done
12121 dnl ===================================================================
12122 dnl Test whether to integrate helppacks into the product's installer
12123 dnl ===================================================================
12124 AC_MSG_CHECKING([for helppack integration])
12125 if test "$with_helppack_integration" = "no"; then
12126     AC_MSG_RESULT([no integration])
12127 else
12128     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12129     AC_MSG_RESULT([integration])
12132 ###############################################################################
12133 # Extensions checking
12134 ###############################################################################
12135 AC_MSG_CHECKING([for extensions integration])
12136 if test "x$enable_extension_integration" != "xno"; then
12137     WITH_EXTENSION_INTEGRATION=TRUE
12138     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12139     AC_MSG_RESULT([yes, use integration])
12140 else
12141     WITH_EXTENSION_INTEGRATION=
12142     AC_MSG_RESULT([no, do not integrate])
12144 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12146 dnl Should any extra extensions be included?
12147 dnl There are standalone tests for each of these below.
12148 WITH_EXTRA_EXTENSIONS=
12149 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12151 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12152 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12153 if test "x$with_java" != "xno"; then
12154     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12155     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12158 AC_MSG_CHECKING([whether to build opens___.ttf])
12159 if test "$enable_build_opensymbol" = "yes"; then
12160     AC_MSG_RESULT([yes])
12161     AC_PATH_PROG(FONTFORGE, fontforge)
12162     if test -z "$FONTFORGE"; then
12163         AC_MSG_ERROR([fontforge not installed])
12164     fi
12165 else
12166     AC_MSG_RESULT([no])
12167     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
12168     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12170 AC_SUBST(OPENSYMBOL_TTF)
12171 AC_SUBST(FONTFORGE)
12173 dnl ===================================================================
12174 dnl Test whether to include fonts
12175 dnl ===================================================================
12176 AC_MSG_CHECKING([whether to include third-party fonts])
12177 if test "$with_fonts" != "no"; then
12178     AC_MSG_RESULT([yes])
12179     WITH_FONTS=TRUE
12180     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12181     AC_DEFINE(HAVE_MORE_FONTS)
12182 else
12183     AC_MSG_RESULT([no])
12184     WITH_FONTS=
12185     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12187 AC_SUBST(WITH_FONTS)
12190 dnl ===================================================================
12191 dnl Test whether to enable online update service
12192 dnl ===================================================================
12193 AC_MSG_CHECKING([whether to enable online update])
12194 ENABLE_ONLINE_UPDATE=
12195 ENABLE_ONLINE_UPDATE_MAR=
12196 UPDATE_CONFIG=
12197 if test "$enable_online_update" = ""; then
12198     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12199         AC_MSG_RESULT([yes])
12200         ENABLE_ONLINE_UPDATE="TRUE"
12201     else
12202         AC_MSG_RESULT([no])
12203     fi
12204 else
12205     if test "$enable_online_update" = "mar"; then
12206         AC_MSG_RESULT([yes - MAR-based online update])
12207         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12208         if test "$with_update_config" = ""; then
12209             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12210         fi
12211         UPDATE_CONFIG="$with_update_config"
12212         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12213     elif test "$enable_online_update" = "yes"; then
12214         AC_MSG_RESULT([yes])
12215         ENABLE_ONLINE_UPDATE="TRUE"
12216     else
12217         AC_MSG_RESULT([no])
12218     fi
12220 AC_SUBST(ENABLE_ONLINE_UPDATE)
12221 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
12222 AC_SUBST(UPDATE_CONFIG)
12224 dnl ===================================================================
12225 dnl Test whether we need bzip2
12226 dnl ===================================================================
12227 SYSTEM_BZIP2=
12228 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
12229     AC_MSG_CHECKING([whether to use system bzip2])
12230     if test "$with_system_bzip2" = yes; then
12231         SYSTEM_BZIP2=TRUE
12232         AC_MSG_RESULT([yes])
12233         PKG_CHECK_MODULES(BZIP2, bzip2)
12234         FilterLibs "${BZIP2_LIBS}"
12235         BZIP2_LIBS="${filteredlibs}"
12236     else
12237         AC_MSG_RESULT([no])
12238         BUILD_TYPE="$BUILD_TYPE BZIP2"
12239     fi
12241 AC_SUBST(SYSTEM_BZIP2)
12242 AC_SUBST(BZIP2_CFLAGS)
12243 AC_SUBST(BZIP2_LIBS)
12245 dnl ===================================================================
12246 dnl Test whether to enable extension update
12247 dnl ===================================================================
12248 AC_MSG_CHECKING([whether to enable extension update])
12249 ENABLE_EXTENSION_UPDATE=
12250 if test "x$enable_extension_update" = "xno"; then
12251     AC_MSG_RESULT([no])
12252 else
12253     AC_MSG_RESULT([yes])
12254     ENABLE_EXTENSION_UPDATE="TRUE"
12255     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
12256     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
12258 AC_SUBST(ENABLE_EXTENSION_UPDATE)
12261 dnl ===================================================================
12262 dnl Test whether to create MSI with LIMITUI=1 (silent install)
12263 dnl ===================================================================
12264 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
12265 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
12266     AC_MSG_RESULT([no])
12267     ENABLE_SILENT_MSI=
12268 else
12269     AC_MSG_RESULT([yes])
12270     ENABLE_SILENT_MSI=TRUE
12271     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
12273 AC_SUBST(ENABLE_SILENT_MSI)
12275 AC_MSG_CHECKING([whether and how to use Xinerama])
12276 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
12277     if test "$x_libraries" = "default_x_libraries"; then
12278         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
12279         if test "x$XINERAMALIB" = x; then
12280            XINERAMALIB="/usr/lib"
12281         fi
12282     else
12283         XINERAMALIB="$x_libraries"
12284     fi
12285     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
12286         # we have both versions, let the user decide but use the dynamic one
12287         # per default
12288         USE_XINERAMA=TRUE
12289         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
12290             XINERAMA_LINK=dynamic
12291         else
12292             XINERAMA_LINK=static
12293         fi
12294     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
12295         # we have only the dynamic version
12296         USE_XINERAMA=TRUE
12297         XINERAMA_LINK=dynamic
12298     elif test -e "$XINERAMALIB/libXinerama.a"; then
12299         # static version
12300         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
12301             USE_XINERAMA=TRUE
12302             XINERAMA_LINK=static
12303         else
12304             USE_XINERAMA=
12305             XINERAMA_LINK=none
12306         fi
12307     else
12308         # no Xinerama
12309         USE_XINERAMA=
12310         XINERAMA_LINK=none
12311     fi
12312     if test "$USE_XINERAMA" = "TRUE"; then
12313         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
12314         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
12315             [AC_MSG_ERROR(Xinerama header not found.)], [])
12316         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
12317         if test "x$XEXTLIB" = x; then
12318            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
12319         fi
12320         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
12321         if test "$_os" = "FreeBSD"; then
12322             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
12323         fi
12324         if test "$_os" = "Linux"; then
12325             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
12326         fi
12327         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
12328             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
12329     else
12330         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
12331     fi
12332 else
12333     USE_XINERAMA=
12334     XINERAMA_LINK=none
12335     AC_MSG_RESULT([no])
12337 AC_SUBST(USE_XINERAMA)
12338 AC_SUBST(XINERAMA_LINK)
12340 dnl ===================================================================
12341 dnl Test whether to build cairo or rely on the system version
12342 dnl ===================================================================
12344 if test "$USING_X11" = TRUE; then
12345     # Used in vcl/Library_vclplug_gen.mk
12346     test_cairo=yes
12349 if test "$test_cairo" = "yes"; then
12350     AC_MSG_CHECKING([whether to use the system cairo])
12352     : ${with_system_cairo:=$with_system_libs}
12353     if test "$with_system_cairo" = "yes"; then
12354         SYSTEM_CAIRO=TRUE
12355         AC_MSG_RESULT([yes])
12357         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
12358         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12359         FilterLibs "${CAIRO_LIBS}"
12360         CAIRO_LIBS="${filteredlibs}"
12362         if test "$test_xrender" = "yes"; then
12363             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
12364             AC_LANG_PUSH([C])
12365             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
12366 #ifdef PictStandardA8
12367 #else
12368       return fail;
12369 #endif
12370 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
12372             AC_LANG_POP([C])
12373         fi
12374     else
12375         SYSTEM_CAIRO=
12376         AC_MSG_RESULT([no])
12378         BUILD_TYPE="$BUILD_TYPE CAIRO"
12379     fi
12382 AC_SUBST(SYSTEM_CAIRO)
12383 AC_SUBST(CAIRO_CFLAGS)
12384 AC_SUBST(CAIRO_LIBS)
12386 dnl ===================================================================
12387 dnl Test whether to use avahi
12388 dnl ===================================================================
12389 if test "$_os" = "WINNT"; then
12390     # Windows uses bundled mDNSResponder
12391     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
12392 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12393     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12394                       [ENABLE_AVAHI="TRUE"])
12395     AC_DEFINE(HAVE_FEATURE_AVAHI)
12396     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12397     FilterLibs "${AVAHI_LIBS}"
12398     AVAHI_LIBS="${filteredlibs}"
12401 AC_SUBST(ENABLE_AVAHI)
12402 AC_SUBST(AVAHI_CFLAGS)
12403 AC_SUBST(AVAHI_LIBS)
12405 dnl ===================================================================
12406 dnl Test whether to use liblangtag
12407 dnl ===================================================================
12408 SYSTEM_LIBLANGTAG=
12409 AC_MSG_CHECKING([whether to use system liblangtag])
12410 if test "$with_system_liblangtag" = yes; then
12411     SYSTEM_LIBLANGTAG=TRUE
12412     AC_MSG_RESULT([yes])
12413     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12414     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12415     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12416     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12417     FilterLibs "${LIBLANGTAG_LIBS}"
12418     LIBLANGTAG_LIBS="${filteredlibs}"
12419 else
12420     SYSTEM_LIBLANGTAG=
12421     AC_MSG_RESULT([no])
12422     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12423     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12424     if test "$COM" = "MSC"; then
12425         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12426     else
12427         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12428     fi
12430 AC_SUBST(SYSTEM_LIBLANGTAG)
12431 AC_SUBST(LIBLANGTAG_CFLAGS)
12432 AC_SUBST(LIBLANGTAG_LIBS)
12434 dnl ===================================================================
12435 dnl Test whether to build libpng or rely on the system version
12436 dnl ===================================================================
12438 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12440 dnl ===================================================================
12441 dnl Check for runtime JVM search path
12442 dnl ===================================================================
12443 if test "$ENABLE_JAVA" != ""; then
12444     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12445     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12446         AC_MSG_RESULT([yes])
12447         if ! test -d "$with_jvm_path"; then
12448             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12449         fi
12450         if ! test -d "$with_jvm_path"jvm; then
12451             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12452         fi
12453         JVM_ONE_PATH_CHECK="$with_jvm_path"
12454         AC_SUBST(JVM_ONE_PATH_CHECK)
12455     else
12456         AC_MSG_RESULT([no])
12457     fi
12460 dnl ===================================================================
12461 dnl Test for the presence of Ant and that it works
12462 dnl ===================================================================
12464 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12465     ANT_HOME=; export ANT_HOME
12466     WITH_ANT_HOME=; export WITH_ANT_HOME
12467     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12468         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12469             if test "$_os" = "WINNT"; then
12470                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12471             else
12472                 with_ant_home="$LODE_HOME/opt/ant"
12473             fi
12474         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12475             with_ant_home="$LODE_HOME/opt/ant"
12476         fi
12477     fi
12478     if test -z "$with_ant_home"; then
12479         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12480     else
12481         if test "$_os" = "WINNT"; then
12482             # AC_PATH_PROGS needs unix path
12483             with_ant_home=`cygpath -u "$with_ant_home"`
12484         fi
12485         AbsolutePath "$with_ant_home"
12486         with_ant_home=$absolute_path
12487         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12488         WITH_ANT_HOME=$with_ant_home
12489         ANT_HOME=$with_ant_home
12490     fi
12492     if test -z "$ANT"; then
12493         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12494     else
12495         # resolve relative or absolute symlink
12496         while test -h "$ANT"; do
12497             a_cwd=`pwd`
12498             a_basename=`basename "$ANT"`
12499             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12500             cd "`dirname "$ANT"`"
12501             cd "`dirname "$a_script"`"
12502             ANT="`pwd`"/"`basename "$a_script"`"
12503             cd "$a_cwd"
12504         done
12506         AC_MSG_CHECKING([if $ANT works])
12507         mkdir -p conftest.dir
12508         a_cwd=$(pwd)
12509         cd conftest.dir
12510         cat > conftest.java << EOF
12511         public class conftest {
12512             int testmethod(int a, int b) {
12513                     return a + b;
12514             }
12515         }
12518         cat > conftest.xml << EOF
12519         <project name="conftest" default="conftest">
12520         <target name="conftest">
12521             <javac srcdir="." includes="conftest.java">
12522             </javac>
12523         </target>
12524         </project>
12527         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12528         if test $? = 0 -a -f ./conftest.class; then
12529             AC_MSG_RESULT([Ant works])
12530             if test -z "$WITH_ANT_HOME"; then
12531                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12532                 if test -z "$ANT_HOME"; then
12533                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12534                 fi
12535             else
12536                 ANT_HOME="$WITH_ANT_HOME"
12537             fi
12538         else
12539             echo "configure: Ant test failed" >&5
12540             cat conftest.java >&5
12541             cat conftest.xml >&5
12542             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12543         fi
12544         cd "$a_cwd"
12545         rm -fr conftest.dir
12546     fi
12547     if test -z "$ANT_HOME"; then
12548         ANT_HOME="NO_ANT_HOME"
12549     else
12550         PathFormat "$ANT_HOME"
12551         ANT_HOME="$formatted_path"
12552         PathFormat "$ANT"
12553         ANT="$formatted_path"
12554     fi
12555     AC_SUBST(ANT_HOME)
12556     AC_SUBST(ANT)
12558     dnl Checking for ant.jar
12559     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12560         AC_MSG_CHECKING([Ant lib directory])
12561         if test -f $ANT_HOME/lib/ant.jar; then
12562             ANT_LIB="$ANT_HOME/lib"
12563         else
12564             if test -f $ANT_HOME/ant.jar; then
12565                 ANT_LIB="$ANT_HOME"
12566             else
12567                 if test -f /usr/share/java/ant.jar; then
12568                     ANT_LIB=/usr/share/java
12569                 else
12570                     if test -f /usr/share/ant-core/lib/ant.jar; then
12571                         ANT_LIB=/usr/share/ant-core/lib
12572                     else
12573                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12574                             ANT_LIB="$ANT_HOME/lib/ant"
12575                         else
12576                             if test -f /usr/share/lib/ant/ant.jar; then
12577                                 ANT_LIB=/usr/share/lib/ant
12578                             else
12579                                 AC_MSG_ERROR([Ant libraries not found!])
12580                             fi
12581                         fi
12582                     fi
12583                 fi
12584             fi
12585         fi
12586         PathFormat "$ANT_LIB"
12587         ANT_LIB="$formatted_path"
12588         AC_MSG_RESULT([Ant lib directory found.])
12589     fi
12590     AC_SUBST(ANT_LIB)
12592     ant_minver=1.6.0
12593     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12595     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12596     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12597     ant_version_major=`echo $ant_version | cut -d. -f1`
12598     ant_version_minor=`echo $ant_version | cut -d. -f2`
12599     echo "configure: ant_version $ant_version " >&5
12600     echo "configure: ant_version_major $ant_version_major " >&5
12601     echo "configure: ant_version_minor $ant_version_minor " >&5
12602     if test "$ant_version_major" -ge "2"; then
12603         AC_MSG_RESULT([yes, $ant_version])
12604     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12605         AC_MSG_RESULT([yes, $ant_version])
12606     else
12607         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12608     fi
12610     rm -f conftest* core core.* *.core
12613 OOO_JUNIT_JAR=
12614 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12615     AC_MSG_CHECKING([for JUnit 4])
12616     if test "$with_junit" = "yes"; then
12617         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12618             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12619         elif test -e /usr/share/java/junit4.jar; then
12620             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12621         else
12622            if test -e /usr/share/lib/java/junit.jar; then
12623               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12624            else
12625               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12626            fi
12627         fi
12628     else
12629         OOO_JUNIT_JAR=$with_junit
12630     fi
12631     if test "$_os" = "WINNT"; then
12632         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12633     fi
12634     printf 'import org.junit.Before;' > conftest.java
12635     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12636         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12637     else
12638         AC_MSG_ERROR(
12639 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12640  specify its pathname via --with-junit=..., or disable it via --without-junit])
12641     fi
12642     rm -f conftest.class conftest.java
12643     if test $OOO_JUNIT_JAR != ""; then
12644     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12645     fi
12647 AC_SUBST(OOO_JUNIT_JAR)
12649 HAMCREST_JAR=
12650 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12651     AC_MSG_CHECKING([for included Hamcrest])
12652     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12653     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12654         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12655     else
12656         AC_MSG_RESULT([Not included])
12657         AC_MSG_CHECKING([for standalone hamcrest jar.])
12658         if test "$with_hamcrest" = "yes"; then
12659             if test -e /usr/share/lib/java/hamcrest.jar; then
12660                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12661             elif test -e /usr/share/java/hamcrest/core.jar; then
12662                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12663             else
12664                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12665             fi
12666         else
12667             HAMCREST_JAR=$with_hamcrest
12668         fi
12669         if test "$_os" = "WINNT"; then
12670             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12671         fi
12672         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12673             AC_MSG_RESULT([$HAMCREST_JAR])
12674         else
12675             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),
12676                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12677         fi
12678     fi
12679     rm -f conftest.class conftest.java
12681 AC_SUBST(HAMCREST_JAR)
12684 AC_SUBST(SCPDEFS)
12687 # check for wget and curl
12689 WGET=
12690 CURL=
12692 if test "$enable_fetch_external" != "no"; then
12694 CURL=`which curl 2>/dev/null`
12696 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12697     # wget new enough?
12698     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12699     if test $? -eq 0; then
12700         WGET=$i
12701         break
12702     fi
12703 done
12705 if test -z "$WGET" -a -z "$CURL"; then
12706     AC_MSG_ERROR([neither wget nor curl found!])
12711 AC_SUBST(WGET)
12712 AC_SUBST(CURL)
12715 # check for sha256sum
12717 SHA256SUM=
12719 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12720     eval "$i -a 256 --version" > /dev/null 2>&1
12721     ret=$?
12722     if test $ret -eq 0; then
12723         SHA256SUM="$i -a 256"
12724         break
12725     fi
12726 done
12728 if test -z "$SHA256SUM"; then
12729     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12730         eval "$i --version" > /dev/null 2>&1
12731         ret=$?
12732         if test $ret -eq 0; then
12733             SHA256SUM=$i
12734             break
12735         fi
12736     done
12739 if test -z "$SHA256SUM"; then
12740     AC_MSG_ERROR([no sha256sum found!])
12743 AC_SUBST(SHA256SUM)
12745 dnl ===================================================================
12746 dnl Dealing with l10n options
12747 dnl ===================================================================
12748 AC_MSG_CHECKING([which languages to be built])
12749 # get list of all languages
12750 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12751 # the sed command does the following:
12752 #   + if a line ends with a backslash, append the next line to it
12753 #   + adds " on the beginning of the value (after =)
12754 #   + adds " at the end of the value
12755 #   + removes en-US; we want to put it on the beginning
12756 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12757 [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)]
12758 ALL_LANGS="en-US $completelangiso"
12759 # check the configured localizations
12760 WITH_LANG="$with_lang"
12762 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12763 # (Norwegian is "nb" and "nn".)
12764 if test "$WITH_LANG" = "no"; then
12765     WITH_LANG=
12768 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12769     AC_MSG_RESULT([en-US])
12770 else
12771     AC_MSG_RESULT([$WITH_LANG])
12772     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12773     if test -z "$MSGFMT"; then
12774         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12775             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12776         elif test -x "/opt/lo/bin/msgfmt"; then
12777             MSGFMT="/opt/lo/bin/msgfmt"
12778         else
12779             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12780             if test -z "$MSGFMT"; then
12781                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12782             fi
12783         fi
12784     fi
12785     if test -z "$MSGUNIQ"; then
12786         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12787             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12788         elif test -x "/opt/lo/bin/msguniq"; then
12789             MSGUNIQ="/opt/lo/bin/msguniq"
12790         else
12791             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12792             if test -z "$MSGUNIQ"; then
12793                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12794             fi
12795         fi
12796     fi
12798 AC_SUBST(MSGFMT)
12799 AC_SUBST(MSGUNIQ)
12800 # check that the list is valid
12801 for lang in $WITH_LANG; do
12802     test "$lang" = "ALL" && continue
12803     # need to check for the exact string, so add space before and after the list of all languages
12804     for vl in $ALL_LANGS; do
12805         if test "$vl" = "$lang"; then
12806            break
12807         fi
12808     done
12809     if test "$vl" != "$lang"; then
12810         # if you're reading this - you prolly quoted your languages remove the quotes ...
12811         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12812     fi
12813 done
12814 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12815     echo $WITH_LANG | grep -q en-US
12816     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12818 # list with substituted ALL
12819 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12820 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12821 test "$WITH_LANG" = "en-US" && WITH_LANG=
12822 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12823     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12824     ALL_LANGS=`echo $ALL_LANGS qtz`
12826 AC_SUBST(ALL_LANGS)
12827 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12828 AC_SUBST(WITH_LANG)
12829 AC_SUBST(WITH_LANG_LIST)
12830 AC_SUBST(GIT_NEEDED_SUBMODULES)
12832 WITH_POOR_HELP_LOCALIZATIONS=
12833 if test -d "$SRC_ROOT/translations/source"; then
12834     for l in `ls -1 $SRC_ROOT/translations/source`; do
12835         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12836             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12837         fi
12838     done
12840 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12842 if test -n "$with_locales"; then
12843     WITH_LOCALES="$with_locales"
12845     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12846     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12847     # config_host/config_locales.h.in
12848     for locale in $WITH_LOCALES; do
12849         lang=${locale%_*}
12851         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12853         case $lang in
12854         hi|mr*ne)
12855             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12856             ;;
12857         bg|ru)
12858             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12859             ;;
12860         esac
12861     done
12862 else
12863     AC_DEFINE(WITH_LOCALE_ALL)
12865 AC_SUBST(WITH_LOCALES)
12867 dnl git submodule update --reference
12868 dnl ===================================================================
12869 if test -n "${GIT_REFERENCE_SRC}"; then
12870     for repo in ${GIT_NEEDED_SUBMODULES}; do
12871         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12872             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12873         fi
12874     done
12876 AC_SUBST(GIT_REFERENCE_SRC)
12878 dnl git submodules linked dirs
12879 dnl ===================================================================
12880 if test -n "${GIT_LINK_SRC}"; then
12881     for repo in ${GIT_NEEDED_SUBMODULES}; do
12882         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12883             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12884         fi
12885     done
12887 AC_SUBST(GIT_LINK_SRC)
12889 dnl branding
12890 dnl ===================================================================
12891 AC_MSG_CHECKING([for alternative branding images directory])
12892 # initialize mapped arrays
12893 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
12894 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo_flavor.svg about.svg"
12896 if test -z "$with_branding" -o "$with_branding" = "no"; then
12897     AC_MSG_RESULT([none])
12898     DEFAULT_BRAND_IMAGES="$brand_files"
12899 else
12900     if ! test -d $with_branding ; then
12901         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12902     else
12903         AC_MSG_RESULT([$with_branding])
12904         CUSTOM_BRAND_DIR="$with_branding"
12905         for lfile in $brand_files
12906         do
12907             if ! test -f $with_branding/$lfile ; then
12908                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12909                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12910             else
12911                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12912             fi
12913         done
12914         check_for_progress="yes"
12915     fi
12917 AC_SUBST([BRAND_INTRO_IMAGES])
12918 AC_SUBST([CUSTOM_BRAND_DIR])
12919 AC_SUBST([CUSTOM_BRAND_IMAGES])
12920 AC_SUBST([DEFAULT_BRAND_IMAGES])
12923 AC_MSG_CHECKING([for 'intro' progress settings])
12924 PROGRESSBARCOLOR=
12925 PROGRESSSIZE=
12926 PROGRESSPOSITION=
12927 PROGRESSFRAMECOLOR=
12928 PROGRESSTEXTCOLOR=
12929 PROGRESSTEXTBASELINE=
12931 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12932     source "$with_branding/progress.conf"
12933     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12934 else
12935     AC_MSG_RESULT([none])
12938 AC_SUBST(PROGRESSBARCOLOR)
12939 AC_SUBST(PROGRESSSIZE)
12940 AC_SUBST(PROGRESSPOSITION)
12941 AC_SUBST(PROGRESSFRAMECOLOR)
12942 AC_SUBST(PROGRESSTEXTCOLOR)
12943 AC_SUBST(PROGRESSTEXTBASELINE)
12946 AC_MSG_CHECKING([for extra build ID])
12947 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12948     EXTRA_BUILDID="$with_extra_buildid"
12950 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12951 if test -n "$EXTRA_BUILDID" ; then
12952     AC_MSG_RESULT([$EXTRA_BUILDID])
12953 else
12954     AC_MSG_RESULT([not set])
12956 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12958 OOO_VENDOR=
12959 AC_MSG_CHECKING([for vendor])
12960 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12961     OOO_VENDOR="$USERNAME"
12963     if test -z "$OOO_VENDOR"; then
12964         OOO_VENDOR="$USER"
12965     fi
12967     if test -z "$OOO_VENDOR"; then
12968         OOO_VENDOR="`id -u -n`"
12969     fi
12971     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12972 else
12973     OOO_VENDOR="$with_vendor"
12974     AC_MSG_RESULT([$OOO_VENDOR])
12976 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12977 AC_SUBST(OOO_VENDOR)
12979 if test "$_os" = "Android" ; then
12980     ANDROID_PACKAGE_NAME=
12981     AC_MSG_CHECKING([for Android package name])
12982     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12983         if test -n "$ENABLE_DEBUG"; then
12984             # Default to the package name that makes ndk-gdb happy.
12985             ANDROID_PACKAGE_NAME="org.libreoffice"
12986         else
12987             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12988         fi
12990         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12991     else
12992         ANDROID_PACKAGE_NAME="$with_android_package_name"
12993         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12994     fi
12995     AC_SUBST(ANDROID_PACKAGE_NAME)
12998 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12999 if test "$with_compat_oowrappers" = "yes"; then
13000     WITH_COMPAT_OOWRAPPERS=TRUE
13001     AC_MSG_RESULT(yes)
13002 else
13003     WITH_COMPAT_OOWRAPPERS=
13004     AC_MSG_RESULT(no)
13006 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13008 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
13009 AC_MSG_CHECKING([for install dirname])
13010 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13011     INSTALLDIRNAME="$with_install_dirname"
13013 AC_MSG_RESULT([$INSTALLDIRNAME])
13014 AC_SUBST(INSTALLDIRNAME)
13016 AC_MSG_CHECKING([for prefix])
13017 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13018 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13019 PREFIXDIR="$prefix"
13020 AC_MSG_RESULT([$PREFIXDIR])
13021 AC_SUBST(PREFIXDIR)
13023 LIBDIR=[$(eval echo $(eval echo $libdir))]
13024 AC_SUBST(LIBDIR)
13026 DATADIR=[$(eval echo $(eval echo $datadir))]
13027 AC_SUBST(DATADIR)
13029 MANDIR=[$(eval echo $(eval echo $mandir))]
13030 AC_SUBST(MANDIR)
13032 DOCDIR=[$(eval echo $(eval echo $docdir))]
13033 AC_SUBST(DOCDIR)
13035 BINDIR=[$(eval echo $(eval echo $bindir))]
13036 AC_SUBST(BINDIR)
13038 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13039 AC_SUBST(INSTALLDIR)
13041 TESTINSTALLDIR="${BUILDDIR}/test-install"
13042 AC_SUBST(TESTINSTALLDIR)
13045 # ===================================================================
13046 # OAuth2 id and secrets
13047 # ===================================================================
13049 AC_MSG_CHECKING([for Google Drive client id and secret])
13050 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13051     AC_MSG_RESULT([not set])
13052     GDRIVE_CLIENT_ID="\"\""
13053     GDRIVE_CLIENT_SECRET="\"\""
13054 else
13055     AC_MSG_RESULT([set])
13056     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13057     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13059 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13060 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13062 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13063 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13064     AC_MSG_RESULT([not set])
13065     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13066     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13067 else
13068     AC_MSG_RESULT([set])
13069     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13070     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13072 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13073 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13075 AC_MSG_CHECKING([for OneDrive client id and secret])
13076 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13077     AC_MSG_RESULT([not set])
13078     ONEDRIVE_CLIENT_ID="\"\""
13079     ONEDRIVE_CLIENT_SECRET="\"\""
13080 else
13081     AC_MSG_RESULT([set])
13082     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13083     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13085 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13086 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13089 dnl ===================================================================
13090 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13091 dnl --enable-dependency-tracking configure option
13092 dnl ===================================================================
13093 AC_MSG_CHECKING([whether to enable dependency tracking])
13094 if test "$enable_dependency_tracking" = "no"; then
13095     nodep=TRUE
13096     AC_MSG_RESULT([no])
13097 else
13098     AC_MSG_RESULT([yes])
13100 AC_SUBST(nodep)
13102 dnl ===================================================================
13103 dnl Number of CPUs to use during the build
13104 dnl ===================================================================
13105 AC_MSG_CHECKING([for number of processors to use])
13106 # plain --with-parallelism is just the default
13107 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13108     if test "$with_parallelism" = "no"; then
13109         PARALLELISM=0
13110     else
13111         PARALLELISM=$with_parallelism
13112     fi
13113 else
13114     if test "$enable_icecream" = "yes"; then
13115         PARALLELISM="40"
13116     else
13117         case `uname -s` in
13119         Darwin|FreeBSD|NetBSD|OpenBSD)
13120             PARALLELISM=`sysctl -n hw.ncpu`
13121             ;;
13123         Linux)
13124             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13125         ;;
13126         # what else than above does profit here *and* has /proc?
13127         *)
13128             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13129             ;;
13130         esac
13132         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13133         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13134     fi
13137 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13138     if test -z "$with_parallelism"; then
13139             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13140             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13141             PARALLELISM="1"
13142     else
13143         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."
13144     fi
13147 if test $PARALLELISM -eq 0; then
13148     AC_MSG_RESULT([explicit make -j option needed])
13149 else
13150     AC_MSG_RESULT([$PARALLELISM])
13152 AC_SUBST(PARALLELISM)
13154 IWYU_PATH="$with_iwyu"
13155 AC_SUBST(IWYU_PATH)
13156 if test ! -z "$IWYU_PATH"; then
13157     if test ! -f "$IWYU_PATH"; then
13158         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13159     fi
13163 # Set up ILIB for MSVC build
13165 ILIB1=
13166 if test "$build_os" = "cygwin"; then
13167     ILIB="."
13168     if test -n "$JAVA_HOME"; then
13169         ILIB="$ILIB;$JAVA_HOME/lib"
13170     fi
13171     ILIB1=-link
13172     if test "$BITNESS_OVERRIDE" = 64; then
13173         ILIB="$ILIB;$COMPATH/lib/x64"
13174         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
13175         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
13176         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
13177         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13178             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
13179             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
13180         fi
13181         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
13182         ucrtlibpath_formatted=$formatted_path
13183         ILIB="$ILIB;$ucrtlibpath_formatted"
13184         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13185     else
13186         ILIB="$ILIB;$COMPATH/lib/x86"
13187         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
13188         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
13189         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
13190         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13191             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
13192             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
13193         fi
13194         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
13195         ucrtlibpath_formatted=$formatted_path
13196         ILIB="$ILIB;$ucrtlibpath_formatted"
13197         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13198     fi
13199     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13200         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13201     else
13202         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
13203     fi
13205     AC_SUBST(ILIB)
13208 # ===================================================================
13209 # Creating bigger shared library to link against
13210 # ===================================================================
13211 AC_MSG_CHECKING([whether to create huge library])
13212 MERGELIBS=
13214 if test $_os = iOS -o $_os = Android; then
13215     # Never any point in mergelibs for these as we build just static
13216     # libraries anyway...
13217     enable_mergelibs=no
13220 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
13221     if test $_os != Linux -a $_os != WINNT; then
13222         add_warning "--enable-mergelibs is not tested for this platform"
13223     fi
13224     MERGELIBS="TRUE"
13225     AC_MSG_RESULT([yes])
13226     AC_DEFINE(ENABLE_MERGELIBS)
13227 else
13228     AC_MSG_RESULT([no])
13230 AC_SUBST([MERGELIBS])
13232 dnl ===================================================================
13233 dnl icerun is a wrapper that stops us spawning tens of processes
13234 dnl locally - for tools that can't be executed on the compile cluster
13235 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
13236 dnl ===================================================================
13237 AC_MSG_CHECKING([whether to use icerun wrapper])
13238 ICECREAM_RUN=
13239 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
13240     ICECREAM_RUN=icerun
13241     AC_MSG_RESULT([yes])
13242 else
13243     AC_MSG_RESULT([no])
13245 AC_SUBST(ICECREAM_RUN)
13247 dnl ===================================================================
13248 dnl Setup the ICECC_VERSION for the build the same way it was set for
13249 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
13250 dnl ===================================================================
13251 x_ICECC_VERSION=[\#]
13252 if test -n "$ICECC_VERSION" ; then
13253     x_ICECC_VERSION=
13255 AC_SUBST(x_ICECC_VERSION)
13256 AC_SUBST(ICECC_VERSION)
13258 dnl ===================================================================
13260 AC_MSG_CHECKING([MPL subset])
13261 MPL_SUBSET=
13263 if test "$enable_mpl_subset" = "yes"; then
13264     warn_report=false
13265     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13266         warn_report=true
13267     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
13268         warn_report=true
13269     fi
13270     if test "$warn_report" = "true"; then
13271         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
13272     fi
13273     if test "x$enable_postgresql_sdbc" != "xno"; then
13274         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
13275     fi
13276     if test "$enable_lotuswordpro" = "yes"; then
13277         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
13278     fi
13279     if test "$WITH_WEBDAV" = "neon"; then
13280         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
13281     fi
13282     if test -n "$ENABLE_POPPLER"; then
13283         if test "x$SYSTEM_POPPLER" = "x"; then
13284             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
13285         fi
13286     fi
13287     # cf. m4/libo_check_extension.m4
13288     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
13289         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
13290     fi
13291     for theme in $WITH_THEMES; do
13292         case $theme in
13293         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sukapura|sukapura_svg) #blacklist of icon themes under GPL or LGPL
13294             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
13295         *) : ;;
13296         esac
13297     done
13299     ENABLE_OPENGL_TRANSITIONS=
13301     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
13302         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
13303     fi
13305     MPL_SUBSET="TRUE"
13306     AC_DEFINE(MPL_HAVE_SUBSET)
13307     AC_MSG_RESULT([only])
13308 else
13309     AC_MSG_RESULT([no restrictions])
13311 AC_SUBST(MPL_SUBSET)
13313 dnl ===================================================================
13315 AC_MSG_CHECKING([formula logger])
13316 ENABLE_FORMULA_LOGGER=
13318 if test "x$enable_formula_logger" = "xyes"; then
13319     AC_MSG_RESULT([yes])
13320     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13321     ENABLE_FORMULA_LOGGER=TRUE
13322 elif test -n "$ENABLE_DBGUTIL" ; then
13323     AC_MSG_RESULT([yes])
13324     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13325     ENABLE_FORMULA_LOGGER=TRUE
13326 else
13327     AC_MSG_RESULT([no])
13330 AC_SUBST(ENABLE_FORMULA_LOGGER)
13332 dnl ===================================================================
13333 dnl Checking for active Antivirus software.
13334 dnl ===================================================================
13336 if test $_os = WINNT ; then
13337     AC_MSG_CHECKING([for active Antivirus software])
13338     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
13339     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
13340         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
13341             AC_MSG_RESULT([found])
13342             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
13343             echo $EICAR_STRING > $SRC_ROOT/eicar
13344             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
13345             rm $SRC_ROOT/eicar
13346             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13347                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13348             fi
13349             echo $EICAR_STRING > $BUILDDIR/eicar
13350             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
13351             rm $BUILDDIR/eicar
13352             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13353                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13354             fi
13355             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"
13356         else
13357             AC_MSG_RESULT([not found])
13358         fi
13359     else
13360         AC_MSG_RESULT([n/a])
13361     fi
13364 dnl ===================================================================
13365 dnl Setting up the environment.
13366 dnl ===================================================================
13367 AC_MSG_NOTICE([setting up the build environment variables...])
13369 AC_SUBST(COMPATH)
13371 if test "$build_os" = "cygwin"; then
13372     if test -d "$COMPATH/atlmfc/lib/spectre"; then
13373         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
13374         ATL_INCLUDE="$COMPATH/atlmfc/include"
13375     elif test -d "$COMPATH/atlmfc/lib"; then
13376         ATL_LIB="$COMPATH/atlmfc/lib"
13377         ATL_INCLUDE="$COMPATH/atlmfc/include"
13378     else
13379         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
13380         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
13381     fi
13382     if test "$BITNESS_OVERRIDE" = 64; then
13383         ATL_LIB="$ATL_LIB/x64"
13384     else
13385         ATL_LIB="$ATL_LIB/x86"
13386     fi
13387     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
13388     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
13390     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
13391     PathFormat "/usr/bin/find.exe"
13392     FIND="$formatted_path"
13393     PathFormat "/usr/bin/sort.exe"
13394     SORT="$formatted_path"
13395     PathFormat "/usr/bin/grep.exe"
13396     WIN_GREP="$formatted_path"
13397     PathFormat "/usr/bin/ls.exe"
13398     WIN_LS="$formatted_path"
13399     PathFormat "/usr/bin/touch.exe"
13400     WIN_TOUCH="$formatted_path"
13401 else
13402     FIND=find
13403     SORT=sort
13406 AC_SUBST(ATL_INCLUDE)
13407 AC_SUBST(ATL_LIB)
13408 AC_SUBST(FIND)
13409 AC_SUBST(SORT)
13410 AC_SUBST(WIN_GREP)
13411 AC_SUBST(WIN_LS)
13412 AC_SUBST(WIN_TOUCH)
13414 AC_SUBST(BUILD_TYPE)
13416 AC_SUBST(SOLARINC)
13418 PathFormat "$PERL"
13419 PERL="$formatted_path"
13420 AC_SUBST(PERL)
13422 if test -n "$TMPDIR"; then
13423     TEMP_DIRECTORY="$TMPDIR"
13424 else
13425     TEMP_DIRECTORY="/tmp"
13427 if test "$build_os" = "cygwin"; then
13428     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
13430 AC_SUBST(TEMP_DIRECTORY)
13432 # setup the PATH for the environment
13433 if test -n "$LO_PATH_FOR_BUILD"; then
13434     LO_PATH="$LO_PATH_FOR_BUILD"
13435 else
13436     LO_PATH="$PATH"
13438     case "$host_os" in
13440     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13441         if test "$ENABLE_JAVA" != ""; then
13442             pathmunge "$JAVA_HOME/bin" "after"
13443         fi
13444         ;;
13446     cygwin*)
13447         # Win32 make needs native paths
13448         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13449             LO_PATH=`cygpath -p -m "$PATH"`
13450         fi
13451         if test "$BITNESS_OVERRIDE" = 64; then
13452             # needed for msi packaging
13453             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13454         fi
13455         # .NET 4.6 and higher don't have bin directory
13456         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13457             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13458         fi
13459         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13460         pathmunge "$CSC_PATH" "before"
13461         pathmunge "$MIDL_PATH" "before"
13462         pathmunge "$AL_PATH" "before"
13463         pathmunge "$MSPDB_PATH" "before"
13464         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13465             pathmunge "$CL_PATH" "before"
13466         fi
13467         if test -n "$MSBUILD_PATH" ; then
13468             pathmunge "$MSBUILD_PATH" "before"
13469         fi
13470         if test "$BITNESS_OVERRIDE" = 64; then
13471             pathmunge "$COMPATH/bin/amd64" "before"
13472             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13473         else
13474             pathmunge "$COMPATH/bin" "before"
13475             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13476         fi
13477         if test "$ENABLE_JAVA" != ""; then
13478             if test -d "$JAVA_HOME/jre/bin/client"; then
13479                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13480             fi
13481             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13482                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13483             fi
13484             pathmunge "$JAVA_HOME/bin" "before"
13485         fi
13486         ;;
13488     solaris*)
13489         pathmunge "/usr/css/bin" "before"
13490         if test "$ENABLE_JAVA" != ""; then
13491             pathmunge "$JAVA_HOME/bin" "after"
13492         fi
13493         ;;
13494     esac
13497 AC_SUBST(LO_PATH)
13499 libo_FUZZ_SUMMARY
13501 # Generate a configuration sha256 we can use for deps
13502 if test -f config_host.mk; then
13503     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13505 if test -f config_host_lang.mk; then
13506     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13509 CFLAGS=$my_original_CFLAGS
13510 CXXFLAGS=$my_original_CXXFLAGS
13511 CPPFLAGS=$my_original_CPPFLAGS
13513 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
13514 # BUILD platform configuration] - otherwise breaks cross building
13515 AC_CONFIG_FILES([config_host.mk
13516                  config_host_lang.mk
13517                  Makefile
13518                  bin/bffvalidator.sh
13519                  bin/odfvalidator.sh
13520                  bin/officeotron.sh
13521                  hardened_runtime.xcent
13522                  instsetoo_native/util/openoffice.lst
13523                  sysui/desktop/macosx/Info.plist])
13524 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13525 AC_CONFIG_HEADERS([config_host/config_clang.h])
13526 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13527 AC_CONFIG_HEADERS([config_host/config_eot.h])
13528 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13529 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13530 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13531 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13532 AC_CONFIG_HEADERS([config_host/config_features.h])
13533 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13534 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13535 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13536 AC_CONFIG_HEADERS([config_host/config_folders.h])
13537 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13538 AC_CONFIG_HEADERS([config_host/config_gio.h])
13539 AC_CONFIG_HEADERS([config_host/config_global.h])
13540 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13541 AC_CONFIG_HEADERS([config_host/config_java.h])
13542 AC_CONFIG_HEADERS([config_host/config_langs.h])
13543 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13544 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13545 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13546 AC_CONFIG_HEADERS([config_host/config_locales.h])
13547 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13548 AC_CONFIG_HEADERS([config_host/config_oox.h])
13549 AC_CONFIG_HEADERS([config_host/config_options.h])
13550 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13551 AC_CONFIG_HEADERS([config_host/config_skia.h])
13552 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13553 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13554 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13555 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13556 AC_CONFIG_HEADERS([config_host/config_version.h])
13557 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13558 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13559 AC_CONFIG_HEADERS([config_host/config_python.h])
13560 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13561 AC_OUTPUT
13563 if test "$CROSS_COMPILING" = TRUE; then
13564     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13567 # touch the config timestamp file
13568 if test ! -f config_host.mk.stamp; then
13569     echo > config_host.mk.stamp
13570 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13571     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13572 else
13573     echo > config_host.mk.stamp
13576 # touch the config lang timestamp file
13577 if test ! -f config_host_lang.mk.stamp; then
13578     echo > config_host_lang.mk.stamp
13579 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13580     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13581 else
13582     echo > config_host_lang.mk.stamp
13586 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13587         -a "$build_os" = "cygwin"; then
13589 cat << _EOS
13590 ****************************************************************************
13591 WARNING:
13592 Your make version is known to be horribly slow, and hard to debug
13593 problems with. To get a reasonably functional make please do:
13595 to install a pre-compiled binary make for Win32
13597  mkdir -p /opt/lo/bin
13598  cd /opt/lo/bin
13599  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13600  cp make-4.2.1-msvc.exe make
13601  chmod +x make
13603 to install from source:
13604 place yourself in a working directory of you choice.
13606  git clone git://git.savannah.gnu.org/make.git
13608  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
13609  set PATH=%PATH%;C:\Cygwin\bin
13610  [or Cygwin64, if that is what you have]
13611  cd path-to-make-repo-you-cloned-above
13612  build_w32.bat --without-guile
13614 should result in a WinRel/gnumake.exe.
13615 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13617 Then re-run autogen.sh
13619 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13620 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13622 _EOS
13623 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13624     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13629 cat << _EOF
13630 ****************************************************************************
13632 To build, run:
13633 $GNUMAKE
13635 To view some help, run:
13636 $GNUMAKE help
13638 _EOF
13640 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13641     cat << _EOF
13642 After the build has finished successfully, you can immediately run what you built using the command:
13643 _EOF
13645     if test $_os = Darwin; then
13646         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
13647     else
13648         echo instdir/program/soffice
13649     fi
13650     cat << _EOF
13652 If you want to run the smoketest, run:
13653 $GNUMAKE check
13655 _EOF
13658 if test -f warn; then
13659     cat warn
13660     rm warn
13663 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: