Bump version to 7.0.7.0.M8
[LibreOffice.git] / configure.ac
blob5ce98203def70a04a4942f41c0eb4900154e5fca
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.0.7.0.M8],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 LIBO_VERSION_SUFFIX=$5
212 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
213 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
214 # they get undoubled before actually passed to sed.
215 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
216 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
217 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
218 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
220 AC_SUBST(LIBO_VERSION_MAJOR)
221 AC_SUBST(LIBO_VERSION_MINOR)
222 AC_SUBST(LIBO_VERSION_MICRO)
223 AC_SUBST(LIBO_VERSION_PATCH)
224 AC_SUBST(LIBO_VERSION_SUFFIX)
225 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
227 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
228 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
229 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
230 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
232 LIBO_THIS_YEAR=`date +%Y`
233 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
235 dnl ===================================================================
236 dnl Product version
237 dnl ===================================================================
238 AC_MSG_CHECKING([for product version])
239 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
240 AC_MSG_RESULT([$PRODUCTVERSION])
241 AC_SUBST(PRODUCTVERSION)
243 AC_PROG_EGREP
244 # AC_PROG_EGREP doesn't set GREP on all systems as well
245 AC_PATH_PROG(GREP, grep)
247 BUILDDIR=`pwd`
248 cd $srcdir
249 SRC_ROOT=`pwd`
250 cd $BUILDDIR
251 x_Cygwin=[\#]
253 dnl ======================================
254 dnl Required GObject introspection version
255 dnl ======================================
256 INTROSPECTION_REQUIRED_VERSION=1.32.0
258 dnl ===================================================================
259 dnl Search all the common names for GNU Make
260 dnl ===================================================================
261 AC_MSG_CHECKING([for GNU Make])
263 # try to use our own make if it is available and GNUMAKE was not already defined
264 if test -z "$GNUMAKE"; then
265     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
266         GNUMAKE="$LODE_HOME/opt/bin/make"
267     elif test -x "/opt/lo/bin/make"; then
268         GNUMAKE="/opt/lo/bin/make"
269     fi
272 GNUMAKE_WIN_NATIVE=
273 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
274     if test -n "$a"; then
275         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
276         if test $? -eq 0;  then
277             if test "$build_os" = "cygwin"; then
278                 if test -n "$($a -v | grep 'Built for Windows')" ; then
279                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
280                     GNUMAKE_WIN_NATIVE="TRUE"
281                 else
282                     GNUMAKE=`which $a`
283                 fi
284             else
285                 GNUMAKE=`which $a`
286             fi
287             break
288         fi
289     fi
290 done
291 AC_MSG_RESULT($GNUMAKE)
292 if test -z "$GNUMAKE"; then
293     AC_MSG_ERROR([not found. install GNU Make.])
294 else
295     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
296         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
297     fi
300 win_short_path_for_make()
302     local_short_path="$1"
303     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
304         cygpath -sm "$local_short_path"
305     else
306         cygpath -u "$(cygpath -d "$local_short_path")"
307     fi
311 if test "$build_os" = "cygwin"; then
312     PathFormat "$SRC_ROOT"
313     SRC_ROOT="$formatted_path"
314     PathFormat "$BUILDDIR"
315     BUILDDIR="$formatted_path"
316     x_Cygwin=
317     AC_MSG_CHECKING(for explicit COMSPEC)
318     if test -z "$COMSPEC"; then
319         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
320     else
321         AC_MSG_RESULT([found: $COMSPEC])
322     fi
325 AC_SUBST(SRC_ROOT)
326 AC_SUBST(BUILDDIR)
327 AC_SUBST(x_Cygwin)
328 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
329 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
330 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
332 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
333     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
336 # need sed in os checks...
337 AC_PATH_PROGS(SED, sed)
338 if test -z "$SED"; then
339     AC_MSG_ERROR([install sed to run this script])
342 # Set the ENABLE_LTO variable
343 # ===================================================================
344 AC_MSG_CHECKING([whether to use link-time optimization])
345 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
346     ENABLE_LTO="TRUE"
347     AC_MSG_RESULT([yes])
348 else
349     ENABLE_LTO=""
350     AC_MSG_RESULT([no])
352 AC_SUBST(ENABLE_LTO)
354 AC_ARG_ENABLE(fuzz-options,
355     AS_HELP_STRING([--enable-fuzz-options],
356         [Randomly enable or disable each of those configurable options
357          that are supposed to be freely selectable without interdependencies,
358          or where bad interaction from interdependencies is automatically avoided.])
361 dnl ===================================================================
362 dnl When building for Android, --with-android-ndk,
363 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
364 dnl mandatory
365 dnl ===================================================================
367 AC_ARG_WITH(android-ndk,
368     AS_HELP_STRING([--with-android-ndk],
369         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
372 AC_ARG_WITH(android-ndk-toolchain-version,
373     AS_HELP_STRING([--with-android-ndk-toolchain-version],
374         [Specify which toolchain version to use, of those present in the
375         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
376         with_android_ndk_toolchain_version=clang5.0)
378 AC_ARG_WITH(android-sdk,
379     AS_HELP_STRING([--with-android-sdk],
380         [Specify location of the Android SDK. Mandatory when building for Android.]),
383 AC_ARG_WITH(android-api-level,
384     AS_HELP_STRING([--with-android-api-level],
385         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
388 ANDROID_NDK_HOME=
389 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
390     with_android_ndk="$SRC_ROOT/external/android-ndk"
392 if test -n "$with_android_ndk"; then
393     eval ANDROID_NDK_HOME=$with_android_ndk
395     # Set up a lot of pre-canned defaults
397     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
398         if test ! -f $ANDROID_NDK_HOME/source.properties; then
399             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
400         fi
401         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
402     else
403         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
404     fi
405     if test -z "$ANDROID_NDK_VERSION";  then
406         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
407     fi
408     case $ANDROID_NDK_VERSION in
409     r9*|r10*)
410         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
411         ;;
412     11.1.*|12.1.*|13.1.*|14.1.*)
413         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
414         ;;
415     16.*|17.*|18.*|19.*|20.*)
416         ;;
417     *)
418         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
419         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
420         ;;
421     esac
423     ANDROID_API_LEVEL=16
424     if test -n "$with_android_api_level" ; then
425         ANDROID_API_LEVEL="$with_android_api_level"
426     fi
428     android_cpu=$host_cpu
429     if test $host_cpu = arm; then
430         android_platform_prefix=arm-linux-androideabi
431         android_gnu_prefix=$android_platform_prefix
432         LLVM_TRIPLE=armv7a-linux-androideabi
433         ANDROID_APP_ABI=armeabi-v7a
434         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
435     elif test $host_cpu = aarch64; then
436         android_platform_prefix=aarch64-linux-android
437         android_gnu_prefix=$android_platform_prefix
438         LLVM_TRIPLE=$android_platform_prefix
439         # minimum android version that supports aarch64
440         if test "$ANDROID_API_LEVEL" -lt "21" ; then
441             ANDROID_API_LEVEL=21
442         fi
443         ANDROID_APP_ABI=arm64-v8a
444     elif test $host_cpu = x86_64; then
445         android_platform_prefix=x86_64-linux-android
446         android_gnu_prefix=$android_platform_prefix
447         LLVM_TRIPLE=$android_platform_prefix
448         # minimum android version that supports x86_64
449         ANDROID_API_LEVEL=21
450         ANDROID_APP_ABI=x86_64
451     else
452         # host_cpu is something like "i386" or "i686" I guess, NDK uses
453         # "x86" in some contexts
454         android_cpu=x86
455         android_platform_prefix=$android_cpu
456         android_gnu_prefix=i686-linux-android
457         LLVM_TRIPLE=$android_gnu_prefix
458         ANDROID_APP_ABI=x86
459     fi
461     case "$with_android_ndk_toolchain_version" in
462     clang5.0)
463         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
464         ;;
465     *)
466         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
467     esac
469     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
471     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
472     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
473     # manage to link the (app-specific) single huge .so that is built for the app in
474     # android/source/ if there is debug information in a significant part of the object files.
475     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
476     # all objects have been built with debug information.)
477     case $build_os in
478     linux-gnu*)
479         android_HOST_TAG=linux-x86_64
480         ;;
481     darwin*)
482         android_HOST_TAG=darwin-x86_64
483         ;;
484     *)
485         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
486         # ndk would also support windows and windows-x86_64
487         ;;
488     esac
489     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
490     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
491     dnl TODO: NSS build uses it...
492     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
493     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
495     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
496     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
497     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
498     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
499     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
501     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
502     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
503     if test "$ENABLE_LTO" = TRUE; then
504         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
505         # $CC and $CXX when building external libraries
506         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
507     fi
509     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
511     if test -z "$CC"; then
512         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
513         CC_BASE="clang"
514     fi
515     if test -z "$CXX"; then
516         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
517         CXX_BASE="clang++"
518     fi
520     # remember to download the ownCloud Android library later
521     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
523 AC_SUBST(ANDROID_NDK_HOME)
524 AC_SUBST(ANDROID_APP_ABI)
525 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
527 dnl ===================================================================
528 dnl --with-android-sdk
529 dnl ===================================================================
530 ANDROID_SDK_HOME=
531 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
532     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
534 if test -n "$with_android_sdk"; then
535     eval ANDROID_SDK_HOME=$with_android_sdk
536     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
538 AC_SUBST(ANDROID_SDK_HOME)
540 AC_ARG_ENABLE([android-lok],
541     AS_HELP_STRING([--enable-android-lok],
542         [The Android app from the android/ subdir needs several tweaks all
543          over the place that break the LOK when used in the Online-based
544          Android app.  This switch indicates that the intent of this build is
545          actually the Online-based, non-modified LOK.])
547 ENABLE_ANDROID_LOK=
548 if test -n "$ANDROID_NDK_HOME" ; then
549     if test "$enable_android_lok" = yes; then
550         ENABLE_ANDROID_LOK=TRUE
551         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
552         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
553     else
554         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
555     fi
557 AC_SUBST([ENABLE_ANDROID_LOK])
559 libo_FUZZ_ARG_ENABLE([android-editing],
560     AS_HELP_STRING([--enable-android-editing],
561         [Enable the experimental editing feature on Android.])
563 ENABLE_ANDROID_EDITING=
564 if test "$enable_android_editing" = yes; then
565     ENABLE_ANDROID_EDITING=TRUE
567 AC_SUBST([ENABLE_ANDROID_EDITING])
569 dnl ===================================================================
570 dnl The following is a list of supported systems.
571 dnl Sequential to keep the logic very simple
572 dnl These values may be checked and reset later.
573 dnl ===================================================================
574 #defaults unless the os test overrides this:
575 test_randr=yes
576 test_xrender=yes
577 test_cups=yes
578 test_dbus=yes
579 test_fontconfig=yes
580 test_cairo=no
581 test_gdb_index=no
582 test_split_debug=no
584 # Default values, as such probably valid just for Linux, set
585 # differently below just for Mac OSX, but at least better than
586 # hardcoding these as we used to do. Much of this is duplicated also
587 # in solenv for old build system and for gbuild, ideally we should
588 # perhaps define stuff like this only here in configure.ac?
590 LINKFLAGSSHL="-shared"
591 PICSWITCH="-fpic"
592 DLLPOST=".so"
594 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
596 INSTROOTBASESUFFIX=
597 INSTROOTCONTENTSUFFIX=
598 SDKDIRNAME=sdk
600 HOST_PLATFORM="$host"
602 host_cpu_for_clang="$host_cpu"
604 case "$host_os" in
606 solaris*)
607     build_gstreamer_1_0=yes
608     test_freetype=yes
609     build_skia=yes
610     _os=SunOS
612     dnl ===========================================================
613     dnl Check whether we're using Solaris 10 - SPARC or Intel.
614     dnl ===========================================================
615     AC_MSG_CHECKING([the Solaris operating system release])
616     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
617     if test "$_os_release" -lt "10"; then
618         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
619     else
620         AC_MSG_RESULT([ok ($_os_release)])
621     fi
623     dnl Check whether we're using a SPARC or i386 processor
624     AC_MSG_CHECKING([the processor type])
625     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
626         AC_MSG_RESULT([ok ($host_cpu)])
627     else
628         AC_MSG_ERROR([only SPARC and i386 processors are supported])
629     fi
630     ;;
632 linux-gnu*|k*bsd*-gnu*)
633     build_gstreamer_1_0=yes
634     test_kf5=yes
635     test_gtk3_kde5=yes
636     build_skia=yes
637     test_gdb_index=yes
638     test_split_debug=yes
639     if test "$enable_fuzzers" != yes; then
640         test_freetype=yes
641         test_fontconfig=yes
642     else
643         test_freetype=no
644         test_fontconfig=no
645         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
646     fi
647     _os=Linux
648     ;;
650 gnu)
651     test_randr=no
652     test_xrender=no
653     _os=GNU
654      ;;
656 cygwin*|interix*)
658     # When building on Windows normally with MSVC under Cygwin,
659     # configure thinks that the host platform (the platform the
660     # built code will run on) is Cygwin, even if it obviously is
661     # Windows, which in Autoconf terminology is called
662     # "mingw32". (Which is misleading as MinGW is the name of the
663     # tool-chain, not an operating system.)
665     # Somewhat confusing, yes. But this configure script doesn't
666     # look at $host etc that much, it mostly uses its own $_os
667     # variable, set here in this case statement.
669     test_cups=no
670     test_dbus=no
671     test_randr=no
672     test_xrender=no
673     test_freetype=no
674     test_fontconfig=no
675     build_skia=yes
676     _os=WINNT
678     DLLPOST=".dll"
679     LINKFLAGSNOUNDEFS=
680     ;;
682 darwin*|macos*) # macOS
683     test_randr=no
684     test_xrender=no
685     test_freetype=no
686     test_fontconfig=no
687     test_dbus=no
688     if test -n "$LODE_HOME" ; then
689         mac_sanitize_path
690         AC_MSG_NOTICE([sanitized the PATH to $PATH])
691     fi
692     _os=Darwin
693     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
694     INSTROOTCONTENTSUFFIX=/Contents
695     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
696     # See comment above the case "$host_os"
697     LINKFLAGSSHL="-dynamiclib -single_module"
699     # -fPIC is default
700     PICSWITCH=""
702     DLLPOST=".dylib"
704     # -undefined error is the default
705     LINKFLAGSNOUNDEFS=""
706     case "$host_cpu" in
707     aarch64|arm64)
708         case "$host_os" in
709         macos*)
710             # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
711             # the "macos" part so be sure to use aarch64-apple-darwin for now.
712             HOST_PLATFORM=aarch64-apple-darwin
713             ;;
714         esac
716         # Apple's Clang uses "arm64"
717         host_cpu_for_clang=arm64
718     esac
721 ios*) # iOS
722     test_randr=no
723     test_xrender=no
724     test_freetype=no
725     test_fontconfig=no
726     test_dbus=no
727     if test -n "$LODE_HOME" ; then
728         mac_sanitize_path
729         AC_MSG_NOTICE([sanitized the PATH to $PATH])
730     fi
731     build_for_ios=YES
732     _os=iOS
733     test_cups=no
734     enable_mpl_subset=yes
735     enable_lotuswordpro=no
736     enable_coinmp=no
737     enable_lpsolve=no
738     enable_postgresql_sdbc=no
739     enable_extension_integration=no
740     enable_report_builder=no
741     with_ppds=no
742     if test "$enable_ios_simulator" = "yes"; then
743         host=x86_64-apple-darwin
744     fi
745     # See comment above the case "$host_os"
746     LINKFLAGSSHL="-dynamiclib -single_module"
748     # -fPIC is default
749     PICSWITCH=""
751     DLLPOST=".dylib"
753     # -undefined error is the default
754     LINKFLAGSNOUNDEFS=""
756     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
757     # part, so use aarch64-apple-darwin for now.
758     HOST_PLATFORM=aarch64-apple-darwin
760     # Apple's Clang uses "arm64"
761     host_cpu_for_clang=arm64
764 freebsd*)
765     build_gstreamer_1_0=yes
766     test_kf5=yes
767     test_gtk3_kde5=yes
768     test_freetype=yes
769     build_skia=yes
770     AC_MSG_CHECKING([the FreeBSD operating system release])
771     if test -n "$with_os_version"; then
772         OSVERSION="$with_os_version"
773     else
774         OSVERSION=`/sbin/sysctl -n kern.osreldate`
775     fi
776     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
777     AC_MSG_CHECKING([which thread library to use])
778     if test "$OSVERSION" -lt "500016"; then
779         PTHREAD_CFLAGS="-D_THREAD_SAFE"
780         PTHREAD_LIBS="-pthread"
781     elif test "$OSVERSION" -lt "502102"; then
782         PTHREAD_CFLAGS="-D_THREAD_SAFE"
783         PTHREAD_LIBS="-lc_r"
784     else
785         PTHREAD_CFLAGS=""
786         PTHREAD_LIBS="-pthread"
787     fi
788     AC_MSG_RESULT([$PTHREAD_LIBS])
789     _os=FreeBSD
790     ;;
792 *netbsd*)
793     build_gstreamer_1_0=yes
794     test_kf5=yes
795     test_gtk3_kde5=yes
796     test_freetype=yes
797     build_skia=yes
798     PTHREAD_LIBS="-pthread -lpthread"
799     _os=NetBSD
800     ;;
802 aix*)
803     test_randr=no
804     test_freetype=yes
805     PTHREAD_LIBS=-pthread
806     _os=AIX
807     ;;
809 openbsd*)
810     test_freetype=yes
811     PTHREAD_CFLAGS="-D_THREAD_SAFE"
812     PTHREAD_LIBS="-pthread"
813     _os=OpenBSD
814     ;;
816 dragonfly*)
817     build_gstreamer_1_0=yes
818     test_kf5=yes
819     test_gtk3_kde5=yes
820     test_freetype=yes
821     build_skia=yes
822     PTHREAD_LIBS="-pthread"
823     _os=DragonFly
824     ;;
826 linux-android*)
827     build_gstreamer_1_0=no
828     enable_lotuswordpro=no
829     enable_mpl_subset=yes
830     enable_coinmp=yes
831     enable_lpsolve=no
832     enable_report_builder=no
833     enable_odk=no
834     enable_postgresql_sdbc=no
835     enable_python=no
836     test_cups=no
837     test_dbus=no
838     test_fontconfig=no
839     test_freetype=no
840     test_kf5=no
841     test_qt5=no
842     test_gtk3_kde5=no
843     test_randr=no
844     test_xrender=no
845     _os=Android
847     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
848     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
849     ;;
851 haiku*)
852     test_cups=no
853     test_dbus=no
854     test_randr=no
855     test_xrender=no
856     test_freetype=yes
857     enable_odk=no
858     enable_gstreamer_1_0=no
859     enable_vlc=no
860     enable_coinmp=no
861     enable_pdfium=no
862     enable_sdremote=no
863     enable_postgresql_sdbc=no
864     enable_firebird_sdbc=no
865     _os=Haiku
866     ;;
869     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
870     ;;
871 esac
873 AC_SUBST(HOST_PLATFORM)
875 if test "$_os" = "Android" ; then
876     # Verify that the NDK and SDK options are proper
877     if test -z "$with_android_ndk"; then
878         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
879     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
880         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
881     fi
883     if test -z "$ANDROID_SDK_HOME"; then
884         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
885     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
886         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
887     fi
889     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
890     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
891         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
892                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
893                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
894         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
895         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
896         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
897     fi
898     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
899         AC_MSG_WARN([android support repository not found - install with
900                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
901                      to allow the build to download the specified version of the android support libraries])
902         add_warning "android support repository not found - install with"
903         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
904         add_warning "to allow the build to download the specified version of the android support libraries"
905     fi
908 if test "$_os" = "AIX"; then
909     AC_PATH_PROG(GAWK, gawk)
910     if test -z "$GAWK"; then
911         AC_MSG_ERROR([gawk not found in \$PATH])
912     fi
915 AC_SUBST(SDKDIRNAME)
917 AC_SUBST(PTHREAD_CFLAGS)
918 AC_SUBST(PTHREAD_LIBS)
920 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
921 # By default use the ones specified by our build system,
922 # but explicit override is possible.
923 AC_MSG_CHECKING(for explicit AFLAGS)
924 if test -n "$AFLAGS"; then
925     AC_MSG_RESULT([$AFLAGS])
926     x_AFLAGS=
927 else
928     AC_MSG_RESULT(no)
929     x_AFLAGS=[\#]
931 AC_MSG_CHECKING(for explicit CFLAGS)
932 if test -n "$CFLAGS"; then
933     AC_MSG_RESULT([$CFLAGS])
934     x_CFLAGS=
935 else
936     AC_MSG_RESULT(no)
937     x_CFLAGS=[\#]
939 AC_MSG_CHECKING(for explicit CXXFLAGS)
940 if test -n "$CXXFLAGS"; then
941     AC_MSG_RESULT([$CXXFLAGS])
942     x_CXXFLAGS=
943 else
944     AC_MSG_RESULT(no)
945     x_CXXFLAGS=[\#]
947 AC_MSG_CHECKING(for explicit OBJCFLAGS)
948 if test -n "$OBJCFLAGS"; then
949     AC_MSG_RESULT([$OBJCFLAGS])
950     x_OBJCFLAGS=
951 else
952     AC_MSG_RESULT(no)
953     x_OBJCFLAGS=[\#]
955 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
956 if test -n "$OBJCXXFLAGS"; then
957     AC_MSG_RESULT([$OBJCXXFLAGS])
958     x_OBJCXXFLAGS=
959 else
960     AC_MSG_RESULT(no)
961     x_OBJCXXFLAGS=[\#]
963 AC_MSG_CHECKING(for explicit LDFLAGS)
964 if test -n "$LDFLAGS"; then
965     AC_MSG_RESULT([$LDFLAGS])
966     x_LDFLAGS=
967 else
968     AC_MSG_RESULT(no)
969     x_LDFLAGS=[\#]
971 AC_SUBST(AFLAGS)
972 AC_SUBST(CFLAGS)
973 AC_SUBST(CXXFLAGS)
974 AC_SUBST(OBJCFLAGS)
975 AC_SUBST(OBJCXXFLAGS)
976 AC_SUBST(LDFLAGS)
977 AC_SUBST(x_AFLAGS)
978 AC_SUBST(x_CFLAGS)
979 AC_SUBST(x_CXXFLAGS)
980 AC_SUBST(x_OBJCFLAGS)
981 AC_SUBST(x_OBJCXXFLAGS)
982 AC_SUBST(x_LDFLAGS)
984 dnl These are potentially set for MSVC, in the code checking for UCRT below:
985 my_original_CFLAGS=$CFLAGS
986 my_original_CXXFLAGS=$CXXFLAGS
987 my_original_CPPFLAGS=$CPPFLAGS
989 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
990 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
991 dnl AC_PROG_CC internally.
992 if test "$_os" != "WINNT"; then
993     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
994     save_CFLAGS=$CFLAGS
995     AC_PROG_CC
996     CFLAGS=$save_CFLAGS
997     if test -z "$CC_BASE"; then
998         CC_BASE=`first_arg_basename "$CC"`
999     fi
1002 if test "$_os" != "WINNT"; then
1003     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1004 else
1005     ENDIANNESS=little
1007 AC_SUBST(ENDIANNESS)
1009 if test $_os != "WINNT"; then
1010     save_LIBS="$LIBS"
1011     AC_SEARCH_LIBS([dlsym], [dl],
1012         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1013         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1014     LIBS="$save_LIBS"
1016 AC_SUBST(DLOPEN_LIBS)
1018 AC_ARG_ENABLE(ios-simulator,
1019     AS_HELP_STRING([--enable-ios-simulator],
1020         [build i386 or x86_64 for ios simulator])
1023 AC_ARG_ENABLE(ios-libreofficelight-app,
1024     AS_HELP_STRING([--enable-ios-libreofficelight-app],
1025         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
1026          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
1027          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
1030 ENABLE_IOS_LIBREOFFICELIGHT_APP=
1031 if test "$enable_ios_libreofficelight_app" = yes; then
1032     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
1034 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
1036 ###############################################################################
1037 # Extensions switches --enable/--disable
1038 ###############################################################################
1039 # By default these should be enabled unless having extra dependencies.
1040 # If there is extra dependency over configure options then the enable should
1041 # be automagic based on whether the requiring feature is enabled or not.
1042 # All this options change anything only with --enable-extension-integration.
1044 # The name of this option and its help string makes it sound as if
1045 # extensions are built anyway, just not integrated in the installer,
1046 # if you use --disable-extension-integration. Is that really the
1047 # case?
1049 libo_FUZZ_ARG_ENABLE(extension-integration,
1050     AS_HELP_STRING([--disable-extension-integration],
1051         [Disable integration of the built extensions in the installer of the
1052          product. Use this switch to disable the integration.])
1055 AC_ARG_ENABLE(avmedia,
1056     AS_HELP_STRING([--disable-avmedia],
1057         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1060 AC_ARG_ENABLE(database-connectivity,
1061     AS_HELP_STRING([--disable-database-connectivity],
1062         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1065 # This doesn't mean not building (or "integrating") extensions
1066 # (although it probably should; i.e. it should imply
1067 # --disable-extension-integration I guess), it means not supporting
1068 # any extension mechanism at all
1069 libo_FUZZ_ARG_ENABLE(extensions,
1070     AS_HELP_STRING([--disable-extensions],
1071         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1074 AC_ARG_ENABLE(scripting,
1075     AS_HELP_STRING([--disable-scripting],
1076         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1079 # This is mainly for Android and iOS, but could potentially be used in some
1080 # special case otherwise, too, so factored out as a separate setting
1082 AC_ARG_ENABLE(dynamic-loading,
1083     AS_HELP_STRING([--disable-dynamic-loading],
1084         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1087 libo_FUZZ_ARG_ENABLE(report-builder,
1088     AS_HELP_STRING([--disable-report-builder],
1089         [Disable the Report Builder.])
1092 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1093     AS_HELP_STRING([--enable-ext-wiki-publisher],
1094         [Enable the Wiki Publisher extension.])
1097 libo_FUZZ_ARG_ENABLE(lpsolve,
1098     AS_HELP_STRING([--disable-lpsolve],
1099         [Disable compilation of the lp solve solver ])
1101 libo_FUZZ_ARG_ENABLE(coinmp,
1102     AS_HELP_STRING([--disable-coinmp],
1103         [Disable compilation of the CoinMP solver ])
1106 libo_FUZZ_ARG_ENABLE(pdfimport,
1107     AS_HELP_STRING([--disable-pdfimport],
1108         [Disable building the PDF import feature.])
1111 libo_FUZZ_ARG_ENABLE(pdfium,
1112     AS_HELP_STRING([--disable-pdfium],
1113         [Disable building PDFium.])
1116 libo_FUZZ_ARG_ENABLE(skia,
1117     AS_HELP_STRING([--disable-skia],
1118         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1121 ###############################################################################
1123 dnl ---------- *** ----------
1125 libo_FUZZ_ARG_ENABLE(mergelibs,
1126     AS_HELP_STRING([--enable-mergelibs],
1127         [Merge several of the smaller libraries into one big, "merged", one.])
1130 libo_FUZZ_ARG_ENABLE(breakpad,
1131     AS_HELP_STRING([--enable-breakpad],
1132         [Enables breakpad for crash reporting.])
1135 libo_FUZZ_ARG_ENABLE(crashdump,
1136     AS_HELP_STRING([--disable-crashdump],
1137         [Disable dump.ini and dump-file, when --enable-breakpad])
1140 AC_ARG_ENABLE(fetch-external,
1141     AS_HELP_STRING([--disable-fetch-external],
1142         [Disables fetching external tarballs from web sources.])
1145 AC_ARG_ENABLE(fuzzers,
1146     AS_HELP_STRING([--enable-fuzzers],
1147         [Enables building libfuzzer targets for fuzz testing.])
1150 libo_FUZZ_ARG_ENABLE(pch,
1151     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1152         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1153          Using 'system' will include only external headers, 'base' will add also headers
1154          from base modules, 'normal' will also add all headers except from the module built,
1155          'full' will use all suitable headers even from a module itself.])
1158 libo_FUZZ_ARG_ENABLE(epm,
1159     AS_HELP_STRING([--enable-epm],
1160         [LibreOffice includes self-packaging code, that requires epm, however epm is
1161          useless for large scale package building.])
1164 libo_FUZZ_ARG_ENABLE(odk,
1165     AS_HELP_STRING([--disable-odk],
1166         [LibreOffice includes an ODK, office development kit which some packagers may
1167          wish to build without.])
1170 AC_ARG_ENABLE(mpl-subset,
1171     AS_HELP_STRING([--enable-mpl-subset],
1172         [Don't compile any pieces which are not MPL or more liberally licensed])
1175 libo_FUZZ_ARG_ENABLE(evolution2,
1176     AS_HELP_STRING([--enable-evolution2],
1177         [Allows the built-in evolution 2 addressbook connectivity build to be
1178          enabled.])
1181 AC_ARG_ENABLE(avahi,
1182     AS_HELP_STRING([--enable-avahi],
1183         [Determines whether to use Avahi to advertise Impress to remote controls.])
1186 libo_FUZZ_ARG_ENABLE(werror,
1187     AS_HELP_STRING([--enable-werror],
1188         [Turn warnings to errors. (Has no effect in modules where the treating
1189          of warnings as errors is disabled explicitly.)]),
1192 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1193     AS_HELP_STRING([--enable-assert-always-abort],
1194         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1197 libo_FUZZ_ARG_ENABLE(dbgutil,
1198     AS_HELP_STRING([--enable-dbgutil],
1199         [Provide debugging support from --enable-debug and include additional debugging
1200          utilities such as object counting or more expensive checks.
1201          This is the recommended option for developers.
1202          Note that this makes the build ABI incompatible, it is not possible to mix object
1203          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1205 libo_FUZZ_ARG_ENABLE(debug,
1206     AS_HELP_STRING([--enable-debug],
1207         [Include debugging information, disable compiler optimization and inlining plus
1208          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1210 libo_FUZZ_ARG_ENABLE(split-debug,
1211     AS_HELP_STRING([--disable-split-debug],
1212         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1213          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1215 libo_FUZZ_ARG_ENABLE(gdb-index,
1216     AS_HELP_STRING([--disable-gdb-index],
1217         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1218          The feature requires the gold or lld linker.]))
1220 libo_FUZZ_ARG_ENABLE(sal-log,
1221     AS_HELP_STRING([--enable-sal-log],
1222         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1224 libo_FUZZ_ARG_ENABLE(symbols,
1225     AS_HELP_STRING([--enable-symbols],
1226         [Generate debug information.
1227          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1228          otherwise. It is possible to explicitly specify gbuild build targets
1229          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1230          everything in the directory; there is no ordering, more specific overrides
1231          more general, and disabling takes precedence).
1232          Example: --enable-symbols="all -sw/ -Library_sc".]))
1234 libo_FUZZ_ARG_ENABLE(optimized,
1235     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1236         [Whether to compile with optimization flags.
1237          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1238          otherwise. Using 'debug' will try to use only optimizations that should
1239          not interfere with debugging.]))
1241 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1242     AS_HELP_STRING([--disable-runtime-optimizations],
1243         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1244          JVM JIT) that are known to interact badly with certain dynamic analysis
1245          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1246          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1247          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1249 AC_ARG_WITH(valgrind,
1250     AS_HELP_STRING([--with-valgrind],
1251         [Make availability of Valgrind headers a hard requirement.]))
1253 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1254     AS_HELP_STRING([--enable-compiler-plugins],
1255         [Enable compiler plugins that will perform additional checks during
1256          building. Enabled automatically by --enable-dbgutil.
1257          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1258 COMPILER_PLUGINS_DEBUG=
1259 if test "$enable_compiler_plugins" = debug; then
1260     enable_compiler_plugins=yes
1261     COMPILER_PLUGINS_DEBUG=TRUE
1264 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1265     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1266         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1267          relevant in the --disable-compiler-plugins case.]))
1269 libo_FUZZ_ARG_ENABLE(ooenv,
1270     AS_HELP_STRING([--disable-ooenv],
1271         [Disable ooenv for the instdir installation.]))
1273 libo_FUZZ_ARG_ENABLE(libnumbertext,
1274     AS_HELP_STRING([--disable-libnumbertext],
1275         [Disable use of numbertext external library.]))
1277 AC_ARG_ENABLE(lto,
1278     AS_HELP_STRING([--enable-lto],
1279         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1280          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1281          linker. For MSVC, this option is broken at the moment. This is experimental work
1282          in progress that shouldn't be used unless you are working on it.)]))
1284 AC_ARG_ENABLE(python,
1285     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1286         [Enables or disables Python support at run-time.
1287          Also specifies what Python to use at build-time.
1288          'fully-internal' even forces the internal version for uses of Python
1289          during the build.
1290          On macOS the only choices are
1291          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1292          ]))
1294 libo_FUZZ_ARG_ENABLE(gtk3,
1295     AS_HELP_STRING([--disable-gtk3],
1296         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1297 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1299 AC_ARG_ENABLE(introspection,
1300     AS_HELP_STRING([--enable-introspection],
1301         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1302          Linux distributions.)]))
1304 AC_ARG_ENABLE(split-app-modules,
1305     AS_HELP_STRING([--enable-split-app-modules],
1306         [Split file lists for app modules, e.g. base, calc.
1307          Has effect only with make distro-pack-install]),
1310 AC_ARG_ENABLE(split-opt-features,
1311     AS_HELP_STRING([--enable-split-opt-features],
1312         [Split file lists for some optional features, e.g. pyuno, testtool.
1313          Has effect only with make distro-pack-install]),
1316 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1317     AS_HELP_STRING([--disable-cairo-canvas],
1318         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1321 libo_FUZZ_ARG_ENABLE(dbus,
1322     AS_HELP_STRING([--disable-dbus],
1323         [Determines whether to enable features that depend on dbus.
1324          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1325 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1327 libo_FUZZ_ARG_ENABLE(sdremote,
1328     AS_HELP_STRING([--disable-sdremote],
1329         [Determines whether to enable Impress remote control (i.e. the server component).]),
1330 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1332 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1333     AS_HELP_STRING([--disable-sdremote-bluetooth],
1334         [Determines whether to build sdremote with bluetooth support.
1335          Requires dbus on Linux.]))
1337 libo_FUZZ_ARG_ENABLE(gio,
1338     AS_HELP_STRING([--disable-gio],
1339         [Determines whether to use the GIO support.]),
1340 ,test "${enable_gio+set}" = set || enable_gio=yes)
1342 AC_ARG_ENABLE(qt5,
1343     AS_HELP_STRING([--enable-qt5],
1344         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1345          available.]),
1348 AC_ARG_ENABLE(kf5,
1349     AS_HELP_STRING([--enable-kf5],
1350         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1351          KF5 are available.]),
1354 AC_ARG_ENABLE(kde5,
1355     AS_HELP_STRING([--enable-kde5],
1356         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1359 AC_ARG_ENABLE(gtk3_kde5,
1360     AS_HELP_STRING([--enable-gtk3-kde5],
1361         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1362          platforms where Gtk3, Qt5 and Plasma is available.]),
1365 AC_ARG_ENABLE(gui,
1366     AS_HELP_STRING([--disable-gui],
1367         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1368 ,enable_gui=yes)
1370 libo_FUZZ_ARG_ENABLE(randr,
1371     AS_HELP_STRING([--disable-randr],
1372         [Disable RandR support in the vcl project.]),
1373 ,test "${enable_randr+set}" = set || enable_randr=yes)
1375 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1376     AS_HELP_STRING([--disable-gstreamer-1-0],
1377         [Disable building with the gstreamer 1.0 avmedia backend.]),
1378 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1380 libo_FUZZ_ARG_ENABLE(vlc,
1381     AS_HELP_STRING([--enable-vlc],
1382         [Enable building with the (experimental) VLC avmedia backend.]),
1383 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1385 libo_FUZZ_ARG_ENABLE(neon,
1386     AS_HELP_STRING([--disable-neon],
1387         [Disable neon and the compilation of webdav binding.]),
1390 libo_FUZZ_ARG_ENABLE([eot],
1391     [AS_HELP_STRING([--enable-eot],
1392         [Enable support for Embedded OpenType fonts.])],
1393 ,test "${enable_eot+set}" = set || enable_eot=no)
1395 libo_FUZZ_ARG_ENABLE(cve-tests,
1396     AS_HELP_STRING([--disable-cve-tests],
1397         [Prevent CVE tests to be executed]),
1400 libo_FUZZ_ARG_ENABLE(chart-tests,
1401     AS_HELP_STRING([--enable-chart-tests],
1402         [Executes chart XShape tests. In a perfect world these tests would be
1403          stable and everyone could run them, in reality it is best to run them
1404          only on a few machines that are known to work and maintained by people
1405          who can judge if a test failure is a regression or not.]),
1408 AC_ARG_ENABLE(build-unowinreg,
1409     AS_HELP_STRING([--enable-build-unowinreg],
1410         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1411          compiler is needed on Linux.]),
1414 AC_ARG_ENABLE(build-opensymbol,
1415     AS_HELP_STRING([--enable-build-opensymbol],
1416         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1417          fontforge installed.]),
1420 AC_ARG_ENABLE(dependency-tracking,
1421     AS_HELP_STRING([--enable-dependency-tracking],
1422         [Do not reject slow dependency extractors.])[
1423   --disable-dependency-tracking
1424                           Disables generation of dependency information.
1425                           Speed up one-time builds.],
1428 AC_ARG_ENABLE(icecream,
1429     AS_HELP_STRING([--enable-icecream],
1430         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1431          It defaults to /opt/icecream for the location of the icecream gcc/g++
1432          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1435 AC_ARG_ENABLE(ld,
1436     AS_HELP_STRING([--enable-ld=<linker>],
1437         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1438          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1441 libo_FUZZ_ARG_ENABLE(cups,
1442     AS_HELP_STRING([--disable-cups],
1443         [Do not build cups support.])
1446 AC_ARG_ENABLE(ccache,
1447     AS_HELP_STRING([--disable-ccache],
1448         [Do not try to use ccache automatically.
1449          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1450          CC/CXX are not yet set, and --enable-icecream is not given, we
1451          attempt to use ccache. --disable-ccache disables ccache completely.
1452          Additionally ccache's depend mode is enabled if possible,
1453          use --enable-ccache=nodepend to enable ccache without depend mode.
1457 AC_ARG_ENABLE(64-bit,
1458     AS_HELP_STRING([--enable-64-bit],
1459         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1460          At the moment meaningful only for Windows.]), ,)
1462 libo_FUZZ_ARG_ENABLE(online-update,
1463     AS_HELP_STRING([--enable-online-update],
1464         [Enable the online update service that will check for new versions of
1465          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1466          If the value is "mar", the experimental Mozilla-like update will be
1467          enabled instead of the traditional update mechanism.]),
1470 AC_ARG_WITH(update-config,
1471     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1472                    [Path to the update config ini file]))
1474 libo_FUZZ_ARG_ENABLE(extension-update,
1475     AS_HELP_STRING([--disable-extension-update],
1476         [Disable possibility to update installed extensions.]),
1479 libo_FUZZ_ARG_ENABLE(release-build,
1480     AS_HELP_STRING([--enable-release-build],
1481         [Enable release build. Note that the "release build" choice is orthogonal to
1482          whether symbols are present, debug info is generated, or optimization
1483          is done.
1484          See http://wiki.documentfoundation.org/Development/DevBuild]),
1487 AC_ARG_ENABLE(windows-build-signing,
1488     AS_HELP_STRING([--enable-windows-build-signing],
1489         [Enable signing of windows binaries (*.exe, *.dll)]),
1492 AC_ARG_ENABLE(silent-msi,
1493     AS_HELP_STRING([--enable-silent-msi],
1494         [Enable MSI with LIMITUI=1 (silent install).]),
1497 AC_ARG_ENABLE(macosx-code-signing,
1498     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1499         [Sign executables, dylibs, frameworks and the app bundle. If you
1500          don't provide an identity the first suitable certificate
1501          in your keychain is used.]),
1504 AC_ARG_ENABLE(macosx-package-signing,
1505     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1506         [Create a .pkg suitable for uploading to the Mac App Store and sign
1507          it. If you don't provide an identity the first suitable certificate
1508          in your keychain is used.]),
1511 AC_ARG_ENABLE(macosx-sandbox,
1512     AS_HELP_STRING([--enable-macosx-sandbox],
1513         [Make the app bundle run in a sandbox. Requires code signing.
1514          Is required by apps distributed in the Mac App Store, and implies
1515          adherence to App Store rules.]),
1518 AC_ARG_WITH(macosx-bundle-identifier,
1519     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1520         [Define the macOS bundle identifier. Default is the somewhat weird
1521          org.libreoffice.script ("script", huh?).]),
1522 ,with_macosx_bundle_identifier=org.libreoffice.script)
1524 AC_ARG_WITH(product-name,
1525     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1526         [Define the product name. Default is AC_PACKAGE_NAME.]),
1527 ,with_product_name=$PRODUCTNAME)
1529 AC_ARG_WITH(package-version,
1530     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1531         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1534 libo_FUZZ_ARG_ENABLE(readonly-installset,
1535     AS_HELP_STRING([--enable-readonly-installset],
1536         [Prevents any attempts by LibreOffice to write into its installation. That means
1537          at least that no "system-wide" extensions can be added. Partly experimental work in
1538          progress, probably not fully implemented. Always enabled for macOS.]),
1541 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1542     AS_HELP_STRING([--disable-postgresql-sdbc],
1543         [Disable the build of the PostgreSQL-SDBC driver.])
1546 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1547     AS_HELP_STRING([--disable-lotuswordpro],
1548         [Disable the build of the Lotus Word Pro filter.]),
1549 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1551 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1552     AS_HELP_STRING([--disable-firebird-sdbc],
1553         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1554 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1556 AC_ARG_ENABLE(bogus-pkg-config,
1557     AS_HELP_STRING([--enable-bogus-pkg-config],
1558         [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.]),
1561 AC_ARG_ENABLE(openssl,
1562     AS_HELP_STRING([--disable-openssl],
1563         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1564          components will either use GNUTLS or NSS. Work in progress,
1565          use only if you are hacking on it.]),
1566 ,enable_openssl=yes)
1568 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1569     AS_HELP_STRING([--enable-cipher-openssl-backend],
1570         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1571          Requires --enable-openssl.]))
1573 AC_ARG_ENABLE(library-bin-tar,
1574     AS_HELP_STRING([--enable-library-bin-tar],
1575         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1576         Some libraries can save their build result in a tarball
1577         stored in TARFILE_LOCATION. That binary tarball is
1578         uniquely identified by the source tarball,
1579         the content of the config_host.mk file and the content
1580         of the top-level directory in core for that library
1581         If this option is enabled, then if such a tarfile exist, it will be untarred
1582         instead of the source tarfile, and the build step will be skipped for that
1583         library.
1584         If a proper tarfile does not exist, then the normal source-based
1585         build is done for that library and a proper binary tarfile is created
1586         for the next time.]),
1589 AC_ARG_ENABLE(dconf,
1590     AS_HELP_STRING([--disable-dconf],
1591         [Disable the dconf configuration backend (enabled by default where
1592          available).]))
1594 libo_FUZZ_ARG_ENABLE(formula-logger,
1595     AS_HELP_STRING(
1596         [--enable-formula-logger],
1597         [Enable formula logger for logging formula calculation flow in Calc.]
1598     )
1601 AC_ARG_ENABLE(ldap,
1602     AS_HELP_STRING([--disable-ldap],
1603         [Disable LDAP support.]),
1604 ,enable_ldap=yes)
1606 dnl ===================================================================
1607 dnl Optional Packages (--with/without-)
1608 dnl ===================================================================
1610 AC_ARG_WITH(gcc-home,
1611     AS_HELP_STRING([--with-gcc-home],
1612         [Specify the location of gcc/g++ manually. This can be used in conjunction
1613          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1614          non-default path.]),
1617 AC_ARG_WITH(gnu-patch,
1618     AS_HELP_STRING([--with-gnu-patch],
1619         [Specify location of GNU patch on Solaris or FreeBSD.]),
1622 AC_ARG_WITH(build-platform-configure-options,
1623     AS_HELP_STRING([--with-build-platform-configure-options],
1624         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1627 AC_ARG_WITH(gnu-cp,
1628     AS_HELP_STRING([--with-gnu-cp],
1629         [Specify location of GNU cp on Solaris or FreeBSD.]),
1632 AC_ARG_WITH(external-tar,
1633     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1634         [Specify an absolute path of where to find (and store) tarfiles.]),
1635     TARFILE_LOCATION=$withval ,
1638 AC_ARG_WITH(referenced-git,
1639     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1640         [Specify another checkout directory to reference. This makes use of
1641                  git submodule update --reference, and saves a lot of diskspace
1642                  when having multiple trees side-by-side.]),
1643     GIT_REFERENCE_SRC=$withval ,
1646 AC_ARG_WITH(linked-git,
1647     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1648         [Specify a directory where the repositories of submodules are located.
1649          This uses a method similar to git-new-workdir to get submodules.]),
1650     GIT_LINK_SRC=$withval ,
1653 AC_ARG_WITH(galleries,
1654     AS_HELP_STRING([--with-galleries],
1655         [Specify how galleries should be built. It is possible either to
1656          build these internally from source ("build"),
1657          or to disable them ("no")]),
1660 AC_ARG_WITH(theme,
1661     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1662         [Choose which themes to include. By default those themes with an '*' are included.
1663          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1664          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
1667 libo_FUZZ_ARG_WITH(helppack-integration,
1668     AS_HELP_STRING([--without-helppack-integration],
1669         [It will not integrate the helppacks to the installer
1670          of the product. Please use this switch to use the online help
1671          or separate help packages.]),
1674 libo_FUZZ_ARG_WITH(fonts,
1675     AS_HELP_STRING([--without-fonts],
1676         [LibreOffice includes some third-party fonts to provide a reliable basis for
1677          help content, templates, samples, etc. When these fonts are already
1678          known to be available on the system then you should use this option.]),
1681 AC_ARG_WITH(epm,
1682     AS_HELP_STRING([--with-epm],
1683         [Decides which epm to use. Default is to use the one from the system if
1684          one is built. When either this is not there or you say =internal epm
1685          will be built.]),
1688 AC_ARG_WITH(package-format,
1689     AS_HELP_STRING([--with-package-format],
1690         [Specify package format(s) for LibreOffice installation sets. The
1691          implicit --without-package-format leads to no installation sets being
1692          generated. Possible values: aix, archive, bsd, deb, dmg,
1693          installed, msi, pkg, and rpm.
1694          Example: --with-package-format='deb rpm']),
1697 AC_ARG_WITH(tls,
1698     AS_HELP_STRING([--with-tls],
1699         [Decides which TLS/SSL and cryptographic implementations to use for
1700          LibreOffice's code. Notice that this doesn't apply for depending
1701          libraries like "neon", for example. Default is to use NSS
1702          although OpenSSL is also possible. Notice that selecting NSS restricts
1703          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1704          restrict by now the usage of NSS in LO's code. Possible values:
1705          openssl, nss. Example: --with-tls="nss"]),
1708 AC_ARG_WITH(system-libs,
1709     AS_HELP_STRING([--with-system-libs],
1710         [Use libraries already on system -- enables all --with-system-* flags.]),
1713 AC_ARG_WITH(system-bzip2,
1714     AS_HELP_STRING([--with-system-bzip2],
1715         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1716     [with_system_bzip2="$with_system_libs"])
1718 AC_ARG_WITH(system-headers,
1719     AS_HELP_STRING([--with-system-headers],
1720         [Use headers already on system -- enables all --with-system-* flags for
1721          external packages whose headers are the only entities used i.e.
1722          boost/odbc/sane-header(s).]),,
1723     [with_system_headers="$with_system_libs"])
1725 AC_ARG_WITH(system-jars,
1726     AS_HELP_STRING([--without-system-jars],
1727         [When building with --with-system-libs, also the needed jars are expected
1728          on the system. Use this to disable that]),,
1729     [with_system_jars="$with_system_libs"])
1731 AC_ARG_WITH(system-cairo,
1732     AS_HELP_STRING([--with-system-cairo],
1733         [Use cairo libraries already on system.  Happens automatically for
1734          (implicit) --enable-gtk3.]))
1736 AC_ARG_WITH(system-epoxy,
1737     AS_HELP_STRING([--with-system-epoxy],
1738         [Use epoxy libraries already on system.  Happens automatically for
1739          (implicit) --enable-gtk3.]),,
1740        [with_system_epoxy="$with_system_libs"])
1742 AC_ARG_WITH(myspell-dicts,
1743     AS_HELP_STRING([--with-myspell-dicts],
1744         [Adds myspell dictionaries to the LibreOffice installation set]),
1747 AC_ARG_WITH(system-dicts,
1748     AS_HELP_STRING([--without-system-dicts],
1749         [Do not use dictionaries from system paths.]),
1752 AC_ARG_WITH(external-dict-dir,
1753     AS_HELP_STRING([--with-external-dict-dir],
1754         [Specify external dictionary dir.]),
1757 AC_ARG_WITH(external-hyph-dir,
1758     AS_HELP_STRING([--with-external-hyph-dir],
1759         [Specify external hyphenation pattern dir.]),
1762 AC_ARG_WITH(external-thes-dir,
1763     AS_HELP_STRING([--with-external-thes-dir],
1764         [Specify external thesaurus dir.]),
1767 AC_ARG_WITH(system-zlib,
1768     AS_HELP_STRING([--with-system-zlib],
1769         [Use zlib already on system.]),,
1770     [with_system_zlib=auto])
1772 AC_ARG_WITH(system-jpeg,
1773     AS_HELP_STRING([--with-system-jpeg],
1774         [Use jpeg already on system.]),,
1775     [with_system_jpeg="$with_system_libs"])
1777 AC_ARG_WITH(system-clucene,
1778     AS_HELP_STRING([--with-system-clucene],
1779         [Use clucene already on system.]),,
1780     [with_system_clucene="$with_system_libs"])
1782 AC_ARG_WITH(system-expat,
1783     AS_HELP_STRING([--with-system-expat],
1784         [Use expat already on system.]),,
1785     [with_system_expat="$with_system_libs"])
1787 AC_ARG_WITH(system-libxml,
1788     AS_HELP_STRING([--with-system-libxml],
1789         [Use libxml/libxslt already on system.]),,
1790     [with_system_libxml=auto])
1792 AC_ARG_WITH(system-icu,
1793     AS_HELP_STRING([--with-system-icu],
1794         [Use icu already on system.]),,
1795     [with_system_icu="$with_system_libs"])
1797 AC_ARG_WITH(system-ucpp,
1798     AS_HELP_STRING([--with-system-ucpp],
1799         [Use ucpp already on system.]),,
1800     [])
1802 AC_ARG_WITH(system-openldap,
1803     AS_HELP_STRING([--with-system-openldap],
1804         [Use the OpenLDAP LDAP SDK already on system.]),,
1805     [with_system_openldap="$with_system_libs"])
1807 libo_FUZZ_ARG_ENABLE(poppler,
1808     AS_HELP_STRING([--disable-poppler],
1809         [Disable building Poppler.])
1812 AC_ARG_WITH(system-poppler,
1813     AS_HELP_STRING([--with-system-poppler],
1814         [Use system poppler (only needed for PDF import).]),,
1815     [with_system_poppler="$with_system_libs"])
1817 AC_ARG_WITH(system-gpgmepp,
1818     AS_HELP_STRING([--with-system-gpgmepp],
1819         [Use gpgmepp already on system]),,
1820     [with_system_gpgmepp="$with_system_libs"])
1822 AC_ARG_WITH(system-apache-commons,
1823     AS_HELP_STRING([--with-system-apache-commons],
1824         [Use Apache commons libraries already on system.]),,
1825     [with_system_apache_commons="$with_system_jars"])
1827 AC_ARG_WITH(system-mariadb,
1828     AS_HELP_STRING([--with-system-mariadb],
1829         [Use MariaDB/MySQL libraries already on system.]),,
1830     [with_system_mariadb="$with_system_libs"])
1832 AC_ARG_ENABLE(bundle-mariadb,
1833     AS_HELP_STRING([--enable-bundle-mariadb],
1834         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1837 AC_ARG_WITH(system-postgresql,
1838     AS_HELP_STRING([--with-system-postgresql],
1839         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1840          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1841     [with_system_postgresql="$with_system_libs"])
1843 AC_ARG_WITH(libpq-path,
1844     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1845         [Use this PostgreSQL C interface (libpq) installation for building
1846          the PostgreSQL-SDBC extension.]),
1849 AC_ARG_WITH(system-firebird,
1850     AS_HELP_STRING([--with-system-firebird],
1851         [Use Firebird libraries already on system, for building the Firebird-SDBC
1852          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1853     [with_system_firebird="$with_system_libs"])
1855 AC_ARG_WITH(system-libtommath,
1856             AS_HELP_STRING([--with-system-libtommath],
1857                            [Use libtommath already on system]),,
1858             [with_system_libtommath="$with_system_libs"])
1860 AC_ARG_WITH(system-hsqldb,
1861     AS_HELP_STRING([--with-system-hsqldb],
1862         [Use hsqldb already on system.]))
1864 AC_ARG_WITH(hsqldb-jar,
1865     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1866         [Specify path to jarfile manually.]),
1867     HSQLDB_JAR=$withval)
1869 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1870     AS_HELP_STRING([--disable-scripting-beanshell],
1871         [Disable support for scripts in BeanShell.]),
1875 AC_ARG_WITH(system-beanshell,
1876     AS_HELP_STRING([--with-system-beanshell],
1877         [Use beanshell already on system.]),,
1878     [with_system_beanshell="$with_system_jars"])
1880 AC_ARG_WITH(beanshell-jar,
1881     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1882         [Specify path to jarfile manually.]),
1883     BSH_JAR=$withval)
1885 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1886     AS_HELP_STRING([--disable-scripting-javascript],
1887         [Disable support for scripts in JavaScript.]),
1891 AC_ARG_WITH(system-rhino,
1892     AS_HELP_STRING([--with-system-rhino],
1893         [Use rhino already on system.]),,)
1894 #    [with_system_rhino="$with_system_jars"])
1895 # Above is not used as we have different debug interface
1896 # patched into internal rhino. This code needs to be fixed
1897 # before we can enable it by default.
1899 AC_ARG_WITH(rhino-jar,
1900     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1901         [Specify path to jarfile manually.]),
1902     RHINO_JAR=$withval)
1904 AC_ARG_WITH(commons-logging-jar,
1905     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1906         [Specify path to jarfile manually.]),
1907     COMMONS_LOGGING_JAR=$withval)
1909 AC_ARG_WITH(system-jfreereport,
1910     AS_HELP_STRING([--with-system-jfreereport],
1911         [Use JFreeReport already on system.]),,
1912     [with_system_jfreereport="$with_system_jars"])
1914 AC_ARG_WITH(sac-jar,
1915     AS_HELP_STRING([--with-sac-jar=JARFILE],
1916         [Specify path to jarfile manually.]),
1917     SAC_JAR=$withval)
1919 AC_ARG_WITH(libxml-jar,
1920     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1921         [Specify path to jarfile manually.]),
1922     LIBXML_JAR=$withval)
1924 AC_ARG_WITH(flute-jar,
1925     AS_HELP_STRING([--with-flute-jar=JARFILE],
1926         [Specify path to jarfile manually.]),
1927     FLUTE_JAR=$withval)
1929 AC_ARG_WITH(jfreereport-jar,
1930     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1931         [Specify path to jarfile manually.]),
1932     JFREEREPORT_JAR=$withval)
1934 AC_ARG_WITH(liblayout-jar,
1935     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1936         [Specify path to jarfile manually.]),
1937     LIBLAYOUT_JAR=$withval)
1939 AC_ARG_WITH(libloader-jar,
1940     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1941         [Specify path to jarfile manually.]),
1942     LIBLOADER_JAR=$withval)
1944 AC_ARG_WITH(libformula-jar,
1945     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1946         [Specify path to jarfile manually.]),
1947     LIBFORMULA_JAR=$withval)
1949 AC_ARG_WITH(librepository-jar,
1950     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1951         [Specify path to jarfile manually.]),
1952     LIBREPOSITORY_JAR=$withval)
1954 AC_ARG_WITH(libfonts-jar,
1955     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1956         [Specify path to jarfile manually.]),
1957     LIBFONTS_JAR=$withval)
1959 AC_ARG_WITH(libserializer-jar,
1960     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1961         [Specify path to jarfile manually.]),
1962     LIBSERIALIZER_JAR=$withval)
1964 AC_ARG_WITH(libbase-jar,
1965     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1966         [Specify path to jarfile manually.]),
1967     LIBBASE_JAR=$withval)
1969 AC_ARG_WITH(system-odbc,
1970     AS_HELP_STRING([--with-system-odbc],
1971         [Use the odbc headers already on system.]),,
1972     [with_system_odbc="auto"])
1974 AC_ARG_WITH(system-sane,
1975     AS_HELP_STRING([--with-system-sane],
1976         [Use sane.h already on system.]),,
1977     [with_system_sane="$with_system_headers"])
1979 AC_ARG_WITH(system-bluez,
1980     AS_HELP_STRING([--with-system-bluez],
1981         [Use bluetooth.h already on system.]),,
1982     [with_system_bluez="$with_system_headers"])
1984 AC_ARG_WITH(system-curl,
1985     AS_HELP_STRING([--with-system-curl],
1986         [Use curl already on system.]),,
1987     [with_system_curl=auto])
1989 AC_ARG_WITH(system-boost,
1990     AS_HELP_STRING([--with-system-boost],
1991         [Use boost already on system.]),,
1992     [with_system_boost="$with_system_headers"])
1994 AC_ARG_WITH(system-glm,
1995     AS_HELP_STRING([--with-system-glm],
1996         [Use glm already on system.]),,
1997     [with_system_glm="$with_system_headers"])
1999 AC_ARG_WITH(system-hunspell,
2000     AS_HELP_STRING([--with-system-hunspell],
2001         [Use libhunspell already on system.]),,
2002     [with_system_hunspell="$with_system_libs"])
2004 libo_FUZZ_ARG_ENABLE(qrcodegen,
2005     AS_HELP_STRING([--disable-qrcodegen],
2006         [Disable use of qrcodegen external library.]))
2008 AC_ARG_WITH(system-qrcodegen,
2009     AS_HELP_STRING([--with-system-qrcodegen],
2010         [Use libqrcodegen already on system.]),,
2011     [with_system_qrcodegen="$with_system_libs"])
2013 AC_ARG_WITH(system-mythes,
2014     AS_HELP_STRING([--with-system-mythes],
2015         [Use mythes already on system.]),,
2016     [with_system_mythes="$with_system_libs"])
2018 AC_ARG_WITH(system-altlinuxhyph,
2019     AS_HELP_STRING([--with-system-altlinuxhyph],
2020         [Use ALTLinuxhyph already on system.]),,
2021     [with_system_altlinuxhyph="$with_system_libs"])
2023 AC_ARG_WITH(system-lpsolve,
2024     AS_HELP_STRING([--with-system-lpsolve],
2025         [Use lpsolve already on system.]),,
2026     [with_system_lpsolve="$with_system_libs"])
2028 AC_ARG_WITH(system-coinmp,
2029     AS_HELP_STRING([--with-system-coinmp],
2030         [Use CoinMP already on system.]),,
2031     [with_system_coinmp="$with_system_libs"])
2033 AC_ARG_WITH(system-liblangtag,
2034     AS_HELP_STRING([--with-system-liblangtag],
2035         [Use liblangtag library already on system.]),,
2036     [with_system_liblangtag="$with_system_libs"])
2038 AC_ARG_WITH(webdav,
2039     AS_HELP_STRING([--with-webdav],
2040         [Specify which library to use for webdav implementation.
2041          Possible values: "neon", "serf", "no". The default value is "neon".
2042          Example: --with-webdav="serf"]),
2043     WITH_WEBDAV=$withval,
2044     WITH_WEBDAV="neon")
2046 AC_ARG_WITH(linker-hash-style,
2047     AS_HELP_STRING([--with-linker-hash-style],
2048         [Use linker with --hash-style=<style> when linking shared objects.
2049          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2050          if supported on the build system, and "sysv" otherwise.]))
2052 AC_ARG_WITH(jdk-home,
2053     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2054         [If you have installed JDK 9 or later on your system please supply the
2055          path here. Note that this is not the location of the java command but the
2056          location of the entire distribution.]),
2059 AC_ARG_WITH(help,
2060     AS_HELP_STRING([--with-help],
2061         [Enable the build of help. There is a special parameter "common" that
2062          can be used to bundle only the common part, .e.g help-specific icons.
2063          This is useful when you build the helpcontent separately.])
2064     [
2065                           Usage:     --with-help    build the old local help
2066                                  --without-help     no local help (default)
2067                                  --with-help=html   build the new HTML local help
2068                                  --with-help=online build the new HTML online help
2069     ],
2072 AC_ARG_WITH(omindex,
2073    AS_HELP_STRING([--with-omindex],
2074         [Enable the support of xapian-omega index for online help.])
2075    [
2076                          Usage: --with-omindex=server prepare the pages for omindex
2077                                 but let xapian-omega be built in server.
2078                                 --with-omindex=noxap do not prepare online pages
2079                                 for xapian-omega
2080   ],
2083 libo_FUZZ_ARG_WITH(java,
2084     AS_HELP_STRING([--with-java=<java command>],
2085         [Specify the name of the Java interpreter command. Typically "java"
2086          which is the default.
2088          To build without support for Java components, applets, accessibility
2089          or the XML filters written in Java, use --without-java or --with-java=no.]),
2090     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2091     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2094 AC_ARG_WITH(jvm-path,
2095     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2096         [Use a specific JVM search path at runtime.
2097          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2100 AC_ARG_WITH(ant-home,
2101     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2102         [If you have installed Apache Ant on your system, please supply the path here.
2103          Note that this is not the location of the Ant binary but the location
2104          of the entire distribution.]),
2107 AC_ARG_WITH(symbol-config,
2108     AS_HELP_STRING([--with-symbol-config],
2109         [Configuration for the crashreport symbol upload]),
2110         [],
2111         [with_symbol_config=no])
2113 AC_ARG_WITH(export-validation,
2114     AS_HELP_STRING([--without-export-validation],
2115         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2116 ,with_export_validation=auto)
2118 AC_ARG_WITH(bffvalidator,
2119     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2120         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2121          Requires installed Microsoft Office Binary File Format Validator.
2122          Note: export-validation (--with-export-validation) is required to be turned on.
2123          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2124 ,with_bffvalidator=no)
2126 libo_FUZZ_ARG_WITH(junit,
2127     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2128         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2129          --without-junit disables those tests. Not relevant in the --without-java case.]),
2130 ,with_junit=yes)
2132 AC_ARG_WITH(hamcrest,
2133     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2134         [Specifies the hamcrest jar file to use for JUnit-based tests.
2135          --without-junit disables those tests. Not relevant in the --without-java case.]),
2136 ,with_hamcrest=yes)
2138 AC_ARG_WITH(perl-home,
2139     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2140         [If you have installed Perl 5 Distribution, on your system, please
2141          supply the path here. Note that this is not the location of the Perl
2142          binary but the location of the entire distribution.]),
2145 libo_FUZZ_ARG_WITH(doxygen,
2146     AS_HELP_STRING(
2147         [--with-doxygen=<absolute path to doxygen executable>],
2148         [Specifies the doxygen executable to use when generating ODK C/C++
2149          documentation. --without-doxygen disables generation of ODK C/C++
2150          documentation. Not relevant in the --disable-odk case.]),
2151 ,with_doxygen=yes)
2153 AC_ARG_WITH(visual-studio,
2154     AS_HELP_STRING([--with-visual-studio=<2019>],
2155         [Specify which Visual Studio version to use in case several are
2156          installed. Currently only 2019 (default) is supported.]),
2159 AC_ARG_WITH(windows-sdk,
2160     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2161         [Specify which Windows SDK, or "Windows Kit", version to use
2162          in case the one that came with the selected Visual Studio
2163          is not what you want for some reason. Note that not all compiler/SDK
2164          combinations are supported. The intent is that this option should not
2165          be needed.]),
2168 AC_ARG_WITH(lang,
2169     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2170         [Use this option to build LibreOffice with additional UI language support.
2171          English (US) is always included by default.
2172          Separate multiple languages with space.
2173          For all languages, use --with-lang=ALL.]),
2176 AC_ARG_WITH(locales,
2177     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2178         [Use this option to limit the locale information built in.
2179          Separate multiple locales with space.
2180          Very experimental and might well break stuff.
2181          Just a desperate measure to shrink code and data size.
2182          By default all the locales available is included.
2183          This option is completely unrelated to --with-lang.])
2184     [
2185                           Affects also our character encoding conversion
2186                           tables for encodings mainly targeted for a
2187                           particular locale, like EUC-CN and EUC-TW for
2188                           zh, ISO-2022-JP for ja.
2190                           Affects also our add-on break iterator data for
2191                           some languages.
2193                           For the default, all locales, don't use this switch at all.
2194                           Specifying just the language part of a locale means all matching
2195                           locales will be included.
2196     ],
2199 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2200 libo_FUZZ_ARG_WITH(krb5,
2201     AS_HELP_STRING([--with-krb5],
2202         [Enable MIT Kerberos 5 support in modules that support it.
2203          By default automatically enabled on platforms
2204          where a good system Kerberos 5 is available.]),
2207 libo_FUZZ_ARG_WITH(gssapi,
2208     AS_HELP_STRING([--with-gssapi],
2209         [Enable GSSAPI support in modules that support it.
2210          By default automatically enabled on platforms
2211          where a good system GSSAPI is available.]),
2214 AC_ARG_WITH(iwyu,
2215     AS_HELP_STRING([--with-iwyu],
2216         [Use given IWYU binary path to check unneeded includes instead of building.
2217          Use only if you are hacking on it.]),
2220 libo_FUZZ_ARG_WITH(lxml,
2221     AS_HELP_STRING([--without-lxml],
2222         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2223          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2224          report widget classes and ids.]),
2227 libo_FUZZ_ARG_WITH(latest-c++,
2228     AS_HELP_STRING([--with-latest-c++],
2229         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2230          published standard.]),,
2231         [with_latest_c__=no])
2233 dnl ===================================================================
2234 dnl Branding
2235 dnl ===================================================================
2237 AC_ARG_WITH(branding,
2238     AS_HELP_STRING([--with-branding=/path/to/images],
2239         [Use given path to retrieve branding images set.])
2240     [
2241                           Search for intro.png about.svg and logo.svg.
2242                           If any is missing, default ones will be used instead.
2244                           Search also progress.conf for progress
2245                           settings on intro screen :
2247                           PROGRESSBARCOLOR="255,255,255" Set color of
2248                           progress bar. Comma separated RGB decimal values.
2249                           PROGRESSSIZE="407,6" Set size of progress bar.
2250                           Comma separated decimal values (width, height).
2251                           PROGRESSPOSITION="61,317" Set position of progress
2252                           bar from left,top. Comma separated decimal values.
2253                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2254                           bar frame. Comma separated RGB decimal values.
2255                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2256                           bar text. Comma separated RGB decimal values.
2257                           PROGRESSTEXTBASELINE="287" Set vertical position of
2258                           progress bar text from top. Decimal value.
2260                           Default values will be used if not found.
2261     ],
2265 AC_ARG_WITH(extra-buildid,
2266     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2267         [Show addition build identification in about dialog.]),
2271 AC_ARG_WITH(vendor,
2272     AS_HELP_STRING([--with-vendor="John the Builder"],
2273         [Set vendor of the build.]),
2276 AC_ARG_WITH(android-package-name,
2277     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2278         [Set Android package name of the build.]),
2281 AC_ARG_WITH(compat-oowrappers,
2282     AS_HELP_STRING([--with-compat-oowrappers],
2283         [Install oo* wrappers in parallel with
2284          lo* ones to keep backward compatibility.
2285          Has effect only with make distro-pack-install]),
2288 AC_ARG_WITH(os-version,
2289     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2290         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2293 AC_ARG_WITH(mingw-cross-compiler,
2294     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2295         [Specify the MinGW cross-compiler to use.
2296          When building on the ODK on Unix and building unowinreg.dll,
2297          specify the MinGW C++ cross-compiler.]),
2300 AC_ARG_WITH(idlc-cpp,
2301     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2302         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2305 AC_ARG_WITH(parallelism,
2306     AS_HELP_STRING([--with-parallelism],
2307         [Number of jobs to run simultaneously during build. Parallel builds can
2308         save a lot of time on multi-cpu machines. Defaults to the number of
2309         CPUs on the machine, unless you configure --enable-icecream - then to
2310         40.]),
2313 AC_ARG_WITH(all-tarballs,
2314     AS_HELP_STRING([--with-all-tarballs],
2315         [Download all external tarballs unconditionally]))
2317 AC_ARG_WITH(gdrive-client-id,
2318     AS_HELP_STRING([--with-gdrive-client-id],
2319         [Provides the client id of the application for OAuth2 authentication
2320         on Google Drive. If either this or --with-gdrive-client-secret is
2321         empty, the feature will be disabled]),
2324 AC_ARG_WITH(gdrive-client-secret,
2325     AS_HELP_STRING([--with-gdrive-client-secret],
2326         [Provides the client secret of the application for OAuth2
2327         authentication on Google Drive. If either this or
2328         --with-gdrive-client-id is empty, the feature will be disabled]),
2331 AC_ARG_WITH(alfresco-cloud-client-id,
2332     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2333         [Provides the client id of the application for OAuth2 authentication
2334         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2335         empty, the feature will be disabled]),
2338 AC_ARG_WITH(alfresco-cloud-client-secret,
2339     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2340         [Provides the client secret of the application for OAuth2
2341         authentication on Alfresco Cloud. If either this or
2342         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2345 AC_ARG_WITH(onedrive-client-id,
2346     AS_HELP_STRING([--with-onedrive-client-id],
2347         [Provides the client id of the application for OAuth2 authentication
2348         on OneDrive. If either this or --with-onedrive-client-secret is
2349         empty, the feature will be disabled]),
2352 AC_ARG_WITH(onedrive-client-secret,
2353     AS_HELP_STRING([--with-onedrive-client-secret],
2354         [Provides the client secret of the application for OAuth2
2355         authentication on OneDrive. If either this or
2356         --with-onedrive-client-id is empty, the feature will be disabled]),
2358 dnl ===================================================================
2359 dnl Do we want to use pre-build binary tarball for recompile
2360 dnl ===================================================================
2362 if test "$enable_library_bin_tar" = "yes" ; then
2363     USE_LIBRARY_BIN_TAR=TRUE
2364 else
2365     USE_LIBRARY_BIN_TAR=
2367 AC_SUBST(USE_LIBRARY_BIN_TAR)
2369 dnl ===================================================================
2370 dnl Test whether build target is Release Build
2371 dnl ===================================================================
2372 AC_MSG_CHECKING([whether build target is Release Build])
2373 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2374     AC_MSG_RESULT([no])
2375     ENABLE_RELEASE_BUILD=
2376     GET_TASK_ALLOW_ENTITLEMENT='
2377         <!-- We want to be able to debug a hardened process when not building for release -->
2378         <key>com.apple.security.get-task-allow</key>
2379         <true/>'
2380 else
2381     AC_MSG_RESULT([yes])
2382     ENABLE_RELEASE_BUILD=TRUE
2383     GET_TASK_ALLOW_ENTITLEMENT=''
2385 AC_SUBST(ENABLE_RELEASE_BUILD)
2386 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2388 dnl ===================================================================
2389 dnl Test whether to sign Windows Build
2390 dnl ===================================================================
2391 AC_MSG_CHECKING([whether to sign windows build])
2392 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2393     AC_MSG_RESULT([yes])
2394     WINDOWS_BUILD_SIGNING="TRUE"
2395 else
2396     AC_MSG_RESULT([no])
2397     WINDOWS_BUILD_SIGNING="FALSE"
2399 AC_SUBST(WINDOWS_BUILD_SIGNING)
2401 dnl ===================================================================
2402 dnl MacOSX build and runtime environment options
2403 dnl ===================================================================
2405 AC_ARG_WITH(macosx-sdk,
2406     AS_HELP_STRING([--with-macosx-sdk=<version>],
2407         [Prefer a specific SDK for building.])
2408     [
2409                           If the requested SDK is not available, a search for the oldest one will be done.
2410                           With current Xcode versions, only the latest SDK is included, so this option is
2411                           not terribly useful. It works fine to build with a new SDK and run the result
2412                           on an older OS.
2414                           e. g.: --with-macosx-sdk=10.10
2416                           there are 3 options to control the MacOSX build:
2417                           --with-macosx-sdk (referred as 'sdk' below)
2418                           --with-macosx-version-min-required (referred as 'min' below)
2419                           --with-macosx-version-max-allowed (referred as 'max' below)
2421                           the connection between these value and the default they take is as follow:
2422                           ( ? means not specified on the command line, s means the SDK version found,
2423                           constraint: 8 <= x <= y <= z)
2425                           ==========================================
2426                            command line      || config result
2427                           ==========================================
2428                           min  | max  | sdk  || min   | max  | sdk  |
2429                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2430                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2431                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2432                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2433                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2434                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2435                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2436                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2439                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2440                           for a detailed technical explanation of these variables
2442                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2443     ],
2446 AC_ARG_WITH(macosx-version-min-required,
2447     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2448         [set the minimum OS version needed to run the built LibreOffice])
2449     [
2450                           e. g.: --with-macos-version-min-required=10.10
2451                           see --with-macosx-sdk for more info
2452     ],
2455 AC_ARG_WITH(macosx-version-max-allowed,
2456     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2457         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2458     [
2459                           e. g.: --with-macos-version-max-allowed=10.10
2460                           see --with-macosx-sdk for more info
2461     ],
2465 dnl ===================================================================
2466 dnl options for stuff used during cross-compilation build
2467 dnl Not quite superseded by --with-build-platform-configure-options.
2468 dnl TODO: check, if the "force" option is still needed anywhere.
2469 dnl ===================================================================
2471 AC_ARG_WITH(system-icu-for-build,
2472     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2473         [Use icu already on system for build tools (cross-compilation only).]))
2476 dnl ===================================================================
2477 dnl Check for incompatible options set by fuzzing, and reset those
2478 dnl automatically to working combinations
2479 dnl ===================================================================
2481 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2482         "$enable_dbus" != "$enable_avahi"; then
2483     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2484     enable_avahi=$enable_dbus
2487 add_lopath_after ()
2489     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2490         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2491     fi
2494 add_lopath_before ()
2496     local IFS=${P_SEP}
2497     local path_cleanup
2498     local dir
2499     for dir in $LO_PATH ; do
2500         if test "$dir" != "$1" ; then
2501             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2502         fi
2503     done
2504     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2507 dnl ===================================================================
2508 dnl check for required programs (grep, awk, sed, bash)
2509 dnl ===================================================================
2511 pathmunge ()
2513     if test -n "$1"; then
2514         if test "$build_os" = "cygwin"; then
2515             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2516                 PathFormat "$1"
2517                 new_path=`cygpath -sm "$formatted_path"`
2518             else
2519                 PathFormat "$1"
2520                 new_path=`cygpath -u "$formatted_path"`
2521             fi
2522         else
2523             new_path="$1"
2524         fi
2525         if test "$2" = "after"; then
2526             add_lopath_after "$new_path"
2527         else
2528             add_lopath_before "$new_path"
2529         fi
2530         unset new_path
2531     fi
2534 AC_PROG_AWK
2535 AC_PATH_PROG( AWK, $AWK)
2536 if test -z "$AWK"; then
2537     AC_MSG_ERROR([install awk to run this script])
2540 AC_PATH_PROG(BASH, bash)
2541 if test -z "$BASH"; then
2542     AC_MSG_ERROR([bash not found in \$PATH])
2544 AC_SUBST(BASH)
2546 AC_MSG_CHECKING([for GNU or BSD tar])
2547 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2548     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2549     if test $? -eq 0;  then
2550         GNUTAR=$a
2551         break
2552     fi
2553 done
2554 AC_MSG_RESULT($GNUTAR)
2555 if test -z "$GNUTAR"; then
2556     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2558 AC_SUBST(GNUTAR)
2560 AC_MSG_CHECKING([for tar's option to strip components])
2561 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2562 if test $? -eq 0; then
2563     STRIP_COMPONENTS="--strip-components"
2564 else
2565     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2566     if test $? -eq 0; then
2567         STRIP_COMPONENTS="--strip-path"
2568     else
2569         STRIP_COMPONENTS="unsupported"
2570     fi
2572 AC_MSG_RESULT($STRIP_COMPONENTS)
2573 if test x$STRIP_COMPONENTS = xunsupported; then
2574     AC_MSG_ERROR([you need a tar that is able to strip components.])
2576 AC_SUBST(STRIP_COMPONENTS)
2578 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2579 dnl desktop OSes from "mobile" ones.
2581 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2582 dnl In other words, that when building for an OS that is not a
2583 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2585 dnl Note the direction of the implication; there is no assumption that
2586 dnl cross-compiling would imply a non-desktop OS.
2588 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2589     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2590     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2591     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2594 # Whether to build "avmedia" functionality or not.
2596 if test -z "$enable_avmedia"; then
2597     enable_avmedia=yes
2600 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2601 if test "$enable_avmedia" = yes; then
2602     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2603 else
2604     USE_AVMEDIA_DUMMY='TRUE'
2606 AC_SUBST(USE_AVMEDIA_DUMMY)
2608 # Decide whether to build database connectivity stuff (including
2609 # Base) or not. We probably don't want to on non-desktop OSes.
2610 if test -z "$enable_database_connectivity"; then
2611     # --disable-database-connectivity is unfinished work in progress
2612     # and the iOS test app doesn't link if we actually try to use it.
2613     # if test $_os != iOS -a $_os != Android; then
2614     if test $_os != iOS; then
2615         enable_database_connectivity=yes
2616     fi
2619 if test "$enable_database_connectivity" = yes; then
2620     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2621     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2624 if test -z "$enable_extensions"; then
2625     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2626     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2627         enable_extensions=yes
2628     fi
2631 if test "$enable_extensions" = yes; then
2632     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2633     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2636 if test -z "$enable_scripting"; then
2637     # Disable scripting for iOS unless specifically overridden
2638     # with --enable-scripting.
2639     if test $_os != iOS; then
2640         enable_scripting=yes
2641     fi
2644 DISABLE_SCRIPTING=''
2645 if test "$enable_scripting" = yes; then
2646     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2647     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2648 else
2649     DISABLE_SCRIPTING='TRUE'
2650     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2653 if test $_os = iOS -o $_os = Android; then
2654     # Disable dynamic_loading always for iOS and Android
2655     enable_dynamic_loading=no
2656 elif test -z "$enable_dynamic_loading"; then
2657     # Otherwise enable it unless specifically disabled
2658     enable_dynamic_loading=yes
2661 DISABLE_DYNLOADING=''
2662 if test "$enable_dynamic_loading" = yes; then
2663     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2664 else
2665     DISABLE_DYNLOADING='TRUE'
2667 AC_SUBST(DISABLE_DYNLOADING)
2669 # remember SYSBASE value
2670 AC_SUBST(SYSBASE)
2672 dnl ===================================================================
2673 dnl  Sort out various gallery compilation options
2674 dnl ===================================================================
2675 AC_MSG_CHECKING([how to build and package galleries])
2676 if test -n "${with_galleries}"; then
2677     if test "$with_galleries" = "build"; then
2678         WITH_GALLERY_BUILD=TRUE
2679         AC_MSG_RESULT([build from source images internally])
2680     elif test "$with_galleries" = "no"; then
2681         WITH_GALLERY_BUILD=
2682         AC_MSG_RESULT([disable non-internal gallery build])
2683     else
2684         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2685     fi
2686 else
2687     if test $_os != iOS -a $_os != Android; then
2688         WITH_GALLERY_BUILD=TRUE
2689         AC_MSG_RESULT([internal src images for desktop])
2690     else
2691         WITH_GALLERY_BUILD=
2692         AC_MSG_RESULT([disable src image build])
2693     fi
2695 AC_SUBST(WITH_GALLERY_BUILD)
2697 dnl ===================================================================
2698 dnl  Checks if ccache is available
2699 dnl ===================================================================
2700 CCACHE_DEPEND_MODE=
2701 if test "$_os" = "WINNT"; then
2702     # on windows/VC build do not use ccache
2703     CCACHE=""
2704 elif test "$enable_ccache" = "no"; then
2705     CCACHE=""
2706 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2707     case "%$CC%$CXX%" in
2708     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2709     # assume that's good then
2710     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2711         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2712         CCACHE_DEPEND_MODE=1
2713         ;;
2714     *)
2715         AC_PATH_PROG([CCACHE],[ccache],[not found])
2716         if test "$CCACHE" = "not found"; then
2717             CCACHE=""
2718         else
2719             CCACHE_DEPEND_MODE=1
2720             # Need to check for ccache version: otherwise prevents
2721             # caching of the results (like "-x objective-c++" for Mac)
2722             if test $_os = Darwin -o $_os = iOS; then
2723                 # Check ccache version
2724                 AC_MSG_CHECKING([whether version of ccache is suitable])
2725                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2726                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2727                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2728                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2729                 else
2730                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2731                     CCACHE=""
2732                     CCACHE_DEPEND_MODE=
2733                 fi
2734             fi
2735         fi
2736         ;;
2737     esac
2738 else
2739     CCACHE=""
2741 if test "$enable_ccache" = "nodepend"; then
2742     CCACHE_DEPEND_MODE=""
2744 AC_SUBST(CCACHE_DEPEND_MODE)
2746 if test "$CCACHE" != ""; then
2747     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2748     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2749     if test "$ccache_size" = ""; then
2750         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2751         if test "$ccache_size" = ""; then
2752             ccache_size=0
2753         fi
2754         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2755         if test $ccache_size -lt 1024; then
2756             CCACHE=""
2757             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2758             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2759         else
2760             # warn that ccache may be too small for debug build
2761             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2762             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2763         fi
2764     else
2765         if test $ccache_size -lt 5; then
2766             #warn that ccache may be too small for debug build
2767             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2768             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2769         fi
2770     fi
2773 dnl ===================================================================
2774 dnl  Checks for C compiler,
2775 dnl  The check for the C++ compiler is later on.
2776 dnl ===================================================================
2777 if test "$_os" != "WINNT"; then
2778     GCC_HOME_SET="true"
2779     AC_MSG_CHECKING([gcc home])
2780     if test -z "$with_gcc_home"; then
2781         if test "$enable_icecream" = "yes"; then
2782             if test -d "/usr/lib/icecc/bin"; then
2783                 GCC_HOME="/usr/lib/icecc/"
2784             elif test -d "/usr/libexec/icecc/bin"; then
2785                 GCC_HOME="/usr/libexec/icecc/"
2786             elif test -d "/opt/icecream/bin"; then
2787                 GCC_HOME="/opt/icecream/"
2788             else
2789                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2791             fi
2792         else
2793             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2794             GCC_HOME_SET="false"
2795         fi
2796     else
2797         GCC_HOME="$with_gcc_home"
2798     fi
2799     AC_MSG_RESULT($GCC_HOME)
2800     AC_SUBST(GCC_HOME)
2802     if test "$GCC_HOME_SET" = "true"; then
2803         if test -z "$CC"; then
2804             CC="$GCC_HOME/bin/gcc"
2805             CC_BASE="gcc"
2806         fi
2807         if test -z "$CXX"; then
2808             CXX="$GCC_HOME/bin/g++"
2809             CXX_BASE="g++"
2810         fi
2811     fi
2814 COMPATH=`dirname "$CC"`
2815 if test "$COMPATH" = "."; then
2816     AC_PATH_PROGS(COMPATH, $CC)
2817     dnl double square bracket to get single because of M4 quote...
2818     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2820 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2822 dnl ===================================================================
2823 dnl Java support
2824 dnl ===================================================================
2825 AC_MSG_CHECKING([whether to build with Java support])
2826 if test "$with_java" != "no"; then
2827     if test "$DISABLE_SCRIPTING" = TRUE; then
2828         AC_MSG_RESULT([no, overridden by --disable-scripting])
2829         ENABLE_JAVA=""
2830         with_java=no
2831     else
2832         AC_MSG_RESULT([yes])
2833         ENABLE_JAVA="TRUE"
2834         AC_DEFINE(HAVE_FEATURE_JAVA)
2835     fi
2836 else
2837     AC_MSG_RESULT([no])
2838     ENABLE_JAVA=""
2841 AC_SUBST(ENABLE_JAVA)
2843 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2845 dnl ENABLE_JAVA="" indicate no Java support at all
2847 dnl ===================================================================
2848 dnl Check macOS SDK and compiler
2849 dnl ===================================================================
2851 if test $_os = Darwin; then
2853     # If no --with-macosx-sdk option is given, look for one
2855     # The intent is that for "most" Mac-based developers, a suitable
2856     # SDK will be found automatically without any configure options.
2858     # For developers with a current Xcode, the lowest-numbered SDK
2859     # higher than or equal to the minimum required should be found.
2861     AC_MSG_CHECKING([what macOS SDK to use])
2862     for _macosx_sdk in ${with_macosx_sdk-11.1 11.0 10.15 10.14 10.13}; do
2863         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2864         if test -d "$MACOSX_SDK_PATH"; then
2865             with_macosx_sdk="${_macosx_sdk}"
2866             break
2867         else
2868             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2869             if test -d "$MACOSX_SDK_PATH"; then
2870                 with_macosx_sdk="${_macosx_sdk}"
2871                 break
2872             fi
2873         fi
2874     done
2875     if test ! -d "$MACOSX_SDK_PATH"; then
2876         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2877     fi
2879     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2881     case $with_macosx_sdk in
2882     10.13)
2883         MACOSX_SDK_VERSION=101300
2884         ;;
2885     10.14)
2886         MACOSX_SDK_VERSION=101400
2887         ;;
2888     10.15)
2889         MACOSX_SDK_VERSION=101500
2890         ;;
2891     11.0)
2892         MACOSX_SDK_VERSION=110000
2893         ;;
2894     11.1)
2895         MACOSX_SDK_VERSION=110100
2896         ;;
2897     *)
2898         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.1])
2899         ;;
2900     esac
2902     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
2903         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
2904     fi
2906     if test "$with_macosx_version_min_required" = "" ; then
2907         if test "$host_cpu" = x86_64; then
2908             with_macosx_version_min_required="10.10";
2909         else
2910             with_macosx_version_min_required="11.0";
2911         fi
2912     fi
2914     if test "$with_macosx_version_max_allowed" = "" ; then
2915         with_macosx_version_max_allowed="$with_macosx_sdk"
2916     fi
2918     # export this so that "xcrun" invocations later return matching values
2919     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2920     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2921     export DEVELOPER_DIR
2922     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2923     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2925     AC_MSG_CHECKING([whether Xcode is new enough])
2926     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2927     my_xcode_ver2=${my_xcode_ver1#Xcode }
2928     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2929     if test "$my_xcode_ver3" -ge 1103; then
2930         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2931     else
2932         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
2933     fi
2935     case "$with_macosx_version_min_required" in
2936     10.10)
2937         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2938         ;;
2939     10.11)
2940         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2941         ;;
2942     10.12)
2943         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2944         ;;
2945     10.13)
2946         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2947         ;;
2948     10.14)
2949         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2950         ;;
2951     10.15)
2952         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2953         ;;
2954     11.0)
2955         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
2956         ;;
2957     11.1)
2958         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
2959         ;;
2960     *)
2961         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--11.1])
2962         ;;
2963     esac
2965     LIBTOOL=/usr/bin/libtool
2966     INSTALL_NAME_TOOL=install_name_tool
2967     if test -z "$save_CC"; then
2968         stdlib=-stdlib=libc++
2969         if test "$ENABLE_LTO" = TRUE; then
2970             lto=-flto
2971         fi
2973         AC_MSG_CHECKING([what C compiler to use])
2974         CC="`xcrun -find clang`"
2975         CC_BASE=`first_arg_basename "$CC"`
2976         if test "$host_cpu" = x86_64; then
2977             CC+=" -target x86_64-apple-macos"
2978         else
2979             CC+=" -target arm64-apple-macos"
2980         fi
2981         CC+=" $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2982         AC_MSG_RESULT([$CC])
2984         AC_MSG_CHECKING([what C++ compiler to use])
2985         CXX="`xcrun -find clang++`"
2986         CXX_BASE=`first_arg_basename "$CXX"`
2987         if test "$host_cpu" = x86_64; then
2988             CXX+=" -target x86_64-apple-macos"
2989         else
2990             CXX+=" -target arm64-apple-macos"
2991         fi
2992         CXX+=" $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2993         AC_MSG_RESULT([$CXX])
2995         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2996         AR=`xcrun -find ar`
2997         NM=`xcrun -find nm`
2998         STRIP=`xcrun -find strip`
2999         LIBTOOL=`xcrun -find libtool`
3000         RANLIB=`xcrun -find ranlib`
3001     fi
3003     case "$with_macosx_version_max_allowed" in
3004     10.10)
3005         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3006         ;;
3007     10.11)
3008         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3009         ;;
3010     10.12)
3011         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3012         ;;
3013     10.13)
3014         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3015         ;;
3016     10.14)
3017         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3018         ;;
3019     10.15)
3020         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3021         ;;
3022     11.0)
3023         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3024         ;;
3025     11.1)
3026         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3027         ;;
3028     *)
3029         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--11.1])
3030         ;;
3031     esac
3033     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3034     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3035         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])
3036     else
3037         AC_MSG_RESULT([ok])
3038     fi
3040     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3041     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3042         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3043     else
3044         AC_MSG_RESULT([ok])
3045     fi
3046     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3047     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3049     AC_MSG_CHECKING([whether to do code signing])
3051     if test "$enable_macosx_code_signing" = yes; then
3052         # By default use the first suitable certificate (?).
3054         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3055         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3056         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3057         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3058         # "Developer ID Application" one.
3060         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3061         if test -n "$identity"; then
3062             MACOSX_CODESIGNING_IDENTITY=$identity
3063             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3064             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3065         else
3066             AC_MSG_ERROR([cannot determine identity to use])
3067         fi
3068     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3069         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3070         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3071         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3072     else
3073         AC_MSG_RESULT([no])
3074     fi
3076     AC_MSG_CHECKING([whether to create a Mac App Store package])
3078     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3079         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3080     elif test "$enable_macosx_package_signing" = yes; then
3081         # By default use the first suitable certificate.
3082         # It should be a "3rd Party Mac Developer Installer" one
3084         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3085         if test -n "$identity"; then
3086             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3087             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3088             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3089         else
3090             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3091         fi
3092     elif test -n "$enable_macosx_package_signing"; then
3093         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3094         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3095         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3096     else
3097         AC_MSG_RESULT([no])
3098     fi
3100     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3101         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3102     fi
3104     AC_MSG_CHECKING([whether to sandbox the application])
3106     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3107         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3108     elif test "$enable_macosx_sandbox" = yes; then
3109         ENABLE_MACOSX_SANDBOX=TRUE
3110         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3111         AC_MSG_RESULT([yes])
3112     else
3113         AC_MSG_RESULT([no])
3114     fi
3116     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3117     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3118     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3120 AC_SUBST(MACOSX_SDK_PATH)
3121 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3122 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3123 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3124 AC_SUBST(INSTALL_NAME_TOOL)
3125 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3126 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3127 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3128 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3129 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3131 dnl ===================================================================
3132 dnl Check iOS SDK and compiler
3133 dnl ===================================================================
3135 if test $_os = iOS; then
3136     AC_MSG_CHECKING([what iOS SDK to use])
3137     current_sdk_ver=14.3
3138     older_sdk_vers="14.2 14.1 14.0 13.7 13.6 13.5 13.4 13.2 13.1 13.0 12.4 12.2"
3139     if test "$enable_ios_simulator" = "yes"; then
3140         platform=iPhoneSimulator
3141         versionmin=-mios-simulator-version-min=12.2
3142     else
3143         platform=iPhoneOS
3144         versionmin=-miphoneos-version-min=12.2
3145     fi
3146     xcode_developer=`xcode-select -print-path`
3148     for sdkver in $current_sdk_ver $older_sdk_vers; do
3149         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3150         if test -d $t; then
3151             sysroot=$t
3152             break
3153         fi
3154     done
3156     if test -z "$sysroot"; then
3157         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3158     fi
3160     AC_MSG_RESULT($sysroot)
3162     # LTO is not really recommended for iOS builds,
3163     # the link time will be astronomical
3164     if test "$ENABLE_LTO" = TRUE; then
3165         lto=-flto
3166     fi
3168     stdlib="-stdlib=libc++"
3170     AC_MSG_CHECKING([what C compiler to use])
3171     CC="`xcrun -find clang`"
3172     CC_BASE=`first_arg_basename "$CC"`
3173     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $lto $versionmin"
3174     AC_MSG_RESULT([$CC])
3176     AC_MSG_CHECKING([what C++ compiler to use])
3177     CXX="`xcrun -find clang++`"
3178     CXX_BASE=`first_arg_basename "$CXX"`
3179     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $lto $versionmin"
3180     AC_MSG_RESULT([$CXX])
3182     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3183     AR=`xcrun -find ar`
3184     NM=`xcrun -find nm`
3185     STRIP=`xcrun -find strip`
3186     LIBTOOL=`xcrun -find libtool`
3187     RANLIB=`xcrun -find ranlib`
3190 AC_MSG_CHECKING([whether to treat the installation as read-only])
3192 if test $_os = Darwin; then
3193     enable_readonly_installset=yes
3194 elif test "$enable_extensions" != yes; then
3195     enable_readonly_installset=yes
3197 if test "$enable_readonly_installset" = yes; then
3198     AC_MSG_RESULT([yes])
3199     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3200 else
3201     AC_MSG_RESULT([no])
3204 dnl ===================================================================
3205 dnl Structure of install set
3206 dnl ===================================================================
3208 if test $_os = Darwin; then
3209     LIBO_BIN_FOLDER=MacOS
3210     LIBO_ETC_FOLDER=Resources
3211     LIBO_LIBEXEC_FOLDER=MacOS
3212     LIBO_LIB_FOLDER=Frameworks
3213     LIBO_LIB_PYUNO_FOLDER=Resources
3214     LIBO_SHARE_FOLDER=Resources
3215     LIBO_SHARE_HELP_FOLDER=Resources/help
3216     LIBO_SHARE_JAVA_FOLDER=Resources/java
3217     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3218     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3219     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3220     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3221     LIBO_URE_BIN_FOLDER=MacOS
3222     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3223     LIBO_URE_LIB_FOLDER=Frameworks
3224     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3225     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3226 elif test $_os = WINNT; then
3227     LIBO_BIN_FOLDER=program
3228     LIBO_ETC_FOLDER=program
3229     LIBO_LIBEXEC_FOLDER=program
3230     LIBO_LIB_FOLDER=program
3231     LIBO_LIB_PYUNO_FOLDER=program
3232     LIBO_SHARE_FOLDER=share
3233     LIBO_SHARE_HELP_FOLDER=help
3234     LIBO_SHARE_JAVA_FOLDER=program/classes
3235     LIBO_SHARE_PRESETS_FOLDER=presets
3236     LIBO_SHARE_READMES_FOLDER=readmes
3237     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3238     LIBO_SHARE_SHELL_FOLDER=program/shell
3239     LIBO_URE_BIN_FOLDER=program
3240     LIBO_URE_ETC_FOLDER=program
3241     LIBO_URE_LIB_FOLDER=program
3242     LIBO_URE_MISC_FOLDER=program
3243     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3244 else
3245     LIBO_BIN_FOLDER=program
3246     LIBO_ETC_FOLDER=program
3247     LIBO_LIBEXEC_FOLDER=program
3248     LIBO_LIB_FOLDER=program
3249     LIBO_LIB_PYUNO_FOLDER=program
3250     LIBO_SHARE_FOLDER=share
3251     LIBO_SHARE_HELP_FOLDER=help
3252     LIBO_SHARE_JAVA_FOLDER=program/classes
3253     LIBO_SHARE_PRESETS_FOLDER=presets
3254     LIBO_SHARE_READMES_FOLDER=readmes
3255     if test "$enable_fuzzers" != yes; then
3256         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3257     else
3258         LIBO_SHARE_RESOURCE_FOLDER=resource
3259     fi
3260     LIBO_SHARE_SHELL_FOLDER=program/shell
3261     LIBO_URE_BIN_FOLDER=program
3262     LIBO_URE_ETC_FOLDER=program
3263     LIBO_URE_LIB_FOLDER=program
3264     LIBO_URE_MISC_FOLDER=program
3265     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3267 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3268 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3269 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3270 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3271 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3272 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3273 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3274 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3275 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3276 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3277 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3278 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3279 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3280 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3281 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3282 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3284 # Not all of them needed in config_host.mk, add more if need arises
3285 AC_SUBST(LIBO_BIN_FOLDER)
3286 AC_SUBST(LIBO_ETC_FOLDER)
3287 AC_SUBST(LIBO_LIB_FOLDER)
3288 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3289 AC_SUBST(LIBO_SHARE_FOLDER)
3290 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3291 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3292 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3293 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3294 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3295 AC_SUBST(LIBO_URE_BIN_FOLDER)
3296 AC_SUBST(LIBO_URE_ETC_FOLDER)
3297 AC_SUBST(LIBO_URE_LIB_FOLDER)
3298 AC_SUBST(LIBO_URE_MISC_FOLDER)
3299 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3301 dnl ===================================================================
3302 dnl Windows specific tests and stuff
3303 dnl ===================================================================
3305 reg_get_value()
3307     # Return value: $regvalue
3308     unset regvalue
3310     local _regentry="/proc/registry${1}/${2}"
3311     if test -f "$_regentry"; then
3312         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3313         # Registry keys read via /proc/registry* are always \0 terminated!
3314         local _regvalue=$(tr -d '\0' < "$_regentry")
3315         if test $? -eq 0; then
3316             regvalue=$_regvalue
3317         fi
3318     fi
3321 # Get a value from the 32-bit side of the Registry
3322 reg_get_value_32()
3324     reg_get_value "32" "$1"
3327 # Get a value from the 64-bit side of the Registry
3328 reg_get_value_64()
3330     reg_get_value "64" "$1"
3333 if test "$_os" = "WINNT"; then
3334     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3335     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3336         AC_MSG_RESULT([no])
3337         WINDOWS_SDK_ARCH="x86"
3338     else
3339         AC_MSG_RESULT([yes])
3340         WINDOWS_SDK_ARCH="x64"
3341         BITNESS_OVERRIDE=64
3342     fi
3344 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3345     cross_compiling="yes"
3347 if test "$cross_compiling" = "yes"; then
3348     export CROSS_COMPILING=TRUE
3349 else
3350     CROSS_COMPILING=
3351     BUILD_TYPE="$BUILD_TYPE NATIVE"
3353 AC_SUBST(CROSS_COMPILING)
3355 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3356 # NOTE: must _not_ be used for bundled external libraries!
3357 ISYSTEM=
3358 if test "$GCC" = "yes"; then
3359     AC_MSG_CHECKING( for -isystem )
3360     save_CFLAGS=$CFLAGS
3361     CFLAGS="$CFLAGS -Werror"
3362     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3363     CFLAGS=$save_CFLAGS
3364     if test -n "$ISYSTEM"; then
3365         AC_MSG_RESULT(yes)
3366     else
3367         AC_MSG_RESULT(no)
3368     fi
3370 if test -z "$ISYSTEM"; then
3371     # fall back to using -I
3372     ISYSTEM=-I
3374 AC_SUBST(ISYSTEM)
3376 dnl ===================================================================
3377 dnl  Check which Visual Studio compiler is used
3378 dnl ===================================================================
3380 map_vs_year_to_version()
3382     # Return value: $vsversion
3384     unset vsversion
3386     case $1 in
3387     2019)
3388         vsversion=16;;
3389     *)
3390         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3391     esac
3394 vs_versions_to_check()
3396     # Args: $1 (optional) : versions to check, in the order of preference
3397     # Return value: $vsversions
3399     unset vsversions
3401     if test -n "$1"; then
3402         map_vs_year_to_version "$1"
3403         vsversions=$vsversion
3404     else
3405         # We accept only 2019
3406         vsversions="16"
3407     fi
3410 win_get_env_from_vsvars32bat()
3412     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3413     # Also seems to be located in another directory under the same name: vsvars32.bat
3414     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3415     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3416     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3417     chmod +x $WRAPPERBATCHFILEPATH
3418     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3419     rm -f $WRAPPERBATCHFILEPATH
3420     printf '%s' "$_win_get_env_from_vsvars32bat"
3423 find_ucrt()
3425     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3426     if test -n "$regvalue"; then
3427         PathFormat "$regvalue"
3428         UCRTSDKDIR=$formatted_path
3429         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3430         UCRTVERSION=$regvalue
3431         # Rest if not exist
3432         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3433           UCRTSDKDIR=
3434         fi
3435     fi
3436     if test -z "$UCRTSDKDIR"; then
3437         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3438         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3439         if test -f "$ide_env_file"; then
3440             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3441             UCRTSDKDIR=$formatted_path
3442             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3443             dnl Hack needed at least by tml:
3444             if test "$UCRTVERSION" = 10.0.15063.0 \
3445                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3446                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3447             then
3448                 UCRTVERSION=10.0.14393.0
3449             fi
3450         else
3451           AC_MSG_ERROR([No UCRT found])
3452         fi
3453     fi
3456 find_msvc()
3458     # Find Visual C++ 2019
3459     # Args: $1 (optional) : The VS version year
3460     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3462     unset vctest vcnum vcnumwithdot vcbuildnumber
3464     vs_versions_to_check "$1"
3465     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3466     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3467     PathFormat "$vswhere"
3468     vswhere=$formatted_path
3469     for ver in $vsversions; do
3470         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3471         # Fall back to all MS products (this includes VC++ Build Tools)
3472         if ! test -n "$vswhereoutput"; then
3473             AC_MSG_CHECKING([VC++ Build Tools and similar])
3474             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3475         fi
3476         if test -n "$vswhereoutput"; then
3477             PathFormat "$vswhereoutput"
3478             vctest=$formatted_path
3479             break
3480         fi
3481     done
3483     if test -n "$vctest"; then
3484         vcnumwithdot="$ver.0"
3485         case "$vcnumwithdot" in
3486         16.0)
3487             vcyear=2019
3488             vcnum=160
3489             ;;
3490         esac
3491         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3493     fi
3496 SOLARINC=
3497 MSBUILD_PATH=
3498 DEVENV=
3499 if test "$_os" = "WINNT"; then
3500     AC_MSG_CHECKING([Visual C++])
3501     find_msvc "$with_visual_studio"
3502     if test -z "$vctest"; then
3503         if test -n "$with_visual_studio"; then
3504             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3505         else
3506             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3507         fi
3508     fi
3510     if test "$BITNESS_OVERRIDE" = ""; then
3511         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3512             VC_PRODUCT_DIR=$vctest/VC
3513         else
3514             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3515         fi
3516     else
3517         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3518             VC_PRODUCT_DIR=$vctest/VC
3519         else
3520             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3521         fi
3522     fi
3523     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3525     AC_MSG_CHECKING([for short pathname of VC product directory])
3526     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3527     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3529     UCRTSDKDIR=
3530     UCRTVERSION=
3532     AC_MSG_CHECKING([for UCRT location])
3533     find_ucrt
3534     # find_ucrt errors out if it doesn't find it
3535     AC_MSG_RESULT([found])
3536     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3537     ucrtincpath_formatted=$formatted_path
3538     # SOLARINC is used for external modules and must be set too.
3539     # And no, it's not sufficient to set SOLARINC only, as configure
3540     # itself doesn't honour it.
3541     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3542     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3543     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3544     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3546     AC_SUBST(UCRTSDKDIR)
3547     AC_SUBST(UCRTVERSION)
3549     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3550     # Find the proper version of MSBuild.exe to use based on the VS version
3551     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3552     if test -n "$regvalue" ; then
3553         AC_MSG_RESULT([found: $regvalue])
3554         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3555     else
3556         if test "$vcnumwithdot" = "16.0"; then
3557             if test "$BITNESS_OVERRIDE" = ""; then
3558                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3559             else
3560                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3561             fi
3562         else
3563             if test "$BITNESS_OVERRIDE" = ""; then
3564                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3565             else
3566                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3567             fi
3568         fi
3569         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3570         AC_MSG_RESULT([$regvalue])
3571     fi
3573     # Find the version of devenv.exe
3574     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3575     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3576     if test ! -e "$DEVENV"; then
3577         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3578     fi
3580     dnl ===========================================================
3581     dnl  Check for the corresponding mspdb*.dll
3582     dnl ===========================================================
3584     VC_HOST_DIR=
3585     MSPDB_PATH=
3586     CL_PATH=
3588     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3589         VC_HOST_DIR="HostX64"
3590         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3591     else
3592         VC_HOST_DIR="HostX86"
3593         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3594     fi
3596     if test "$BITNESS_OVERRIDE" = ""; then
3597         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3598     else
3599         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3600     fi
3602     # MSVC 15.0 has libraries from 14.0?
3603     mspdbnum="140"
3605     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3606         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3607     fi
3609     dnl The path needs to be added before cl is called
3610     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3611     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3613     AC_MSG_CHECKING([cl.exe])
3615     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3616     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3617     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3618     # is not enough?
3620     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3621     dnl needed when building CLR code:
3622     if test -z "$MSVC_CXX"; then
3623         if test -f "$CL_PATH/cl.exe"; then
3624             MSVC_CXX="$CL_PATH/cl.exe"
3625         fi
3627         # This gives us a posix path with 8.3 filename restrictions
3628         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3629     fi
3631     if test -z "$CC"; then
3632         CC=$MSVC_CXX
3633         CC_BASE=`first_arg_basename "$CC"`
3634     fi
3635     if test -z "$CXX"; then
3636         CXX=$MSVC_CXX
3637         CXX_BASE=`first_arg_basename "$CXX"`
3638     fi
3640     if test -n "$CC"; then
3641         # Remove /cl.exe from CC case insensitive
3642         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3643         if test "$BITNESS_OVERRIDE" = ""; then
3644            COMPATH="$VC_PRODUCT_DIR"
3645         else
3646             if test -n "$VC_PRODUCT_DIR"; then
3647                 COMPATH=$VC_PRODUCT_DIR
3648             fi
3649         fi
3651         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3653         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3655         PathFormat "$COMPATH"
3656         COMPATH=`win_short_path_for_make "$formatted_path"`
3658         VCVER=$vcnum
3660         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3661         # are always "better", we list them in reverse chronological order.
3663         case "$vcnum" in
3664         160)
3665             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3666             ;;
3667         esac
3669         # The expectation is that --with-windows-sdk should not need to be used
3670         if test -n "$with_windows_sdk"; then
3671             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3672             *" "$with_windows_sdk" "*)
3673                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3674                 ;;
3675             *)
3676                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
3677                 ;;
3678             esac
3679         fi
3681         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3682         ac_objext=obj
3683         ac_exeext=exe
3685     else
3686         AC_MSG_ERROR([Visual C++ not found after all, huh])
3687     fi
3689     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
3690     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3691         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3692         // between Visual Studio versions and _MSC_VER:
3693         #if _MSC_VER < 1924
3694         #error
3695         #endif
3696     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3698     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3699     # version of the Explorer extension (and maybe other small
3700     # bits, too) needed when installing a 32-bit LibreOffice on a
3701     # 64-bit OS. The 64-bit Explorer extension is a feature that
3702     # has been present since long in OOo. Don't confuse it with
3703     # building LibreOffice itself as 64-bit code.
3705     BUILD_X64=
3706     CXX_X64_BINARY=
3708     if test "$BITNESS_OVERRIDE" = ""; then
3709         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3710         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3711              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3712             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3713                 BUILD_X64=TRUE
3714                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3715             fi
3716         fi
3717         if test "$BUILD_X64" = TRUE; then
3718             AC_MSG_RESULT([found])
3719         else
3720             AC_MSG_RESULT([not found])
3721             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3722         fi
3723     else
3724         CXX_X64_BINARY=$CXX
3725     fi
3726     AC_SUBST(BUILD_X64)
3728     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3729     AC_SUBST(CXX_X64_BINARY)
3731     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3732     # needed to support TWAIN scan on both 32- and 64-bit systems
3734     BUILD_X86=
3736     if test "$BITNESS_OVERRIDE" = "64"; then
3737         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3738         if test -n "$CXX_X86_BINARY"; then
3739             BUILD_X86=TRUE
3740             AC_MSG_RESULT([preset])
3741         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3742             BUILD_X86=TRUE
3743             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3744             CXX_X86_BINARY+=" /arch:SSE"
3745             AC_MSG_RESULT([found])
3746         else
3747             CXX_X86_BINARY=
3748             AC_MSG_RESULT([not found])
3749             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3750         fi
3751     else
3752         BUILD_X86=TRUE
3753         CXX_X86_BINARY=$MSVC_CXX
3754     fi
3755     AC_SUBST(BUILD_X86)
3756     AC_SUBST(CXX_X86_BINARY)
3758 AC_SUBST(VCVER)
3759 AC_SUBST(DEVENV)
3760 AC_SUBST(MSVC_CXX)
3763 # unowinreg.dll
3765 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3766 AC_SUBST(UNOWINREG_DLL)
3768 COM_IS_CLANG=
3769 AC_MSG_CHECKING([whether the compiler is actually Clang])
3770 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3771     #ifndef __clang__
3772     you lose
3773     #endif
3774     int foo=42;
3775     ]])],
3776     [AC_MSG_RESULT([yes])
3777      COM_IS_CLANG=TRUE],
3778     [AC_MSG_RESULT([no])])
3779 AC_SUBST(COM_IS_CLANG)
3781 CC_PLAIN=$CC
3782 CLANGVER=
3783 if test "$COM_IS_CLANG" = TRUE; then
3784     AC_MSG_CHECKING([whether Clang is new enough])
3785     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3786         #if !defined __apple_build_version__
3787         #error
3788         #endif
3789         ]])],
3790         [my_apple_clang=yes],[my_apple_clang=])
3791     if test "$my_apple_clang" = yes; then
3792         AC_MSG_RESULT([assumed yes (Apple Clang)])
3793     else
3794         if test "$_os" = WINNT; then
3795             dnl In which case, assume clang-cl:
3796             my_args="/EP /TC"
3797             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3798             dnl clang-cl:
3799             CC_PLAIN=
3800             for i in $CC; do
3801                 case $i in
3802                 -FIIntrin.h)
3803                     ;;
3804                 *)
3805                     CC_PLAIN="$CC_PLAIN $i"
3806                     ;;
3807                 esac
3808             done
3809         else
3810             my_args="-E -P"
3811         fi
3812         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3813         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3814         CLANGVER=`echo $clang_version \
3815             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3816         if test "$CLANGVER" -ge 50002; then
3817             AC_MSG_RESULT([yes ($clang_version)])
3818         else
3819             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3820         fi
3821         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3822         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3823     fi
3826 SHOWINCLUDES_PREFIX=
3827 if test "$_os" = WINNT; then
3828     dnl We need to guess the prefix of the -showIncludes output, it can be
3829     dnl localized
3830     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3831     echo "#include <stdlib.h>" > conftest.c
3832     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3833         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3834     rm -f conftest.c conftest.obj
3835     if test -z "$SHOWINCLUDES_PREFIX"; then
3836         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3837     else
3838         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3839     fi
3841 AC_SUBST(SHOWINCLUDES_PREFIX)
3844 # prefix C with ccache if needed
3846 if test "$CCACHE" != ""; then
3847     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3849     AC_LANG_PUSH([C])
3850     save_CFLAGS=$CFLAGS
3851     CFLAGS="$CFLAGS --ccache-skip -O2"
3852     dnl an empty program will do, we're checking the compiler flags
3853     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3854                       [use_ccache=yes], [use_ccache=no])
3855     if test $use_ccache = yes; then
3856         AC_MSG_RESULT([yes])
3857     else
3858         CC="$CCACHE $CC"
3859         CC_BASE="ccache $CC_BASE"
3860         AC_MSG_RESULT([no])
3861     fi
3862     CFLAGS=$save_CFLAGS
3863     AC_LANG_POP([C])
3866 # ===================================================================
3867 # check various GCC options that Clang does not support now but maybe
3868 # will somewhen in the future, check them even for GCC, so that the
3869 # flags are set
3870 # ===================================================================
3872 HAVE_GCC_GGDB2=
3873 if test "$GCC" = "yes"; then
3874     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3875     save_CFLAGS=$CFLAGS
3876     CFLAGS="$CFLAGS -Werror -ggdb2"
3877     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3878     CFLAGS=$save_CFLAGS
3879     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3880         AC_MSG_RESULT([yes])
3881     else
3882         AC_MSG_RESULT([no])
3883     fi
3885     if test "$host_cpu" = "m68k"; then
3886         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3887         save_CFLAGS=$CFLAGS
3888         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3889         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3890         CFLAGS=$save_CFLAGS
3891         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3892             AC_MSG_RESULT([yes])
3893         else
3894             AC_MSG_ERROR([no])
3895         fi
3896     fi
3898 AC_SUBST(HAVE_GCC_GGDB2)
3900 dnl ===================================================================
3901 dnl  Test the gcc version
3902 dnl ===================================================================
3903 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3904     AC_MSG_CHECKING([the GCC version])
3905     _gcc_version=`$CC -dumpversion`
3906     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3907         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3908     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3910     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3912     if test "$gcc_full_version" -lt 70000; then
3913         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3914     fi
3915 else
3916     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3917     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3918     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3919     # (which reports itself as GCC 4.2.1).
3920     GCC_VERSION=
3922 AC_SUBST(GCC_VERSION)
3924 dnl Set the ENABLE_DBGUTIL variable
3925 dnl ===================================================================
3926 AC_MSG_CHECKING([whether to build with additional debug utilities])
3927 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3928     ENABLE_DBGUTIL="TRUE"
3929     # this is an extra var so it can have different default on different MSVC
3930     # versions (in case there are version specific problems with it)
3931     MSVC_USE_DEBUG_RUNTIME="TRUE"
3933     AC_MSG_RESULT([yes])
3934     # cppunit and graphite expose STL in public headers
3935     if test "$with_system_cppunit" = "yes"; then
3936         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3937     else
3938         with_system_cppunit=no
3939     fi
3940     if test "$with_system_graphite" = "yes"; then
3941         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3942     else
3943         with_system_graphite=no
3944     fi
3945     if test "$with_system_orcus" = "yes"; then
3946         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3947     else
3948         with_system_orcus=no
3949     fi
3950     if test "$with_system_libcmis" = "yes"; then
3951         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3952     else
3953         with_system_libcmis=no
3954     fi
3955     if test "$with_system_hunspell" = "yes"; then
3956         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3957     else
3958         with_system_hunspell=no
3959     fi
3960     if test "$with_system_gpgmepp" = "yes"; then
3961         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3962     else
3963         with_system_gpgmepp=no
3964     fi
3965     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3966     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3967     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3968     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3969     # of those two is using the system variant:
3970     if test "$with_system_libnumbertext" = "yes"; then
3971         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3972     else
3973         with_system_libnumbertext=no
3974     fi
3975     if test "$with_system_libwps" = "yes"; then
3976         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3977     else
3978         with_system_libwps=no
3979     fi
3980 else
3981     ENABLE_DBGUTIL=""
3982     MSVC_USE_DEBUG_RUNTIME=""
3983     AC_MSG_RESULT([no])
3985 AC_SUBST(ENABLE_DBGUTIL)
3986 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3988 dnl Set the ENABLE_DEBUG variable.
3989 dnl ===================================================================
3990 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3991     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3993 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3994     if test -z "$libo_fuzzed_enable_debug"; then
3995         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3996     else
3997         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3998         enable_debug=yes
3999     fi
4002 AC_MSG_CHECKING([whether to do a debug build])
4003 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4004     ENABLE_DEBUG="TRUE"
4005     if test -n "$ENABLE_DBGUTIL" ; then
4006         AC_MSG_RESULT([yes (dbgutil)])
4007     else
4008         AC_MSG_RESULT([yes])
4009     fi
4010 else
4011     ENABLE_DEBUG=""
4012     AC_MSG_RESULT([no])
4014 AC_SUBST(ENABLE_DEBUG)
4016 dnl ===================================================================
4017 dnl Select the linker to use (gold/lld/ld.bfd).
4018 dnl This is done only after compiler checks (need to know if Clang is
4019 dnl used, for different defaults) and after checking if a debug build
4020 dnl is wanted (non-debug builds get the default linker if not explicitly
4021 dnl specified otherwise).
4022 dnl All checks for linker features/options should come after this.
4023 dnl ===================================================================
4024 check_use_ld()
4026     use_ld=$1
4027     use_ld_fail_if_error=$2
4028     use_ld_ok=
4029     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
4030     use_ld_ldflags_save="$LDFLAGS"
4031     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
4032     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4033 #include <stdio.h>
4034         ],[
4035 printf ("hello world\n");
4036         ])], USE_LD=$use_ld, [])
4037     if test -n "$USE_LD"; then
4038         AC_MSG_RESULT( yes )
4039         use_ld_ok=yes
4040     else
4041         if test -n "$use_ld_fail_if_error"; then
4042             AC_MSG_ERROR( no )
4043         else
4044             AC_MSG_RESULT( no )
4045         fi
4046     fi
4047     if test -n "$use_ld_ok"; then
4048         dnl keep the value of LDFLAGS
4049         return 0
4050     fi
4051     LDFLAGS="$use_ld_ldflags_save"
4052     return 1
4054 USE_LD=
4055 if test "$enable_ld" != "no"; then
4056     if test "$GCC" = "yes"; then
4057         if test -n "$enable_ld"; then
4058             check_use_ld "$enable_ld" fail_if_error
4059         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4060             dnl non-debug builds default to the default linker
4061             true
4062         elif test -n "$COM_IS_CLANG"; then
4063             check_use_ld lld
4064             if test $? -ne 0; then
4065                 check_use_ld gold
4066             fi
4067         else
4068             # For gcc first try gold, new versions also support lld.
4069             check_use_ld gold
4070             if test $? -ne 0; then
4071                 check_use_ld lld
4072             fi
4073         fi
4074         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4075         rm conftest.out
4076         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4077         if test -z "$ld_used"; then
4078             ld_used="unknown"
4079         fi
4080         AC_MSG_CHECKING([for linker that is used])
4081         AC_MSG_RESULT([$ld_used])
4082         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4083             if echo "$ld_used" | grep -q "^GNU ld"; then
4084                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4085                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4086             fi
4087         fi
4088     else
4089         if test "$enable_ld" = "yes"; then
4090             AC_MSG_ERROR([--enable-ld not supported])
4091         fi
4092     fi
4094 AC_SUBST(USE_LD)
4096 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4097 if test "$GCC" = "yes"; then
4098     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4099     bsymbolic_functions_ldflags_save=$LDFLAGS
4100     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4101     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4102 #include <stdio.h>
4103         ],[
4104 printf ("hello world\n");
4105         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4106     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4107         AC_MSG_RESULT( found )
4108     else
4109         AC_MSG_RESULT( not found )
4110     fi
4111     LDFLAGS=$bsymbolic_functions_ldflags_save
4113 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4115 LD_GC_SECTIONS=
4116 if test "$GCC" = "yes"; then
4117     for flag in "--gc-sections" "-dead_strip"; do
4118         AC_MSG_CHECKING([for $flag linker support])
4119         ldflags_save=$LDFLAGS
4120         LDFLAGS="$LDFLAGS -Wl,$flag"
4121         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4122 #include <stdio.h>
4123             ],[
4124 printf ("hello world\n");
4125             ])],[
4126             LD_GC_SECTIONS="-Wl,$flag"
4127             AC_MSG_RESULT( found )
4128             ], [
4129             AC_MSG_RESULT( not found )
4130             ])
4131         LDFLAGS=$ldflags_save
4132         if test -n "$LD_GC_SECTIONS"; then
4133             break
4134         fi
4135     done
4137 AC_SUBST(LD_GC_SECTIONS)
4139 HAVE_GSPLIT_DWARF=
4140 if test "$enable_split_debug" != no; then
4141     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4142     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4143         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4144         save_CFLAGS=$CFLAGS
4145         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4146         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4147         CFLAGS=$save_CFLAGS
4148         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4149             AC_MSG_RESULT([yes])
4150         else
4151             if test "$enable_split_debug" = yes; then
4152                 AC_MSG_ERROR([no])
4153             else
4154                 AC_MSG_RESULT([no])
4155             fi
4156         fi
4157     fi
4158     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4159         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4160         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4161     fi
4163 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4165 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4166 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4167 save_CFLAGS=$CFLAGS
4168 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4169 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4170 CFLAGS=$save_CFLAGS
4171 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4172     AC_MSG_RESULT([yes])
4173 else
4174     AC_MSG_RESULT([no])
4176 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4178 ENABLE_GDB_INDEX=
4179 if test "$enable_gdb_index" != "no"; then
4180     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4181     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4182         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4183         save_CFLAGS=$CFLAGS
4184         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4185         have_ggnu_pubnames=
4186         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4187         if test "$have_ggnu_pubnames" != "TRUE"; then
4188             if test "$enable_gdb_index" = "yes"; then
4189                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4190             else
4191                 AC_MSG_RESULT( no )
4192             fi
4193         else
4194             AC_MSG_RESULT( yes )
4195             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4196             ldflags_save=$LDFLAGS
4197             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4198             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4199 #include <stdio.h>
4200                 ],[
4201 printf ("hello world\n");
4202                 ])], ENABLE_GDB_INDEX=TRUE, [])
4203             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4204                 AC_MSG_RESULT( yes )
4205             else
4206                 if test "$enable_gdb_index" = "yes"; then
4207                     AC_MSG_ERROR( no )
4208                 else
4209                     AC_MSG_RESULT( no )
4210                 fi
4211             fi
4212             LDFLAGS=$ldflags_save
4213         fi
4214         CFLAGS=$save_CFLAGS
4215         fi
4216     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4217         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4218         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4219     fi
4221 AC_SUBST(ENABLE_GDB_INDEX)
4223 if test "$enable_sal_log" = yes; then
4224     ENABLE_SAL_LOG=TRUE
4226 AC_SUBST(ENABLE_SAL_LOG)
4228 dnl Check for enable symbols option
4229 dnl ===================================================================
4230 AC_MSG_CHECKING([whether to generate debug information])
4231 if test -z "$enable_symbols"; then
4232     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4233         enable_symbols=yes
4234     else
4235         enable_symbols=no
4236     fi
4238 if test "$enable_symbols" = yes; then
4239     ENABLE_SYMBOLS_FOR=all
4240     AC_MSG_RESULT([yes])
4241 elif test "$enable_symbols" = no; then
4242     ENABLE_SYMBOLS_FOR=
4243     AC_MSG_RESULT([no])
4244 else
4245     # Selective debuginfo.
4246     ENABLE_SYMBOLS_FOR="$enable_symbols"
4247     AC_MSG_RESULT([for "$enable_symbols"])
4249 AC_SUBST(ENABLE_SYMBOLS_FOR)
4251 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4252     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4253     AC_MSG_CHECKING([whether enough memory is available for linking])
4254     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4255     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4256     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4257         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4258     else
4259         AC_MSG_RESULT([yes])
4260     fi
4263 ENABLE_OPTIMIZED=
4264 ENABLE_OPTIMIZED_DEBUG=
4265 AC_MSG_CHECKING([whether to compile with optimization flags])
4266 if test -z "$enable_optimized"; then
4267     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4268         enable_optimized=no
4269     else
4270         enable_optimized=yes
4271     fi
4273 if test "$enable_optimized" = yes; then
4274     ENABLE_OPTIMIZED=TRUE
4275     AC_MSG_RESULT([yes])
4276 elif test "$enable_optimized" = debug; then
4277     ENABLE_OPTIMIZED_DEBUG=TRUE
4278     AC_MSG_RESULT([yes (debug)])
4279     HAVE_GCC_OG=
4280     if test "$GCC" = "yes"; then
4281         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4282         save_CFLAGS=$CFLAGS
4283         CFLAGS="$CFLAGS -Werror -Og"
4284         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4285         CFLAGS=$save_CFLAGS
4286         if test "$HAVE_GCC_OG" = "TRUE"; then
4287             AC_MSG_RESULT([yes])
4288         else
4289             AC_MSG_RESULT([no])
4290         fi
4291     fi
4292     if test -z "$HAVE_GCC_OG"; then
4293         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4294     fi
4295 else
4296     AC_MSG_RESULT([no])
4298 AC_SUBST(ENABLE_OPTIMIZED)
4299 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4302 # determine CPUNAME, OS, ...
4303 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4305 case "$host_os" in
4307 aix*)
4308     COM=GCC
4309     CPUNAME=POWERPC
4310     USING_X11=TRUE
4311     OS=AIX
4312     RTL_OS=AIX
4313     RTL_ARCH=PowerPC
4314     PLATFORMID=aix_powerpc
4315     P_SEP=:
4316     ;;
4318 cygwin*)
4319     COM=MSC
4320     USING_X11=
4321     OS=WNT
4322     RTL_OS=Windows
4323     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4324         P_SEP=";"
4325     else
4326         P_SEP=:
4327     fi
4328     case "$host_cpu" in
4329     i*86|x86_64)
4330         if test "$BITNESS_OVERRIDE" = 64; then
4331             CPUNAME=X86_64
4332             RTL_ARCH=X86_64
4333             PLATFORMID=windows_x86_64
4334             WINDOWS_X64=1
4335             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4336         else
4337             CPUNAME=INTEL
4338             RTL_ARCH=x86
4339             PLATFORMID=windows_x86
4340         fi
4341         ;;
4342     *)
4343         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4344         ;;
4345     esac
4346     SCPDEFS="$SCPDEFS -D_MSC_VER"
4347     ;;
4349 darwin*|macos*)
4350     COM=GCC
4351     USING_X11=
4352     OS=MACOSX
4353     RTL_OS=MacOSX
4354     P_SEP=:
4356     case "$host_cpu" in
4357     aarch64|arm64)
4358         if test "$enable_ios_simulator" = "yes"; then
4359             OS=iOS
4360         else
4361             CPUNAME=AARCH64
4362             RTL_ARCH=AARCH64
4363             PLATFORMID=macosx_arm64
4364         fi
4365         ;;
4366     x86_64)
4367         if test "$enable_ios_simulator" = "yes"; then
4368             OS=iOS
4369         fi
4370         CPUNAME=X86_64
4371         RTL_ARCH=X86_64
4372         PLATFORMID=macosx_x86_64
4373         ;;
4374     *)
4375         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4376         ;;
4377     esac
4378     ;;
4380 ios*)
4381     COM=GCC
4382     USING_X11=
4383     OS=iOS
4384     RTL_OS=iOS
4385     P_SEP=:
4387     case "$host_cpu" in
4388     aarch64|arm64)
4389         if test "$enable_ios_simulator" = "yes"; then
4390             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4391         fi
4392         ;;
4393     *)
4394         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4395         ;;
4396     esac
4397     CPUNAME=AARCH64
4398     RTL_ARCH=AARCH64
4399     PLATFORMID=ios_arm64
4400     ;;
4402 dragonfly*)
4403     COM=GCC
4404     USING_X11=TRUE
4405     OS=DRAGONFLY
4406     RTL_OS=DragonFly
4407     P_SEP=:
4409     case "$host_cpu" in
4410     i*86)
4411         CPUNAME=INTEL
4412         RTL_ARCH=x86
4413         PLATFORMID=dragonfly_x86
4414         ;;
4415     x86_64)
4416         CPUNAME=X86_64
4417         RTL_ARCH=X86_64
4418         PLATFORMID=dragonfly_x86_64
4419         ;;
4420     *)
4421         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4422         ;;
4423     esac
4424     ;;
4426 freebsd*)
4427     COM=GCC
4428     USING_X11=TRUE
4429     RTL_OS=FreeBSD
4430     OS=FREEBSD
4431     P_SEP=:
4433     case "$host_cpu" in
4434     i*86)
4435         CPUNAME=INTEL
4436         RTL_ARCH=x86
4437         PLATFORMID=freebsd_x86
4438         ;;
4439     x86_64|amd64)
4440         CPUNAME=X86_64
4441         RTL_ARCH=X86_64
4442         PLATFORMID=freebsd_x86_64
4443         ;;
4444     *)
4445         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4446         ;;
4447     esac
4448     ;;
4450 haiku*)
4451     COM=GCC
4452     USING_X11=
4453     GUIBASE=haiku
4454     RTL_OS=Haiku
4455     OS=HAIKU
4456     P_SEP=:
4458     case "$host_cpu" in
4459     i*86)
4460         CPUNAME=INTEL
4461         RTL_ARCH=x86
4462         PLATFORMID=haiku_x86
4463         ;;
4464     x86_64|amd64)
4465         CPUNAME=X86_64
4466         RTL_ARCH=X86_64
4467         PLATFORMID=haiku_x86_64
4468         ;;
4469     *)
4470         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4471         ;;
4472     esac
4473     ;;
4475 kfreebsd*)
4476     COM=GCC
4477     USING_X11=TRUE
4478     OS=LINUX
4479     RTL_OS=kFreeBSD
4480     P_SEP=:
4482     case "$host_cpu" in
4484     i*86)
4485         CPUNAME=INTEL
4486         RTL_ARCH=x86
4487         PLATFORMID=kfreebsd_x86
4488         ;;
4489     x86_64)
4490         CPUNAME=X86_64
4491         RTL_ARCH=X86_64
4492         PLATFORMID=kfreebsd_x86_64
4493         ;;
4494     *)
4495         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4496         ;;
4497     esac
4498     ;;
4500 linux-gnu*)
4501     COM=GCC
4502     USING_X11=TRUE
4503     OS=LINUX
4504     RTL_OS=Linux
4505     P_SEP=:
4507     case "$host_cpu" in
4509     aarch64)
4510         CPUNAME=AARCH64
4511         PLATFORMID=linux_aarch64
4512         RTL_ARCH=AARCH64
4513         ;;
4514     alpha)
4515         CPUNAME=AXP
4516         RTL_ARCH=ALPHA
4517         PLATFORMID=linux_alpha
4518         ;;
4519     arm*)
4520         CPUNAME=ARM
4521         EPM_FLAGS="-a arm"
4522         RTL_ARCH=ARM_EABI
4523         PLATFORMID=linux_arm_eabi
4524         case "$host_cpu" in
4525         arm*-linux)
4526             RTL_ARCH=ARM_OABI
4527             PLATFORMID=linux_arm_oabi
4528             ;;
4529         esac
4530         ;;
4531     hppa)
4532         CPUNAME=HPPA
4533         RTL_ARCH=HPPA
4534         EPM_FLAGS="-a hppa"
4535         PLATFORMID=linux_hppa
4536         ;;
4537     i*86)
4538         CPUNAME=INTEL
4539         RTL_ARCH=x86
4540         PLATFORMID=linux_x86
4541         ;;
4542     ia64)
4543         CPUNAME=IA64
4544         RTL_ARCH=IA64
4545         PLATFORMID=linux_ia64
4546         ;;
4547     mips)
4548         CPUNAME=GODSON
4549         RTL_ARCH=MIPS_EB
4550         EPM_FLAGS="-a mips"
4551         PLATFORMID=linux_mips_eb
4552         ;;
4553     mips64)
4554         CPUNAME=GODSON64
4555         RTL_ARCH=MIPS64_EB
4556         EPM_FLAGS="-a mips64"
4557         PLATFORMID=linux_mips64_eb
4558         ;;
4559     mips64el)
4560         CPUNAME=GODSON64
4561         RTL_ARCH=MIPS64_EL
4562         EPM_FLAGS="-a mips64el"
4563         PLATFORMID=linux_mips64_el
4564         ;;
4565     mipsel)
4566         CPUNAME=GODSON
4567         RTL_ARCH=MIPS_EL
4568         EPM_FLAGS="-a mipsel"
4569         PLATFORMID=linux_mips_el
4570         ;;
4571     m68k)
4572         CPUNAME=M68K
4573         RTL_ARCH=M68K
4574         PLATFORMID=linux_m68k
4575         ;;
4576     powerpc)
4577         CPUNAME=POWERPC
4578         RTL_ARCH=PowerPC
4579         PLATFORMID=linux_powerpc
4580         ;;
4581     powerpc64)
4582         CPUNAME=POWERPC64
4583         RTL_ARCH=PowerPC_64
4584         PLATFORMID=linux_powerpc64
4585         ;;
4586     powerpc64le)
4587         CPUNAME=POWERPC64
4588         RTL_ARCH=PowerPC_64_LE
4589         PLATFORMID=linux_powerpc64_le
4590         ;;
4591     sparc)
4592         CPUNAME=SPARC
4593         RTL_ARCH=SPARC
4594         PLATFORMID=linux_sparc
4595         ;;
4596     sparc64)
4597         CPUNAME=SPARC64
4598         RTL_ARCH=SPARC64
4599         PLATFORMID=linux_sparc64
4600         ;;
4601     s390)
4602         CPUNAME=S390
4603         RTL_ARCH=S390
4604         PLATFORMID=linux_s390
4605         ;;
4606     s390x)
4607         CPUNAME=S390X
4608         RTL_ARCH=S390x
4609         PLATFORMID=linux_s390x
4610         ;;
4611     x86_64)
4612         CPUNAME=X86_64
4613         RTL_ARCH=X86_64
4614         PLATFORMID=linux_x86_64
4615         ;;
4616     *)
4617         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4618         ;;
4619     esac
4620     ;;
4622 linux-android*)
4623     COM=GCC
4624     USING_X11=
4625     OS=ANDROID
4626     RTL_OS=Android
4627     P_SEP=:
4629     case "$host_cpu" in
4631     arm|armel)
4632         CPUNAME=ARM
4633         RTL_ARCH=ARM_EABI
4634         PLATFORMID=android_arm_eabi
4635         ;;
4636     aarch64)
4637         CPUNAME=AARCH64
4638         RTL_ARCH=AARCH64
4639         PLATFORMID=android_aarch64
4640         ;;
4641     i*86)
4642         CPUNAME=INTEL
4643         RTL_ARCH=x86
4644         PLATFORMID=android_x86
4645         ;;
4646     x86_64)
4647         CPUNAME=X86_64
4648         RTL_ARCH=X86_64
4649         PLATFORMID=android_x86_64
4650         ;;
4651     *)
4652         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4653         ;;
4654     esac
4655     ;;
4657 *netbsd*)
4658     COM=GCC
4659     USING_X11=TRUE
4660     OS=NETBSD
4661     RTL_OS=NetBSD
4662     P_SEP=:
4664     case "$host_cpu" in
4665     i*86)
4666         CPUNAME=INTEL
4667         RTL_ARCH=x86
4668         PLATFORMID=netbsd_x86
4669         ;;
4670     powerpc)
4671         CPUNAME=POWERPC
4672         RTL_ARCH=PowerPC
4673         PLATFORMID=netbsd_powerpc
4674         ;;
4675     sparc)
4676         CPUNAME=SPARC
4677         RTL_ARCH=SPARC
4678         PLATFORMID=netbsd_sparc
4679         ;;
4680     x86_64)
4681         CPUNAME=X86_64
4682         RTL_ARCH=X86_64
4683         PLATFORMID=netbsd_x86_64
4684         ;;
4685     *)
4686         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4687         ;;
4688     esac
4689     ;;
4691 openbsd*)
4692     COM=GCC
4693     USING_X11=TRUE
4694     OS=OPENBSD
4695     RTL_OS=OpenBSD
4696     P_SEP=:
4698     case "$host_cpu" in
4699     i*86)
4700         CPUNAME=INTEL
4701         RTL_ARCH=x86
4702         PLATFORMID=openbsd_x86
4703         ;;
4704     x86_64)
4705         CPUNAME=X86_64
4706         RTL_ARCH=X86_64
4707         PLATFORMID=openbsd_x86_64
4708         ;;
4709     *)
4710         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4711         ;;
4712     esac
4713     SOLARINC="$SOLARINC -I/usr/local/include"
4714     ;;
4716 solaris*)
4717     COM=GCC
4718     USING_X11=TRUE
4719     OS=SOLARIS
4720     RTL_OS=Solaris
4721     P_SEP=:
4723     case "$host_cpu" in
4724     i*86)
4725         CPUNAME=INTEL
4726         RTL_ARCH=x86
4727         PLATFORMID=solaris_x86
4728         ;;
4729     sparc)
4730         CPUNAME=SPARC
4731         RTL_ARCH=SPARC
4732         PLATFORMID=solaris_sparc
4733         ;;
4734     sparc64)
4735         CPUNAME=SPARC64
4736         RTL_ARCH=SPARC64
4737         PLATFORMID=solaris_sparc64
4738         ;;
4739     *)
4740         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4741         ;;
4742     esac
4743     SOLARINC="$SOLARINC -I/usr/local/include"
4744     ;;
4747     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4748     ;;
4749 esac
4751 if test "$with_x" = "no"; then
4752     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4755 DISABLE_GUI=""
4756 if test "$enable_gui" = "no"; then
4757     if test "$USING_X11" != TRUE; then
4758         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4759     fi
4760     USING_X11=
4761     DISABLE_GUI=TRUE
4762     AC_DEFINE(HAVE_FEATURE_UI,0)
4763     test_cairo=yes
4765 AC_SUBST(DISABLE_GUI)
4767 WORKDIR="${BUILDDIR}/workdir"
4768 INSTDIR="${BUILDDIR}/instdir"
4769 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4770 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4771 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4772 AC_SUBST(COM)
4773 AC_SUBST(CPUNAME)
4774 AC_SUBST(RTL_OS)
4775 AC_SUBST(RTL_ARCH)
4776 AC_SUBST(EPM_FLAGS)
4777 AC_SUBST(USING_X11)
4778 AC_SUBST([INSTDIR])
4779 AC_SUBST([INSTROOT])
4780 AC_SUBST([INSTROOTBASE])
4781 AC_SUBST(OS)
4782 AC_SUBST(P_SEP)
4783 AC_SUBST(WORKDIR)
4784 AC_SUBST(PLATFORMID)
4785 AC_SUBST(WINDOWS_X64)
4786 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4788 dnl ===================================================================
4789 dnl Test which package format to use
4790 dnl ===================================================================
4791 AC_MSG_CHECKING([which package format to use])
4792 if test -n "$with_package_format" -a "$with_package_format" != no; then
4793     for i in $with_package_format; do
4794         case "$i" in
4795         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4796             ;;
4797         *)
4798             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4799 aix - AIX software distribution
4800 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4801 deb - Debian software distribution
4802 pkg - Solaris software distribution
4803 rpm - RedHat software distribution
4805 LibreOffice additionally supports:
4806 archive - .tar.gz or .zip
4807 dmg - macOS .dmg
4808 installed - installation tree
4809 msi - Windows .msi
4810         ])
4811             ;;
4812         esac
4813     done
4814     # fakeroot is needed to ensure correct file ownerships/permissions
4815     # inside deb packages and tar archives created on Linux and Solaris.
4816     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4817         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4818         if test "$FAKEROOT" = "no"; then
4819             AC_MSG_ERROR(
4820                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4821         fi
4822     fi
4823     PKGFORMAT="$with_package_format"
4824     AC_MSG_RESULT([$PKGFORMAT])
4825 else
4826     PKGFORMAT=
4827     AC_MSG_RESULT([none])
4829 AC_SUBST(PKGFORMAT)
4831 dnl ===================================================================
4832 dnl Set up a different compiler to produce tools to run on the build
4833 dnl machine when doing cross-compilation
4834 dnl ===================================================================
4836 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4837 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4838 if test "$cross_compiling" = "yes"; then
4839     AC_MSG_CHECKING([for BUILD platform configuration])
4840     echo
4841     rm -rf CONF-FOR-BUILD config_build.mk
4842     mkdir CONF-FOR-BUILD
4843     # Here must be listed all files needed when running the configure script. In particular, also
4844     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4845     # keep them in the same order as there.
4846     (cd $SRC_ROOT && tar cf - \
4847         config.guess \
4848         bin/get_config_variables \
4849         solenv/bin/getcompver.awk \
4850         solenv/inc/langlist.mk \
4851         download.lst \
4852         config_host.mk.in \
4853         config_host_lang.mk.in \
4854         Makefile.in \
4855         bin/bffvalidator.sh.in \
4856         bin/odfvalidator.sh.in \
4857         bin/officeotron.sh.in \
4858         hardened_runtime.xcent.in \
4859         instsetoo_native/util/openoffice.lst.in \
4860         config_host/*.in \
4861         sysui/desktop/macosx/Info.plist.in) \
4862     | (cd CONF-FOR-BUILD && tar xf -)
4863     cp configure CONF-FOR-BUILD
4864     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4865     (
4866     unset COM USING_X11 OS CPUNAME
4867     unset CC CXX SYSBASE CFLAGS
4868     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4869     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4870     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4871     if test -n "$CC_FOR_BUILD"; then
4872         export CC="$CC_FOR_BUILD"
4873         CC_BASE=`first_arg_basename "$CC"`
4874     fi
4875     if test -n "$CXX_FOR_BUILD"; then
4876         export CXX="$CXX_FOR_BUILD"
4877         CXX_BASE=`first_arg_basename "$CXX"`
4878     fi
4879     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4880     cd CONF-FOR-BUILD
4881     sub_conf_opts=""
4882     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4883     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4884     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4885     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4886     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4887     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
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-gstreamer-1-0 \
4893         --disable-gtk3 \
4894         --disable-pdfimport \
4895         --disable-postgresql-sdbc \
4896         --enable-icecream="$enable_icecream" \
4897         --with-parallelism="$with_parallelism" \
4898         --without-doxygen \
4899         --without-java \
4900         $sub_conf_opts \
4901         --srcdir=$srcdir \
4902         2>&1 | sed -e 's/^/    /'
4903     test -f ./config_host.mk 2>/dev/null || exit
4904     cp config_host.mk ../config_build.mk
4905     cp config_host_lang.mk ../config_build_lang.mk
4906     mv config.log ../config.Build.log
4907     mkdir -p ../config_build
4908     mv config_host/*.h ../config_build
4909     . ./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
4911     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
4912         VV='$'$V
4913         VV=`eval "echo $VV"`
4914         if test -n "$VV"; then
4915             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4916             echo "$line" >>build-config
4917         fi
4918     done
4920     for V in INSTDIR INSTROOT WORKDIR; do
4921         VV='$'$V
4922         VV=`eval "echo $VV"`
4923         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4924         if test -n "$VV"; then
4925             line="${V}_FOR_BUILD='$VV'"
4926             echo "$line" >>build-config
4927         fi
4928     done
4930     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4931     echo "$line" >>build-config
4933     )
4934     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4935     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])
4936     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4937              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4939     eval `cat CONF-FOR-BUILD/build-config`
4941     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4943     rm -rf CONF-FOR-BUILD
4944 else
4945     OS_FOR_BUILD="$OS"
4946     CC_FOR_BUILD="$CC"
4947     CXX_FOR_BUILD="$CXX"
4948     INSTDIR_FOR_BUILD="$INSTDIR"
4949     INSTROOT_FOR_BUILD="$INSTROOT"
4950     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4951     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4952     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4953     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4954     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4955     WORKDIR_FOR_BUILD="$WORKDIR"
4957 AC_SUBST(OS_FOR_BUILD)
4958 AC_SUBST(INSTDIR_FOR_BUILD)
4959 AC_SUBST(INSTROOT_FOR_BUILD)
4960 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4961 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4962 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4963 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4964 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4965 AC_SUBST(WORKDIR_FOR_BUILD)
4967 dnl ===================================================================
4968 dnl Check for syslog header
4969 dnl ===================================================================
4970 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4972 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4973 dnl ===================================================================
4974 AC_MSG_CHECKING([whether to turn warnings to errors])
4975 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4976     ENABLE_WERROR="TRUE"
4977     AC_MSG_RESULT([yes])
4978 else
4979     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4980         ENABLE_WERROR="TRUE"
4981         AC_MSG_RESULT([yes])
4982     else
4983         AC_MSG_RESULT([no])
4984     fi
4986 AC_SUBST(ENABLE_WERROR)
4988 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4989 dnl ===================================================================
4990 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4991 if test -z "$enable_assert_always_abort"; then
4992    if test "$ENABLE_DEBUG" = TRUE; then
4993        enable_assert_always_abort=yes
4994    else
4995        enable_assert_always_abort=no
4996    fi
4998 if test "$enable_assert_always_abort" = "yes"; then
4999     ASSERT_ALWAYS_ABORT="TRUE"
5000     AC_MSG_RESULT([yes])
5001 else
5002     ASSERT_ALWAYS_ABORT="FALSE"
5003     AC_MSG_RESULT([no])
5005 AC_SUBST(ASSERT_ALWAYS_ABORT)
5007 # Determine whether to use ooenv for the instdir installation
5008 # ===================================================================
5009 if test $_os != "WINNT" -a $_os != "Darwin"; then
5010     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5011     if test "$enable_ooenv" = "no"; then
5012         AC_MSG_RESULT([no])
5013     else
5014         ENABLE_OOENV="TRUE"
5015         AC_MSG_RESULT([yes])
5016     fi
5018 AC_SUBST(ENABLE_OOENV)
5020 if test "$USING_X11" != TRUE; then
5021     # be sure to do not mess with unneeded stuff
5022     test_randr=no
5023     test_xrender=no
5024     test_cups=no
5025     test_dbus=no
5026     build_gstreamer_1_0=no
5027     test_kf5=no
5028     test_qt5=no
5029     test_gtk3_kde5=no
5030     enable_cairo_canvas=no
5033 if test "$OS" = "HAIKU"; then
5034     enable_cairo_canvas=yes
5035     test_kf5=yes
5038 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5039     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!])
5040     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!"
5041     enable_kf5=yes
5044 if test "$test_kf5" = "yes"; then
5045     test_qt5=yes
5048 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5049     if test "$enable_qt5" = "no"; then
5050         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5051     else
5052         enable_qt5=yes
5053     fi
5056 dnl ===================================================================
5057 dnl check for cups support
5058 dnl ===================================================================
5059 ENABLE_CUPS=""
5061 if test "$enable_cups" = "no"; then
5062     test_cups=no
5065 AC_MSG_CHECKING([whether to enable CUPS support])
5066 if test "$test_cups" = "yes"; then
5067     ENABLE_CUPS="TRUE"
5068     AC_MSG_RESULT([yes])
5070     AC_MSG_CHECKING([whether cups support is present])
5071     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5072     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5073     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5074         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5075     fi
5077 else
5078     AC_MSG_RESULT([no])
5081 AC_SUBST(ENABLE_CUPS)
5083 # fontconfig checks
5084 if test "$test_fontconfig" = "yes"; then
5085     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5086     SYSTEM_FONTCONFIG=TRUE
5087     FilterLibs "${FONTCONFIG_LIBS}"
5088     FONTCONFIG_LIBS="${filteredlibs}"
5090 AC_SUBST(FONTCONFIG_CFLAGS)
5091 AC_SUBST(FONTCONFIG_LIBS)
5092 AC_SUBST([SYSTEM_FONTCONFIG])
5094 dnl whether to find & fetch external tarballs?
5095 dnl ===================================================================
5096 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5097    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5098        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5099    else
5100        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5101    fi
5103 if test -z "$TARFILE_LOCATION"; then
5104     if test -d "$SRC_ROOT/src" ; then
5105         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5106         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5107     fi
5108     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5109 else
5110     AbsolutePath "$TARFILE_LOCATION"
5111     PathFormat "${absolute_path}"
5112     TARFILE_LOCATION="${formatted_path}"
5114 AC_SUBST(TARFILE_LOCATION)
5116 AC_MSG_CHECKING([whether we want to fetch tarballs])
5117 if test "$enable_fetch_external" != "no"; then
5118     if test "$with_all_tarballs" = "yes"; then
5119         AC_MSG_RESULT([yes, all of them])
5120         DO_FETCH_TARBALLS="ALL"
5121     else
5122         AC_MSG_RESULT([yes, if we use them])
5123         DO_FETCH_TARBALLS="TRUE"
5124     fi
5125 else
5126     AC_MSG_RESULT([no])
5127     DO_FETCH_TARBALLS=
5129 AC_SUBST(DO_FETCH_TARBALLS)
5131 AC_MSG_CHECKING([whether to build help])
5132 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5133     BUILD_TYPE="$BUILD_TYPE HELP"
5134     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5135     case "$with_help" in
5136     "html")
5137         ENABLE_HTMLHELP=TRUE
5138         SCPDEFS="$SCPDEFS -DWITH_HELP"
5139         AC_MSG_RESULT([HTML])
5140         ;;
5141     "online")
5142         ENABLE_HTMLHELP=TRUE
5143         HELP_ONLINE=TRUE
5144         AC_MSG_RESULT([HTML])
5145         ;;
5146     yes)
5147         SCPDEFS="$SCPDEFS -DWITH_HELP"
5148         AC_MSG_RESULT([yes])
5149         ;;
5150     *)
5151         AC_MSG_ERROR([Unknown --with-help=$with_help])
5152         ;;
5153     esac
5154 else
5155     AC_MSG_RESULT([no])
5157 AC_SUBST([ENABLE_HTMLHELP])
5158 AC_SUBST([HELP_ONLINE])
5160 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5161 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5162     BUILD_TYPE="$BUILD_TYPE HELP"
5163     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5164     case "$with_omindex" in
5165     "server")
5166         ENABLE_HTMLHELP=TRUE
5167         HELP_ONLINE=TRUE
5168         HELP_OMINDEX_PAGE=TRUE
5169         AC_MSG_RESULT([SERVER])
5170         ;;
5171     "noxap")
5172         ENABLE_HTMLHELP=TRUE
5173         HELP_ONLINE=TRUE
5174         HELP_OMINDEX_PAGE=FALSE
5175         AC_MSG_RESULT([NOXAP])
5176         ;;
5177     *)
5178         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5179         ;;
5180     esac
5181 else
5182     HELP_OMINDEX_PAGE=FALSE
5183     AC_MSG_RESULT([no])
5185 AC_SUBST([ENABLE_HTMLHELP])
5186 AC_SUBST([HELP_OMINDEX_PAGE])
5187 AC_SUBST([HELP_ONLINE])
5190 dnl Test whether to include MySpell dictionaries
5191 dnl ===================================================================
5192 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5193 if test "$with_myspell_dicts" = "yes"; then
5194     AC_MSG_RESULT([yes])
5195     WITH_MYSPELL_DICTS=TRUE
5196     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5197     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5198 else
5199     AC_MSG_RESULT([no])
5200     WITH_MYSPELL_DICTS=
5202 AC_SUBST(WITH_MYSPELL_DICTS)
5204 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5205 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5206     if test "$with_system_dicts" = yes; then
5207         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5208     fi
5209     with_system_dicts=no
5212 AC_MSG_CHECKING([whether to use dicts from external paths])
5213 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5214     AC_MSG_RESULT([yes])
5215     SYSTEM_DICTS=TRUE
5216     AC_MSG_CHECKING([for spelling dictionary directory])
5217     if test -n "$with_external_dict_dir"; then
5218         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5219     else
5220         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5221         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5222             DICT_SYSTEM_DIR=file:///usr/share/myspell
5223         fi
5224     fi
5225     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5226     AC_MSG_CHECKING([for hyphenation patterns directory])
5227     if test -n "$with_external_hyph_dir"; then
5228         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5229     else
5230         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5231     fi
5232     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5233     AC_MSG_CHECKING([for thesaurus directory])
5234     if test -n "$with_external_thes_dir"; then
5235         THES_SYSTEM_DIR=file://$with_external_thes_dir
5236     else
5237         THES_SYSTEM_DIR=file:///usr/share/mythes
5238     fi
5239     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5240 else
5241     AC_MSG_RESULT([no])
5242     SYSTEM_DICTS=
5244 AC_SUBST(SYSTEM_DICTS)
5245 AC_SUBST(DICT_SYSTEM_DIR)
5246 AC_SUBST(HYPH_SYSTEM_DIR)
5247 AC_SUBST(THES_SYSTEM_DIR)
5249 dnl ===================================================================
5250 dnl Precompiled headers.
5251 ENABLE_PCH=""
5252 AC_MSG_CHECKING([whether to enable pch feature])
5253 if test -z "$enable_pch"; then
5254     if test "$_os" = "WINNT"; then
5255         # Enabled by default on Windows.
5256         enable_pch=yes
5257     else
5258         enable_pch=no
5259     fi
5261 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5262     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5264 if test "$enable_pch" = "system"; then
5265     ENABLE_PCH="1"
5266     AC_MSG_RESULT([yes (system headers)])
5267 elif test "$enable_pch" = "base"; then
5268     ENABLE_PCH="2"
5269     AC_MSG_RESULT([yes (system and base headers)])
5270 elif test "$enable_pch" = "normal"; then
5271     ENABLE_PCH="3"
5272     AC_MSG_RESULT([yes (normal)])
5273 elif test "$enable_pch" = "full"; then
5274     ENABLE_PCH="4"
5275     AC_MSG_RESULT([yes (full)])
5276 elif test "$enable_pch" = "yes"; then
5277     # Pick a suitable default.
5278     if test "$GCC" = "yes"; then
5279         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5280         # while making the PCHs larger and rebuilds more likely.
5281         ENABLE_PCH="2"
5282         AC_MSG_RESULT([yes (system and base headers)])
5283     else
5284         # With MSVC the highest level makes a significant difference,
5285         # and it was the default when there used to be no PCH levels.
5286         ENABLE_PCH="4"
5287         AC_MSG_RESULT([yes (full)])
5288     fi
5289 elif test "$enable_pch" = "no"; then
5290     AC_MSG_RESULT([no])
5291 else
5292     AC_MSG_ERROR([Unknown value for --enable-pch])
5294 AC_SUBST(ENABLE_PCH)
5295 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5296 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5297     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5298     if test "$CCACHE_BIN" != "not found"; then
5299         AC_MSG_CHECKING([ccache version])
5300         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5301         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5302         AC_MSG_RESULT([$CCACHE_VERSION])
5303         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5304         if test "$CCACHE_NUMVER" -gt "030701"; then
5305             AC_MSG_RESULT([yes])
5306         else
5307             AC_MSG_RESULT([no (not newer than 3.7.1)])
5308             CCACHE_DEPEND_MODE=
5309         fi
5310     fi
5313 BUILDING_PCH_WITH_OBJ=
5314 if test -n "$ENABLE_PCH"; then
5315     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5316     save_CFLAGS=$CFLAGS
5317     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5318     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5319     CFLAGS=$save_CFLAGS
5320     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5321         AC_MSG_RESULT(yes)
5322     else
5323         AC_MSG_RESULT(no)
5324     fi
5326 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5328 PCH_MODULES_CODEGEN=
5329 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5330     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-codegen])
5331     save_CFLAGS=$CFLAGS
5332     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-codegen"
5333     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_CODEGEN="-Xclang -fmodules-codegen" ],[])
5334     CFLAGS=$save_CFLAGS
5335     if test -n "$PCH_MODULES_CODEGEN"; then
5336         AC_MSG_RESULT(yes)
5337     else
5338         AC_MSG_RESULT(no)
5339     fi
5340     CFLAGS=$save_CFLAGS
5342 AC_SUBST(PCH_MODULES_CODEGEN)
5343 PCH_MODULES_DEBUGINFO=
5344 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5345     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-debuginfo])
5346     save_CFLAGS=$CFLAGS
5347     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-debuginfo"
5348     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_DEBUGINFO="-Xclang -fmodules-debuginfo" ],[])
5349     CFLAGS=$save_CFLAGS
5350     if test -n "$PCH_MODULES_DEBUGINFO"; then
5351         AC_MSG_RESULT(yes)
5352     else
5353         AC_MSG_RESULT(no)
5354     fi
5355     CFLAGS=$save_CFLAGS
5357 AC_SUBST(PCH_MODULES_DEBUGINFO)
5359 TAB=`printf '\t'`
5361 AC_MSG_CHECKING([the GNU Make version])
5362 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5363 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5364 if test "$_make_longver" -ge "038200"; then
5365     AC_MSG_RESULT([$GNUMAKE $_make_version])
5367 elif test "$_make_longver" -ge "038100"; then
5368     if test "$build_os" = "cygwin"; then
5369         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5370     fi
5371     AC_MSG_RESULT([$GNUMAKE $_make_version])
5373     dnl ===================================================================
5374     dnl Search all the common names for sha1sum
5375     dnl ===================================================================
5376     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5377     if test -z "$SHA1SUM"; then
5378         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5379     elif test "$SHA1SUM" = "openssl"; then
5380         SHA1SUM="openssl sha1"
5381     fi
5382     AC_MSG_CHECKING([for GNU Make bug 20033])
5383     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5384     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5385 A := \$(wildcard *.a)
5387 .PHONY: all
5388 all: \$(A:.a=.b)
5389 <TAB>@echo survived bug20033.
5391 .PHONY: setup
5392 setup:
5393 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5395 define d1
5396 @echo lala \$(1)
5397 @sleep 1
5398 endef
5400 define d2
5401 @echo tyty \$(1)
5402 @sleep 1
5403 endef
5405 %.b : %.a
5406 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5407 <TAB>\$(call d1,\$(CHECKSUM)),\
5408 <TAB>\$(call d2,\$(CHECKSUM)))
5410     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5411         no_parallelism_make="YES"
5412         AC_MSG_RESULT([yes, disable parallelism])
5413     else
5414         AC_MSG_RESULT([no, keep parallelism enabled])
5415     fi
5416     rm -rf $TESTGMAKEBUG20033
5417 else
5418     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5421 # find if gnumake support file function
5422 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5423 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5424 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5425     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5427 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5428 \$(file >test.txt,Success )
5430 .PHONY: all
5431 all:
5432 <TAB>@cat test.txt
5435 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5436 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5437     HAVE_GNUMAKE_FILE_FUNC=TRUE
5438     AC_MSG_RESULT([yes])
5439 else
5440     AC_MSG_RESULT([no])
5442 rm -rf $TESTGMAKEFILEFUNC
5443 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5444 AC_SUBST(GNUMAKE_WIN_NATIVE)
5446 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5447 STALE_MAKE=
5448 if test "$_make_ver_check" = ""; then
5449    STALE_MAKE=TRUE
5452 HAVE_LD_HASH_STYLE=FALSE
5453 WITH_LINKER_HASH_STYLE=
5454 AC_MSG_CHECKING([for --hash-style gcc linker support])
5455 if test "$GCC" = "yes"; then
5456     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5457         hash_styles="gnu sysv"
5458     elif test "$with_linker_hash_style" = "no"; then
5459         hash_styles=
5460     else
5461         hash_styles="$with_linker_hash_style"
5462     fi
5464     for hash_style in $hash_styles; do
5465         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5466         hash_style_ldflags_save=$LDFLAGS
5467         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5469         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5470             [
5471 #include <stdio.h>
5472             ],[
5473 printf ("");
5474             ])],
5475             [
5476                   HAVE_LD_HASH_STYLE=TRUE
5477                   WITH_LINKER_HASH_STYLE=$hash_style
5478             ],
5479             [HAVE_LD_HASH_STYLE=FALSE],
5480             [HAVE_LD_HASH_STYLE=FALSE])
5481         LDFLAGS=$hash_style_ldflags_save
5482     done
5484     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5485         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5486     else
5487         AC_MSG_RESULT( no )
5488     fi
5489     LDFLAGS=$hash_style_ldflags_save
5490 else
5491     AC_MSG_RESULT( no )
5493 AC_SUBST(HAVE_LD_HASH_STYLE)
5494 AC_SUBST(WITH_LINKER_HASH_STYLE)
5496 dnl ===================================================================
5497 dnl Check whether there's a Perl version available.
5498 dnl ===================================================================
5499 if test -z "$with_perl_home"; then
5500     AC_PATH_PROG(PERL, perl)
5501 else
5502     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5503     _perl_path="$with_perl_home/bin/perl"
5504     if test -x "$_perl_path"; then
5505         PERL=$_perl_path
5506     else
5507         AC_MSG_ERROR([$_perl_path not found])
5508     fi
5511 dnl ===================================================================
5512 dnl Testing for Perl version 5 or greater.
5513 dnl $] is the Perl version variable, it is returned as an integer
5514 dnl ===================================================================
5515 if test "$PERL"; then
5516     AC_MSG_CHECKING([the Perl version])
5517     ${PERL} -e "exit($]);"
5518     _perl_version=$?
5519     if test "$_perl_version" -lt 5; then
5520         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5521     fi
5522     AC_MSG_RESULT([Perl $_perl_version])
5523 else
5524     AC_MSG_ERROR([Perl not found, install Perl 5])
5527 dnl ===================================================================
5528 dnl Testing for required Perl modules
5529 dnl ===================================================================
5531 AC_MSG_CHECKING([for required Perl modules])
5532 perl_use_string="use Cwd ; use Digest::MD5"
5533 if test "$_os" = "WINNT"; then
5534     if test -n "$PKGFORMAT"; then
5535         for i in $PKGFORMAT; do
5536             case "$i" in
5537             msi)
5538                 # for getting fonts versions to use in MSI
5539                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5540                 ;;
5541             esac
5542         done
5543     fi
5545 if test "$with_system_hsqldb" = "yes"; then
5546     perl_use_string="$perl_use_string ; use Archive::Zip"
5548 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5549     AC_MSG_RESULT([all modules found])
5550 else
5551     AC_MSG_RESULT([failed to find some modules])
5552     # Find out which modules are missing.
5553     for i in $perl_use_string; do
5554         if test "$i" != "use" -a "$i" != ";"; then
5555             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5556                 missing_perl_modules="$missing_perl_modules $i"
5557             fi
5558         fi
5559     done
5560     AC_MSG_ERROR([
5561     The missing Perl modules are: $missing_perl_modules
5562     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5565 dnl ===================================================================
5566 dnl Check for pkg-config
5567 dnl ===================================================================
5568 if test "$_os" != "WINNT"; then
5569     PKG_PROG_PKG_CONFIG
5572 if test "$_os" != "WINNT"; then
5574     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5575     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5576     # explicitly. Or put /path/to/compiler in PATH yourself.
5578     # Use wrappers for LTO
5579     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5580         AC_CHECK_TOOL(AR,gcc-ar)
5581         AC_CHECK_TOOL(NM,gcc-nm)
5582         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5583     else
5584         AC_CHECK_TOOL(AR,ar)
5585         AC_CHECK_TOOL(NM,nm)
5586         AC_CHECK_TOOL(RANLIB,ranlib)
5587     fi
5588     AC_CHECK_TOOL(OBJDUMP,objdump)
5589     AC_CHECK_TOOL(READELF,readelf)
5590     AC_CHECK_TOOL(STRIP,strip)
5591     if test "$_os" = "WINNT"; then
5592         AC_CHECK_TOOL(DLLTOOL,dlltool)
5593         AC_CHECK_TOOL(WINDRES,windres)
5594     fi
5596 AC_SUBST(AR)
5597 AC_SUBST(DLLTOOL)
5598 AC_SUBST(NM)
5599 AC_SUBST(OBJDUMP)
5600 AC_SUBST(PKG_CONFIG)
5601 AC_SUBST(RANLIB)
5602 AC_SUBST(READELF)
5603 AC_SUBST(STRIP)
5604 AC_SUBST(WINDRES)
5606 dnl ===================================================================
5607 dnl pkg-config checks on macOS
5608 dnl ===================================================================
5610 if test $_os = Darwin; then
5611     AC_MSG_CHECKING([for bogus pkg-config])
5612     if test -n "$PKG_CONFIG"; then
5613         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5614             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5615         else
5616             if test "$enable_bogus_pkg_config" = "yes"; then
5617                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5618             else
5619                 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.])
5620             fi
5621         fi
5622     else
5623         AC_MSG_RESULT([no, good])
5624     fi
5627 find_csc()
5629     # Return value: $csctest
5631     unset csctest
5633     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5634     if test -n "$regvalue"; then
5635         csctest=$regvalue
5636         return
5637     fi
5640 find_al()
5642     # Return value: $altest
5644     unset altest
5646     # We need this check to detect 4.6.1 or above.
5647     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5648         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5649         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5650             altest=$regvalue
5651             return
5652         fi
5653     done
5655     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5656         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5657         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5658             altest=$regvalue
5659             return
5660         fi
5661     done
5666 find_dotnetsdk46()
5668     unset frametest
5670     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5671         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5672         if test -n "$regvalue"; then
5673             frametest=$regvalue
5674             return
5675         fi
5676     done
5679 find_winsdk_version()
5681     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5682     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5684     unset winsdktest winsdkbinsubdir winsdklibsubdir
5686     case "$1" in
5687     8.0|8.0A)
5688         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5689         if test -n "$regvalue"; then
5690             winsdktest=$regvalue
5691             winsdklibsubdir=win8
5692             return
5693         fi
5694         ;;
5695     8.1|8.1A)
5696         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5697         if test -n "$regvalue"; then
5698             winsdktest=$regvalue
5699             winsdklibsubdir=winv6.3
5700             return
5701         fi
5702         ;;
5703     10.0)
5704         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5705         if test -n "$regvalue"; then
5706             winsdktest=$regvalue
5707             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5708             if test -n "$regvalue"; then
5709                 winsdkbinsubdir="$regvalue".0
5710                 winsdklibsubdir=$winsdkbinsubdir
5711                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5712                 # test exist the SDK path
5713                 if test -d "$tmppath"; then
5714                    # when path is convertible to a short path then path is okay
5715                    cygpath -d "$tmppath" >/dev/null 2>&1
5716                    if test $? -ne 0; then
5717                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5718                    fi
5719                 else
5720                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5721                 fi
5722             fi
5723             return
5724         fi
5725         ;;
5726     esac
5729 find_winsdk()
5731     # Return value: From find_winsdk_version
5733     unset winsdktest
5735     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5736         find_winsdk_version $ver
5737         if test -n "$winsdktest"; then
5738             return
5739         fi
5740     done
5743 find_msms()
5745     AC_MSG_CHECKING([for MSVC merge modules directory])
5746     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5747     case "$VCVER" in
5748         160)
5749         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5750         ;;
5751     esac
5752     for f in $my_msm_files; do
5753         echo "$as_me:$LINENO: searching for $f" >&5
5754     done
5756     msmdir=
5757     for ver in 14.0 15.0; do
5758         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5759         if test -n "$regvalue"; then
5760             for f in ${my_msm_files}; do
5761                 if test -e "$regvalue/${f}"; then
5762                     msmdir=$regvalue
5763                     break
5764                 fi
5765             done
5766         fi
5767     done
5768     dnl Is the following fallback really necessary, or was it added in response
5769     dnl to never having started Visual Studio on a given machine, so the
5770     dnl registry keys checked above had presumably not yet been created?
5771     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5772     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5773     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5774     dnl expanding to "C:\Program Files\Common Files"), which would need
5775     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5776     dnl obtain its value from cygwin:
5777     if test -z "$msmdir"; then
5778         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5779         for f in ${my_msm_files}; do
5780             if test -e "$my_msm_dir/${f}"; then
5781                 msmdir=$my_msm_dir
5782             fi
5783         done
5784     fi
5786     dnl Starting from MSVC 15.0, merge modules are located in different directory
5787     case "$VCVER" in
5788     160)
5789         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5790             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5791             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5792             for f in ${my_msm_files}; do
5793                 if test -e "$my_msm_dir/${f}"; then
5794                     msmdir=$my_msm_dir
5795                     break
5796                 fi
5797             done
5798         done
5799         ;;
5800     esac
5802     if test -n "$msmdir"; then
5803         msmdir=`cygpath -m "$msmdir"`
5804         AC_MSG_RESULT([$msmdir])
5805     else
5806         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5807             AC_MSG_FAILURE([not found])
5808         else
5809             AC_MSG_WARN([not found (check config.log)])
5810             add_warning "MSM none of ${my_msm_files} found"
5811         fi
5812     fi
5815 find_msvc_x64_dlls()
5817     AC_MSG_CHECKING([for MSVC x64 DLL path])
5818     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5819     case "$VCVER" in
5820     160)
5821         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5822             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5823             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5824                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5825                 break
5826             fi
5827             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5828             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5829                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5830                 break
5831             fi
5832         done
5833         ;;
5834     esac
5835     AC_MSG_RESULT([$msvcdllpath])
5836     AC_MSG_CHECKING([for MSVC x64 DLLs])
5837     msvcdlls="msvcp140.dll vcruntime140.dll"
5838     for dll in $msvcdlls; do
5839         if ! test -f "$msvcdllpath/$dll"; then
5840             AC_MSG_FAILURE([missing $dll])
5841         fi
5842     done
5843     AC_MSG_RESULT([found all ($msvcdlls)])
5846 dnl =========================================
5847 dnl Check for the Windows  SDK.
5848 dnl =========================================
5849 if test "$_os" = "WINNT"; then
5850     AC_MSG_CHECKING([for Windows SDK])
5851     if test "$build_os" = "cygwin"; then
5852         find_winsdk
5853         WINDOWS_SDK_HOME=$winsdktest
5855         # normalize if found
5856         if test -n "$WINDOWS_SDK_HOME"; then
5857             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5858             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5859         fi
5861         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5862     fi
5864     if test -n "$WINDOWS_SDK_HOME"; then
5865         # Remove a possible trailing backslash
5866         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5868         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5869              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5870              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5871             have_windows_sdk_headers=yes
5872         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5873              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5874              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5875             have_windows_sdk_headers=yes
5876         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5877              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5878              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5879             have_windows_sdk_headers=yes
5880         else
5881             have_windows_sdk_headers=no
5882         fi
5884         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5885             have_windows_sdk_libs=yes
5886         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5887             have_windows_sdk_libs=yes
5888         else
5889             have_windows_sdk_libs=no
5890         fi
5892         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5893             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5894 the  Windows SDK are installed.])
5895         fi
5896     fi
5898     if test -z "$WINDOWS_SDK_HOME"; then
5899         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5900     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5901         WINDOWS_SDK_VERSION=80
5902         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5903     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5904         WINDOWS_SDK_VERSION=81
5905         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5906     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5907         WINDOWS_SDK_VERSION=10
5908         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5909     else
5910         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5911     fi
5912     PathFormat "$WINDOWS_SDK_HOME"
5913     WINDOWS_SDK_HOME="$formatted_path"
5914     if test "$build_os" = "cygwin"; then
5915         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5916         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5917             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5918         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5919             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5920         fi
5921     fi
5923     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5924     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5925     dnl but not in v8.0), so allow this to be overridden with a
5926     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5927     dnl and configuration error if no WiLangId.vbs is found would arguably be
5928     dnl better, but I do not know under which conditions exactly it is needed by
5929     dnl msiglobal.pm:
5930     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5931         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5932         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5933             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5934         fi
5935         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5936             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5937         fi
5938         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5939             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5940         fi
5941     fi
5942     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5943         if test -n "$with_package_format" -a "$with_package_format" != no; then
5944             for i in "$with_package_format"; do
5945                 if test "$i" = "msi"; then
5946                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5947                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5948                     fi
5949                 fi
5950             done
5951         fi
5952     fi
5954 AC_SUBST(WINDOWS_SDK_HOME)
5955 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5956 AC_SUBST(WINDOWS_SDK_VERSION)
5957 AC_SUBST(WINDOWS_SDK_WILANGID)
5959 if test "$build_os" = "cygwin"; then
5960     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5961     dnl dir, it also determines that dir's path w/o an arch segment if any,
5962     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5963     AC_MSG_CHECKING([for midl.exe])
5965     find_winsdk
5966     if test -n "$winsdkbinsubdir" \
5967         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5968     then
5969         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5970         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5971     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5972         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5973         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5974     elif test -f "$winsdktest/Bin/midl.exe"; then
5975         MIDL_PATH=$winsdktest/Bin
5976         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5977     fi
5978     if test ! -f "$MIDL_PATH/midl.exe"; then
5979         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5980     else
5981         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5982     fi
5984     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5985     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5987     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5988          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5989          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5990          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5991     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5992          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5993          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5994          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5995     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5996          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5997          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5998          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5999     else
6000         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6001     fi
6003     dnl Check csc.exe
6004     AC_MSG_CHECKING([for csc.exe])
6005     find_csc
6006     if test -f "$csctest/csc.exe"; then
6007         CSC_PATH="$csctest"
6008     fi
6009     if test ! -f "$CSC_PATH/csc.exe"; then
6010         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6011     else
6012         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6013     fi
6015     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6017     dnl Check al.exe
6018     AC_MSG_CHECKING([for al.exe])
6019     find_winsdk
6020     if test -n "$winsdkbinsubdir" \
6021         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
6022     then
6023         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
6024     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
6025         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
6026     elif test -f "$winsdktest/Bin/al.exe"; then
6027         AL_PATH="$winsdktest/Bin"
6028     fi
6030     if test -z "$AL_PATH"; then
6031         find_al
6032         if test -f "$altest/bin/al.exe"; then
6033             AL_PATH="$altest/bin"
6034         elif test -f "$altest/al.exe"; then
6035             AL_PATH="$altest"
6036         fi
6037     fi
6038     if test ! -f "$AL_PATH/al.exe"; then
6039         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6040     else
6041         AC_MSG_RESULT([$AL_PATH/al.exe])
6042     fi
6044     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6046     dnl Check mscoree.lib / .NET Framework dir
6047     AC_MSG_CHECKING(.NET Framework)
6048     find_dotnetsdk46
6049     PathFormat "$frametest"
6050     frametest="$formatted_path"
6051     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6052         DOTNET_FRAMEWORK_HOME="$frametest"
6053     else
6054         find_winsdk
6055         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6056             DOTNET_FRAMEWORK_HOME="$winsdktest"
6057         fi
6058     fi
6059     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
6060         AC_MSG_ERROR([mscoree.lib not found])
6061     fi
6062     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6064     PathFormat "$MIDL_PATH"
6065     MIDL_PATH="$formatted_path"
6067     PathFormat "$AL_PATH"
6068     AL_PATH="$formatted_path"
6070     PathFormat "$DOTNET_FRAMEWORK_HOME"
6071     DOTNET_FRAMEWORK_HOME="$formatted_path"
6073     PathFormat "$CSC_PATH"
6074     CSC_PATH="$formatted_path"
6077 dnl ===================================================================
6078 dnl Check if stdc headers are available excluding MSVC.
6079 dnl ===================================================================
6080 if test "$_os" != "WINNT"; then
6081     AC_HEADER_STDC
6084 dnl ===================================================================
6085 dnl Testing for C++ compiler and version...
6086 dnl ===================================================================
6088 if test "$_os" != "WINNT"; then
6089     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6090     save_CXXFLAGS=$CXXFLAGS
6091     AC_PROG_CXX
6092     CXXFLAGS=$save_CXXFLAGS
6093     if test -z "$CXX_BASE"; then
6094         CXX_BASE=`first_arg_basename "$CXX"`
6095     fi
6098 dnl check for GNU C++ compiler version
6099 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6100     AC_MSG_CHECKING([the GNU C++ compiler version])
6102     _gpp_version=`$CXX -dumpversion`
6103     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6105     if test "$_gpp_majmin" -lt "700"; then
6106         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6107     else
6108         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6109     fi
6111     dnl see https://code.google.com/p/android/issues/detail?id=41770
6112         glibcxx_threads=no
6113         AC_LANG_PUSH([C++])
6114         AC_REQUIRE_CPP
6115         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6116         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6117             #include <bits/c++config.h>]],[[
6118             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6119             && !defined(_GLIBCXX__PTHREADS) \
6120             && !defined(_GLIBCXX_HAS_GTHREADS)
6121             choke me
6122             #endif
6123         ]])],[AC_MSG_RESULT([yes])
6124         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6125         AC_LANG_POP([C++])
6126         if test $glibcxx_threads = yes; then
6127             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6128         fi
6130 AC_SUBST(BOOST_CXXFLAGS)
6133 # prefx CXX with ccache if needed
6135 if test "$CCACHE" != ""; then
6136     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6137     AC_LANG_PUSH([C++])
6138     save_CXXFLAGS=$CXXFLAGS
6139     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6140     dnl an empty program will do, we're checking the compiler flags
6141     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6142                       [use_ccache=yes], [use_ccache=no])
6143     if test $use_ccache = yes; then
6144         AC_MSG_RESULT([yes])
6145     else
6146         CXX="$CCACHE $CXX"
6147         CXX_BASE="ccache $CXX_BASE"
6148         AC_MSG_RESULT([no])
6149     fi
6150     CXXFLAGS=$save_CXXFLAGS
6151     AC_LANG_POP([C++])
6154 dnl ===================================================================
6155 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6156 dnl ===================================================================
6158 if test "$_os" != "WINNT"; then
6159     AC_PROG_CXXCPP
6161     dnl Check whether there's a C pre-processor.
6162     AC_PROG_CPP
6166 dnl ===================================================================
6167 dnl Find integral type sizes and alignments
6168 dnl ===================================================================
6170 if test "$_os" != "WINNT"; then
6172 if test "$_os" = "iOS"; then
6173     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6174     ac_cv_sizeof_long=8
6175     ac_cv_sizeof_short=2
6176     ac_cv_sizeof_int=4
6177     ac_cv_sizeof_long_long=8
6178     ac_cv_sizeof_double=8
6179     ac_cv_sizeof_voidp=8
6180 else
6181     AC_CHECK_SIZEOF(long)
6182     AC_CHECK_SIZEOF(short)
6183     AC_CHECK_SIZEOF(int)
6184     AC_CHECK_SIZEOF(long long)
6185     AC_CHECK_SIZEOF(double)
6186     AC_CHECK_SIZEOF(void*)
6189     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6190     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6191     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6192     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6193     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6195     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6196     m4_pattern_allow([AC_CHECK_ALIGNOF])
6197     m4_ifdef([AC_CHECK_ALIGNOF],
6198         [
6199             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6200             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6201             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6202             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6203         ],
6204         [
6205             case "$_os-$host_cpu" in
6206             Linux-i686)
6207                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6208                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6209                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6210                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6211                 ;;
6212             Linux-x86_64)
6213                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6214                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6215                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6216                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6217                 ;;
6218             *)
6219                 if test -z "$ac_cv_alignof_short" -o \
6220                         -z "$ac_cv_alignof_int" -o \
6221                         -z "$ac_cv_alignof_long" -o \
6222                         -z "$ac_cv_alignof_double"; then
6223                    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.])
6224                 fi
6225                 ;;
6226             esac
6227         ])
6229     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6230     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6231     if test $ac_cv_sizeof_long -eq 8; then
6232         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6233     elif test $ac_cv_sizeof_double -eq 8; then
6234         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6235     else
6236         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6237     fi
6239     dnl Check for large file support
6240     AC_SYS_LARGEFILE
6241     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6242         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6243     fi
6244     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6245         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6246     fi
6247 else
6248     # Hardcode for MSVC
6249     SAL_TYPES_SIZEOFSHORT=2
6250     SAL_TYPES_SIZEOFINT=4
6251     SAL_TYPES_SIZEOFLONG=4
6252     SAL_TYPES_SIZEOFLONGLONG=8
6253     if test "$BITNESS_OVERRIDE" = ""; then
6254         SAL_TYPES_SIZEOFPOINTER=4
6255     else
6256         SAL_TYPES_SIZEOFPOINTER=8
6257     fi
6258     SAL_TYPES_ALIGNMENT2=2
6259     SAL_TYPES_ALIGNMENT4=4
6260     SAL_TYPES_ALIGNMENT8=8
6261     LFS_CFLAGS=''
6263 AC_SUBST(LFS_CFLAGS)
6265 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6266 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6267 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6268 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6269 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6270 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6271 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6272 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6274 dnl ===================================================================
6275 dnl Check whether to enable runtime optimizations
6276 dnl ===================================================================
6277 ENABLE_RUNTIME_OPTIMIZATIONS=
6278 AC_MSG_CHECKING([whether to enable runtime optimizations])
6279 if test -z "$enable_runtime_optimizations"; then
6280     for i in $CC; do
6281         case $i in
6282         -fsanitize=*)
6283             enable_runtime_optimizations=no
6284             break
6285             ;;
6286         esac
6287     done
6289 if test "$enable_runtime_optimizations" != no; then
6290     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6291     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6292     AC_MSG_RESULT([yes])
6293 else
6294     AC_MSG_RESULT([no])
6296 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6298 dnl ===================================================================
6299 dnl Check if valgrind headers are available
6300 dnl ===================================================================
6301 ENABLE_VALGRIND=
6302 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6303     prev_cppflags=$CPPFLAGS
6304     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6305     # or where does it come from?
6306     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6307     AC_CHECK_HEADER([valgrind/valgrind.h],
6308         [ENABLE_VALGRIND=TRUE])
6309     CPPFLAGS=$prev_cppflags
6311 AC_SUBST([ENABLE_VALGRIND])
6312 if test -z "$ENABLE_VALGRIND"; then
6313     if test "$with_valgrind" = yes; then
6314         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6315     fi
6316     VALGRIND_CFLAGS=
6318 AC_SUBST([VALGRIND_CFLAGS])
6321 dnl ===================================================================
6322 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6323 dnl ===================================================================
6325 # We need at least the sys/sdt.h include header.
6326 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6327 if test "$SDT_H_FOUND" = "TRUE"; then
6328     # Found sys/sdt.h header, now make sure the c++ compiler works.
6329     # Old g++ versions had problems with probes in constructors/destructors.
6330     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6331     AC_LANG_PUSH([C++])
6332     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6333     #include <sys/sdt.h>
6334     class ProbeClass
6335     {
6336     private:
6337       int& ref;
6338       const char *name;
6340     public:
6341       ProbeClass(int& v, const char *n) : ref(v), name(n)
6342       {
6343         DTRACE_PROBE2(_test_, cons, name, ref);
6344       }
6346       void method(int min)
6347       {
6348         DTRACE_PROBE3(_test_, meth, name, ref, min);
6349         ref -= min;
6350       }
6352       ~ProbeClass()
6353       {
6354         DTRACE_PROBE2(_test_, dest, name, ref);
6355       }
6356     };
6357     ]],[[
6358     int i = 64;
6359     DTRACE_PROBE1(_test_, call, i);
6360     ProbeClass inst = ProbeClass(i, "call");
6361     inst.method(24);
6362     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6363           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6364     AC_LANG_POP([C++])
6366 AC_CONFIG_HEADERS([config_host/config_probes.h])
6368 dnl ===================================================================
6369 dnl GCC features
6370 dnl ===================================================================
6371 HAVE_GCC_STACK_CLASH_PROTECTION=
6372 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6373     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6374     save_CFLAGS=$CFLAGS
6375     CFLAGS="$CFLAGS -fstack-clash-protection"
6376     AC_LINK_IFELSE(
6377         [AC_LANG_PROGRAM(, [[return 0;]])],
6378         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6379         [AC_MSG_RESULT([no])])
6380     CFLAGS=$save_CFLAGS
6382     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6383     save_CFLAGS=$CFLAGS
6384     CFLAGS="$CFLAGS -Werror -mno-avx"
6385     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6386     CFLAGS=$save_CFLAGS
6387     if test "$HAVE_GCC_AVX" = "TRUE"; then
6388         AC_MSG_RESULT([yes])
6389     else
6390         AC_MSG_RESULT([no])
6391     fi
6393     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6394     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6395     int v = 0;
6396     if (__sync_add_and_fetch(&v, 1) != 1 ||
6397         __sync_sub_and_fetch(&v, 1) != 0)
6398         return 1;
6399     __sync_synchronize();
6400     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6401         v != 1)
6402         return 1;
6403     return 0;
6404 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6405     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6406         AC_MSG_RESULT([yes])
6407         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6408     else
6409         AC_MSG_RESULT([no])
6410     fi
6412     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6413     AC_LANG_PUSH([C++])
6414     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6415             #include <cstddef>
6416             #include <cxxabi.h>
6417             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6418         ])], [
6419             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6420             AC_MSG_RESULT([yes])
6421         ], [AC_MSG_RESULT([no])])
6422     AC_LANG_POP([C++])
6424     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6425     AC_LANG_PUSH([C++])
6426     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6427             #include <cstddef>
6428             #include <cxxabi.h>
6429             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6430         ])], [
6431             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6432             AC_MSG_RESULT([yes])
6433         ], [AC_MSG_RESULT([no])])
6434     AC_LANG_POP([C++])
6436     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6437     AC_LANG_PUSH([C++])
6438     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6439             #include <cxxabi.h>
6440             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6441         ])], [
6442             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6443             AC_MSG_RESULT([yes])
6444         ], [AC_MSG_RESULT([no])])
6445     AC_LANG_POP([C++])
6447     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6448     AC_LANG_PUSH([C++])
6449     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6450             #include <cstddef>
6451             #include <cxxabi.h>
6452             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6453         ])], [
6454             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6455             AC_MSG_RESULT([yes])
6456         ], [AC_MSG_RESULT([no])])
6457     AC_LANG_POP([C++])
6459     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6460     AC_LANG_PUSH([C++])
6461     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6462             #include <cstddef>
6463             #include <cxxabi.h>
6464             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6465         ])], [
6466             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6467             AC_MSG_RESULT([yes])
6468         ], [AC_MSG_RESULT([no])])
6469     AC_LANG_POP([C++])
6471     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6472     AC_LANG_PUSH([C++])
6473     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6474             #include <cxxabi.h>
6475             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6476         ])], [
6477             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6478             AC_MSG_RESULT([yes])
6479         ], [AC_MSG_RESULT([no])])
6480     AC_LANG_POP([C++])
6482     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6483     AC_LANG_PUSH([C++])
6484     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6485             #include <cxxabi.h>
6486             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6487         ])], [
6488             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6489             AC_MSG_RESULT([yes])
6490         ], [AC_MSG_RESULT([no])])
6491     AC_LANG_POP([C++])
6493     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6494     AC_LANG_PUSH([C++])
6495     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6496             #include <cxxabi.h>
6497             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6498         ])], [
6499             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6500             AC_MSG_RESULT([yes])
6501         ], [AC_MSG_RESULT([no])])
6502     AC_LANG_POP([C++])
6504     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6505     AC_LANG_PUSH([C++])
6506     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6507             #include <cstddef>
6508             #include <cxxabi.h>
6509             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6510         ])], [
6511             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6512             AC_MSG_RESULT([yes])
6513         ], [AC_MSG_RESULT([no])])
6514     AC_LANG_POP([C++])
6516     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6517     AC_LANG_PUSH([C++])
6518     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6519             #include <cstddef>
6520             #include <cxxabi.h>
6521             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6522         ])], [
6523             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6524             AC_MSG_RESULT([yes])
6525         ], [AC_MSG_RESULT([no])])
6526     AC_LANG_POP([C++])
6528     dnl Available in GCC 4.9 and at least since Clang 3.4; this check can eventually be removed
6529     dnl completely (e.g., after libreoffice-6-5 branch off):
6530     AC_MSG_CHECKING([that $CXX_BASE supports __attribute__((warn_unused))])
6531     AC_LANG_PUSH([C++])
6532     save_CXXFLAGS=$CXXFLAGS
6533     CXXFLAGS="$CXXFLAGS -Werror"
6534     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6535             struct __attribute__((warn_unused)) dummy {};
6536         ])], [
6537             AC_MSG_RESULT([yes])
6538         ], [AC_MSG_ERROR([no])])
6539     CXXFLAGS=$save_CXXFLAGS
6540 AC_LANG_POP([C++])
6543 AC_SUBST(HAVE_GCC_AVX)
6544 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6545 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6547 dnl ===================================================================
6548 dnl Identify the C++ library
6549 dnl ===================================================================
6551 AC_MSG_CHECKING([what the C++ library is])
6552 AC_LANG_PUSH([C++])
6553 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6554 #include <utility>
6555 #ifndef __GLIBCXX__
6556 foo bar
6557 #endif
6558 ]])],
6559     [CPP_LIBRARY=GLIBCXX
6560      cpp_library_name="GNU libstdc++"
6561     ],
6562     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6563 #include <utility>
6564 #ifndef _LIBCPP_VERSION
6565 foo bar
6566 #endif
6567 ]])],
6568     [CPP_LIBRARY=LIBCPP
6569      cpp_library_name="LLVM libc++"
6570      AC_DEFINE([HAVE_LIBCXX])
6571     ],
6572     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6573 #include <utility>
6574 #ifndef _MSC_VER
6575 foo bar
6576 #endif
6577 ]])],
6578     [CPP_LIBRARY=MSVCRT
6579      cpp_library_name="Microsoft"
6580     ],
6581     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6582 AC_MSG_RESULT([$cpp_library_name])
6583 AC_LANG_POP([C++])
6585 dnl ===================================================================
6586 dnl Check for gperf
6587 dnl ===================================================================
6588 AC_PATH_PROG(GPERF, gperf)
6589 if test -z "$GPERF"; then
6590     AC_MSG_ERROR([gperf not found but needed. Install it.])
6592 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6593     GPERF=`cygpath -m $GPERF`
6595 AC_MSG_CHECKING([whether gperf is new enough])
6596 my_gperf_ver1=$($GPERF --version | head -n 1)
6597 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6598 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6599 if test "$my_gperf_ver3" -ge 301; then
6600     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6601 else
6602     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6604 AC_SUBST(GPERF)
6606 dnl ===================================================================
6607 dnl Check for system libcmis
6608 dnl ===================================================================
6609 # libcmis requires curl and we can't build curl for iOS
6610 if test $_os != iOS; then
6611     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6612     ENABLE_LIBCMIS=TRUE
6613 else
6614     ENABLE_LIBCMIS=
6616 AC_SUBST(ENABLE_LIBCMIS)
6618 dnl ===================================================================
6619 dnl C++11
6620 dnl ===================================================================
6622 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6623 CXXFLAGS_CXX11=
6624 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6625     if test "$with_latest_c__" = yes; then
6626         CXXFLAGS_CXX11=-std:c++latest
6627     else
6628         CXXFLAGS_CXX11=-std:c++17
6629     fi
6630     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6631 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6632     my_flags='-std=c++17 -std=c++1z'
6633     if test "$with_latest_c__" = yes; then
6634         my_flags="-std=c++20 -std=c++2a $my_flags"
6635     fi
6636     for flag in $my_flags; do
6637         if test "$COM" = MSC; then
6638             flag="-Xclang $flag"
6639         fi
6640         save_CXXFLAGS=$CXXFLAGS
6641         CXXFLAGS="$CXXFLAGS $flag -Werror"
6642         if test "$SYSTEM_LIBCMIS" = TRUE; then
6643             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6644         fi
6645         AC_LANG_PUSH([C++])
6646         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6647             #include <algorithm>
6648             #include <functional>
6649             #include <vector>
6651             #if defined SYSTEM_LIBCMIS
6652             // See ucb/source/ucp/cmis/auth_provider.hxx:
6653             #if !defined __clang__
6654             #pragma GCC diagnostic push
6655             #pragma GCC diagnostic ignored "-Wdeprecated"
6656             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6657             #endif
6658             #include <libcmis/libcmis.hxx>
6659             #if !defined __clang__
6660             #pragma GCC diagnostic pop
6661             #endif
6662             #endif
6664             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6665                 std::sort(v.begin(), v.end(), fn);
6666             }
6667             ]])],[CXXFLAGS_CXX11=$flag])
6668         AC_LANG_POP([C++])
6669         CXXFLAGS=$save_CXXFLAGS
6670         if test -n "$CXXFLAGS_CXX11"; then
6671             break
6672         fi
6673     done
6675 if test -n "$CXXFLAGS_CXX11"; then
6676     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6677 else
6678     AC_MSG_ERROR(no)
6680 AC_SUBST(CXXFLAGS_CXX11)
6682 if test "$GCC" = "yes"; then
6683     save_CXXFLAGS=$CXXFLAGS
6684     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6685     CHECK_L_ATOMIC
6686     CXXFLAGS=$save_CXXFLAGS
6687     AC_SUBST(ATOMIC_LIB)
6690 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6691 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6692 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6693 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6694 dnl again towards 4.7.2:
6695 if test $CPP_LIBRARY = GLIBCXX; then
6696     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6697     AC_LANG_PUSH([C++])
6698     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6699 #include <list>
6700 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6701     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6702     //   GCC 4.7.0: 20120322
6703     //   GCC 4.7.1: 20120614
6704     // and using a range check is not possible as the mapping between
6705     // __GLIBCXX__ values and GCC versions is not monotonic
6706 /* ok */
6707 #else
6708 abi broken
6709 #endif
6710         ]])], [AC_MSG_RESULT(no, ok)],
6711         [AC_MSG_ERROR(yes)])
6712     AC_LANG_POP([C++])
6715 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6716 save_CXXFLAGS=$CXXFLAGS
6717 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6718 AC_LANG_PUSH([C++])
6720 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6721 #include <stddef.h>
6723 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6725 namespace
6727         struct b
6728         {
6729                 int i;
6730                 int j;
6731         };
6733 ]], [[
6734 struct a
6736         int i;
6737         int j;
6739 a thinga[]={{0,0}, {1,1}};
6740 b thingb[]={{0,0}, {1,1}};
6741 size_t i = sizeof(sal_n_array_size(thinga));
6742 size_t j = sizeof(sal_n_array_size(thingb));
6743 return !(i != 0 && j != 0);
6745     ], [ AC_MSG_RESULT(yes) ],
6746     [ AC_MSG_ERROR(no)])
6747 AC_LANG_POP([C++])
6748 CXXFLAGS=$save_CXXFLAGS
6750 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6751 if test "$GCC" = yes; then
6752     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6753     AC_LANG_PUSH([C++])
6754     save_CXXFLAGS=$CXXFLAGS
6755     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6756     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6757     CXXFLAGS=$save_CXXFLAGS
6758     AC_LANG_POP([C++])
6759     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6760         AC_MSG_RESULT([yes])
6761     else
6762         AC_MSG_RESULT([no])
6763     fi
6765 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6767 dnl This check can eventually be removed completely (e.g., after libreoffice-7-0 branch off):
6768 AC_MSG_CHECKING([that $CXX_BASE supports guaranteed copy elision])
6769 AC_LANG_PUSH([C++])
6770 save_CXXFLAGS=$CXXFLAGS
6771 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6772 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6773         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6774         // supporting it:
6775         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6776         struct S {
6777         private:
6778             S(S const &);
6779         public:
6780             S();
6781             ~S();
6782         };
6783         S copy();
6784         void f() { S c(copy()); }
6785         #endif
6786     ])], [AC_MSG_RESULT([yes])
6787     ], [AC_MSG_ERROR([no])])
6788 CXXFLAGS=$save_CXXFLAGS
6789 AC_LANG_POP([C++])
6791 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6792 AC_LANG_PUSH([C++])
6793 save_CXXFLAGS=$CXXFLAGS
6794 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6795 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6796         #include <algorithm>
6797         #include <initializer_list>
6798         #include <vector>
6799         template<typename T> class S {
6800         private:
6801             std::vector<T> v_;
6802         public:
6803             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6804         };
6805         constinit S<int> s{3, 2, 1};
6806     ])], [
6807         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6808         AC_MSG_RESULT([yes])
6809     ], [AC_MSG_RESULT([no])])
6810 CXXFLAGS=$save_CXXFLAGS
6811 AC_LANG_POP([C++])
6813 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6814 AC_LANG_PUSH([C++])
6815 save_CXXFLAGS=$CXXFLAGS
6816 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6817 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6818         #include <span>
6819         #include <type_traits>
6820         // Don't check size_type directly, as it was called index_type before P1872R0:
6821         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6822     ])], [
6823         AC_DEFINE([HAVE_CPP_SPAN],[1])
6824         AC_MSG_RESULT([yes])
6825     ], [AC_MSG_RESULT([no])])
6826 CXXFLAGS=$save_CXXFLAGS
6827 AC_LANG_POP([C++])
6829 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
6830 AC_LANG_PUSH([C++])
6831 save_CXXFLAGS=$CXXFLAGS
6832 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6833 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6834         struct S1 { S1(S1 &&); };
6835         struct S2: S1 {};
6836         S1 f(S2 s) { return s; }
6837     ])], [
6838         AC_DEFINE([HAVE_P1155R3],[1])
6839         AC_MSG_RESULT([yes])
6840     ], [AC_MSG_RESULT([no])])
6841 CXXFLAGS=$save_CXXFLAGS
6842 AC_LANG_POP([C++])
6844 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
6845 dnl which is included in -Wextra anyway):
6846 HAVE_WDEPRECATED_COPY_DTOR=
6847 if test "$GCC" = yes; then
6848     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
6849     AC_LANG_PUSH([C++])
6850     save_CXXFLAGS=$CXXFLAGS
6851     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
6852     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
6853             HAVE_WDEPRECATED_COPY_DTOR=TRUE
6854             AC_MSG_RESULT([yes])
6855         ], [AC_MSG_RESULT([no])])
6856     CXXFLAGS=$save_CXXFLAGS
6857     AC_LANG_POP([C++])
6859 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
6861 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6862 dnl uninitialized warning for code like
6864 dnl   OString f();
6865 dnl   boost::optional<OString> * g(bool b) {
6866 dnl       boost::optional<OString> o;
6867 dnl       if (b) o = f();
6868 dnl       return new boost::optional<OString>(o);
6869 dnl   }
6871 dnl (as is e.g. present, in a slightly more elaborate form, in
6872 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6873 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6874 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6875 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6876     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6877     AC_LANG_PUSH([C++])
6878     save_CXXFLAGS=$CXXFLAGS
6879     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6880     if test "$ENABLE_OPTIMIZED" = TRUE; then
6881         CXXFLAGS="$CXXFLAGS -O2"
6882     else
6883         CXXFLAGS="$CXXFLAGS -O0"
6884     fi
6885     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6886             #include <new>
6887             void f1(int);
6888             struct S1 {
6889                 ~S1() { f1(n); }
6890                 int n = 0;
6891             };
6892             struct S2 {
6893                 S2() {}
6894                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6895                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6896                 void set(S1 s) {
6897                     new (stg) S1(s);
6898                     init = true;
6899                 }
6900                 bool init = false;
6901                 char stg[sizeof (S1)];
6902             } ;
6903             S1 f2();
6904             S2 * f3(bool b) {
6905                 S2 o;
6906                 if (b) o.set(f2());
6907                 return new S2(o);
6908             }
6909         ]])], [AC_MSG_RESULT([no])], [
6910             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6911             AC_MSG_RESULT([yes])
6912         ])
6913     CXXFLAGS=$save_CXXFLAGS
6914     AC_LANG_POP([C++])
6916 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6918 dnl ===================================================================
6919 dnl CPU Intrinsics support - SSE, AVX
6920 dnl ===================================================================
6922 CXXFLAGS_INTRINSICS_SSE2=
6923 CXXFLAGS_INTRINSICS_SSSE3=
6924 CXXFLAGS_INTRINSICS_SSE41=
6925 CXXFLAGS_INTRINSICS_SSE42=
6926 CXXFLAGS_INTRINSICS_AVX=
6927 CXXFLAGS_INTRINSICS_AVX2=
6928 CXXFLAGS_INTRINSICS_AVX512=
6929 CXXFLAGS_INTRINSICS_F16C=
6930 CXXFLAGS_INTRINSICS_FMA=
6932 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6933     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
6934     flag_sse2=-msse2
6935     flag_ssse3=-mssse3
6936     flag_sse41=-msse4.1
6937     flag_sse42=-msse4.2
6938     flag_avx=-mavx
6939     flag_avx2=-mavx2
6940     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
6941     flag_f16c=-mf16c
6942     flag_fma=-mfma
6943 else
6944     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
6945     # MSVC seems to differentiate only between SSE and SSE2, where in fact
6946     # SSE2 seems to be SSE2+.
6947     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
6948     # is not empty (and can be tested in gbuild).
6949     flag_sse2=-arch:SSE2
6950     flag_ssse3=-arch:SSE2
6951     flag_sse41=-arch:SSE2
6952     flag_sse42=-arch:SSE2
6953     flag_avx=-arch:AVX
6954     flag_avx2=-arch:AVX2
6955     flag_avx512=-arch:AVX512
6956     # These are part of -arch:AVX2
6957     flag_f16c=-arch:AVX2
6958     flag_fma=-arch:AVX2
6961 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6962 AC_LANG_PUSH([C++])
6963 save_CXXFLAGS=$CXXFLAGS
6964 CXXFLAGS="$CXXFLAGS $flag_sse2"
6965 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6966     #include <emmintrin.h>
6967     int main () {
6968         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6969         c = _mm_xor_si128 (a, b);
6970         return 0;
6971     }
6972     ])],
6973     [can_compile_sse2=yes],
6974     [can_compile_sse2=no])
6975 AC_LANG_POP([C++])
6976 CXXFLAGS=$save_CXXFLAGS
6977 AC_MSG_RESULT([${can_compile_sse2}])
6978 if test "${can_compile_sse2}" = "yes" ; then
6979     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
6982 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6983 AC_LANG_PUSH([C++])
6984 save_CXXFLAGS=$CXXFLAGS
6985 CXXFLAGS="$CXXFLAGS $flag_ssse3"
6986 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6987     #include <tmmintrin.h>
6988     int main () {
6989         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6990         c = _mm_maddubs_epi16 (a, b);
6991         return 0;
6992     }
6993     ])],
6994     [can_compile_ssse3=yes],
6995     [can_compile_ssse3=no])
6996 AC_LANG_POP([C++])
6997 CXXFLAGS=$save_CXXFLAGS
6998 AC_MSG_RESULT([${can_compile_ssse3}])
6999 if test "${can_compile_ssse3}" = "yes" ; then
7000     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7003 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7004 AC_LANG_PUSH([C++])
7005 save_CXXFLAGS=$CXXFLAGS
7006 CXXFLAGS="$CXXFLAGS $flag_sse41"
7007 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7008     #include <smmintrin.h>
7009     int main () {
7010         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7011         c = _mm_cmpeq_epi64 (a, b);
7012         return 0;
7013     }
7014     ])],
7015     [can_compile_sse41=yes],
7016     [can_compile_sse41=no])
7017 AC_LANG_POP([C++])
7018 CXXFLAGS=$save_CXXFLAGS
7019 AC_MSG_RESULT([${can_compile_sse41}])
7020 if test "${can_compile_sse41}" = "yes" ; then
7021     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7024 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7025 AC_LANG_PUSH([C++])
7026 save_CXXFLAGS=$CXXFLAGS
7027 CXXFLAGS="$CXXFLAGS $flag_sse42"
7028 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7029     #include <nmmintrin.h>
7030     int main () {
7031         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7032         c = _mm_cmpgt_epi64 (a, b);
7033         return 0;
7034     }
7035     ])],
7036     [can_compile_sse42=yes],
7037     [can_compile_sse42=no])
7038 AC_LANG_POP([C++])
7039 CXXFLAGS=$save_CXXFLAGS
7040 AC_MSG_RESULT([${can_compile_sse42}])
7041 if test "${can_compile_sse42}" = "yes" ; then
7042     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7045 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7046 AC_LANG_PUSH([C++])
7047 save_CXXFLAGS=$CXXFLAGS
7048 CXXFLAGS="$CXXFLAGS $flag_avx"
7049 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7050     #include <immintrin.h>
7051     int main () {
7052         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7053         c = _mm256_xor_ps(a, b);
7054         return 0;
7055     }
7056     ])],
7057     [can_compile_avx=yes],
7058     [can_compile_avx=no])
7059 AC_LANG_POP([C++])
7060 CXXFLAGS=$save_CXXFLAGS
7061 AC_MSG_RESULT([${can_compile_avx}])
7062 if test "${can_compile_avx}" = "yes" ; then
7063     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7066 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7067 AC_LANG_PUSH([C++])
7068 save_CXXFLAGS=$CXXFLAGS
7069 CXXFLAGS="$CXXFLAGS $flag_avx2"
7070 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7071     #include <immintrin.h>
7072     int main () {
7073         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7074         c = _mm256_maddubs_epi16(a, b);
7075         return 0;
7076     }
7077     ])],
7078     [can_compile_avx2=yes],
7079     [can_compile_avx2=no])
7080 AC_LANG_POP([C++])
7081 CXXFLAGS=$save_CXXFLAGS
7082 AC_MSG_RESULT([${can_compile_avx2}])
7083 if test "${can_compile_avx2}" = "yes" ; then
7084     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7087 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7088 AC_LANG_PUSH([C++])
7089 save_CXXFLAGS=$CXXFLAGS
7090 CXXFLAGS="$CXXFLAGS $flag_avx512"
7091 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7092     #include <immintrin.h>
7093     int main () {
7094         __m512i a = _mm512_loadu_si512(0);
7095         return 0;
7096     }
7097     ])],
7098     [can_compile_avx512=yes],
7099     [can_compile_avx512=no])
7100 AC_LANG_POP([C++])
7101 CXXFLAGS=$save_CXXFLAGS
7102 AC_MSG_RESULT([${can_compile_avx512}])
7103 if test "${can_compile_avx512}" = "yes" ; then
7104     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7107 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7108 AC_LANG_PUSH([C++])
7109 save_CXXFLAGS=$CXXFLAGS
7110 CXXFLAGS="$CXXFLAGS $flag_f16c"
7111 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7112     #include <immintrin.h>
7113     int main () {
7114         __m128i a = _mm_set1_epi32 (0);
7115         __m128 c;
7116         c = _mm_cvtph_ps(a);
7117         return 0;
7118     }
7119     ])],
7120     [can_compile_f16c=yes],
7121     [can_compile_f16c=no])
7122 AC_LANG_POP([C++])
7123 CXXFLAGS=$save_CXXFLAGS
7124 AC_MSG_RESULT([${can_compile_f16c}])
7125 if test "${can_compile_f16c}" = "yes" ; then
7126     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7129 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7130 AC_LANG_PUSH([C++])
7131 save_CXXFLAGS=$CXXFLAGS
7132 CXXFLAGS="$CXXFLAGS $flag_fma"
7133 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7134     #include <immintrin.h>
7135     int main () {
7136         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7137         d = _mm256_fmadd_ps(a, b, c);
7138         return 0;
7139     }
7140     ])],
7141     [can_compile_fma=yes],
7142     [can_compile_fma=no])
7143 AC_LANG_POP([C++])
7144 CXXFLAGS=$save_CXXFLAGS
7145 AC_MSG_RESULT([${can_compile_fma}])
7146 if test "${can_compile_fma}" = "yes" ; then
7147     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7150 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7151 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7152 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7153 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7154 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7155 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7156 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7157 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7158 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7160 dnl ===================================================================
7161 dnl system stl sanity tests
7162 dnl ===================================================================
7163 if test "$_os" != "WINNT"; then
7165     AC_LANG_PUSH([C++])
7167     save_CPPFLAGS="$CPPFLAGS"
7168     if test -n "$MACOSX_SDK_PATH"; then
7169         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7170     fi
7172     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7173     # only.
7174     if test "$CPP_LIBRARY" = GLIBCXX; then
7175         dnl gcc#19664, gcc#22482, rhbz#162935
7176         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7177         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7178         AC_MSG_RESULT([$stlvisok])
7179         if test "$stlvisok" = "no"; then
7180             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7181         fi
7182     fi
7184     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7185     # when we don't make any dynamic libraries?
7186     if test "$DISABLE_DYNLOADING" = ""; then
7187         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7188         cat > conftestlib1.cc <<_ACEOF
7189 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7190 struct S2: S1<int> { virtual ~S2(); };
7191 S2::~S2() {}
7192 _ACEOF
7193         cat > conftestlib2.cc <<_ACEOF
7194 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7195 struct S2: S1<int> { virtual ~S2(); };
7196 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7197 _ACEOF
7198         gccvisinlineshiddenok=yes
7199         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7200             gccvisinlineshiddenok=no
7201         else
7202             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7203             dnl known to not work with -z defs (unsetting which makes the test
7204             dnl moot, though):
7205             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7206             if test "$COM_IS_CLANG" = TRUE; then
7207                 for i in $CXX $CXXFLAGS; do
7208                     case $i in
7209                     -fsanitize=*)
7210                         my_linkflagsnoundefs=
7211                         break
7212                         ;;
7213                     esac
7214                 done
7215             fi
7216             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7217                 gccvisinlineshiddenok=no
7218             fi
7219         fi
7221         rm -fr libconftest*
7222         AC_MSG_RESULT([$gccvisinlineshiddenok])
7223         if test "$gccvisinlineshiddenok" = "no"; then
7224             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7225         fi
7226     fi
7228    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7229     cat >visibility.cxx <<_ACEOF
7230 #pragma GCC visibility push(hidden)
7231 struct __attribute__ ((visibility ("default"))) TestStruct {
7232   static void Init();
7234 __attribute__ ((visibility ("default"))) void TestFunc() {
7235   TestStruct::Init();
7237 _ACEOF
7238     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7239         gccvisbroken=yes
7240     else
7241         case "$host_cpu" in
7242         i?86|x86_64)
7243             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7244                 gccvisbroken=no
7245             else
7246                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7247                     gccvisbroken=no
7248                 else
7249                     gccvisbroken=yes
7250                 fi
7251             fi
7252             ;;
7253         *)
7254             gccvisbroken=no
7255             ;;
7256         esac
7257     fi
7258     rm -f visibility.s visibility.cxx
7260     AC_MSG_RESULT([$gccvisbroken])
7261     if test "$gccvisbroken" = "yes"; then
7262         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7263     fi
7265     CPPFLAGS="$save_CPPFLAGS"
7267     AC_LANG_POP([C++])
7270 dnl ===================================================================
7271 dnl  Clang++ tests
7272 dnl ===================================================================
7274 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7275 if test "$GCC" = "yes"; then
7276     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7277     AC_LANG_PUSH([C++])
7278     save_CXXFLAGS=$CXXFLAGS
7279     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7280     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7281     CXXFLAGS=$save_CXXFLAGS
7282     AC_LANG_POP([C++])
7283     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7284         AC_MSG_RESULT([yes])
7285     else
7286         AC_MSG_RESULT([no])
7287     fi
7289 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7291 dnl ===================================================================
7292 dnl Compiler plugins
7293 dnl ===================================================================
7295 COMPILER_PLUGINS=
7296 # currently only Clang
7298 if test "$COM_IS_CLANG" != "TRUE"; then
7299     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7300         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7301         enable_compiler_plugins=no
7302     fi
7305 COMPILER_PLUGINS_COM_IS_CLANG=
7306 if test "$COM_IS_CLANG" = "TRUE"; then
7307     if test -n "$enable_compiler_plugins"; then
7308         compiler_plugins="$enable_compiler_plugins"
7309     elif test -n "$ENABLE_DBGUTIL"; then
7310         compiler_plugins=test
7311     else
7312         compiler_plugins=no
7313     fi
7314     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7315         if test "$CLANGVER" -lt 50002; then
7316             if test "$compiler_plugins" = yes; then
7317                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7318             else
7319                 compiler_plugins=no
7320             fi
7321         fi
7322     fi
7323     if test "$compiler_plugins" != "no"; then
7324         dnl The prefix where Clang resides, override to where Clang resides if
7325         dnl using a source build:
7326         if test -z "$CLANGDIR"; then
7327             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | head -n 1)))))
7328         fi
7329         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7330         if test -z "$COMPILER_PLUGINS_CXX"; then
7331             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7332         fi
7333         clangbindir=$CLANGDIR/bin
7334         if test "$build_os" = "cygwin"; then
7335             clangbindir=$(cygpath -u "$clangbindir")
7336         fi
7337         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7338         if test -n "$LLVM_CONFIG"; then
7339             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7340             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7341             if test -z "$CLANGLIBDIR"; then
7342                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7343             fi
7344             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7345             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7346             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7347             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7348                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7349             fi
7350             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7351             clangobjdir=$($LLVM_CONFIG --obj-root)
7352             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7353                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7354             fi
7355         fi
7356         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7357         AC_LANG_PUSH([C++])
7358         save_CXX=$CXX
7359         save_CXXCPP=$CXXCPP
7360         save_CPPFLAGS=$CPPFLAGS
7361         save_CXXFLAGS=$CXXFLAGS
7362         save_LDFLAGS=$LDFLAGS
7363         save_LIBS=$LIBS
7364         CXX=$COMPILER_PLUGINS_CXX
7365         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7366         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7367         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7368         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7369             [COMPILER_PLUGINS=TRUE],
7370             [
7371             if test "$compiler_plugins" = "yes"; then
7372                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7373             else
7374                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7375                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7376             fi
7377             ])
7378         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7379         dnl comment in compilerplugins/Makefile-clang.mk:
7380         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7381             LDFLAGS=""
7382             AC_MSG_CHECKING([for clang libraries to use])
7383             if test -z "$CLANGTOOLLIBS"; then
7384                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7385  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7386                 AC_LINK_IFELSE([
7387                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7388                         [[ clang::FullSourceLoc().dump(); ]])
7389                 ],[CLANGTOOLLIBS="$LIBS"],[])
7390             fi
7391             if test -z "$CLANGTOOLLIBS"; then
7392                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7393                 AC_LINK_IFELSE([
7394                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7395                         [[ clang::FullSourceLoc().dump(); ]])
7396                 ],[CLANGTOOLLIBS="$LIBS"],[])
7397             fi
7398             AC_MSG_RESULT([$CLANGTOOLLIBS])
7399             if test -z "$CLANGTOOLLIBS"; then
7400                 if test "$compiler_plugins" = "yes"; then
7401                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7402                 else
7403                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7404                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7405                 fi
7406                 COMPILER_PLUGINS=
7407             fi
7408             if test -n "$COMPILER_PLUGINS"; then
7409                 if test -z "$CLANGSYSINCLUDE"; then
7410                     if test -n "$LLVM_CONFIG"; then
7411                         # Path to the clang system headers (no idea if there's a better way to get it).
7412                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7413                     fi
7414                 fi
7415             fi
7416         fi
7417         CXX=$save_CXX
7418         CXXCPP=$save_CXXCPP
7419         CPPFLAGS=$save_CPPFLAGS
7420         CXXFLAGS=$save_CXXFLAGS
7421         LDFLAGS=$save_LDFLAGS
7422         LIBS="$save_LIBS"
7423         AC_LANG_POP([C++])
7425         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7426         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7427             #ifndef __clang__
7428             you lose
7429             #endif
7430             int foo=42;
7431             ]])],
7432             [AC_MSG_RESULT([yes])
7433              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7434             [AC_MSG_RESULT([no])])
7435         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7436     fi
7437 else
7438     if test "$enable_compiler_plugins" = "yes"; then
7439         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7440     fi
7442 COMPILER_PLUGINS_ANALYZER_PCH=
7443 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7444     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7446 AC_SUBST(COMPILER_PLUGINS)
7447 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7448 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7449 AC_SUBST(COMPILER_PLUGINS_CXX)
7450 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7451 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7452 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7453 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7454 AC_SUBST(CLANGDIR)
7455 AC_SUBST(CLANGLIBDIR)
7456 AC_SUBST(CLANGTOOLLIBS)
7457 AC_SUBST(CLANGSYSINCLUDE)
7459 # Plugin to help linker.
7460 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7461 # This makes --enable-lto build with clang work.
7462 AC_SUBST(LD_PLUGIN)
7464 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7465 AC_SUBST(HAVE_POSIX_FALLOCATE)
7467 JITC_PROCESSOR_TYPE=""
7468 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7469     # IBMs JDK needs this...
7470     JITC_PROCESSOR_TYPE=6
7471     export JITC_PROCESSOR_TYPE
7473 AC_SUBST([JITC_PROCESSOR_TYPE])
7475 # Misc Windows Stuff
7476 AC_ARG_WITH(ucrt-dir,
7477     AS_HELP_STRING([--with-ucrt-dir],
7478         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7479         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7480         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7481             Windows6.1-KB2999226-x64.msu
7482             Windows6.1-KB2999226-x86.msu
7483             Windows8.1-KB2999226-x64.msu
7484             Windows8.1-KB2999226-x86.msu
7485             Windows8-RT-KB2999226-x64.msu
7486             Windows8-RT-KB2999226-x86.msu
7487         A zip archive including those files is available from Microsoft site:
7488         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7490 UCRT_REDISTDIR="$with_ucrt_dir"
7491 if test $_os = "WINNT"; then
7492     find_msvc_x64_dlls
7493     find_msms
7494     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7495     MSVC_DLLS="$msvcdlls"
7496     MSM_PATH=`win_short_path_for_make "$msmdir"`
7497     # MSVC 15.3 changed it to VC141
7498     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
7499         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
7500     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7501         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7502     else
7503         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7504     fi
7506     if test "$UCRT_REDISTDIR" = "no"; then
7507         dnl explicitly disabled
7508         UCRT_REDISTDIR=""
7509     else
7510         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7511                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7512                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7513                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7514                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7515                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7516             UCRT_REDISTDIR=""
7517             if test -n "$PKGFORMAT"; then
7518                for i in $PKGFORMAT; do
7519                    case "$i" in
7520                    msi)
7521                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7522                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7523                        ;;
7524                    esac
7525                done
7526             fi
7527         fi
7528     fi
7531 AC_SUBST(UCRT_REDISTDIR)
7532 AC_SUBST(MSVC_DLL_PATH)
7533 AC_SUBST(MSVC_DLLS)
7534 AC_SUBST(MSM_PATH)
7536 dnl ===================================================================
7537 dnl Checks for Java
7538 dnl ===================================================================
7539 if test "$ENABLE_JAVA" != ""; then
7541     # Windows-specific tests
7542     if test "$build_os" = "cygwin"; then
7543         if test "$BITNESS_OVERRIDE" = 64; then
7544             bitness=64
7545         else
7546             bitness=32
7547         fi
7549         if test -z "$with_jdk_home"; then
7550             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7551             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7552             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7553             if test -n "$regvalue"; then
7554                 ver=$regvalue
7555                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7556                 _jdk_home=$regvalue
7557             fi
7559             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7560                 with_jdk_home="$_jdk_home"
7561                 howfound="found automatically"
7562             else
7563                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK >= 9])
7564             fi
7565         else
7566             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7567             howfound="you passed"
7568         fi
7569     fi
7571     # 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.
7572     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7573     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7574         with_jdk_home=`/usr/libexec/java_home`
7575     fi
7577     JAVA_HOME=; export JAVA_HOME
7578     if test -z "$with_jdk_home"; then
7579         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7580     else
7581         _java_path="$with_jdk_home/bin/$with_java"
7582         dnl Check if there is a Java interpreter at all.
7583         if test -x "$_java_path"; then
7584             JAVAINTERPRETER=$_java_path
7585         else
7586             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7587         fi
7588     fi
7590     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7591     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7592     dnl loaded by java to run JunitTests:
7593     if test "$build_os" = "cygwin"; then
7594         shortjdkhome=`cygpath -d "$with_jdk_home"`
7595         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
7596             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7597             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7598         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
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
7603         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7604             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7605         fi
7606         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7607     elif test "$cross_compiling" != "yes"; then
7608         case $CPUNAME in
7609             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7610                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7611                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7612                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7613                 fi
7614                 ;;
7615             *) # assumption: everything else 32-bit
7616                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7617                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7618                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7619                 fi
7620                 ;;
7621         esac
7622     fi
7625 dnl ===================================================================
7626 dnl Checks for JDK.
7627 dnl ===================================================================
7629 # Note that JAVA_HOME as for now always means the *build* platform's
7630 # JAVA_HOME. Whether all the complexity here actually is needed any
7631 # more or not, no idea.
7633 if test "$ENABLE_JAVA" != ""; then
7634     _gij_longver=0
7635     AC_MSG_CHECKING([the installed JDK])
7636     if test -n "$JAVAINTERPRETER"; then
7637         dnl java -version sends output to stderr!
7638         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7639             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7640         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7641             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7642         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7643             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7644         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7645             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7646         else
7647             JDK=sun
7649             dnl Sun JDK specific tests
7650             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7651             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7653             if test "$_jdk_ver" -lt 10900; then
7654                 AC_MSG_ERROR([JDK is too old, you need at least 9])
7655             fi
7656             if test "$_jdk_ver" -gt 10900; then
7657                 JAVA_CLASSPATH_NOT_SET=TRUE
7658             fi
7660             AC_MSG_RESULT([found (JDK $_jdk)])
7661             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7662             if test "$_os" = "WINNT"; then
7663                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7664             fi
7666             # set to limit VM usage for JunitTests
7667             JAVAIFLAGS=-Xmx64M
7668             # set to limit VM usage for javac
7669             JAVAFLAGS=-J-Xmx128M
7670         fi
7671     else
7672         AC_MSG_ERROR([Java not found. You need at least JDK 9])
7673     fi
7674 else
7675     dnl Java disabled
7676     JAVA_HOME=
7677     export JAVA_HOME
7680 dnl ===================================================================
7681 dnl Checks for javac
7682 dnl ===================================================================
7683 if test "$ENABLE_JAVA" != ""; then
7684     javacompiler="javac"
7685     : ${JAVA_SOURCE_VER=8}
7686     : ${JAVA_TARGET_VER=8}
7687     if test -z "$with_jdk_home"; then
7688         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7689     else
7690         _javac_path="$with_jdk_home/bin/$javacompiler"
7691         dnl Check if there is a Java compiler at all.
7692         if test -x "$_javac_path"; then
7693             JAVACOMPILER=$_javac_path
7694         fi
7695     fi
7696     if test -z "$JAVACOMPILER"; then
7697         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7698     fi
7699     if test "$build_os" = "cygwin"; then
7700         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7701             JAVACOMPILER="${JAVACOMPILER}.exe"
7702         fi
7703         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7704     fi
7707 dnl ===================================================================
7708 dnl Checks for javadoc
7709 dnl ===================================================================
7710 if test "$ENABLE_JAVA" != ""; then
7711     if test -z "$with_jdk_home"; then
7712         AC_PATH_PROG(JAVADOC, javadoc)
7713     else
7714         _javadoc_path="$with_jdk_home/bin/javadoc"
7715         dnl Check if there is a javadoc at all.
7716         if test -x "$_javadoc_path"; then
7717             JAVADOC=$_javadoc_path
7718         else
7719             AC_PATH_PROG(JAVADOC, javadoc)
7720         fi
7721     fi
7722     if test -z "$JAVADOC"; then
7723         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7724     fi
7725     if test "$build_os" = "cygwin"; then
7726         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7727             JAVADOC="${JAVADOC}.exe"
7728         fi
7729         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7730     fi
7732     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7733     JAVADOCISGJDOC="yes"
7734     fi
7736 AC_SUBST(JAVADOCISGJDOC)
7738 if test "$ENABLE_JAVA" != ""; then
7739     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7740     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7741         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7742            # try to recover first by looking whether we have an alternative
7743            # system as in Debian or newer SuSEs where following /usr/bin/javac
7744            # over /etc/alternatives/javac leads to the right bindir where we
7745            # just need to strip a bit away to get a valid JAVA_HOME
7746            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7747         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7748             # maybe only one level of symlink (e.g. on Mac)
7749             JAVA_HOME=$(readlink $JAVACOMPILER)
7750             if test "$(dirname $JAVA_HOME)" = "."; then
7751                 # we've got no path to trim back
7752                 JAVA_HOME=""
7753             fi
7754         else
7755             # else warn
7756             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7757             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7758             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7759             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7760         fi
7761         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7762         if test "$JAVA_HOME" != "/usr"; then
7763             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7764                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7765                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7766                 dnl Tiger already returns a JDK path...
7767                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7768             else
7769                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7770                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7771                 dnl that checks which version to run
7772                 if test -f "$JAVA_HOME"; then
7773                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7774                 fi
7775             fi
7776         fi
7777     fi
7778     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7780     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7781     if test -z "$JAVA_HOME"; then
7782         if test "x$with_jdk_home" = "x"; then
7783             cat > findhome.java <<_ACEOF
7784 [import java.io.File;
7786 class findhome
7788     public static void main(String args[])
7789     {
7790         String jrelocation = System.getProperty("java.home");
7791         File jre = new File(jrelocation);
7792         System.out.println(jre.getParent());
7793     }
7795 _ACEOF
7796             AC_MSG_CHECKING([if javac works])
7797             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7798             AC_TRY_EVAL(javac_cmd)
7799             if test $? = 0 -a -f ./findhome.class; then
7800                 AC_MSG_RESULT([javac works])
7801             else
7802                 echo "configure: javac test failed" >&5
7803                 cat findhome.java >&5
7804                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7805             fi
7806             AC_MSG_CHECKING([if gij knows its java.home])
7807             JAVA_HOME=`$JAVAINTERPRETER findhome`
7808             if test $? = 0 -a "$JAVA_HOME" != ""; then
7809                 AC_MSG_RESULT([$JAVA_HOME])
7810             else
7811                 echo "configure: java test failed" >&5
7812                 cat findhome.java >&5
7813                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7814             fi
7815             # clean-up after ourselves
7816             rm -f ./findhome.java ./findhome.class
7817         else
7818             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7819         fi
7820     fi
7822     # now check if $JAVA_HOME is really valid
7823     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7824         case "${JAVA_HOME}" in
7825             /Library/Java/JavaVirtualMachines/*)
7826                 ;;
7827             *)
7828                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7829                 ;;
7830         esac
7831         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7832             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7833             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7834             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7835             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7836             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7837             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7838         fi
7839     fi
7840     PathFormat "$JAVA_HOME"
7841     JAVA_HOME="$formatted_path"
7844 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7845     "$_os" != Darwin
7846 then
7847     AC_MSG_CHECKING([for JAWT lib])
7848     if test "$_os" = WINNT; then
7849         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7850         JAWTLIB=jawt.lib
7851     else
7852         case "$host_cpu" in
7853         arm*)
7854             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7855             JAVA_ARCH=$my_java_arch
7856             ;;
7857         i*86)
7858             my_java_arch=i386
7859             ;;
7860         m68k)
7861             my_java_arch=m68k
7862             ;;
7863         powerpc)
7864             my_java_arch=ppc
7865             ;;
7866         powerpc64)
7867             my_java_arch=ppc64
7868             ;;
7869         powerpc64le)
7870             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7871             JAVA_ARCH=$my_java_arch
7872             ;;
7873         sparc64)
7874             my_java_arch=sparcv9
7875             ;;
7876         x86_64)
7877             my_java_arch=amd64
7878             ;;
7879         *)
7880             my_java_arch=$host_cpu
7881             ;;
7882         esac
7883         # This is where JDK9 puts the library
7884         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7885             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7886         else
7887             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7888         fi
7889         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7890     fi
7891     AC_MSG_RESULT([$JAWTLIB])
7893 AC_SUBST(JAWTLIB)
7895 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7896     case "$host_os" in
7898     aix*)
7899         JAVAINC="-I$JAVA_HOME/include"
7900         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7901         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7902         ;;
7904     cygwin*)
7905         JAVAINC="-I$JAVA_HOME/include/win32"
7906         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7907         ;;
7909     darwin*)
7910         if test -d "$JAVA_HOME/include/darwin"; then
7911             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7912         else
7913             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7914         fi
7915         ;;
7917     dragonfly*)
7918         JAVAINC="-I$JAVA_HOME/include"
7919         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7920         ;;
7922     freebsd*)
7923         JAVAINC="-I$JAVA_HOME/include"
7924         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7925         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7926         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7927         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7928         ;;
7930     k*bsd*-gnu*)
7931         JAVAINC="-I$JAVA_HOME/include"
7932         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7933         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7934         ;;
7936     linux-gnu*)
7937         JAVAINC="-I$JAVA_HOME/include"
7938         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7939         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7940         ;;
7942     *netbsd*)
7943         JAVAINC="-I$JAVA_HOME/include"
7944         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7945         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7946        ;;
7948     openbsd*)
7949         JAVAINC="-I$JAVA_HOME/include"
7950         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7951         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7952         ;;
7954     solaris*)
7955         JAVAINC="-I$JAVA_HOME/include"
7956         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7957         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7958         ;;
7959     esac
7961 SOLARINC="$SOLARINC $JAVAINC"
7963 AC_SUBST(JAVACOMPILER)
7964 AC_SUBST(JAVADOC)
7965 AC_SUBST(JAVAINTERPRETER)
7966 AC_SUBST(JAVAIFLAGS)
7967 AC_SUBST(JAVAFLAGS)
7968 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7969 AC_SUBST(JAVA_HOME)
7970 AC_SUBST(JAVA_SOURCE_VER)
7971 AC_SUBST(JAVA_TARGET_VER)
7972 AC_SUBST(JDK)
7975 dnl ===================================================================
7976 dnl Export file validation
7977 dnl ===================================================================
7978 AC_MSG_CHECKING([whether to enable export file validation])
7979 if test "$with_export_validation" != "no"; then
7980     if test -z "$ENABLE_JAVA"; then
7981         if test "$with_export_validation" = "yes"; then
7982             AC_MSG_ERROR([requested, but Java is disabled])
7983         else
7984             AC_MSG_RESULT([no, as Java is disabled])
7985         fi
7986     elif ! test -d "${SRC_ROOT}/schema"; then
7987         if test "$with_export_validation" = "yes"; then
7988             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7989         else
7990             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7991         fi
7992     else
7993         AC_MSG_RESULT([yes])
7994         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7996         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7997         if test -z "$ODFVALIDATOR"; then
7998             # remember to download the ODF toolkit with validator later
7999             AC_MSG_NOTICE([no odfvalidator found, will download it])
8000             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8001             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8003             # and fetch name of odfvalidator jar name from download.lst
8004             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8005             AC_SUBST(ODFVALIDATOR_JAR)
8007             if test -z "$ODFVALIDATOR_JAR"; then
8008                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8009             fi
8010         fi
8011         if test "$build_os" = "cygwin"; then
8012             # In case of Cygwin it will be executed from Windows,
8013             # so we need to run bash and absolute path to validator
8014             # so instead of "odfvalidator" it will be
8015             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8016             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8017         else
8018             ODFVALIDATOR="sh $ODFVALIDATOR"
8019         fi
8020         AC_SUBST(ODFVALIDATOR)
8023         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8024         if test -z "$OFFICEOTRON"; then
8025             # remember to download the officeotron with validator later
8026             AC_MSG_NOTICE([no officeotron found, will download it])
8027             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8028             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8030             # and fetch name of officeotron jar name from download.lst
8031             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8032             AC_SUBST(OFFICEOTRON_JAR)
8034             if test -z "$OFFICEOTRON_JAR"; then
8035                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8036             fi
8037         else
8038             # check version of existing officeotron
8039             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8040             if test 0"$OFFICEOTRON_VER" -lt 704; then
8041                 AC_MSG_ERROR([officeotron too old])
8042             fi
8043         fi
8044         if test "$build_os" = "cygwin"; then
8045             # In case of Cygwin it will be executed from Windows,
8046             # so we need to run bash and absolute path to validator
8047             # so instead of "odfvalidator" it will be
8048             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8049             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8050         else
8051             OFFICEOTRON="sh $OFFICEOTRON"
8052         fi
8053     fi
8054     AC_SUBST(OFFICEOTRON)
8055 else
8056     AC_MSG_RESULT([no])
8059 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8060 if test "$with_bffvalidator" != "no"; then
8061     AC_DEFINE(HAVE_BFFVALIDATOR)
8063     if test "$with_export_validation" = "no"; then
8064         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8065     fi
8067     if test "$with_bffvalidator" = "yes"; then
8068         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8069     else
8070         BFFVALIDATOR="$with_bffvalidator"
8071     fi
8073     if test "$build_os" = "cygwin"; then
8074         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8075             AC_MSG_RESULT($BFFVALIDATOR)
8076         else
8077             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8078         fi
8079     elif test -n "$BFFVALIDATOR"; then
8080         # We are not in Cygwin but need to run Windows binary with wine
8081         AC_PATH_PROGS(WINE, wine)
8083         # so swap in a shell wrapper that converts paths transparently
8084         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8085         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8086         AC_SUBST(BFFVALIDATOR_EXE)
8087         AC_MSG_RESULT($BFFVALIDATOR)
8088     else
8089         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8090     fi
8091     AC_SUBST(BFFVALIDATOR)
8092 else
8093     AC_MSG_RESULT([no])
8096 dnl ===================================================================
8097 dnl Check for C preprocessor to use
8098 dnl ===================================================================
8099 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8100 if test -n "$with_idlc_cpp"; then
8101     AC_MSG_RESULT([$with_idlc_cpp])
8102     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8103 else
8104     AC_MSG_RESULT([ucpp])
8105     AC_MSG_CHECKING([which ucpp tp use])
8106     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8107         AC_MSG_RESULT([external])
8108         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8109     else
8110         AC_MSG_RESULT([internal])
8111         BUILD_TYPE="$BUILD_TYPE UCPP"
8112     fi
8114 AC_SUBST(SYSTEM_UCPP)
8116 dnl ===================================================================
8117 dnl Check for epm (not needed for Windows)
8118 dnl ===================================================================
8119 AC_MSG_CHECKING([whether to enable EPM for packing])
8120 if test "$enable_epm" = "yes"; then
8121     AC_MSG_RESULT([yes])
8122     if test "$_os" != "WINNT"; then
8123         if test $_os = Darwin; then
8124             EPM=internal
8125         elif test -n "$with_epm"; then
8126             EPM=$with_epm
8127         else
8128             AC_PATH_PROG(EPM, epm, no)
8129         fi
8130         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8131             AC_MSG_NOTICE([EPM will be built.])
8132             BUILD_TYPE="$BUILD_TYPE EPM"
8133             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8134         else
8135             # Gentoo has some epm which is something different...
8136             AC_MSG_CHECKING([whether the found epm is the right epm])
8137             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8138                 AC_MSG_RESULT([yes])
8139             else
8140                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8141             fi
8142             AC_MSG_CHECKING([epm version])
8143             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8144             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8145                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8146                 AC_MSG_RESULT([OK, >= 3.7])
8147             else
8148                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8149                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8150             fi
8151         fi
8152     fi
8154     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8155         AC_MSG_CHECKING([for rpm])
8156         for a in "$RPM" rpmbuild rpm; do
8157             $a --usage >/dev/null 2> /dev/null
8158             if test $? -eq 0; then
8159                 RPM=$a
8160                 break
8161             else
8162                 $a --version >/dev/null 2> /dev/null
8163                 if test $? -eq 0; then
8164                     RPM=$a
8165                     break
8166                 fi
8167             fi
8168         done
8169         if test -z "$RPM"; then
8170             AC_MSG_ERROR([not found])
8171         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8172             RPM_PATH=`which $RPM`
8173             AC_MSG_RESULT([$RPM_PATH])
8174             SCPDEFS="$SCPDEFS -DWITH_RPM"
8175         else
8176             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8177         fi
8178     fi
8179     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8180         AC_PATH_PROG(DPKG, dpkg, no)
8181         if test "$DPKG" = "no"; then
8182             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8183         fi
8184     fi
8185     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8186        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8187         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8188             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8189                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8190                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8191                     AC_MSG_RESULT([yes])
8192                 else
8193                     AC_MSG_RESULT([no])
8194                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8195                         _pt="rpm"
8196                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8197                         add_warning "the rpms will need to be installed with --nodeps"
8198                     else
8199                         _pt="pkg"
8200                     fi
8201                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8202                     add_warning "the ${_pt}s will not be relocatable"
8203                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8204                                  relocation will work, you need to patch your epm with the
8205                                  patch in epm/epm-3.7.patch or build with
8206                                  --with-epm=internal which will build a suitable epm])
8207                 fi
8208             fi
8209         fi
8210     fi
8211     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8212         AC_PATH_PROG(PKGMK, pkgmk, no)
8213         if test "$PKGMK" = "no"; then
8214             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8215         fi
8216     fi
8217     AC_SUBST(RPM)
8218     AC_SUBST(DPKG)
8219     AC_SUBST(PKGMK)
8220 else
8221     for i in $PKGFORMAT; do
8222         case "$i" in
8223         aix | bsd | deb | pkg | rpm | native | portable)
8224             AC_MSG_ERROR(
8225                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8226             ;;
8227         esac
8228     done
8229     AC_MSG_RESULT([no])
8230     EPM=NO
8232 AC_SUBST(EPM)
8234 ENABLE_LWP=
8235 if test "$enable_lotuswordpro" = "yes"; then
8236     ENABLE_LWP="TRUE"
8238 AC_SUBST(ENABLE_LWP)
8240 dnl ===================================================================
8241 dnl Check for building ODK
8242 dnl ===================================================================
8243 if test "$enable_odk" = no; then
8244     unset DOXYGEN
8245 else
8246     if test "$with_doxygen" = no; then
8247         AC_MSG_CHECKING([for doxygen])
8248         unset DOXYGEN
8249         AC_MSG_RESULT([no])
8250     else
8251         if test "$with_doxygen" = yes; then
8252             AC_PATH_PROG([DOXYGEN], [doxygen])
8253             if test -z "$DOXYGEN"; then
8254                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8255             fi
8256             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8257                 if ! dot -V 2>/dev/null; then
8258                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8259                 fi
8260             fi
8261         else
8262             AC_MSG_CHECKING([for doxygen])
8263             DOXYGEN=$with_doxygen
8264             AC_MSG_RESULT([$DOXYGEN])
8265         fi
8266         if test -n "$DOXYGEN"; then
8267             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8268             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8269             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8270                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8271             fi
8272         fi
8273     fi
8275 AC_SUBST([DOXYGEN])
8277 AC_MSG_CHECKING([whether to build the ODK])
8278 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8279     AC_MSG_RESULT([yes])
8281     if test "$with_java" != "no"; then
8282         AC_MSG_CHECKING([whether to build unowinreg.dll])
8283         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8284             # build on Win by default
8285             enable_build_unowinreg=yes
8286         fi
8287         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8288             AC_MSG_RESULT([no])
8289             BUILD_UNOWINREG=
8290         else
8291             AC_MSG_RESULT([yes])
8292             BUILD_UNOWINREG=TRUE
8293         fi
8294         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8295             if test -z "$with_mingw_cross_compiler"; then
8296                 dnl Guess...
8297                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8298             elif test -x "$with_mingw_cross_compiler"; then
8299                  MINGWCXX="$with_mingw_cross_compiler"
8300             else
8301                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8302             fi
8304             if test "$MINGWCXX" = "false"; then
8305                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8306             fi
8308             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8309             if test -x "$mingwstrip_test"; then
8310                 MINGWSTRIP="$mingwstrip_test"
8311             else
8312                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8313             fi
8315             if test "$MINGWSTRIP" = "false"; then
8316                 AC_MSG_ERROR(MinGW32 binutils not found.)
8317             fi
8318         fi
8319     fi
8320     BUILD_TYPE="$BUILD_TYPE ODK"
8321 else
8322     AC_MSG_RESULT([no])
8323     BUILD_UNOWINREG=
8325 AC_SUBST(BUILD_UNOWINREG)
8326 AC_SUBST(MINGWCXX)
8327 AC_SUBST(MINGWSTRIP)
8329 dnl ===================================================================
8330 dnl Check for system zlib
8331 dnl ===================================================================
8332 if test "$with_system_zlib" = "auto"; then
8333     case "$_os" in
8334     WINNT)
8335         with_system_zlib="$with_system_libs"
8336         ;;
8337     *)
8338         if test "$enable_fuzzers" != "yes"; then
8339             with_system_zlib=yes
8340         else
8341             with_system_zlib=no
8342         fi
8343         ;;
8344     esac
8347 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8348 dnl and has no pkg-config for it at least on some tinderboxes,
8349 dnl so leaving that out for now
8350 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8351 AC_MSG_CHECKING([which zlib to use])
8352 if test "$with_system_zlib" = "yes"; then
8353     AC_MSG_RESULT([external])
8354     SYSTEM_ZLIB=TRUE
8355     AC_CHECK_HEADER(zlib.h, [],
8356         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8357     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8358         [AC_MSG_ERROR(zlib not found or functional)], [])
8359 else
8360     AC_MSG_RESULT([internal])
8361     SYSTEM_ZLIB=
8362     BUILD_TYPE="$BUILD_TYPE ZLIB"
8363     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8364     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8366 AC_SUBST(ZLIB_CFLAGS)
8367 AC_SUBST(ZLIB_LIBS)
8368 AC_SUBST(SYSTEM_ZLIB)
8370 dnl ===================================================================
8371 dnl Check for system jpeg
8372 dnl ===================================================================
8373 AC_MSG_CHECKING([which libjpeg to use])
8374 if test "$with_system_jpeg" = "yes"; then
8375     AC_MSG_RESULT([external])
8376     SYSTEM_LIBJPEG=TRUE
8377     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8378         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8379     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8380         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8381 else
8382     SYSTEM_LIBJPEG=
8383     AC_MSG_RESULT([internal, libjpeg-turbo])
8384     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8385     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8386     if test "$COM" = "MSC"; then
8387         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8388     else
8389         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8390     fi
8392     case "$host_cpu" in
8393     x86_64 | amd64 | i*86 | x86 | ia32)
8394         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8395         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8396             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8397                 NASM="$LODE_HOME/opt/bin/nasm"
8398             elif test -x "/opt/lo/bin/nasm"; then
8399                 NASM="/opt/lo/bin/nasm"
8400             fi
8401         fi
8403         if test -n "$NASM"; then
8404             AC_MSG_CHECKING([for object file format of host system])
8405             case "$host_os" in
8406               cygwin* | mingw* | pw32* | interix*)
8407                 case "$host_cpu" in
8408                   x86_64)
8409                     objfmt='Win64-COFF'
8410                     ;;
8411                   *)
8412                     objfmt='Win32-COFF'
8413                     ;;
8414                 esac
8415               ;;
8416               msdosdjgpp* | go32*)
8417                 objfmt='COFF'
8418               ;;
8419               os2-emx*) # not tested
8420                 objfmt='MSOMF' # obj
8421               ;;
8422               linux*coff* | linux*oldld*)
8423                 objfmt='COFF' # ???
8424               ;;
8425               linux*aout*)
8426                 objfmt='a.out'
8427               ;;
8428               linux*)
8429                 case "$host_cpu" in
8430                   x86_64)
8431                     objfmt='ELF64'
8432                     ;;
8433                   *)
8434                     objfmt='ELF'
8435                     ;;
8436                 esac
8437               ;;
8438               kfreebsd* | freebsd* | netbsd* | openbsd*)
8439                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8440                   objfmt='BSD-a.out'
8441                 else
8442                   case "$host_cpu" in
8443                     x86_64 | amd64)
8444                       objfmt='ELF64'
8445                       ;;
8446                     *)
8447                       objfmt='ELF'
8448                       ;;
8449                   esac
8450                 fi
8451               ;;
8452               solaris* | sunos* | sysv* | sco*)
8453                 case "$host_cpu" in
8454                   x86_64)
8455                     objfmt='ELF64'
8456                     ;;
8457                   *)
8458                     objfmt='ELF'
8459                     ;;
8460                 esac
8461               ;;
8462               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8463                 case "$host_cpu" in
8464                   x86_64)
8465                     objfmt='Mach-O64'
8466                     ;;
8467                   *)
8468                     objfmt='Mach-O'
8469                     ;;
8470                 esac
8471               ;;
8472               *)
8473                 objfmt='ELF ?'
8474               ;;
8475             esac
8477             AC_MSG_RESULT([$objfmt])
8478             if test "$objfmt" = 'ELF ?'; then
8479               objfmt='ELF'
8480               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8481             fi
8483             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8484             case "$objfmt" in
8485               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8486               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8487               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8488               COFF)       NAFLAGS='-fcoff -DCOFF';;
8489               a.out)      NAFLAGS='-faout -DAOUT';;
8490               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8491               ELF)        NAFLAGS='-felf -DELF';;
8492               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8493               RDF)        NAFLAGS='-frdf -DRDF';;
8494               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8495               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8496             esac
8497             AC_MSG_RESULT([$NAFLAGS])
8499             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8500             cat > conftest.asm << EOF
8501             [%line __oline__ "configure"
8502                     section .text
8503                     global  _main,main
8504             _main:
8505             main:   xor     eax,eax
8506                     ret
8507             ]
8509             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8510             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8511               AC_MSG_RESULT(yes)
8512             else
8513               echo "configure: failed program was:" >&AC_FD_CC
8514               cat conftest.asm >&AC_FD_CC
8515               rm -rf conftest*
8516               AC_MSG_RESULT(no)
8517               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8518               NASM=""
8519             fi
8521         fi
8523         if test -z "$NASM"; then
8524 cat << _EOS
8525 ****************************************************************************
8526 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8527 To get one please:
8529 _EOS
8530             if test "$build_os" = "cygwin"; then
8531 cat << _EOS
8532 install a pre-compiled binary for Win32
8534 mkdir -p /opt/lo/bin
8535 cd /opt/lo/bin
8536 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8537 chmod +x nasm
8539 or get and install one from http://www.nasm.us/
8541 Then re-run autogen.sh
8543 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8544 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8546 _EOS
8547             else
8548 cat << _EOS
8549 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8551 _EOS
8552             fi
8553             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8554             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8555         fi
8556       ;;
8557     esac
8560 AC_SUBST(NASM)
8561 AC_SUBST(LIBJPEG_CFLAGS)
8562 AC_SUBST(LIBJPEG_LIBS)
8563 AC_SUBST(SYSTEM_LIBJPEG)
8565 dnl ===================================================================
8566 dnl Check for system clucene
8567 dnl ===================================================================
8568 dnl we should rather be using
8569 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8570 dnl but the contribs-lib check seems tricky
8571 AC_MSG_CHECKING([which clucene to use])
8572 if test "$with_system_clucene" = "yes"; then
8573     AC_MSG_RESULT([external])
8574     SYSTEM_CLUCENE=TRUE
8575     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8576     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8577     FilterLibs "${CLUCENE_LIBS}"
8578     CLUCENE_LIBS="${filteredlibs}"
8579     AC_LANG_PUSH([C++])
8580     save_CXXFLAGS=$CXXFLAGS
8581     save_CPPFLAGS=$CPPFLAGS
8582     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8583     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8584     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8585     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8586     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8587                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8588     CXXFLAGS=$save_CXXFLAGS
8589     CPPFLAGS=$save_CPPFLAGS
8590     AC_LANG_POP([C++])
8592     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8593 else
8594     AC_MSG_RESULT([internal])
8595     SYSTEM_CLUCENE=
8596     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8598 AC_SUBST(SYSTEM_CLUCENE)
8599 AC_SUBST(CLUCENE_CFLAGS)
8600 AC_SUBST(CLUCENE_LIBS)
8602 dnl ===================================================================
8603 dnl Check for system expat
8604 dnl ===================================================================
8605 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8607 dnl ===================================================================
8608 dnl Check for system xmlsec
8609 dnl ===================================================================
8610 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8612 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8613 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8614     ENABLE_EOT="TRUE"
8615     AC_DEFINE([ENABLE_EOT])
8616     AC_MSG_RESULT([yes])
8618     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8619 else
8620     ENABLE_EOT=
8621     AC_MSG_RESULT([no])
8623 AC_SUBST([ENABLE_EOT])
8625 dnl ===================================================================
8626 dnl Check for DLP libs
8627 dnl ===================================================================
8628 AS_IF([test "$COM" = "MSC"],
8629       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8630       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8632 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8634 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8636 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8638 AS_IF([test "$COM" = "MSC"],
8639       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8640       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8642 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8644 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8646 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8647 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.11])
8649 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8651 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8653 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8655 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8656 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.16])
8658 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8659 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8661 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8663 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8664 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8666 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8668 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8670 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8672 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8674 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8675 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
8677 dnl ===================================================================
8678 dnl Check for system lcms2
8679 dnl ===================================================================
8680 if test "$with_system_lcms2" != "yes"; then
8681     SYSTEM_LCMS2=
8683 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8684 if test "$GCC" = "yes"; then
8685     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8687 if test "$COM" = "MSC"; then # override the above
8688     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8691 dnl ===================================================================
8692 dnl Check for system cppunit
8693 dnl ===================================================================
8694 if test "$_os" != "Android" ; then
8695     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8698 dnl ===================================================================
8699 dnl Check whether freetype is available
8700 dnl ===================================================================
8701 if test  "$test_freetype" = "yes"; then
8702     AC_MSG_CHECKING([whether freetype is available])
8703     # FreeType has 3 different kinds of versions
8704     # * release, like 2.4.10
8705     # * libtool, like 13.0.7 (this what pkg-config returns)
8706     # * soname
8707     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8708     #
8709     # 9.9.3 is 2.2.0
8710     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8711     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8712     FilterLibs "${FREETYPE_LIBS}"
8713     FREETYPE_LIBS="${filteredlibs}"
8714     SYSTEM_FREETYPE=TRUE
8715 else
8716     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8717     if test "x$ac_config_site_64bit_host" = xYES; then
8718         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8719     else
8720         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8721     fi
8723 AC_SUBST(FREETYPE_CFLAGS)
8724 AC_SUBST(FREETYPE_LIBS)
8725 AC_SUBST([SYSTEM_FREETYPE])
8727 # ===================================================================
8728 # Check for system libxslt
8729 # to prevent incompatibilities between internal libxml2 and external libxslt,
8730 # or vice versa, use with_system_libxml here
8731 # ===================================================================
8732 if test "$with_system_libxml" = "auto"; then
8733     case "$_os" in
8734     WINNT|iOS|Android)
8735         with_system_libxml="$with_system_libs"
8736         ;;
8737     *)
8738         if test "$enable_fuzzers" != "yes"; then
8739             with_system_libxml=yes
8740         else
8741             with_system_libxml=no
8742         fi
8743         ;;
8744     esac
8747 AC_MSG_CHECKING([which libxslt to use])
8748 if test "$with_system_libxml" = "yes"; then
8749     AC_MSG_RESULT([external])
8750     SYSTEM_LIBXSLT=TRUE
8751     if test "$_os" = "Darwin"; then
8752         dnl make sure to use SDK path
8753         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8754         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8755         dnl omit -L/usr/lib
8756         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8757         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8758     else
8759         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8760         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8761         FilterLibs "${LIBXSLT_LIBS}"
8762         LIBXSLT_LIBS="${filteredlibs}"
8763         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8764         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8765         FilterLibs "${LIBEXSLT_LIBS}"
8766         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8767     fi
8769     dnl Check for xsltproc
8770     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8771     if test "$XSLTPROC" = "no"; then
8772         AC_MSG_ERROR([xsltproc is required])
8773     fi
8774 else
8775     AC_MSG_RESULT([internal])
8776     SYSTEM_LIBXSLT=
8777     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8779     if test "$cross_compiling" = "yes"; then
8780         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8781         if test "$XSLTPROC" = "no"; then
8782             AC_MSG_ERROR([xsltproc is required])
8783         fi
8784     fi
8786 AC_SUBST(SYSTEM_LIBXSLT)
8787 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8788     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8790 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8792 AC_SUBST(LIBEXSLT_CFLAGS)
8793 AC_SUBST(LIBEXSLT_LIBS)
8794 AC_SUBST(LIBXSLT_CFLAGS)
8795 AC_SUBST(LIBXSLT_LIBS)
8796 AC_SUBST(XSLTPROC)
8798 # ===================================================================
8799 # Check for system libxml
8800 # ===================================================================
8801 AC_MSG_CHECKING([which libxml to use])
8802 if test "$with_system_libxml" = "yes"; then
8803     AC_MSG_RESULT([external])
8804     SYSTEM_LIBXML=TRUE
8805     if test "$_os" = "Darwin"; then
8806         dnl make sure to use SDK path
8807         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8808         dnl omit -L/usr/lib
8809         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8810     elif test $_os = iOS; then
8811         dnl make sure to use SDK path
8812         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8813         LIBXML_CFLAGS="-I$usr/include/libxml2"
8814         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8815     else
8816         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8817         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8818         FilterLibs "${LIBXML_LIBS}"
8819         LIBXML_LIBS="${filteredlibs}"
8820     fi
8822     dnl Check for xmllint
8823     AC_PATH_PROG(XMLLINT, xmllint, no)
8824     if test "$XMLLINT" = "no"; then
8825         AC_MSG_ERROR([xmllint is required])
8826     fi
8827 else
8828     AC_MSG_RESULT([internal])
8829     SYSTEM_LIBXML=
8830     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8831     if test "$COM" = "MSC"; then
8832         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8833     fi
8834     if test "$COM" = "MSC"; then
8835         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8836     else
8837         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8838     fi
8839     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8841 AC_SUBST(SYSTEM_LIBXML)
8842 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8843     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8845 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8846 AC_SUBST(LIBXML_CFLAGS)
8847 AC_SUBST(LIBXML_LIBS)
8848 AC_SUBST(XMLLINT)
8850 # =====================================================================
8851 # Checking for a Python interpreter with version >= 3.3.
8852 # Optionally user can pass an option to configure, i. e.
8853 # ./configure PYTHON=/usr/bin/python
8854 # =====================================================================
8855 if test $_os = Darwin -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
8856     # Only allowed choices for macOS are 'internal' (default) and 'fully-internal'
8857     enable_python=internal
8859 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8860     if test -n "$PYTHON"; then
8861         PYTHON_FOR_BUILD=$PYTHON
8862     else
8863         # This allows a lack of system python with no error, we use internal one in that case.
8864         AM_PATH_PYTHON([3.3],, [:])
8865         # Clean PYTHON_VERSION checked below if cross-compiling
8866         PYTHON_VERSION=""
8867         if test "$PYTHON" != ":"; then
8868             PYTHON_FOR_BUILD=$PYTHON
8869         fi
8870     fi
8872 AC_SUBST(PYTHON_FOR_BUILD)
8874 # Checks for Python to use for Pyuno
8875 AC_MSG_CHECKING([which Python to use for Pyuno])
8876 case "$enable_python" in
8877 no|disable)
8878     if test -z $PYTHON_FOR_BUILD; then
8879         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8880         # requirement from the choice whether to include Python stuff in the installer, but why
8881         # bother?
8882         AC_MSG_ERROR([Python is required at build time.])
8883     fi
8884     enable_python=no
8885     AC_MSG_RESULT([none])
8886     ;;
8887 ""|yes|auto)
8888     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8889         AC_MSG_RESULT([no, overridden by --disable-scripting])
8890         enable_python=no
8891     elif test $build_os = cygwin; then
8892         dnl When building on Windows we don't attempt to use any installed
8893         dnl "system"  Python.
8894         AC_MSG_RESULT([fully internal])
8895         enable_python=internal
8896     elif test "$cross_compiling" = yes; then
8897         AC_MSG_RESULT([system])
8898         enable_python=system
8899     else
8900         # Unset variables set by the above AM_PATH_PYTHON so that
8901         # we actually do check anew.
8902         AC_MSG_RESULT([])
8903         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
8904         AM_PATH_PYTHON([3.3],, [:])
8905         AC_MSG_CHECKING([which Python to use for Pyuno])
8906         if test "$PYTHON" = ":"; then
8907             if test -z "$PYTHON_FOR_BUILD"; then
8908                 AC_MSG_RESULT([fully internal])
8909             else
8910                 AC_MSG_RESULT([internal])
8911             fi
8912             enable_python=internal
8913         else
8914             AC_MSG_RESULT([system])
8915             enable_python=system
8916         fi
8917     fi
8918     ;;
8919 internal)
8920     AC_MSG_RESULT([internal])
8921     ;;
8922 fully-internal)
8923     AC_MSG_RESULT([fully internal])
8924     enable_python=internal
8925     ;;
8926 system)
8927     AC_MSG_RESULT([system])
8928     if test "$_os" = Darwin; then
8929         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
8930     fi
8931     ;;
8933     AC_MSG_ERROR([Incorrect --enable-python option])
8934     ;;
8935 esac
8937 if test $enable_python != no; then
8938     BUILD_TYPE="$BUILD_TYPE PYUNO"
8941 if test $enable_python = system; then
8942     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8943         # Fallback: Accept these in the environment, or as set above
8944         # for MacOSX.
8945         :
8946     elif test "$cross_compiling" != yes; then
8947         # Unset variables set by the above AM_PATH_PYTHON so that
8948         # we actually do check anew.
8949         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
8950         # This causes an error if no python command is found
8951         AM_PATH_PYTHON([3.3])
8952         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8953         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8954         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8955         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8956         if test -z "$PKG_CONFIG"; then
8957             PYTHON_CFLAGS="-I$python_include"
8958             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8959         elif $PKG_CONFIG --exists python-$python_version-embed; then
8960             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8961             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8962         elif $PKG_CONFIG --exists python-$python_version; then
8963             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8964             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8965         else
8966             PYTHON_CFLAGS="-I$python_include"
8967             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8968         fi
8969         FilterLibs "${PYTHON_LIBS}"
8970         PYTHON_LIBS="${filteredlibs}"
8971     else
8972         dnl How to find out the cross-compilation Python installation path?
8973         AC_MSG_CHECKING([for python version])
8974         AS_IF([test -n "$PYTHON_VERSION"],
8975               [AC_MSG_RESULT([$PYTHON_VERSION])],
8976               [AC_MSG_RESULT([not found])
8977                AC_MSG_ERROR([no usable python found])])
8978         test -n "$PYTHON_CFLAGS" && break
8979     fi
8981     dnl Check if the headers really work
8982     save_CPPFLAGS="$CPPFLAGS"
8983     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8984     AC_CHECK_HEADER(Python.h)
8985     CPPFLAGS="$save_CPPFLAGS"
8987     # let the PYTHON_FOR_BUILD match the same python installation that
8988     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8989     # better for PythonTests.
8990     PYTHON_FOR_BUILD=$PYTHON
8993 if test "$with_lxml" != no; then
8994     if test -z "$PYTHON_FOR_BUILD"; then
8995         case $build_os in
8996             cygwin)
8997                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8998                 ;;
8999             *)
9000                 if test "$cross_compiling" != yes ; then
9001                     BUILD_TYPE="$BUILD_TYPE LXML"
9002                 fi
9003                 ;;
9004         esac
9005     else
9006         AC_MSG_CHECKING([for python lxml])
9007         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9008             AC_MSG_RESULT([yes])
9009         else
9010             case $build_os in
9011                 cygwin)
9012                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9013                     ;;
9014                 *)
9015                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9016                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9017                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9018                         else
9019                             BUILD_TYPE="$BUILD_TYPE LXML"
9020                             AC_MSG_RESULT([no, using internal lxml])
9021                         fi
9022                     else
9023                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9024                     fi
9025                     ;;
9026             esac
9027         fi
9028     fi
9031 dnl By now enable_python should be "system", "internal" or "no"
9032 case $enable_python in
9033 system)
9034     SYSTEM_PYTHON=TRUE
9036     if test "x$ac_cv_header_Python_h" != "xyes"; then
9037        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9038     fi
9040     AC_LANG_PUSH(C)
9041     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9042     AC_MSG_CHECKING([for correct python library version])
9043        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9044 #include <Python.h>
9046 int main(int argc, char **argv) {
9047    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9048    else return 1;
9050        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9051     CFLAGS=$save_CFLAGS
9052     AC_LANG_POP(C)
9054     dnl FIXME Check if the Python library can be linked with, too?
9055     ;;
9057 internal)
9058     SYSTEM_PYTHON=
9059     PYTHON_VERSION_MAJOR=3
9060     PYTHON_VERSION_MINOR=7
9061     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
9062     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9063         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9064     fi
9065     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9066     BUILD_TYPE="$BUILD_TYPE PYTHON"
9067     if test "$OS" = LINUX; then
9068         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9069     fi
9070     # Embedded Python dies without Home set
9071     if test "$HOME" = ""; then
9072         export HOME=""
9073     fi
9074     ;;
9076     DISABLE_PYTHON=TRUE
9077     SYSTEM_PYTHON=
9078     ;;
9080     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9081     ;;
9082 esac
9084 AC_SUBST(DISABLE_PYTHON)
9085 AC_SUBST(SYSTEM_PYTHON)
9086 AC_SUBST(PYTHON_CFLAGS)
9087 AC_SUBST(PYTHON_LIBS)
9088 AC_SUBST(PYTHON_VERSION)
9089 AC_SUBST(PYTHON_VERSION_MAJOR)
9090 AC_SUBST(PYTHON_VERSION_MINOR)
9092 ENABLE_MARIADBC=TRUE
9093 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
9094     ENABLE_MARIADBC=
9096 MARIADBC_MAJOR=1
9097 MARIADBC_MINOR=0
9098 MARIADBC_MICRO=2
9099 if test "$ENABLE_MARIADBC" = "TRUE"; then
9100     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9103 AC_SUBST(ENABLE_MARIADBC)
9104 AC_SUBST(MARIADBC_MAJOR)
9105 AC_SUBST(MARIADBC_MINOR)
9106 AC_SUBST(MARIADBC_MICRO)
9108 if test "$ENABLE_MARIADBC" = "TRUE"; then
9109     dnl ===================================================================
9110     dnl Check for system MariaDB
9111     dnl ===================================================================
9112     AC_MSG_CHECKING([which MariaDB to use])
9113     if test "$with_system_mariadb" = "yes"; then
9114         AC_MSG_RESULT([external])
9115         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9116         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9117         if test -z "$MARIADBCONFIG"; then
9118             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9119             if test -z "$MARIADBCONFIG"; then
9120                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9121                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9122             fi
9123         fi
9124         AC_MSG_CHECKING([MariaDB version])
9125         MARIADB_VERSION=`$MARIADBCONFIG --version`
9126         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9127         if test "$MARIADB_MAJOR" -ge "5"; then
9128             AC_MSG_RESULT([OK])
9129         else
9130             AC_MSG_ERROR([too old, use 5.0.x or later])
9131         fi
9132         AC_MSG_CHECKING([for MariaDB Client library])
9133         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9134         if test "$COM_IS_CLANG" = TRUE; then
9135             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9136         fi
9137         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9138         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9139         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9140         dnl linux32:
9141         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9142             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9143             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9144                 | sed -e 's|/lib64/|/lib/|')
9145         fi
9146         FilterLibs "${MARIADB_LIBS}"
9147         MARIADB_LIBS="${filteredlibs}"
9148         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9149         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9150         if test "$enable_bundle_mariadb" = "yes"; then
9151             AC_MSG_RESULT([yes])
9152             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9153             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9155 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9157 /g' | grep -E '(mysqlclient|mariadb)')
9158             if test "$_os" = "Darwin"; then
9159                 LIBMARIADB=${LIBMARIADB}.dylib
9160             elif test "$_os" = "WINNT"; then
9161                 LIBMARIADB=${LIBMARIADB}.dll
9162             else
9163                 LIBMARIADB=${LIBMARIADB}.so
9164             fi
9165             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9166             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9167             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9168                 AC_MSG_RESULT([found.])
9169                 PathFormat "$LIBMARIADB_PATH"
9170                 LIBMARIADB_PATH="$formatted_path"
9171             else
9172                 AC_MSG_ERROR([not found.])
9173             fi
9174         else
9175             AC_MSG_RESULT([no])
9176             BUNDLE_MARIADB_CONNECTOR_C=
9177         fi
9178     else
9179         AC_MSG_RESULT([internal])
9180         SYSTEM_MARIADB_CONNECTOR_C=
9181         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9182         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9183         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9184     fi
9186     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9187     AC_SUBST(MARIADB_CFLAGS)
9188     AC_SUBST(MARIADB_LIBS)
9189     AC_SUBST(LIBMARIADB)
9190     AC_SUBST(LIBMARIADB_PATH)
9191     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9194 dnl ===================================================================
9195 dnl Check for system hsqldb
9196 dnl ===================================================================
9197 if test "$with_java" != "no"; then
9198     HSQLDB_USE_JDBC_4_1=
9199     AC_MSG_CHECKING([which hsqldb to use])
9200     if test "$with_system_hsqldb" = "yes"; then
9201         AC_MSG_RESULT([external])
9202         SYSTEM_HSQLDB=TRUE
9203         if test -z $HSQLDB_JAR; then
9204             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9205         fi
9206         if ! test -f $HSQLDB_JAR; then
9207                AC_MSG_ERROR(hsqldb.jar not found.)
9208         fi
9209         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9210         export HSQLDB_JAR
9211         if $PERL -e \
9212            'use Archive::Zip;
9213             my $file = "$ENV{'HSQLDB_JAR'}";
9214             my $zip = Archive::Zip->new( $file );
9215             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9216             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9217             {
9218                 push @l, split(/\n/, $mf);
9219                 foreach my $line (@l)
9220                 {
9221                     if ($line =~ m/Specification-Version:/)
9222                     {
9223                         ($t, $version) = split (/:/,$line);
9224                         $version =~ s/^\s//;
9225                         ($a, $b, $c, $d) = split (/\./,$version);
9226                         if ($c == "0" && $d > "8")
9227                         {
9228                             exit 0;
9229                         }
9230                         else
9231                         {
9232                             exit 1;
9233                         }
9234                     }
9235                 }
9236             }
9237             else
9238             {
9239                 exit 1;
9240             }'; then
9241             AC_MSG_RESULT([yes])
9242         else
9243             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9244         fi
9245     else
9246         AC_MSG_RESULT([internal])
9247         SYSTEM_HSQLDB=
9248         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9249         NEED_ANT=TRUE
9250         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9251         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9252         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9253             AC_MSG_RESULT([yes])
9254             HSQLDB_USE_JDBC_4_1=TRUE
9255         else
9256             AC_MSG_RESULT([no])
9257         fi
9258     fi
9259     AC_SUBST(SYSTEM_HSQLDB)
9260     AC_SUBST(HSQLDB_JAR)
9261     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9264 dnl ===================================================================
9265 dnl Check for PostgreSQL stuff
9266 dnl ===================================================================
9267 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9268 if test "x$enable_postgresql_sdbc" != "xno"; then
9269     AC_MSG_RESULT([yes])
9270     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9272     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9273         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9274     fi
9275     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9276         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9277     fi
9279     postgres_interface=""
9280     if test "$with_system_postgresql" = "yes"; then
9281         postgres_interface="external PostgreSQL"
9282         SYSTEM_POSTGRESQL=TRUE
9283         if test "$_os" = Darwin; then
9284             supp_path=''
9285             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9286                 pg_supp_path="$P_SEP$d$pg_supp_path"
9287             done
9288         fi
9289         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9290         if test -n "$PGCONFIG"; then
9291             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9292             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9293         else
9294             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9295               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9296               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9297             ],[
9298               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9299             ])
9300         fi
9301         FilterLibs "${POSTGRESQL_LIB}"
9302         POSTGRESQL_LIB="${filteredlibs}"
9303     else
9304         # if/when anything else than PostgreSQL uses Kerberos,
9305         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9306         WITH_KRB5=
9307         WITH_GSSAPI=
9308         case "$_os" in
9309         Darwin)
9310             # macOS has system MIT Kerberos 5 since 10.4
9311             if test "$with_krb5" != "no"; then
9312                 WITH_KRB5=TRUE
9313                 save_LIBS=$LIBS
9314                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9315                 # that the libraries where these functions are located on macOS will change, is it?
9316                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9317                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9318                 KRB5_LIBS=$LIBS
9319                 LIBS=$save_LIBS
9320                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9321                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9322                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9323                 LIBS=$save_LIBS
9324             fi
9325             if test "$with_gssapi" != "no"; then
9326                 WITH_GSSAPI=TRUE
9327                 save_LIBS=$LIBS
9328                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9329                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9330                 GSSAPI_LIBS=$LIBS
9331                 LIBS=$save_LIBS
9332             fi
9333             ;;
9334         WINNT)
9335             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9336                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9337             fi
9338             ;;
9339         Linux|GNU|*BSD|DragonFly)
9340             if test "$with_krb5" != "no"; then
9341                 WITH_KRB5=TRUE
9342                 save_LIBS=$LIBS
9343                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9344                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9345                 KRB5_LIBS=$LIBS
9346                 LIBS=$save_LIBS
9347                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9348                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9349                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9350                 LIBS=$save_LIBS
9351             fi
9352             if test "$with_gssapi" != "no"; then
9353                 WITH_GSSAPI=TRUE
9354                 save_LIBS=$LIBS
9355                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9356                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9357                 GSSAPI_LIBS=$LIBS
9358                 LIBS=$save_LIBS
9359             fi
9360             ;;
9361         *)
9362             if test "$with_krb5" = "yes"; then
9363                 WITH_KRB5=TRUE
9364                 save_LIBS=$LIBS
9365                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9366                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9367                 KRB5_LIBS=$LIBS
9368                 LIBS=$save_LIBS
9369                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9370                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9371                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9372                 LIBS=$save_LIBS
9373             fi
9374             if test "$with_gssapi" = "yes"; then
9375                 WITH_GSSAPI=TRUE
9376                 save_LIBS=$LIBS
9377                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9378                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9379                 LIBS=$save_LIBS
9380                 GSSAPI_LIBS=$LIBS
9381             fi
9382         esac
9384         if test -n "$with_libpq_path"; then
9385             SYSTEM_POSTGRESQL=TRUE
9386             postgres_interface="external libpq"
9387             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9388             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9389         else
9390             SYSTEM_POSTGRESQL=
9391             postgres_interface="internal"
9392             POSTGRESQL_LIB=""
9393             POSTGRESQL_INC="%OVERRIDE_ME%"
9394             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9395         fi
9396     fi
9398     AC_MSG_CHECKING([PostgreSQL C interface])
9399     AC_MSG_RESULT([$postgres_interface])
9401     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9402         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9403         save_CFLAGS=$CFLAGS
9404         save_CPPFLAGS=$CPPFLAGS
9405         save_LIBS=$LIBS
9406         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9407         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9408         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9409         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9410             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9411         CFLAGS=$save_CFLAGS
9412         CPPFLAGS=$save_CPPFLAGS
9413         LIBS=$save_LIBS
9414     fi
9415     BUILD_POSTGRESQL_SDBC=TRUE
9416 else
9417     AC_MSG_RESULT([no])
9419 AC_SUBST(WITH_KRB5)
9420 AC_SUBST(WITH_GSSAPI)
9421 AC_SUBST(GSSAPI_LIBS)
9422 AC_SUBST(KRB5_LIBS)
9423 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9424 AC_SUBST(SYSTEM_POSTGRESQL)
9425 AC_SUBST(POSTGRESQL_INC)
9426 AC_SUBST(POSTGRESQL_LIB)
9428 dnl ===================================================================
9429 dnl Check for Firebird stuff
9430 dnl ===================================================================
9431 ENABLE_FIREBIRD_SDBC=
9432 if test "$enable_firebird_sdbc" = "yes" ; then
9433     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9435     dnl ===================================================================
9436     dnl Check for system Firebird
9437     dnl ===================================================================
9438     AC_MSG_CHECKING([which Firebird to use])
9439     if test "$with_system_firebird" = "yes"; then
9440         AC_MSG_RESULT([external])
9441         SYSTEM_FIREBIRD=TRUE
9442         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9443         if test -z "$FIREBIRDCONFIG"; then
9444             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9445             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9446                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9447             ])
9448             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9449         else
9450             AC_MSG_NOTICE([fb_config found])
9451             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9452             AC_MSG_CHECKING([for Firebird Client library])
9453             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9454             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9455             FilterLibs "${FIREBIRD_LIBS}"
9456             FIREBIRD_LIBS="${filteredlibs}"
9457         fi
9458         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9459         AC_MSG_CHECKING([Firebird version])
9460         if test -n "${FIREBIRD_VERSION}"; then
9461             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9462             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9463             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9464                 AC_MSG_RESULT([OK])
9465             else
9466                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9467             fi
9468         else
9469             __save_CFLAGS="${CFLAGS}"
9470             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9471             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9472 #if defined(FB_API_VER) && FB_API_VER == 30
9473 int fb_api_is_30(void) { return 0; }
9474 #else
9475 #error "Wrong Firebird API version"
9476 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9477             CFLAGS="${__save_CFLAGS}"
9478         fi
9479         ENABLE_FIREBIRD_SDBC=TRUE
9480         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9481     elif test "$enable_database_connectivity" != yes; then
9482         AC_MSG_RESULT([none])
9483     elif test "$cross_compiling" = "yes"; then
9484         AC_MSG_RESULT([none])
9485     else
9486         dnl Embedded Firebird has version 3.0
9487         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9488         dnl We need libatomic_ops for any non X86/X64 system
9489         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9490             dnl ===================================================================
9491             dnl Check for system libatomic_ops
9492             dnl ===================================================================
9493             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9494             if test "$with_system_libatomic_ops" = "yes"; then
9495                 SYSTEM_LIBATOMIC_OPS=TRUE
9496                 AC_CHECK_HEADERS(atomic_ops.h, [],
9497                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9498             else
9499                 SYSTEM_LIBATOMIC_OPS=
9500                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9501                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9502                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9503             fi
9504         fi
9506         AC_MSG_RESULT([internal])
9507         SYSTEM_FIREBIRD=
9508         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9509         FIREBIRD_LIBS="-lfbclient"
9511         if test "$with_system_libtommath" = "yes"; then
9512             SYSTEM_LIBTOMMATH=TRUE
9513             dnl check for tommath presence
9514             save_LIBS=$LIBS
9515             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9516             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9517             LIBS=$save_LIBS
9518         else
9519             SYSTEM_LIBTOMMATH=
9520             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9521             LIBTOMMATH_LIBS="-ltommath"
9522             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9523         fi
9525         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9526         ENABLE_FIREBIRD_SDBC=TRUE
9527         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9528     fi
9530 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9531 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9532 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9533 AC_SUBST(LIBATOMIC_OPS_LIBS)
9534 AC_SUBST(SYSTEM_FIREBIRD)
9535 AC_SUBST(FIREBIRD_CFLAGS)
9536 AC_SUBST(FIREBIRD_LIBS)
9537 AC_SUBST([TOMMATH_CFLAGS])
9538 AC_SUBST([TOMMATH_LIBS])
9540 dnl ===================================================================
9541 dnl Check for system curl
9542 dnl ===================================================================
9543 AC_MSG_CHECKING([which libcurl to use])
9544 if test "$with_system_curl" = "auto"; then
9545     with_system_curl="$with_system_libs"
9548 if test "$with_system_curl" = "yes"; then
9549     AC_MSG_RESULT([external])
9550     SYSTEM_CURL=TRUE
9552     # First try PKGCONFIG and then fall back
9553     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9555     if test -n "$CURL_PKG_ERRORS"; then
9556         AC_PATH_PROG(CURLCONFIG, curl-config)
9557         if test -z "$CURLCONFIG"; then
9558             AC_MSG_ERROR([curl development files not found])
9559         fi
9560         CURL_LIBS=`$CURLCONFIG --libs`
9561         FilterLibs "${CURL_LIBS}"
9562         CURL_LIBS="${filteredlibs}"
9563         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9564         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9566         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9567         case $curl_version in
9568         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9569         dnl so they need to be doubled to end up in the configure script
9570         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9571             AC_MSG_RESULT([yes])
9572             ;;
9573         *)
9574             AC_MSG_ERROR([no, you have $curl_version])
9575             ;;
9576         esac
9577     fi
9579     ENABLE_CURL=TRUE
9580 elif test $_os = iOS; then
9581     # Let's see if we need curl, I think not?
9582     AC_MSG_RESULT([none])
9583     ENABLE_CURL=
9584 else
9585     AC_MSG_RESULT([internal])
9586     SYSTEM_CURL=
9587     BUILD_TYPE="$BUILD_TYPE CURL"
9588     ENABLE_CURL=TRUE
9590 AC_SUBST(SYSTEM_CURL)
9591 AC_SUBST(CURL_CFLAGS)
9592 AC_SUBST(CURL_LIBS)
9593 AC_SUBST(ENABLE_CURL)
9595 dnl ===================================================================
9596 dnl Check for system boost
9597 dnl ===================================================================
9598 AC_MSG_CHECKING([which boost to use])
9599 if test "$with_system_boost" = "yes"; then
9600     AC_MSG_RESULT([external])
9601     SYSTEM_BOOST=TRUE
9602     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
9603     AX_BOOST_DATE_TIME
9604     AX_BOOST_FILESYSTEM
9605     AX_BOOST_IOSTREAMS
9606     AX_BOOST_LOCALE
9607     AC_LANG_PUSH([C++])
9608     save_CXXFLAGS=$CXXFLAGS
9609     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9610     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9611        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9612     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9613        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9614     CXXFLAGS=$save_CXXFLAGS
9615     AC_LANG_POP([C++])
9616     # this is in m4/ax_boost_base.m4
9617     FilterLibs "${BOOST_LDFLAGS}"
9618     BOOST_LDFLAGS="${filteredlibs}"
9619 else
9620     AC_MSG_RESULT([internal])
9621     BUILD_TYPE="$BUILD_TYPE BOOST"
9622     SYSTEM_BOOST=
9623     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9624         # use warning-suppressing wrapper headers
9625         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9626     else
9627         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9628     fi
9630 AC_SUBST(SYSTEM_BOOST)
9632 dnl ===================================================================
9633 dnl Check for system mdds
9634 dnl ===================================================================
9635 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9637 dnl ===================================================================
9638 dnl Check for system glm
9639 dnl ===================================================================
9640 AC_MSG_CHECKING([which glm to use])
9641 if test "$with_system_glm" = "yes"; then
9642     AC_MSG_RESULT([external])
9643     SYSTEM_GLM=TRUE
9644     AC_LANG_PUSH([C++])
9645     AC_CHECK_HEADER([glm/glm.hpp], [],
9646        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9647     AC_LANG_POP([C++])
9648 else
9649     AC_MSG_RESULT([internal])
9650     BUILD_TYPE="$BUILD_TYPE GLM"
9651     SYSTEM_GLM=
9652     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9654 AC_SUBST([GLM_CFLAGS])
9655 AC_SUBST([SYSTEM_GLM])
9657 dnl ===================================================================
9658 dnl Check for system odbc
9659 dnl ===================================================================
9660 AC_MSG_CHECKING([which odbc headers to use])
9661 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
9662     AC_MSG_RESULT([external])
9663     SYSTEM_ODBC_HEADERS=TRUE
9665     if test "$build_os" = "cygwin"; then
9666         save_CPPFLAGS=$CPPFLAGS
9667         find_winsdk
9668         PathFormat "$winsdktest"
9669         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"
9670         AC_CHECK_HEADER(sqlext.h, [],
9671             [AC_MSG_ERROR(odbc not found. install odbc)],
9672             [#include <windows.h>])
9673         CPPFLAGS=$save_CPPFLAGS
9674     else
9675         AC_CHECK_HEADER(sqlext.h, [],
9676             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9677     fi
9678 elif test "$enable_database_connectivity" != yes; then
9679     AC_MSG_RESULT([none])
9680 else
9681     AC_MSG_RESULT([internal])
9682     SYSTEM_ODBC_HEADERS=
9684 AC_SUBST(SYSTEM_ODBC_HEADERS)
9686 dnl ===================================================================
9687 dnl Enable LDAP support
9688 dnl ===================================================================
9690 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9691 AC_MSG_CHECKING([whether to enable LDAP support])
9692     if test "$enable_ldap" != "yes"; then
9693         AC_MSG_RESULT([no])
9694         ENABLE_LDAP=""
9695         enable_ldap=no
9696     else
9697         AC_MSG_RESULT([yes])
9698         ENABLE_LDAP="TRUE"
9699     fi
9701 AC_SUBST(ENABLE_LDAP)
9703 dnl ===================================================================
9704 dnl Check for system openldap
9705 dnl ===================================================================
9707 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9708 AC_MSG_CHECKING([which openldap library to use])
9709 if test "$with_system_openldap" = "yes"; then
9710     AC_MSG_RESULT([external])
9711     SYSTEM_OPENLDAP=TRUE
9712     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9713     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9714     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9715 else
9716     AC_MSG_RESULT([internal])
9717     SYSTEM_OPENLDAP=
9718     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9721 AC_SUBST(SYSTEM_OPENLDAP)
9723 dnl ===================================================================
9724 dnl Check for system NSS
9725 dnl ===================================================================
9726 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9727     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9728     AC_DEFINE(HAVE_FEATURE_NSS)
9729     ENABLE_NSS="TRUE"
9730     AC_DEFINE(ENABLE_NSS)
9731 elif test $_os != iOS ; then
9732     with_tls=openssl
9734 AC_SUBST(ENABLE_NSS)
9736 dnl ===================================================================
9737 dnl Check for TLS/SSL and cryptographic implementation to use
9738 dnl ===================================================================
9739 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9740 if test -n "$with_tls"; then
9741     case $with_tls in
9742     openssl)
9743         AC_DEFINE(USE_TLS_OPENSSL)
9744         TLS=OPENSSL
9746         if test "$enable_openssl" != "yes"; then
9747             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9748         fi
9750         # warn that OpenSSL has been selected but not all TLS code has this option
9751         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9752         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9753         ;;
9754     nss)
9755         AC_DEFINE(USE_TLS_NSS)
9756         TLS=NSS
9757         ;;
9758     no)
9759         AC_MSG_WARN([Skipping TLS/SSL])
9760         ;;
9761     *)
9762         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9763 openssl - OpenSSL
9764 nss - Mozilla's Network Security Services (NSS)
9765     ])
9766         ;;
9767     esac
9768 else
9769     # default to using NSS, it results in smaller oox lib
9770     AC_DEFINE(USE_TLS_NSS)
9771     TLS=NSS
9773 AC_MSG_RESULT([$TLS])
9774 AC_SUBST(TLS)
9776 dnl ===================================================================
9777 dnl Check for system sane
9778 dnl ===================================================================
9779 AC_MSG_CHECKING([which sane header to use])
9780 if test "$with_system_sane" = "yes"; then
9781     AC_MSG_RESULT([external])
9782     AC_CHECK_HEADER(sane/sane.h, [],
9783       [AC_MSG_ERROR(sane not found. install sane)], [])
9784 else
9785     AC_MSG_RESULT([internal])
9786     BUILD_TYPE="$BUILD_TYPE SANE"
9789 dnl ===================================================================
9790 dnl Check for system icu
9791 dnl ===================================================================
9792 SYSTEM_GENBRK=
9793 SYSTEM_GENCCODE=
9794 SYSTEM_GENCMN=
9796 ICU_MAJOR=67
9797 ICU_MINOR=1
9798 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9799 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9800 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9801 AC_MSG_CHECKING([which icu to use])
9802 if test "$with_system_icu" = "yes"; then
9803     AC_MSG_RESULT([external])
9804     SYSTEM_ICU=TRUE
9805     AC_LANG_PUSH([C++])
9806     AC_MSG_CHECKING([for unicode/rbbi.h])
9807     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9808     AC_LANG_POP([C++])
9810     if test "$cross_compiling" != "yes"; then
9811         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9812         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9813         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9814         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9815     fi
9817     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9818         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9819         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9820         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9821         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9822         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9823             AC_MSG_RESULT([yes])
9824         else
9825             AC_MSG_RESULT([no])
9826             if test "$with_system_icu_for_build" != "force"; then
9827                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9828 You can use --with-system-icu-for-build=force to use it anyway.])
9829             fi
9830         fi
9831     fi
9833     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9834         # using the system icu tools can lead to version confusion, use the
9835         # ones from the build environment when cross-compiling
9836         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9837         if test -z "$SYSTEM_GENBRK"; then
9838             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9839         fi
9840         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9841         if test -z "$SYSTEM_GENCCODE"; then
9842             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9843         fi
9844         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9845         if test -z "$SYSTEM_GENCMN"; then
9846             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9847         fi
9848         if test "$ICU_MAJOR" -ge "49"; then
9849             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9850             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9851             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9852         else
9853             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9854             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9855             ICU_RECLASSIFIED_HEBREW_LETTER=
9856         fi
9857     fi
9859     if test "$cross_compiling" = "yes"; then
9860         if test "$ICU_MAJOR" -ge "50"; then
9861             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9862             ICU_MINOR=""
9863         fi
9864     fi
9865 else
9866     AC_MSG_RESULT([internal])
9867     SYSTEM_ICU=
9868     BUILD_TYPE="$BUILD_TYPE ICU"
9869     # surprisingly set these only for "internal" (to be used by various other
9870     # external libs): the system icu-config is quite unhelpful and spits out
9871     # dozens of weird flags and also default path -I/usr/include
9872     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9873     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9875 if test "$ICU_MAJOR" -ge "59"; then
9876     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9877     # with -std=c++11 but not all external libraries can be built with that,
9878     # for those use a bit-compatible typedef uint16_t UChar; see
9879     # icu/source/common/unicode/umachine.h
9880     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9881 else
9882     ICU_UCHAR_TYPE=""
9884 AC_SUBST(SYSTEM_ICU)
9885 AC_SUBST(SYSTEM_GENBRK)
9886 AC_SUBST(SYSTEM_GENCCODE)
9887 AC_SUBST(SYSTEM_GENCMN)
9888 AC_SUBST(ICU_MAJOR)
9889 AC_SUBST(ICU_MINOR)
9890 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9891 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9892 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9893 AC_SUBST(ICU_CFLAGS)
9894 AC_SUBST(ICU_LIBS)
9895 AC_SUBST(ICU_UCHAR_TYPE)
9897 dnl ==================================================================
9898 dnl Breakpad
9899 dnl ==================================================================
9900 DEFAULT_CRASHDUMP_VALUE="true"
9901 AC_MSG_CHECKING([whether to enable breakpad])
9902 if test "$enable_breakpad" != yes; then
9903     AC_MSG_RESULT([no])
9904 else
9905     AC_MSG_RESULT([yes])
9906     ENABLE_BREAKPAD="TRUE"
9907     AC_DEFINE(ENABLE_BREAKPAD)
9908     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9909     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9911     AC_MSG_CHECKING([for disable crash dump])
9912     if test "$enable_crashdump" = no; then
9913         DEFAULT_CRASHDUMP_VALUE="false"
9914         AC_MSG_RESULT([yes])
9915     else
9916        AC_MSG_RESULT([no])
9917     fi
9919     AC_MSG_CHECKING([for crashreport config])
9920     if test "$with_symbol_config" = "no"; then
9921         BREAKPAD_SYMBOL_CONFIG="invalid"
9922         AC_MSG_RESULT([no])
9923     else
9924         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9925         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9926         AC_MSG_RESULT([yes])
9927     fi
9928     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9930 AC_SUBST(ENABLE_BREAKPAD)
9931 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9933 dnl ==================================================================
9934 dnl libfuzzer
9935 dnl ==================================================================
9936 AC_MSG_CHECKING([whether to enable fuzzers])
9937 if test "$enable_fuzzers" != yes; then
9938     AC_MSG_RESULT([no])
9939 else
9940     AC_MSG_RESULT([yes])
9941     ENABLE_FUZZERS="TRUE"
9942     AC_DEFINE([ENABLE_FUZZERS],1)
9943     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9945 AC_SUBST(ENABLE_FUZZERS)
9947 dnl ===================================================================
9948 dnl Orcus
9949 dnl ===================================================================
9950 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9951 if test "$with_system_orcus" != "yes"; then
9952     if test "$SYSTEM_BOOST" = "TRUE"; then
9953         # ===========================================================
9954         # Determine if we are going to need to link with Boost.System
9955         # ===========================================================
9956         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9957         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9958         dnl in documentation has no effect.
9959         AC_MSG_CHECKING([if we need to link with Boost.System])
9960         AC_LANG_PUSH([C++])
9961         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9962                 @%:@include <boost/version.hpp>
9963             ]],[[
9964                 #if BOOST_VERSION >= 105000
9965                 #   error yes, we need to link with Boost.System
9966                 #endif
9967             ]])],[
9968                 AC_MSG_RESULT([no])
9969             ],[
9970                 AC_MSG_RESULT([yes])
9971                 AX_BOOST_SYSTEM
9972         ])
9973         AC_LANG_POP([C++])
9974     fi
9976 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9977 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9978 AC_SUBST([BOOST_SYSTEM_LIB])
9979 AC_SUBST(SYSTEM_LIBORCUS)
9981 dnl ===================================================================
9982 dnl HarfBuzz
9983 dnl ===================================================================
9984 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9985                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9986                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9988 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9989                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9990                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9992 if test "$COM" = "MSC"; then # override the above
9993     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9994     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9997 if test "$with_system_harfbuzz" = "yes"; then
9998     if test "$with_system_graphite" = "no"; then
9999         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10000     fi
10001     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10002     _save_libs="$LIBS"
10003     _save_cflags="$CFLAGS"
10004     LIBS="$LIBS $HARFBUZZ_LIBS"
10005     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10006     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10007     LIBS="$_save_libs"
10008     CFLAGS="$_save_cflags"
10009 else
10010     if test "$with_system_graphite" = "yes"; then
10011         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10012     fi
10015 AC_MSG_CHECKING([whether to use X11])
10016 dnl ***************************************
10017 dnl testing for X libraries and includes...
10018 dnl ***************************************
10019 if test "$USING_X11" = TRUE; then
10020     AC_DEFINE(HAVE_FEATURE_X11)
10022 AC_MSG_RESULT([$USING_X11])
10024 if test "$USING_X11" = TRUE; then
10025     AC_PATH_X
10026     AC_PATH_XTRA
10027     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10029     if test -z "$x_includes"; then
10030         x_includes="default_x_includes"
10031     fi
10032     if test -z "$x_libraries"; then
10033         x_libraries="default_x_libraries"
10034     fi
10035     CFLAGS="$CFLAGS $X_CFLAGS"
10036     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10037     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10038 else
10039     x_includes="no_x_includes"
10040     x_libraries="no_x_libraries"
10043 if test "$USING_X11" = TRUE; then
10044     dnl ===================================================================
10045     dnl Check for extension headers
10046     dnl ===================================================================
10047     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10048      [#include <X11/extensions/shape.h>])
10050     # vcl needs ICE and SM
10051     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10052     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10053         [AC_MSG_ERROR(ICE library not found)])
10054     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10055     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10056         [AC_MSG_ERROR(SM library not found)])
10059 dnl ===================================================================
10060 dnl Check for system Xrender
10061 dnl ===================================================================
10062 AC_MSG_CHECKING([whether to use Xrender])
10063 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10064     AC_MSG_RESULT([yes])
10065     PKG_CHECK_MODULES(XRENDER, xrender)
10066     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10067     FilterLibs "${XRENDER_LIBS}"
10068     XRENDER_LIBS="${filteredlibs}"
10069     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10070       [AC_MSG_ERROR(libXrender not found or functional)], [])
10071     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10072       [AC_MSG_ERROR(Xrender not found. install X)], [])
10073 else
10074     AC_MSG_RESULT([no])
10076 AC_SUBST(XRENDER_CFLAGS)
10077 AC_SUBST(XRENDER_LIBS)
10079 dnl ===================================================================
10080 dnl Check for XRandr
10081 dnl ===================================================================
10082 AC_MSG_CHECKING([whether to enable RandR support])
10083 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10084     AC_MSG_RESULT([yes])
10085     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10086     if test "$ENABLE_RANDR" != "TRUE"; then
10087         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10088                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10089         XRANDR_CFLAGS=" "
10090         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10091           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10092         XRANDR_LIBS="-lXrandr "
10093         ENABLE_RANDR="TRUE"
10094     fi
10095     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10096     FilterLibs "${XRANDR_LIBS}"
10097     XRANDR_LIBS="${filteredlibs}"
10098 else
10099     ENABLE_RANDR=""
10100     AC_MSG_RESULT([no])
10102 AC_SUBST(XRANDR_CFLAGS)
10103 AC_SUBST(XRANDR_LIBS)
10104 AC_SUBST(ENABLE_RANDR)
10106 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10107     if test -z "$WITH_WEBDAV"; then
10108         WITH_WEBDAV="serf"
10109     fi
10111 if test $_os = iOS -o $_os = Android; then
10112     WITH_WEBDAV="no"
10114 AC_MSG_CHECKING([for webdav library])
10115 case "$WITH_WEBDAV" in
10116 serf)
10117     AC_MSG_RESULT([serf])
10118     # Check for system apr-util
10119     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10120                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10121                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10122     if test "$COM" = "MSC"; then
10123         APR_LIB_DIR="LibR"
10124         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10125         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10126     fi
10128     # Check for system serf
10129     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
10130                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
10131     if test "$COM" = "MSC"; then
10132         SERF_LIB_DIR="Release"
10133         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
10134         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
10135     fi
10136     ;;
10137 neon)
10138     AC_MSG_RESULT([neon])
10139     # Check for system neon
10140     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
10141     if test "$with_system_neon" = "yes"; then
10142         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10143     else
10144         NEON_VERSION=0295
10145     fi
10146     AC_SUBST(NEON_VERSION)
10147     ;;
10149     AC_MSG_RESULT([none, disabled])
10150     WITH_WEBDAV=""
10151     ;;
10152 esac
10153 AC_SUBST(WITH_WEBDAV)
10155 dnl ===================================================================
10156 dnl Check for disabling cve_tests
10157 dnl ===================================================================
10158 AC_MSG_CHECKING([whether to execute CVE tests])
10159 # If not explicitly enabled or disabled, default
10160 if test -z "$enable_cve_tests"; then
10161     case "$OS" in
10162     WNT)
10163         # Default cves off for Windows with its wild and wonderful
10164         # variety of AV software kicking in and panicking
10165         enable_cve_tests=no
10166         ;;
10167     *)
10168         # otherwise yes
10169         enable_cve_tests=yes
10170         ;;
10171     esac
10173 if test "$enable_cve_tests" = "no"; then
10174     AC_MSG_RESULT([no])
10175     DISABLE_CVE_TESTS=TRUE
10176     AC_SUBST(DISABLE_CVE_TESTS)
10177 else
10178     AC_MSG_RESULT([yes])
10181 dnl ===================================================================
10182 dnl Check for enabling chart XShape tests
10183 dnl ===================================================================
10184 AC_MSG_CHECKING([whether to execute chart XShape tests])
10185 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10186     AC_MSG_RESULT([yes])
10187     ENABLE_CHART_TESTS=TRUE
10188     AC_SUBST(ENABLE_CHART_TESTS)
10189 else
10190     AC_MSG_RESULT([no])
10193 dnl ===================================================================
10194 dnl Check for system openssl
10195 dnl ===================================================================
10196 DISABLE_OPENSSL=
10197 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10198 if test "$enable_openssl" = "yes"; then
10199     AC_MSG_RESULT([no])
10200     if test "$_os" = Darwin ; then
10201         # OpenSSL is deprecated when building for 10.7 or later.
10202         #
10203         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10204         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10206         with_system_openssl=no
10207         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10208     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10209             && test "$with_system_openssl" != "no"; then
10210         with_system_openssl=yes
10211         SYSTEM_OPENSSL=TRUE
10212         OPENSSL_CFLAGS=
10213         OPENSSL_LIBS="-lssl -lcrypto"
10214     else
10215         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10216     fi
10217     if test "$with_system_openssl" = "yes"; then
10218         AC_MSG_CHECKING([whether openssl supports SHA512])
10219         AC_LANG_PUSH([C])
10220         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10221             SHA512_CTX context;
10222 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10223         AC_LANG_POP(C)
10224     fi
10225 else
10226     AC_MSG_RESULT([yes])
10227     DISABLE_OPENSSL=TRUE
10229     # warn that although OpenSSL is disabled, system libraries may depend on it
10230     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10231     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10234 AC_SUBST([DISABLE_OPENSSL])
10236 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10237     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10238         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10239         enable_cipher_openssl_backend=no
10240     else
10241         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10242     fi
10244 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10245 ENABLE_CIPHER_OPENSSL_BACKEND=
10246 if test "$enable_cipher_openssl_backend" = yes; then
10247     AC_MSG_RESULT([yes])
10248     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10249 else
10250     AC_MSG_RESULT([no])
10252 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10254 dnl ===================================================================
10255 dnl Check for building gnutls
10256 dnl ===================================================================
10257 AC_MSG_CHECKING([whether to use gnutls])
10258 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10259     AC_MSG_RESULT([yes])
10260     AM_PATH_LIBGCRYPT()
10261     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10262         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10263                       available in the system to use as replacement.]]))
10264     FilterLibs "${LIBGCRYPT_LIBS}"
10265     LIBGCRYPT_LIBS="${filteredlibs}"
10266 else
10267     AC_MSG_RESULT([no])
10270 AC_SUBST([LIBGCRYPT_CFLAGS])
10271 AC_SUBST([LIBGCRYPT_LIBS])
10273 dnl ===================================================================
10274 dnl Check for system redland
10275 dnl ===================================================================
10276 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10277 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10278 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10279 if test "$with_system_redland" = "yes"; then
10280     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10281             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10282 else
10283     RAPTOR_MAJOR="0"
10284     RASQAL_MAJOR="3"
10285     REDLAND_MAJOR="0"
10287 AC_SUBST(RAPTOR_MAJOR)
10288 AC_SUBST(RASQAL_MAJOR)
10289 AC_SUBST(REDLAND_MAJOR)
10291 dnl ===================================================================
10292 dnl Check for system hunspell
10293 dnl ===================================================================
10294 AC_MSG_CHECKING([which libhunspell to use])
10295 if test "$_os" = iOS; then
10296    AC_MSG_RESULT([none])
10297 elif test "$with_system_hunspell" = "yes"; then
10298     AC_MSG_RESULT([external])
10299     SYSTEM_HUNSPELL=TRUE
10300     AC_LANG_PUSH([C++])
10301     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10302     if test "$HUNSPELL_PC" != "TRUE"; then
10303         AC_CHECK_HEADER(hunspell.hxx, [],
10304             [
10305             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10306             [AC_MSG_ERROR(hunspell headers not found.)], [])
10307             ], [])
10308         AC_CHECK_LIB([hunspell], [main], [:],
10309            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10310         HUNSPELL_LIBS=-lhunspell
10311     fi
10312     AC_LANG_POP([C++])
10313     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10314     FilterLibs "${HUNSPELL_LIBS}"
10315     HUNSPELL_LIBS="${filteredlibs}"
10316 else
10317     AC_MSG_RESULT([internal])
10318     SYSTEM_HUNSPELL=
10319     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10320     if test "$COM" = "MSC"; then
10321         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10322     else
10323         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10324     fi
10325     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10327 AC_SUBST(SYSTEM_HUNSPELL)
10328 AC_SUBST(HUNSPELL_CFLAGS)
10329 AC_SUBST(HUNSPELL_LIBS)
10331 dnl ===================================================================
10332 dnl Check for system qrcodegen
10333 dnl ===================================================================
10334 AC_MSG_CHECKING([whether to use libqrcodegen])
10335 if test "$enable_qrcodegen" = "no"; then
10336     AC_MSG_RESULT([no])
10337     ENABLE_QRCODEGEN=
10338     SYSTEM_QRCODEGEN=
10339 else
10340     AC_MSG_RESULT([yes])
10341     ENABLE_QRCODEGEN=TRUE
10342     AC_MSG_CHECKING([which libqrcodegen to use])
10343     if test "$with_system_qrcodegen" = "yes"; then
10344         AC_MSG_RESULT([external])
10345         SYSTEM_QRCODEGEN=TRUE
10346         AC_LANG_PUSH([C++])
10347         AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10348             [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10349         AC_CHECK_LIB([qrcodegencpp], [main], [:],
10350             [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10351         QRCODEGEN_LIBS=-lqrcodegencpp
10352         AC_LANG_POP([C++])
10353         QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10354         FilterLibs "${QRCODEGEN_LIBS}"
10355         QRCODEGEN_LIBS="${filteredlibs}"
10356     else
10357         AC_MSG_RESULT([internal])
10358         SYSTEM_QRCODEGEN=
10359         BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10360     fi
10361     if test "$ENABLE_QRCODEGEN" = TRUE; then
10362         AC_DEFINE(ENABLE_QRCODEGEN)
10363     fi
10365 AC_SUBST(SYSTEM_QRCODEGEN)
10366 AC_SUBST(ENABLE_QRCODEGEN)
10367 AC_SUBST(QRCODEGEN_CFLAGS)
10368 AC_SUBST(QRCODEGEN_LIBS)
10370 dnl ===================================================================
10371 dnl Checking for altlinuxhyph
10372 dnl ===================================================================
10373 AC_MSG_CHECKING([which altlinuxhyph to use])
10374 if test "$with_system_altlinuxhyph" = "yes"; then
10375     AC_MSG_RESULT([external])
10376     SYSTEM_HYPH=TRUE
10377     AC_CHECK_HEADER(hyphen.h, [],
10378        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10379     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10380        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10381        [#include <hyphen.h>])
10382     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10383         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10384     if test -z "$HYPHEN_LIB"; then
10385         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10386            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10387     fi
10388     if test -z "$HYPHEN_LIB"; then
10389         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10390            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10391     fi
10392 else
10393     AC_MSG_RESULT([internal])
10394     SYSTEM_HYPH=
10395     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10396     if test "$COM" = "MSC"; then
10397         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10398     else
10399         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10400     fi
10402 AC_SUBST(SYSTEM_HYPH)
10403 AC_SUBST(HYPHEN_LIB)
10405 dnl ===================================================================
10406 dnl Checking for mythes
10407 dnl ===================================================================
10408 AC_MSG_CHECKING([which mythes to use])
10409 if test "$_os" = iOS; then
10410    AC_MSG_RESULT([none])
10411 elif test "$with_system_mythes" = "yes"; then
10412     AC_MSG_RESULT([external])
10413     SYSTEM_MYTHES=TRUE
10414     AC_LANG_PUSH([C++])
10415     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10416     if test "$MYTHES_PKGCONFIG" = "no"; then
10417         AC_CHECK_HEADER(mythes.hxx, [],
10418             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10419         AC_CHECK_LIB([mythes-1.2], [main], [:],
10420             [ MYTHES_FOUND=no], [])
10421     if test "$MYTHES_FOUND" = "no"; then
10422         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10423                 [ MYTHES_FOUND=no], [])
10424     fi
10425     if test "$MYTHES_FOUND" = "no"; then
10426         AC_MSG_ERROR([mythes library not found!.])
10427     fi
10428     fi
10429     AC_LANG_POP([C++])
10430     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10431     FilterLibs "${MYTHES_LIBS}"
10432     MYTHES_LIBS="${filteredlibs}"
10433 else
10434     AC_MSG_RESULT([internal])
10435     SYSTEM_MYTHES=
10436     BUILD_TYPE="$BUILD_TYPE MYTHES"
10437     if test "$COM" = "MSC"; then
10438         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10439     else
10440         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10441     fi
10443 AC_SUBST(SYSTEM_MYTHES)
10444 AC_SUBST(MYTHES_CFLAGS)
10445 AC_SUBST(MYTHES_LIBS)
10447 dnl ===================================================================
10448 dnl How should we build the linear programming solver ?
10449 dnl ===================================================================
10451 ENABLE_COINMP=
10452 AC_MSG_CHECKING([whether to build with CoinMP])
10453 if test "$enable_coinmp" != "no"; then
10454     ENABLE_COINMP=TRUE
10455     AC_MSG_RESULT([yes])
10456     if test "$with_system_coinmp" = "yes"; then
10457         SYSTEM_COINMP=TRUE
10458         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10459         FilterLibs "${COINMP_LIBS}"
10460         COINMP_LIBS="${filteredlibs}"
10461     else
10462         BUILD_TYPE="$BUILD_TYPE COINMP"
10463     fi
10464 else
10465     AC_MSG_RESULT([no])
10467 AC_SUBST(ENABLE_COINMP)
10468 AC_SUBST(SYSTEM_COINMP)
10469 AC_SUBST(COINMP_CFLAGS)
10470 AC_SUBST(COINMP_LIBS)
10472 ENABLE_LPSOLVE=
10473 AC_MSG_CHECKING([whether to build with lpsolve])
10474 if test "$enable_lpsolve" != "no"; then
10475     ENABLE_LPSOLVE=TRUE
10476     AC_MSG_RESULT([yes])
10477 else
10478     AC_MSG_RESULT([no])
10480 AC_SUBST(ENABLE_LPSOLVE)
10482 if test "$ENABLE_LPSOLVE" = TRUE; then
10483     AC_MSG_CHECKING([which lpsolve to use])
10484     if test "$with_system_lpsolve" = "yes"; then
10485         AC_MSG_RESULT([external])
10486         SYSTEM_LPSOLVE=TRUE
10487         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10488            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10489         save_LIBS=$LIBS
10490         # some systems need this. Like Ubuntu...
10491         AC_CHECK_LIB(m, floor)
10492         AC_CHECK_LIB(dl, dlopen)
10493         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10494             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10495         LIBS=$save_LIBS
10496     else
10497         AC_MSG_RESULT([internal])
10498         SYSTEM_LPSOLVE=
10499         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10500     fi
10502 AC_SUBST(SYSTEM_LPSOLVE)
10504 dnl ===================================================================
10505 dnl Checking for libexttextcat
10506 dnl ===================================================================
10507 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10508 if test "$with_system_libexttextcat" = "yes"; then
10509     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10511 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10513 dnl ===================================================================
10514 dnl Checking for libnumbertext
10515 dnl ===================================================================
10516 AC_MSG_CHECKING([whether to use libnumbertext])
10517 if test "$enable_libnumbertext" = "no"; then
10518     AC_MSG_RESULT([no])
10519     ENABLE_LIBNUMBERTEXT=
10520     SYSTEM_LIBNUMBERTEXT=
10521 else
10522     AC_MSG_RESULT([yes])
10523     ENABLE_LIBNUMBERTEXT=TRUE
10524     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
10525     if test "$with_system_libnumbertext" = "yes"; then
10526         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10527         SYSTEM_LIBNUMBERTEXT=YES
10528     else
10529         SYSTEM_LIBNUMBERTEXT=
10530         AC_LANG_PUSH([C++])
10531         save_CPPFLAGS=$CPPFLAGS
10532         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10533         AC_CHECK_HEADERS([codecvt regex])
10534         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10535                 [ ENABLE_LIBNUMBERTEXT=''
10536                   LIBNUMBERTEXT_CFLAGS=''
10537                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10538                                Enable libnumbertext fallback (missing number to number name conversion).])
10539                 ])
10540         CPPFLAGS=$save_CPPFLAGS
10541         AC_LANG_POP([C++])
10542     fi
10543     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10544         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10545     fi
10547 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10548 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10549 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10550 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10552 dnl ***************************************
10553 dnl testing libc version for Linux...
10554 dnl ***************************************
10555 if test "$_os" = "Linux"; then
10556     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10557     exec 6>/dev/null # no output
10558     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10559     exec 6>&1 # output on again
10560     if test "$HAVE_LIBC"; then
10561         AC_MSG_RESULT([yes])
10562     else
10563         AC_MSG_ERROR([no, upgrade libc])
10564     fi
10567 dnl =========================================
10568 dnl Check for uuidgen
10569 dnl =========================================
10570 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10571     # presence is already tested above in the WINDOWS_SDK_HOME check
10572     UUIDGEN=uuidgen.exe
10573     AC_SUBST(UUIDGEN)
10574 else
10575     AC_PATH_PROG([UUIDGEN], [uuidgen])
10576     if test -z "$UUIDGEN"; then
10577         AC_MSG_WARN([uuid is needed for building installation sets])
10578     fi
10581 dnl ***************************************
10582 dnl Checking for bison and flex
10583 dnl ***************************************
10584 AC_PATH_PROG(BISON, bison)
10585 if test -z "$BISON"; then
10586     AC_MSG_ERROR([no bison found in \$PATH, install it])
10587 else
10588     AC_MSG_CHECKING([the bison version])
10589     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10590     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10591     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
10592     dnl cause
10593     dnl
10594     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]
10595     dnl   typedef union YYSTYPE
10596     dnl           ~~~~~~^~~~~~~
10597     dnl
10598     dnl while at least 3.4.1 is know to be good:
10599     if test "$COMPILER_PLUGINS" = TRUE; then
10600         if test "$_bison_longver" -lt 2004; then
10601             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
10602         fi
10603     else
10604         if test "$_bison_longver" -lt 2000; then
10605             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10606         fi
10607     fi
10609 AC_SUBST([BISON])
10611 AC_PATH_PROG(FLEX, flex)
10612 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10613     FLEX=`cygpath -m $FLEX`
10615 if test -z "$FLEX"; then
10616     AC_MSG_ERROR([no flex found in \$PATH, install it])
10617 else
10618     AC_MSG_CHECKING([the flex version])
10619     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10620     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10621         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10622     fi
10624 AC_SUBST([FLEX])
10625 dnl ***************************************
10626 dnl Checking for patch
10627 dnl ***************************************
10628 AC_PATH_PROG(PATCH, patch)
10629 if test -z "$PATCH"; then
10630     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10633 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10634 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10635     if test -z "$with_gnu_patch"; then
10636         GNUPATCH=$PATCH
10637     else
10638         if test -x "$with_gnu_patch"; then
10639             GNUPATCH=$with_gnu_patch
10640         else
10641             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10642         fi
10643     fi
10645     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10646     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10647         AC_MSG_RESULT([yes])
10648     else
10649         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10650     fi
10651 else
10652     GNUPATCH=$PATCH
10655 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10656     GNUPATCH=`cygpath -m $GNUPATCH`
10659 dnl We also need to check for --with-gnu-cp
10661 if test -z "$with_gnu_cp"; then
10662     # check the place where the good stuff is hidden on Solaris...
10663     if test -x /usr/gnu/bin/cp; then
10664         GNUCP=/usr/gnu/bin/cp
10665     else
10666         AC_PATH_PROGS(GNUCP, gnucp cp)
10667     fi
10668     if test -z $GNUCP; then
10669         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10670     fi
10671 else
10672     if test -x "$with_gnu_cp"; then
10673         GNUCP=$with_gnu_cp
10674     else
10675         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10676     fi
10679 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10680     GNUCP=`cygpath -m $GNUCP`
10683 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10684 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10685     AC_MSG_RESULT([yes])
10686 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10687     AC_MSG_RESULT([yes])
10688 else
10689     case "$build_os" in
10690     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10691         x_GNUCP=[\#]
10692         GNUCP=''
10693         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10694         ;;
10695     *)
10696         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10697         ;;
10698     esac
10701 AC_SUBST(GNUPATCH)
10702 AC_SUBST(GNUCP)
10703 AC_SUBST(x_GNUCP)
10705 dnl ***************************************
10706 dnl testing assembler path
10707 dnl ***************************************
10708 ML_EXE=""
10709 if test "$_os" = "WINNT"; then
10710     if test "$BITNESS_OVERRIDE" = ""; then
10711         assembler=ml.exe
10712     else
10713         assembler=ml64.exe
10714     fi
10716     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10717     if test -f "$CL_PATH/$assembler"; then
10718         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10719         AC_MSG_RESULT([$ML_EXE])
10720     else
10721         AC_MSG_ERROR([not found])
10722     fi
10725 AC_SUBST(ML_EXE)
10727 dnl ===================================================================
10728 dnl We need zip and unzip
10729 dnl ===================================================================
10730 AC_PATH_PROG(ZIP, zip)
10731 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10732 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10733     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],,)
10736 AC_PATH_PROG(UNZIP, unzip)
10737 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10739 dnl ===================================================================
10740 dnl Zip must be a specific type for different build types.
10741 dnl ===================================================================
10742 if test $build_os = cygwin; then
10743     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10744         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10745     fi
10748 dnl ===================================================================
10749 dnl We need touch with -h option support.
10750 dnl ===================================================================
10751 AC_PATH_PROG(TOUCH, touch)
10752 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10753 touch warn
10754 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10755     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],,)
10758 dnl ===================================================================
10759 dnl Check for system epoxy
10760 dnl ===================================================================
10761 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10763 dnl ===================================================================
10764 dnl Set vcl option: coordinate device in double or sal_Int32
10765 dnl ===================================================================
10767 dnl disabled for now, we don't want subtle differences between OSs
10768 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10769 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10770 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10771 dnl     AC_MSG_RESULT([double])
10772 dnl else
10773 dnl     AC_MSG_RESULT([sal_Int32])
10774 dnl fi
10776 dnl ===================================================================
10777 dnl Test which vclplugs have to be built.
10778 dnl ===================================================================
10779 R=""
10780 if test "$USING_X11" != TRUE; then
10781     enable_gtk3=no
10784 ENABLE_GTK3=""
10785 if test "x$enable_gtk3" = "xyes"; then
10786     ENABLE_GTK3="TRUE"
10787     AC_DEFINE(ENABLE_GTK3)
10788     R="$R gtk3"
10790 AC_SUBST(ENABLE_GTK3)
10792 ENABLE_GTK3_KDE5=""
10793 if test "x$enable_gtk3_kde5" = "xyes"; then
10794     ENABLE_GTK3_KDE5="TRUE"
10795     AC_DEFINE(ENABLE_GTK3_KDE5)
10796     R="$R gtk3_kde5"
10798 AC_SUBST(ENABLE_GTK3_KDE5)
10800 ENABLE_QT5=""
10801 if test "x$enable_qt5" = "xyes"; then
10802     ENABLE_QT5="TRUE"
10803     AC_DEFINE(ENABLE_QT5)
10804     R="$R qt5"
10806 AC_SUBST(ENABLE_QT5)
10808 ENABLE_KF5=""
10809 if test "x$enable_kf5" = "xyes"; then
10810     ENABLE_KF5="TRUE"
10811     AC_DEFINE(ENABLE_KF5)
10812     R="$R kf5"
10814 AC_SUBST(ENABLE_KF5)
10816 GTK3_CFLAGS=""
10817 GTK3_LIBS=""
10818 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
10819     if test "$with_system_cairo" = no; then
10820         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10821     fi
10822     : ${with_system_cairo:=yes}
10823     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)
10824     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10825     FilterLibs "${GTK3_LIBS}"
10826     GTK3_LIBS="${filteredlibs}"
10828     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10829     if test "$with_system_epoxy" != "yes"; then
10830         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10831         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10832                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10833     fi
10835 AC_SUBST(GTK3_LIBS)
10836 AC_SUBST(GTK3_CFLAGS)
10838 if test "$enable_introspection" = yes; then
10839     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
10840         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10841     else
10842         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10843     fi
10846 if test "$_os" = "WINNT"; then
10847     R="$R win"
10848 elif test "$_os" = "Darwin"; then
10849     R="$R osx"
10850 elif test "$_os" = "iOS"; then
10851     R="ios (builtin)"
10854 build_vcl_plugins="$R"
10855 if test -z "$build_vcl_plugins"; then
10856     build_vcl_plugins="none"
10858 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10860 dnl ===================================================================
10861 dnl check for dbus support
10862 dnl ===================================================================
10863 ENABLE_DBUS=""
10864 DBUS_CFLAGS=""
10865 DBUS_LIBS=""
10866 DBUS_GLIB_CFLAGS=""
10867 DBUS_GLIB_LIBS=""
10868 DBUS_HAVE_GLIB=""
10870 if test "$enable_dbus" = "no"; then
10871     test_dbus=no
10874 AC_MSG_CHECKING([whether to enable DBUS support])
10875 if test "$test_dbus" = "yes"; then
10876     ENABLE_DBUS="TRUE"
10877     AC_MSG_RESULT([yes])
10878     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10879     AC_DEFINE(ENABLE_DBUS)
10880     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10881     FilterLibs "${DBUS_LIBS}"
10882     DBUS_LIBS="${filteredlibs}"
10884     # Glib is needed for BluetoothServer
10885     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10886     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10887         [
10888             DBUS_HAVE_GLIB="TRUE"
10889             AC_DEFINE(DBUS_HAVE_GLIB,1)
10890         ],
10891         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10892     )
10893 else
10894     AC_MSG_RESULT([no])
10897 AC_SUBST(ENABLE_DBUS)
10898 AC_SUBST(DBUS_CFLAGS)
10899 AC_SUBST(DBUS_LIBS)
10900 AC_SUBST(DBUS_GLIB_CFLAGS)
10901 AC_SUBST(DBUS_GLIB_LIBS)
10902 AC_SUBST(DBUS_HAVE_GLIB)
10904 AC_MSG_CHECKING([whether to enable Impress remote control])
10905 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10906     AC_MSG_RESULT([yes])
10907     ENABLE_SDREMOTE=TRUE
10908     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10910     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
10911         # The Bluetooth code doesn't compile with macOS SDK 10.15
10912         if test "$enable_sdremote_bluetooth" = yes; then
10913             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
10914         fi
10915         enable_sdremote_bluetooth=no
10916     fi
10917     # If not explicitly enabled or disabled, default
10918     if test -z "$enable_sdremote_bluetooth"; then
10919         case "$OS" in
10920         LINUX|MACOSX|WNT)
10921             # Default to yes for these
10922             enable_sdremote_bluetooth=yes
10923             ;;
10924         *)
10925             # otherwise no
10926             enable_sdremote_bluetooth=no
10927             ;;
10928         esac
10929     fi
10930     # $enable_sdremote_bluetooth is guaranteed non-empty now
10932     if test "$enable_sdremote_bluetooth" != "no"; then
10933         if test "$OS" = "LINUX"; then
10934             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10935                 AC_MSG_RESULT([yes])
10936                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10937                 dnl ===================================================================
10938                 dnl Check for system bluez
10939                 dnl ===================================================================
10940                 AC_MSG_CHECKING([which Bluetooth header to use])
10941                 if test "$with_system_bluez" = "yes"; then
10942                     AC_MSG_RESULT([external])
10943                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10944                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10945                     SYSTEM_BLUEZ=TRUE
10946                 else
10947                     AC_MSG_RESULT([internal])
10948                     SYSTEM_BLUEZ=
10949                 fi
10950             else
10951                 AC_MSG_RESULT([no, dbus disabled])
10952                 ENABLE_SDREMOTE_BLUETOOTH=
10953                 SYSTEM_BLUEZ=
10954             fi
10955         else
10956             AC_MSG_RESULT([yes])
10957             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10958             SYSTEM_BLUEZ=
10959         fi
10960     else
10961         AC_MSG_RESULT([no])
10962         ENABLE_SDREMOTE_BLUETOOTH=
10963         SYSTEM_BLUEZ=
10964     fi
10965 else
10966     ENABLE_SDREMOTE=
10967     SYSTEM_BLUEZ=
10968     AC_MSG_RESULT([no])
10970 AC_SUBST(ENABLE_SDREMOTE)
10971 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10972 AC_SUBST(SYSTEM_BLUEZ)
10974 dnl ===================================================================
10975 dnl Check whether to enable GIO support
10976 dnl ===================================================================
10977 if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
10978     AC_MSG_CHECKING([whether to enable GIO support])
10979     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10980         dnl Need at least 2.26 for the dbus support.
10981         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10982                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10983         if test "$ENABLE_GIO" = "TRUE"; then
10984             AC_DEFINE(ENABLE_GIO)
10985             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10986             FilterLibs "${GIO_LIBS}"
10987             GIO_LIBS="${filteredlibs}"
10988         fi
10989     else
10990         AC_MSG_RESULT([no])
10991     fi
10993 AC_SUBST(ENABLE_GIO)
10994 AC_SUBST(GIO_CFLAGS)
10995 AC_SUBST(GIO_LIBS)
10998 dnl ===================================================================
11000 SPLIT_APP_MODULES=""
11001 if test "$enable_split_app_modules" = "yes"; then
11002     SPLIT_APP_MODULES="TRUE"
11004 AC_SUBST(SPLIT_APP_MODULES)
11006 SPLIT_OPT_FEATURES=""
11007 if test "$enable_split_opt_features" = "yes"; then
11008     SPLIT_OPT_FEATURES="TRUE"
11010 AC_SUBST(SPLIT_OPT_FEATURES)
11012 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
11013     if test "$enable_cairo_canvas" = yes; then
11014         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
11015     fi
11016     enable_cairo_canvas=no
11017 elif test -z "$enable_cairo_canvas"; then
11018     enable_cairo_canvas=yes
11021 ENABLE_CAIRO_CANVAS=""
11022 if test "$enable_cairo_canvas" = "yes"; then
11023     test_cairo=yes
11024     ENABLE_CAIRO_CANVAS="TRUE"
11025     AC_DEFINE(ENABLE_CAIRO_CANVAS)
11027 AC_SUBST(ENABLE_CAIRO_CANVAS)
11029 dnl ===================================================================
11030 dnl Check whether the GStreamer libraries are available.
11031 dnl ===================================================================
11033 ENABLE_GSTREAMER_1_0=""
11035 if test "$build_gstreamer_1_0" = "yes"; then
11037     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11038     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11039         ENABLE_GSTREAMER_1_0="TRUE"
11040         AC_MSG_RESULT([yes])
11041         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11042         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11043         FilterLibs "${GSTREAMER_1_0_LIBS}"
11044         GSTREAMER_1_0_LIBS="${filteredlibs}"
11045         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11046     else
11047         AC_MSG_RESULT([no])
11048     fi
11050 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11051 AC_SUBST(GSTREAMER_1_0_LIBS)
11052 AC_SUBST(ENABLE_GSTREAMER_1_0)
11054 dnl ===================================================================
11055 dnl Check whether to build the VLC avmedia backend
11056 dnl ===================================================================
11058 ENABLE_VLC=""
11060 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
11061 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
11062     ENABLE_VLC="TRUE"
11063     AC_MSG_RESULT([yes])
11064 else
11065     AC_MSG_RESULT([no])
11067 AC_SUBST(ENABLE_VLC)
11069 ENABLE_OPENGL_TRANSITIONS=
11070 ENABLE_OPENGL_CANVAS=
11071 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11072    : # disable
11073 elif test "$_os" = "Darwin"; then
11074     # We use frameworks on macOS, no need for detail checks
11075     ENABLE_OPENGL_TRANSITIONS=TRUE
11076     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11077     ENABLE_OPENGL_CANVAS=TRUE
11078 elif test $_os = WINNT; then
11079     ENABLE_OPENGL_TRANSITIONS=TRUE
11080     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11081     ENABLE_OPENGL_CANVAS=TRUE
11082 else
11083     if test "$USING_X11" = TRUE; then
11084         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11085         ENABLE_OPENGL_TRANSITIONS=TRUE
11086         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11087         ENABLE_OPENGL_CANVAS=TRUE
11088     fi
11091 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11092 AC_SUBST(ENABLE_OPENGL_CANVAS)
11094 dnl =================================================
11095 dnl Check whether to build with OpenCL support.
11096 dnl =================================================
11098 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
11099     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11100     # platform (optional at run-time, used through clew).
11101     BUILD_TYPE="$BUILD_TYPE OPENCL"
11102     AC_DEFINE(HAVE_FEATURE_OPENCL)
11105 dnl =================================================
11106 dnl Check whether to build with dconf support.
11107 dnl =================================================
11109 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11110     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11111         if test "$enable_dconf" = yes; then
11112             AC_MSG_ERROR([dconf not found])
11113         else
11114             enable_dconf=no
11115         fi])
11117 AC_MSG_CHECKING([whether to enable dconf])
11118 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11119     DCONF_CFLAGS=
11120     DCONF_LIBS=
11121     ENABLE_DCONF=
11122     AC_MSG_RESULT([no])
11123 else
11124     ENABLE_DCONF=TRUE
11125     AC_DEFINE(ENABLE_DCONF)
11126     AC_MSG_RESULT([yes])
11128 AC_SUBST([DCONF_CFLAGS])
11129 AC_SUBST([DCONF_LIBS])
11130 AC_SUBST([ENABLE_DCONF])
11132 # pdf import?
11133 AC_MSG_CHECKING([whether to build the PDF import feature])
11134 ENABLE_PDFIMPORT=
11135 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
11136     AC_MSG_RESULT([yes])
11137     ENABLE_PDFIMPORT=TRUE
11138     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11139 else
11140     AC_MSG_RESULT([no])
11143 # Pdfium?
11144 AC_MSG_CHECKING([whether to build PDFium])
11145 ENABLE_PDFIUM=
11146 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11147     AC_MSG_RESULT([yes])
11148     ENABLE_PDFIUM=TRUE
11149     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11150     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11151 else
11152     AC_MSG_RESULT([no])
11154 AC_SUBST(ENABLE_PDFIUM)
11156 dnl ===================================================================
11157 dnl Check for poppler
11158 dnl ===================================================================
11159 ENABLE_POPPLER=
11160 AC_MSG_CHECKING([whether to build Poppler])
11161 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11162     AC_MSG_RESULT([yes])
11163     ENABLE_POPPLER=TRUE
11164     AC_DEFINE(HAVE_FEATURE_POPPLER)
11165 else
11166     AC_MSG_RESULT([no])
11168 AC_SUBST(ENABLE_POPPLER)
11170 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11171     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11174 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11175     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11178 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11179     dnl ===================================================================
11180     dnl Check for system poppler
11181     dnl ===================================================================
11182     AC_MSG_CHECKING([which PDF import poppler to use])
11183     if test "$with_system_poppler" = "yes"; then
11184         AC_MSG_RESULT([external])
11185         SYSTEM_POPPLER=TRUE
11186         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11187         AC_LANG_PUSH([C++])
11188         save_CXXFLAGS=$CXXFLAGS
11189         save_CPPFLAGS=$CPPFLAGS
11190         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11191         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11192         AC_CHECK_HEADER([cpp/poppler-version.h],
11193             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11194             [])
11195         CXXFLAGS=$save_CXXFLAGS
11196         CPPFLAGS=$save_CPPFLAGS
11197         AC_LANG_POP([C++])
11198         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11200         FilterLibs "${POPPLER_LIBS}"
11201         POPPLER_LIBS="${filteredlibs}"
11202     else
11203         AC_MSG_RESULT([internal])
11204         SYSTEM_POPPLER=
11205         BUILD_TYPE="$BUILD_TYPE POPPLER"
11206         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11207     fi
11208     AC_DEFINE([ENABLE_PDFIMPORT],1)
11210 AC_SUBST(ENABLE_PDFIMPORT)
11211 AC_SUBST(SYSTEM_POPPLER)
11212 AC_SUBST(POPPLER_CFLAGS)
11213 AC_SUBST(POPPLER_LIBS)
11215 # Skia?
11216 AC_MSG_CHECKING([whether to build Skia])
11217 ENABLE_SKIA=
11218 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
11219     if test "$enable_skia" = "debug"; then
11220         AC_MSG_RESULT([yes (debug)])
11221         ENABLE_SKIA_DEBUG=TRUE
11222     else
11223         AC_MSG_RESULT([yes])
11224         ENABLE_SKIA_DEBUG=
11225     fi
11226     ENABLE_SKIA=TRUE
11227     AC_DEFINE(HAVE_FEATURE_SKIA)
11228     BUILD_TYPE="$BUILD_TYPE SKIA"
11229 else
11230     AC_MSG_RESULT([no])
11232 AC_SUBST(ENABLE_SKIA)
11233 AC_SUBST(ENABLE_SKIA_DEBUG)
11235 CLANG_CXXFLAGS_INTRINSICS_SSE2=
11236 CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11237 CLANG_CXXFLAGS_INTRINSICS_SSE41=
11238 CLANG_CXXFLAGS_INTRINSICS_SSE42=
11239 CLANG_CXXFLAGS_INTRINSICS_AVX=
11240 CLANG_CXXFLAGS_INTRINSICS_AVX2=
11241 CLANG_CXXFLAGS_INTRINSICS_AVX512=
11242 CLANG_CXXFLAGS_INTRINSICS_F16C=
11243 CLANG_CXXFLAGS_INTRINSICS_FMA=
11245 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
11246     if test -n "$CLANG_CC" -a -n "$CLANG_CXX"; then
11247         AC_MSG_CHECKING([for Clang])
11248         AC_MSG_RESULT([$CLANG_CC / $CLANG_CXX])
11249     else
11250         if test "$_os" = "WINNT"; then
11251             AC_MSG_CHECKING([for clang-cl])
11252             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11253                 CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11254                 dnl explicitly set -m32/-m64
11255                 if test "$BITNESS_OVERRIDE" = ""; then
11256                     CLANG_CC="$CLANG_CC -m32"
11257                 else
11258                     CLANG_CC="$CLANG_CC -m64"
11259                 fi
11260                 CLANG_CXX="$CLANG_CC"
11261                 AC_MSG_RESULT([$CLANG_CC])
11262             else
11263                 AC_MSG_RESULT([no])
11264             fi
11265         else
11266             AC_CHECK_PROG(CLANG_CC,clang,clang,[])
11267             AC_CHECK_PROG(CLANG_CXX,clang++,clang++,[])
11268         fi
11269     fi
11270     if test -n "$CLANG_CC" -a -n "$CLANG_CXX"; then
11271         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CLANG_CC -E - | tail -1 | sed 's/ //g'`
11272         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11273         if test "$clang2_ver" -lt 50002; then
11274             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11275             CLANG_CC=
11276             CLANG_CXX=
11277         fi
11278     fi
11279     if test -z "$CLANG_CC" -o -z "$CLANG_CXX"; then
11280         # Skia is the default on Windows, so hard-require Clang.
11281         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11282         if test "$_os" = "WINNT"; then
11283             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11284         else
11285             AC_MSG_WARN([Clang compiler not found.])
11286         fi
11287     else
11289         save_CXX="$CXX"
11290         CXX="$CLANG_CXX"
11291         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11292         flag_sse2=-msse2
11293         flag_ssse3=-mssse3
11294         flag_sse41=-msse4.1
11295         flag_sse42=-msse4.2
11296         flag_avx=-mavx
11297         flag_avx2=-mavx2
11298         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
11299         flag_f16c=-mf16c
11300         flag_fma=-mfma
11302         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11303         AC_LANG_PUSH([C++])
11304         save_CXXFLAGS=$CXXFLAGS
11305         CXXFLAGS="$CXXFLAGS $flag_sse2"
11306         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11307             #include <emmintrin.h>
11308             int main () {
11309                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11310                 c = _mm_xor_si128 (a, b);
11311                 return 0;
11312             }
11313             ])],
11314             [can_compile_sse2=yes],
11315             [can_compile_sse2=no])
11316         AC_LANG_POP([C++])
11317         CXXFLAGS=$save_CXXFLAGS
11318         AC_MSG_RESULT([${can_compile_sse2}])
11319         if test "${can_compile_sse2}" = "yes" ; then
11320             CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11321         fi
11323         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11324         AC_LANG_PUSH([C++])
11325         save_CXXFLAGS=$CXXFLAGS
11326         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11327         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11328             #include <tmmintrin.h>
11329             int main () {
11330                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11331                 c = _mm_maddubs_epi16 (a, b);
11332                 return 0;
11333             }
11334             ])],
11335             [can_compile_ssse3=yes],
11336             [can_compile_ssse3=no])
11337         AC_LANG_POP([C++])
11338         CXXFLAGS=$save_CXXFLAGS
11339         AC_MSG_RESULT([${can_compile_ssse3}])
11340         if test "${can_compile_ssse3}" = "yes" ; then
11341             CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
11342         fi
11344         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
11345         AC_LANG_PUSH([C++])
11346         save_CXXFLAGS=$CXXFLAGS
11347         CXXFLAGS="$CXXFLAGS $flag_sse41"
11348         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11349             #include <smmintrin.h>
11350             int main () {
11351                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11352                 c = _mm_cmpeq_epi64 (a, b);
11353                 return 0;
11354             }
11355             ])],
11356             [can_compile_sse41=yes],
11357             [can_compile_sse41=no])
11358         AC_LANG_POP([C++])
11359         CXXFLAGS=$save_CXXFLAGS
11360         AC_MSG_RESULT([${can_compile_sse41}])
11361         if test "${can_compile_sse41}" = "yes" ; then
11362             CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
11363         fi
11365         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
11366         AC_LANG_PUSH([C++])
11367         save_CXXFLAGS=$CXXFLAGS
11368         CXXFLAGS="$CXXFLAGS $flag_sse42"
11369         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11370             #include <nmmintrin.h>
11371             int main () {
11372                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11373                 c = _mm_cmpgt_epi64 (a, b);
11374                 return 0;
11375             }
11376             ])],
11377             [can_compile_sse42=yes],
11378             [can_compile_sse42=no])
11379         AC_LANG_POP([C++])
11380         CXXFLAGS=$save_CXXFLAGS
11381         AC_MSG_RESULT([${can_compile_sse42}])
11382         if test "${can_compile_sse42}" = "yes" ; then
11383             CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
11384         fi
11386         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
11387         AC_LANG_PUSH([C++])
11388         save_CXXFLAGS=$CXXFLAGS
11389         CXXFLAGS="$CXXFLAGS $flag_avx"
11390         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11391             #include <immintrin.h>
11392             int main () {
11393                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
11394                 c = _mm256_xor_ps(a, b);
11395                 return 0;
11396             }
11397             ])],
11398             [can_compile_avx=yes],
11399             [can_compile_avx=no])
11400         AC_LANG_POP([C++])
11401         CXXFLAGS=$save_CXXFLAGS
11402         AC_MSG_RESULT([${can_compile_avx}])
11403         if test "${can_compile_avx}" = "yes" ; then
11404             CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
11405         fi
11407         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
11408         AC_LANG_PUSH([C++])
11409         save_CXXFLAGS=$CXXFLAGS
11410         CXXFLAGS="$CXXFLAGS $flag_avx2"
11411         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11412             #include <immintrin.h>
11413             int main () {
11414                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
11415                 c = _mm256_maddubs_epi16(a, b);
11416                 return 0;
11417             }
11418             ])],
11419             [can_compile_avx2=yes],
11420             [can_compile_avx2=no])
11421         AC_LANG_POP([C++])
11422         CXXFLAGS=$save_CXXFLAGS
11423         AC_MSG_RESULT([${can_compile_avx2}])
11424         if test "${can_compile_avx2}" = "yes" ; then
11425             CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
11426         fi
11428         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
11429         AC_LANG_PUSH([C++])
11430         save_CXXFLAGS=$CXXFLAGS
11431         CXXFLAGS="$CXXFLAGS $flag_avx512"
11432         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11433             #include <immintrin.h>
11434             int main () {
11435                 __m512i a = _mm512_loadu_si512(0);
11436                 return 0;
11437             }
11438             ])],
11439             [can_compile_avx512=yes],
11440             [can_compile_avx512=no])
11441         AC_LANG_POP([C++])
11442         CXXFLAGS=$save_CXXFLAGS
11443         AC_MSG_RESULT([${can_compile_avx512}])
11444         if test "${can_compile_avx512}" = "yes" ; then
11445             CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
11446         fi
11448         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
11449         AC_LANG_PUSH([C++])
11450         save_CXXFLAGS=$CXXFLAGS
11451         CXXFLAGS="$CXXFLAGS $flag_f16c"
11452         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11453             #include <immintrin.h>
11454             int main () {
11455                 __m128i a = _mm_set1_epi32 (0);
11456                 __m128 c;
11457                 c = _mm_cvtph_ps(a);
11458                 return 0;
11459             }
11460             ])],
11461             [can_compile_f16c=yes],
11462             [can_compile_f16c=no])
11463         AC_LANG_POP([C++])
11464         CXXFLAGS=$save_CXXFLAGS
11465         AC_MSG_RESULT([${can_compile_f16c}])
11466         if test "${can_compile_f16c}" = "yes" ; then
11467             CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
11468         fi
11470         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
11471         AC_LANG_PUSH([C++])
11472         save_CXXFLAGS=$CXXFLAGS
11473         CXXFLAGS="$CXXFLAGS $flag_fma"
11474         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11475             #include <immintrin.h>
11476             int main () {
11477                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
11478                 d = _mm256_fmadd_ps(a, b, c);
11479                 return 0;
11480             }
11481             ])],
11482             [can_compile_fma=yes],
11483             [can_compile_fma=no])
11484         AC_LANG_POP([C++])
11485         CXXFLAGS=$save_CXXFLAGS
11486         AC_MSG_RESULT([${can_compile_fma}])
11487         if test "${can_compile_fma}" = "yes" ; then
11488             CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
11489         fi
11491         CXX="$save_CXX"
11492     fi
11494 AC_SUBST(CLANG_CC)
11495 AC_SUBST(CLANG_CXX)
11496 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE2)
11497 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSSE3)
11498 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE41)
11499 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_SSE42)
11500 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX)
11501 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX2)
11502 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX512)
11503 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_F16C)
11504 AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_FMA)
11506 SYSTEM_GPGMEPP=
11508 if test "$build_for_ios" = "YES"; then
11509     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
11510     AC_MSG_RESULT([yes])
11511 elif test "$enable_mpl_subset" = "yes"; then
11512     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11513     AC_MSG_RESULT([yes])
11514 elif test "$enable_fuzzers" = "yes"; then
11515     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11516     AC_MSG_RESULT([yes])
11517 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11518     dnl ===================================================================
11519     dnl Check for system gpgme
11520     dnl ===================================================================
11521     AC_MSG_CHECKING([which gpgmepp to use])
11522     if test "$with_system_gpgmepp" = "yes"; then
11523         AC_MSG_RESULT([external])
11524         SYSTEM_GPGMEPP=TRUE
11526         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11527         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11528             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11529         # progress_callback is the only func with plain C linkage
11530         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11531         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11532             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11533         AC_CHECK_HEADER(gpgme.h, [],
11534             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11535     else
11536         AC_MSG_RESULT([internal])
11537         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11538         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11540         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11541         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11542         if test "$_os" != "WINNT"; then
11543             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11544             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11545         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11546             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11547         fi
11548     fi
11549     ENABLE_GPGMEPP=TRUE
11550     AC_DEFINE([HAVE_FEATURE_GPGME])
11551     AC_PATH_PROG(GPG, gpg)
11552     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11553     # so let's exclude that manually for the moment
11554     if test -n "$GPG" -a "$_os" != "WINNT"; then
11555         # make sure we not only have a working gpgme, but a full working
11556         # gpg installation to run OpenPGP signature verification
11557         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11558     fi
11559     if test "$_os" = "Linux"; then
11560       uid=`id -u`
11561       AC_MSG_CHECKING([for /run/user/$uid])
11562       if test -d /run/user/$uid; then
11563         AC_MSG_RESULT([yes])
11564         AC_PATH_PROG(GPGCONF, gpgconf)
11566         # Older versions of gpgconf are not working as expected, since
11567         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11568         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11569         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11570         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11571         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11572         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11573         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11574           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11575           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11576           if $GPGCONF --dump-options > /dev/null ; then
11577             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11578               AC_MSG_RESULT([yes])
11579               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11580               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11581             else
11582               AC_MSG_RESULT([no])
11583             fi
11584           else
11585             AC_MSG_RESULT([no. missing or broken gpgconf?])
11586           fi
11587         else
11588           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11589         fi
11590       else
11591         AC_MSG_RESULT([no])
11592      fi
11593    fi
11595 AC_SUBST(ENABLE_GPGMEPP)
11596 AC_SUBST(SYSTEM_GPGMEPP)
11597 AC_SUBST(GPG_ERROR_CFLAGS)
11598 AC_SUBST(GPG_ERROR_LIBS)
11599 AC_SUBST(LIBASSUAN_CFLAGS)
11600 AC_SUBST(LIBASSUAN_LIBS)
11601 AC_SUBST(GPGMEPP_CFLAGS)
11602 AC_SUBST(GPGMEPP_LIBS)
11604 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11605 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11606     AC_MSG_RESULT([yes])
11607     ENABLE_MEDIAWIKI=TRUE
11608     BUILD_TYPE="$BUILD_TYPE XSLTML"
11609     if test  "x$with_java" = "xno"; then
11610         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11611     fi
11612 else
11613     AC_MSG_RESULT([no])
11614     ENABLE_MEDIAWIKI=
11615     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11617 AC_SUBST(ENABLE_MEDIAWIKI)
11619 AC_MSG_CHECKING([whether to build the Report Builder])
11620 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11621     AC_MSG_RESULT([yes])
11622     ENABLE_REPORTBUILDER=TRUE
11623     AC_MSG_CHECKING([which jfreereport libs to use])
11624     if test "$with_system_jfreereport" = "yes"; then
11625         SYSTEM_JFREEREPORT=TRUE
11626         AC_MSG_RESULT([external])
11627         if test -z $SAC_JAR; then
11628             SAC_JAR=/usr/share/java/sac.jar
11629         fi
11630         if ! test -f $SAC_JAR; then
11631              AC_MSG_ERROR(sac.jar not found.)
11632         fi
11634         if test -z $LIBXML_JAR; then
11635             if test -f /usr/share/java/libxml-1.0.0.jar; then
11636                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11637             elif test -f /usr/share/java/libxml.jar; then
11638                 LIBXML_JAR=/usr/share/java/libxml.jar
11639             else
11640                 AC_MSG_ERROR(libxml.jar replacement not found.)
11641             fi
11642         elif ! test -f $LIBXML_JAR; then
11643             AC_MSG_ERROR(libxml.jar not found.)
11644         fi
11646         if test -z $FLUTE_JAR; then
11647             if test -f /usr/share/java/flute-1.3.0.jar; then
11648                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11649             elif test -f /usr/share/java/flute.jar; then
11650                 FLUTE_JAR=/usr/share/java/flute.jar
11651             else
11652                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11653             fi
11654         elif ! test -f $FLUTE_JAR; then
11655             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11656         fi
11658         if test -z $JFREEREPORT_JAR; then
11659             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11660                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11661             elif test -f /usr/share/java/flow-engine.jar; then
11662                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11663             else
11664                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11665             fi
11666         elif ! test -f  $JFREEREPORT_JAR; then
11667                 AC_MSG_ERROR(jfreereport.jar not found.)
11668         fi
11670         if test -z $LIBLAYOUT_JAR; then
11671             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11672                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11673             elif test -f /usr/share/java/liblayout.jar; then
11674                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11675             else
11676                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11677             fi
11678         elif ! test -f $LIBLAYOUT_JAR; then
11679                 AC_MSG_ERROR(liblayout.jar not found.)
11680         fi
11682         if test -z $LIBLOADER_JAR; then
11683             if test -f /usr/share/java/libloader-1.0.0.jar; then
11684                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11685             elif test -f /usr/share/java/libloader.jar; then
11686                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11687             else
11688                 AC_MSG_ERROR(libloader.jar replacement not found.)
11689             fi
11690         elif ! test -f  $LIBLOADER_JAR; then
11691             AC_MSG_ERROR(libloader.jar not found.)
11692         fi
11694         if test -z $LIBFORMULA_JAR; then
11695             if test -f /usr/share/java/libformula-0.2.0.jar; then
11696                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11697             elif test -f /usr/share/java/libformula.jar; then
11698                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11699             else
11700                 AC_MSG_ERROR(libformula.jar replacement not found.)
11701             fi
11702         elif ! test -f $LIBFORMULA_JAR; then
11703                 AC_MSG_ERROR(libformula.jar not found.)
11704         fi
11706         if test -z $LIBREPOSITORY_JAR; then
11707             if test -f /usr/share/java/librepository-1.0.0.jar; then
11708                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11709             elif test -f /usr/share/java/librepository.jar; then
11710                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11711             else
11712                 AC_MSG_ERROR(librepository.jar replacement not found.)
11713             fi
11714         elif ! test -f $LIBREPOSITORY_JAR; then
11715             AC_MSG_ERROR(librepository.jar not found.)
11716         fi
11718         if test -z $LIBFONTS_JAR; then
11719             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11720                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11721             elif test -f /usr/share/java/libfonts.jar; then
11722                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11723             else
11724                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11725             fi
11726         elif ! test -f $LIBFONTS_JAR; then
11727                 AC_MSG_ERROR(libfonts.jar not found.)
11728         fi
11730         if test -z $LIBSERIALIZER_JAR; then
11731             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11732                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11733             elif test -f /usr/share/java/libserializer.jar; then
11734                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11735             else
11736                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11737             fi
11738         elif ! test -f $LIBSERIALIZER_JAR; then
11739                 AC_MSG_ERROR(libserializer.jar not found.)
11740         fi
11742         if test -z $LIBBASE_JAR; then
11743             if test -f /usr/share/java/libbase-1.0.0.jar; then
11744                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11745             elif test -f /usr/share/java/libbase.jar; then
11746                 LIBBASE_JAR=/usr/share/java/libbase.jar
11747             else
11748                 AC_MSG_ERROR(libbase.jar replacement not found.)
11749             fi
11750         elif ! test -f $LIBBASE_JAR; then
11751             AC_MSG_ERROR(libbase.jar not found.)
11752         fi
11754     else
11755         AC_MSG_RESULT([internal])
11756         SYSTEM_JFREEREPORT=
11757         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11758         NEED_ANT=TRUE
11759     fi
11760 else
11761     AC_MSG_RESULT([no])
11762     ENABLE_REPORTBUILDER=
11763     SYSTEM_JFREEREPORT=
11765 AC_SUBST(ENABLE_REPORTBUILDER)
11766 AC_SUBST(SYSTEM_JFREEREPORT)
11767 AC_SUBST(SAC_JAR)
11768 AC_SUBST(LIBXML_JAR)
11769 AC_SUBST(FLUTE_JAR)
11770 AC_SUBST(JFREEREPORT_JAR)
11771 AC_SUBST(LIBBASE_JAR)
11772 AC_SUBST(LIBLAYOUT_JAR)
11773 AC_SUBST(LIBLOADER_JAR)
11774 AC_SUBST(LIBFORMULA_JAR)
11775 AC_SUBST(LIBREPOSITORY_JAR)
11776 AC_SUBST(LIBFONTS_JAR)
11777 AC_SUBST(LIBSERIALIZER_JAR)
11779 # this has to be here because both the Wiki Publisher and the SRB use
11780 # commons-logging
11781 COMMONS_LOGGING_VERSION=1.2
11782 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11783     AC_MSG_CHECKING([which Apache commons-* libs to use])
11784     if test "$with_system_apache_commons" = "yes"; then
11785         SYSTEM_APACHE_COMMONS=TRUE
11786         AC_MSG_RESULT([external])
11787         if test -z $COMMONS_LOGGING_JAR; then
11788             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11789                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11790            elif test -f /usr/share/java/commons-logging.jar; then
11791                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11792             else
11793                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11794             fi
11795         elif ! test -f $COMMONS_LOGGING_JAR; then
11796             AC_MSG_ERROR(commons-logging.jar not found.)
11797         fi
11798     else
11799         AC_MSG_RESULT([internal])
11800         SYSTEM_APACHE_COMMONS=
11801         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11802         NEED_ANT=TRUE
11803     fi
11805 AC_SUBST(SYSTEM_APACHE_COMMONS)
11806 AC_SUBST(COMMONS_LOGGING_JAR)
11807 AC_SUBST(COMMONS_LOGGING_VERSION)
11809 # scripting provider for BeanShell?
11810 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11811 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11812     AC_MSG_RESULT([yes])
11813     ENABLE_SCRIPTING_BEANSHELL=TRUE
11815     dnl ===================================================================
11816     dnl Check for system beanshell
11817     dnl ===================================================================
11818     AC_MSG_CHECKING([which beanshell to use])
11819     if test "$with_system_beanshell" = "yes"; then
11820         AC_MSG_RESULT([external])
11821         SYSTEM_BSH=TRUE
11822         if test -z $BSH_JAR; then
11823             BSH_JAR=/usr/share/java/bsh.jar
11824         fi
11825         if ! test -f $BSH_JAR; then
11826             AC_MSG_ERROR(bsh.jar not found.)
11827         fi
11828     else
11829         AC_MSG_RESULT([internal])
11830         SYSTEM_BSH=
11831         BUILD_TYPE="$BUILD_TYPE BSH"
11832     fi
11833 else
11834     AC_MSG_RESULT([no])
11835     ENABLE_SCRIPTING_BEANSHELL=
11836     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11838 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11839 AC_SUBST(SYSTEM_BSH)
11840 AC_SUBST(BSH_JAR)
11842 # scripting provider for JavaScript?
11843 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11844 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11845     AC_MSG_RESULT([yes])
11846     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11848     dnl ===================================================================
11849     dnl Check for system rhino
11850     dnl ===================================================================
11851     AC_MSG_CHECKING([which rhino to use])
11852     if test "$with_system_rhino" = "yes"; then
11853         AC_MSG_RESULT([external])
11854         SYSTEM_RHINO=TRUE
11855         if test -z $RHINO_JAR; then
11856             RHINO_JAR=/usr/share/java/js.jar
11857         fi
11858         if ! test -f $RHINO_JAR; then
11859             AC_MSG_ERROR(js.jar not found.)
11860         fi
11861     else
11862         AC_MSG_RESULT([internal])
11863         SYSTEM_RHINO=
11864         BUILD_TYPE="$BUILD_TYPE RHINO"
11865         NEED_ANT=TRUE
11866     fi
11867 else
11868     AC_MSG_RESULT([no])
11869     ENABLE_SCRIPTING_JAVASCRIPT=
11870     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11872 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11873 AC_SUBST(SYSTEM_RHINO)
11874 AC_SUBST(RHINO_JAR)
11876 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11877 # paths should be added to library search path. So lets put all 64-bit
11878 # platforms there.
11879 supports_multilib=
11880 case "$host_cpu" in
11881 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11882     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11883         supports_multilib="yes"
11884     fi
11885     ;;
11887     ;;
11888 esac
11890 dnl ===================================================================
11891 dnl QT5 Integration
11892 dnl ===================================================================
11894 QT5_CFLAGS=""
11895 QT5_LIBS=""
11896 QMAKE5="qmake"
11897 MOC5="moc"
11898 QT5_GOBJECT_CFLAGS=""
11899 QT5_GOBJECT_LIBS=""
11900 QT5_HAVE_GOBJECT=""
11901 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11902         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11903         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11904 then
11905     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11906     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11908     if test -n "$supports_multilib"; then
11909         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11910     fi
11912     qt5_test_include="QtWidgets/qapplication.h"
11913     qt5_test_library="libQt5Widgets.so"
11915     dnl Check for qmake5
11916     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11917     if test "$QMAKE5" = "no"; then
11918         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11919     else
11920         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11921         if test -z "$qmake5_test_ver"; then
11922             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11923         fi
11924         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11925         qt5_minimal_minor="6"
11926         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11927             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11928         else
11929             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11930         fi
11931     fi
11933     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11934     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11936     AC_MSG_CHECKING([for Qt5 headers])
11937     qt5_incdir="no"
11938     for inc_dir in $qt5_incdirs; do
11939         if test -r "$inc_dir/$qt5_test_include"; then
11940             qt5_incdir="$inc_dir"
11941             break
11942         fi
11943     done
11944     AC_MSG_RESULT([$qt5_incdir])
11945     if test "x$qt5_incdir" = "xno"; then
11946         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11947     fi
11949     AC_MSG_CHECKING([for Qt5 libraries])
11950     qt5_libdir="no"
11951     for lib_dir in $qt5_libdirs; do
11952         if test -r "$lib_dir/$qt5_test_library"; then
11953             qt5_libdir="$lib_dir"
11954             break
11955         fi
11956     done
11957     AC_MSG_RESULT([$qt5_libdir])
11958     if test "x$qt5_libdir" = "xno"; then
11959         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11960     fi
11962     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11963     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11964     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11966     if test "$USING_X11" = TRUE; then
11967         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11968         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11969             QT5_HAVE_XCB_ICCCM=1
11970             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11971         ],[
11972             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)])
11973             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11974         ])
11975         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11976         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11977         QT5_USING_X11=1
11978         AC_DEFINE(QT5_USING_X11)
11979     fi
11981     dnl Check for Meta Object Compiler
11983     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11984     if test "$MOC5" = "no"; then
11985         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11986 the root of your Qt installation by exporting QT5DIR before running "configure".])
11987     fi
11989     if test "$build_gstreamer_1_0" = "yes"; then
11990         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11991                 QT5_HAVE_GOBJECT=1
11992                 AC_DEFINE(QT5_HAVE_GOBJECT)
11993             ],
11994             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11995         )
11996     fi
11998 AC_SUBST(QT5_CFLAGS)
11999 AC_SUBST(QT5_LIBS)
12000 AC_SUBST(MOC5)
12001 AC_SUBST(QT5_GOBJECT_CFLAGS)
12002 AC_SUBST(QT5_GOBJECT_LIBS)
12003 AC_SUBST(QT5_HAVE_GOBJECT)
12005 dnl ===================================================================
12006 dnl KF5 Integration
12007 dnl ===================================================================
12009 KF5_CFLAGS=""
12010 KF5_LIBS=""
12011 KF5_CONFIG="kf5-config"
12012 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12013         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12014 then
12015     if test "$OS" = "HAIKU"; then
12016         haiku_arch="`echo $RTL_ARCH | tr X x`"
12017         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12018         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12019     fi
12021     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12022     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12023     if test -n "$supports_multilib"; then
12024         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12025     fi
12027     kf5_test_include="KF5/kcoreaddons_version.h"
12028     kf5_test_library="libKF5CoreAddons.so"
12029     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12031     dnl kf5 KDE4 support compatibility installed
12032     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12033     if test "$KF5_CONFIG" != "no"; then
12034         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12035         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12036     fi
12038     dnl Check for KF5 headers
12039     AC_MSG_CHECKING([for KF5 headers])
12040     kf5_incdir="no"
12041     for kf5_check in $kf5_incdirs; do
12042         if test -r "$kf5_check/$kf5_test_include"; then
12043             kf5_incdir="$kf5_check/KF5"
12044             break
12045         fi
12046     done
12047     AC_MSG_RESULT([$kf5_incdir])
12048     if test "x$kf5_incdir" = "xno"; then
12049         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12050     fi
12052     dnl Check for KF5 libraries
12053     AC_MSG_CHECKING([for KF5 libraries])
12054     kf5_libdir="no"
12055     for kf5_check in $kf5_libdirs; do
12056         if test -r "$kf5_check/$kf5_test_library"; then
12057             kf5_libdir="$kf5_check"
12058             break
12059         fi
12060     done
12062     AC_MSG_RESULT([$kf5_libdir])
12063     if test "x$kf5_libdir" = "xno"; then
12064         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12065     fi
12067     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"
12068     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12069     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12071     if test "$USING_X11" = TRUE; then
12072         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12073     fi
12075     AC_LANG_PUSH([C++])
12076     save_CXXFLAGS=$CXXFLAGS
12077     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12078     AC_MSG_CHECKING([whether KDE is >= 5.0])
12079        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12080 #include <kcoreaddons_version.h>
12082 int main(int argc, char **argv) {
12083        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12084        else return 1;
12086        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12087     CXXFLAGS=$save_CXXFLAGS
12088     AC_LANG_POP([C++])
12090 AC_SUBST(KF5_CFLAGS)
12091 AC_SUBST(KF5_LIBS)
12093 dnl ===================================================================
12094 dnl Test whether to include Evolution 2 support
12095 dnl ===================================================================
12096 AC_MSG_CHECKING([whether to enable evolution 2 support])
12097 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
12098     AC_MSG_RESULT([yes])
12099     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12100     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12101     FilterLibs "${GOBJECT_LIBS}"
12102     GOBJECT_LIBS="${filteredlibs}"
12103     ENABLE_EVOAB2="TRUE"
12104 else
12105     ENABLE_EVOAB2=""
12106     AC_MSG_RESULT([no])
12108 AC_SUBST(ENABLE_EVOAB2)
12109 AC_SUBST(GOBJECT_CFLAGS)
12110 AC_SUBST(GOBJECT_LIBS)
12112 dnl ===================================================================
12113 dnl Test which themes to include
12114 dnl ===================================================================
12115 AC_MSG_CHECKING([which themes to include])
12116 # if none given use default subset of available themes
12117 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12118     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"
12121 WITH_THEMES=""
12122 if test "x$with_theme" != "xno"; then
12123     for theme in $with_theme; do
12124         case $theme in
12125         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" ;;
12126         default) real_theme=colibre ;;
12127         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12128         esac
12129         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12130     done
12132 AC_MSG_RESULT([$WITH_THEMES])
12133 AC_SUBST([WITH_THEMES])
12134 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12135 for theme in $with_theme; do
12136     case $theme in
12137     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12138     *) ;;
12139     esac
12140 done
12142 dnl ===================================================================
12143 dnl Test whether to integrate helppacks into the product's installer
12144 dnl ===================================================================
12145 AC_MSG_CHECKING([for helppack integration])
12146 if test "$with_helppack_integration" = "no"; then
12147     AC_MSG_RESULT([no integration])
12148 else
12149     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12150     AC_MSG_RESULT([integration])
12153 ###############################################################################
12154 # Extensions checking
12155 ###############################################################################
12156 AC_MSG_CHECKING([for extensions integration])
12157 if test "x$enable_extension_integration" != "xno"; then
12158     WITH_EXTENSION_INTEGRATION=TRUE
12159     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12160     AC_MSG_RESULT([yes, use integration])
12161 else
12162     WITH_EXTENSION_INTEGRATION=
12163     AC_MSG_RESULT([no, do not integrate])
12165 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12167 dnl Should any extra extensions be included?
12168 dnl There are standalone tests for each of these below.
12169 WITH_EXTRA_EXTENSIONS=
12170 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12172 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12173 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12174 if test "x$with_java" != "xno"; then
12175     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12176     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12179 AC_MSG_CHECKING([whether to build opens___.ttf])
12180 if test "$enable_build_opensymbol" = "yes"; then
12181     AC_MSG_RESULT([yes])
12182     AC_PATH_PROG(FONTFORGE, fontforge)
12183     if test -z "$FONTFORGE"; then
12184         AC_MSG_ERROR([fontforge not installed])
12185     fi
12186 else
12187     AC_MSG_RESULT([no])
12188     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
12189     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12191 AC_SUBST(OPENSYMBOL_TTF)
12192 AC_SUBST(FONTFORGE)
12194 dnl ===================================================================
12195 dnl Test whether to include fonts
12196 dnl ===================================================================
12197 AC_MSG_CHECKING([whether to include third-party fonts])
12198 if test "$with_fonts" != "no"; then
12199     AC_MSG_RESULT([yes])
12200     WITH_FONTS=TRUE
12201     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12202     AC_DEFINE(HAVE_MORE_FONTS)
12203 else
12204     AC_MSG_RESULT([no])
12205     WITH_FONTS=
12206     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12208 AC_SUBST(WITH_FONTS)
12211 dnl ===================================================================
12212 dnl Test whether to enable online update service
12213 dnl ===================================================================
12214 AC_MSG_CHECKING([whether to enable online update])
12215 ENABLE_ONLINE_UPDATE=
12216 ENABLE_ONLINE_UPDATE_MAR=
12217 UPDATE_CONFIG=
12218 if test "$enable_online_update" = ""; then
12219     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12220         AC_MSG_RESULT([yes])
12221         ENABLE_ONLINE_UPDATE="TRUE"
12222     else
12223         AC_MSG_RESULT([no])
12224     fi
12225 else
12226     if test "$enable_online_update" = "mar"; then
12227         AC_MSG_RESULT([yes - MAR-based online update])
12228         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12229         if test "$with_update_config" = ""; then
12230             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12231         fi
12232         UPDATE_CONFIG="$with_update_config"
12233         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12234     elif test "$enable_online_update" = "yes"; then
12235         AC_MSG_RESULT([yes])
12236         ENABLE_ONLINE_UPDATE="TRUE"
12237     else
12238         AC_MSG_RESULT([no])
12239     fi
12241 AC_SUBST(ENABLE_ONLINE_UPDATE)
12242 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
12243 AC_SUBST(UPDATE_CONFIG)
12245 dnl ===================================================================
12246 dnl Test whether we need bzip2
12247 dnl ===================================================================
12248 SYSTEM_BZIP2=
12249 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
12250     AC_MSG_CHECKING([whether to use system bzip2])
12251     if test "$with_system_bzip2" = yes; then
12252         SYSTEM_BZIP2=TRUE
12253         AC_MSG_RESULT([yes])
12254         PKG_CHECK_MODULES(BZIP2, bzip2)
12255         FilterLibs "${BZIP2_LIBS}"
12256         BZIP2_LIBS="${filteredlibs}"
12257     else
12258         AC_MSG_RESULT([no])
12259         BUILD_TYPE="$BUILD_TYPE BZIP2"
12260     fi
12262 AC_SUBST(SYSTEM_BZIP2)
12263 AC_SUBST(BZIP2_CFLAGS)
12264 AC_SUBST(BZIP2_LIBS)
12266 dnl ===================================================================
12267 dnl Test whether to enable extension update
12268 dnl ===================================================================
12269 AC_MSG_CHECKING([whether to enable extension update])
12270 ENABLE_EXTENSION_UPDATE=
12271 if test "x$enable_extension_update" = "xno"; then
12272     AC_MSG_RESULT([no])
12273 else
12274     AC_MSG_RESULT([yes])
12275     ENABLE_EXTENSION_UPDATE="TRUE"
12276     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
12277     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
12279 AC_SUBST(ENABLE_EXTENSION_UPDATE)
12282 dnl ===================================================================
12283 dnl Test whether to create MSI with LIMITUI=1 (silent install)
12284 dnl ===================================================================
12285 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
12286 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
12287     AC_MSG_RESULT([no])
12288     ENABLE_SILENT_MSI=
12289 else
12290     AC_MSG_RESULT([yes])
12291     ENABLE_SILENT_MSI=TRUE
12292     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
12294 AC_SUBST(ENABLE_SILENT_MSI)
12296 AC_MSG_CHECKING([whether and how to use Xinerama])
12297 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
12298     if test "$x_libraries" = "default_x_libraries"; then
12299         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
12300         if test "x$XINERAMALIB" = x; then
12301            XINERAMALIB="/usr/lib"
12302         fi
12303     else
12304         XINERAMALIB="$x_libraries"
12305     fi
12306     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
12307         # we have both versions, let the user decide but use the dynamic one
12308         # per default
12309         USE_XINERAMA=TRUE
12310         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
12311             XINERAMA_LINK=dynamic
12312         else
12313             XINERAMA_LINK=static
12314         fi
12315     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
12316         # we have only the dynamic version
12317         USE_XINERAMA=TRUE
12318         XINERAMA_LINK=dynamic
12319     elif test -e "$XINERAMALIB/libXinerama.a"; then
12320         # static version
12321         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
12322             USE_XINERAMA=TRUE
12323             XINERAMA_LINK=static
12324         else
12325             USE_XINERAMA=
12326             XINERAMA_LINK=none
12327         fi
12328     else
12329         # no Xinerama
12330         USE_XINERAMA=
12331         XINERAMA_LINK=none
12332     fi
12333     if test "$USE_XINERAMA" = "TRUE"; then
12334         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
12335         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
12336             [AC_MSG_ERROR(Xinerama header not found.)], [])
12337         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
12338         if test "x$XEXTLIB" = x; then
12339            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
12340         fi
12341         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
12342         if test "$_os" = "FreeBSD"; then
12343             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
12344         fi
12345         if test "$_os" = "Linux"; then
12346             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
12347         fi
12348         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
12349             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
12350     else
12351         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
12352     fi
12353 else
12354     USE_XINERAMA=
12355     XINERAMA_LINK=none
12356     AC_MSG_RESULT([no])
12358 AC_SUBST(USE_XINERAMA)
12359 AC_SUBST(XINERAMA_LINK)
12361 dnl ===================================================================
12362 dnl Test whether to build cairo or rely on the system version
12363 dnl ===================================================================
12365 if test "$USING_X11" = TRUE; then
12366     # Used in vcl/Library_vclplug_gen.mk
12367     test_cairo=yes
12370 if test "$test_cairo" = "yes"; then
12371     AC_MSG_CHECKING([whether to use the system cairo])
12373     : ${with_system_cairo:=$with_system_libs}
12374     if test "$with_system_cairo" = "yes"; then
12375         SYSTEM_CAIRO=TRUE
12376         AC_MSG_RESULT([yes])
12378         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
12379         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12380         FilterLibs "${CAIRO_LIBS}"
12381         CAIRO_LIBS="${filteredlibs}"
12383         if test "$test_xrender" = "yes"; then
12384             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
12385             AC_LANG_PUSH([C])
12386             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
12387 #ifdef PictStandardA8
12388 #else
12389       return fail;
12390 #endif
12391 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
12393             AC_LANG_POP([C])
12394         fi
12395     else
12396         SYSTEM_CAIRO=
12397         AC_MSG_RESULT([no])
12399         BUILD_TYPE="$BUILD_TYPE CAIRO"
12400     fi
12403 AC_SUBST(SYSTEM_CAIRO)
12404 AC_SUBST(CAIRO_CFLAGS)
12405 AC_SUBST(CAIRO_LIBS)
12407 dnl ===================================================================
12408 dnl Test whether to use avahi
12409 dnl ===================================================================
12410 if test "$_os" = "WINNT"; then
12411     # Windows uses bundled mDNSResponder
12412     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
12413 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12414     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12415                       [ENABLE_AVAHI="TRUE"])
12416     AC_DEFINE(HAVE_FEATURE_AVAHI)
12417     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12418     FilterLibs "${AVAHI_LIBS}"
12419     AVAHI_LIBS="${filteredlibs}"
12422 AC_SUBST(ENABLE_AVAHI)
12423 AC_SUBST(AVAHI_CFLAGS)
12424 AC_SUBST(AVAHI_LIBS)
12426 dnl ===================================================================
12427 dnl Test whether to use liblangtag
12428 dnl ===================================================================
12429 SYSTEM_LIBLANGTAG=
12430 AC_MSG_CHECKING([whether to use system liblangtag])
12431 if test "$with_system_liblangtag" = yes; then
12432     SYSTEM_LIBLANGTAG=TRUE
12433     AC_MSG_RESULT([yes])
12434     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12435     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12436     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12437     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12438     FilterLibs "${LIBLANGTAG_LIBS}"
12439     LIBLANGTAG_LIBS="${filteredlibs}"
12440 else
12441     SYSTEM_LIBLANGTAG=
12442     AC_MSG_RESULT([no])
12443     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12444     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12445     if test "$COM" = "MSC"; then
12446         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12447     else
12448         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12449     fi
12451 AC_SUBST(SYSTEM_LIBLANGTAG)
12452 AC_SUBST(LIBLANGTAG_CFLAGS)
12453 AC_SUBST(LIBLANGTAG_LIBS)
12455 dnl ===================================================================
12456 dnl Test whether to build libpng or rely on the system version
12457 dnl ===================================================================
12459 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12461 dnl ===================================================================
12462 dnl Check for runtime JVM search path
12463 dnl ===================================================================
12464 if test "$ENABLE_JAVA" != ""; then
12465     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12466     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12467         AC_MSG_RESULT([yes])
12468         if ! test -d "$with_jvm_path"; then
12469             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12470         fi
12471         if ! test -d "$with_jvm_path"jvm; then
12472             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12473         fi
12474         JVM_ONE_PATH_CHECK="$with_jvm_path"
12475         AC_SUBST(JVM_ONE_PATH_CHECK)
12476     else
12477         AC_MSG_RESULT([no])
12478     fi
12481 dnl ===================================================================
12482 dnl Test for the presence of Ant and that it works
12483 dnl ===================================================================
12485 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12486     ANT_HOME=; export ANT_HOME
12487     WITH_ANT_HOME=; export WITH_ANT_HOME
12488     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12489         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12490             if test "$_os" = "WINNT"; then
12491                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12492             else
12493                 with_ant_home="$LODE_HOME/opt/ant"
12494             fi
12495         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12496             with_ant_home="$LODE_HOME/opt/ant"
12497         fi
12498     fi
12499     if test -z "$with_ant_home"; then
12500         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12501     else
12502         if test "$_os" = "WINNT"; then
12503             # AC_PATH_PROGS needs unix path
12504             with_ant_home=`cygpath -u "$with_ant_home"`
12505         fi
12506         AbsolutePath "$with_ant_home"
12507         with_ant_home=$absolute_path
12508         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12509         WITH_ANT_HOME=$with_ant_home
12510         ANT_HOME=$with_ant_home
12511     fi
12513     if test -z "$ANT"; then
12514         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12515     else
12516         # resolve relative or absolute symlink
12517         while test -h "$ANT"; do
12518             a_cwd=`pwd`
12519             a_basename=`basename "$ANT"`
12520             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12521             cd "`dirname "$ANT"`"
12522             cd "`dirname "$a_script"`"
12523             ANT="`pwd`"/"`basename "$a_script"`"
12524             cd "$a_cwd"
12525         done
12527         AC_MSG_CHECKING([if $ANT works])
12528         mkdir -p conftest.dir
12529         a_cwd=$(pwd)
12530         cd conftest.dir
12531         cat > conftest.java << EOF
12532         public class conftest {
12533             int testmethod(int a, int b) {
12534                     return a + b;
12535             }
12536         }
12539         cat > conftest.xml << EOF
12540         <project name="conftest" default="conftest">
12541         <target name="conftest">
12542             <javac srcdir="." includes="conftest.java">
12543             </javac>
12544         </target>
12545         </project>
12548         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12549         if test $? = 0 -a -f ./conftest.class; then
12550             AC_MSG_RESULT([Ant works])
12551             if test -z "$WITH_ANT_HOME"; then
12552                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12553                 if test -z "$ANT_HOME"; then
12554                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12555                 fi
12556             else
12557                 ANT_HOME="$WITH_ANT_HOME"
12558             fi
12559         else
12560             echo "configure: Ant test failed" >&5
12561             cat conftest.java >&5
12562             cat conftest.xml >&5
12563             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12564         fi
12565         cd "$a_cwd"
12566         rm -fr conftest.dir
12567     fi
12568     if test -z "$ANT_HOME"; then
12569         ANT_HOME="NO_ANT_HOME"
12570     else
12571         PathFormat "$ANT_HOME"
12572         ANT_HOME="$formatted_path"
12573         PathFormat "$ANT"
12574         ANT="$formatted_path"
12575     fi
12576     AC_SUBST(ANT_HOME)
12577     AC_SUBST(ANT)
12579     dnl Checking for ant.jar
12580     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12581         AC_MSG_CHECKING([Ant lib directory])
12582         if test -f $ANT_HOME/lib/ant.jar; then
12583             ANT_LIB="$ANT_HOME/lib"
12584         else
12585             if test -f $ANT_HOME/ant.jar; then
12586                 ANT_LIB="$ANT_HOME"
12587             else
12588                 if test -f /usr/share/java/ant.jar; then
12589                     ANT_LIB=/usr/share/java
12590                 else
12591                     if test -f /usr/share/ant-core/lib/ant.jar; then
12592                         ANT_LIB=/usr/share/ant-core/lib
12593                     else
12594                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12595                             ANT_LIB="$ANT_HOME/lib/ant"
12596                         else
12597                             if test -f /usr/share/lib/ant/ant.jar; then
12598                                 ANT_LIB=/usr/share/lib/ant
12599                             else
12600                                 AC_MSG_ERROR([Ant libraries not found!])
12601                             fi
12602                         fi
12603                     fi
12604                 fi
12605             fi
12606         fi
12607         PathFormat "$ANT_LIB"
12608         ANT_LIB="$formatted_path"
12609         AC_MSG_RESULT([Ant lib directory found.])
12610     fi
12611     AC_SUBST(ANT_LIB)
12613     ant_minver=1.6.0
12614     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12616     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12617     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12618     ant_version_major=`echo $ant_version | cut -d. -f1`
12619     ant_version_minor=`echo $ant_version | cut -d. -f2`
12620     echo "configure: ant_version $ant_version " >&5
12621     echo "configure: ant_version_major $ant_version_major " >&5
12622     echo "configure: ant_version_minor $ant_version_minor " >&5
12623     if test "$ant_version_major" -ge "2"; then
12624         AC_MSG_RESULT([yes, $ant_version])
12625     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12626         AC_MSG_RESULT([yes, $ant_version])
12627     else
12628         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12629     fi
12631     rm -f conftest* core core.* *.core
12634 OOO_JUNIT_JAR=
12635 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12636     AC_MSG_CHECKING([for JUnit 4])
12637     if test "$with_junit" = "yes"; then
12638         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12639             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12640         elif test -e /usr/share/java/junit4.jar; then
12641             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12642         else
12643            if test -e /usr/share/lib/java/junit.jar; then
12644               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12645            else
12646               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12647            fi
12648         fi
12649     else
12650         OOO_JUNIT_JAR=$with_junit
12651     fi
12652     if test "$_os" = "WINNT"; then
12653         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12654     fi
12655     printf 'import org.junit.Before;' > conftest.java
12656     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12657         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12658     else
12659         AC_MSG_ERROR(
12660 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12661  specify its pathname via --with-junit=..., or disable it via --without-junit])
12662     fi
12663     rm -f conftest.class conftest.java
12664     if test $OOO_JUNIT_JAR != ""; then
12665     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12666     fi
12668 AC_SUBST(OOO_JUNIT_JAR)
12670 HAMCREST_JAR=
12671 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12672     AC_MSG_CHECKING([for included Hamcrest])
12673     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12674     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12675         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12676     else
12677         AC_MSG_RESULT([Not included])
12678         AC_MSG_CHECKING([for standalone hamcrest jar.])
12679         if test "$with_hamcrest" = "yes"; then
12680             if test -e /usr/share/lib/java/hamcrest.jar; then
12681                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12682             elif test -e /usr/share/java/hamcrest/core.jar; then
12683                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12684             else
12685                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12686             fi
12687         else
12688             HAMCREST_JAR=$with_hamcrest
12689         fi
12690         if test "$_os" = "WINNT"; then
12691             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12692         fi
12693         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12694             AC_MSG_RESULT([$HAMCREST_JAR])
12695         else
12696             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),
12697                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12698         fi
12699     fi
12700     rm -f conftest.class conftest.java
12702 AC_SUBST(HAMCREST_JAR)
12705 AC_SUBST(SCPDEFS)
12708 # check for wget and curl
12710 WGET=
12711 CURL=
12713 if test "$enable_fetch_external" != "no"; then
12715 CURL=`which curl 2>/dev/null`
12717 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12718     # wget new enough?
12719     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12720     if test $? -eq 0; then
12721         WGET=$i
12722         break
12723     fi
12724 done
12726 if test -z "$WGET" -a -z "$CURL"; then
12727     AC_MSG_ERROR([neither wget nor curl found!])
12732 AC_SUBST(WGET)
12733 AC_SUBST(CURL)
12736 # check for sha256sum
12738 SHA256SUM=
12740 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12741     eval "$i -a 256 --version" > /dev/null 2>&1
12742     ret=$?
12743     if test $ret -eq 0; then
12744         SHA256SUM="$i -a 256"
12745         break
12746     fi
12747 done
12749 if test -z "$SHA256SUM"; then
12750     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12751         eval "$i --version" > /dev/null 2>&1
12752         ret=$?
12753         if test $ret -eq 0; then
12754             SHA256SUM=$i
12755             break
12756         fi
12757     done
12760 if test -z "$SHA256SUM"; then
12761     AC_MSG_ERROR([no sha256sum found!])
12764 AC_SUBST(SHA256SUM)
12766 dnl ===================================================================
12767 dnl Dealing with l10n options
12768 dnl ===================================================================
12769 AC_MSG_CHECKING([which languages to be built])
12770 # get list of all languages
12771 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12772 # the sed command does the following:
12773 #   + if a line ends with a backslash, append the next line to it
12774 #   + adds " on the beginning of the value (after =)
12775 #   + adds " at the end of the value
12776 #   + removes en-US; we want to put it on the beginning
12777 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12778 [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)]
12779 ALL_LANGS="en-US $completelangiso"
12780 # check the configured localizations
12781 WITH_LANG="$with_lang"
12783 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12784 # (Norwegian is "nb" and "nn".)
12785 if test "$WITH_LANG" = "no"; then
12786     WITH_LANG=
12789 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12790     AC_MSG_RESULT([en-US])
12791 else
12792     AC_MSG_RESULT([$WITH_LANG])
12793     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12794     if test -z "$MSGFMT"; then
12795         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12796             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12797         elif test -x "/opt/lo/bin/msgfmt"; then
12798             MSGFMT="/opt/lo/bin/msgfmt"
12799         else
12800             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12801             if test -z "$MSGFMT"; then
12802                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12803             fi
12804         fi
12805     fi
12806     if test -z "$MSGUNIQ"; then
12807         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12808             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12809         elif test -x "/opt/lo/bin/msguniq"; then
12810             MSGUNIQ="/opt/lo/bin/msguniq"
12811         else
12812             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12813             if test -z "$MSGUNIQ"; then
12814                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12815             fi
12816         fi
12817     fi
12819 AC_SUBST(MSGFMT)
12820 AC_SUBST(MSGUNIQ)
12821 # check that the list is valid
12822 for lang in $WITH_LANG; do
12823     test "$lang" = "ALL" && continue
12824     # need to check for the exact string, so add space before and after the list of all languages
12825     for vl in $ALL_LANGS; do
12826         if test "$vl" = "$lang"; then
12827            break
12828         fi
12829     done
12830     if test "$vl" != "$lang"; then
12831         # if you're reading this - you prolly quoted your languages remove the quotes ...
12832         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12833     fi
12834 done
12835 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12836     echo $WITH_LANG | grep -q en-US
12837     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12839 # list with substituted ALL
12840 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12841 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12842 test "$WITH_LANG" = "en-US" && WITH_LANG=
12843 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12844     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12845     ALL_LANGS=`echo $ALL_LANGS qtz`
12847 AC_SUBST(ALL_LANGS)
12848 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12849 AC_SUBST(WITH_LANG)
12850 AC_SUBST(WITH_LANG_LIST)
12851 AC_SUBST(GIT_NEEDED_SUBMODULES)
12853 WITH_POOR_HELP_LOCALIZATIONS=
12854 if test -d "$SRC_ROOT/translations/source"; then
12855     for l in `ls -1 $SRC_ROOT/translations/source`; do
12856         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12857             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12858         fi
12859     done
12861 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12863 if test -n "$with_locales"; then
12864     WITH_LOCALES="$with_locales"
12866     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12867     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12868     # config_host/config_locales.h.in
12869     for locale in $WITH_LOCALES; do
12870         lang=${locale%_*}
12872         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12874         case $lang in
12875         hi|mr*ne)
12876             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12877             ;;
12878         bg|ru)
12879             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12880             ;;
12881         esac
12882     done
12883 else
12884     AC_DEFINE(WITH_LOCALE_ALL)
12886 AC_SUBST(WITH_LOCALES)
12888 dnl git submodule update --reference
12889 dnl ===================================================================
12890 if test -n "${GIT_REFERENCE_SRC}"; then
12891     for repo in ${GIT_NEEDED_SUBMODULES}; do
12892         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12893             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12894         fi
12895     done
12897 AC_SUBST(GIT_REFERENCE_SRC)
12899 dnl git submodules linked dirs
12900 dnl ===================================================================
12901 if test -n "${GIT_LINK_SRC}"; then
12902     for repo in ${GIT_NEEDED_SUBMODULES}; do
12903         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12904             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12905         fi
12906     done
12908 AC_SUBST(GIT_LINK_SRC)
12910 dnl branding
12911 dnl ===================================================================
12912 AC_MSG_CHECKING([for alternative branding images directory])
12913 # initialize mapped arrays
12914 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
12915 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg about.svg"
12917 if test -z "$with_branding" -o "$with_branding" = "no"; then
12918     AC_MSG_RESULT([none])
12919     DEFAULT_BRAND_IMAGES="$brand_files"
12920 else
12921     if ! test -d $with_branding ; then
12922         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12923     else
12924         AC_MSG_RESULT([$with_branding])
12925         CUSTOM_BRAND_DIR="$with_branding"
12926         for lfile in $brand_files
12927         do
12928             if ! test -f $with_branding/$lfile ; then
12929                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12930                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12931             else
12932                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12933             fi
12934         done
12935         check_for_progress="yes"
12936     fi
12938 AC_SUBST([BRAND_INTRO_IMAGES])
12939 AC_SUBST([CUSTOM_BRAND_DIR])
12940 AC_SUBST([CUSTOM_BRAND_IMAGES])
12941 AC_SUBST([DEFAULT_BRAND_IMAGES])
12944 AC_MSG_CHECKING([for 'intro' progress settings])
12945 PROGRESSBARCOLOR=
12946 PROGRESSSIZE=
12947 PROGRESSPOSITION=
12948 PROGRESSFRAMECOLOR=
12949 PROGRESSTEXTCOLOR=
12950 PROGRESSTEXTBASELINE=
12952 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12953     source "$with_branding/progress.conf"
12954     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12955 else
12956     AC_MSG_RESULT([none])
12959 AC_SUBST(PROGRESSBARCOLOR)
12960 AC_SUBST(PROGRESSSIZE)
12961 AC_SUBST(PROGRESSPOSITION)
12962 AC_SUBST(PROGRESSFRAMECOLOR)
12963 AC_SUBST(PROGRESSTEXTCOLOR)
12964 AC_SUBST(PROGRESSTEXTBASELINE)
12967 dnl ===================================================================
12968 dnl Custom build version
12969 dnl ===================================================================
12970 AC_MSG_CHECKING([for extra build ID])
12971 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12972     EXTRA_BUILDID="$with_extra_buildid"
12974 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12975 if test -n "$EXTRA_BUILDID" ; then
12976     AC_MSG_RESULT([$EXTRA_BUILDID])
12977 else
12978     AC_MSG_RESULT([not set])
12980 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12982 OOO_VENDOR=
12983 AC_MSG_CHECKING([for vendor])
12984 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12985     OOO_VENDOR="$USERNAME"
12987     if test -z "$OOO_VENDOR"; then
12988         OOO_VENDOR="$USER"
12989     fi
12991     if test -z "$OOO_VENDOR"; then
12992         OOO_VENDOR="`id -u -n`"
12993     fi
12995     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12996 else
12997     OOO_VENDOR="$with_vendor"
12998     AC_MSG_RESULT([$OOO_VENDOR])
13000 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13001 AC_SUBST(OOO_VENDOR)
13003 if test "$_os" = "Android" ; then
13004     ANDROID_PACKAGE_NAME=
13005     AC_MSG_CHECKING([for Android package name])
13006     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13007         if test -n "$ENABLE_DEBUG"; then
13008             # Default to the package name that makes ndk-gdb happy.
13009             ANDROID_PACKAGE_NAME="org.libreoffice"
13010         else
13011             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13012         fi
13014         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13015     else
13016         ANDROID_PACKAGE_NAME="$with_android_package_name"
13017         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13018     fi
13019     AC_SUBST(ANDROID_PACKAGE_NAME)
13022 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13023 if test "$with_compat_oowrappers" = "yes"; then
13024     WITH_COMPAT_OOWRAPPERS=TRUE
13025     AC_MSG_RESULT(yes)
13026 else
13027     WITH_COMPAT_OOWRAPPERS=
13028     AC_MSG_RESULT(no)
13030 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13032 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
13033 AC_MSG_CHECKING([for install dirname])
13034 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13035     INSTALLDIRNAME="$with_install_dirname"
13037 AC_MSG_RESULT([$INSTALLDIRNAME])
13038 AC_SUBST(INSTALLDIRNAME)
13040 AC_MSG_CHECKING([for prefix])
13041 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13042 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13043 PREFIXDIR="$prefix"
13044 AC_MSG_RESULT([$PREFIXDIR])
13045 AC_SUBST(PREFIXDIR)
13047 LIBDIR=[$(eval echo $(eval echo $libdir))]
13048 AC_SUBST(LIBDIR)
13050 DATADIR=[$(eval echo $(eval echo $datadir))]
13051 AC_SUBST(DATADIR)
13053 MANDIR=[$(eval echo $(eval echo $mandir))]
13054 AC_SUBST(MANDIR)
13056 DOCDIR=[$(eval echo $(eval echo $docdir))]
13057 AC_SUBST(DOCDIR)
13059 BINDIR=[$(eval echo $(eval echo $bindir))]
13060 AC_SUBST(BINDIR)
13062 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13063 AC_SUBST(INSTALLDIR)
13065 TESTINSTALLDIR="${BUILDDIR}/test-install"
13066 AC_SUBST(TESTINSTALLDIR)
13069 # ===================================================================
13070 # OAuth2 id and secrets
13071 # ===================================================================
13073 AC_MSG_CHECKING([for Google Drive client id and secret])
13074 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13075     AC_MSG_RESULT([not set])
13076     GDRIVE_CLIENT_ID="\"\""
13077     GDRIVE_CLIENT_SECRET="\"\""
13078 else
13079     AC_MSG_RESULT([set])
13080     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13081     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13083 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13084 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13086 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13087 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13088     AC_MSG_RESULT([not set])
13089     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13090     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13091 else
13092     AC_MSG_RESULT([set])
13093     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13094     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13096 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13097 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13099 AC_MSG_CHECKING([for OneDrive client id and secret])
13100 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13101     AC_MSG_RESULT([not set])
13102     ONEDRIVE_CLIENT_ID="\"\""
13103     ONEDRIVE_CLIENT_SECRET="\"\""
13104 else
13105     AC_MSG_RESULT([set])
13106     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13107     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13109 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13110 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13113 dnl ===================================================================
13114 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13115 dnl --enable-dependency-tracking configure option
13116 dnl ===================================================================
13117 AC_MSG_CHECKING([whether to enable dependency tracking])
13118 if test "$enable_dependency_tracking" = "no"; then
13119     nodep=TRUE
13120     AC_MSG_RESULT([no])
13121 else
13122     AC_MSG_RESULT([yes])
13124 AC_SUBST(nodep)
13126 dnl ===================================================================
13127 dnl Number of CPUs to use during the build
13128 dnl ===================================================================
13129 AC_MSG_CHECKING([for number of processors to use])
13130 # plain --with-parallelism is just the default
13131 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13132     if test "$with_parallelism" = "no"; then
13133         PARALLELISM=0
13134     else
13135         PARALLELISM=$with_parallelism
13136     fi
13137 else
13138     if test "$enable_icecream" = "yes"; then
13139         PARALLELISM="40"
13140     else
13141         case `uname -s` in
13143         Darwin|FreeBSD|NetBSD|OpenBSD)
13144             PARALLELISM=`sysctl -n hw.ncpu`
13145             ;;
13147         Linux)
13148             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13149         ;;
13150         # what else than above does profit here *and* has /proc?
13151         *)
13152             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13153             ;;
13154         esac
13156         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13157         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13158     fi
13161 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13162     if test -z "$with_parallelism"; then
13163             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13164             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13165             PARALLELISM="1"
13166     else
13167         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."
13168     fi
13171 if test $PARALLELISM -eq 0; then
13172     AC_MSG_RESULT([explicit make -j option needed])
13173 else
13174     AC_MSG_RESULT([$PARALLELISM])
13176 AC_SUBST(PARALLELISM)
13178 IWYU_PATH="$with_iwyu"
13179 AC_SUBST(IWYU_PATH)
13180 if test ! -z "$IWYU_PATH"; then
13181     if test ! -f "$IWYU_PATH"; then
13182         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13183     fi
13187 # Set up ILIB for MSVC build
13189 ILIB1=
13190 if test "$build_os" = "cygwin"; then
13191     ILIB="."
13192     if test -n "$JAVA_HOME"; then
13193         ILIB="$ILIB;$JAVA_HOME/lib"
13194     fi
13195     ILIB1=-link
13196     if test "$BITNESS_OVERRIDE" = 64; then
13197         ILIB="$ILIB;$COMPATH/lib/x64"
13198         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
13199         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
13200         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
13201         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13202             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
13203             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
13204         fi
13205         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
13206         ucrtlibpath_formatted=$formatted_path
13207         ILIB="$ILIB;$ucrtlibpath_formatted"
13208         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13209     else
13210         ILIB="$ILIB;$COMPATH/lib/x86"
13211         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
13212         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
13213         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
13214         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13215             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
13216             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
13217         fi
13218         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
13219         ucrtlibpath_formatted=$formatted_path
13220         ILIB="$ILIB;$ucrtlibpath_formatted"
13221         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13222     fi
13223     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13224         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13225     else
13226         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
13227     fi
13229     AC_SUBST(ILIB)
13232 # ===================================================================
13233 # Creating bigger shared library to link against
13234 # ===================================================================
13235 AC_MSG_CHECKING([whether to create huge library])
13236 MERGELIBS=
13238 if test $_os = iOS -o $_os = Android; then
13239     # Never any point in mergelibs for these as we build just static
13240     # libraries anyway...
13241     enable_mergelibs=no
13244 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
13245     if test $_os != Linux -a $_os != WINNT; then
13246         add_warning "--enable-mergelibs is not tested for this platform"
13247     fi
13248     MERGELIBS="TRUE"
13249     AC_MSG_RESULT([yes])
13250     AC_DEFINE(ENABLE_MERGELIBS)
13251 else
13252     AC_MSG_RESULT([no])
13254 AC_SUBST([MERGELIBS])
13256 dnl ===================================================================
13257 dnl icerun is a wrapper that stops us spawning tens of processes
13258 dnl locally - for tools that can't be executed on the compile cluster
13259 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
13260 dnl ===================================================================
13261 AC_MSG_CHECKING([whether to use icerun wrapper])
13262 ICECREAM_RUN=
13263 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
13264     ICECREAM_RUN=icerun
13265     AC_MSG_RESULT([yes])
13266 else
13267     AC_MSG_RESULT([no])
13269 AC_SUBST(ICECREAM_RUN)
13271 dnl ===================================================================
13272 dnl Setup the ICECC_VERSION for the build the same way it was set for
13273 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
13274 dnl ===================================================================
13275 x_ICECC_VERSION=[\#]
13276 if test -n "$ICECC_VERSION" ; then
13277     x_ICECC_VERSION=
13279 AC_SUBST(x_ICECC_VERSION)
13280 AC_SUBST(ICECC_VERSION)
13282 dnl ===================================================================
13284 AC_MSG_CHECKING([MPL subset])
13285 MPL_SUBSET=
13287 if test "$enable_mpl_subset" = "yes"; then
13288     warn_report=false
13289     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13290         warn_report=true
13291     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
13292         warn_report=true
13293     fi
13294     if test "$warn_report" = "true"; then
13295         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
13296     fi
13297     if test "x$enable_postgresql_sdbc" != "xno"; then
13298         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
13299     fi
13300     if test "$enable_lotuswordpro" = "yes"; then
13301         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
13302     fi
13303     if test "$WITH_WEBDAV" = "neon"; then
13304         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
13305     fi
13306     if test -n "$ENABLE_POPPLER"; then
13307         if test "x$SYSTEM_POPPLER" = "x"; then
13308             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
13309         fi
13310     fi
13311     # cf. m4/libo_check_extension.m4
13312     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
13313         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
13314     fi
13315     for theme in $WITH_THEMES; do
13316         case $theme in
13317         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
13318             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
13319         *) : ;;
13320         esac
13321     done
13323     ENABLE_OPENGL_TRANSITIONS=
13325     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
13326         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
13327     fi
13329     MPL_SUBSET="TRUE"
13330     AC_DEFINE(MPL_HAVE_SUBSET)
13331     AC_MSG_RESULT([only])
13332 else
13333     AC_MSG_RESULT([no restrictions])
13335 AC_SUBST(MPL_SUBSET)
13337 dnl ===================================================================
13339 AC_MSG_CHECKING([formula logger])
13340 ENABLE_FORMULA_LOGGER=
13342 if test "x$enable_formula_logger" = "xyes"; then
13343     AC_MSG_RESULT([yes])
13344     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13345     ENABLE_FORMULA_LOGGER=TRUE
13346 elif test -n "$ENABLE_DBGUTIL" ; then
13347     AC_MSG_RESULT([yes])
13348     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13349     ENABLE_FORMULA_LOGGER=TRUE
13350 else
13351     AC_MSG_RESULT([no])
13354 AC_SUBST(ENABLE_FORMULA_LOGGER)
13356 dnl ===================================================================
13357 dnl Checking for active Antivirus software.
13358 dnl ===================================================================
13360 if test $_os = WINNT ; then
13361     AC_MSG_CHECKING([for active Antivirus software])
13362     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
13363     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
13364         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
13365             AC_MSG_RESULT([found])
13366             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
13367             echo $EICAR_STRING > $SRC_ROOT/eicar
13368             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
13369             rm $SRC_ROOT/eicar
13370             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13371                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13372             fi
13373             echo $EICAR_STRING > $BUILDDIR/eicar
13374             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
13375             rm $BUILDDIR/eicar
13376             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13377                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13378             fi
13379             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"
13380         else
13381             AC_MSG_RESULT([not found])
13382         fi
13383     else
13384         AC_MSG_RESULT([n/a])
13385     fi
13388 dnl ===================================================================
13389 dnl Setting up the environment.
13390 dnl ===================================================================
13391 AC_MSG_NOTICE([setting up the build environment variables...])
13393 AC_SUBST(COMPATH)
13395 if test "$build_os" = "cygwin"; then
13396     if test -d "$COMPATH/atlmfc/lib/spectre"; then
13397         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
13398         ATL_INCLUDE="$COMPATH/atlmfc/include"
13399     elif test -d "$COMPATH/atlmfc/lib"; then
13400         ATL_LIB="$COMPATH/atlmfc/lib"
13401         ATL_INCLUDE="$COMPATH/atlmfc/include"
13402     else
13403         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
13404         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
13405     fi
13406     if test "$BITNESS_OVERRIDE" = 64; then
13407         ATL_LIB="$ATL_LIB/x64"
13408     else
13409         ATL_LIB="$ATL_LIB/x86"
13410     fi
13411     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
13412     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
13414     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
13415     PathFormat "/usr/bin/find.exe"
13416     FIND="$formatted_path"
13417     PathFormat "/usr/bin/sort.exe"
13418     SORT="$formatted_path"
13419     PathFormat "/usr/bin/grep.exe"
13420     WIN_GREP="$formatted_path"
13421     PathFormat "/usr/bin/ls.exe"
13422     WIN_LS="$formatted_path"
13423     PathFormat "/usr/bin/touch.exe"
13424     WIN_TOUCH="$formatted_path"
13425 else
13426     FIND=find
13427     SORT=sort
13430 AC_SUBST(ATL_INCLUDE)
13431 AC_SUBST(ATL_LIB)
13432 AC_SUBST(FIND)
13433 AC_SUBST(SORT)
13434 AC_SUBST(WIN_GREP)
13435 AC_SUBST(WIN_LS)
13436 AC_SUBST(WIN_TOUCH)
13438 AC_SUBST(BUILD_TYPE)
13440 AC_SUBST(SOLARINC)
13442 PathFormat "$PERL"
13443 PERL="$formatted_path"
13444 AC_SUBST(PERL)
13446 if test -n "$TMPDIR"; then
13447     TEMP_DIRECTORY="$TMPDIR"
13448 else
13449     TEMP_DIRECTORY="/tmp"
13451 if test "$build_os" = "cygwin"; then
13452     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
13454 AC_SUBST(TEMP_DIRECTORY)
13456 # setup the PATH for the environment
13457 if test -n "$LO_PATH_FOR_BUILD"; then
13458     LO_PATH="$LO_PATH_FOR_BUILD"
13459 else
13460     LO_PATH="$PATH"
13462     case "$host_os" in
13464     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13465         if test "$ENABLE_JAVA" != ""; then
13466             pathmunge "$JAVA_HOME/bin" "after"
13467         fi
13468         ;;
13470     cygwin*)
13471         # Win32 make needs native paths
13472         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13473             LO_PATH=`cygpath -p -m "$PATH"`
13474         fi
13475         if test "$BITNESS_OVERRIDE" = 64; then
13476             # needed for msi packaging
13477             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13478         fi
13479         # .NET 4.6 and higher don't have bin directory
13480         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13481             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13482         fi
13483         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13484         pathmunge "$CSC_PATH" "before"
13485         pathmunge "$MIDL_PATH" "before"
13486         pathmunge "$AL_PATH" "before"
13487         pathmunge "$MSPDB_PATH" "before"
13488         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13489             pathmunge "$CL_PATH" "before"
13490         fi
13491         if test -n "$MSBUILD_PATH" ; then
13492             pathmunge "$MSBUILD_PATH" "before"
13493         fi
13494         if test "$BITNESS_OVERRIDE" = 64; then
13495             pathmunge "$COMPATH/bin/amd64" "before"
13496             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13497         else
13498             pathmunge "$COMPATH/bin" "before"
13499             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13500         fi
13501         if test "$ENABLE_JAVA" != ""; then
13502             if test -d "$JAVA_HOME/jre/bin/client"; then
13503                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13504             fi
13505             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13506                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13507             fi
13508             pathmunge "$JAVA_HOME/bin" "before"
13509         fi
13510         ;;
13512     solaris*)
13513         pathmunge "/usr/css/bin" "before"
13514         if test "$ENABLE_JAVA" != ""; then
13515             pathmunge "$JAVA_HOME/bin" "after"
13516         fi
13517         ;;
13518     esac
13521 AC_SUBST(LO_PATH)
13523 libo_FUZZ_SUMMARY
13525 # Generate a configuration sha256 we can use for deps
13526 if test -f config_host.mk; then
13527     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13529 if test -f config_host_lang.mk; then
13530     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13533 CFLAGS=$my_original_CFLAGS
13534 CXXFLAGS=$my_original_CXXFLAGS
13535 CPPFLAGS=$my_original_CPPFLAGS
13537 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
13538 # BUILD platform configuration] - otherwise breaks cross building
13539 AC_CONFIG_FILES([config_host.mk
13540                  config_host_lang.mk
13541                  Makefile
13542                  bin/bffvalidator.sh
13543                  bin/odfvalidator.sh
13544                  bin/officeotron.sh
13545                  hardened_runtime.xcent
13546                  instsetoo_native/util/openoffice.lst
13547                  sysui/desktop/macosx/Info.plist])
13548 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13549 AC_CONFIG_HEADERS([config_host/config_clang.h])
13550 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13551 AC_CONFIG_HEADERS([config_host/config_eot.h])
13552 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13553 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13554 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13555 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13556 AC_CONFIG_HEADERS([config_host/config_features.h])
13557 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13558 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13559 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13560 AC_CONFIG_HEADERS([config_host/config_folders.h])
13561 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13562 AC_CONFIG_HEADERS([config_host/config_gio.h])
13563 AC_CONFIG_HEADERS([config_host/config_global.h])
13564 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13565 AC_CONFIG_HEADERS([config_host/config_java.h])
13566 AC_CONFIG_HEADERS([config_host/config_langs.h])
13567 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13568 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13569 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13570 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13571 AC_CONFIG_HEADERS([config_host/config_locales.h])
13572 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13573 AC_CONFIG_HEADERS([config_host/config_oox.h])
13574 AC_CONFIG_HEADERS([config_host/config_options.h])
13575 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13576 AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
13577 AC_CONFIG_HEADERS([config_host/config_skia.h])
13578 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13579 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13580 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13581 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13582 AC_CONFIG_HEADERS([config_host/config_version.h])
13583 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13584 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13585 AC_CONFIG_HEADERS([config_host/config_python.h])
13586 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13587 AC_OUTPUT
13589 if test "$CROSS_COMPILING" = TRUE; then
13590     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13593 # touch the config timestamp file
13594 if test ! -f config_host.mk.stamp; then
13595     echo > config_host.mk.stamp
13596 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13597     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13598 else
13599     echo > config_host.mk.stamp
13602 # touch the config lang timestamp file
13603 if test ! -f config_host_lang.mk.stamp; then
13604     echo > config_host_lang.mk.stamp
13605 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13606     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13607 else
13608     echo > config_host_lang.mk.stamp
13612 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13613         -a "$build_os" = "cygwin"; then
13615 cat << _EOS
13616 ****************************************************************************
13617 WARNING:
13618 Your make version is known to be horribly slow, and hard to debug
13619 problems with. To get a reasonably functional make please do:
13621 to install a pre-compiled binary make for Win32
13623  mkdir -p /opt/lo/bin
13624  cd /opt/lo/bin
13625  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13626  cp make-4.2.1-msvc.exe make
13627  chmod +x make
13629 to install from source:
13630 place yourself in a working directory of you choice.
13632  git clone git://git.savannah.gnu.org/make.git
13634  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
13635  set PATH=%PATH%;C:\Cygwin\bin
13636  [or Cygwin64, if that is what you have]
13637  cd path-to-make-repo-you-cloned-above
13638  build_w32.bat --without-guile
13640 should result in a WinRel/gnumake.exe.
13641 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13643 Then re-run autogen.sh
13645 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13646 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13648 _EOS
13649 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13650     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13655 cat << _EOF
13656 ****************************************************************************
13658 To build, run:
13659 $GNUMAKE
13661 To view some help, run:
13662 $GNUMAKE help
13664 _EOF
13666 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13667     cat << _EOF
13668 After the build has finished successfully, you can immediately run what you built using the command:
13669 _EOF
13671     if test $_os = Darwin; then
13672         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
13673     else
13674         echo instdir/program/soffice
13675     fi
13676     cat << _EOF
13678 If you want to run the smoketest, run:
13679 $GNUMAKE check
13681 _EOF
13684 if test -f warn; then
13685     cat warn
13686     rm warn
13689 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: