tdf#123406 KDE5: Use delayed frame destruction
[LibreOffice.git] / configure.ac
blob3b28ca40cef156b1711df5de41156377198ff2fd
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],[6.3.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 BUILD_TYPE="LibO"
29 SCPDEFS=""
30 GIT_NEEDED_SUBMODULES=""
31 LO_PATH= # used by path_munge to construct a PATH variable
33 FilterLibs()
35     filteredlibs=
36     for f in $1; do
37         case "$f" in
38             # let's start with Fedora's paths for now
39             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
40                 # ignore it: on UNIXoids it is searched by default anyway
41                 # but if it's given explicitly then it may override other paths
42                 # (on macOS it would be an error to use it instead of SDK)
43                 ;;
44             *)
45                 filteredlibs="$filteredlibs $f"
46                 ;;
47         esac
48     done
51 PathFormat()
53     formatted_path="$1"
54     if test "$build_os" = "cygwin"; then
55         pf_conv_to_dos=
56         # spaces,parentheses,brackets,braces are problematic in pathname
57         # so are backslashes
58         case "$formatted_path" in
59             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
60                 pf_conv_to_dos="yes"
61             ;;
62         esac
63         if test "$pf_conv_to_dos" = "yes"; then
64             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
65                 formatted_path=`cygpath -sm "$formatted_path"`
66             else
67                 formatted_path=`cygpath -d "$formatted_path"`
68             fi
69             if test $? -ne 0;  then
70                 AC_MSG_ERROR([path conversion failed for "$1".])
71             fi
72         fi
73         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
74         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
75         if test "$fp_count_slash$fp_count_colon" != "00"; then
76             if test "$fp_count_colon" = "0"; then
77                 new_formatted_path=`realpath "$formatted_path"`
78                 if test $? -ne 0;  then
79                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
80                 else
81                     formatted_path="$new_formatted_path"
82                 fi
83             fi
84             formatted_path=`cygpath -m "$formatted_path"`
85             if test $? -ne 0;  then
86                 AC_MSG_ERROR([path conversion failed for "$1".])
87             fi
88         fi
89         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
90         if test "$fp_count_space" != "0"; then
91             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
92         fi
93     fi
96 AbsolutePath()
98     # There appears to be no simple and portable method to get an absolute and
99     # canonical path, so we try creating the directory if does not exist and
100     # utilizing the shell and pwd.
101     rel="$1"
102     absolute_path=""
103     test ! -e "$rel" && mkdir -p "$rel"
104     if test -d "$rel" ; then
105         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
106         absolute_path="$(pwd)"
107         cd - > /dev/null
108     else
109         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
110     fi
113 rm -f warn
114 have_WARNINGS="no"
115 add_warning()
117     if test "$have_WARNINGS" = "no"; then
118         echo "*************************************" > warn
119         have_WARNINGS="yes"
120         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
121             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
122             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
123         else
124             COLORWARN="* WARNING :"
125         fi
126     fi
127     echo "$COLORWARN $@" >> warn
130 dnl Some Mac User have the bad habit of letting a lot of crap
131 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
132 dnl that confuse the build.
133 dnl For the ones that use LODE, let's be nice and protect them
134 dnl from themselves
136 mac_sanitize_path()
138     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
139 dnl a common but nevertheless necessary thing that may be in a fancy
140 dnl path location is git, so make sure we have it
141     mac_git_path=`which git 2>/dev/null`
142     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
143         mac_path="$mac_path:`dirname $mac_git_path`"
144     fi
145 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
146 dnl path location is gpg, so make sure we find it
147     mac_gpg_path=`which gpg 2>/dev/null`
148     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
149         mac_path="$mac_path:`dirname $mac_gpg_path`"
150     fi
151     PATH="$mac_path"
152     unset mac_path
153     unset mac_git_path
154     unset mac_gpg_path
157 echo "********************************************************************"
158 echo "*"
159 echo "*   Running ${PACKAGE_NAME} build configuration."
160 echo "*"
161 echo "********************************************************************"
162 echo ""
164 dnl ===================================================================
165 dnl checks build and host OSes
166 dnl do this before argument processing to allow for platform dependent defaults
167 dnl ===================================================================
168 AC_CANONICAL_HOST
170 AC_MSG_CHECKING([for product name])
171 PRODUCTNAME="AC_PACKAGE_NAME"
172 if test -n "$with_product_name" -a "$with_product_name" != no; then
173     PRODUCTNAME="$with_product_name"
175 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
176     PRODUCTNAME="${PRODUCTNAME}Dev"
178 AC_MSG_RESULT([$PRODUCTNAME])
179 AC_SUBST(PRODUCTNAME)
180 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
181 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
183 dnl ===================================================================
184 dnl Our version is defined by the AC_INIT() at the top of this script.
185 dnl ===================================================================
187 AC_MSG_CHECKING([for package version])
188 if test -n "$with_package_version" -a "$with_package_version" != no; then
189     PACKAGE_VERSION="$with_package_version"
191 AC_MSG_RESULT([$PACKAGE_VERSION])
193 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
195 LIBO_VERSION_MAJOR=$1
196 LIBO_VERSION_MINOR=$2
197 LIBO_VERSION_MICRO=$3
198 LIBO_VERSION_PATCH=$4
200 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
201 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
202 # no way to encode that into an integer in general.
203 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
205 LIBO_VERSION_SUFFIX=$5
206 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
207 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
208 # they get undoubled before actually passed to sed.
209 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
210 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
211 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
212 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
214 AC_SUBST(LIBO_VERSION_MAJOR)
215 AC_SUBST(LIBO_VERSION_MINOR)
216 AC_SUBST(LIBO_VERSION_MICRO)
217 AC_SUBST(LIBO_VERSION_PATCH)
218 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
219 AC_SUBST(LIBO_VERSION_SUFFIX)
220 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
222 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
223 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
224 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
225 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
227 LIBO_THIS_YEAR=`date +%Y`
228 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
230 dnl ===================================================================
231 dnl Product version
232 dnl ===================================================================
233 AC_MSG_CHECKING([for product version])
234 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
235 AC_MSG_RESULT([$PRODUCTVERSION])
236 AC_SUBST(PRODUCTVERSION)
238 AC_PROG_EGREP
239 # AC_PROG_EGREP doesn't set GREP on all systems as well
240 AC_PATH_PROG(GREP, grep)
242 BUILDDIR=`pwd`
243 cd $srcdir
244 SRC_ROOT=`pwd`
245 cd $BUILDDIR
246 x_Cygwin=[\#]
248 dnl ======================================
249 dnl Required GObject introspection version
250 dnl ======================================
251 INTROSPECTION_REQUIRED_VERSION=1.32.0
253 dnl ===================================================================
254 dnl Search all the common names for GNU Make
255 dnl ===================================================================
256 AC_MSG_CHECKING([for GNU Make])
258 # try to use our own make if it is available and GNUMAKE was not already defined
259 if test -z "$GNUMAKE"; then
260     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
261         GNUMAKE="$LODE_HOME/opt/bin/make"
262     elif test -x "/opt/lo/bin/make"; then
263         GNUMAKE="/opt/lo/bin/make"
264     fi
267 GNUMAKE_WIN_NATIVE=
268 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
269     if test -n "$a"; then
270         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
271         if test $? -eq 0;  then
272             if test "$build_os" = "cygwin"; then
273                 if test -n "$($a -v | grep 'Built for Windows')" ; then
274                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
275                     GNUMAKE_WIN_NATIVE="TRUE"
276                 else
277                     GNUMAKE=`which $a`
278                 fi
279             else
280                 GNUMAKE=`which $a`
281             fi
282             break
283         fi
284     fi
285 done
286 AC_MSG_RESULT($GNUMAKE)
287 if test -z "$GNUMAKE"; then
288     AC_MSG_ERROR([not found. install GNU Make.])
289 else
290     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
291         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
292     fi
295 win_short_path_for_make()
297     local_short_path="$1"
298     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
299         cygpath -sm "$local_short_path"
300     else
301         cygpath -u "$(cygpath -d "$local_short_path")"
302     fi
306 if test "$build_os" = "cygwin"; then
307     PathFormat "$SRC_ROOT"
308     SRC_ROOT="$formatted_path"
309     PathFormat "$BUILDDIR"
310     BUILDDIR="$formatted_path"
311     x_Cygwin=
312     AC_MSG_CHECKING(for explicit COMSPEC)
313     if test -z "$COMSPEC"; then
314         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
315     else
316         AC_MSG_RESULT([found: $COMSPEC])
317     fi
320 AC_SUBST(SRC_ROOT)
321 AC_SUBST(BUILDDIR)
322 AC_SUBST(x_Cygwin)
323 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
324 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
326 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
327     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
330 # need sed in os checks...
331 AC_PATH_PROGS(SED, sed)
332 if test -z "$SED"; then
333     AC_MSG_ERROR([install sed to run this script])
336 # Set the ENABLE_LTO variable
337 # ===================================================================
338 AC_MSG_CHECKING([whether to use link-time optimization])
339 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
340     ENABLE_LTO="TRUE"
341     AC_MSG_RESULT([yes])
342     AC_DEFINE(STATIC_LINKING)
343 else
344     ENABLE_LTO=""
345     AC_MSG_RESULT([no])
347 AC_SUBST(ENABLE_LTO)
349 AC_ARG_ENABLE(fuzz-options,
350     AS_HELP_STRING([--enable-fuzz-options],
351         [Randomly enable or disable each of those configurable options
352          that are supposed to be freely selectable without interdependencies,
353          or where bad interaction from interdependencies is automatically avoided.])
356 dnl ===================================================================
357 dnl When building for Android, --with-android-ndk,
358 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
359 dnl mandatory
360 dnl ===================================================================
362 AC_ARG_WITH(android-ndk,
363     AS_HELP_STRING([--with-android-ndk],
364         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
367 AC_ARG_WITH(android-ndk-toolchain-version,
368     AS_HELP_STRING([--with-android-ndk-toolchain-version],
369         [Specify which toolchain version to use, of those present in the
370         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
371         with_android_ndk_toolchain_version=clang5.0)
373 AC_ARG_WITH(android-sdk,
374     AS_HELP_STRING([--with-android-sdk],
375         [Specify location of the Android SDK. Mandatory when building for Android.]),
378 ANDROID_NDK_HOME=
379 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
380     with_android_ndk="$SRC_ROOT/external/android-ndk"
382 if test -n "$with_android_ndk"; then
383     ANDROID_NDK_HOME=$with_android_ndk
385     # Set up a lot of pre-canned defaults
387     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
388         if test ! -f $ANDROID_NDK_HOME/source.properties; then
389             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
390         fi
391         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
392     else
393         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
394     fi
395     if test -z "$ANDROID_NDK_VERSION";  then
396         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
397     fi
398     case $ANDROID_NDK_VERSION in
399     r9*|r10*)
400         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
401         ;;
402     11.1.*|12.1.*|13.1.*|14.1.*)
403         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
404         ;;
405     16.*)
406         ;;
407     *)
408         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
409         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
410         ;;
411     esac
413     ANDROID_API_LEVEL=14
414     android_cpu=$host_cpu
415     ANDROID_ARCH=$android_cpu
416     if test $host_cpu = arm; then
417         android_platform_prefix=$android_cpu-linux-androideabi
418         android_gnu_prefix=$android_platform_prefix
419         LLVM_TRIPLE=armv7-none-linux-androideabi
420         ANDROID_APP_ABI=armeabi-v7a
421         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
422     elif test $host_cpu = aarch64; then
423         android_platform_prefix=$android_cpu-linux-android
424         android_gnu_prefix=$android_platform_prefix
425         LLVM_TRIPLE=aarch64-none-linux-android
426         # minimum android version that supports aarch64
427         ANDROID_API_LEVEL=21
428         ANDROID_APP_ABI=arm64-v8a
429         ANDROID_ARCH=arm64
430     elif test $host_cpu = mips; then
431         android_platform_prefix=mipsel-linux-android
432         android_gnu_prefix=$android_platform_prefix
433         LLVM_TRIPLE=mipsel-none-linux-android
434         ANDROID_APP_ABI=mips
435     else
436         # host_cpu is something like "i386" or "i686" I guess, NDK uses
437         # "x86" in some contexts
438         android_cpu=x86
439         android_platform_prefix=$android_cpu
440         android_gnu_prefix=i686-linux-android
441         LLVM_TRIPLE=i686-none-linux-android
442         ANDROID_APP_ABI=x86
443         ANDROID_ARCH=$android_cpu
444         ANDROIDCFLAGS="-march=atom"
445     fi
447     case "$with_android_ndk_toolchain_version" in
448     clang5.0)
449         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
450         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
451         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
452         ;;
453     *)
454         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
455     esac
457     if test ! -d $ANDROID_BINUTILS_DIR; then
458         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
459     elif test ! -d $ANDROID_COMPILER_DIR; then
460         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
461     fi
463     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
464     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
465     # manage to link the (app-specific) single huge .so that is built for the app in
466     # android/source/ if there is debug information in a significant part of the object files.
467     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
468     # all objects have been built with debug information.)
469     case $build_os in
470     linux-gnu*)
471         ndk_build_os=linux
472         ;;
473     darwin*)
474         ndk_build_os=darwin
475         ;;
476     *)
477         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
478         ;;
479     esac
480     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
481     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
482     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
484     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
485     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
486     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
487     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
488     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
489     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
491     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
492     # android is using different sysroots for compilation and linking, but as
493     # there is no full separation in configure and elsewhere, use isystem for
494     # compilation stuff and sysroot for linking
495     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
496     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
497     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
498     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
499     if test "$ENABLE_LTO" = TRUE; then
500         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
501         # $CC and $CXX when building external libraries
502         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
503     fi
505     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
507     if test -z "$CC"; then
508         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
509     fi
510     if test -z "$CXX"; then
511         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
512     fi
514     # remember to download the ownCloud Android library later
515     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
517 AC_SUBST(ANDROID_NDK_HOME)
518 AC_SUBST(ANDROID_APP_ABI)
519 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
521 dnl ===================================================================
522 dnl --with-android-sdk
523 dnl ===================================================================
524 ANDROID_SDK_HOME=
525 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
526     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
528 if test -n "$with_android_sdk"; then
529     ANDROID_SDK_HOME=$with_android_sdk
530     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
532 AC_SUBST(ANDROID_SDK_HOME)
534 libo_FUZZ_ARG_ENABLE([android-editing],
535     AS_HELP_STRING([--enable-android-editing],
536         [Enable the experimental editing feature on Android.])
538 ENABLE_ANDROID_EDITING=
539 if test "$enable_android_editing" = yes; then
540     ENABLE_ANDROID_EDITING=TRUE
542 AC_SUBST([ENABLE_ANDROID_EDITING])
544 dnl ===================================================================
545 dnl The following is a list of supported systems.
546 dnl Sequential to keep the logic very simple
547 dnl These values may be checked and reset later.
548 dnl ===================================================================
549 #defaults unless the os test overrides this:
550 test_randr=yes
551 test_xrender=yes
552 test_cups=yes
553 test_dbus=yes
554 test_fontconfig=yes
555 test_cairo=no
556 test_gdb_index=no
557 test_split_debug=no
559 # Default values, as such probably valid just for Linux, set
560 # differently below just for Mac OSX, but at least better than
561 # hardcoding these as we used to do. Much of this is duplicated also
562 # in solenv for old build system and for gbuild, ideally we should
563 # perhaps define stuff like this only here in configure.ac?
565 LINKFLAGSSHL="-shared"
566 PICSWITCH="-fpic"
567 DLLPOST=".so"
569 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
571 INSTROOTBASESUFFIX=
572 INSTROOTCONTENTSUFFIX=
573 SDKDIRNAME=sdk
575 case "$host_os" in
577 solaris*)
578     test_gtk=yes
579     build_gstreamer_1_0=yes
580     build_gstreamer_0_10=yes
581     test_freetype=yes
582     _os=SunOS
584     dnl ===========================================================
585     dnl Check whether we're using Solaris 10 - SPARC or Intel.
586     dnl ===========================================================
587     AC_MSG_CHECKING([the Solaris operating system release])
588     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
589     if test "$_os_release" -lt "10"; then
590         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
591     else
592         AC_MSG_RESULT([ok ($_os_release)])
593     fi
595     dnl Check whether we're using a SPARC or i386 processor
596     AC_MSG_CHECKING([the processor type])
597     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
598         AC_MSG_RESULT([ok ($host_cpu)])
599     else
600         AC_MSG_ERROR([only SPARC and i386 processors are supported])
601     fi
602     ;;
604 linux-gnu*|k*bsd*-gnu*)
605     test_gtk=yes
606     build_gstreamer_1_0=yes
607     build_gstreamer_0_10=yes
608     test_kde5=yes
609     test_gtk3_kde5=yes
610     test_gdb_index=yes
611     test_split_debug=yes
612     if test "$enable_fuzzers" != yes; then
613         test_freetype=yes
614         test_fontconfig=yes
615     else
616         test_freetype=no
617         test_fontconfig=no
618         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
619     fi
620     _os=Linux
621     ;;
623 gnu)
624     test_randr=no
625     test_xrender=no
626     _os=GNU
627      ;;
629 cygwin*|interix*)
631     # When building on Windows normally with MSVC under Cygwin,
632     # configure thinks that the host platform (the platform the
633     # built code will run on) is Cygwin, even if it obviously is
634     # Windows, which in Autoconf terminology is called
635     # "mingw32". (Which is misleading as MinGW is the name of the
636     # tool-chain, not an operating system.)
638     # Somewhat confusing, yes. But this configure script doesn't
639     # look at $host etc that much, it mostly uses its own $_os
640     # variable, set here in this case statement.
642     test_cups=no
643     test_dbus=no
644     test_randr=no
645     test_xrender=no
646     test_freetype=no
647     test_fontconfig=no
648     _os=WINNT
650     DLLPOST=".dll"
651     LINKFLAGSNOUNDEFS=
652     ;;
654 darwin*) # macOS or iOS
655     test_gtk=yes
656     test_randr=no
657     test_xrender=no
658     test_freetype=no
659     test_fontconfig=no
660     test_dbus=no
661     if test -n "$LODE_HOME" ; then
662         mac_sanitize_path
663         AC_MSG_NOTICE([sanitized the PATH to $PATH])
664     fi
665     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
666         build_for_ios=YES
667         _os=iOS
668         test_gtk=no
669         test_cups=no
670         enable_mpl_subset=yes
671         enable_lotuswordpro=no
672         enable_coinmp=no
673         enable_lpsolve=no
674         enable_postgresql_sdbc=no
675         enable_extension_integration=no
676         enable_report_builder=no
677         with_ppds=no
678         if test "$enable_ios_simulator" = "yes"; then
679             host=x86_64-apple-darwin
680         fi
681     else
682         _os=Darwin
683         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
684         INSTROOTCONTENTSUFFIX=/Contents
685         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
686     fi
687     # See comment above the case "$host_os"
688     LINKFLAGSSHL="-dynamiclib -single_module"
690     # -fPIC is default
691     PICSWITCH=""
693     DLLPOST=".dylib"
695     # -undefined error is the default
696     LINKFLAGSNOUNDEFS=""
699 freebsd*)
700     test_gtk=yes
701     build_gstreamer_1_0=yes
702     build_gstreamer_0_10=yes
703     test_kde5=yes
704     test_gtk3_kde5=yes
705     test_freetype=yes
706     AC_MSG_CHECKING([the FreeBSD operating system release])
707     if test -n "$with_os_version"; then
708         OSVERSION="$with_os_version"
709     else
710         OSVERSION=`/sbin/sysctl -n kern.osreldate`
711     fi
712     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
713     AC_MSG_CHECKING([which thread library to use])
714     if test "$OSVERSION" -lt "500016"; then
715         PTHREAD_CFLAGS="-D_THREAD_SAFE"
716         PTHREAD_LIBS="-pthread"
717     elif test "$OSVERSION" -lt "502102"; then
718         PTHREAD_CFLAGS="-D_THREAD_SAFE"
719         PTHREAD_LIBS="-lc_r"
720     else
721         PTHREAD_CFLAGS=""
722         PTHREAD_LIBS="-pthread"
723     fi
724     AC_MSG_RESULT([$PTHREAD_LIBS])
725     _os=FreeBSD
726     ;;
728 *netbsd*)
729     test_gtk=yes
730     build_gstreamer_1_0=yes
731     build_gstreamer_0_10=yes
732     test_kde5=yes
733     test_gtk3_kde5=yes
734     test_freetype=yes
735     PTHREAD_LIBS="-pthread -lpthread"
736     _os=NetBSD
737     ;;
739 aix*)
740     test_randr=no
741     test_freetype=yes
742     PTHREAD_LIBS=-pthread
743     _os=AIX
744     ;;
746 openbsd*)
747     test_gtk=yes
748     test_freetype=yes
749     PTHREAD_CFLAGS="-D_THREAD_SAFE"
750     PTHREAD_LIBS="-pthread"
751     _os=OpenBSD
752     ;;
754 dragonfly*)
755     test_gtk=yes
756     build_gstreamer_1_0=yes
757     build_gstreamer_0_10=yes
758     test_kde5=yes
759     test_gtk3_kde5=yes
760     test_freetype=yes
761     PTHREAD_LIBS="-pthread"
762     _os=DragonFly
763     ;;
765 linux-android*)
766     build_gstreamer_1_0=no
767     build_gstreamer_0_10=no
768     enable_lotuswordpro=no
769     enable_mpl_subset=yes
770     enable_coinmp=yes
771     enable_lpsolve=no
772     enable_report_builder=no
773     enable_odk=no
774     enable_postgresql_sdbc=no
775     enable_python=no
776     with_theme="tango"
777     test_cups=no
778     test_dbus=no
779     test_fontconfig=no
780     test_freetype=no
781     test_gtk=no
782     test_kde5=no
783     test_gtk3_kde5=no
784     test_randr=no
785     test_xrender=no
786     _os=Android
788     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
789     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
790     ;;
792 haiku*)
793     test_cups=no
794     test_dbus=no
795     test_randr=no
796     test_xrender=no
797     test_freetype=yes
798     enable_odk=no
799     enable_gstreamer_0_10=no
800     enable_gstreamer_1_0=no
801     enable_vlc=no
802     enable_coinmp=no
803     enable_pdfium=no
804     enable_sdremote=no
805     enable_postgresql_sdbc=no
806     enable_firebird_sdbc=no
807     _os=Haiku
808     ;;
811     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
812     ;;
813 esac
815 if test "$_os" = "Android" ; then
816     # Verify that the NDK and SDK options are proper
817     if test -z "$with_android_ndk"; then
818         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
819     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
820         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
821     fi
823     if test -z "$ANDROID_SDK_HOME"; then
824         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
825     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
826         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
827     fi
829     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
830     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
831         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
832                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
833                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
834         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
835         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
836         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
837     fi
838     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
839         AC_MSG_WARN([android support repository not found - install with
840                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
841                      to allow the build to download the specified version of the android support libraries])
842         add_warning "android support repository not found - install with"
843         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
844         add_warning "to allow the build to download the specified version of the android support libraries"
845     fi
848 if test "$_os" = "AIX"; then
849     AC_PATH_PROG(GAWK, gawk)
850     if test -z "$GAWK"; then
851         AC_MSG_ERROR([gawk not found in \$PATH])
852     fi
855 AC_SUBST(SDKDIRNAME)
857 AC_SUBST(PTHREAD_CFLAGS)
858 AC_SUBST(PTHREAD_LIBS)
860 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
861 # By default use the ones specified by our build system,
862 # but explicit override is possible.
863 AC_MSG_CHECKING(for explicit AFLAGS)
864 if test -n "$AFLAGS"; then
865     AC_MSG_RESULT([$AFLAGS])
866     x_AFLAGS=
867 else
868     AC_MSG_RESULT(no)
869     x_AFLAGS=[\#]
871 AC_MSG_CHECKING(for explicit CFLAGS)
872 if test -n "$CFLAGS"; then
873     AC_MSG_RESULT([$CFLAGS])
874     x_CFLAGS=
875 else
876     AC_MSG_RESULT(no)
877     x_CFLAGS=[\#]
879 AC_MSG_CHECKING(for explicit CXXFLAGS)
880 if test -n "$CXXFLAGS"; then
881     AC_MSG_RESULT([$CXXFLAGS])
882     x_CXXFLAGS=
883 else
884     AC_MSG_RESULT(no)
885     x_CXXFLAGS=[\#]
887 AC_MSG_CHECKING(for explicit OBJCFLAGS)
888 if test -n "$OBJCFLAGS"; then
889     AC_MSG_RESULT([$OBJCFLAGS])
890     x_OBJCFLAGS=
891 else
892     AC_MSG_RESULT(no)
893     x_OBJCFLAGS=[\#]
895 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
896 if test -n "$OBJCXXFLAGS"; then
897     AC_MSG_RESULT([$OBJCXXFLAGS])
898     x_OBJCXXFLAGS=
899 else
900     AC_MSG_RESULT(no)
901     x_OBJCXXFLAGS=[\#]
903 AC_MSG_CHECKING(for explicit LDFLAGS)
904 if test -n "$LDFLAGS"; then
905     AC_MSG_RESULT([$LDFLAGS])
906     x_LDFLAGS=
907 else
908     AC_MSG_RESULT(no)
909     x_LDFLAGS=[\#]
911 AC_SUBST(AFLAGS)
912 AC_SUBST(CFLAGS)
913 AC_SUBST(CXXFLAGS)
914 AC_SUBST(OBJCFLAGS)
915 AC_SUBST(OBJCXXFLAGS)
916 AC_SUBST(LDFLAGS)
917 AC_SUBST(x_AFLAGS)
918 AC_SUBST(x_CFLAGS)
919 AC_SUBST(x_CXXFLAGS)
920 AC_SUBST(x_OBJCFLAGS)
921 AC_SUBST(x_OBJCXXFLAGS)
922 AC_SUBST(x_LDFLAGS)
924 dnl These are potentially set for MSVC, in the code checking for UCRT below:
925 my_original_CFLAGS=$CFLAGS
926 my_original_CXXFLAGS=$CXXFLAGS
927 my_original_CPPFLAGS=$CPPFLAGS
929 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
930 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
931 dnl AC_PROG_CC internally.
932 if test "$_os" != "WINNT"; then
933     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
934     save_CFLAGS=$CFLAGS
935     AC_PROG_CC
936     CFLAGS=$save_CFLAGS
939 if test "$_os" != "WINNT"; then
940 AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
941 else
942 ENDIANNESS=little
944 AC_SUBST(ENDIANNESS)
946 if test $_os != "WINNT"; then
947     save_LIBS="$LIBS"
948     AC_SEARCH_LIBS([dlsym], [dl],
949         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
950         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
951     LIBS="$save_LIBS"
953 AC_SUBST(DLOPEN_LIBS)
955 AC_ARG_ENABLE(ios-simulator,
956     AS_HELP_STRING([--enable-ios-simulator],
957         [build i386 or x86_64 for ios simulator])
960 AC_ARG_ENABLE(ios-libreofficelight-app,
961     AS_HELP_STRING([--enable-ios-libreofficelight-app],
962         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
963          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
964          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
967 ENABLE_IOS_LIBREOFFICELIGHT_APP=
968 if test "$enable_ios_libreofficelight_app" = yes; then
969     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
971 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
973 ###############################################################################
974 # Extensions switches --enable/--disable
975 ###############################################################################
976 # By default these should be enabled unless having extra dependencies.
977 # If there is extra dependency over configure options then the enable should
978 # be automagic based on whether the requiring feature is enabled or not.
979 # All this options change anything only with --enable-extension-integration.
981 # The name of this option and its help string makes it sound as if
982 # extensions are built anyway, just not integrated in the installer,
983 # if you use --disable-extension-integration. Is that really the
984 # case?
986 libo_FUZZ_ARG_ENABLE(extension-integration,
987     AS_HELP_STRING([--disable-extension-integration],
988         [Disable integration of the built extensions in the installer of the
989          product. Use this switch to disable the integration.])
992 AC_ARG_ENABLE(avmedia,
993     AS_HELP_STRING([--disable-avmedia],
994         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
997 AC_ARG_ENABLE(database-connectivity,
998     AS_HELP_STRING([--disable-database-connectivity],
999         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1002 # This doesn't mean not building (or "integrating") extensions
1003 # (although it probably should; i.e. it should imply
1004 # --disable-extension-integration I guess), it means not supporting
1005 # any extension mechanism at all
1006 libo_FUZZ_ARG_ENABLE(extensions,
1007     AS_HELP_STRING([--disable-extensions],
1008         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1011 AC_ARG_ENABLE(scripting,
1012     AS_HELP_STRING([--disable-scripting],
1013         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1016 # This is mainly for Android and iOS, but could potentially be used in some
1017 # special case otherwise, too, so factored out as a separate setting
1019 AC_ARG_ENABLE(dynamic-loading,
1020     AS_HELP_STRING([--disable-dynamic-loading],
1021         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1024 libo_FUZZ_ARG_ENABLE(report-builder,
1025     AS_HELP_STRING([--disable-report-builder],
1026         [Disable the Report Builder.])
1029 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1030     AS_HELP_STRING([--enable-ext-wiki-publisher],
1031         [Enable the Wiki Publisher extension.])
1034 libo_FUZZ_ARG_ENABLE(lpsolve,
1035     AS_HELP_STRING([--disable-lpsolve],
1036         [Disable compilation of the lp solve solver ])
1038 libo_FUZZ_ARG_ENABLE(coinmp,
1039     AS_HELP_STRING([--disable-coinmp],
1040         [Disable compilation of the CoinMP solver ])
1043 libo_FUZZ_ARG_ENABLE(pdfimport,
1044     AS_HELP_STRING([--disable-pdfimport],
1045         [Disable building the PDF import feature.])
1048 libo_FUZZ_ARG_ENABLE(pdfium,
1049     AS_HELP_STRING([--disable-pdfium],
1050         [Disable building PDFium.])
1053 ###############################################################################
1055 dnl ---------- *** ----------
1057 libo_FUZZ_ARG_ENABLE(mergelibs,
1058     AS_HELP_STRING([--enable-mergelibs],
1059         [Merge several of the smaller libraries into one big, "merged", one.])
1062 libo_FUZZ_ARG_ENABLE(breakpad,
1063     AS_HELP_STRING([--enable-breakpad],
1064         [Enables breakpad for crash reporting.])
1067 AC_ARG_ENABLE(fetch-external,
1068     AS_HELP_STRING([--disable-fetch-external],
1069         [Disables fetching external tarballs from web sources.])
1072 AC_ARG_ENABLE(fuzzers,
1073     AS_HELP_STRING([--enable-fuzzers],
1074         [Enables building libfuzzer targets for fuzz testing.])
1077 libo_FUZZ_ARG_ENABLE(pch,
1078     AS_HELP_STRING([--enable-pch],
1079         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1082 libo_FUZZ_ARG_ENABLE(epm,
1083     AS_HELP_STRING([--enable-epm],
1084         [LibreOffice includes self-packaging code, that requires epm, however epm is
1085          useless for large scale package building.])
1088 libo_FUZZ_ARG_ENABLE(odk,
1089     AS_HELP_STRING([--disable-odk],
1090         [LibreOffice includes an ODK, office development kit which some packagers may
1091          wish to build without.])
1094 AC_ARG_ENABLE(mpl-subset,
1095     AS_HELP_STRING([--enable-mpl-subset],
1096         [Don't compile any pieces which are not MPL or more liberally licensed])
1099 libo_FUZZ_ARG_ENABLE(evolution2,
1100     AS_HELP_STRING([--enable-evolution2],
1101         [Allows the built-in evolution 2 addressbook connectivity build to be
1102          enabled.])
1105 AC_ARG_ENABLE(avahi,
1106     AS_HELP_STRING([--enable-avahi],
1107         [Determines whether to use Avahi to advertise Impress to remote controls.])
1110 libo_FUZZ_ARG_ENABLE(werror,
1111     AS_HELP_STRING([--enable-werror],
1112         [Turn warnings to errors. (Has no effect in modules where the treating
1113          of warnings as errors is disabled explicitly.)]),
1116 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1117     AS_HELP_STRING([--enable-assert-always-abort],
1118         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1121 libo_FUZZ_ARG_ENABLE(dbgutil,
1122     AS_HELP_STRING([--enable-dbgutil],
1123         [Provide debugging support from --enable-debug and include additional debugging
1124          utilities such as object counting or more expensive checks.
1125          This is the recommended option for developers.
1126          Note that this makes the build ABI incompatible, it is not possible to mix object
1127          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1129 libo_FUZZ_ARG_ENABLE(debug,
1130     AS_HELP_STRING([--enable-debug],
1131         [Include debugging information, disable compiler optimization and inlining plus
1132          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1134 libo_FUZZ_ARG_ENABLE(split-debug,
1135     AS_HELP_STRING([--disable-split-debug],
1136         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1137          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1139 libo_FUZZ_ARG_ENABLE(gdb-index,
1140     AS_HELP_STRING([--disable-gdb-index],
1141         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1142          The feature requires the gold or lld linker.]))
1144 libo_FUZZ_ARG_ENABLE(sal-log,
1145     AS_HELP_STRING([--enable-sal-log],
1146         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1148 AC_ARG_ENABLE(selective-debuginfo,
1149     AS_HELP_STRING([--enable-selective-debuginfo],
1150         [If --enable-debug or --enable-dbgutil is used, build debugging information
1151          (-g compiler flag) only for the specified gbuild build targets
1152          (where all means everything, - prepended means not to enable, / appended means
1153          everything in the directory; there is no ordering, more specific overrides
1154          more general, and disabling takes precedence).
1155          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1157 libo_FUZZ_ARG_ENABLE(symbols,
1158     AS_HELP_STRING([--enable-symbols],
1159         [Generate debug information.
1160          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1161          otherwise.]))
1163 libo_FUZZ_ARG_ENABLE(optimized,
1164     AS_HELP_STRING([--disable-optimized],
1165         [Whether to compile with optimization flags.
1166          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1167          otherwise.]))
1169 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1170     AS_HELP_STRING([--disable-runtime-optimizations],
1171         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1172          JVM JIT) that are known to interact badly with certain dynamic analysis
1173          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1174          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1175          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1177 AC_ARG_WITH(valgrind,
1178     AS_HELP_STRING([--with-valgrind],
1179         [Make availability of Valgrind headers a hard requirement.]))
1181 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1182     AS_HELP_STRING([--enable-compiler-plugins],
1183         [Enable compiler plugins that will perform additional checks during
1184          building. Enabled automatically by --enable-dbgutil.
1185          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1186 COMPILER_PLUGINS_DEBUG=
1187 if test "$enable_compiler_plugins" = debug; then
1188     enable_compiler_plugins=yes
1189     COMPILER_PLUGINS_DEBUG=TRUE
1192 libo_FUZZ_ARG_ENABLE(ooenv,
1193     AS_HELP_STRING([--disable-ooenv],
1194         [Disable ooenv for the instdir installation.]))
1196 libo_FUZZ_ARG_ENABLE(libnumbertext,
1197     AS_HELP_STRING([--disable-libnumbertext],
1198         [Disable use of numbertext external library.]))
1200 AC_ARG_ENABLE(lto,
1201     AS_HELP_STRING([--enable-lto],
1202         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1203          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1204          linker. For MSVC, this option is broken at the moment. This is experimental work
1205          in progress that shouldn't be used unless you are working on it.)]))
1207 AC_ARG_ENABLE(python,
1208     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1209         [Enables or disables Python support at run-time.
1210          Also specifies what Python to use. 'auto' is the default.
1211          'fully-internal' even forces the internal version for uses of Python
1212          during the build.]))
1214 libo_FUZZ_ARG_ENABLE(gtk,
1215     AS_HELP_STRING([--disable-gtk],
1216         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1217 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1219 libo_FUZZ_ARG_ENABLE(gtk3,
1220     AS_HELP_STRING([--disable-gtk3],
1221         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1222 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1224 AC_ARG_ENABLE(split-app-modules,
1225     AS_HELP_STRING([--enable-split-app-modules],
1226         [Split file lists for app modules, e.g. base, calc.
1227          Has effect only with make distro-pack-install]),
1230 AC_ARG_ENABLE(split-opt-features,
1231     AS_HELP_STRING([--enable-split-opt-features],
1232         [Split file lists for some optional features, e.g. pyuno, testtool.
1233          Has effect only with make distro-pack-install]),
1236 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1237     AS_HELP_STRING([--disable-cairo-canvas],
1238         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1241 libo_FUZZ_ARG_ENABLE(dbus,
1242     AS_HELP_STRING([--disable-dbus],
1243         [Determines whether to enable features that depend on dbus.
1244          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1245 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1247 libo_FUZZ_ARG_ENABLE(sdremote,
1248     AS_HELP_STRING([--disable-sdremote],
1249         [Determines whether to enable Impress remote control (i.e. the server component).]),
1250 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1252 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1253     AS_HELP_STRING([--disable-sdremote-bluetooth],
1254         [Determines whether to build sdremote with bluetooth support.
1255          Requires dbus on Linux.]))
1257 libo_FUZZ_ARG_ENABLE(gio,
1258     AS_HELP_STRING([--disable-gio],
1259         [Determines whether to use the GIO support.]),
1260 ,test "${enable_gio+set}" = set || enable_gio=yes)
1262 AC_ARG_ENABLE(qt5,
1263     AS_HELP_STRING([--enable-qt5],
1264         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1265          available.]),
1268 AC_ARG_ENABLE(kde5,
1269     AS_HELP_STRING([--enable-kde5],
1270         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1271          KF5 are available.]),
1274 AC_ARG_ENABLE(gtk3_kde5,
1275     AS_HELP_STRING([--enable-gtk3-kde5],
1276         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1277          platforms where Gtk3, Qt5 and Plasma is available.]),
1280 libo_FUZZ_ARG_ENABLE(gui,
1281     AS_HELP_STRING([--disable-gui],
1282         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1283          command-line option. Not related to LibreOffice Online functionality. Don't use
1284          unless you are certain you need to. Nobody will help you if you insist on trying
1285          this and run into problems.]),
1286 ,test "${enable_gui+set}" = set || enable_gui=yes)
1288 libo_FUZZ_ARG_ENABLE(randr,
1289     AS_HELP_STRING([--disable-randr],
1290         [Disable RandR support in the vcl project.]),
1291 ,test "${enable_randr+set}" = set || enable_randr=yes)
1293 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1294     AS_HELP_STRING([--disable-gstreamer-1-0],
1295         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1296 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1298 AC_ARG_ENABLE(gstreamer-0-10,
1299     AS_HELP_STRING([--enable-gstreamer-0-10],
1300         [Enable building with the gstreamer 0.10 avmedia backend.]),
1301 ,enable_gstreamer_0_10=no)
1303 libo_FUZZ_ARG_ENABLE(vlc,
1304     AS_HELP_STRING([--enable-vlc],
1305         [Enable building with the (experimental) VLC avmedia backend.]),
1306 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1308 libo_FUZZ_ARG_ENABLE(neon,
1309     AS_HELP_STRING([--disable-neon],
1310         [Disable neon and the compilation of webdav binding.]),
1313 libo_FUZZ_ARG_ENABLE([eot],
1314     [AS_HELP_STRING([--enable-eot],
1315         [Enable support for Embedded OpenType fonts.])],
1316 ,test "${enable_eot+set}" = set || enable_eot=no)
1318 libo_FUZZ_ARG_ENABLE(cve-tests,
1319     AS_HELP_STRING([--disable-cve-tests],
1320         [Prevent CVE tests to be executed]),
1323 libo_FUZZ_ARG_ENABLE(chart-tests,
1324     AS_HELP_STRING([--enable-chart-tests],
1325         [Executes chart XShape tests. In a perfect world these tests would be
1326          stable and everyone could run them, in reality it is best to run them
1327          only on a few machines that are known to work and maintained by people
1328          who can judge if a test failure is a regression or not.]),
1331 AC_ARG_ENABLE(build-unowinreg,
1332     AS_HELP_STRING([--enable-build-unowinreg],
1333         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1334          compiler is needed on Linux.]),
1337 AC_ARG_ENABLE(build-opensymbol,
1338     AS_HELP_STRING([--enable-build-opensymbol],
1339         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1340          fontforge installed.]),
1343 AC_ARG_ENABLE(dependency-tracking,
1344     AS_HELP_STRING([--enable-dependency-tracking],
1345         [Do not reject slow dependency extractors.])[
1346   --disable-dependency-tracking
1347                           Disables generation of dependency information.
1348                           Speed up one-time builds.],
1351 AC_ARG_ENABLE(icecream,
1352     AS_HELP_STRING([--enable-icecream],
1353         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1354          It defaults to /opt/icecream for the location of the icecream gcc/g++
1355          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1358 AC_ARG_ENABLE(ld,
1359     AS_HELP_STRING([--enable-ld=<linker>],
1360         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1361          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1364 libo_FUZZ_ARG_ENABLE(cups,
1365     AS_HELP_STRING([--disable-cups],
1366         [Do not build cups support.])
1369 AC_ARG_ENABLE(ccache,
1370     AS_HELP_STRING([--disable-ccache],
1371         [Do not try to use ccache automatically.
1372          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1373          CC/CXX are not yet set, and --enable-icecream is not given, we
1374          attempt to use ccache. --disable-ccache disables ccache completely.
1378 AC_ARG_ENABLE(64-bit,
1379     AS_HELP_STRING([--enable-64-bit],
1380         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1381          At the moment meaningful only for Windows.]), ,)
1383 libo_FUZZ_ARG_ENABLE(online-update,
1384     AS_HELP_STRING([--enable-online-update],
1385         [Enable the online update service that will check for new versions of
1386          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1387          If the value is "mar", the experimental Mozilla-like update will be
1388          enabled instead of the traditional update mechanism.]),
1391 AC_ARG_WITH(update-config,
1392     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1393                    [Path to the update config ini file]))
1395 libo_FUZZ_ARG_ENABLE(extension-update,
1396     AS_HELP_STRING([--disable-extension-update],
1397         [Disable possibility to update installed extensions.]),
1400 libo_FUZZ_ARG_ENABLE(release-build,
1401     AS_HELP_STRING([--enable-release-build],
1402         [Enable release build. Note that the "release build" choice is orthogonal to
1403          whether symbols are present, debug info is generated, or optimization
1404          is done.
1405          See http://wiki.documentfoundation.org/Development/DevBuild]),
1408 AC_ARG_ENABLE(windows-build-signing,
1409     AS_HELP_STRING([--enable-windows-build-signing],
1410         [Enable signing of windows binaries (*.exe, *.dll)]),
1413 AC_ARG_ENABLE(silent-msi,
1414     AS_HELP_STRING([--enable-silent-msi],
1415         [Enable MSI with LIMITUI=1 (silent install).]),
1418 AC_ARG_ENABLE(macosx-code-signing,
1419     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1420         [Sign executables, dylibs, frameworks and the app bundle. If you
1421          don't provide an identity the first suitable certificate
1422          in your keychain is used.]),
1425 AC_ARG_ENABLE(macosx-package-signing,
1426     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1427         [Create a .pkg suitable for uploading to the Mac App Store and sign
1428          it. If you don't provide an identity the first suitable certificate
1429          in your keychain is used.]),
1432 AC_ARG_ENABLE(macosx-sandbox,
1433     AS_HELP_STRING([--enable-macosx-sandbox],
1434         [Make the app bundle run in a sandbox. Requires code signing.
1435          Is required by apps distributed in the Mac App Store, and implies
1436          adherence to App Store rules.]),
1439 AC_ARG_WITH(macosx-bundle-identifier,
1440     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1441         [Define the macOS bundle identifier. Default is the somewhat weird
1442          org.libreoffice.script ("script", huh?).]),
1443 ,with_macosx_bundle_identifier=org.libreoffice.script)
1445 AC_ARG_WITH(product-name,
1446     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1447         [Define the product name. Default is AC_PACKAGE_NAME.]),
1448 ,with_product_name=$PRODUCTNAME)
1450 AC_ARG_WITH(package-version,
1451     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1452         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1455 libo_FUZZ_ARG_ENABLE(readonly-installset,
1456     AS_HELP_STRING([--enable-readonly-installset],
1457         [Prevents any attempts by LibreOffice to write into its installation. That means
1458          at least that no "system-wide" extensions can be added. Partly experimental work in
1459          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1462 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1463     AS_HELP_STRING([--disable-postgresql-sdbc],
1464         [Disable the build of the PostgreSQL-SDBC driver.])
1467 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1468     AS_HELP_STRING([--disable-lotuswordpro],
1469         [Disable the build of the Lotus Word Pro filter.]),
1470 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1472 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1473     AS_HELP_STRING([--disable-firebird-sdbc],
1474         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1475 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1477 AC_ARG_ENABLE(bogus-pkg-config,
1478     AS_HELP_STRING([--enable-bogus-pkg-config],
1479         [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.]),
1482 AC_ARG_ENABLE(openssl,
1483     AS_HELP_STRING([--disable-openssl],
1484         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1485          components will either use GNUTLS or NSS. Work in progress,
1486          use only if you are hacking on it.]),
1487 ,enable_openssl=yes)
1489 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1490     AS_HELP_STRING([--enable-cipher-openssl-backend],
1491         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1492          Requires --enable-openssl.]))
1494 AC_ARG_ENABLE(library-bin-tar,
1495     AS_HELP_STRING([--enable-library-bin-tar],
1496         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1497         Some libraries can save their build result in a tarball
1498         stored in TARFILE_LOCATION. That binary tarball is
1499         uniquely identified by the source tarball,
1500         the content of the config_host.mk file and the content
1501         of the top-level directory in core for that library
1502         If this option is enabled, then if such a tarfile exist, it will be untarred
1503         instead of the source tarfile, and the build step will be skipped for that
1504         library.
1505         If a proper tarfile does not exist, then the normal source-based
1506         build is done for that library and a proper binary tarfile is created
1507         for the next time.]),
1510 AC_ARG_ENABLE(dconf,
1511     AS_HELP_STRING([--disable-dconf],
1512         [Disable the dconf configuration backend (enabled by default where
1513          available).]))
1515 libo_FUZZ_ARG_ENABLE(formula-logger,
1516     AS_HELP_STRING(
1517         [--enable-formula-logger],
1518         [Enable formula logger for logging formula calculation flow in Calc.]
1519     )
1522 AC_ARG_ENABLE(ldap,
1523     AS_HELP_STRING([--disable-ldap],
1524         [Disable LDAP support.]),
1525 ,enable_ldap=yes)
1527 dnl ===================================================================
1528 dnl Optional Packages (--with/without-)
1529 dnl ===================================================================
1531 AC_ARG_WITH(gcc-home,
1532     AS_HELP_STRING([--with-gcc-home],
1533         [Specify the location of gcc/g++ manually. This can be used in conjunction
1534          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1535          non-default path.]),
1538 AC_ARG_WITH(gnu-patch,
1539     AS_HELP_STRING([--with-gnu-patch],
1540         [Specify location of GNU patch on Solaris or FreeBSD.]),
1543 AC_ARG_WITH(build-platform-configure-options,
1544     AS_HELP_STRING([--with-build-platform-configure-options],
1545         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1548 AC_ARG_WITH(gnu-cp,
1549     AS_HELP_STRING([--with-gnu-cp],
1550         [Specify location of GNU cp on Solaris or FreeBSD.]),
1553 AC_ARG_WITH(external-tar,
1554     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1555         [Specify an absolute path of where to find (and store) tarfiles.]),
1556     TARFILE_LOCATION=$withval ,
1559 AC_ARG_WITH(referenced-git,
1560     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1561         [Specify another checkout directory to reference. This makes use of
1562                  git submodule update --reference, and saves a lot of diskspace
1563                  when having multiple trees side-by-side.]),
1564     GIT_REFERENCE_SRC=$withval ,
1567 AC_ARG_WITH(linked-git,
1568     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1569         [Specify a directory where the repositories of submodules are located.
1570          This uses a method similar to git-new-workdir to get submodules.]),
1571     GIT_LINK_SRC=$withval ,
1574 AC_ARG_WITH(galleries,
1575     AS_HELP_STRING([--with-galleries],
1576         [Specify how galleries should be built. It is possible either to
1577          build these internally from source ("build"),
1578          or to disable them ("no")]),
1581 AC_ARG_WITH(theme,
1582     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1583         [Choose which themes to include. By default those themes with an '*' are included.
1584          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1585          *elementary_svg, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1588 libo_FUZZ_ARG_WITH(helppack-integration,
1589     AS_HELP_STRING([--without-helppack-integration],
1590         [It will not integrate the helppacks to the installer
1591          of the product. Please use this switch to use the online help
1592          or separate help packages.]),
1595 libo_FUZZ_ARG_WITH(fonts,
1596     AS_HELP_STRING([--without-fonts],
1597         [LibreOffice includes some third-party fonts to provide a reliable basis for
1598          help content, templates, samples, etc. When these fonts are already
1599          known to be available on the system then you should use this option.]),
1602 AC_ARG_WITH(epm,
1603     AS_HELP_STRING([--with-epm],
1604         [Decides which epm to use. Default is to use the one from the system if
1605          one is built. When either this is not there or you say =internal epm
1606          will be built.]),
1609 AC_ARG_WITH(package-format,
1610     AS_HELP_STRING([--with-package-format],
1611         [Specify package format(s) for LibreOffice installation sets. The
1612          implicit --without-package-format leads to no installation sets being
1613          generated. Possible values: aix, archive, bsd, deb, dmg,
1614          installed, msi, pkg, and rpm.
1615          Example: --with-package-format='deb rpm']),
1618 AC_ARG_WITH(tls,
1619     AS_HELP_STRING([--with-tls],
1620         [Decides which TLS/SSL and cryptographic implementations to use for
1621          LibreOffice's code. Notice that this doesn't apply for depending
1622          libraries like "neon", for example. Default is to use OpenSSL
1623          although NSS is also possible. Notice that selecting NSS restricts
1624          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1625          restrict by now the usage of NSS in LO's code. Possible values:
1626          openssl, nss. Example: --with-tls="nss"]),
1629 AC_ARG_WITH(system-libs,
1630     AS_HELP_STRING([--with-system-libs],
1631         [Use libraries already on system -- enables all --with-system-* flags.]),
1634 AC_ARG_WITH(system-bzip2,
1635     AS_HELP_STRING([--with-system-bzip2],
1636         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1637     [with_system_bzip2="$with_system_libs"])
1639 AC_ARG_WITH(system-headers,
1640     AS_HELP_STRING([--with-system-headers],
1641         [Use headers already on system -- enables all --with-system-* flags for
1642          external packages whose headers are the only entities used i.e.
1643          boost/odbc/sane-header(s).]),,
1644     [with_system_headers="$with_system_libs"])
1646 AC_ARG_WITH(system-jars,
1647     AS_HELP_STRING([--without-system-jars],
1648         [When building with --with-system-libs, also the needed jars are expected
1649          on the system. Use this to disable that]),,
1650     [with_system_jars="$with_system_libs"])
1652 AC_ARG_WITH(system-cairo,
1653     AS_HELP_STRING([--with-system-cairo],
1654         [Use cairo libraries already on system.  Happens automatically for
1655          (implicit) --enable-gtk and for --enable-gtk3.]))
1657 AC_ARG_WITH(system-epoxy,
1658     AS_HELP_STRING([--with-system-epoxy],
1659         [Use epoxy libraries already on system.  Happens automatically for
1660          --enable-gtk3.]),,
1661        [with_system_epoxy="$with_system_libs"])
1663 AC_ARG_WITH(myspell-dicts,
1664     AS_HELP_STRING([--with-myspell-dicts],
1665         [Adds myspell dictionaries to the LibreOffice installation set]),
1668 AC_ARG_WITH(system-dicts,
1669     AS_HELP_STRING([--without-system-dicts],
1670         [Do not use dictionaries from system paths.]),
1673 AC_ARG_WITH(external-dict-dir,
1674     AS_HELP_STRING([--with-external-dict-dir],
1675         [Specify external dictionary dir.]),
1678 AC_ARG_WITH(external-hyph-dir,
1679     AS_HELP_STRING([--with-external-hyph-dir],
1680         [Specify external hyphenation pattern dir.]),
1683 AC_ARG_WITH(external-thes-dir,
1684     AS_HELP_STRING([--with-external-thes-dir],
1685         [Specify external thesaurus dir.]),
1688 AC_ARG_WITH(system-zlib,
1689     AS_HELP_STRING([--with-system-zlib],
1690         [Use zlib already on system.]),,
1691     [with_system_zlib=auto])
1693 AC_ARG_WITH(system-jpeg,
1694     AS_HELP_STRING([--with-system-jpeg],
1695         [Use jpeg already on system.]),,
1696     [with_system_jpeg="$with_system_libs"])
1698 AC_ARG_WITH(system-clucene,
1699     AS_HELP_STRING([--with-system-clucene],
1700         [Use clucene already on system.]),,
1701     [with_system_clucene="$with_system_libs"])
1703 AC_ARG_WITH(system-expat,
1704     AS_HELP_STRING([--with-system-expat],
1705         [Use expat already on system.]),,
1706     [with_system_expat="$with_system_libs"])
1708 AC_ARG_WITH(system-libxml,
1709     AS_HELP_STRING([--with-system-libxml],
1710         [Use libxml/libxslt already on system.]),,
1711     [with_system_libxml=auto])
1713 AC_ARG_WITH(system-icu,
1714     AS_HELP_STRING([--with-system-icu],
1715         [Use icu already on system.]),,
1716     [with_system_icu="$with_system_libs"])
1718 AC_ARG_WITH(system-ucpp,
1719     AS_HELP_STRING([--with-system-ucpp],
1720         [Use ucpp already on system.]),,
1721     [])
1723 AC_ARG_WITH(system-openldap,
1724     AS_HELP_STRING([--with-system-openldap],
1725         [Use the OpenLDAP LDAP SDK already on system.]),,
1726     [with_system_openldap="$with_system_libs"])
1728 AC_ARG_WITH(system-poppler,
1729     AS_HELP_STRING([--with-system-poppler],
1730         [Use system poppler (only needed for PDF import).]),,
1731     [with_system_poppler="$with_system_libs"])
1733 AC_ARG_WITH(system-gpgmepp,
1734     AS_HELP_STRING([--with-system-gpgmepp],
1735         [Use gpgmepp already on system]),,
1736     [with_system_gpgmepp="$with_system_libs"])
1738 AC_ARG_WITH(system-apache-commons,
1739     AS_HELP_STRING([--with-system-apache-commons],
1740         [Use Apache commons libraries already on system.]),,
1741     [with_system_apache_commons="$with_system_jars"])
1743 AC_ARG_WITH(system-mariadb,
1744     AS_HELP_STRING([--with-system-mariadb],
1745         [Use MariaDB/MySQL libraries already on system.]),,
1746     [with_system_mariadb="$with_system_libs"])
1748 AC_ARG_ENABLE(bundle-mariadb,
1749     AS_HELP_STRING([--enable-bundle-mariadb],
1750         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1753 AC_ARG_WITH(system-postgresql,
1754     AS_HELP_STRING([--with-system-postgresql],
1755         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1756          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1757     [with_system_postgresql="$with_system_libs"])
1759 AC_ARG_WITH(libpq-path,
1760     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1761         [Use this PostgreSQL C interface (libpq) installation for building
1762          the PostgreSQL-SDBC extension.]),
1765 AC_ARG_WITH(system-firebird,
1766     AS_HELP_STRING([--with-system-firebird],
1767         [Use Firebird libraries already on system, for building the Firebird-SDBC
1768          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1769     [with_system_firebird="$with_system_libs"])
1771 AC_ARG_WITH(system-libtommath,
1772             AS_HELP_STRING([--with-system-libtommath],
1773                            [Use libtommath already on system]),,
1774             [with_system_libtommath="$with_system_libs"])
1776 AC_ARG_WITH(system-hsqldb,
1777     AS_HELP_STRING([--with-system-hsqldb],
1778         [Use hsqldb already on system.]))
1780 AC_ARG_WITH(hsqldb-jar,
1781     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1782         [Specify path to jarfile manually.]),
1783     HSQLDB_JAR=$withval)
1785 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1786     AS_HELP_STRING([--disable-scripting-beanshell],
1787         [Disable support for scripts in BeanShell.]),
1791 AC_ARG_WITH(system-beanshell,
1792     AS_HELP_STRING([--with-system-beanshell],
1793         [Use beanshell already on system.]),,
1794     [with_system_beanshell="$with_system_jars"])
1796 AC_ARG_WITH(beanshell-jar,
1797     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1798         [Specify path to jarfile manually.]),
1799     BSH_JAR=$withval)
1801 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1802     AS_HELP_STRING([--disable-scripting-javascript],
1803         [Disable support for scripts in JavaScript.]),
1807 AC_ARG_WITH(system-rhino,
1808     AS_HELP_STRING([--with-system-rhino],
1809         [Use rhino already on system.]),,)
1810 #    [with_system_rhino="$with_system_jars"])
1811 # Above is not used as we have different debug interface
1812 # patched into internal rhino. This code needs to be fixed
1813 # before we can enable it by default.
1815 AC_ARG_WITH(rhino-jar,
1816     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1817         [Specify path to jarfile manually.]),
1818     RHINO_JAR=$withval)
1820 AC_ARG_WITH(commons-logging-jar,
1821     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1822         [Specify path to jarfile manually.]),
1823     COMMONS_LOGGING_JAR=$withval)
1825 AC_ARG_WITH(system-jfreereport,
1826     AS_HELP_STRING([--with-system-jfreereport],
1827         [Use JFreeReport already on system.]),,
1828     [with_system_jfreereport="$with_system_jars"])
1830 AC_ARG_WITH(sac-jar,
1831     AS_HELP_STRING([--with-sac-jar=JARFILE],
1832         [Specify path to jarfile manually.]),
1833     SAC_JAR=$withval)
1835 AC_ARG_WITH(libxml-jar,
1836     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1837         [Specify path to jarfile manually.]),
1838     LIBXML_JAR=$withval)
1840 AC_ARG_WITH(flute-jar,
1841     AS_HELP_STRING([--with-flute-jar=JARFILE],
1842         [Specify path to jarfile manually.]),
1843     FLUTE_JAR=$withval)
1845 AC_ARG_WITH(jfreereport-jar,
1846     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1847         [Specify path to jarfile manually.]),
1848     JFREEREPORT_JAR=$withval)
1850 AC_ARG_WITH(liblayout-jar,
1851     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1852         [Specify path to jarfile manually.]),
1853     LIBLAYOUT_JAR=$withval)
1855 AC_ARG_WITH(libloader-jar,
1856     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1857         [Specify path to jarfile manually.]),
1858     LIBLOADER_JAR=$withval)
1860 AC_ARG_WITH(libformula-jar,
1861     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1862         [Specify path to jarfile manually.]),
1863     LIBFORMULA_JAR=$withval)
1865 AC_ARG_WITH(librepository-jar,
1866     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1867         [Specify path to jarfile manually.]),
1868     LIBREPOSITORY_JAR=$withval)
1870 AC_ARG_WITH(libfonts-jar,
1871     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1872         [Specify path to jarfile manually.]),
1873     LIBFONTS_JAR=$withval)
1875 AC_ARG_WITH(libserializer-jar,
1876     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1877         [Specify path to jarfile manually.]),
1878     LIBSERIALIZER_JAR=$withval)
1880 AC_ARG_WITH(libbase-jar,
1881     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1882         [Specify path to jarfile manually.]),
1883     LIBBASE_JAR=$withval)
1885 AC_ARG_WITH(system-odbc,
1886     AS_HELP_STRING([--with-system-odbc],
1887         [Use the odbc headers already on system.]),,
1888     [with_system_odbc="auto"])
1890 AC_ARG_WITH(system-sane,
1891     AS_HELP_STRING([--with-system-sane],
1892         [Use sane.h already on system.]),,
1893     [with_system_sane="$with_system_headers"])
1895 AC_ARG_WITH(system-bluez,
1896     AS_HELP_STRING([--with-system-bluez],
1897         [Use bluetooth.h already on system.]),,
1898     [with_system_bluez="$with_system_headers"])
1900 AC_ARG_WITH(system-curl,
1901     AS_HELP_STRING([--with-system-curl],
1902         [Use curl already on system.]),,
1903     [with_system_curl=auto])
1905 AC_ARG_WITH(system-boost,
1906     AS_HELP_STRING([--with-system-boost],
1907         [Use boost already on system.]),,
1908     [with_system_boost="$with_system_headers"])
1910 AC_ARG_WITH(system-glm,
1911     AS_HELP_STRING([--with-system-glm],
1912         [Use glm already on system.]),,
1913     [with_system_glm="$with_system_headers"])
1915 AC_ARG_WITH(system-hunspell,
1916     AS_HELP_STRING([--with-system-hunspell],
1917         [Use libhunspell already on system.]),,
1918     [with_system_hunspell="$with_system_libs"])
1920 AC_ARG_WITH(system-mythes,
1921     AS_HELP_STRING([--with-system-mythes],
1922         [Use mythes already on system.]),,
1923     [with_system_mythes="$with_system_libs"])
1925 AC_ARG_WITH(system-altlinuxhyph,
1926     AS_HELP_STRING([--with-system-altlinuxhyph],
1927         [Use ALTLinuxhyph already on system.]),,
1928     [with_system_altlinuxhyph="$with_system_libs"])
1930 AC_ARG_WITH(system-lpsolve,
1931     AS_HELP_STRING([--with-system-lpsolve],
1932         [Use lpsolve already on system.]),,
1933     [with_system_lpsolve="$with_system_libs"])
1935 AC_ARG_WITH(system-coinmp,
1936     AS_HELP_STRING([--with-system-coinmp],
1937         [Use CoinMP already on system.]),,
1938     [with_system_coinmp="$with_system_libs"])
1940 AC_ARG_WITH(system-liblangtag,
1941     AS_HELP_STRING([--with-system-liblangtag],
1942         [Use liblangtag library already on system.]),,
1943     [with_system_liblangtag="$with_system_libs"])
1945 AC_ARG_WITH(webdav,
1946     AS_HELP_STRING([--with-webdav],
1947         [Specify which library to use for webdav implementation.
1948          Possible values: "neon", "serf", "no". The default value is "neon".
1949          Example: --with-webdav="serf"]),
1950     WITH_WEBDAV=$withval,
1951     WITH_WEBDAV="neon")
1953 AC_ARG_WITH(linker-hash-style,
1954     AS_HELP_STRING([--with-linker-hash-style],
1955         [Use linker with --hash-style=<style> when linking shared objects.
1956          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1957          if supported on the build system, and "sysv" otherwise.]))
1959 AC_ARG_WITH(jdk-home,
1960     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1961         [If you have installed JDK 1.6 or later on your system please supply the
1962          path here. Note that this is not the location of the java command but the
1963          location of the entire distribution.]),
1966 AC_ARG_WITH(help,
1967     AS_HELP_STRING([--with-help],
1968         [Enable the build of help. There is a special parameter "common" that
1969          can be used to bundle only the common part, .e.g help-specific icons.
1970          This is useful when you build the helpcontent separately.])
1971     [
1972                           Usage:     --with-help    build the old local help
1973                                  --without-help     no local help (default)
1974                                  --with-help=html   build the new HTML local help
1975                                  --with-help=online build the new HTML online help
1976     ],
1979 libo_FUZZ_ARG_WITH(java,
1980     AS_HELP_STRING([--with-java=<java command>],
1981         [Specify the name of the Java interpreter command. Typically "java"
1982          which is the default.
1984          To build without support for Java components, applets, accessibility
1985          or the XML filters written in Java, use --without-java or --with-java=no.]),
1986     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1987     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1990 AC_ARG_WITH(jvm-path,
1991     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1992         [Use a specific JVM search path at runtime.
1993          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1996 AC_ARG_WITH(ant-home,
1997     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1998         [If you have installed Apache Ant on your system, please supply the path here.
1999          Note that this is not the location of the Ant binary but the location
2000          of the entire distribution.]),
2003 AC_ARG_WITH(symbol-config,
2004     AS_HELP_STRING([--with-symbol-config],
2005         [Configuration for the crashreport symbol upload]),
2006         [],
2007         [with_symbol_config=no])
2009 AC_ARG_WITH(export-validation,
2010     AS_HELP_STRING([--without-export-validation],
2011         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2012 ,with_export_validation=auto)
2014 AC_ARG_WITH(bffvalidator,
2015     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2016         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2017          Requires installed Microsoft Office Binary File Format Validator.
2018          Note: export-validation (--with-export-validation) is required to be turned on.
2019          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2020 ,with_bffvalidator=no)
2022 libo_FUZZ_ARG_WITH(junit,
2023     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2024         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2025          --without-junit disables those tests. Not relevant in the --without-java case.]),
2026 ,with_junit=yes)
2028 AC_ARG_WITH(hamcrest,
2029     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2030         [Specifies the hamcrest jar file to use for JUnit-based tests.
2031          --without-junit disables those tests. Not relevant in the --without-java case.]),
2032 ,with_hamcrest=yes)
2034 AC_ARG_WITH(perl-home,
2035     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2036         [If you have installed Perl 5 Distribution, on your system, please
2037          supply the path here. Note that this is not the location of the Perl
2038          binary but the location of the entire distribution.]),
2041 libo_FUZZ_ARG_WITH(doxygen,
2042     AS_HELP_STRING(
2043         [--with-doxygen=<absolute path to doxygen executable>],
2044         [Specifies the doxygen executable to use when generating ODK C/C++
2045          documentation. --without-doxygen disables generation of ODK C/C++
2046          documentation. Not relevant in the --disable-odk case.]),
2047 ,with_doxygen=yes)
2049 AC_ARG_WITH(visual-studio,
2050     AS_HELP_STRING([--with-visual-studio=<2017>],
2051         [Specify which Visual Studio version to use in case several are
2052          installed. Currently only 2017 is supported.]),
2055 AC_ARG_WITH(windows-sdk,
2056     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2057         [Specify which Windows SDK, or "Windows Kit", version to use
2058          in case the one that came with the selected Visual Studio
2059          is not what you want for some reason. Note that not all compiler/SDK
2060          combinations are supported. The intent is that this option should not
2061          be needed.]),
2064 AC_ARG_WITH(lang,
2065     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2066         [Use this option to build LibreOffice with additional UI language support.
2067          English (US) is always included by default.
2068          Separate multiple languages with space.
2069          For all languages, use --with-lang=ALL.]),
2072 AC_ARG_WITH(locales,
2073     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2074         [Use this option to limit the locale information built in.
2075          Separate multiple locales with space.
2076          Very experimental and might well break stuff.
2077          Just a desperate measure to shrink code and data size.
2078          By default all the locales available is included.
2079          This option is completely unrelated to --with-lang.])
2080     [
2081                           Affects also our character encoding conversion
2082                           tables for encodings mainly targeted for a
2083                           particular locale, like EUC-CN and EUC-TW for
2084                           zh, ISO-2022-JP for ja.
2086                           Affects also our add-on break iterator data for
2087                           some languages.
2089                           For the default, all locales, don't use this switch at all.
2090                           Specifying just the language part of a locale means all matching
2091                           locales will be included.
2092     ],
2095 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2096 libo_FUZZ_ARG_WITH(krb5,
2097     AS_HELP_STRING([--with-krb5],
2098         [Enable MIT Kerberos 5 support in modules that support it.
2099          By default automatically enabled on platforms
2100          where a good system Kerberos 5 is available.]),
2103 libo_FUZZ_ARG_WITH(gssapi,
2104     AS_HELP_STRING([--with-gssapi],
2105         [Enable GSSAPI support in modules that support it.
2106          By default automatically enabled on platforms
2107          where a good system GSSAPI is available.]),
2110 AC_ARG_WITH(iwyu,
2111     AS_HELP_STRING([--with-iwyu],
2112         [Use given IWYU binary path to check unneeded includes instead of building.
2113          Use only if you are hacking on it.]),
2116 libo_FUZZ_ARG_WITH(lxml,
2117     AS_HELP_STRING([--without-lxml],
2118         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2119          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2120          report widget classes and ids.]),
2123 dnl ===================================================================
2124 dnl Branding
2125 dnl ===================================================================
2127 AC_ARG_WITH(branding,
2128     AS_HELP_STRING([--with-branding=/path/to/images],
2129         [Use given path to retrieve branding images set.])
2130     [
2131                           Search for intro.png about.svg and flat_logo.svg.
2132                           If any is missing, default ones will be used instead.
2134                           Search also progress.conf for progress
2135                           settings on intro screen :
2137                           PROGRESSBARCOLOR="255,255,255" Set color of
2138                           progress bar. Comma separated RGB decimal values.
2139                           PROGRESSSIZE="407,6" Set size of progress bar.
2140                           Comma separated decimal values (width, height).
2141                           PROGRESSPOSITION="61,317" Set position of progress
2142                           bar from left,top. Comma separated decimal values.
2143                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2144                           bar frame. Comma separated RGB decimal values.
2145                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2146                           bar text. Comma separated RGB decimal values.
2147                           PROGRESSTEXTBASELINE="287" Set vertical position of
2148                           progress bar text from top. Decimal value.
2150                           Default values will be used if not found.
2151     ],
2155 AC_ARG_WITH(extra-buildid,
2156     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2157         [Show addition build identification in about dialog.]),
2161 AC_ARG_WITH(vendor,
2162     AS_HELP_STRING([--with-vendor="John the Builder"],
2163         [Set vendor of the build.]),
2166 AC_ARG_WITH(android-package-name,
2167     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2168         [Set Android package name of the build.]),
2171 AC_ARG_WITH(compat-oowrappers,
2172     AS_HELP_STRING([--with-compat-oowrappers],
2173         [Install oo* wrappers in parallel with
2174          lo* ones to keep backward compatibility.
2175          Has effect only with make distro-pack-install]),
2178 AC_ARG_WITH(os-version,
2179     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2180         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2183 AC_ARG_WITH(mingw-cross-compiler,
2184     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2185         [Specify the MinGW cross-compiler to use.
2186          When building on the ODK on Unix and building unowinreg.dll,
2187          specify the MinGW C++ cross-compiler.]),
2190 AC_ARG_WITH(idlc-cpp,
2191     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2192         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2195 AC_ARG_WITH(build-version,
2196     AS_HELP_STRING([--with-build-version="Built by Jim"],
2197         [Allows the builder to add a custom version tag that will appear in the
2198          Help/About box for QA purposes.]),
2199 with_build_version=$withval,
2202 AC_ARG_WITH(parallelism,
2203     AS_HELP_STRING([--with-parallelism],
2204         [Number of jobs to run simultaneously during build. Parallel builds can
2205         save a lot of time on multi-cpu machines. Defaults to the number of
2206         CPUs on the machine, unless you configure --enable-icecream - then to
2207         10.]),
2210 AC_ARG_WITH(all-tarballs,
2211     AS_HELP_STRING([--with-all-tarballs],
2212         [Download all external tarballs unconditionally]))
2214 AC_ARG_WITH(gdrive-client-id,
2215     AS_HELP_STRING([--with-gdrive-client-id],
2216         [Provides the client id of the application for OAuth2 authentication
2217         on Google Drive. If either this or --with-gdrive-client-secret is
2218         empty, the feature will be disabled]),
2221 AC_ARG_WITH(gdrive-client-secret,
2222     AS_HELP_STRING([--with-gdrive-client-secret],
2223         [Provides the client secret of the application for OAuth2
2224         authentication on Google Drive. If either this or
2225         --with-gdrive-client-id is empty, the feature will be disabled]),
2228 AC_ARG_WITH(alfresco-cloud-client-id,
2229     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2230         [Provides the client id of the application for OAuth2 authentication
2231         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2232         empty, the feature will be disabled]),
2235 AC_ARG_WITH(alfresco-cloud-client-secret,
2236     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2237         [Provides the client secret of the application for OAuth2
2238         authentication on Alfresco Cloud. If either this or
2239         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2242 AC_ARG_WITH(onedrive-client-id,
2243     AS_HELP_STRING([--with-onedrive-client-id],
2244         [Provides the client id of the application for OAuth2 authentication
2245         on OneDrive. If either this or --with-onedrive-client-secret is
2246         empty, the feature will be disabled]),
2249 AC_ARG_WITH(onedrive-client-secret,
2250     AS_HELP_STRING([--with-onedrive-client-secret],
2251         [Provides the client secret of the application for OAuth2
2252         authentication on OneDrive. If either this or
2253         --with-onedrive-client-id is empty, the feature will be disabled]),
2255 dnl ===================================================================
2256 dnl Do we want to use pre-build binary tarball for recompile
2257 dnl ===================================================================
2259 if test "$enable_library_bin_tar" = "yes" ; then
2260     USE_LIBRARY_BIN_TAR=TRUE
2261 else
2262     USE_LIBRARY_BIN_TAR=
2264 AC_SUBST(USE_LIBRARY_BIN_TAR)
2266 dnl ===================================================================
2267 dnl Test whether build target is Release Build
2268 dnl ===================================================================
2269 AC_MSG_CHECKING([whether build target is Release Build])
2270 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2271     AC_MSG_RESULT([no])
2272     ENABLE_RELEASE_BUILD=
2273 else
2274     AC_MSG_RESULT([yes])
2275     ENABLE_RELEASE_BUILD=TRUE
2277 AC_SUBST(ENABLE_RELEASE_BUILD)
2279 dnl ===================================================================
2280 dnl Test whether to sign Windows Build
2281 dnl ===================================================================
2282 AC_MSG_CHECKING([whether to sign windows build])
2283 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2284     AC_MSG_RESULT([yes])
2285     WINDOWS_BUILD_SIGNING="TRUE"
2286 else
2287     AC_MSG_RESULT([no])
2288     WINDOWS_BUILD_SIGNING="FALSE"
2290 AC_SUBST(WINDOWS_BUILD_SIGNING)
2292 dnl ===================================================================
2293 dnl MacOSX build and runtime environment options
2294 dnl ===================================================================
2296 AC_ARG_WITH(macosx-sdk,
2297     AS_HELP_STRING([--with-macosx-sdk=<version>],
2298         [Prefer a specific SDK for building.])
2299     [
2300                           If the requested SDK is not available, a search for the oldest one will be done.
2301                           With current Xcode versions, only the latest SDK is included, so this option is
2302                           not terribly useful. It works fine to build with a new SDK and run the result
2303                           on an older OS.
2305                           e. g.: --with-macosx-sdk=10.10
2307                           there are 3 options to control the MacOSX build:
2308                           --with-macosx-sdk (referred as 'sdk' below)
2309                           --with-macosx-version-min-required (referred as 'min' below)
2310                           --with-macosx-version-max-allowed (referred as 'max' below)
2312                           the connection between these value and the default they take is as follow:
2313                           ( ? means not specified on the command line, s means the SDK version found,
2314                           constraint: 8 <= x <= y <= z)
2316                           ==========================================
2317                            command line      || config result
2318                           ==========================================
2319                           min  | max  | sdk  || min   | max  | sdk  |
2320                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2321                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2322                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2323                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2324                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2325                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2326                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2327                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2330                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2331                           for a detailed technical explanation of these variables
2333                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2334     ],
2337 AC_ARG_WITH(macosx-version-min-required,
2338     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2339         [set the minimum OS version needed to run the built LibreOffice])
2340     [
2341                           e. g.: --with-macos-version-min-required=10.10
2342                           see --with-macosx-sdk for more info
2343     ],
2346 AC_ARG_WITH(macosx-version-max-allowed,
2347     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2348         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2349     [
2350                           e. g.: --with-macos-version-max-allowed=10.10
2351                           see --with-macosx-sdk for more info
2352     ],
2356 dnl ===================================================================
2357 dnl options for stuff used during cross-compilation build
2358 dnl Not quite superseded by --with-build-platform-configure-options.
2359 dnl TODO: check, if the "force" option is still needed anywhere.
2360 dnl ===================================================================
2362 AC_ARG_WITH(system-icu-for-build,
2363     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2364         [Use icu already on system for build tools (cross-compilation only).]))
2367 dnl ===================================================================
2368 dnl Check for incompatible options set by fuzzing, and reset those
2369 dnl automatically to working combinations
2370 dnl ===================================================================
2372 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2373         "$enable_dbus" != "$enable_avahi"; then
2374     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2375     enable_avahi=$enable_dbus
2378 dnl ===================================================================
2379 dnl check for required programs (grep, awk, sed, bash)
2380 dnl ===================================================================
2382 pathmunge ()
2384     if test -n "$1"; then
2385         if test "$build_os" = "cygwin"; then
2386             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2387                 PathFormat "$1"
2388                 new_path=`cygpath -sm "$formatted_path"`
2389             else
2390                 PathFormat "$1"
2391                 new_path=`cygpath -u "$formatted_path"`
2392             fi
2393         else
2394             new_path="$1"
2395         fi
2396         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2397             if test "$2" = "after"; then
2398                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2399             else
2400                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2401             fi
2402         fi
2403         unset new_path
2404     fi
2407 AC_PROG_AWK
2408 AC_PATH_PROG( AWK, $AWK)
2409 if test -z "$AWK"; then
2410     AC_MSG_ERROR([install awk to run this script])
2413 AC_PATH_PROG(BASH, bash)
2414 if test -z "$BASH"; then
2415     AC_MSG_ERROR([bash not found in \$PATH])
2417 AC_SUBST(BASH)
2419 AC_MSG_CHECKING([for GNU or BSD tar])
2420 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2421     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2422     if test $? -eq 0;  then
2423         GNUTAR=$a
2424         break
2425     fi
2426 done
2427 AC_MSG_RESULT($GNUTAR)
2428 if test -z "$GNUTAR"; then
2429     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2431 AC_SUBST(GNUTAR)
2433 AC_MSG_CHECKING([for tar's option to strip components])
2434 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2435 if test $? -eq 0; then
2436     STRIP_COMPONENTS="--strip-components"
2437 else
2438     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2439     if test $? -eq 0; then
2440         STRIP_COMPONENTS="--strip-path"
2441     else
2442         STRIP_COMPONENTS="unsupported"
2443     fi
2445 AC_MSG_RESULT($STRIP_COMPONENTS)
2446 if test x$STRIP_COMPONENTS = xunsupported; then
2447     AC_MSG_ERROR([you need a tar that is able to strip components.])
2449 AC_SUBST(STRIP_COMPONENTS)
2451 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2452 dnl desktop OSes from "mobile" ones.
2454 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2455 dnl In other words, that when building for an OS that is not a
2456 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2458 dnl Note the direction of the implication; there is no assumption that
2459 dnl cross-compiling would imply a non-desktop OS.
2461 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2462     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2463     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2464     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2467 # Whether to build "avmedia" functionality or not.
2469 if test -z "$enable_avmedia"; then
2470     enable_avmedia=yes
2473 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2474 if test "$enable_avmedia" = yes; then
2475     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2476 else
2477     USE_AVMEDIA_DUMMY='TRUE'
2479 AC_SUBST(USE_AVMEDIA_DUMMY)
2481 # Decide whether to build database connectivity stuff (including
2482 # Base) or not. We probably don't want to on non-desktop OSes.
2483 if test -z "$enable_database_connectivity"; then
2484     # --disable-database-connectivity is unfinished work in progress
2485     # and the iOS test app doesn't link if we actually try to use it.
2486     # if test $_os != iOS -a $_os != Android; then
2487     if test $_os != iOS; then
2488         enable_database_connectivity=yes
2489     fi
2492 if test "$enable_database_connectivity" = yes; then
2493     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2494     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2497 if test -z "$enable_extensions"; then
2498     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2499     if test $_os != iOS -a $_os != Android; then
2500         enable_extensions=yes
2501     fi
2504 if test "$enable_extensions" = yes; then
2505     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2506     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2509 if test -z "$enable_scripting"; then
2510     # Disable scripting for iOS unless specifically overridden
2511     # with --enable-scripting.
2512     if test $_os != iOS; then
2513         enable_scripting=yes
2514     fi
2517 DISABLE_SCRIPTING=''
2518 if test "$enable_scripting" = yes; then
2519     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2520     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2521 else
2522     DISABLE_SCRIPTING='TRUE'
2523     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2526 if test $_os = iOS -o $_os = Android; then
2527     # Disable dynamic_loading always for iOS and Android
2528     enable_dynamic_loading=no
2529 elif test -z "$enable_dynamic_loading"; then
2530     # Otherwise enable it unless specifically disabled
2531     enable_dynamic_loading=yes
2534 DISABLE_DYNLOADING=''
2535 if test "$enable_dynamic_loading" = yes; then
2536     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2537 else
2538     DISABLE_DYNLOADING='TRUE'
2540 AC_SUBST(DISABLE_DYNLOADING)
2542 # remember SYSBASE value
2543 AC_SUBST(SYSBASE)
2545 dnl ===================================================================
2546 dnl  Sort out various gallery compilation options
2547 dnl ===================================================================
2548 AC_MSG_CHECKING([how to build and package galleries])
2549 if test -n "${with_galleries}"; then
2550     if test "$with_galleries" = "build"; then
2551         WITH_GALLERY_BUILD=TRUE
2552         AC_MSG_RESULT([build from source images internally])
2553     elif test "$with_galleries" = "no"; then
2554         WITH_GALLERY_BUILD=
2555         AC_MSG_RESULT([disable non-internal gallery build])
2556     else
2557         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2558     fi
2559 else
2560     if test $_os != iOS -a $_os != Android; then
2561         WITH_GALLERY_BUILD=TRUE
2562         AC_MSG_RESULT([internal src images for desktop])
2563     else
2564         WITH_GALLERY_BUILD=
2565         AC_MSG_RESULT([disable src image build])
2566     fi
2568 AC_SUBST(WITH_GALLERY_BUILD)
2570 dnl ===================================================================
2571 dnl  Checks if ccache is available
2572 dnl ===================================================================
2573 if test "$_os" = "WINNT"; then
2574     # on windows/VC build do not use ccache
2575     CCACHE=""
2576 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2577     case "%$CC%$CXX%" in
2578     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2579     # assume that's good then
2580     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2581         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2582         ;;
2583     *)
2584         AC_PATH_PROG([CCACHE],[ccache],[not found])
2585         if test "$CCACHE" = "not found"; then
2586             CCACHE=""
2587         else
2588             # Need to check for ccache version: otherwise prevents
2589             # caching of the results (like "-x objective-c++" for Mac)
2590             if test $_os = Darwin -o $_os = iOS; then
2591                 # Check ccache version
2592                 AC_MSG_CHECKING([whether version of ccache is suitable])
2593                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2594                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2595                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2596                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2597                 else
2598                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2599                     CCACHE=""
2600                 fi
2601             fi
2602         fi
2603         ;;
2604     esac
2605 else
2606     CCACHE=""
2609 if test "$CCACHE" != ""; then
2610     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2611     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2612     if test "$ccache_size" = ""; then
2613         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2614         if test "$ccache_size" = ""; then
2615             ccache_size=0
2616         fi
2617         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2618         if test $ccache_size -lt 1024; then
2619             CCACHE=""
2620             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2621             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2622         else
2623             # warn that ccache may be too small for debug build
2624             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2625             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2626         fi
2627     else
2628         if test $ccache_size -lt 5; then
2629             #warn that ccache may be too small for debug build
2630             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2631             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2632         fi
2633     fi
2636 dnl ===================================================================
2637 dnl  Checks for C compiler,
2638 dnl  The check for the C++ compiler is later on.
2639 dnl ===================================================================
2640 if test "$_os" != "WINNT"; then
2641     GCC_HOME_SET="true"
2642     AC_MSG_CHECKING([gcc home])
2643     if test -z "$with_gcc_home"; then
2644         if test "$enable_icecream" = "yes"; then
2645             if test -d "/usr/lib/icecc/bin"; then
2646                 GCC_HOME="/usr/lib/icecc/"
2647             elif test -d "/usr/libexec/icecc/bin"; then
2648                 GCC_HOME="/usr/libexec/icecc/"
2649             elif test -d "/opt/icecream/bin"; then
2650                 GCC_HOME="/opt/icecream/"
2651             else
2652                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2654             fi
2655         else
2656             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2657             GCC_HOME_SET="false"
2658         fi
2659     else
2660         GCC_HOME="$with_gcc_home"
2661     fi
2662     AC_MSG_RESULT($GCC_HOME)
2663     AC_SUBST(GCC_HOME)
2665     if test "$GCC_HOME_SET" = "true"; then
2666         if test -z "$CC"; then
2667             CC="$GCC_HOME/bin/gcc"
2668         fi
2669         if test -z "$CXX"; then
2670             CXX="$GCC_HOME/bin/g++"
2671         fi
2672     fi
2675 COMPATH=`dirname "$CC"`
2676 if test "$COMPATH" = "."; then
2677     AC_PATH_PROGS(COMPATH, $CC)
2678     dnl double square bracket to get single because of M4 quote...
2679     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2681 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2683 dnl ===================================================================
2684 dnl Java support
2685 dnl ===================================================================
2686 AC_MSG_CHECKING([whether to build with Java support])
2687 if test "$with_java" != "no"; then
2688     if test "$DISABLE_SCRIPTING" = TRUE; then
2689         AC_MSG_RESULT([no, overridden by --disable-scripting])
2690         ENABLE_JAVA=""
2691         with_java=no
2692     else
2693         AC_MSG_RESULT([yes])
2694         ENABLE_JAVA="TRUE"
2695         AC_DEFINE(HAVE_FEATURE_JAVA)
2696     fi
2697 else
2698     AC_MSG_RESULT([no])
2699     ENABLE_JAVA=""
2702 AC_SUBST(ENABLE_JAVA)
2704 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2706 dnl ENABLE_JAVA="" indicate no Java support at all
2708 dnl ===================================================================
2709 dnl Check macOS SDK and compiler
2710 dnl ===================================================================
2712 if test $_os = Darwin -o $_os = iOS; then
2714     # If no --with-macosx-sdk option is given, look for one
2716     # The intent is that for "most" Mac-based developers, a suitable
2717     # SDK will be found automatically without any configure options.
2719     # For developers with a current Xcode, the lowest-numbered SDK
2720     # higher than or equal to the minimum required should be found.
2722     AC_MSG_CHECKING([what macOS SDK to use])
2723     for _macosx_sdk in ${with_macosx_sdk-10.14 10.13 10.12}; do
2724         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2725         if test -d "$MACOSX_SDK_PATH"; then
2726             with_macosx_sdk="${_macosx_sdk}"
2727             break
2728         else
2729             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2730             if test -d "$MACOSX_SDK_PATH"; then
2731                 with_macosx_sdk="${_macosx_sdk}"
2732                 break
2733             fi
2734         fi
2735     done
2736     if test ! -d "$MACOSX_SDK_PATH"; then
2737         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2738     fi
2740     if test $_os = iOS; then
2741         if test "$enable_ios_simulator" = "yes"; then
2742             useos=iphonesimulator
2743         else
2744             useos=iphoneos
2745         fi
2746         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2747     fi
2748     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2751     case $with_macosx_sdk in
2752     10.12)
2753         MACOSX_SDK_VERSION=101200
2754         ;;
2755     10.13)
2756         MACOSX_SDK_VERSION=101300
2757         ;;
2758     10.14)
2759         MACOSX_SDK_VERSION=101400
2760         ;;
2761     *)
2762         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--14])
2763         ;;
2764     esac
2766     if test "$with_macosx_version_min_required" = "" ; then
2767         with_macosx_version_min_required="10.10";
2768     fi
2770     if test "$with_macosx_version_max_allowed" = "" ; then
2771         with_macosx_version_max_allowed="$with_macosx_sdk"
2772     fi
2774     # export this so that "xcrun" invocations later return matching values
2775     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2776     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2777     export DEVELOPER_DIR
2778     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2779     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2781     AC_MSG_CHECKING([whether Xcode is new enough])
2782     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2783     my_xcode_ver2=${my_xcode_ver1#Xcode }
2784     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2785     if test "$my_xcode_ver3" -ge 903; then
2786         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2787     else
2788         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2789     fi
2791     case "$with_macosx_version_min_required" in
2792     10.10)
2793         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2794         ;;
2795     10.11)
2796         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2797         ;;
2798     10.12)
2799         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2800         ;;
2801     10.13)
2802         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2803         ;;
2804     10.14)
2805         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2806         ;;
2807     *)
2808         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--14])
2809         ;;
2810     esac
2811     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2813     LIBTOOL=/usr/bin/libtool
2814     INSTALL_NAME_TOOL=install_name_tool
2815     if test -z "$save_CC"; then
2816         AC_MSG_CHECKING([what compiler to use])
2817         stdlib=-stdlib=libc++
2818         if test "$ENABLE_LTO" = TRUE; then
2819             lto=-flto
2820         fi
2821         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2822         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2823         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2824         AR=`xcrun -find ar`
2825         NM=`xcrun -find nm`
2826         STRIP=`xcrun -find strip`
2827         LIBTOOL=`xcrun -find libtool`
2828         RANLIB=`xcrun -find ranlib`
2829         AC_MSG_RESULT([$CC and $CXX])
2830     fi
2832     case "$with_macosx_version_max_allowed" in
2833     10.10)
2834         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2835         ;;
2836     10.11)
2837         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2838         ;;
2839     10.12)
2840         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2841         ;;
2842     10.13)
2843         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2844         ;;
2845     10.14)
2846         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2847         ;;
2848     *)
2849         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--14])
2850         ;;
2851     esac
2853     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2854     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2855         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])
2856     else
2857         AC_MSG_RESULT([ok])
2858     fi
2860     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2861     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2862         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2863     else
2864         AC_MSG_RESULT([ok])
2865     fi
2866     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2867     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2869     AC_MSG_CHECKING([whether to do code signing])
2871     if test "$enable_macosx_code_signing" = yes; then
2872         # By default use the first suitable certificate (?).
2874         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2875         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2876         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2877         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2878         # "Developer ID Application" one.
2880         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2881         if test -n "$identity"; then
2882             MACOSX_CODESIGNING_IDENTITY=$identity
2883             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2884             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2885         else
2886             AC_MSG_ERROR([cannot determine identity to use])
2887         fi
2888     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2889         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2890         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2891         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2892     else
2893         AC_MSG_RESULT([no])
2894     fi
2896     AC_MSG_CHECKING([whether to create a Mac App Store package])
2898     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2899         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2900     elif test "$enable_macosx_package_signing" = yes; then
2901         # By default use the first suitable certificate.
2902         # It should be a "3rd Party Mac Developer Installer" one
2904         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2905         if test -n "$identity"; then
2906             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2907             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2908             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2909         else
2910             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2911         fi
2912     elif test -n "$enable_macosx_package_signing"; then
2913         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2914         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2915         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2916     else
2917         AC_MSG_RESULT([no])
2918     fi
2920     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2921         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2922     fi
2924     AC_MSG_CHECKING([whether to sandbox the application])
2926     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2927         AC_MSG_ERROR([macOS sandboxing requires code signing])
2928     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2929         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2930     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2931         ENABLE_MACOSX_SANDBOX=TRUE
2932         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2933         AC_MSG_RESULT([yes])
2934     else
2935         AC_MSG_RESULT([no])
2936     fi
2938     AC_MSG_CHECKING([what macOS app bundle identifier to use])
2939     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2940     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2942 AC_SUBST(MACOSX_SDK_PATH)
2943 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2944 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2945 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2946 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2947 AC_SUBST(INSTALL_NAME_TOOL)
2948 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
2949 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2950 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2951 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2952 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2954 dnl ===================================================================
2955 dnl Check iOS SDK and compiler
2956 dnl ===================================================================
2958 if test $_os = iOS; then
2959     AC_MSG_CHECKING([what iOS SDK to use])
2960     current_sdk_ver=12.1
2961     older_sdk_vers="12.0 11.4"
2962     if test "$enable_ios_simulator" = "yes"; then
2963         platform=iPhoneSimulator
2964         versionmin=-mios-simulator-version-min=11.0
2965     else
2966         platform=iPhoneOS
2967         versionmin=-miphoneos-version-min=11.0
2968     fi
2969     xcode_developer=`xcode-select -print-path`
2971     for sdkver in $current_sdk_ver $older_sdk_vers; do
2972         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2973         if test -d $t; then
2974             sysroot=$t
2975             break
2976         fi
2977     done
2979     if test -z "$sysroot"; then
2980         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2981     fi
2983     AC_MSG_RESULT($sysroot)
2985     # LTO is not really recommended for iOS builds,
2986     # the link time will be astronomical
2987     if test "$ENABLE_LTO" = TRUE; then
2988         lto=-flto
2989     fi
2991     stdlib="-stdlib=libc++"
2993     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2994     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2996     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2997     AR=`xcrun -find ar`
2998     NM=`xcrun -find nm`
2999     STRIP=`xcrun -find strip`
3000     LIBTOOL=`xcrun -find libtool`
3001     RANLIB=`xcrun -find ranlib`
3004 AC_MSG_CHECKING([whether to treat the installation as read-only])
3006 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3007         "$enable_extensions" != yes; then
3008     enable_readonly_installset=yes
3010 if test "$enable_readonly_installset" = yes; then
3011     AC_MSG_RESULT([yes])
3012     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3013 else
3014     AC_MSG_RESULT([no])
3017 dnl ===================================================================
3018 dnl Structure of install set
3019 dnl ===================================================================
3021 if test $_os = Darwin; then
3022     LIBO_BIN_FOLDER=MacOS
3023     LIBO_ETC_FOLDER=Resources
3024     LIBO_LIBEXEC_FOLDER=MacOS
3025     LIBO_LIB_FOLDER=Frameworks
3026     LIBO_LIB_PYUNO_FOLDER=Resources
3027     LIBO_SHARE_FOLDER=Resources
3028     LIBO_SHARE_HELP_FOLDER=Resources/help
3029     LIBO_SHARE_JAVA_FOLDER=Resources/java
3030     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3031     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3032     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3033     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3034     LIBO_URE_BIN_FOLDER=MacOS
3035     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3036     LIBO_URE_LIB_FOLDER=Frameworks
3037     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3038     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3039 elif test $_os = WINNT; then
3040     LIBO_BIN_FOLDER=program
3041     LIBO_ETC_FOLDER=program
3042     LIBO_LIBEXEC_FOLDER=program
3043     LIBO_LIB_FOLDER=program
3044     LIBO_LIB_PYUNO_FOLDER=program
3045     LIBO_SHARE_FOLDER=share
3046     LIBO_SHARE_HELP_FOLDER=help
3047     LIBO_SHARE_JAVA_FOLDER=program/classes
3048     LIBO_SHARE_PRESETS_FOLDER=presets
3049     LIBO_SHARE_READMES_FOLDER=readmes
3050     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3051     LIBO_SHARE_SHELL_FOLDER=program/shell
3052     LIBO_URE_BIN_FOLDER=program
3053     LIBO_URE_ETC_FOLDER=program
3054     LIBO_URE_LIB_FOLDER=program
3055     LIBO_URE_MISC_FOLDER=program
3056     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3057 else
3058     LIBO_BIN_FOLDER=program
3059     LIBO_ETC_FOLDER=program
3060     LIBO_LIBEXEC_FOLDER=program
3061     LIBO_LIB_FOLDER=program
3062     LIBO_LIB_PYUNO_FOLDER=program
3063     LIBO_SHARE_FOLDER=share
3064     LIBO_SHARE_HELP_FOLDER=help
3065     LIBO_SHARE_JAVA_FOLDER=program/classes
3066     LIBO_SHARE_PRESETS_FOLDER=presets
3067     LIBO_SHARE_READMES_FOLDER=readmes
3068     if test "$enable_fuzzers" != yes; then
3069         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3070     else
3071         LIBO_SHARE_RESOURCE_FOLDER=resource
3072     fi
3073     LIBO_SHARE_SHELL_FOLDER=program/shell
3074     LIBO_URE_BIN_FOLDER=program
3075     LIBO_URE_ETC_FOLDER=program
3076     LIBO_URE_LIB_FOLDER=program
3077     LIBO_URE_MISC_FOLDER=program
3078     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3080 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3081 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3091 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3092 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3093 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3094 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3095 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3097 # Not all of them needed in config_host.mk, add more if need arises
3098 AC_SUBST(LIBO_BIN_FOLDER)
3099 AC_SUBST(LIBO_ETC_FOLDER)
3100 AC_SUBST(LIBO_LIB_FOLDER)
3101 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3102 AC_SUBST(LIBO_SHARE_FOLDER)
3103 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3104 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3105 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3106 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3107 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3108 AC_SUBST(LIBO_URE_BIN_FOLDER)
3109 AC_SUBST(LIBO_URE_ETC_FOLDER)
3110 AC_SUBST(LIBO_URE_LIB_FOLDER)
3111 AC_SUBST(LIBO_URE_MISC_FOLDER)
3112 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3114 dnl ===================================================================
3115 dnl Windows specific tests and stuff
3116 dnl ===================================================================
3118 reg_get_value()
3120     # Return value: $regvalue
3121     unset regvalue
3123     local _regentry="/proc/registry${1}/${2}"
3124     if test -f "$_regentry"; then
3125         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3126         # Registry keys read via /proc/registry* are always \0 terminated!
3127         local _regvalue=$(tr -d '\0' < "$_regentry")
3128         if test $? -eq 0; then
3129             regvalue=$_regvalue
3130         fi
3131     fi
3134 # Get a value from the 32-bit side of the Registry
3135 reg_get_value_32()
3137     reg_get_value "32" "$1"
3140 # Get a value from the 64-bit side of the Registry
3141 reg_get_value_64()
3143     reg_get_value "64" "$1"
3146 if test "$_os" = "WINNT"; then
3147     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3148     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3149         AC_MSG_RESULT([no])
3150         WINDOWS_SDK_ARCH="x86"
3151     else
3152         AC_MSG_RESULT([yes])
3153         WINDOWS_SDK_ARCH="x64"
3154         BITNESS_OVERRIDE=64
3155     fi
3157 if test "$_os" = "iOS"; then
3158     cross_compiling="yes"
3161 if test "$cross_compiling" = "yes"; then
3162     export CROSS_COMPILING=TRUE
3163 else
3164     CROSS_COMPILING=
3165     BUILD_TYPE="$BUILD_TYPE NATIVE"
3167 AC_SUBST(CROSS_COMPILING)
3169 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3170 # NOTE: must _not_ be used for bundled external libraries!
3171 ISYSTEM=
3172 if test "$GCC" = "yes"; then
3173     AC_MSG_CHECKING( for -isystem )
3174     save_CFLAGS=$CFLAGS
3175     CFLAGS="$CFLAGS -Werror"
3176     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3177     CFLAGS=$save_CFLAGS
3178     if test -n "$ISYSTEM"; then
3179         AC_MSG_RESULT(yes)
3180     else
3181         AC_MSG_RESULT(no)
3182     fi
3184 if test -z "$ISYSTEM"; then
3185     # fall back to using -I
3186     ISYSTEM=-I
3188 AC_SUBST(ISYSTEM)
3190 dnl ===================================================================
3191 dnl  Check which Visual Studio compiler is used
3192 dnl ===================================================================
3194 map_vs_year_to_version()
3196     # Return value: $vsversion
3198     unset vsversion
3200     case $1 in
3201     2017)
3202         vsversion=15.0;;
3203     *)
3204         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3205     esac
3208 vs_versions_to_check()
3210     # Args: $1 (optional) : versions to check, in the order of preference
3211     # Return value: $vsversions
3213     unset vsversions
3215     if test -n "$1"; then
3216         map_vs_year_to_version "$1"
3217         vsversions=$vsversion
3218     else
3219         # We accept only 2017
3220         vsversions="15.0"
3221     fi
3224 win_get_env_from_vsvars32bat()
3226     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3227     # Also seems to be located in another directory under the same name: vsvars32.bat
3228     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3229     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3230     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3231     chmod +x $WRAPPERBATCHFILEPATH
3232     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3233     rm -f $WRAPPERBATCHFILEPATH
3234     printf '%s' "$_win_get_env_from_vsvars32bat"
3237 find_ucrt()
3239     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3240     if test -n "$regvalue"; then
3241         PathFormat "$regvalue"
3242         UCRTSDKDIR=$formatted_path
3243         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3244         UCRTVERSION=$regvalue
3245         # Rest if not exist
3246         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3247           UCRTSDKDIR=
3248         fi
3249     fi
3250     if test -z "$UCRTSDKDIR"; then
3251         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3252         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3253         if test -f "$ide_env_file"; then
3254             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3255             UCRTSDKDIR=$formatted_path
3256             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3257             dnl Hack needed at least by tml:
3258             if test "$UCRTVERSION" = 10.0.15063.0 \
3259                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3260                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3261             then
3262                 UCRTVERSION=10.0.14393.0
3263             fi
3264         else
3265           AC_MSG_ERROR([No UCRT found])
3266         fi
3267     fi
3270 find_msvc()
3272     # Find Visual C++ 2017
3273     # Args: $1 (optional) : The VS version year
3274     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3276     unset vctest vcnum vcnumwithdot vcbuildnumber
3278     vs_versions_to_check "$1"
3280     for ver in $vsversions; do
3281         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3282         if test -n "$regvalue"; then
3283             vctest=$regvalue
3284             break
3285         fi
3286         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3287         if test -n "$regvalue"; then
3288             AC_MSG_RESULT([found: $regvalue])
3289             PathFormat "$regvalue"
3290             vctest=$formatted_path
3291             break
3292         fi
3293     done
3294     if test -n "$vctest"; then
3295         vcnumwithdot=$ver
3296         case "$vcnumwithdot" in
3297         15.0)
3298             vcyear=2017
3299             vcnum=150
3300             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3301             ;;
3302         esac
3303     fi
3306 SOLARINC=
3307 MSBUILD_PATH=
3308 DEVENV=
3309 if test "$_os" = "WINNT"; then
3310     AC_MSG_CHECKING([Visual C++])
3312     find_msvc "$with_visual_studio"
3313     if test -z "$vctest"; then
3314         if test -n "$with_visual_studio"; then
3315             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3316         else
3317             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3318         fi
3319     fi
3321     if test "$BITNESS_OVERRIDE" = ""; then
3322         if test -f "$vctest/bin/cl.exe"; then
3323             VC_PRODUCT_DIR=$vctest
3324         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3325             VC_PRODUCT_DIR=$vctest/VC
3326         else
3327             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3328         fi
3329     else
3330         if test -f "$vctest/bin/amd64/cl.exe"; then
3331             VC_PRODUCT_DIR=$vctest
3332         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3333             VC_PRODUCT_DIR=$vctest/VC
3334         else
3335             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe or $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3336         fi
3337     fi
3339     AC_MSG_CHECKING([for short pathname of VC product directory])
3340     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3341     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3343     UCRTSDKDIR=
3344     UCRTVERSION=
3346     AC_MSG_CHECKING([for UCRT location])
3347     find_ucrt
3348     # find_ucrt errors out if it doesn't find it
3349     AC_MSG_RESULT([found])
3350     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3351     ucrtincpath_formatted=$formatted_path
3352     # SOLARINC is used for external modules and must be set too.
3353     # And no, it's not sufficient to set SOLARINC only, as configure
3354     # itself doesn't honour it.
3355     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3356     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3357     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3358     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3360     AC_SUBST(UCRTSDKDIR)
3361     AC_SUBST(UCRTVERSION)
3363     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3364     # Find the proper version of MSBuild.exe to use based on the VS version
3365     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3366     if test -n "$regvalue" ; then
3367         AC_MSG_RESULT([found: $regvalue])
3368         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3369     else
3370         if test "$BITNESS_OVERRIDE" = ""; then
3371             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3372         else
3373             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3374         fi
3375         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3376         AC_MSG_RESULT([$regvalue])
3377     fi
3379     # Find the version of devenv.exe
3380     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3381     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3382     if test ! -e "$DEVENV"; then
3383         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3384     fi
3386     dnl ===========================================================
3387     dnl  Check for the corresponding mspdb*.dll
3388     dnl ===========================================================
3390     MSPDB_PATH=
3391     CL_DIR=
3392     CL_LIB=
3394     if test "$BITNESS_OVERRIDE" = ""; then
3395         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3396         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3397     else
3398         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3399         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3400     fi
3402     # MSVC 15.0 has libraries from 14.0?
3403     mspdbnum="140"
3405     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3406         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3407     fi
3409     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3410     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3412     dnl The path needs to be added before cl is called
3413     PATH="$MSPDB_PATH:$PATH"
3415     AC_MSG_CHECKING([cl.exe])
3417     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3418     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3419     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3420     # is not enough?
3422     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3423     dnl needed when building CLR code:
3424     if test -z "$MSVC_CXX"; then
3425         if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3426             MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3427         fi
3429         # This gives us a posix path with 8.3 filename restrictions
3430         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3431     fi
3433     if test -z "$CC"; then
3434         CC=$MSVC_CXX
3435     fi
3436     if test "$BITNESS_OVERRIDE" = ""; then
3437         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3438         MSVC_CXX="$MSVC_CXX -arch:SSE"
3439     fi
3441     if test -n "$CC"; then
3442         # Remove /cl.exe from CC case insensitive
3443         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3444         if test "$BITNESS_OVERRIDE" = ""; then
3445            COMPATH="$VC_PRODUCT_DIR"
3446         else
3447             if test -n "$VC_PRODUCT_DIR"; then
3448                 COMPATH=$VC_PRODUCT_DIR
3449             fi
3450         fi
3451         if test "$BITNESS_OVERRIDE" = ""; then
3452             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3453             CC="$CC -arch:SSE"
3454         fi
3456         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3458         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3460         PathFormat "$COMPATH"
3461         COMPATH="$formatted_path"
3463         VCVER=$vcnum
3464         MSVSVER=$vcyear
3466         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3467         # are always "better", we list them in reverse chronological order.
3469         case $vcnum in
3470         150)
3471             COMEX=19
3472             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3473             ;;
3474         esac
3476         # The expectation is that --with-windows-sdk should not need to be used
3477         if test -n "$with_windows_sdk"; then
3478             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3479             *" "$with_windows_sdk" "*)
3480                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3481                 ;;
3482             *)
3483                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3484                 ;;
3485             esac
3486         fi
3488         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3489         ac_objext=obj
3490         ac_exeext=exe
3492     else
3493         AC_MSG_ERROR([Visual C++ not found after all, huh])
3494     fi
3496     AC_MSG_CHECKING([$CC is at least Visual Studio 2017 version 15.7])
3497     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3498         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3499         // between Visual Studio versions and _MSC_VER:
3500         #if _MSC_VER < 1914
3501         #error
3502         #endif
3503     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3505     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3506     # version of the Explorer extension (and maybe other small
3507     # bits, too) needed when installing a 32-bit LibreOffice on a
3508     # 64-bit OS. The 64-bit Explorer extension is a feature that
3509     # has been present since long in OOo. Don't confuse it with
3510     # building LibreOffice itself as 64-bit code.
3512     BUILD_X64=
3513     CXX_X64_BINARY=
3514     LINK_X64_BINARY=
3516     if test "$BITNESS_OVERRIDE" = ""; then
3517         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3518         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3519             # Prefer native x64 compiler to cross-compiler, in case we are running
3520             # the build on a 64-bit OS.
3521             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3522                 BUILD_X64=TRUE
3523                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3524                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3525             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3526                 BUILD_X64=TRUE
3527                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3528                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3529             fi
3530         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3531             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3532             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3533                 BUILD_X64=TRUE
3534                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3535                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3536             fi
3537         fi
3538         if test "$BUILD_X64" = TRUE; then
3539             AC_MSG_RESULT([found])
3540         else
3541             AC_MSG_RESULT([not found])
3542             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3543         fi
3544     fi
3545     AC_SUBST(BUILD_X64)
3547     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3548     AC_SUBST(CXX_X64_BINARY)
3549     AC_SUBST(LINK_X64_BINARY)
3551     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3552     # needed to support TWAIN scan on both 32- and 64-bit systems
3554     BUILD_X86=
3556     if test "$BITNESS_OVERRIDE" = "64"; then
3557         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3558         if test -n "$CXX_X86_BINARY"; then
3559             BUILD_X86=TRUE
3560             AC_MSG_RESULT([preset])
3561         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3562             BUILD_X86=TRUE
3563             CXX_X86_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe -arch:SSE"
3564             AC_MSG_RESULT([found])
3565         else
3566             CXX_X86_BINARY=
3567             AC_MSG_RESULT([not found])
3568             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3569         fi
3570     else
3571         BUILD_X86=TRUE
3572         CXX_X86_BINARY=$MSVC_CXX
3573     fi
3574     AC_SUBST(BUILD_X86)
3575     AC_SUBST(CXX_X86_BINARY)
3577 AC_SUBST(VCVER)
3578 AC_SUBST(DEVENV)
3579 PathFormat "$MSPDB_PATH"
3580 MSPDB_PATH="$formatted_path"
3581 AC_SUBST(MSVC_CXX)
3584 # unowinreg.dll
3586 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3587 AC_SUBST(UNOWINREG_DLL)
3589 COM_IS_CLANG=
3590 AC_MSG_CHECKING([whether the compiler is actually Clang])
3591 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3592     #ifndef __clang__
3593     you lose
3594     #endif
3595     int foo=42;
3596     ]])],
3597     [AC_MSG_RESULT([yes])
3598      COM_IS_CLANG=TRUE],
3599     [AC_MSG_RESULT([no])])
3600 AC_SUBST(COM_IS_CLANG)
3602 CC_PLAIN=$CC
3603 CLANGVER=
3604 if test "$COM_IS_CLANG" = TRUE; then
3605     AC_MSG_CHECKING([whether Clang is new enough])
3606     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3607         #if !defined __apple_build_version__
3608         #error
3609         #endif
3610         ]])],
3611         [my_apple_clang=yes],[my_apple_clang=])
3612     if test "$my_apple_clang" = yes; then
3613         AC_MSG_RESULT([assumed yes (Apple Clang)])
3614     else
3615         if test "$_os" = WINNT; then
3616             dnl In which case, assume clang-cl:
3617             my_args="/EP /TC"
3618             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3619             dnl clang-cl:
3620             CC_PLAIN=
3621             for i in $CC; do
3622                 case $i in
3623                 -FIIntrin.h)
3624                     ;;
3625                 *)
3626                     CC_PLAIN="$CC_PLAIN $i"
3627                     ;;
3628                 esac
3629             done
3630         else
3631             my_args="-E -P"
3632         fi
3633         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3634         CLANGVER=`echo $clang_version \
3635             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3636         if test "$CLANGVER" -ge 50002; then
3637             AC_MSG_RESULT([yes ($clang_version)])
3638         else
3639             CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3640             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3641         fi
3642         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3643     fi
3646 SHOWINCLUDES_PREFIX=
3647 if test "$_os" = WINNT; then
3648     dnl We need to guess the prefix of the -showIncludes output, it can be
3649     dnl localized
3650     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3651     echo "#include <stdlib.h>" > conftest.c
3652     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3653         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3654     rm -f conftest.c conftest.obj
3655     if test -z "$SHOWINCLUDES_PREFIX"; then
3656         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3657     else
3658         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3659     fi
3661 AC_SUBST(SHOWINCLUDES_PREFIX)
3664 # prefix C with ccache if needed
3666 if test "$CCACHE" != ""; then
3667     AC_MSG_CHECKING([whether $CC is already ccached])
3669     AC_LANG_PUSH([C])
3670     save_CFLAGS=$CFLAGS
3671     CFLAGS="$CFLAGS --ccache-skip -O2"
3672     dnl an empty program will do, we're checking the compiler flags
3673     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3674                       [use_ccache=yes], [use_ccache=no])
3675     if test $use_ccache = yes; then
3676         AC_MSG_RESULT([yes])
3677     else
3678         CC="$CCACHE $CC"
3679         AC_MSG_RESULT([no])
3680     fi
3681     CFLAGS=$save_CFLAGS
3682     AC_LANG_POP([C])
3685 # ===================================================================
3686 # check various GCC options that Clang does not support now but maybe
3687 # will somewhen in the future, check them even for GCC, so that the
3688 # flags are set
3689 # ===================================================================
3691 HAVE_GCC_GGDB2=
3692 if test "$GCC" = "yes"; then
3693     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3694     save_CFLAGS=$CFLAGS
3695     CFLAGS="$CFLAGS -Werror -ggdb2"
3696     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3697     CFLAGS=$save_CFLAGS
3698     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3699         AC_MSG_RESULT([yes])
3700     else
3701         AC_MSG_RESULT([no])
3702     fi
3704     if test "$host_cpu" = "m68k"; then
3705         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3706         save_CFLAGS=$CFLAGS
3707         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3708         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3709         CFLAGS=$save_CFLAGS
3710         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3711             AC_MSG_RESULT([yes])
3712         else
3713             AC_MSG_ERROR([no])
3714         fi
3715     fi
3717 AC_SUBST(HAVE_GCC_GGDB2)
3719 dnl ===================================================================
3720 dnl  Test the gcc version
3721 dnl ===================================================================
3722 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3723     AC_MSG_CHECKING([the GCC version])
3724     _gcc_version=`$CC -dumpversion`
3725     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3726         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3727     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3729     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3731     if test "$gcc_full_version" -lt 70000; then
3732         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3733     fi
3734 else
3735     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3736     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3737     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3738     # (which reports itself as GCC 4.2.1).
3739     GCC_VERSION=
3741 AC_SUBST(GCC_VERSION)
3743 dnl Set the ENABLE_DBGUTIL variable
3744 dnl ===================================================================
3745 AC_MSG_CHECKING([whether to build with additional debug utilities])
3746 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3747     ENABLE_DBGUTIL="TRUE"
3748     # this is an extra var so it can have different default on different MSVC
3749     # versions (in case there are version specific problems with it)
3750     MSVC_USE_DEBUG_RUNTIME="TRUE"
3752     AC_MSG_RESULT([yes])
3753     # cppunit and graphite expose STL in public headers
3754     if test "$with_system_cppunit" = "yes"; then
3755         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3756     else
3757         with_system_cppunit=no
3758     fi
3759     if test "$with_system_graphite" = "yes"; then
3760         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3761     else
3762         with_system_graphite=no
3763     fi
3764     if test "$with_system_orcus" = "yes"; then
3765         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3766     else
3767         with_system_orcus=no
3768     fi
3769     if test "$with_system_libcmis" = "yes"; then
3770         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3771     else
3772         with_system_libcmis=no
3773     fi
3774     if test "$with_system_hunspell" = "yes"; then
3775         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3776     else
3777         with_system_hunspell=no
3778     fi
3779     if test "$with_system_gpgmepp" = "yes"; then
3780         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3781     else
3782         with_system_gpgmepp=no
3783     fi
3784     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3785     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3786     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3787     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3788     # of those two is using the system variant:
3789     if test "$with_system_libnumbertext" = "yes"; then
3790         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3791     else
3792         with_system_libnumbertext=no
3793     fi
3794     if test "$with_system_libwps" = "yes"; then
3795         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3796     else
3797         with_system_libwps=no
3798     fi
3799 else
3800     ENABLE_DBGUTIL=""
3801     MSVC_USE_DEBUG_RUNTIME=""
3802     AC_MSG_RESULT([no])
3804 AC_SUBST(ENABLE_DBGUTIL)
3805 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3807 dnl Set the ENABLE_DEBUG variable.
3808 dnl ===================================================================
3809 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3810     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3812 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3813     if test -z "$libo_fuzzed_enable_debug"; then
3814         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3815     else
3816         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3817         enable_debug=yes
3818     fi
3821 AC_MSG_CHECKING([whether to do a debug build])
3822 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3823     ENABLE_DEBUG="TRUE"
3824     if test -n "$ENABLE_DBGUTIL" ; then
3825         AC_MSG_RESULT([yes (dbgutil)])
3826     else
3827         AC_MSG_RESULT([yes])
3828     fi
3829 else
3830     ENABLE_DEBUG=""
3831     AC_MSG_RESULT([no])
3833 AC_SUBST(ENABLE_DEBUG)
3835 dnl ===================================================================
3836 dnl Select the linker to use (gold/lld/ld.bfd).
3837 dnl This is done only after compiler checks (need to know if Clang is
3838 dnl used, for different defaults) and after checking if a debug build
3839 dnl is wanted (non-debug builds get the default linker if not explicitly
3840 dnl specified otherwise).
3841 dnl All checks for linker features/options should come after this.
3842 dnl ===================================================================
3843 check_use_ld()
3845     use_ld=$1
3846     use_ld_fail_if_error=$2
3847     use_ld_ok=
3848     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3849     use_ld_ldflags_save="$LDFLAGS"
3850     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3851     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3852 #include <stdio.h>
3853         ],[
3854 printf ("hello world\n");
3855         ])], USE_LD=$use_ld, [])
3856     if test -n "$USE_LD"; then
3857         AC_MSG_RESULT( yes )
3858         use_ld_ok=yes
3859         dnl For obscure reasons, unxgcc.mk uses the --dynamic-list-cpp-typeinfo linker option
3860         dnl if sanitizers are used, and lld doesn't support this option.
3861         use_ld_has_sanitizers=
3862         for i in $CC; do
3863             case $i in
3864             -fsanitize=*)
3865                 use_ld_has_sanitizers=yes
3866                 break
3867                 ;;
3868             esac
3869         done
3870         if test -n "$use_ld_has_sanitizers"; then
3871             AC_MSG_CHECKING([for --dynamic-list-cpp-typeinfo linker support (-fuse-ld=$use_ld)])
3872             use_ld_ldflags_save_2="$LDFLAGS"
3873             LDFLAGS="$LDFLAGS -Wl,--dynamic-list-cpp-typeinfo"
3874             use_ld_has_cpp_typeinfo=
3875             AC_LINK_IFELSE([AC_LANG_PROGRAM([
3876 #include <stdio.h>
3877                 ],[
3878 printf ("hello world\n");
3879                 ])], use_ld_has_cpp_typeinfo=yes, [])
3880             LDFLAGS="$use_ld_ldflags_save_2"
3881             if test -n "$use_ld_has_cpp_typeinfo"; then
3882                 AC_MSG_RESULT( yes )
3883             else
3884                 AC_MSG_RESULT( no )
3885                 use_ld_ok=
3886             fi
3887         fi
3888     else
3889         if test -n "$use_ld_fail_if_error"; then
3890             AC_MSG_ERROR( no )
3891         else
3892             AC_MSG_RESULT( no )
3893         fi
3894     fi
3895     if test -n "$use_ld_ok"; then
3896         dnl keep the value of LDFLAGS
3897         return 0
3898     fi
3899     LDFLAGS="$use_ld_ldflags_save"
3900     return 1
3902 USE_LD=
3903 if test "$enable_ld" != "no"; then
3904     if test "$GCC" = "yes"; then
3905         if test -n "$enable_ld"; then
3906             check_use_ld "$enable_ld" fail_if_error
3907         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3908             dnl non-debug builds default to the default linker
3909             true
3910         elif test -n "$COM_IS_CLANG"; then
3911             check_use_ld lld
3912             if test $? -ne 0; then
3913                 check_use_ld gold
3914             fi
3915         else
3916             check_use_ld gold
3917         fi
3918         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c - $CFLAGS $LDFLAGS 2>/dev/null)
3919         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
3920         if test -z "$ld_used"; then
3921             ld_used="unknown"
3922         fi
3923         AC_MSG_CHECKING([for linker that is used])
3924         AC_MSG_RESULT([$ld_used])
3925         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3926             if echo "$ld_used" | grep -q "^GNU ld"; then
3927                 if test -n "$COM_IS_CLANG"; then
3928                     AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
3929                     add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
3930                 else
3931                     AC_MSG_WARN([The default GNU linker is slow, consider using the GNU gold linker.])
3932                     add_warning "The default GNU linker is slow, consider using the GNU gold linker."
3933                 fi
3934             fi
3935         fi
3936     else
3937         if test "$enable_ld" = "yes"; then
3938             AC_MSG_ERROR([--enable-ld not supported])
3939         fi
3940     fi
3942 AC_SUBST(USE_LD)
3944 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3945 if test "$GCC" = "yes"; then
3946     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3947     bsymbolic_functions_ldflags_save=$LDFLAGS
3948     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
3949     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3950 #include <stdio.h>
3951         ],[
3952 printf ("hello world\n");
3953         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3954     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3955         AC_MSG_RESULT( found )
3956     else
3957         AC_MSG_RESULT( not found )
3958     fi
3959     LDFLAGS=$bsymbolic_functions_ldflags_save
3961 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3964 HAVE_GSPLIT_DWARF=
3965 if test "$enable_split_debug" != no; then
3966     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
3967     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
3968         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
3969         save_CFLAGS=$CFLAGS
3970         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
3971         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
3972         CFLAGS=$save_CFLAGS
3973         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
3974             AC_MSG_RESULT([yes])
3975         else
3976             if test "$enable_split_debug" = yes; then
3977                 AC_MSG_ERROR([no])
3978             else
3979                 AC_MSG_RESULT([no])
3980             fi
3981         fi
3982     fi
3983     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3984         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
3985         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
3986     fi
3988 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
3990 ENABLE_GDB_INDEX=
3991 if test "$enable_gdb_index" != "no"; then
3992     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
3993     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
3994         AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
3995         save_CFLAGS=$CFLAGS
3996         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
3997         have_ggnu_pubnames=
3998         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
3999         if test "$have_ggnu_pubnames" != "TRUE"; then
4000             if test "$enable_gdb_index" = "yes"; then
4001                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4002             else
4003                 AC_MSG_RESULT( no )
4004             fi
4005         else
4006             AC_MSG_RESULT( yes )
4007             AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
4008             ldflags_save=$LDFLAGS
4009             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4010             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4011 #include <stdio.h>
4012                 ],[
4013 printf ("hello world\n");
4014                 ])], ENABLE_GDB_INDEX=TRUE, [])
4015             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4016                 AC_MSG_RESULT( yes )
4017             else
4018                 if test "$enable_gdb_index" = "yes"; then
4019                     AC_MSG_ERROR( no )
4020                 else
4021                     AC_MSG_RESULT( no )
4022                 fi
4023             fi
4024             LDFLAGS=$ldflags_save
4025         fi
4026         CFLAGS=$save_CFLAGS
4027         fi
4028     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4029         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4030         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4031     fi
4033 AC_SUBST(ENABLE_GDB_INDEX)
4035 if test "$enable_sal_log" = yes; then
4036     ENABLE_SAL_LOG=TRUE
4038 AC_SUBST(ENABLE_SAL_LOG)
4040 dnl Selective debuginfo
4041 ENABLE_DEBUGINFO_FOR=
4042 if test -n "$ENABLE_DEBUG"; then
4043     AC_MSG_CHECKING([whether to use selective debuginfo])
4044     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
4045         if test "$enable_selective_debuginfo" = "yes"; then
4046             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
4047         fi
4048         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
4049         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
4050     else
4051         ENABLE_DEBUGINFO_FOR=all
4052         AC_MSG_RESULT([no, for all])
4053     fi
4054 else
4055     if test -n "$enable_selective_debuginfo"; then
4056         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
4057     fi
4059 AC_SUBST(ENABLE_DEBUGINFO_FOR)
4061 dnl Check for enable symbols option
4062 dnl ===================================================================
4063 AC_MSG_CHECKING([whether to generate debug information])
4064 if test -z "$enable_symbols"; then
4065     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4066         enable_symbols=yes
4067     else
4068         enable_symbols=no
4069     fi
4071 if test "$enable_symbols" != no; then
4072     ENABLE_SYMBOLS=TRUE
4073     AC_MSG_RESULT([yes])
4074 else
4075     ENABLE_SYMBOLS=
4076     AC_MSG_RESULT([no])
4078 AC_SUBST(ENABLE_SYMBOLS)
4080 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4081     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4082     AC_MSG_CHECKING([whether enough memory is available for linking])
4083     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4084     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4085     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4086         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4087     else
4088         AC_MSG_RESULT([yes])
4089     fi
4092 AC_MSG_CHECKING([whether to compile with optimization flags])
4093 if test -z "$enable_optimized"; then
4094     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4095         enable_optimized=no
4096     else
4097         enable_optimized=yes
4098     fi
4100 if test "$enable_optimized" != no; then
4101     ENABLE_OPTIMIZED=TRUE
4102     AC_MSG_RESULT([yes])
4103 else
4104     ENABLE_OPTIMIZED=
4105     AC_MSG_RESULT([no])
4107 AC_SUBST(ENABLE_OPTIMIZED)
4110 # determine CPUNAME, OS, ...
4111 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4113 case "$host_os" in
4115 aix*)
4116     COM=GCC
4117     CPUNAME=POWERPC
4118     USING_X11=TRUE
4119     OS=AIX
4120     RTL_OS=AIX
4121     RTL_ARCH=PowerPC
4122     PLATFORMID=aix_powerpc
4123     P_SEP=:
4124     ;;
4126 cygwin*)
4127     COM=MSC
4128     USING_X11=
4129     OS=WNT
4130     RTL_OS=Windows
4131     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4132         P_SEP=";"
4133     else
4134         P_SEP=:
4135     fi
4136     case "$host_cpu" in
4137     i*86|x86_64)
4138         if test "$BITNESS_OVERRIDE" = 64; then
4139             CPUNAME=X86_64
4140             RTL_ARCH=X86_64
4141             PLATFORMID=windows_x86_64
4142             WINDOWS_X64=1
4143             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4144         else
4145             CPUNAME=INTEL
4146             RTL_ARCH=x86
4147             PLATFORMID=windows_x86
4148         fi
4149         ;;
4150     *)
4151         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4152         ;;
4153     esac
4154     SCPDEFS="$SCPDEFS -D_MSC_VER"
4155     ;;
4157 darwin*)
4158     COM=GCC
4159     USING_X11=
4160     OS=MACOSX
4161     RTL_OS=MacOSX
4162     P_SEP=:
4164     case "$host_cpu" in
4165     arm)
4166         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4167         ;;
4168     arm64)
4169         OS=iOS
4170         if test "$enable_ios_simulator" = "yes"; then
4171             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4172         else
4173             CPUNAME=ARM64
4174             RTL_ARCH=ARM_EABI
4175             PLATFORMID=ios_arm64
4176         fi
4177         ;;
4178     i*86)
4179         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4180         ;;
4181     x86_64)
4182         if test "$enable_ios_simulator" = "yes"; then
4183             OS=iOS
4184         fi
4185         CPUNAME=X86_64
4186         RTL_ARCH=X86_64
4187         PLATFORMID=macosx_x86_64
4188         ;;
4189     *)
4190         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4191         ;;
4192     esac
4193     ;;
4195 dragonfly*)
4196     COM=GCC
4197     USING_X11=TRUE
4198     OS=DRAGONFLY
4199     RTL_OS=DragonFly
4200     P_SEP=:
4202     case "$host_cpu" in
4203     i*86)
4204         CPUNAME=INTEL
4205         RTL_ARCH=x86
4206         PLATFORMID=dragonfly_x86
4207         ;;
4208     x86_64)
4209         CPUNAME=X86_64
4210         RTL_ARCH=X86_64
4211         PLATFORMID=dragonfly_x86_64
4212         ;;
4213     *)
4214         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4215         ;;
4216     esac
4217     ;;
4219 freebsd*)
4220     COM=GCC
4221     USING_X11=TRUE
4222     RTL_OS=FreeBSD
4223     OS=FREEBSD
4224     P_SEP=:
4226     case "$host_cpu" in
4227     i*86)
4228         CPUNAME=INTEL
4229         RTL_ARCH=x86
4230         PLATFORMID=freebsd_x86
4231         ;;
4232     x86_64|amd64)
4233         CPUNAME=X86_64
4234         RTL_ARCH=X86_64
4235         PLATFORMID=freebsd_x86_64
4236         ;;
4237     *)
4238         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4239         ;;
4240     esac
4241     ;;
4243 haiku*)
4244     COM=GCC
4245     USING_X11=
4246     GUIBASE=haiku
4247     RTL_OS=Haiku
4248     OS=HAIKU
4249     P_SEP=:
4251     case "$host_cpu" in
4252     i*86)
4253         CPUNAME=INTEL
4254         RTL_ARCH=x86
4255         PLATFORMID=haiku_x86
4256         ;;
4257     x86_64|amd64)
4258         CPUNAME=X86_64
4259         RTL_ARCH=X86_64
4260         PLATFORMID=haiku_x86_64
4261         ;;
4262     *)
4263         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4264         ;;
4265     esac
4266     ;;
4268 kfreebsd*)
4269     COM=GCC
4270     USING_X11=TRUE
4271     OS=LINUX
4272     RTL_OS=kFreeBSD
4273     P_SEP=:
4275     case "$host_cpu" in
4277     i*86)
4278         CPUNAME=INTEL
4279         RTL_ARCH=x86
4280         PLATFORMID=kfreebsd_x86
4281         ;;
4282     x86_64)
4283         CPUNAME=X86_64
4284         RTL_ARCH=X86_64
4285         PLATFORMID=kfreebsd_x86_64
4286         ;;
4287     *)
4288         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4289         ;;
4290     esac
4291     ;;
4293 linux-gnu*)
4294     COM=GCC
4295     USING_X11=TRUE
4296     OS=LINUX
4297     RTL_OS=Linux
4298     P_SEP=:
4300     case "$host_cpu" in
4302     aarch64)
4303         CPUNAME=AARCH64
4304         PLATFORMID=linux_aarch64
4305         RTL_ARCH=AARCH64
4306         ;;
4307     alpha)
4308         CPUNAME=AXP
4309         RTL_ARCH=ALPHA
4310         PLATFORMID=linux_alpha
4311         ;;
4312     arm*)
4313         CPUNAME=ARM
4314         EPM_FLAGS="-a arm"
4315         RTL_ARCH=ARM_EABI
4316         PLATFORMID=linux_arm_eabi
4317         case "$host_cpu" in
4318         arm*-linux)
4319             RTL_ARCH=ARM_OABI
4320             PLATFORMID=linux_arm_oabi
4321             ;;
4322         esac
4323         ;;
4324     hppa)
4325         CPUNAME=HPPA
4326         RTL_ARCH=HPPA
4327         EPM_FLAGS="-a hppa"
4328         PLATFORMID=linux_hppa
4329         ;;
4330     i*86)
4331         CPUNAME=INTEL
4332         RTL_ARCH=x86
4333         PLATFORMID=linux_x86
4334         ;;
4335     ia64)
4336         CPUNAME=IA64
4337         RTL_ARCH=IA64
4338         PLATFORMID=linux_ia64
4339         ;;
4340     mips)
4341         CPUNAME=GODSON
4342         RTL_ARCH=MIPS_EB
4343         EPM_FLAGS="-a mips"
4344         PLATFORMID=linux_mips_eb
4345         ;;
4346     mips64)
4347         CPUNAME=GODSON64
4348         RTL_ARCH=MIPS64_EB
4349         EPM_FLAGS="-a mips64"
4350         PLATFORMID=linux_mips64_eb
4351         ;;
4352     mips64el)
4353         CPUNAME=GODSON64
4354         RTL_ARCH=MIPS64_EL
4355         EPM_FLAGS="-a mips64el"
4356         PLATFORMID=linux_mips64_el
4357         ;;
4358     mipsel)
4359         CPUNAME=GODSON
4360         RTL_ARCH=MIPS_EL
4361         EPM_FLAGS="-a mipsel"
4362         PLATFORMID=linux_mips_el
4363         ;;
4364     m68k)
4365         CPUNAME=M68K
4366         RTL_ARCH=M68K
4367         PLATFORMID=linux_m68k
4368         ;;
4369     powerpc)
4370         CPUNAME=POWERPC
4371         RTL_ARCH=PowerPC
4372         PLATFORMID=linux_powerpc
4373         ;;
4374     powerpc64)
4375         CPUNAME=POWERPC64
4376         RTL_ARCH=PowerPC_64
4377         PLATFORMID=linux_powerpc64
4378         ;;
4379     powerpc64le)
4380         CPUNAME=POWERPC64
4381         RTL_ARCH=PowerPC_64_LE
4382         PLATFORMID=linux_powerpc64_le
4383         ;;
4384     sparc)
4385         CPUNAME=SPARC
4386         RTL_ARCH=SPARC
4387         PLATFORMID=linux_sparc
4388         ;;
4389     sparc64)
4390         CPUNAME=SPARC64
4391         RTL_ARCH=SPARC64
4392         PLATFORMID=linux_sparc64
4393         ;;
4394     s390)
4395         CPUNAME=S390
4396         RTL_ARCH=S390
4397         PLATFORMID=linux_s390
4398         ;;
4399     s390x)
4400         CPUNAME=S390X
4401         RTL_ARCH=S390x
4402         PLATFORMID=linux_s390x
4403         ;;
4404     x86_64)
4405         CPUNAME=X86_64
4406         RTL_ARCH=X86_64
4407         PLATFORMID=linux_x86_64
4408         ;;
4409     *)
4410         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4411         ;;
4412     esac
4413     ;;
4415 linux-android*)
4416     COM=GCC
4417     USING_X11=
4418     OS=ANDROID
4419     RTL_OS=Android
4420     P_SEP=:
4422     case "$host_cpu" in
4424     arm|armel)
4425         CPUNAME=ARM
4426         RTL_ARCH=ARM_EABI
4427         PLATFORMID=android_arm_eabi
4428         ;;
4429     aarch64)
4430         CPUNAME=AARCH64
4431         RTL_ARCH=AARCH64
4432         PLATFORMID=android_aarch64
4433         ;;
4434     mips|mipsel)
4435         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4436         RTL_ARCH=MIPS_EL
4437         PLATFORMID=android_mips_el
4438         ;;
4439     i*86)
4440         CPUNAME=INTEL
4441         RTL_ARCH=x86
4442         PLATFORMID=android_x86
4443         ;;
4444     *)
4445         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4446         ;;
4447     esac
4448     ;;
4450 *netbsd*)
4451     COM=GCC
4452     USING_X11=TRUE
4453     OS=NETBSD
4454     RTL_OS=NetBSD
4455     P_SEP=:
4457     case "$host_cpu" in
4458     i*86)
4459         CPUNAME=INTEL
4460         RTL_ARCH=x86
4461         PLATFORMID=netbsd_x86
4462         ;;
4463     powerpc)
4464         CPUNAME=POWERPC
4465         RTL_ARCH=PowerPC
4466         PLATFORMID=netbsd_powerpc
4467         ;;
4468     sparc)
4469         CPUNAME=SPARC
4470         RTL_ARCH=SPARC
4471         PLATFORMID=netbsd_sparc
4472         ;;
4473     x86_64)
4474         CPUNAME=X86_64
4475         RTL_ARCH=X86_64
4476         PLATFORMID=netbsd_x86_64
4477         ;;
4478     *)
4479         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4480         ;;
4481     esac
4482     ;;
4484 openbsd*)
4485     COM=GCC
4486     USING_X11=TRUE
4487     OS=OPENBSD
4488     RTL_OS=OpenBSD
4489     P_SEP=:
4491     case "$host_cpu" in
4492     i*86)
4493         CPUNAME=INTEL
4494         RTL_ARCH=x86
4495         PLATFORMID=openbsd_x86
4496         ;;
4497     x86_64)
4498         CPUNAME=X86_64
4499         RTL_ARCH=X86_64
4500         PLATFORMID=openbsd_x86_64
4501         ;;
4502     *)
4503         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4504         ;;
4505     esac
4506     SOLARINC="$SOLARINC -I/usr/local/include"
4507     ;;
4509 solaris*)
4510     COM=GCC
4511     USING_X11=TRUE
4512     OS=SOLARIS
4513     RTL_OS=Solaris
4514     P_SEP=:
4516     case "$host_cpu" in
4517     i*86)
4518         CPUNAME=INTEL
4519         RTL_ARCH=x86
4520         PLATFORMID=solaris_x86
4521         ;;
4522     sparc)
4523         CPUNAME=SPARC
4524         RTL_ARCH=SPARC
4525         PLATFORMID=solaris_sparc
4526         ;;
4527     sparc64)
4528         CPUNAME=SPARC64
4529         RTL_ARCH=SPARC64
4530         PLATFORMID=solaris_sparc64
4531         ;;
4532     *)
4533         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4534         ;;
4535     esac
4536     SOLARINC="$SOLARINC -I/usr/local/include"
4537     ;;
4540     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4541     ;;
4542 esac
4544 if test "$with_x" = "no"; then
4545     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4548 DISABLE_GUI=""
4549 if test "$enable_gui" = "no"; then
4550     if test "$USING_X11" != TRUE; then
4551         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4552     fi
4553     USING_X11=
4554     DISABLE_GUI=TRUE
4555     AC_DEFINE(HAVE_FEATURE_UI,0)
4556     test_cairo=yes
4558 AC_SUBST(DISABLE_GUI)
4560 WORKDIR="${BUILDDIR}/workdir"
4561 INSTDIR="${BUILDDIR}/instdir"
4562 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4563 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4564 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4565 AC_SUBST(COM)
4566 AC_SUBST(CPUNAME)
4567 AC_SUBST(RTL_OS)
4568 AC_SUBST(RTL_ARCH)
4569 AC_SUBST(EPM_FLAGS)
4570 AC_SUBST(USING_X11)
4571 AC_SUBST([INSTDIR])
4572 AC_SUBST([INSTROOT])
4573 AC_SUBST([INSTROOTBASE])
4574 AC_SUBST(OS)
4575 AC_SUBST(P_SEP)
4576 AC_SUBST(WORKDIR)
4577 AC_SUBST(PLATFORMID)
4578 AC_SUBST(WINDOWS_X64)
4579 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4581 dnl ===================================================================
4582 dnl Test which package format to use
4583 dnl ===================================================================
4584 AC_MSG_CHECKING([which package format to use])
4585 if test -n "$with_package_format" -a "$with_package_format" != no; then
4586     for i in $with_package_format; do
4587         case "$i" in
4588         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4589             ;;
4590         *)
4591             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4592 aix - AIX software distribution
4593 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4594 deb - Debian software distribution
4595 pkg - Solaris software distribution
4596 rpm - RedHat software distribution
4598 LibreOffice additionally supports:
4599 archive - .tar.gz or .zip
4600 dmg - macOS .dmg
4601 installed - installation tree
4602 msi - Windows .msi
4603         ])
4604             ;;
4605         esac
4606     done
4607     # fakeroot is needed to ensure correct file ownerships/permissions
4608     # inside deb packages and tar archives created on Linux and Solaris.
4609     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4610         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4611         if test "$FAKEROOT" = "no"; then
4612             AC_MSG_ERROR(
4613                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4614         fi
4615     fi
4616     PKGFORMAT="$with_package_format"
4617     AC_MSG_RESULT([$PKGFORMAT])
4618 else
4619     PKGFORMAT=
4620     AC_MSG_RESULT([none])
4622 AC_SUBST(PKGFORMAT)
4624 dnl ===================================================================
4625 dnl Set up a different compiler to produce tools to run on the build
4626 dnl machine when doing cross-compilation
4627 dnl ===================================================================
4629 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4630 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4631 if test "$cross_compiling" = "yes"; then
4632     AC_MSG_CHECKING([for BUILD platform configuration])
4633     echo
4634     rm -rf CONF-FOR-BUILD config_build.mk
4635     mkdir CONF-FOR-BUILD
4636     # Here must be listed all files needed when running the configure script. In particular, also
4637     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4638     # keep them in the same order as there.
4639     (cd $SRC_ROOT && tar cf - \
4640         config.guess \
4641         bin/get_config_variables \
4642         solenv/bin/getcompver.awk \
4643         solenv/inc/langlist.mk \
4644         download.lst \
4645         config_host.mk.in \
4646         config_host_lang.mk.in \
4647         Makefile.in \
4648         bin/bffvalidator.sh.in \
4649         bin/odfvalidator.sh.in \
4650         bin/officeotron.sh.in \
4651         instsetoo_native/util/openoffice.lst.in \
4652         config_host/*.in \
4653         sysui/desktop/macosx/Info.plist.in) \
4654     | (cd CONF-FOR-BUILD && tar xf -)
4655     cp configure CONF-FOR-BUILD
4656     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4657     (
4658     unset COM USING_X11 OS CPUNAME
4659     unset CC CXX SYSBASE CFLAGS
4660     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4661     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4662     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4663     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4664     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4665     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4666     cd CONF-FOR-BUILD
4667     sub_conf_opts=""
4668     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4669     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4670     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4671     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4672     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4673     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4674     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4675     # Don't bother having configure look for stuff not needed for the build platform anyway
4676     ./configure \
4677         --disable-cups \
4678         --disable-gstreamer-1-0 \
4679         --disable-gstreamer-0-10 \
4680         --disable-gtk \
4681         --disable-gtk3 \
4682         --disable-pdfimport \
4683         --disable-postgresql-sdbc \
4684         --with-parallelism="$with_parallelism" \
4685         --without-doxygen \
4686         --without-java \
4687         $sub_conf_opts \
4688         --srcdir=$srcdir \
4689         2>&1 | sed -e 's/^/    /'
4690     test -f ./config_host.mk 2>/dev/null || exit
4691     cp config_host.mk ../config_build.mk
4692     cp config_host_lang.mk ../config_build_lang.mk
4693     mv config.log ../config.Build.log
4694     mkdir -p ../config_build
4695     mv config_host/*.h ../config_build
4696     . ./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
4698     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
4699         VV='$'$V
4700         VV=`eval "echo $VV"`
4701         if test -n "$VV"; then
4702             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4703             echo "$line" >>build-config
4704         fi
4705     done
4707     for V in INSTDIR INSTROOT WORKDIR; do
4708         VV='$'$V
4709         VV=`eval "echo $VV"`
4710         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4711         if test -n "$VV"; then
4712             line="${V}_FOR_BUILD='$VV'"
4713             echo "$line" >>build-config
4714         fi
4715     done
4717     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4718     echo "$line" >>build-config
4720     )
4721     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4722     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])
4723     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4724              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4726     eval `cat CONF-FOR-BUILD/build-config`
4728     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4730     rm -rf CONF-FOR-BUILD
4731 else
4732     OS_FOR_BUILD="$OS"
4733     CC_FOR_BUILD="$CC"
4734     CXX_FOR_BUILD="$CXX"
4735     INSTDIR_FOR_BUILD="$INSTDIR"
4736     INSTROOT_FOR_BUILD="$INSTROOT"
4737     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4738     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4739     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4740     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4741     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4742     WORKDIR_FOR_BUILD="$WORKDIR"
4744 AC_SUBST(OS_FOR_BUILD)
4745 AC_SUBST(INSTDIR_FOR_BUILD)
4746 AC_SUBST(INSTROOT_FOR_BUILD)
4747 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4748 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4749 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4750 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4751 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4752 AC_SUBST(WORKDIR_FOR_BUILD)
4754 dnl ===================================================================
4755 dnl Check for syslog header
4756 dnl ===================================================================
4757 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4759 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4760 dnl ===================================================================
4761 AC_MSG_CHECKING([whether to turn warnings to errors])
4762 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4763     ENABLE_WERROR="TRUE"
4764     AC_MSG_RESULT([yes])
4765 else
4766     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4767         ENABLE_WERROR="TRUE"
4768         AC_MSG_RESULT([yes])
4769     else
4770         AC_MSG_RESULT([no])
4771     fi
4773 AC_SUBST(ENABLE_WERROR)
4775 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4776 dnl ===================================================================
4777 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4778 if test -z "$enable_assert_always_abort"; then
4779    if test "$ENABLE_DEBUG" = TRUE; then
4780        enable_assert_always_abort=yes
4781    else
4782        enable_assert_always_abort=no
4783    fi
4785 if test "$enable_assert_always_abort" = "yes"; then
4786     ASSERT_ALWAYS_ABORT="TRUE"
4787     AC_MSG_RESULT([yes])
4788 else
4789     ASSERT_ALWAYS_ABORT="FALSE"
4790     AC_MSG_RESULT([no])
4792 AC_SUBST(ASSERT_ALWAYS_ABORT)
4794 # Determine whether to use ooenv for the instdir installation
4795 # ===================================================================
4796 if test $_os != "WINNT" -a $_os != "Darwin"; then
4797     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4798     if test "$enable_ooenv" = "no"; then
4799         AC_MSG_RESULT([no])
4800     else
4801         ENABLE_OOENV="TRUE"
4802         AC_MSG_RESULT([yes])
4803     fi
4805 AC_SUBST(ENABLE_OOENV)
4807 if test "$USING_X11" != TRUE; then
4808     # be sure to do not mess with unneeded stuff
4809     test_randr=no
4810     test_xrender=no
4811     test_cups=no
4812     test_dbus=no
4813     test_gtk=no
4814     build_gstreamer_1_0=no
4815     build_gstreamer_0_10=no
4816     test_kde5=no
4817     test_qt5=no
4818     test_gtk3_kde5=no
4819     enable_cairo_canvas=no
4822 if test "$OS" = "HAIKU"; then
4823     enable_cairo_canvas=yes
4824     test_kde5=yes
4827 if test "$test_kde5" = "yes"; then
4828     test_qt5=yes
4831 if test "$test_kde5" = "yes" -a  "$enable_kde5" = "yes"; then
4832     if test "$enable_qt5" = "no"; then
4833         AC_MSG_ERROR([KDE5 support depends on QT5, so it conflicts with --disable-qt5])
4834     else
4835         enable_qt5=yes
4836     fi
4839 dnl ===================================================================
4840 dnl check for cups support
4841 dnl ===================================================================
4842 ENABLE_CUPS=""
4844 if test "$enable_cups" = "no"; then
4845     test_cups=no
4848 AC_MSG_CHECKING([whether to enable CUPS support])
4849 if test "$test_cups" = "yes"; then
4850     ENABLE_CUPS="TRUE"
4851     AC_MSG_RESULT([yes])
4853     AC_MSG_CHECKING([whether cups support is present])
4854     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4855     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4856     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4857         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4858     fi
4860 else
4861     AC_MSG_RESULT([no])
4864 AC_SUBST(ENABLE_CUPS)
4866 # fontconfig checks
4867 if test "$test_fontconfig" = "yes"; then
4868     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4869     SYSTEM_FONTCONFIG=TRUE
4870     FilterLibs "${FONTCONFIG_LIBS}"
4871     FONTCONFIG_LIBS="${filteredlibs}"
4873 AC_SUBST(FONTCONFIG_CFLAGS)
4874 AC_SUBST(FONTCONFIG_LIBS)
4875 AC_SUBST([SYSTEM_FONTCONFIG])
4877 dnl whether to find & fetch external tarballs?
4878 dnl ===================================================================
4879 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4880    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4881        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4882    else
4883        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4884    fi
4886 if test -z "$TARFILE_LOCATION"; then
4887     if test -d "$SRC_ROOT/src" ; then
4888         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4889         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4890     fi
4891     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4892 else
4893     AbsolutePath "$TARFILE_LOCATION"
4894     PathFormat "${absolute_path}"
4895     TARFILE_LOCATION="${formatted_path}"
4897 AC_SUBST(TARFILE_LOCATION)
4899 AC_MSG_CHECKING([whether we want to fetch tarballs])
4900 if test "$enable_fetch_external" != "no"; then
4901     if test "$with_all_tarballs" = "yes"; then
4902         AC_MSG_RESULT([yes, all of them])
4903         DO_FETCH_TARBALLS="ALL"
4904     else
4905         AC_MSG_RESULT([yes, if we use them])
4906         DO_FETCH_TARBALLS="TRUE"
4907     fi
4908 else
4909     AC_MSG_RESULT([no])
4910     DO_FETCH_TARBALLS=
4912 AC_SUBST(DO_FETCH_TARBALLS)
4914 AC_MSG_CHECKING([whether to build help])
4915 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4916     BUILD_TYPE="$BUILD_TYPE HELP"
4917     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4918     case "$with_help" in
4919     "html")
4920         ENABLE_HTMLHELP=TRUE
4921         SCPDEFS="$SCPDEFS -DWITH_HELP"
4922         AC_MSG_RESULT([HTML])
4923         ;;
4924     "online")
4925         ENABLE_HTMLHELP=TRUE
4926         HELP_ONLINE=TRUE
4927         AC_MSG_RESULT([HTML])
4928         ;;
4929     yes)
4930         SCPDEFS="$SCPDEFS -DWITH_HELP"
4931         AC_MSG_RESULT([yes])
4932         ;;
4933     *)
4934         AC_MSG_ERROR([Unknown --with-help=$with_help])
4935         ;;
4936     esac
4937 else
4938     AC_MSG_RESULT([no])
4940 AC_SUBST([ENABLE_HTMLHELP])
4941 AC_SUBST([HELP_ONLINE])
4943 dnl Test whether to include MySpell dictionaries
4944 dnl ===================================================================
4945 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4946 if test "$with_myspell_dicts" = "yes"; then
4947     AC_MSG_RESULT([yes])
4948     WITH_MYSPELL_DICTS=TRUE
4949     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4950     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4951 else
4952     AC_MSG_RESULT([no])
4953     WITH_MYSPELL_DICTS=
4955 AC_SUBST(WITH_MYSPELL_DICTS)
4957 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
4958 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4959     if test "$with_system_dicts" = yes; then
4960         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4961     fi
4962     with_system_dicts=no
4965 AC_MSG_CHECKING([whether to use dicts from external paths])
4966 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4967     AC_MSG_RESULT([yes])
4968     SYSTEM_DICTS=TRUE
4969     AC_MSG_CHECKING([for spelling dictionary directory])
4970     if test -n "$with_external_dict_dir"; then
4971         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4972     else
4973         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4974         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4975             DICT_SYSTEM_DIR=file:///usr/share/myspell
4976         fi
4977     fi
4978     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4979     AC_MSG_CHECKING([for hyphenation patterns directory])
4980     if test -n "$with_external_hyph_dir"; then
4981         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4982     else
4983         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4984     fi
4985     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4986     AC_MSG_CHECKING([for thesaurus directory])
4987     if test -n "$with_external_thes_dir"; then
4988         THES_SYSTEM_DIR=file://$with_external_thes_dir
4989     else
4990         THES_SYSTEM_DIR=file:///usr/share/mythes
4991     fi
4992     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4993 else
4994     AC_MSG_RESULT([no])
4995     SYSTEM_DICTS=
4997 AC_SUBST(SYSTEM_DICTS)
4998 AC_SUBST(DICT_SYSTEM_DIR)
4999 AC_SUBST(HYPH_SYSTEM_DIR)
5000 AC_SUBST(THES_SYSTEM_DIR)
5002 dnl ===================================================================
5003 dnl enable pch by default on windows
5004 dnl enable it explicitly otherwise
5005 ENABLE_PCH=""
5006 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
5007     if test -z "$libo_fuzzed_enable_pch"; then
5008         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
5009     else
5010         AC_MSG_NOTICE([Resetting --enable-pch=no])
5011         enable_pch=no
5012     fi
5015 AC_MSG_CHECKING([whether to enable pch feature])
5016 if test "$enable_pch" != "no"; then
5017     if test "$_os" = "WINNT"; then
5018         ENABLE_PCH="TRUE"
5019         AC_MSG_RESULT([yes])
5020     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
5021         ENABLE_PCH="TRUE"
5022         AC_MSG_RESULT([yes])
5023     elif test -n "$enable_pch"; then
5024         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5025     else
5026         AC_MSG_RESULT([no])
5027     fi
5028 else
5029     AC_MSG_RESULT([no])
5031 AC_SUBST(ENABLE_PCH)
5033 TAB=`printf '\t'`
5035 AC_MSG_CHECKING([the GNU Make version])
5036 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5037 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5038 if test "$_make_longver" -ge "038200"; then
5039     AC_MSG_RESULT([$GNUMAKE $_make_version])
5041 elif test "$_make_longver" -ge "038100"; then
5042     if test "$build_os" = "cygwin"; then
5043         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5044     fi
5045     AC_MSG_RESULT([$GNUMAKE $_make_version])
5047     dnl ===================================================================
5048     dnl Search all the common names for sha1sum
5049     dnl ===================================================================
5050     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5051     if test -z "$SHA1SUM"; then
5052         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5053     elif test "$SHA1SUM" = "openssl"; then
5054         SHA1SUM="openssl sha1"
5055     fi
5056     AC_MSG_CHECKING([for GNU Make bug 20033])
5057     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5058     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5059 A := \$(wildcard *.a)
5061 .PHONY: all
5062 all: \$(A:.a=.b)
5063 <TAB>@echo survived bug20033.
5065 .PHONY: setup
5066 setup:
5067 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5069 define d1
5070 @echo lala \$(1)
5071 @sleep 1
5072 endef
5074 define d2
5075 @echo tyty \$(1)
5076 @sleep 1
5077 endef
5079 %.b : %.a
5080 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5081 <TAB>\$(call d1,\$(CHECKSUM)),\
5082 <TAB>\$(call d2,\$(CHECKSUM)))
5084     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5085         no_parallelism_make="YES"
5086         AC_MSG_RESULT([yes, disable parallelism])
5087     else
5088         AC_MSG_RESULT([no, keep parallelism enabled])
5089     fi
5090     rm -rf $TESTGMAKEBUG20033
5091 else
5092     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5095 # find if gnumake support file function
5096 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5097 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5098 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5099     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5101 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5102 \$(file >test.txt,Success )
5104 .PHONY: all
5105 all:
5106 <TAB>@cat test.txt
5109 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5110 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5111     HAVE_GNUMAKE_FILE_FUNC=TRUE
5112     AC_MSG_RESULT([yes])
5113 else
5114     AC_MSG_RESULT([no])
5116 rm -rf $TESTGMAKEFILEFUNC
5117 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5118 AC_SUBST(GNUMAKE_WIN_NATIVE)
5120 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5121 STALE_MAKE=
5122 if test "$_make_ver_check" = ""; then
5123    STALE_MAKE=TRUE
5126 HAVE_LD_HASH_STYLE=FALSE
5127 WITH_LINKER_HASH_STYLE=
5128 AC_MSG_CHECKING([for --hash-style gcc linker support])
5129 if test "$GCC" = "yes"; then
5130     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5131         hash_styles="gnu sysv"
5132     elif test "$with_linker_hash_style" = "no"; then
5133         hash_styles=
5134     else
5135         hash_styles="$with_linker_hash_style"
5136     fi
5138     for hash_style in $hash_styles; do
5139         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5140         hash_style_ldflags_save=$LDFLAGS
5141         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5143         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5144             [
5145 #include <stdio.h>
5146             ],[
5147 printf ("");
5148             ])],
5149             [
5150                   HAVE_LD_HASH_STYLE=TRUE
5151                   WITH_LINKER_HASH_STYLE=$hash_style
5152             ],
5153             [HAVE_LD_HASH_STYLE=FALSE],
5154             [HAVE_LD_HASH_STYLE=FALSE])
5155         LDFLAGS=$hash_style_ldflags_save
5156     done
5158     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5159         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5160     else
5161         AC_MSG_RESULT( no )
5162     fi
5163     LDFLAGS=$hash_style_ldflags_save
5164 else
5165     AC_MSG_RESULT( no )
5167 AC_SUBST(HAVE_LD_HASH_STYLE)
5168 AC_SUBST(WITH_LINKER_HASH_STYLE)
5170 dnl ===================================================================
5171 dnl Check whether there's a Perl version available.
5172 dnl ===================================================================
5173 if test -z "$with_perl_home"; then
5174     AC_PATH_PROG(PERL, perl)
5175 else
5176     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5177     _perl_path="$with_perl_home/bin/perl"
5178     if test -x "$_perl_path"; then
5179         PERL=$_perl_path
5180     else
5181         AC_MSG_ERROR([$_perl_path not found])
5182     fi
5185 dnl ===================================================================
5186 dnl Testing for Perl version 5 or greater.
5187 dnl $] is the Perl version variable, it is returned as an integer
5188 dnl ===================================================================
5189 if test "$PERL"; then
5190     AC_MSG_CHECKING([the Perl version])
5191     ${PERL} -e "exit($]);"
5192     _perl_version=$?
5193     if test "$_perl_version" -lt 5; then
5194         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5195     fi
5196     AC_MSG_RESULT([Perl $_perl_version])
5197 else
5198     AC_MSG_ERROR([Perl not found, install Perl 5])
5201 dnl ===================================================================
5202 dnl Testing for required Perl modules
5203 dnl ===================================================================
5205 AC_MSG_CHECKING([for required Perl modules])
5206 perl_use_string="use Cwd ; use Digest::MD5"
5207 if test "$_os" = "WINNT"; then
5208     if test -n "$PKGFORMAT"; then
5209         for i in $PKGFORMAT; do
5210             case "$i" in
5211             msi)
5212                 # for getting fonts versions to use in MSI
5213                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5214                 ;;
5215             esac
5216         done
5217     fi
5219 if test "$with_system_hsqldb" = "yes"; then
5220         perl_use_string="$perl_use_string ; use Archive::Zip"
5222 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5223     AC_MSG_RESULT([all modules found])
5224 else
5225     AC_MSG_RESULT([failed to find some modules])
5226     # Find out which modules are missing.
5227     for i in $perl_use_string; do
5228         if test "$i" != "use" -a "$i" != ";"; then
5229             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5230                 missing_perl_modules="$missing_perl_modules $i"
5231             fi
5232         fi
5233     done
5234     AC_MSG_ERROR([
5235     The missing Perl modules are: $missing_perl_modules
5236     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5239 dnl ===================================================================
5240 dnl Check for pkg-config
5241 dnl ===================================================================
5242 if test "$_os" != "WINNT"; then
5243     PKG_PROG_PKG_CONFIG
5246 if test "$_os" != "WINNT"; then
5248     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5249     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5250     # explicitly. Or put /path/to/compiler in PATH yourself.
5252     # Use wrappers for LTO
5253     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5254         AC_CHECK_TOOL(AR,gcc-ar)
5255         AC_CHECK_TOOL(NM,gcc-nm)
5256         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5257     else
5258         AC_CHECK_TOOL(AR,ar)
5259         AC_CHECK_TOOL(NM,nm)
5260         AC_CHECK_TOOL(RANLIB,ranlib)
5261     fi
5262     AC_CHECK_TOOL(OBJDUMP,objdump)
5263     AC_CHECK_TOOL(READELF,readelf)
5264     AC_CHECK_TOOL(STRIP,strip)
5265     if test "$_os" = "WINNT"; then
5266         AC_CHECK_TOOL(DLLTOOL,dlltool)
5267         AC_CHECK_TOOL(WINDRES,windres)
5268     fi
5270 AC_SUBST(AR)
5271 AC_SUBST(DLLTOOL)
5272 AC_SUBST(NM)
5273 AC_SUBST(OBJDUMP)
5274 AC_SUBST(PKG_CONFIG)
5275 AC_SUBST(RANLIB)
5276 AC_SUBST(READELF)
5277 AC_SUBST(STRIP)
5278 AC_SUBST(WINDRES)
5280 dnl ===================================================================
5281 dnl pkg-config checks on macOS
5282 dnl ===================================================================
5284 if test $_os = Darwin; then
5285     AC_MSG_CHECKING([for bogus pkg-config])
5286     if test -n "$PKG_CONFIG"; then
5287         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5288             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5289         else
5290             if test "$enable_bogus_pkg_config" = "yes"; then
5291                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5292             else
5293                 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.])
5294             fi
5295         fi
5296     else
5297         AC_MSG_RESULT([no, good])
5298     fi
5301 find_csc()
5303     # Return value: $csctest
5305     unset csctest
5307     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5308     if test -n "$regvalue"; then
5309         csctest=$regvalue
5310         return
5311     fi
5314 find_al()
5316     # Return value: $altest
5318     unset altest
5320     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5321         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5322         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5323             altest=$regvalue
5324             return
5325         fi
5326     done
5328     # We need this additional check to detect 4.6.1 or above.
5329     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5330         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5331         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5332             altest=$regvalue
5333             return
5334         fi
5336         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5337         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5338             altest=$regvalue
5339             return
5340         fi
5341     done
5344 find_dotnetsdk46()
5346     unset frametest
5348     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5349         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5350         if test -n "$regvalue"; then
5351             frametest=$regvalue
5352             return
5353         fi
5354         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5355         if test -n "$regvalue"; then
5356             frametest=$regvalue
5357             return
5358         fi
5359     done
5362 find_winsdk_version()
5364     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5365     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5367     unset winsdktest winsdkbinsubdir winsdklibsubdir
5369     case "$1" in
5370     7.*)
5371         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5372         if test -n "$regvalue"; then
5373             winsdktest=$regvalue
5374             winsdklibsubdir=.
5375             return
5376         fi
5377         ;;
5378     8.0|8.0A)
5379         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5380         if test -n "$regvalue"; then
5381             winsdktest=$regvalue
5382             winsdklibsubdir=win8
5383             return
5384         fi
5385         ;;
5386     8.1|8.1A)
5387         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5388         if test -n "$regvalue"; then
5389             winsdktest=$regvalue
5390             winsdklibsubdir=winv6.3
5391             return
5392         fi
5393         ;;
5394     10.0)
5395         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5396         if test -n "$regvalue"; then
5397             winsdktest=$regvalue
5398             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5399             if test -n "$regvalue"; then
5400                 winsdkbinsubdir="$regvalue".0
5401                 winsdklibsubdir=$winsdkbinsubdir
5402                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5403                 # test exist the SDK path
5404                 if test -d "$tmppath"; then
5405                    # when path is convertible to a short path then path is okay
5406                    if ! cygpath -d "$tmppath"; then
5407                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5408                    fi
5409                 else
5410                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5411                 fi
5412             fi
5413             return
5414         fi
5415         ;;
5416     esac
5419 find_winsdk()
5421     # Return value: From find_winsdk_version
5423     unset winsdktest
5425     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5426         find_winsdk_version $ver
5427         if test -n "$winsdktest"; then
5428             return
5429         fi
5430     done
5433 find_msms()
5435     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5436     if test $VCVER = 150; then
5437         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5438     fi
5439     AC_MSG_CHECKING([for ${my_msm_files}])
5440     msmdir=
5441     for ver in 14.0 15.0; do
5442         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5443         if test -n "$regvalue"; then
5444             for f in ${my_msm_files}; do
5445                 if test -e "$regvalue/${f}"; then
5446                     msmdir=$regvalue
5447                     break
5448                 fi
5449             done
5450         fi
5451     done
5452     dnl Is the following fallback really necessary, or was it added in response
5453     dnl to never having started Visual Studio on a given machine, so the
5454     dnl registry keys checked above had presumably not yet been created?
5455     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5456     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5457     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5458     dnl expanding to "C:\Program Files\Common Files"), which would need
5459     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5460     dnl obtain its value from cygwin:
5461     if test -z "$msmdir"; then
5462         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5463         for f in ${my_msm_files}; do
5464             if test -e "$my_msm_dir/${f}"; then
5465                 msmdir=$my_msm_dir
5466             fi
5467         done
5468     fi
5470     dnl Starting from MSVC 15.0, merge modules are located in different directory
5471     if test $VCVER = 150; then
5472         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5473             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5474             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5475             for f in ${my_msm_files}; do
5476                 if test -e "$my_msm_dir/${f}"; then
5477                     msmdir=$my_msm_dir
5478                     break
5479                 fi
5480             done
5481         done
5482     fi
5484     if test -n "$msmdir"; then
5485         msmdir=`cygpath -m "$msmdir"`
5486         AC_MSG_RESULT([$msmdir])
5487     else
5488         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5489             AC_MSG_ERROR([not found])
5490         else
5491             AC_MSG_WARN([not found])
5492             add_warning "MSM none of ${my_msm_files} found"
5493         fi
5494     fi
5497 find_msvc_x64_dlls()
5499     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5500     if test "$VCVER" = 150; then
5501         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5502             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5503             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5504                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5505                 break
5506             fi
5507             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5508                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5509                 break
5510             fi
5511         done
5512     fi
5513     msvcdlls="msvcp140.dll vcruntime140.dll"
5514     for dll in $msvcdlls; do
5515         if ! test -f "$msvcdllpath/$dll"; then
5516             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5517         fi
5518     done
5521 dnl =========================================
5522 dnl Check for the Windows  SDK.
5523 dnl =========================================
5524 if test "$_os" = "WINNT"; then
5525     AC_MSG_CHECKING([for Windows SDK])
5526     if test "$build_os" = "cygwin"; then
5527         find_winsdk
5528         WINDOWS_SDK_HOME=$winsdktest
5530         # normalize if found
5531         if test -n "$WINDOWS_SDK_HOME"; then
5532             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5533             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5534         fi
5536         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5537     fi
5539     if test -n "$WINDOWS_SDK_HOME"; then
5540         # Remove a possible trailing backslash
5541         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5543         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5544              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5545              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5546             have_windows_sdk_headers=yes
5547         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5548              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5549              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5550             have_windows_sdk_headers=yes
5551         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5552              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5553              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5554             have_windows_sdk_headers=yes
5555         else
5556             have_windows_sdk_headers=no
5557         fi
5559         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5560             have_windows_sdk_libs=yes
5561         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5562             have_windows_sdk_libs=yes
5563         else
5564             have_windows_sdk_libs=no
5565         fi
5567         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5568             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5569 the  Windows SDK are installed.])
5570         fi
5571     fi
5573     if test -z "$WINDOWS_SDK_HOME"; then
5574         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5575     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5576         WINDOWS_SDK_VERSION=70
5577         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5578     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5579         WINDOWS_SDK_VERSION=80
5580         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5581     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5582         WINDOWS_SDK_VERSION=81
5583         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5584     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5585         WINDOWS_SDK_VERSION=10
5586         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5587     else
5588         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5589     fi
5590     PathFormat "$WINDOWS_SDK_HOME"
5591     WINDOWS_SDK_HOME="$formatted_path"
5592     if test "$build_os" = "cygwin"; then
5593         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5594         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5595             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5596         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5597             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5598         fi
5599     fi
5601     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5602     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5603     dnl but not in v8.0), so allow this to be overridden with a
5604     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5605     dnl and configuration error if no WiLangId.vbs is found would arguably be
5606     dnl better, but I do not know under which conditions exactly it is needed by
5607     dnl msiglobal.pm:
5608     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5609         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5610         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5611             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5612         fi
5613         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5614             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5615         fi
5616         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5617             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5618         fi
5619     fi
5620     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5621         if test -n "$with_package_format" -a "$with_package_format" != no; then
5622             for i in "$with_package_format"; do
5623                 if test "$i" = "msi"; then
5624                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5625                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5626                     fi
5627                 fi
5628             done
5629         fi
5630     fi
5632 AC_SUBST(WINDOWS_SDK_HOME)
5633 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5634 AC_SUBST(WINDOWS_SDK_VERSION)
5635 AC_SUBST(WINDOWS_SDK_WILANGID)
5637 if test "$build_os" = "cygwin"; then
5638     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5639     dnl dir, it also determines that dir's path w/o an arch segment if any,
5640     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5641     AC_MSG_CHECKING([for midl.exe])
5643     find_winsdk
5644     if test -n "$winsdkbinsubdir" \
5645         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5646     then
5647         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5648         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5649     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5650         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5651         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5652     elif test -f "$winsdktest/Bin/midl.exe"; then
5653         MIDL_PATH=$winsdktest/Bin
5654         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5655     fi
5656     if test ! -f "$MIDL_PATH/midl.exe"; then
5657         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5658     else
5659         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5660     fi
5662     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5663     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5665     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5666          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5667          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5668          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5669     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5670          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5671          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5672          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5673     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5674          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5675          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5676          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5677     else
5678         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5679     fi
5681     dnl Check csc.exe
5682     AC_MSG_CHECKING([for csc.exe])
5683     find_csc
5684     if test -f "$csctest/csc.exe"; then
5685         CSC_PATH="$csctest"
5686     fi
5687     if test ! -f "$CSC_PATH/csc.exe"; then
5688         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5689     else
5690         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5691     fi
5693     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5695     dnl Check al.exe
5696     AC_MSG_CHECKING([for al.exe])
5697     find_winsdk
5698     if test -n "$winsdkbinsubdir" \
5699         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5700     then
5701         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5702     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5703         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5704     elif test -f "$winsdktest/Bin/al.exe"; then
5705         AL_PATH="$winsdktest/Bin"
5706     fi
5708     if test -z "$AL_PATH"; then
5709         find_al
5710         if test -f "$altest/bin/al.exe"; then
5711             AL_PATH="$altest/bin"
5712         elif test -f "$altest/al.exe"; then
5713             AL_PATH="$altest"
5714         fi
5715     fi
5716     if test ! -f "$AL_PATH/al.exe"; then
5717         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5718     else
5719         AC_MSG_RESULT([$AL_PATH/al.exe])
5720     fi
5722     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5724     dnl Check mscoree.lib / .NET Framework dir
5725     AC_MSG_CHECKING(.NET Framework)
5726     find_dotnetsdk46
5727     PathFormat "$frametest"
5728     frametest="$formatted_path"
5729     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5730         DOTNET_FRAMEWORK_HOME="$frametest"
5731     else
5732         find_winsdk
5733         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5734             DOTNET_FRAMEWORK_HOME="$winsdktest"
5735         fi
5736     fi
5737     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
5738         AC_MSG_ERROR([mscoree.lib not found])
5739     fi
5740     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5742     PathFormat "$MIDL_PATH"
5743     MIDL_PATH="$formatted_path"
5745     PathFormat "$AL_PATH"
5746     AL_PATH="$formatted_path"
5748     PathFormat "$DOTNET_FRAMEWORK_HOME"
5749     DOTNET_FRAMEWORK_HOME="$formatted_path"
5751     PathFormat "$CSC_PATH"
5752     CSC_PATH="$formatted_path"
5755 dnl ===================================================================
5756 dnl Check if stdc headers are available excluding MSVC.
5757 dnl ===================================================================
5758 if test "$_os" != "WINNT"; then
5759     AC_HEADER_STDC
5762 dnl ===================================================================
5763 dnl Testing for C++ compiler and version...
5764 dnl ===================================================================
5766 if test "$_os" != "WINNT"; then
5767     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5768     save_CXXFLAGS=$CXXFLAGS
5769     AC_PROG_CXX
5770     CXXFLAGS=$save_CXXFLAGS
5771 else
5772     if test -n "$CC" -a -z "$CXX"; then
5773         CXX="$CC"
5774     fi
5777 dnl check for GNU C++ compiler version
5778 if test "$GXX" = "yes"; then
5779     AC_MSG_CHECKING([the GNU C++ compiler version])
5781     _gpp_version=`$CXX -dumpversion`
5782     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5784     if test "$_gpp_majmin" -lt "401"; then
5785         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5786     else
5787         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5788     fi
5790     dnl see https://code.google.com/p/android/issues/detail?id=41770
5791     if test "$_gpp_majmin" -ge "401"; then
5792         glibcxx_threads=no
5793         AC_LANG_PUSH([C++])
5794         AC_REQUIRE_CPP
5795         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5796         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5797             #include <bits/c++config.h>]],[[
5798             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5799             && !defined(_GLIBCXX__PTHREADS) \
5800             && !defined(_GLIBCXX_HAS_GTHREADS)
5801             choke me
5802             #endif
5803         ]])],[AC_MSG_RESULT([yes])
5804         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5805         AC_LANG_POP([C++])
5806         if test $glibcxx_threads = yes; then
5807             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5808         fi
5809      fi
5811 AC_SUBST(BOOST_CXXFLAGS)
5814 # prefx CXX with ccache if needed
5816 if test "$CCACHE" != ""; then
5817     AC_MSG_CHECKING([whether $CXX is already ccached])
5818     AC_LANG_PUSH([C++])
5819     save_CXXFLAGS=$CXXFLAGS
5820     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5821     dnl an empty program will do, we're checking the compiler flags
5822     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5823                       [use_ccache=yes], [use_ccache=no])
5824     if test $use_ccache = yes; then
5825         AC_MSG_RESULT([yes])
5826     else
5827         CXX="$CCACHE $CXX"
5828         AC_MSG_RESULT([no])
5829     fi
5830     CXXFLAGS=$save_CXXFLAGS
5831     AC_LANG_POP([C++])
5834 dnl ===================================================================
5835 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5836 dnl ===================================================================
5838 if test "$_os" != "WINNT"; then
5839     AC_PROG_CXXCPP
5841     dnl Check whether there's a C pre-processor.
5842     AC_PROG_CPP
5846 dnl ===================================================================
5847 dnl Find integral type sizes and alignments
5848 dnl ===================================================================
5850 if test "$_os" != "WINNT"; then
5852 if test "$_os" == "iOS"; then
5853     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5854     ac_cv_sizeof_long=8
5855     ac_cv_sizeof_short=2
5856     ac_cv_sizeof_int=4
5857     ac_cv_sizeof_long_long=8
5858     ac_cv_sizeof_double=8
5859     ac_cv_sizeof_voidp=8
5860 else
5861     AC_CHECK_SIZEOF(long)
5862     AC_CHECK_SIZEOF(short)
5863     AC_CHECK_SIZEOF(int)
5864     AC_CHECK_SIZEOF(long long)
5865     AC_CHECK_SIZEOF(double)
5866     AC_CHECK_SIZEOF(void*)
5869     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5870     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5871     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5872     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5873     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5875     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5876     m4_pattern_allow([AC_CHECK_ALIGNOF])
5877     m4_ifdef([AC_CHECK_ALIGNOF],
5878         [
5879             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5880             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5881             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5882             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5883         ],
5884         [
5885             case "$_os-$host_cpu" in
5886             Linux-i686)
5887                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5888                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5889                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5890                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5891                 ;;
5892             Linux-x86_64)
5893                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5894                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5895                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5896                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5897                 ;;
5898             *)
5899                 if test -z "$ac_cv_alignof_short" -o \
5900                         -z "$ac_cv_alignof_int" -o \
5901                         -z "$ac_cv_alignof_long" -o \
5902                         -z "$ac_cv_alignof_double"; then
5903                    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.])
5904                 fi
5905                 ;;
5906             esac
5907         ])
5909     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5910     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5911     if test $ac_cv_sizeof_long -eq 8; then
5912         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5913     elif test $ac_cv_sizeof_double -eq 8; then
5914         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5915     else
5916         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5917     fi
5919     dnl Check for large file support
5920     AC_SYS_LARGEFILE
5921     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5922         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5923     fi
5924     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5925         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5926     fi
5927 else
5928     # Hardcode for MSVC
5929     SAL_TYPES_SIZEOFSHORT=2
5930     SAL_TYPES_SIZEOFINT=4
5931     SAL_TYPES_SIZEOFLONG=4
5932     SAL_TYPES_SIZEOFLONGLONG=8
5933     if test "$BITNESS_OVERRIDE" = ""; then
5934         SAL_TYPES_SIZEOFPOINTER=4
5935     else
5936         SAL_TYPES_SIZEOFPOINTER=8
5937     fi
5938     SAL_TYPES_ALIGNMENT2=2
5939     SAL_TYPES_ALIGNMENT4=4
5940     SAL_TYPES_ALIGNMENT8=8
5941     LFS_CFLAGS=''
5943 AC_SUBST(LFS_CFLAGS)
5945 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5946 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5947 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5948 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5949 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5950 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5951 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5952 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5954 dnl ===================================================================
5955 dnl Check whether to enable runtime optimizations
5956 dnl ===================================================================
5957 ENABLE_RUNTIME_OPTIMIZATIONS=
5958 AC_MSG_CHECKING([whether to enable runtime optimizations])
5959 if test -z "$enable_runtime_optimizations"; then
5960     for i in $CC; do
5961         case $i in
5962         -fsanitize=*)
5963             enable_runtime_optimizations=no
5964             break
5965             ;;
5966         esac
5967     done
5969 if test "$enable_runtime_optimizations" != no; then
5970     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5971     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5972     AC_MSG_RESULT([yes])
5973 else
5974     AC_MSG_RESULT([no])
5976 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5978 dnl ===================================================================
5979 dnl Check if valgrind headers are available
5980 dnl ===================================================================
5981 ENABLE_VALGRIND=
5982 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5983     prev_cppflags=$CPPFLAGS
5984     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5985     # or where does it come from?
5986     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5987     AC_CHECK_HEADER([valgrind/valgrind.h],
5988         [ENABLE_VALGRIND=TRUE])
5989     CPPFLAGS=$prev_cppflags
5991 AC_SUBST([ENABLE_VALGRIND])
5992 if test -z "$ENABLE_VALGRIND"; then
5993     if test "$with_valgrind" = yes; then
5994         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5995     fi
5996     VALGRIND_CFLAGS=
5998 AC_SUBST([VALGRIND_CFLAGS])
6001 dnl ===================================================================
6002 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6003 dnl ===================================================================
6005 # We need at least the sys/sdt.h include header.
6006 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6007 if test "$SDT_H_FOUND" = "TRUE"; then
6008     # Found sys/sdt.h header, now make sure the c++ compiler works.
6009     # Old g++ versions had problems with probes in constructors/destructors.
6010     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6011     AC_LANG_PUSH([C++])
6012     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6013     #include <sys/sdt.h>
6014     class ProbeClass
6015     {
6016     private:
6017       int& ref;
6018       const char *name;
6020     public:
6021       ProbeClass(int& v, const char *n) : ref(v), name(n)
6022       {
6023         DTRACE_PROBE2(_test_, cons, name, ref);
6024       }
6026       void method(int min)
6027       {
6028         DTRACE_PROBE3(_test_, meth, name, ref, min);
6029         ref -= min;
6030       }
6032       ~ProbeClass()
6033       {
6034         DTRACE_PROBE2(_test_, dest, name, ref);
6035       }
6036     };
6037     ]],[[
6038     int i = 64;
6039     DTRACE_PROBE1(_test_, call, i);
6040     ProbeClass inst = ProbeClass(i, "call");
6041     inst.method(24);
6042     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6043           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6044     AC_LANG_POP([C++])
6046 AC_CONFIG_HEADERS([config_host/config_probes.h])
6048 dnl ===================================================================
6049 dnl GCC features
6050 dnl ===================================================================
6051 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6052     AC_MSG_CHECKING([whether $CC supports -mno-avx])
6053     save_CFLAGS=$CFLAGS
6054     CFLAGS="$CFLAGS -Werror -mno-avx"
6055     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6056     CFLAGS=$save_CFLAGS
6057     if test "$HAVE_GCC_AVX" = "TRUE"; then
6058         AC_MSG_RESULT([yes])
6059     else
6060         AC_MSG_RESULT([no])
6061     fi
6063     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
6064     save_CFLAGS=$CFLAGS
6065     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
6066     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
6067     CFLAGS=$save_CFLAGS
6068     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
6069         AC_MSG_RESULT([yes])
6070     else
6071         AC_MSG_RESULT([no])
6072     fi
6074     AC_MSG_CHECKING([whether $CC supports atomic functions])
6075     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6076     int v = 0;
6077     if (__sync_add_and_fetch(&v, 1) != 1 ||
6078         __sync_sub_and_fetch(&v, 1) != 0)
6079         return 1;
6080     __sync_synchronize();
6081     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6082         v != 1)
6083         return 1;
6084     return 0;
6085 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6086     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6087         AC_MSG_RESULT([yes])
6088         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6089     else
6090         AC_MSG_RESULT([no])
6091     fi
6093     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
6094     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6095     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6096         AC_MSG_RESULT([yes])
6097         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6098     else
6099         AC_MSG_RESULT([no])
6100     fi
6102     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6103     save_CFLAGS=$CFLAGS
6104     CFLAGS="$CFLAGS -Werror"
6105     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6106             __attribute__((deprecated("test"))) void f();
6107         ])], [
6108             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6109             AC_MSG_RESULT([yes])
6110         ], [AC_MSG_RESULT([no])])
6111     CFLAGS=$save_CFLAGS
6113     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
6114     AC_LANG_PUSH([C++])
6115     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6116             #include <cstddef>
6117             #include <cxxabi.h>
6118             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6119         ])], [
6120             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6121             AC_MSG_RESULT([yes])
6122         ], [AC_MSG_RESULT([no])])
6123     AC_LANG_POP([C++])
6125     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
6126     AC_LANG_PUSH([C++])
6127     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6128             #include <cstddef>
6129             #include <cxxabi.h>
6130             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6131         ])], [
6132             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6133             AC_MSG_RESULT([yes])
6134         ], [AC_MSG_RESULT([no])])
6135     AC_LANG_POP([C++])
6137     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6138     AC_LANG_PUSH([C++])
6139     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6140             #include <cxxabi.h>
6141             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6142         ])], [
6143             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6144             AC_MSG_RESULT([yes])
6145         ], [AC_MSG_RESULT([no])])
6146     AC_LANG_POP([C++])
6148     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6149     AC_LANG_PUSH([C++])
6150     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6151             #include <cstddef>
6152             #include <cxxabi.h>
6153             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6154         ])], [
6155             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6156             AC_MSG_RESULT([yes])
6157         ], [AC_MSG_RESULT([no])])
6158     AC_LANG_POP([C++])
6160     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6161     AC_LANG_PUSH([C++])
6162     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6163             #include <cstddef>
6164             #include <cxxabi.h>
6165             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6166         ])], [
6167             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6168             AC_MSG_RESULT([yes])
6169         ], [AC_MSG_RESULT([no])])
6170     AC_LANG_POP([C++])
6172     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6173     AC_LANG_PUSH([C++])
6174     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6175             #include <cxxabi.h>
6176             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6177         ])], [
6178             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6179             AC_MSG_RESULT([yes])
6180         ], [AC_MSG_RESULT([no])])
6181     AC_LANG_POP([C++])
6183     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6184     AC_LANG_PUSH([C++])
6185     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6186             #include <cxxabi.h>
6187             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6188         ])], [
6189             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6190             AC_MSG_RESULT([yes])
6191         ], [AC_MSG_RESULT([no])])
6192     AC_LANG_POP([C++])
6194     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6195     AC_LANG_PUSH([C++])
6196     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6197             #include <cxxabi.h>
6198             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6199         ])], [
6200             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6201             AC_MSG_RESULT([yes])
6202         ], [AC_MSG_RESULT([no])])
6203     AC_LANG_POP([C++])
6205     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6206     AC_LANG_PUSH([C++])
6207     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6208             #include <cstddef>
6209             #include <cxxabi.h>
6210             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6211         ])], [
6212             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6213             AC_MSG_RESULT([yes])
6214         ], [AC_MSG_RESULT([no])])
6215     AC_LANG_POP([C++])
6217     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6218     AC_LANG_PUSH([C++])
6219     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6220             #include <cstddef>
6221             #include <cxxabi.h>
6222             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6223         ])], [
6224             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6225             AC_MSG_RESULT([yes])
6226         ], [AC_MSG_RESULT([no])])
6227     AC_LANG_POP([C++])
6229     dnl Available in GCC 4.9 and at least since Clang 3.4:
6230     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6231     AC_LANG_PUSH([C++])
6232     save_CXXFLAGS=$CXXFLAGS
6233     CXXFLAGS="$CXXFLAGS -Werror"
6234     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6235             struct __attribute__((warn_unused)) dummy {};
6236         ])], [
6237             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6238             AC_MSG_RESULT([yes])
6239         ], [AC_MSG_RESULT([no])])
6240     CXXFLAGS=$save_CXXFLAGS
6241 AC_LANG_POP([C++])
6244 AC_SUBST(HAVE_GCC_AVX)
6245 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6246 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6247 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6249 dnl ===================================================================
6250 dnl Identify the C++ library
6251 dnl ===================================================================
6253 AC_MSG_CHECKING([what the C++ library is])
6254 AC_LANG_PUSH([C++])
6255 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6256 #include <utility>
6257 #ifndef __GLIBCXX__
6258 foo bar
6259 #endif
6260 ]])],
6261     [CPP_LIBRARY=GLIBCXX
6262      cpp_library_name="GNU libstdc++"
6263     ],
6264     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6265 #include <utility>
6266 #ifndef _LIBCPP_VERSION
6267 foo bar
6268 #endif
6269 ]])],
6270     [CPP_LIBRARY=LIBCPP
6271      cpp_library_name="LLVM libc++"
6272      AC_DEFINE([HAVE_LIBCXX])
6273     ],
6274     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6275 #include <utility>
6276 #ifndef _MSC_VER
6277 foo bar
6278 #endif
6279 ]])],
6280     [CPP_LIBRARY=MSVCRT
6281      cpp_library_name="Microsoft"
6282     ],
6283     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6284 AC_MSG_RESULT([$cpp_library_name])
6285 AC_LANG_POP([C++])
6287 dnl ===================================================================
6288 dnl Check for gperf
6289 dnl ===================================================================
6290 AC_PATH_PROG(GPERF, gperf)
6291 if test -z "$GPERF"; then
6292     AC_MSG_ERROR([gperf not found but needed. Install it.])
6294 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6295     GPERF=`cygpath -m $GPERF`
6297 AC_MSG_CHECKING([whether gperf is new enough])
6298 my_gperf_ver1=$($GPERF --version | head -n 1)
6299 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6300 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6301 if test "$my_gperf_ver3" -ge 301; then
6302     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6303 else
6304     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6306 AC_SUBST(GPERF)
6308 dnl ===================================================================
6309 dnl Check for system libcmis
6310 dnl ===================================================================
6311 # libcmis requires curl and we can't build curl for iOS
6312 if test $_os != iOS; then
6313     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6314     ENABLE_LIBCMIS=TRUE
6315 else
6316     ENABLE_LIBCMIS=
6318 AC_SUBST(ENABLE_LIBCMIS)
6320 dnl ===================================================================
6321 dnl C++11
6322 dnl ===================================================================
6324 AC_MSG_CHECKING([whether $CXX supports C++17])
6325 CXXFLAGS_CXX11=
6326 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6327     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6328 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6329     my_flags='-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z'
6330     for flag in $my_flags; do
6331         if test "$COM" = MSC; then
6332             flag="-Xclang $flag"
6333         fi
6334         save_CXXFLAGS=$CXXFLAGS
6335         CXXFLAGS="$CXXFLAGS $flag -Werror"
6336         if test "$SYSTEM_LIBCMIS" = TRUE; then
6337             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6338         fi
6339         AC_LANG_PUSH([C++])
6340         dnl Clang 3.9 supports __float128 since
6341         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6342         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6343         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6344         dnl $flag is supported below, so check this first):
6345         my_float128hack=
6346         my_float128hack_impl=-D__float128=void
6347         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6348             #include <vector>
6349             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6350             // (__float128)
6351             ]])
6352         ],,[
6353             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6354             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6355             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6356             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6357             dnl place where __float128 is used is in a template specialization, -D__float128=void
6358             dnl will avoid the problem there while still causing a problem if somebody actually uses
6359             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6360             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6361             dnl "fixed" with this hack):
6362             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6363             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6364                 #include <vector>
6365                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6366                 // (__float128)
6367                 ]])
6368             ],[my_float128hack=$my_float128hack_impl])
6369         ])
6370         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6371             #include <algorithm>
6372             #include <cmath>
6373             #include <functional>
6374             #include <vector>
6376             #if defined SYSTEM_LIBCMIS
6377             // See ucb/source/ucp/cmis/auth_provider.hxx:
6378             #if !defined __clang__
6379             #pragma GCC diagnostic push
6380             #pragma GCC diagnostic ignored "-Wdeprecated"
6381             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6382             #endif
6383             #include <libcmis/libcmis.hxx>
6384             #if !defined __clang__
6385             #pragma GCC diagnostic pop
6386             #endif
6387             #endif
6389             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6390                 std::sort(v.begin(), v.end(), fn);
6391             }
6393             // At least with glibc-headers-2.28-26.fc29.x86_64, when building for Linux x86 32-bit
6394             // (via -m32) and passed-in CXXFLAGS setting -O1 (or higher; overriding -Os as set in
6395             // solenv/gbuild/platform/LINUX_INTEL_GCC.mk), std=gnu* would cause math_errhandling to
6396             // get undef'ed in /usr/include/bits/mathinline.h, while std=c* keeps it defined (as
6397             // needed by sc/source/core/tool/math.cxx):
6398             int g() { return math_errhandling; }
6399             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6400         AC_LANG_POP([C++])
6401         CXXFLAGS=$save_CXXFLAGS
6402         if test -n "$CXXFLAGS_CXX11"; then
6403             break
6404         fi
6405     done
6407 if test -n "$CXXFLAGS_CXX11"; then
6408     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6409 else
6410     AC_MSG_ERROR(no)
6412 AC_SUBST(CXXFLAGS_CXX11)
6414 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6415 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6416 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6417 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6418 dnl again towards 4.7.2:
6419 if test $CPP_LIBRARY = GLIBCXX; then
6420     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6421     AC_LANG_PUSH([C++])
6422     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6423 #include <list>
6424 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6425     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6426     //   GCC 4.7.0: 20120322
6427     //   GCC 4.7.1: 20120614
6428     // and using a range check is not possible as the mapping between
6429     // __GLIBCXX__ values and GCC versions is not monotonic
6430 /* ok */
6431 #else
6432 abi broken
6433 #endif
6434         ]])], [AC_MSG_RESULT(no, ok)],
6435         [AC_MSG_ERROR(yes)])
6436     AC_LANG_POP([C++])
6439 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6440 save_CXXFLAGS=$CXXFLAGS
6441 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6442 AC_LANG_PUSH([C++])
6444 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6445 #include <stddef.h>
6447 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6449 namespace
6451         struct b
6452         {
6453                 int i;
6454                 int j;
6455         };
6457 ]], [[
6458 struct a
6460         int i;
6461         int j;
6463 a thinga[]={{0,0}, {1,1}};
6464 b thingb[]={{0,0}, {1,1}};
6465 size_t i = sizeof(sal_n_array_size(thinga));
6466 size_t j = sizeof(sal_n_array_size(thingb));
6467 return !(i != 0 && j != 0);
6469     ], [ AC_MSG_RESULT(yes) ],
6470     [ AC_MSG_ERROR(no)])
6471 AC_LANG_POP([C++])
6472 CXXFLAGS=$save_CXXFLAGS
6474 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6475 AC_MSG_CHECKING([that $CXX supports C++14 constexpr])
6476 save_CXXFLAGS=$CXXFLAGS
6477 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6478 AC_LANG_PUSH([C++])
6479 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6480     // A somewhat over-complicated way of checking for
6481     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6482     // in constexpr function":
6483     #include <cassert>
6484     template<typename T> inline constexpr T f(T x) { return x; }
6485     template<typename T> inline constexpr T g(T x) {
6486         assert(f(static_cast<int>(x)));
6487         return x;
6488     }
6489     enum E { e };
6490     auto v = g(E::e);
6492     struct S {
6493         int n_;
6494         constexpr bool f() {
6495             int n = n_;
6496             int i = 0;
6497             while (n > 0) { --n; ++i; }
6498             assert(i >= 0);
6499             return i == 0;
6500         }
6501     };
6502     constexpr auto v2 = S{10}.f();
6503     ]])], AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required C++14 constexpr support]))
6504 AC_LANG_POP([C++])
6505 CXXFLAGS=$save_CXXFLAGS
6507 dnl _Pragma support (may require C++11)
6508 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6509     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6510     AC_LANG_PUSH([C++])
6511     save_CXXFLAGS=$CXXFLAGS
6512     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6513     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6514             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6515         ])], [
6516             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6517             AC_MSG_RESULT([yes])
6518         ], [AC_MSG_RESULT([no])])
6519     AC_LANG_POP([C++])
6520     CXXFLAGS=$save_CXXFLAGS
6523 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6524 if test "$GCC" = yes; then
6525     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6526     AC_LANG_PUSH([C++])
6527     save_CXXFLAGS=$CXXFLAGS
6528     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6529     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6530     CXXFLAGS=$save_CXXFLAGS
6531     AC_LANG_POP([C++])
6532     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6533         AC_MSG_RESULT([yes])
6534     else
6535         AC_MSG_RESULT([no])
6536     fi
6538 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6540 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6541 AC_MSG_CHECKING([[that $CXX supports [[fallthrough]]]])
6542 AC_LANG_PUSH([C++])
6543 save_CXXFLAGS=$CXXFLAGS
6544 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6545 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6546 if test "$COM" = MSC; then
6547     CXXFLAGS="$CXXFLAGS /we5030"
6548 else
6549     CXXFLAGS="$CXXFLAGS -Werror"
6551 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6552         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6553         // by checking for __cplusplus:
6554         #if __cplusplus > 201703L
6555         #if !__has_cpp_attribute(fallthrough)
6556         #error
6557         #endif
6558         #else
6559         void f(int & x) {
6560             switch (x) {
6561             case 0:
6562                 ++x;
6563                 [[fallthrough]];
6564             default:
6565                 ++x;
6566             }
6567         }
6568         #endif
6569     ]])],
6570     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required [[fallthrough]] support]))
6571 CXXFLAGS=$save_CXXFLAGS
6572 AC_LANG_POP([C++])
6574 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6575 AC_MSG_CHECKING([[that $CXX supports [[nodiscard]]]])
6576 AC_LANG_PUSH([C++])
6577 save_CXXFLAGS=$CXXFLAGS
6578 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6579 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6580 if test "$COM" = MSC; then
6581     CXXFLAGS="$CXXFLAGS /we5030"
6582 else
6583     CXXFLAGS="$CXXFLAGS -Werror"
6585 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6586         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6587         // by checking for __cplusplus:
6588         #if __cplusplus > 201703L
6589         #if !__has_cpp_attribute(nodiscard)
6590         #error
6591         #endif
6592         #else
6593         [[nodiscard]] int f();
6594         #endif
6595     ]])],
6596     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required [[nodiscard]] support]))
6597 CXXFLAGS=$save_CXXFLAGS
6598 AC_LANG_POP([C++])
6600 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6601 AC_LANG_PUSH([C++])
6602 save_CXXFLAGS=$CXXFLAGS
6603 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6604 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6605         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6606         // supporting it:
6607         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6608         struct S {
6609         private:
6610             S(S const &);
6611         public:
6612             S();
6613             ~S();
6614         };
6615         S copy();
6616         void f() { S c(copy()); }
6617         #endif
6618     ])], [
6619         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6620         AC_MSG_RESULT([yes])
6621     ], [AC_MSG_RESULT([no])])
6622 CXXFLAGS=$save_CXXFLAGS
6623 AC_LANG_POP([C++])
6625 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6626 AC_MSG_CHECKING([that $CXX has a fix for CWG1579])
6627 AC_LANG_PUSH([C++])
6628 save_CXXFLAGS=$CXXFLAGS
6629 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6630 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6631         #include <memory>
6632         struct S1 {};
6633         struct S2: S1 {};
6634         std::unique_ptr<S1> f() {
6635             std::unique_ptr<S2> s2(new S2);
6636             return s2;
6637         }
6638     ])],
6639     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks a required fix for CWG1579]))
6640 CXXFLAGS=$save_CXXFLAGS
6641 AC_LANG_POP([C++])
6643 AC_MSG_CHECKING([whether $CXX has GCC bug 87150])
6644 AC_LANG_PUSH([C++])
6645 save_CXXFLAGS=$CXXFLAGS
6646 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6647 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6648         struct S1 { S1(S1 &&); };
6649         struct S2: S1 {};
6650         S1 f(S2 s) { return s; }
6651     ])], [
6652         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6653         AC_MSG_RESULT([yes])
6654     ], [AC_MSG_RESULT([no])])
6655 CXXFLAGS=$save_CXXFLAGS
6656 AC_LANG_POP([C++])
6658 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6659 dnl uninitialized warning for code like
6661 dnl   OString f();
6662 dnl   boost::optional<OString> * g(bool b) {
6663 dnl       boost::optional<OString> o;
6664 dnl       if (b) o = f();
6665 dnl       return new boost::optional<OString>(o);
6666 dnl   }
6668 dnl (as is e.g. present, in a slightly more elaborate form, in
6669 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6670 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6671 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6672 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6673     AC_MSG_CHECKING([whether $CXX might report false -Werror=maybe-uninitialized])
6674     AC_LANG_PUSH([C++])
6675     save_CXXFLAGS=$CXXFLAGS
6676     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6677     if test "$ENABLE_OPTIMIZED" = TRUE; then
6678         CXXFLAGS="$CXXFLAGS -O2"
6679     else
6680         CXXFLAGS="$CXXFLAGS -O0"
6681     fi
6682     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6683             #include <new>
6684             void f1(int);
6685             struct S1 {
6686                 ~S1() { f1(n); }
6687                 int n = 0;
6688             };
6689             struct S2 {
6690                 S2() {}
6691                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6692                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6693                 void set(S1 s) {
6694                     new (stg) S1(s);
6695                     init = true;
6696                 }
6697                 bool init = false;
6698                 char stg[sizeof (S1)];
6699             } ;
6700             S1 f2();
6701             S2 * f3(bool b) {
6702                 S2 o;
6703                 if (b) o.set(f2());
6704                 return new S2(o);
6705             }
6706         ]])], [AC_MSG_RESULT([no])], [
6707             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6708             AC_MSG_RESULT([yes])
6709         ])
6710     CXXFLAGS=$save_CXXFLAGS
6711     AC_LANG_POP([C++])
6713 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6715 dnl ===================================================================
6716 dnl system stl sanity tests
6717 dnl ===================================================================
6718 if test "$_os" != "WINNT"; then
6720     AC_LANG_PUSH([C++])
6722     save_CPPFLAGS="$CPPFLAGS"
6723     if test -n "$MACOSX_SDK_PATH"; then
6724         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6725     fi
6727     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6728     # only.
6729     if test "$CPP_LIBRARY" = GLIBCXX; then
6730         dnl gcc#19664, gcc#22482, rhbz#162935
6731         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6732         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6733         AC_MSG_RESULT([$stlvisok])
6734         if test "$stlvisok" = "no"; then
6735             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6736         fi
6737     fi
6739     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6740     # when we don't make any dynamic libraries?
6741     if test "$DISABLE_DYNLOADING" = ""; then
6742         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6743         cat > conftestlib1.cc <<_ACEOF
6744 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6745 struct S2: S1<int> { virtual ~S2(); };
6746 S2::~S2() {}
6747 _ACEOF
6748         cat > conftestlib2.cc <<_ACEOF
6749 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6750 struct S2: S1<int> { virtual ~S2(); };
6751 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6752 _ACEOF
6753         gccvisinlineshiddenok=yes
6754         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6755             gccvisinlineshiddenok=no
6756         else
6757             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6758             dnl known to not work with -z defs (unsetting which makes the test
6759             dnl moot, though):
6760             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6761             if test "$COM_IS_CLANG" = TRUE; then
6762                 for i in $CXX $CXXFLAGS; do
6763                     case $i in
6764                     -fsanitize=*)
6765                         my_linkflagsnoundefs=
6766                         break
6767                         ;;
6768                     esac
6769                 done
6770             fi
6771             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6772                 gccvisinlineshiddenok=no
6773             fi
6774         fi
6776         rm -fr libconftest*
6777         AC_MSG_RESULT([$gccvisinlineshiddenok])
6778         if test "$gccvisinlineshiddenok" = "no"; then
6779             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6780         fi
6781     fi
6783    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6784     cat >visibility.cxx <<_ACEOF
6785 #pragma GCC visibility push(hidden)
6786 struct __attribute__ ((visibility ("default"))) TestStruct {
6787   static void Init();
6789 __attribute__ ((visibility ("default"))) void TestFunc() {
6790   TestStruct::Init();
6792 _ACEOF
6793     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6794         gccvisbroken=yes
6795     else
6796         case "$host_cpu" in
6797         i?86|x86_64)
6798             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6799                 gccvisbroken=no
6800             else
6801                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6802                     gccvisbroken=no
6803                 else
6804                     gccvisbroken=yes
6805                 fi
6806             fi
6807             ;;
6808         *)
6809             gccvisbroken=no
6810             ;;
6811         esac
6812     fi
6813     rm -f visibility.s visibility.cxx
6815     AC_MSG_RESULT([$gccvisbroken])
6816     if test "$gccvisbroken" = "yes"; then
6817         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6818     fi
6820     CPPFLAGS="$save_CPPFLAGS"
6822     AC_LANG_POP([C++])
6825 dnl ===================================================================
6826 dnl  Clang++ tests
6827 dnl ===================================================================
6829 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6830 if test "$GCC" = "yes"; then
6831     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6832     AC_LANG_PUSH([C++])
6833     save_CXXFLAGS=$CXXFLAGS
6834     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6835     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6836     CXXFLAGS=$save_CXXFLAGS
6837     AC_LANG_POP([C++])
6838     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6839         AC_MSG_RESULT([yes])
6840     else
6841         AC_MSG_RESULT([no])
6842     fi
6844 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6846 dnl ===================================================================
6847 dnl Compiler plugins
6848 dnl ===================================================================
6850 COMPILER_PLUGINS=
6851 # currently only Clang
6853 if test "$COM_IS_CLANG" != "TRUE"; then
6854     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6855         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6856         enable_compiler_plugins=no
6857     fi
6860 if test "$COM_IS_CLANG" = "TRUE"; then
6861     if test -n "$enable_compiler_plugins"; then
6862         compiler_plugins="$enable_compiler_plugins"
6863     elif test -n "$ENABLE_DBGUTIL"; then
6864         compiler_plugins=test
6865     else
6866         compiler_plugins=no
6867     fi
6868     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 50002; then
6869         if test "$compiler_plugins" = yes; then
6870             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
6871         else
6872             compiler_plugins=no
6873         fi
6874     fi
6875     if test "$compiler_plugins" != "no"; then
6876         dnl The prefix where Clang resides, override to where Clang resides if
6877         dnl using a source build:
6878         if test -z "$CLANGDIR"; then
6879             CLANGDIR=/usr
6880         fi
6881         AC_LANG_PUSH([C++])
6882         save_CPPFLAGS=$CPPFLAGS
6883         save_CXX=$CXX
6884         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6885         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
6886         CXX=$COMPILER_PLUGINS_CXX
6887         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6888         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6889             [COMPILER_PLUGINS=TRUE],
6890             [
6891             if test "$compiler_plugins" = "yes"; then
6892                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6893             else
6894                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6895                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6896             fi
6897             ])
6898         CXX=$save_CXX
6899         CPPFLAGS=$save_CPPFLAGS
6900         AC_LANG_POP([C++])
6901     fi
6902 else
6903     if test "$enable_compiler_plugins" = "yes"; then
6904         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6905     fi
6907 AC_SUBST(COMPILER_PLUGINS)
6908 AC_SUBST(COMPILER_PLUGINS_CXX)
6909 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6910 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6911 AC_SUBST(CLANGDIR)
6912 AC_SUBST(CLANGLIBDIR)
6914 # Plugin to help linker.
6915 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6916 # This makes --enable-lto build with clang work.
6917 AC_SUBST(LD_PLUGIN)
6919 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6920 AC_SUBST(HAVE_POSIX_FALLOCATE)
6922 dnl ===================================================================
6923 dnl Custom build version
6924 dnl ===================================================================
6926 AC_MSG_CHECKING([whether to add custom build version])
6927 if test "$with_build_version" != ""; then
6928     BUILD_VER_STRING=$with_build_version
6929     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6930 else
6931     BUILD_VER_STRING=
6932     AC_MSG_RESULT([no])
6934 AC_SUBST(BUILD_VER_STRING)
6936 JITC_PROCESSOR_TYPE=""
6937 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6938     # IBMs JDK needs this...
6939     JITC_PROCESSOR_TYPE=6
6940     export JITC_PROCESSOR_TYPE
6942 AC_SUBST([JITC_PROCESSOR_TYPE])
6944 # Misc Windows Stuff
6945 AC_ARG_WITH(ucrt-dir,
6946     AS_HELP_STRING([--with-ucrt-dir],
6947         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6948         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6949         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6950             Windows6.1-KB2999226-x64.msu
6951             Windows6.1-KB2999226-x86.msu
6952             Windows8.1-KB2999226-x64.msu
6953             Windows8.1-KB2999226-x86.msu
6954             Windows8-RT-KB2999226-x64.msu
6955             Windows8-RT-KB2999226-x86.msu
6956         A zip archive including those files is available from Microsoft site:
6957         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6959 UCRT_REDISTDIR="$with_ucrt_dir"
6960 if test $_os = "WINNT"; then
6961     find_msvc_x64_dlls
6962     find_msms
6963     MSVC_DLL_PATH="$msvcdllpath"
6964     MSVC_DLLS="$msvcdlls"
6965     MSM_PATH="$msmdir"
6966     # MSVC 15.3 changed it to VC141
6967     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6968         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6969     else
6970         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6971     fi
6972     if test "$UCRT_REDISTDIR" = "no"; then
6973         dnl explicitly disabled
6974         UCRT_REDISTDIR=""
6975     else
6976         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6977                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6978                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6979                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6980                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6981                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6982             UCRT_REDISTDIR=""
6983             if test -n "$PKGFORMAT"; then
6984                for i in $PKGFORMAT; do
6985                    case "$i" in
6986                    msi)
6987                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6988                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6989                        ;;
6990                    esac
6991                done
6992             fi
6993         fi
6994     fi
6997 AC_SUBST(UCRT_REDISTDIR)
6998 AC_SUBST(MSVC_DLL_PATH)
6999 AC_SUBST(MSVC_DLLS)
7000 AC_SUBST(MSM_PATH)
7002 dnl ===================================================================
7003 dnl Checks for Java
7004 dnl ===================================================================
7005 if test "$ENABLE_JAVA" != ""; then
7007     # Windows-specific tests
7008     if test "$build_os" = "cygwin"; then
7009         if test "$BITNESS_OVERRIDE" = 64; then
7010             bitness=64
7011         else
7012             bitness=32
7013         fi
7015         if test -z "$with_jdk_home"; then
7016             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7017             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7018             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7019             if test -n "$regvalue"; then
7020                 ver=$regvalue
7021                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7022                 _jdk_home=$regvalue
7023             fi
7024             if test -z "$with_jdk_home"; then
7025                 for ver in 1.8 1.7 1.6; do
7026                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7027                     if test -n "$regvalue"; then
7028                         _jdk_home=$regvalue
7029                         break
7030                     fi
7031                 done
7032             fi
7033             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7034                 with_jdk_home="$_jdk_home"
7035                 howfound="found automatically"
7036             else
7037                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7038             fi
7039         else
7040             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7041             howfound="you passed"
7042         fi
7043     fi
7045     # 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.
7046     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7047     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7048         with_jdk_home=`/usr/libexec/java_home`
7049     fi
7051     JAVA_HOME=; export JAVA_HOME
7052     if test -z "$with_jdk_home"; then
7053         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7054     else
7055         _java_path="$with_jdk_home/bin/$with_java"
7056         dnl Check if there is a Java interpreter at all.
7057         if test -x "$_java_path"; then
7058             JAVAINTERPRETER=$_java_path
7059         else
7060             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7061         fi
7062     fi
7064     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7065     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7066     dnl loaded by java to run JunitTests:
7067     if test "$build_os" = "cygwin"; then
7068         shortjdkhome=`cygpath -d "$with_jdk_home"`
7069         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
7070             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7071             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7072         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
7073             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7074             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7075         fi
7077         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7078             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7079         fi
7080         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7081     elif test "$cross_compiling" != "yes"; then
7082         case $CPUNAME in
7083             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7084                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7085                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7086                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7087                 fi
7088                 ;;
7089             *) # assumption: everything else 32-bit
7090                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7091                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7092                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7093                 fi
7094                 ;;
7095         esac
7096     fi
7099 dnl ===================================================================
7100 dnl Checks for JDK.
7101 dnl ===================================================================
7103 # Note that JAVA_HOME as for now always means the *build* platform's
7104 # JAVA_HOME. Whether all the complexity here actually is needed any
7105 # more or not, no idea.
7107 if test "$ENABLE_JAVA" != ""; then
7108     _gij_longver=0
7109     AC_MSG_CHECKING([the installed JDK])
7110     if test -n "$JAVAINTERPRETER"; then
7111         dnl java -version sends output to stderr!
7112         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7113             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7114         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7115             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7116         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7117             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7118         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7119             JDK=ibm
7121             dnl IBM JDK specific tests
7122             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7123             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7125             if test "$_jdk_ver" -lt 10600; then
7126                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
7127             fi
7129             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
7131             if test "$with_jdk_home" = ""; then
7132                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7133 you must use the "--with-jdk-home" configure option explicitly])
7134             fi
7136             JAVA_HOME=$with_jdk_home
7137         else
7138             JDK=sun
7140             dnl Sun JDK specific tests
7141             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7142             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7144             if test "$_jdk_ver" -lt 10600; then
7145                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
7146             fi
7147             if test "$_jdk_ver" -gt 10600; then
7148                 JAVA_CLASSPATH_NOT_SET=TRUE
7149             fi
7151             AC_MSG_RESULT([checked (JDK $_jdk)])
7152             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7153             if test "$_os" = "WINNT"; then
7154                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7155             fi
7157             # set to limit VM usage for JunitTests
7158             JAVAIFLAGS=-Xmx64M
7159             # set to limit VM usage for javac
7160             JAVAFLAGS=-J-Xmx128M
7161         fi
7162     else
7163         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
7164     fi
7165 else
7166     dnl Java disabled
7167     JAVA_HOME=
7168     export JAVA_HOME
7171 dnl ===================================================================
7172 dnl Checks for javac
7173 dnl ===================================================================
7174 if test "$ENABLE_JAVA" != ""; then
7175     javacompiler="javac"
7176     JAVA_SOURCE_VER="1.6"
7177     JAVA_TARGET_VER="1.6"
7178     if test -z "$with_jdk_home"; then
7179         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7180     else
7181         _javac_path="$with_jdk_home/bin/$javacompiler"
7182         dnl Check if there is a Java compiler at all.
7183         if test -x "$_javac_path"; then
7184             JAVACOMPILER=$_javac_path
7185         fi
7186     fi
7187     if test -z "$JAVACOMPILER"; then
7188         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7189     fi
7190     if test "$build_os" = "cygwin"; then
7191         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7192             JAVACOMPILER="${JAVACOMPILER}.exe"
7193         fi
7194         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7195     fi
7198 dnl ===================================================================
7199 dnl Checks for javadoc
7200 dnl ===================================================================
7201 if test "$ENABLE_JAVA" != ""; then
7202     if test -z "$with_jdk_home"; then
7203         AC_PATH_PROG(JAVADOC, javadoc)
7204     else
7205         _javadoc_path="$with_jdk_home/bin/javadoc"
7206         dnl Check if there is a javadoc at all.
7207         if test -x "$_javadoc_path"; then
7208             JAVADOC=$_javadoc_path
7209         else
7210             AC_PATH_PROG(JAVADOC, javadoc)
7211         fi
7212     fi
7213     if test -z "$JAVADOC"; then
7214         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7215     fi
7216     if test "$build_os" = "cygwin"; then
7217         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7218             JAVADOC="${JAVADOC}.exe"
7219         fi
7220         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7221     fi
7223     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7224     JAVADOCISGJDOC="yes"
7225     fi
7227 AC_SUBST(JAVADOCISGJDOC)
7229 if test "$ENABLE_JAVA" != ""; then
7230     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7231     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7232         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7233            # try to recover first by looking whether we have a alternatives
7234            # system as in Debian or newer SuSEs where following /usr/bin/javac
7235            # over /etc/alternatives/javac leads to the right bindir where we
7236            # just need to strip a bit away to get a valid JAVA_HOME
7237            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7238         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7239             # maybe only one level of symlink (e.g. on Mac)
7240             JAVA_HOME=$(readlink $JAVACOMPILER)
7241             if test "$(dirname $JAVA_HOME)" = "."; then
7242                 # we've got no path to trim back
7243                 JAVA_HOME=""
7244             fi
7245         else
7246             # else warn
7247             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7248             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7249             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7250             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7251         fi
7252         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7253         if test "$JAVA_HOME" != "/usr"; then
7254             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7255                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7256                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7257                 dnl Tiger already returns a JDK path..
7258                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7259             else
7260                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7261                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7262                 dnl that checks which version to run
7263                 if test -f "$JAVA_HOME"; then
7264                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7265                 fi
7266             fi
7267         fi
7268     fi
7269     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7271     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7272     if test -z "$JAVA_HOME"; then
7273         if test "x$with_jdk_home" = "x"; then
7274             cat > findhome.java <<_ACEOF
7275 [import java.io.File;
7277 class findhome
7279     public static void main(String args[])
7280     {
7281         String jrelocation = System.getProperty("java.home");
7282         File jre = new File(jrelocation);
7283         System.out.println(jre.getParent());
7284     }
7286 _ACEOF
7287             AC_MSG_CHECKING([if javac works])
7288             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7289             AC_TRY_EVAL(javac_cmd)
7290             if test $? = 0 -a -f ./findhome.class; then
7291                 AC_MSG_RESULT([javac works])
7292             else
7293                 echo "configure: javac test failed" >&5
7294                 cat findhome.java >&5
7295                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7296             fi
7297             AC_MSG_CHECKING([if gij knows its java.home])
7298             JAVA_HOME=`$JAVAINTERPRETER findhome`
7299             if test $? = 0 -a "$JAVA_HOME" != ""; then
7300                 AC_MSG_RESULT([$JAVA_HOME])
7301             else
7302                 echo "configure: java test failed" >&5
7303                 cat findhome.java >&5
7304                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7305             fi
7306             # clean-up after ourselves
7307             rm -f ./findhome.java ./findhome.class
7308         else
7309             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7310         fi
7311     fi
7313     # now check if $JAVA_HOME is really valid
7314     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7315         case "${JAVA_HOME}" in
7316             /Library/Java/JavaVirtualMachines/*)
7317                 ;;
7318             *)
7319                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7320                 ;;
7321         esac
7322         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7323             JAVA_HOME_OK="NO"
7324         fi
7325     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7326         JAVA_HOME_OK="NO"
7327     fi
7328     if test "$JAVA_HOME_OK" = "NO"; then
7329         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7330         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7331         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7332         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7333         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7334         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7335     fi
7336     PathFormat "$JAVA_HOME"
7337     JAVA_HOME="$formatted_path"
7340 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7341     "$_os" != Darwin
7342 then
7343     AC_MSG_CHECKING([for JAWT lib])
7344     if test "$_os" = WINNT; then
7345         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7346         JAWTLIB=jawt.lib
7347     else
7348         case "$host_cpu" in
7349         arm*)
7350             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7351             JAVA_ARCH=$my_java_arch
7352             ;;
7353         i*86)
7354             my_java_arch=i386
7355             ;;
7356         m68k)
7357             my_java_arch=m68k
7358             ;;
7359         powerpc)
7360             my_java_arch=ppc
7361             ;;
7362         powerpc64)
7363             my_java_arch=ppc64
7364             ;;
7365         powerpc64le)
7366             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7367             JAVA_ARCH=$my_java_arch
7368             ;;
7369         sparc64)
7370             my_java_arch=sparcv9
7371             ;;
7372         x86_64)
7373             my_java_arch=amd64
7374             ;;
7375         *)
7376             my_java_arch=$host_cpu
7377             ;;
7378         esac
7379         # This is where JDK9 puts the library
7380         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7381             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7382         else
7383             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7384         fi
7385         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7386     fi
7387     AC_MSG_RESULT([$JAWTLIB])
7389 AC_SUBST(JAWTLIB)
7391 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7392     case "$host_os" in
7394     aix*)
7395         JAVAINC="-I$JAVA_HOME/include"
7396         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7397         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7398         ;;
7400     cygwin*)
7401         JAVAINC="-I$JAVA_HOME/include/win32"
7402         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7403         ;;
7405     darwin*)
7406         if test -d "$JAVA_HOME/include/darwin"; then
7407             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7408         else
7409             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7410         fi
7411         ;;
7413     dragonfly*)
7414         JAVAINC="-I$JAVA_HOME/include"
7415         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7416         ;;
7418     freebsd*)
7419         JAVAINC="-I$JAVA_HOME/include"
7420         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7421         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7422         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7423         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7424         ;;
7426     k*bsd*-gnu*)
7427         JAVAINC="-I$JAVA_HOME/include"
7428         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7429         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7430         ;;
7432     linux-gnu*)
7433         JAVAINC="-I$JAVA_HOME/include"
7434         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7435         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7436         ;;
7438     *netbsd*)
7439         JAVAINC="-I$JAVA_HOME/include"
7440         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7441         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7442        ;;
7444     openbsd*)
7445         JAVAINC="-I$JAVA_HOME/include"
7446         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7447         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7448         ;;
7450     solaris*)
7451         JAVAINC="-I$JAVA_HOME/include"
7452         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7453         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7454         ;;
7455     esac
7457 SOLARINC="$SOLARINC $JAVAINC"
7459 if test "$ENABLE_JAVA" != "" -a "x" != "x$JAVACOMPILER"; then
7460     url_check_unknown=0
7461     java_base="testurlcheck"
7462     java_src="${java_base}.java"
7463     java_cls="${java_base}.class"
7464     cat > "${java_src}" <<_ACEOF
7465 [import jdk.internal.loader.URLClassPath;
7466 import java.lang.reflect.Field;
7467 import java.net.URL;
7469 class ${java_base}
7471     public static void main(String args[])
7472     {
7473         try {
7474             URLClassPath cp = new URLClassPath(new URL[0], null);
7475             Field field = cp.getClass().getDeclaredField("DISABLE_CP_URL_CHECK");
7476             field.setAccessible(true);
7477             System.out.println(field.get(cp).toString());
7478         } catch(Exception e) {
7479             System.out.println("unknown");
7480         }
7481     }
7483 _ACEOF
7484     AC_MSG_CHECKING([if jdk.net.URLClassPath.ClassPathURLCheck is disabled])
7485     java_cmd="$JAVACOMPILER --add-exports java.base/jdk.internal.loader=ALL-UNNAMED ${java_src} 1>&2"
7486     AC_TRY_EVAL(java_cmd)
7487     if test $? = 0 -a -f "./${java_cls}"; then
7488         java_res=`$JAVAINTERPRETER --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ${java_base} 2>/dev/null`
7489         if test $? = 0; then
7490             case "${java_res}" in
7491             true) AC_MSG_RESULT([yes]) ;;
7492             false)
7493                 rm -f "./${java_src}" "./${java_cls}"
7494                 AC_MSG_ERROR([no - Java unit tests will break!])
7495                 ;;
7496             *) url_check_unknown=1 ;;
7497             esac
7498         else
7499             url_check_unknown=1
7500         fi
7501     else
7502         url_check_unknown=1
7503     fi
7504     if test $url_check_unknown -eq 1; then
7505         AC_MSG_RESULT([unknown - assuming yes])
7506         add_warning "Unable to find the default value for jdk.net.URLClassPath.ClassPathURLCheck - java tests might fail!"
7507     fi
7508     rm -f "./${java_src}" "./${java_cls}"
7511 AC_SUBST(JAVACOMPILER)
7512 AC_SUBST(JAVADOC)
7513 AC_SUBST(JAVAINTERPRETER)
7514 AC_SUBST(JAVAIFLAGS)
7515 AC_SUBST(JAVAFLAGS)
7516 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7517 AC_SUBST(JAVA_HOME)
7518 AC_SUBST(JAVA_SOURCE_VER)
7519 AC_SUBST(JAVA_TARGET_VER)
7520 AC_SUBST(JDK)
7523 dnl ===================================================================
7524 dnl Export file validation
7525 dnl ===================================================================
7526 AC_MSG_CHECKING([whether to enable export file validation])
7527 if test "$with_export_validation" != "no"; then
7528     if test -z "$ENABLE_JAVA"; then
7529         if test "$with_export_validation" = "yes"; then
7530             AC_MSG_ERROR([requested, but Java is disabled])
7531         else
7532             AC_MSG_RESULT([no, as Java is disabled])
7533         fi
7534     elif test "$_jdk_ver" -lt 10800; then
7535         if test "$with_export_validation" = "yes"; then
7536             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7537         else
7538             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7539         fi
7540     else
7541         AC_MSG_RESULT([yes])
7542         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7544         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7545         if test -z "$ODFVALIDATOR"; then
7546             # remember to download the ODF toolkit with validator later
7547             AC_MSG_NOTICE([no odfvalidator found, will download it])
7548             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7549             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7551             # and fetch name of odfvalidator jar name from download.lst
7552             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7553             AC_SUBST(ODFVALIDATOR_JAR)
7555             if test -z "$ODFVALIDATOR_JAR"; then
7556                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7557             fi
7558         fi
7559         if test "$build_os" = "cygwin"; then
7560             # In case of Cygwin it will be executed from Windows,
7561             # so we need to run bash and absolute path to validator
7562             # so instead of "odfvalidator" it will be
7563             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7564             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7565         else
7566             ODFVALIDATOR="sh $ODFVALIDATOR"
7567         fi
7568         AC_SUBST(ODFVALIDATOR)
7571         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7572         if test -z "$OFFICEOTRON"; then
7573             # remember to download the officeotron with validator later
7574             AC_MSG_NOTICE([no officeotron found, will download it])
7575             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7576             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7578             # and fetch name of officeotron jar name from download.lst
7579             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7580             AC_SUBST(OFFICEOTRON_JAR)
7582             if test -z "$OFFICEOTRON_JAR"; then
7583                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7584             fi
7585         else
7586             # check version of existing officeotron
7587             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7588             if test 0"$OFFICEOTRON_VER" -lt 704; then
7589                 AC_MSG_ERROR([officeotron too old])
7590             fi
7591         fi
7592         if test "$build_os" = "cygwin"; then
7593             # In case of Cygwin it will be executed from Windows,
7594             # so we need to run bash and absolute path to validator
7595             # so instead of "odfvalidator" it will be
7596             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7597             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7598         else
7599             OFFICEOTRON="sh $OFFICEOTRON"
7600         fi
7601     fi
7602     AC_SUBST(OFFICEOTRON)
7603 else
7604     AC_MSG_RESULT([no])
7607 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7608 if test "$with_bffvalidator" != "no"; then
7609     AC_DEFINE(HAVE_BFFVALIDATOR)
7611     if test "$with_export_validation" = "no"; then
7612         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7613     fi
7615     if test "$with_bffvalidator" = "yes"; then
7616         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7617     else
7618         BFFVALIDATOR="$with_bffvalidator"
7619     fi
7621     if test "$build_os" = "cygwin"; then
7622         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7623             AC_MSG_RESULT($BFFVALIDATOR)
7624         else
7625             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7626         fi
7627     elif test -n "$BFFVALIDATOR"; then
7628         # We are not in Cygwin but need to run Windows binary with wine
7629         AC_PATH_PROGS(WINE, wine)
7631         # so swap in a shell wrapper that converts paths transparently
7632         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7633         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7634         AC_SUBST(BFFVALIDATOR_EXE)
7635         AC_MSG_RESULT($BFFVALIDATOR)
7636     else
7637         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7638     fi
7639     AC_SUBST(BFFVALIDATOR)
7640 else
7641     AC_MSG_RESULT([no])
7644 dnl ===================================================================
7645 dnl Check for C preprocessor to use
7646 dnl ===================================================================
7647 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7648 if test -n "$with_idlc_cpp"; then
7649     AC_MSG_RESULT([$with_idlc_cpp])
7650     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7651 else
7652     AC_MSG_RESULT([ucpp])
7653     AC_MSG_CHECKING([which ucpp tp use])
7654     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7655         AC_MSG_RESULT([external])
7656         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7657     else
7658         AC_MSG_RESULT([internal])
7659         BUILD_TYPE="$BUILD_TYPE UCPP"
7660     fi
7662 AC_SUBST(SYSTEM_UCPP)
7664 dnl ===================================================================
7665 dnl Check for epm (not needed for Windows)
7666 dnl ===================================================================
7667 AC_MSG_CHECKING([whether to enable EPM for packing])
7668 if test "$enable_epm" = "yes"; then
7669     AC_MSG_RESULT([yes])
7670     if test "$_os" != "WINNT"; then
7671         if test $_os = Darwin; then
7672             EPM=internal
7673         elif test -n "$with_epm"; then
7674             EPM=$with_epm
7675         else
7676             AC_PATH_PROG(EPM, epm, no)
7677         fi
7678         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7679             AC_MSG_NOTICE([EPM will be built.])
7680             BUILD_TYPE="$BUILD_TYPE EPM"
7681             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7682         else
7683             # Gentoo has some epm which is something different...
7684             AC_MSG_CHECKING([whether the found epm is the right epm])
7685             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7686                 AC_MSG_RESULT([yes])
7687             else
7688                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7689             fi
7690             AC_MSG_CHECKING([epm version])
7691             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7692             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7693                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7694                 AC_MSG_RESULT([OK, >= 3.7])
7695             else
7696                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7697                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7698             fi
7699         fi
7700     fi
7702     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7703         AC_MSG_CHECKING([for rpm])
7704         for a in "$RPM" rpmbuild rpm; do
7705             $a --usage >/dev/null 2> /dev/null
7706             if test $? -eq 0; then
7707                 RPM=$a
7708                 break
7709             else
7710                 $a --version >/dev/null 2> /dev/null
7711                 if test $? -eq 0; then
7712                     RPM=$a
7713                     break
7714                 fi
7715             fi
7716         done
7717         if test -z "$RPM"; then
7718             AC_MSG_ERROR([not found])
7719         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7720             RPM_PATH=`which $RPM`
7721             AC_MSG_RESULT([$RPM_PATH])
7722             SCPDEFS="$SCPDEFS -DWITH_RPM"
7723         else
7724             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7725         fi
7726     fi
7727     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7728         AC_PATH_PROG(DPKG, dpkg, no)
7729         if test "$DPKG" = "no"; then
7730             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7731         fi
7732     fi
7733     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7734        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7735         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7736             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7737                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7738                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7739                     AC_MSG_RESULT([yes])
7740                 else
7741                     AC_MSG_RESULT([no])
7742                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7743                         _pt="rpm"
7744                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7745                         add_warning "the rpms will need to be installed with --nodeps"
7746                     else
7747                         _pt="pkg"
7748                     fi
7749                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7750                     add_warning "the ${_pt}s will not be relocatable"
7751                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7752                                  relocation will work, you need to patch your epm with the
7753                                  patch in epm/epm-3.7.patch or build with
7754                                  --with-epm=internal which will build a suitable epm])
7755                 fi
7756             fi
7757         fi
7758     fi
7759     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7760         AC_PATH_PROG(PKGMK, pkgmk, no)
7761         if test "$PKGMK" = "no"; then
7762             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7763         fi
7764     fi
7765     AC_SUBST(RPM)
7766     AC_SUBST(DPKG)
7767     AC_SUBST(PKGMK)
7768 else
7769     for i in $PKGFORMAT; do
7770         case "$i" in
7771         aix | bsd | deb | pkg | rpm | native | portable)
7772             AC_MSG_ERROR(
7773                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7774             ;;
7775         esac
7776     done
7777     AC_MSG_RESULT([no])
7778     EPM=NO
7780 AC_SUBST(EPM)
7782 ENABLE_LWP=
7783 if test "$enable_lotuswordpro" = "yes"; then
7784     ENABLE_LWP="TRUE"
7786 AC_SUBST(ENABLE_LWP)
7788 dnl ===================================================================
7789 dnl Check for building ODK
7790 dnl ===================================================================
7791 if test "$enable_odk" = no; then
7792     unset DOXYGEN
7793 else
7794     if test "$with_doxygen" = no; then
7795         AC_MSG_CHECKING([for doxygen])
7796         unset DOXYGEN
7797         AC_MSG_RESULT([no])
7798     else
7799         if test "$with_doxygen" = yes; then
7800             AC_PATH_PROG([DOXYGEN], [doxygen])
7801             if test -z "$DOXYGEN"; then
7802                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7803             fi
7804             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7805                 if ! dot -V 2>/dev/null; then
7806                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7807                 fi
7808             fi
7809         else
7810             AC_MSG_CHECKING([for doxygen])
7811             DOXYGEN=$with_doxygen
7812             AC_MSG_RESULT([$DOXYGEN])
7813         fi
7814         if test -n "$DOXYGEN"; then
7815             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7816             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7817             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7818                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7819             fi
7820         fi
7821     fi
7823 AC_SUBST([DOXYGEN])
7825 AC_MSG_CHECKING([whether to build the ODK])
7826 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7827     AC_MSG_RESULT([yes])
7829     if test "$with_java" != "no"; then
7830         AC_MSG_CHECKING([whether to build unowinreg.dll])
7831         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7832             # build on Win by default
7833             enable_build_unowinreg=yes
7834         fi
7835         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7836             AC_MSG_RESULT([no])
7837             BUILD_UNOWINREG=
7838         else
7839             AC_MSG_RESULT([yes])
7840             BUILD_UNOWINREG=TRUE
7841         fi
7842         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7843             if test -z "$with_mingw_cross_compiler"; then
7844                 dnl Guess...
7845                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7846             elif test -x "$with_mingw_cross_compiler"; then
7847                  MINGWCXX="$with_mingw_cross_compiler"
7848             else
7849                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7850             fi
7852             if test "$MINGWCXX" = "false"; then
7853                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7854             fi
7856             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7857             if test -x "$mingwstrip_test"; then
7858                 MINGWSTRIP="$mingwstrip_test"
7859             else
7860                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7861             fi
7863             if test "$MINGWSTRIP" = "false"; then
7864                 AC_MSG_ERROR(MinGW32 binutils not found.)
7865             fi
7866         fi
7867     fi
7868     BUILD_TYPE="$BUILD_TYPE ODK"
7869 else
7870     AC_MSG_RESULT([no])
7871     BUILD_UNOWINREG=
7873 AC_SUBST(BUILD_UNOWINREG)
7874 AC_SUBST(MINGWCXX)
7875 AC_SUBST(MINGWSTRIP)
7877 dnl ===================================================================
7878 dnl Check for system zlib
7879 dnl ===================================================================
7880 if test "$with_system_zlib" = "auto"; then
7881     case "$_os" in
7882     WINNT)
7883         with_system_zlib="$with_system_libs"
7884         ;;
7885     *)
7886         if test "$enable_fuzzers" != "yes"; then
7887             with_system_zlib=yes
7888         else
7889             with_system_zlib=no
7890         fi
7891         ;;
7892     esac
7895 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
7896 dnl and has no pkg-config for it at least on some tinderboxes,
7897 dnl so leaving that out for now
7898 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7899 AC_MSG_CHECKING([which zlib to use])
7900 if test "$with_system_zlib" = "yes"; then
7901     AC_MSG_RESULT([external])
7902     SYSTEM_ZLIB=TRUE
7903     AC_CHECK_HEADER(zlib.h, [],
7904         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7905     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7906         [AC_MSG_ERROR(zlib not found or functional)], [])
7907 else
7908     AC_MSG_RESULT([internal])
7909     SYSTEM_ZLIB=
7910     BUILD_TYPE="$BUILD_TYPE ZLIB"
7911     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7912     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7914 AC_SUBST(ZLIB_CFLAGS)
7915 AC_SUBST(ZLIB_LIBS)
7916 AC_SUBST(SYSTEM_ZLIB)
7918 dnl ===================================================================
7919 dnl Check for system jpeg
7920 dnl ===================================================================
7921 AC_MSG_CHECKING([which libjpeg to use])
7922 if test "$with_system_jpeg" = "yes"; then
7923     AC_MSG_RESULT([external])
7924     SYSTEM_LIBJPEG=TRUE
7925     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7926         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7927     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7928         [AC_MSG_ERROR(jpeg library not found or functional)], [])
7929 else
7930     SYSTEM_LIBJPEG=
7931     AC_MSG_RESULT([internal, libjpeg-turbo])
7932     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7933     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7934     if test "$COM" = "MSC"; then
7935         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7936     else
7937         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7938     fi
7940     case "$host_cpu" in
7941     x86_64 | amd64 | i*86 | x86 | ia32)
7942         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7943         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7944             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7945                 NASM="$LODE_HOME/opt/bin/nasm"
7946             elif test -x "/opt/lo/bin/nasm"; then
7947                 NASM="/opt/lo/bin/nasm"
7948             fi
7949         fi
7951         if test -n "$NASM"; then
7952             AC_MSG_CHECKING([for object file format of host system])
7953             case "$host_os" in
7954               cygwin* | mingw* | pw32* | interix*)
7955                 case "$host_cpu" in
7956                   x86_64)
7957                     objfmt='Win64-COFF'
7958                     ;;
7959                   *)
7960                     objfmt='Win32-COFF'
7961                     ;;
7962                 esac
7963               ;;
7964               msdosdjgpp* | go32*)
7965                 objfmt='COFF'
7966               ;;
7967               os2-emx*)                 # not tested
7968                 objfmt='MSOMF'          # obj
7969               ;;
7970               linux*coff* | linux*oldld*)
7971                 objfmt='COFF'           # ???
7972               ;;
7973               linux*aout*)
7974                 objfmt='a.out'
7975               ;;
7976               linux*)
7977                 case "$host_cpu" in
7978                   x86_64)
7979                     objfmt='ELF64'
7980                     ;;
7981                   *)
7982                     objfmt='ELF'
7983                     ;;
7984                 esac
7985               ;;
7986               kfreebsd* | freebsd* | netbsd* | openbsd*)
7987                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7988                   objfmt='BSD-a.out'
7989                 else
7990                   case "$host_cpu" in
7991                     x86_64 | amd64)
7992                       objfmt='ELF64'
7993                       ;;
7994                     *)
7995                       objfmt='ELF'
7996                       ;;
7997                   esac
7998                 fi
7999               ;;
8000               solaris* | sunos* | sysv* | sco*)
8001                 case "$host_cpu" in
8002                   x86_64)
8003                     objfmt='ELF64'
8004                     ;;
8005                   *)
8006                     objfmt='ELF'
8007                     ;;
8008                 esac
8009               ;;
8010               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8011                 case "$host_cpu" in
8012                   x86_64)
8013                     objfmt='Mach-O64'
8014                     ;;
8015                   *)
8016                     objfmt='Mach-O'
8017                     ;;
8018                 esac
8019               ;;
8020               *)
8021                 objfmt='ELF ?'
8022               ;;
8023             esac
8025             AC_MSG_RESULT([$objfmt])
8026             if test "$objfmt" = 'ELF ?'; then
8027               objfmt='ELF'
8028               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8029             fi
8031             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8032             case "$objfmt" in
8033               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8034               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8035               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8036               COFF)       NAFLAGS='-fcoff -DCOFF';;
8037               a.out)      NAFLAGS='-faout -DAOUT';;
8038               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8039               ELF)        NAFLAGS='-felf -DELF';;
8040               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8041               RDF)        NAFLAGS='-frdf -DRDF';;
8042               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8043               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8044             esac
8045             AC_MSG_RESULT([$NAFLAGS])
8047             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8048             cat > conftest.asm << EOF
8049             [%line __oline__ "configure"
8050                     section .text
8051                     global  _main,main
8052             _main:
8053             main:   xor     eax,eax
8054                     ret
8055             ]
8057             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8058             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8059               AC_MSG_RESULT(yes)
8060             else
8061               echo "configure: failed program was:" >&AC_FD_CC
8062               cat conftest.asm >&AC_FD_CC
8063               rm -rf conftest*
8064               AC_MSG_RESULT(no)
8065               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8066               NASM=""
8067             fi
8069         fi
8071         if test -z "$NASM"; then
8072 cat << _EOS
8073 ****************************************************************************
8074 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8075 To get one please:
8077 _EOS
8078             if test "$build_os" = "cygwin"; then
8079 cat << _EOS
8080 install a pre-compiled binary for Win32
8082 mkdir -p /opt/lo/bin
8083 cd /opt/lo/bin
8084 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8085 chmod +x nasm
8087 or get and install one from http://www.nasm.us/
8089 Then re-run autogen.sh
8091 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8092 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8094 _EOS
8095             else
8096 cat << _EOS
8097 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8099 _EOS
8100             fi
8101             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8102             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8103         fi
8104       ;;
8105     esac
8108 AC_SUBST(NASM)
8109 AC_SUBST(LIBJPEG_CFLAGS)
8110 AC_SUBST(LIBJPEG_LIBS)
8111 AC_SUBST(SYSTEM_LIBJPEG)
8113 dnl ===================================================================
8114 dnl Check for system clucene
8115 dnl ===================================================================
8116 dnl we should rather be using
8117 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8118 dnl but the contribs-lib check seems tricky
8119 AC_MSG_CHECKING([which clucene to use])
8120 if test "$with_system_clucene" = "yes"; then
8121     AC_MSG_RESULT([external])
8122     SYSTEM_CLUCENE=TRUE
8123     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8124     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8125     FilterLibs "${CLUCENE_LIBS}"
8126     CLUCENE_LIBS="${filteredlibs}"
8127     AC_LANG_PUSH([C++])
8128     save_CXXFLAGS=$CXXFLAGS
8129     save_CPPFLAGS=$CPPFLAGS
8130     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8131     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8132     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8133     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8134     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8135                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8136     CXXFLAGS=$save_CXXFLAGS
8137     CPPFLAGS=$save_CPPFLAGS
8138     AC_LANG_POP([C++])
8140     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8141 else
8142     AC_MSG_RESULT([internal])
8143     SYSTEM_CLUCENE=
8144     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8146 AC_SUBST(SYSTEM_CLUCENE)
8147 AC_SUBST(CLUCENE_CFLAGS)
8148 AC_SUBST(CLUCENE_LIBS)
8150 dnl ===================================================================
8151 dnl Check for system expat
8152 dnl ===================================================================
8153 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8155 dnl ===================================================================
8156 dnl Check for system xmlsec
8157 dnl ===================================================================
8158 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
8160 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8161 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8162     ENABLE_EOT="TRUE"
8163     AC_DEFINE([ENABLE_EOT])
8164     AC_MSG_RESULT([yes])
8166     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8167 else
8168     ENABLE_EOT=
8169     AC_MSG_RESULT([no])
8171 AC_SUBST([ENABLE_EOT])
8173 dnl ===================================================================
8174 dnl Check for DLP libs
8175 dnl ===================================================================
8176 AS_IF([test "$COM" = "MSC"],
8177       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8178       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8180 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8182 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8184 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8186 AS_IF([test "$COM" = "MSC"],
8187       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8188       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8190 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8192 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8194 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8195 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8197 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8199 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8201 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8203 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8204 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
8206 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8207 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8209 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8211 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8212 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8214 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8216 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8218 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8220 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8222 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8223 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8225 dnl ===================================================================
8226 dnl Check for system lcms2
8227 dnl ===================================================================
8228 if test "$with_system_lcms2" != "yes"; then
8229     SYSTEM_LCMS2=
8231 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8232 if test "$GCC" = "yes"; then
8233     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8235 if test "$COM" = "MSC"; then # override the above
8236     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8239 dnl ===================================================================
8240 dnl Check for system cppunit
8241 dnl ===================================================================
8242 if test "$_os" != "Android" ; then
8243     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8246 dnl ===================================================================
8247 dnl Check whether freetype is available
8248 dnl ===================================================================
8249 if test  "$test_freetype" = "yes"; then
8250     AC_MSG_CHECKING([whether freetype is available])
8251     # FreeType has 3 different kinds of versions
8252     # * release, like 2.4.10
8253     # * libtool, like 13.0.7 (this what pkg-config returns)
8254     # * soname
8255     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8256     #
8257     # 9.9.3 is 2.2.0
8258     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8259     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8260     FilterLibs "${FREETYPE_LIBS}"
8261     FREETYPE_LIBS="${filteredlibs}"
8262     SYSTEM_FREETYPE=TRUE
8263 else
8264     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8265     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8267 AC_SUBST(FREETYPE_CFLAGS)
8268 AC_SUBST(FREETYPE_LIBS)
8269 AC_SUBST([SYSTEM_FREETYPE])
8271 # ===================================================================
8272 # Check for system libxslt
8273 # to prevent incompatibilities between internal libxml2 and external libxslt,
8274 # or vice versa, use with_system_libxml here
8275 # ===================================================================
8276 if test "$with_system_libxml" = "auto"; then
8277     case "$_os" in
8278     WINNT|iOS|Android)
8279         with_system_libxml="$with_system_libs"
8280         ;;
8281     *)
8282         if test "$enable_fuzzers" != "yes"; then
8283             with_system_libxml=yes
8284         else
8285             with_system_libxml=no
8286         fi
8287         ;;
8288     esac
8291 AC_MSG_CHECKING([which libxslt to use])
8292 if test "$with_system_libxml" = "yes"; then
8293     AC_MSG_RESULT([external])
8294     SYSTEM_LIBXSLT=TRUE
8295     if test "$_os" = "Darwin"; then
8296         dnl make sure to use SDK path
8297         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8298         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8299         dnl omit -L/usr/lib
8300         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8301         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8302     else
8303         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8304         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8305         FilterLibs "${LIBXSLT_LIBS}"
8306         LIBXSLT_LIBS="${filteredlibs}"
8307         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8308         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8309         FilterLibs "${LIBEXSLT_LIBS}"
8310         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8311     fi
8313     dnl Check for xsltproc
8314     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8315     if test "$XSLTPROC" = "no"; then
8316         AC_MSG_ERROR([xsltproc is required])
8317     fi
8318 else
8319     AC_MSG_RESULT([internal])
8320     SYSTEM_LIBXSLT=
8321     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8323     if test "$cross_compiling" = "yes"; then
8324         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8325         if test "$XSLTPROC" = "no"; then
8326             AC_MSG_ERROR([xsltproc is required])
8327         fi
8328     fi
8330 AC_SUBST(SYSTEM_LIBXSLT)
8331 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8332     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8334 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8336 AC_SUBST(LIBEXSLT_CFLAGS)
8337 AC_SUBST(LIBEXSLT_LIBS)
8338 AC_SUBST(LIBXSLT_CFLAGS)
8339 AC_SUBST(LIBXSLT_LIBS)
8340 AC_SUBST(XSLTPROC)
8342 # ===================================================================
8343 # Check for system libxml
8344 # ===================================================================
8345 AC_MSG_CHECKING([which libxml to use])
8346 if test "$with_system_libxml" = "yes"; then
8347     AC_MSG_RESULT([external])
8348     SYSTEM_LIBXML=TRUE
8349     if test "$_os" = "Darwin"; then
8350         dnl make sure to use SDK path
8351         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8352         dnl omit -L/usr/lib
8353         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8354     elif test $_os = iOS; then
8355         dnl make sure to use SDK path
8356         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8357         LIBXML_CFLAGS="-I$usr/include/libxml2"
8358         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8359     else
8360         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8361         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8362         FilterLibs "${LIBXML_LIBS}"
8363         LIBXML_LIBS="${filteredlibs}"
8364     fi
8366     dnl Check for xmllint
8367     AC_PATH_PROG(XMLLINT, xmllint, no)
8368     if test "$XMLLINT" = "no"; then
8369         AC_MSG_ERROR([xmllint is required])
8370     fi
8371 else
8372     AC_MSG_RESULT([internal])
8373     SYSTEM_LIBXML=
8374     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8375     if test "$COM" = "MSC"; then
8376         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8377     fi
8378     if test "$COM" = "MSC"; then
8379         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8380     else
8381         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8382     fi
8383     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8385 AC_SUBST(SYSTEM_LIBXML)
8386 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8387     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8389 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8390 AC_SUBST(LIBXML_CFLAGS)
8391 AC_SUBST(LIBXML_LIBS)
8392 AC_SUBST(XMLLINT)
8394 # =====================================================================
8395 # Checking for a Python interpreter with version >= 2.7.
8396 # Build and runtime requires Python 3 compatible version (>= 2.7).
8397 # Optionally user can pass an option to configure, i. e.
8398 # ./configure PYTHON=/usr/bin/python
8399 # =====================================================================
8400 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8401     # This allows a lack of system python with no error, we use internal one in that case.
8402     AM_PATH_PYTHON([2.7],, [:])
8403     # Clean PYTHON_VERSION checked below if cross-compiling
8404     PYTHON_VERSION=""
8405     if test "$PYTHON" != ":"; then
8406         PYTHON_FOR_BUILD=$PYTHON
8407     fi
8409 AC_SUBST(PYTHON_FOR_BUILD)
8411 # Checks for Python to use for Pyuno
8412 AC_MSG_CHECKING([which Python to use for Pyuno])
8413 case "$enable_python" in
8414 no|disable)
8415     if test -z $PYTHON_FOR_BUILD; then
8416         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8417         # requirement from the choice whether to include Python stuff in the installer, but why
8418         # bother?
8419         AC_MSG_ERROR([Python is required at build time.])
8420     fi
8421     enable_python=no
8422     AC_MSG_RESULT([none])
8423     ;;
8424 ""|yes|auto)
8425     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8426         AC_MSG_RESULT([no, overridden by --disable-scripting])
8427         enable_python=no
8428     elif test $build_os = cygwin; then
8429         dnl When building on Windows we don't attempt to use any installed
8430         dnl "system"  Python.
8431         AC_MSG_RESULT([fully internal])
8432         enable_python=internal
8433     elif test "$cross_compiling" = yes; then
8434         AC_MSG_RESULT([system])
8435         enable_python=system
8436     else
8437         # Unset variables set by the above AM_PATH_PYTHON so that
8438         # we actually do check anew.
8439         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
8440         AM_PATH_PYTHON([3.3],, [:])
8441         if test "$PYTHON" = ":"; then
8442             if test -z "$PYTHON_FOR_BUILD"; then
8443                 AC_MSG_RESULT([fully internal])
8444             else
8445                 AC_MSG_RESULT([internal])
8446             fi
8447             enable_python=internal
8448         else
8449             AC_MSG_RESULT([system])
8450             enable_python=system
8451         fi
8452     fi
8453     ;;
8454 internal)
8455     AC_MSG_RESULT([internal])
8456     ;;
8457 fully-internal)
8458     AC_MSG_RESULT([fully internal])
8459     enable_python=internal
8460     ;;
8461 system)
8462     AC_MSG_RESULT([system])
8463     if test "$_os" = Darwin; then
8464         AC_MSG_ERROR([--enable-python=system doesn't work on macOS: /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h is known to contain uses of "register", which is removed from C++17])
8465     fi
8466     ;;
8468     AC_MSG_ERROR([Incorrect --enable-python option])
8469     ;;
8470 esac
8472 if test $enable_python != no; then
8473     BUILD_TYPE="$BUILD_TYPE PYUNO"
8476 if test $enable_python = system; then
8477     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8478         # Fallback: Accept these in the environment, or as set above
8479         # for MacOSX.
8480         :
8481     elif test "$cross_compiling" != yes; then
8482         # Unset variables set by the above AM_PATH_PYTHON so that
8483         # we actually do check anew.
8484         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
8485         # This causes an error if no python command is found
8486         AM_PATH_PYTHON([3.3])
8487         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8488         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8489         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8490         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8491         if test -z "$PKG_CONFIG"; then
8492             PYTHON_CFLAGS="-I$python_include"
8493             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8494         elif $PKG_CONFIG --exists python-$python_version; then
8495             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8496             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8497         else
8498             PYTHON_CFLAGS="-I$python_include"
8499             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8500         fi
8501         FilterLibs "${PYTHON_LIBS}"
8502         PYTHON_LIBS="${filteredlibs}"
8503     else
8504         dnl How to find out the cross-compilation Python installation path?
8505         AC_MSG_CHECKING([for python version])
8506         AS_IF([test -n "$PYTHON_VERSION"],
8507               [AC_MSG_RESULT([$PYTHON_VERSION])],
8508               [AC_MSG_RESULT([not found])
8509                AC_MSG_ERROR([no usable python found])])
8510         test -n "$PYTHON_CFLAGS" && break
8511     fi
8513     dnl Check if the headers really work
8514     save_CPPFLAGS="$CPPFLAGS"
8515     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8516     AC_CHECK_HEADER(Python.h)
8517     CPPFLAGS="$save_CPPFLAGS"
8519     # let the PYTHON_FOR_BUILD match the same python installation that
8520     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8521     # better for PythonTests.
8522     PYTHON_FOR_BUILD=$PYTHON
8525 if test "$with_lxml" != no; then
8526     if test -z "$PYTHON_FOR_BUILD"; then
8527         case $build_os in
8528             cygwin)
8529                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8530                 ;;
8531             *)
8532                 if test "$cross_compiling" != yes ; then
8533                     BUILD_TYPE="$BUILD_TYPE LXML"
8534                 fi
8535                 ;;
8536         esac
8537     else
8538         AC_MSG_CHECKING([for python lxml])
8539         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8540             AC_MSG_RESULT([yes])
8541         else
8542             case $build_os in
8543                 cygwin)
8544                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8545                     ;;
8546                 *)
8547                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8548                         BUILD_TYPE="$BUILD_TYPE LXML"
8549                         AC_MSG_RESULT([no, using internal lxml])
8550                     else
8551                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8552                     fi
8553                     ;;
8554             esac
8555         fi
8556     fi
8559 dnl By now enable_python should be "system", "internal" or "no"
8560 case $enable_python in
8561 system)
8562     SYSTEM_PYTHON=TRUE
8564     if test "x$ac_cv_header_Python_h" != "xyes"; then
8565        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8566     fi
8568     AC_LANG_PUSH(C)
8569     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8570     AC_MSG_CHECKING([for correct python library version])
8571        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8572 #include <Python.h>
8574 int main(int argc, char **argv) {
8575    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8576        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8577    else return 1;
8579        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.7 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8580     CFLAGS=$save_CFLAGS
8581     AC_LANG_POP(C)
8583     dnl FIXME Check if the Python library can be linked with, too?
8584     ;;
8586 internal)
8587     SYSTEM_PYTHON=
8588     PYTHON_VERSION_MAJOR=3
8589     PYTHON_VERSION_MINOR=5
8590     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.6
8591     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8592         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8593     fi
8594     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8595     BUILD_TYPE="$BUILD_TYPE PYTHON"
8596     # Embedded Python dies without Home set
8597     if test "$HOME" = ""; then
8598         export HOME=""
8599     fi
8600     ;;
8602     DISABLE_PYTHON=TRUE
8603     SYSTEM_PYTHON=
8604     ;;
8606     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8607     ;;
8608 esac
8610 AC_SUBST(DISABLE_PYTHON)
8611 AC_SUBST(SYSTEM_PYTHON)
8612 AC_SUBST(PYTHON_CFLAGS)
8613 AC_SUBST(PYTHON_LIBS)
8614 AC_SUBST(PYTHON_VERSION)
8615 AC_SUBST(PYTHON_VERSION_MAJOR)
8616 AC_SUBST(PYTHON_VERSION_MINOR)
8618 ENABLE_MARIADBC=TRUE
8619 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8620     ENABLE_MARIADBC=
8622 MARIADBC_MAJOR=1
8623 MARIADBC_MINOR=0
8624 MARIADBC_MICRO=2
8625 if test "$ENABLE_MARIADBC" = "TRUE"; then
8626     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8629 AC_SUBST(ENABLE_MARIADBC)
8630 AC_SUBST(MARIADBC_MAJOR)
8631 AC_SUBST(MARIADBC_MINOR)
8632 AC_SUBST(MARIADBC_MICRO)
8634 if test "$ENABLE_MARIADBC" = "TRUE"; then
8635     dnl ===================================================================
8636     dnl Check for system MariaDB
8637     dnl ===================================================================
8638     AC_MSG_CHECKING([which MariaDB to use])
8639     if test "$with_system_mariadb" = "yes"; then
8640         AC_MSG_RESULT([external])
8641         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8642         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8643         if test -z "$MARIADBCONFIG"; then
8644             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8645             if test -z "$MARIADBCONFIG"; then
8646                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8647                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8648             fi
8649         fi
8650         AC_MSG_CHECKING([MariaDB version])
8651         MARIADB_VERSION=`$MARIADBCONFIG --version`
8652         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8653         if test "$MARIADB_MAJOR" -ge "5"; then
8654             AC_MSG_RESULT([OK])
8655         else
8656             AC_MSG_ERROR([too old, use 5.0.x or later])
8657         fi
8658         AC_MSG_CHECKING([for MariaDB Client library])
8659         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8660         if test "$COM_IS_CLANG" = TRUE; then
8661             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8662         fi
8663         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8664         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8665         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8666         dnl linux32:
8667         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8668             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8669             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8670                 | sed -e 's|/lib64/|/lib/|')
8671         fi
8672         FilterLibs "${MARIADB_LIBS}"
8673         MARIADB_LIBS="${filteredlibs}"
8674         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8675         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8676         if test "$enable_bundle_mariadb" = "yes"; then
8677             AC_MSG_RESULT([yes])
8678             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8679             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8681 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8683 /g' | grep -E '(mysqlclient|mariadb)')
8684             if test "$_os" = "Darwin"; then
8685                 LIBMARIADB=${LIBMARIADB}.dylib
8686             elif test "$_os" = "WINNT"; then
8687                 LIBMARIADB=${LIBMARIADB}.dll
8688             else
8689                 LIBMARIADB=${LIBMARIADB}.so
8690             fi
8691             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8692             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8693             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8694                 AC_MSG_RESULT([found.])
8695                 PathFormat "$LIBMARIADB_PATH"
8696                 LIBMARIADB_PATH="$formatted_path"
8697             else
8698                 AC_MSG_ERROR([not found.])
8699             fi
8700         else
8701             AC_MSG_RESULT([no])
8702             BUNDLE_MARIADB_CONNECTOR_C=
8703         fi
8704     else
8705         AC_MSG_RESULT([internal])
8706         SYSTEM_MARIADB_CONNECTOR_C=
8707         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8708         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8709         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8710     fi
8712     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8713     AC_SUBST(MARIADB_CFLAGS)
8714     AC_SUBST(MARIADB_LIBS)
8715     AC_SUBST(LIBMARIADB)
8716     AC_SUBST(LIBMARIADB_PATH)
8717     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8720 dnl ===================================================================
8721 dnl Check for system hsqldb
8722 dnl ===================================================================
8723 if test "$with_java" != "no"; then
8724     HSQLDB_USE_JDBC_4_1=
8725     AC_MSG_CHECKING([which hsqldb to use])
8726     if test "$with_system_hsqldb" = "yes"; then
8727         AC_MSG_RESULT([external])
8728         SYSTEM_HSQLDB=TRUE
8729         if test -z $HSQLDB_JAR; then
8730             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8731         fi
8732         if ! test -f $HSQLDB_JAR; then
8733                AC_MSG_ERROR(hsqldb.jar not found.)
8734         fi
8735         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8736         export HSQLDB_JAR
8737         if $PERL -e \
8738            'use Archive::Zip;
8739             my $file = "$ENV{'HSQLDB_JAR'}";
8740             my $zip = Archive::Zip->new( $file );
8741             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8742             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8743             {
8744                 push @l, split(/\n/, $mf);
8745                 foreach my $line (@l)
8746                 {
8747                     if ($line =~ m/Specification-Version:/)
8748                     {
8749                         ($t, $version) = split (/:/,$line);
8750                         $version =~ s/^\s//;
8751                         ($a, $b, $c, $d) = split (/\./,$version);
8752                         if ($c == "0" && $d > "8")
8753                         {
8754                             exit 0;
8755                         }
8756                         else
8757                         {
8758                             exit 1;
8759                         }
8760                     }
8761                 }
8762             }
8763             else
8764             {
8765                 exit 1;
8766             }'; then
8767             AC_MSG_RESULT([yes])
8768         else
8769             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8770         fi
8771     else
8772         AC_MSG_RESULT([internal])
8773         SYSTEM_HSQLDB=
8774         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8775         NEED_ANT=TRUE
8776         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8777         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8778         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8779             AC_MSG_RESULT([yes])
8780             HSQLDB_USE_JDBC_4_1=TRUE
8781         else
8782             AC_MSG_RESULT([no])
8783         fi
8784     fi
8785     AC_SUBST(SYSTEM_HSQLDB)
8786     AC_SUBST(HSQLDB_JAR)
8787     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8790 dnl ===================================================================
8791 dnl Check for PostgreSQL stuff
8792 dnl ===================================================================
8793 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8794 if test "x$enable_postgresql_sdbc" != "xno"; then
8795     AC_MSG_RESULT([yes])
8796     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8798     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8799         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8800     fi
8801     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8802         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8803     fi
8805     postgres_interface=""
8806     if test "$with_system_postgresql" = "yes"; then
8807         postgres_interface="external PostgreSQL"
8808         SYSTEM_POSTGRESQL=TRUE
8809         if test "$_os" = Darwin; then
8810             supp_path=''
8811             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8812                 pg_supp_path="$P_SEP$d$pg_supp_path"
8813             done
8814         fi
8815         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8816         if test -z "$PGCONFIG"; then
8817             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8818         fi
8819         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8820         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8821         FilterLibs "${POSTGRESQL_LIB}"
8822         POSTGRESQL_LIB="${filteredlibs}"
8823     else
8824         # if/when anything else than PostgreSQL uses Kerberos,
8825         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8826         WITH_KRB5=
8827         WITH_GSSAPI=
8828         case "$_os" in
8829         Darwin)
8830             # macOS has system MIT Kerberos 5 since 10.4
8831             if test "$with_krb5" != "no"; then
8832                 WITH_KRB5=TRUE
8833                 save_LIBS=$LIBS
8834                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8835                 # that the libraries where these functions are located on macOS will change, is it?
8836                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8837                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8838                 KRB5_LIBS=$LIBS
8839                 LIBS=$save_LIBS
8840                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8841                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8842                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8843                 LIBS=$save_LIBS
8844             fi
8845             if test "$with_gssapi" != "no"; then
8846                 WITH_GSSAPI=TRUE
8847                 save_LIBS=$LIBS
8848                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8849                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8850                 GSSAPI_LIBS=$LIBS
8851                 LIBS=$save_LIBS
8852             fi
8853             ;;
8854         WINNT)
8855             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8856                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8857             fi
8858             ;;
8859         Linux|GNU|*BSD|DragonFly)
8860             if test "$with_krb5" != "no"; then
8861                 WITH_KRB5=TRUE
8862                 save_LIBS=$LIBS
8863                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8864                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8865                 KRB5_LIBS=$LIBS
8866                 LIBS=$save_LIBS
8867                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8868                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8869                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8870                 LIBS=$save_LIBS
8871             fi
8872             if test "$with_gssapi" != "no"; then
8873                 WITH_GSSAPI=TRUE
8874                 save_LIBS=$LIBS
8875                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8876                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8877                 GSSAPI_LIBS=$LIBS
8878                 LIBS=$save_LIBS
8879             fi
8880             ;;
8881         *)
8882             if test "$with_krb5" = "yes"; then
8883                 WITH_KRB5=TRUE
8884                 save_LIBS=$LIBS
8885                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8886                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8887                 KRB5_LIBS=$LIBS
8888                 LIBS=$save_LIBS
8889                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8890                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8891                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8892                 LIBS=$save_LIBS
8893             fi
8894             if test "$with_gssapi" = "yes"; then
8895                 WITH_GSSAPI=TRUE
8896                 save_LIBS=$LIBS
8897                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8898                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8899                 LIBS=$save_LIBS
8900                 GSSAPI_LIBS=$LIBS
8901             fi
8902         esac
8904         if test -n "$with_libpq_path"; then
8905             SYSTEM_POSTGRESQL=TRUE
8906             postgres_interface="external libpq"
8907             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8908             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8909         else
8910             SYSTEM_POSTGRESQL=
8911             postgres_interface="internal"
8912             POSTGRESQL_LIB=""
8913             POSTGRESQL_INC="%OVERRIDE_ME%"
8914             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8915         fi
8916     fi
8918     AC_MSG_CHECKING([PostgreSQL C interface])
8919     AC_MSG_RESULT([$postgres_interface])
8921     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8922         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8923         save_CFLAGS=$CFLAGS
8924         save_CPPFLAGS=$CPPFLAGS
8925         save_LIBS=$LIBS
8926         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8927         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8928         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8929         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8930             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8931         CFLAGS=$save_CFLAGS
8932         CPPFLAGS=$save_CPPFLAGS
8933         LIBS=$save_LIBS
8934     fi
8935     BUILD_POSTGRESQL_SDBC=TRUE
8936 else
8937     AC_MSG_RESULT([no])
8939 AC_SUBST(WITH_KRB5)
8940 AC_SUBST(WITH_GSSAPI)
8941 AC_SUBST(GSSAPI_LIBS)
8942 AC_SUBST(KRB5_LIBS)
8943 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8944 AC_SUBST(SYSTEM_POSTGRESQL)
8945 AC_SUBST(POSTGRESQL_INC)
8946 AC_SUBST(POSTGRESQL_LIB)
8948 dnl ===================================================================
8949 dnl Check for Firebird stuff
8950 dnl ===================================================================
8951 ENABLE_FIREBIRD_SDBC=
8952 if test "$enable_firebird_sdbc" = "yes" ; then
8953     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8955     dnl ===================================================================
8956     dnl Check for system Firebird
8957     dnl ===================================================================
8958     AC_MSG_CHECKING([which Firebird to use])
8959     if test "$with_system_firebird" = "yes"; then
8960         AC_MSG_RESULT([external])
8961         SYSTEM_FIREBIRD=TRUE
8962         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8963         if test -z "$FIREBIRDCONFIG"; then
8964             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8965             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8966                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8967             ])
8968             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8969         else
8970             AC_MSG_NOTICE([fb_config found])
8971             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8972             AC_MSG_CHECKING([for Firebird Client library])
8973             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8974             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8975             FilterLibs "${FIREBIRD_LIBS}"
8976             FIREBIRD_LIBS="${filteredlibs}"
8977         fi
8978         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8979         AC_MSG_CHECKING([Firebird version])
8980         if test -n "${FIREBIRD_VERSION}"; then
8981             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8982             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8983             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8984                 AC_MSG_RESULT([OK])
8985             else
8986                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8987             fi
8988         else
8989             __save_CFLAGS="${CFLAGS}"
8990             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8991             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8992 #if defined(FB_API_VER) && FB_API_VER == 30
8993 int fb_api_is_30(void) { return 0; }
8994 #else
8995 #error "Wrong Firebird API version"
8996 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8997             CFLAGS="${__save_CFLAGS}"
8998         fi
8999         ENABLE_FIREBIRD_SDBC=TRUE
9000         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9001     elif test "$enable_database_connectivity" != yes; then
9002         AC_MSG_RESULT([none])
9003     elif test "$cross_compiling" = "yes"; then
9004         AC_MSG_RESULT([none])
9005     else
9006         dnl Embedded Firebird has version 3.0
9007         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9008         dnl We need libatomic_ops for any non X86/X64 system
9009         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9010             dnl ===================================================================
9011             dnl Check for system libatomic_ops
9012             dnl ===================================================================
9013             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9014             if test "$with_system_libatomic_ops" = "yes"; then
9015                 SYSTEM_LIBATOMIC_OPS=TRUE
9016                 AC_CHECK_HEADERS(atomic_ops.h, [],
9017                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9018             else
9019                 SYSTEM_LIBATOMIC_OPS=
9020                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9021                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9022                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9023             fi
9024         fi
9026         AC_MSG_RESULT([internal])
9027         SYSTEM_FIREBIRD=
9028         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9029         FIREBIRD_LIBS="-lfbclient"
9031         if test "$with_system_libtommath" = "yes"; then
9032             SYSTEM_LIBTOMMATH=TRUE
9033             dnl check for tommath presence
9034             save_LIBS=$LIBS
9035             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9036             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9037             LIBS=$save_LIBS
9038         else
9039             SYSTEM_LIBTOMMATH=
9040             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9041             LIBTOMMATH_LIBS="-ltommath"
9042             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9043         fi
9045         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9046         ENABLE_FIREBIRD_SDBC=TRUE
9047         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9048     fi
9050 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9051 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9052 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9053 AC_SUBST(LIBATOMIC_OPS_LIBS)
9054 AC_SUBST(SYSTEM_FIREBIRD)
9055 AC_SUBST(FIREBIRD_CFLAGS)
9056 AC_SUBST(FIREBIRD_LIBS)
9057 AC_SUBST([TOMMATH_CFLAGS])
9058 AC_SUBST([TOMMATH_LIBS])
9060 dnl ===================================================================
9061 dnl Check for system curl
9062 dnl ===================================================================
9063 AC_MSG_CHECKING([which libcurl to use])
9064 if test "$with_system_curl" = "auto"; then
9065     with_system_curl="$with_system_libs"
9068 if test "$with_system_curl" = "yes"; then
9069     AC_MSG_RESULT([external])
9070     SYSTEM_CURL=TRUE
9072     # First try PKGCONFIG and then fall back
9073     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9075     if test -n "$CURL_PKG_ERRORS"; then
9076         AC_PATH_PROG(CURLCONFIG, curl-config)
9077         if test -z "$CURLCONFIG"; then
9078             AC_MSG_ERROR([curl development files not found])
9079         fi
9080         CURL_LIBS=`$CURLCONFIG --libs`
9081         FilterLibs "${CURL_LIBS}"
9082         CURL_LIBS="${filteredlibs}"
9083         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9084         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9086         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9087         case $curl_version in
9088         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9089         dnl so they need to be doubled to end up in the configure script
9090         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9091             AC_MSG_RESULT([yes])
9092             ;;
9093         *)
9094             AC_MSG_ERROR([no, you have $curl_version])
9095             ;;
9096         esac
9097     fi
9099     ENABLE_CURL=TRUE
9100 elif test $_os = iOS; then
9101     # Let's see if we need curl, I think not?
9102     AC_MSG_RESULT([none])
9103     ENABLE_CURL=
9104 else
9105     AC_MSG_RESULT([internal])
9106     SYSTEM_CURL=
9107     BUILD_TYPE="$BUILD_TYPE CURL"
9108     ENABLE_CURL=TRUE
9110 AC_SUBST(SYSTEM_CURL)
9111 AC_SUBST(CURL_CFLAGS)
9112 AC_SUBST(CURL_LIBS)
9113 AC_SUBST(ENABLE_CURL)
9115 dnl ===================================================================
9116 dnl Check for system boost
9117 dnl ===================================================================
9118 AC_MSG_CHECKING([which boost to use])
9119 if test "$with_system_boost" = "yes"; then
9120     AC_MSG_RESULT([external])
9121     SYSTEM_BOOST=TRUE
9122     AX_BOOST_BASE(1.47)
9123     AX_BOOST_DATE_TIME
9124     AX_BOOST_FILESYSTEM
9125     AX_BOOST_IOSTREAMS
9126     AX_BOOST_LOCALE
9127     AC_LANG_PUSH([C++])
9128     save_CXXFLAGS=$CXXFLAGS
9129     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9130     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9131        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9132     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9133        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9134     CXXFLAGS=$save_CXXFLAGS
9135     AC_LANG_POP([C++])
9136     # this is in m4/ax_boost_base.m4
9137     FilterLibs "${BOOST_LDFLAGS}"
9138     BOOST_LDFLAGS="${filteredlibs}"
9139 else
9140     AC_MSG_RESULT([internal])
9141     BUILD_TYPE="$BUILD_TYPE BOOST"
9142     SYSTEM_BOOST=
9143     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9144         # use warning-suppressing wrapper headers
9145         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9146     else
9147         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9148     fi
9150 AC_SUBST(SYSTEM_BOOST)
9152 dnl ===================================================================
9153 dnl Check for system mdds
9154 dnl ===================================================================
9155 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9157 dnl ===================================================================
9158 dnl Check for system glm
9159 dnl ===================================================================
9160 AC_MSG_CHECKING([which glm to use])
9161 if test "$with_system_glm" = "yes"; then
9162     AC_MSG_RESULT([external])
9163     SYSTEM_GLM=TRUE
9164     AC_LANG_PUSH([C++])
9165     AC_CHECK_HEADER([glm/glm.hpp], [],
9166        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9167     AC_LANG_POP([C++])
9168 else
9169     AC_MSG_RESULT([internal])
9170     BUILD_TYPE="$BUILD_TYPE GLM"
9171     SYSTEM_GLM=
9172     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9174 AC_SUBST([GLM_CFLAGS])
9175 AC_SUBST([SYSTEM_GLM])
9177 dnl ===================================================================
9178 dnl Check for system odbc
9179 dnl ===================================================================
9180 AC_MSG_CHECKING([which odbc headers to use])
9181 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
9182     AC_MSG_RESULT([external])
9183     SYSTEM_ODBC_HEADERS=TRUE
9185     if test "$build_os" = "cygwin"; then
9186         save_CPPFLAGS=$CPPFLAGS
9187         find_winsdk
9188         PathFormat "$winsdktest"
9189         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"
9190         AC_CHECK_HEADER(sqlext.h, [],
9191             [AC_MSG_ERROR(odbc not found. install odbc)],
9192             [#include <windows.h>])
9193         CPPFLAGS=$save_CPPFLAGS
9194     else
9195         AC_CHECK_HEADER(sqlext.h, [],
9196             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9197     fi
9198 elif test "$enable_database_connectivity" != yes; then
9199     AC_MSG_RESULT([none])
9200 else
9201     AC_MSG_RESULT([internal])
9202     SYSTEM_ODBC_HEADERS=
9204 AC_SUBST(SYSTEM_ODBC_HEADERS)
9206 dnl ===================================================================
9207 dnl Enable LDAP support
9208 dnl ===================================================================
9210 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9211 AC_MSG_CHECKING([whether to enable LDAP support])
9212     if test "$enable_ldap" != "yes"; then
9213         AC_MSG_RESULT([no])
9214         ENABLE_LDAP=""
9215         enable_ldap=no
9216     else
9217         AC_MSG_RESULT([yes])
9218         ENABLE_LDAP="TRUE"
9219         AC_DEFINE(HAVE_FEATURE_LDAP)
9220     fi
9222 AC_SUBST(ENABLE_LDAP)
9224 dnl ===================================================================
9225 dnl Check for system openldap
9226 dnl ===================================================================
9228 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9229 AC_MSG_CHECKING([which openldap library to use])
9230 if test "$with_system_openldap" = "yes"; then
9231     AC_MSG_RESULT([external])
9232     SYSTEM_OPENLDAP=TRUE
9233     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9234     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9235     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9236 else
9237     AC_MSG_RESULT([internal])
9238     SYSTEM_OPENLDAP=
9239     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9242 AC_SUBST(SYSTEM_OPENLDAP)
9244 dnl ===================================================================
9245 dnl Check for system NSS
9246 dnl ===================================================================
9247 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9248     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9249     AC_DEFINE(HAVE_FEATURE_NSS)
9250     ENABLE_NSS="TRUE"
9251     AC_DEFINE(ENABLE_NSS)
9252 elif test $_os != iOS ; then
9253     with_tls=openssl
9255 AC_SUBST(ENABLE_NSS)
9257 dnl ===================================================================
9258 dnl Check for TLS/SSL and cryptographic implementation to use
9259 dnl ===================================================================
9260 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9261 if test -n "$with_tls"; then
9262     case $with_tls in
9263     openssl)
9264         AC_DEFINE(USE_TLS_OPENSSL)
9265         TLS=OPENSSL
9267         if test "$enable_openssl" != "yes"; then
9268             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9269         fi
9271         # warn that OpenSSL has been selected but not all TLS code has this option
9272         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9273         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9274         ;;
9275     nss)
9276         AC_DEFINE(USE_TLS_NSS)
9277         TLS=NSS
9278         ;;
9279     no)
9280         AC_MSG_WARN([Skipping TLS/SSL])
9281         ;;
9282     *)
9283         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9284 openssl - OpenSSL
9285 nss - Mozilla's Network Security Services (NSS)
9286     ])
9287         ;;
9288     esac
9289 else
9290     # default to using NSS, it results in smaller oox lib
9291     AC_DEFINE(USE_TLS_NSS)
9292     TLS=NSS
9294 AC_MSG_RESULT([$TLS])
9295 AC_SUBST(TLS)
9297 dnl ===================================================================
9298 dnl Check for system sane
9299 dnl ===================================================================
9300 AC_MSG_CHECKING([which sane header to use])
9301 if test "$with_system_sane" = "yes"; then
9302     AC_MSG_RESULT([external])
9303     AC_CHECK_HEADER(sane/sane.h, [],
9304       [AC_MSG_ERROR(sane not found. install sane)], [])
9305 else
9306     AC_MSG_RESULT([internal])
9307     BUILD_TYPE="$BUILD_TYPE SANE"
9310 dnl ===================================================================
9311 dnl Check for system icu
9312 dnl ===================================================================
9313 SYSTEM_GENBRK=
9314 SYSTEM_GENCCODE=
9315 SYSTEM_GENCMN=
9317 ICU_MAJOR=63
9318 ICU_MINOR=1
9319 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9320 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9321 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9322 AC_MSG_CHECKING([which icu to use])
9323 if test "$with_system_icu" = "yes"; then
9324     AC_MSG_RESULT([external])
9325     SYSTEM_ICU=TRUE
9326     AC_LANG_PUSH([C++])
9327     AC_MSG_CHECKING([for unicode/rbbi.h])
9328     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9329     AC_LANG_POP([C++])
9331     if test "$cross_compiling" != "yes"; then
9332         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9333         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9334         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9335         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9336     fi
9338     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9339         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9340         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9341         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9342         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9343         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9344             AC_MSG_RESULT([yes])
9345         else
9346             AC_MSG_RESULT([no])
9347             if test "$with_system_icu_for_build" != "force"; then
9348                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9349 You can use --with-system-icu-for-build=force to use it anyway.])
9350             fi
9351         fi
9352     fi
9354     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9355         # using the system icu tools can lead to version confusion, use the
9356         # ones from the build environment when cross-compiling
9357         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9358         if test -z "$SYSTEM_GENBRK"; then
9359             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9360         fi
9361         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9362         if test -z "$SYSTEM_GENCCODE"; then
9363             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9364         fi
9365         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9366         if test -z "$SYSTEM_GENCMN"; then
9367             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9368         fi
9369         if test "$ICU_MAJOR" -ge "49"; then
9370             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9371             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9372             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9373         else
9374             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9375             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9376             ICU_RECLASSIFIED_HEBREW_LETTER=
9377         fi
9378     fi
9380     if test "$cross_compiling" = "yes"; then
9381         if test "$ICU_MAJOR" -ge "50"; then
9382             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9383             ICU_MINOR=""
9384         fi
9385     fi
9386 else
9387     AC_MSG_RESULT([internal])
9388     SYSTEM_ICU=
9389     BUILD_TYPE="$BUILD_TYPE ICU"
9390     # surprisingly set these only for "internal" (to be used by various other
9391     # external libs): the system icu-config is quite unhelpful and spits out
9392     # dozens of weird flags and also default path -I/usr/include
9393     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9394     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9396 if test "$ICU_MAJOR" -ge "59"; then
9397     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9398     # with -std=c++11 but not all external libraries can be built with that,
9399     # for those use a bit-compatible typedef uint16_t UChar; see
9400     # icu/source/common/unicode/umachine.h
9401     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9402 else
9403     ICU_UCHAR_TYPE=""
9405 AC_SUBST(SYSTEM_ICU)
9406 AC_SUBST(SYSTEM_GENBRK)
9407 AC_SUBST(SYSTEM_GENCCODE)
9408 AC_SUBST(SYSTEM_GENCMN)
9409 AC_SUBST(ICU_MAJOR)
9410 AC_SUBST(ICU_MINOR)
9411 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9412 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9413 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9414 AC_SUBST(ICU_CFLAGS)
9415 AC_SUBST(ICU_LIBS)
9416 AC_SUBST(ICU_UCHAR_TYPE)
9418 dnl ==================================================================
9419 dnl Breakpad
9420 dnl ==================================================================
9421 AC_MSG_CHECKING([whether to enable breakpad])
9422 if test "$enable_breakpad" != yes; then
9423     AC_MSG_RESULT([no])
9424 else
9425     AC_MSG_RESULT([yes])
9426     ENABLE_BREAKPAD="TRUE"
9427     AC_DEFINE(ENABLE_BREAKPAD)
9428     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9429     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9431     AC_MSG_CHECKING([for crashreport config])
9432     if test "$with_symbol_config" = "no"; then
9433         BREAKPAD_SYMBOL_CONFIG="invalid"
9434         AC_MSG_RESULT([no])
9435     else
9436         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9437         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9438         AC_MSG_RESULT([yes])
9439     fi
9440     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9442 AC_SUBST(ENABLE_BREAKPAD)
9444 dnl ==================================================================
9445 dnl libfuzzer
9446 dnl ==================================================================
9447 AC_MSG_CHECKING([whether to enable fuzzers])
9448 if test "$enable_fuzzers" != yes; then
9449     AC_MSG_RESULT([no])
9450 else
9451     AC_MSG_RESULT([yes])
9452     ENABLE_FUZZERS="TRUE"
9453     AC_DEFINE([ENABLE_FUZZERS],1)
9454     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9456 AC_SUBST(ENABLE_FUZZERS)
9458 dnl ===================================================================
9459 dnl Orcus
9460 dnl ===================================================================
9461 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9462 if test "$with_system_orcus" != "yes"; then
9463     if test "$SYSTEM_BOOST" = "TRUE"; then
9464         # ===========================================================
9465         # Determine if we are going to need to link with Boost.System
9466         # ===========================================================
9467         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9468         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9469         dnl in documentation has no effect.
9470         AC_MSG_CHECKING([if we need to link with Boost.System])
9471         AC_LANG_PUSH([C++])
9472         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9473                 @%:@include <boost/version.hpp>
9474             ]],[[
9475                 #if BOOST_VERSION >= 105000
9476                 #   error yes, we need to link with Boost.System
9477                 #endif
9478             ]])],[
9479                 AC_MSG_RESULT([no])
9480             ],[
9481                 AC_MSG_RESULT([yes])
9482                 AX_BOOST_SYSTEM
9483         ])
9484         AC_LANG_POP([C++])
9485     fi
9487 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9488 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9489 AC_SUBST([BOOST_SYSTEM_LIB])
9490 AC_SUBST(SYSTEM_LIBORCUS)
9492 dnl ===================================================================
9493 dnl HarfBuzz
9494 dnl ===================================================================
9495 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9496                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9497                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9499 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9500                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9501                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9503 if test "$COM" = "MSC"; then # override the above
9504     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9505     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9508 if test "$with_system_harfbuzz" = "yes"; then
9509     if test "$with_system_graphite" = "no"; then
9510         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9511     fi
9512     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9513     _save_libs="$LIBS"
9514     _save_cflags="$CFLAGS"
9515     LIBS="$LIBS $HARFBUZZ_LIBS"
9516     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9517     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9518     LIBS="$_save_libs"
9519     CFLAGS="$_save_cflags"
9520 else
9521     if test "$with_system_graphite" = "yes"; then
9522         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9523     fi
9526 AC_MSG_CHECKING([whether to use X11])
9527 dnl ***************************************
9528 dnl testing for X libraries and includes...
9529 dnl ***************************************
9530 if test "$USING_X11" = TRUE; then
9531     AC_DEFINE(HAVE_FEATURE_X11)
9533 AC_MSG_RESULT([$USING_X11])
9535 if test "$USING_X11" = TRUE; then
9536     AC_PATH_X
9537     AC_PATH_XTRA
9538     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9540     if test -z "$x_includes"; then
9541         x_includes="default_x_includes"
9542     fi
9543     if test -z "$x_libraries"; then
9544         x_libraries="default_x_libraries"
9545     fi
9546     CFLAGS="$CFLAGS $X_CFLAGS"
9547     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9548     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9549 else
9550     x_includes="no_x_includes"
9551     x_libraries="no_x_libraries"
9554 if test "$USING_X11" = TRUE; then
9555     dnl ===================================================================
9556     dnl Check for extension headers
9557     dnl ===================================================================
9558     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9559      [#include <X11/extensions/shape.h>])
9561     # vcl needs ICE and SM
9562     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9563     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9564         [AC_MSG_ERROR(ICE library not found)])
9565     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9566     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9567         [AC_MSG_ERROR(SM library not found)])
9570 dnl ===================================================================
9571 dnl Check for system Xrender
9572 dnl ===================================================================
9573 AC_MSG_CHECKING([whether to use Xrender])
9574 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9575     AC_MSG_RESULT([yes])
9576     PKG_CHECK_MODULES(XRENDER, xrender)
9577     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9578     FilterLibs "${XRENDER_LIBS}"
9579     XRENDER_LIBS="${filteredlibs}"
9580     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9581       [AC_MSG_ERROR(libXrender not found or functional)], [])
9582     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9583       [AC_MSG_ERROR(Xrender not found. install X)], [])
9584 else
9585     AC_MSG_RESULT([no])
9587 AC_SUBST(XRENDER_CFLAGS)
9588 AC_SUBST(XRENDER_LIBS)
9590 dnl ===================================================================
9591 dnl Check for XRandr
9592 dnl ===================================================================
9593 AC_MSG_CHECKING([whether to enable RandR support])
9594 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9595     AC_MSG_RESULT([yes])
9596     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9597     if test "$ENABLE_RANDR" != "TRUE"; then
9598         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9599                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9600         XRANDR_CFLAGS=" "
9601         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9602           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9603         XRANDR_LIBS="-lXrandr "
9604         ENABLE_RANDR="TRUE"
9605     fi
9606     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9607     FilterLibs "${XRANDR_LIBS}"
9608     XRANDR_LIBS="${filteredlibs}"
9609 else
9610     ENABLE_RANDR=""
9611     AC_MSG_RESULT([no])
9613 AC_SUBST(XRANDR_CFLAGS)
9614 AC_SUBST(XRANDR_LIBS)
9615 AC_SUBST(ENABLE_RANDR)
9617 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9618     WITH_WEBDAV="serf"
9620 if test $_os = iOS -o $_os = Android; then
9621     WITH_WEBDAV="no"
9623 AC_MSG_CHECKING([for webdav library])
9624 case "$WITH_WEBDAV" in
9625 serf)
9626     AC_MSG_RESULT([serf])
9627     # Check for system apr-util
9628     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9629                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9630                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9631     if test "$COM" = "MSC"; then
9632         APR_LIB_DIR="LibR"
9633         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9634         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9635     fi
9637     # Check for system serf
9638     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9639                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9640     if test "$COM" = "MSC"; then
9641         SERF_LIB_DIR="Release"
9642         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9643         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9644     fi
9645     ;;
9646 neon)
9647     AC_MSG_RESULT([neon])
9648     # Check for system neon
9649     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9650     if test "$with_system_neon" = "yes"; then
9651         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9652     else
9653         NEON_VERSION=0295
9654     fi
9655     AC_SUBST(NEON_VERSION)
9656     ;;
9658     AC_MSG_RESULT([none, disabled])
9659     WITH_WEBDAV=""
9660     ;;
9661 esac
9662 AC_SUBST(WITH_WEBDAV)
9664 dnl ===================================================================
9665 dnl Check for disabling cve_tests
9666 dnl ===================================================================
9667 AC_MSG_CHECKING([whether to execute CVE tests])
9668 # If not explicitly enabled or disabled, default
9669 if test -z "$enable_cve_tests"; then
9670     case "$OS" in
9671     WNT)
9672         # Default cves off for Windows with its wild and wonderful
9673         # variety of AV software kicking in and panicking
9674         enable_cve_tests=no
9675         ;;
9676     *)
9677         # otherwise yes
9678         enable_cve_tests=yes
9679         ;;
9680     esac
9682 if test "$enable_cve_tests" = "no"; then
9683     AC_MSG_RESULT([no])
9684     DISABLE_CVE_TESTS=TRUE
9685     AC_SUBST(DISABLE_CVE_TESTS)
9686 else
9687     AC_MSG_RESULT([yes])
9690 dnl ===================================================================
9691 dnl Check for enabling chart XShape tests
9692 dnl ===================================================================
9693 AC_MSG_CHECKING([whether to execute chart XShape tests])
9694 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9695     AC_MSG_RESULT([yes])
9696     ENABLE_CHART_TESTS=TRUE
9697     AC_SUBST(ENABLE_CHART_TESTS)
9698 else
9699     AC_MSG_RESULT([no])
9702 dnl ===================================================================
9703 dnl Check for system openssl
9704 dnl ===================================================================
9705 DISABLE_OPENSSL=
9706 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9707 if test "$enable_openssl" = "yes"; then
9708     AC_MSG_RESULT([no])
9709     if test "$_os" = Darwin ; then
9710         # OpenSSL is deprecated when building for 10.7 or later.
9711         #
9712         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9713         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9715         with_system_openssl=no
9716         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9717     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9718             && test "$with_system_openssl" != "no"; then
9719         with_system_openssl=yes
9720         SYSTEM_OPENSSL=TRUE
9721         OPENSSL_CFLAGS=
9722         OPENSSL_LIBS="-lssl -lcrypto"
9723     else
9724         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9725     fi
9726     if test "$with_system_openssl" = "yes"; then
9727         AC_MSG_CHECKING([whether openssl supports SHA512])
9728         AC_LANG_PUSH([C])
9729         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9730             SHA512_CTX context;
9731 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9732         AC_LANG_POP(C)
9733     fi
9734 else
9735     AC_MSG_RESULT([yes])
9736     DISABLE_OPENSSL=TRUE
9738     # warn that although OpenSSL is disabled, system libraries may depend on it
9739     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9740     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9743 AC_SUBST([DISABLE_OPENSSL])
9745 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9746     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9747         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9748         enable_cipher_openssl_backend=no
9749     else
9750         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9751     fi
9753 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9754 ENABLE_CIPHER_OPENSSL_BACKEND=
9755 if test "$enable_cipher_openssl_backend" = yes; then
9756     AC_MSG_RESULT([yes])
9757     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9758 else
9759     AC_MSG_RESULT([no])
9761 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9763 dnl ===================================================================
9764 dnl Check for building gnutls
9765 dnl ===================================================================
9766 AC_MSG_CHECKING([whether to use gnutls])
9767 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9768     AC_MSG_RESULT([yes])
9769     AM_PATH_LIBGCRYPT()
9770     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9771         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9772                       available in the system to use as replacement.]]))
9773     FilterLibs "${LIBGCRYPT_LIBS}"
9774     LIBGCRYPT_LIBS="${filteredlibs}"
9775 else
9776     AC_MSG_RESULT([no])
9779 AC_SUBST([LIBGCRYPT_CFLAGS])
9780 AC_SUBST([LIBGCRYPT_LIBS])
9782 dnl ===================================================================
9783 dnl Check for system redland
9784 dnl ===================================================================
9785 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9786 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9787 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9788 if test "$with_system_redland" = "yes"; then
9789     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9790             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9791 else
9792     RAPTOR_MAJOR="0"
9793     RASQAL_MAJOR="3"
9794     REDLAND_MAJOR="0"
9796 AC_SUBST(RAPTOR_MAJOR)
9797 AC_SUBST(RASQAL_MAJOR)
9798 AC_SUBST(REDLAND_MAJOR)
9800 dnl ===================================================================
9801 dnl Check for system hunspell
9802 dnl ===================================================================
9803 AC_MSG_CHECKING([which libhunspell to use])
9804 if test "$with_system_hunspell" = "yes"; then
9805     AC_MSG_RESULT([external])
9806     SYSTEM_HUNSPELL=TRUE
9807     AC_LANG_PUSH([C++])
9808     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9809     if test "$HUNSPELL_PC" != "TRUE"; then
9810         AC_CHECK_HEADER(hunspell.hxx, [],
9811             [
9812             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9813             [AC_MSG_ERROR(hunspell headers not found.)], [])
9814             ], [])
9815         AC_CHECK_LIB([hunspell], [main], [:],
9816            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9817         HUNSPELL_LIBS=-lhunspell
9818     fi
9819     AC_LANG_POP([C++])
9820     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9821     FilterLibs "${HUNSPELL_LIBS}"
9822     HUNSPELL_LIBS="${filteredlibs}"
9823 else
9824     AC_MSG_RESULT([internal])
9825     SYSTEM_HUNSPELL=
9826     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9827     if test "$COM" = "MSC"; then
9828         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9829     else
9830         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
9831     fi
9832     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9834 AC_SUBST(SYSTEM_HUNSPELL)
9835 AC_SUBST(HUNSPELL_CFLAGS)
9836 AC_SUBST(HUNSPELL_LIBS)
9838 dnl ===================================================================
9839 dnl Checking for altlinuxhyph
9840 dnl ===================================================================
9841 AC_MSG_CHECKING([which altlinuxhyph to use])
9842 if test "$with_system_altlinuxhyph" = "yes"; then
9843     AC_MSG_RESULT([external])
9844     SYSTEM_HYPH=TRUE
9845     AC_CHECK_HEADER(hyphen.h, [],
9846        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9847     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9848        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9849        [#include <hyphen.h>])
9850     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9851         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9852     if test -z "$HYPHEN_LIB"; then
9853         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9854            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9855     fi
9856     if test -z "$HYPHEN_LIB"; then
9857         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9858            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9859     fi
9860 else
9861     AC_MSG_RESULT([internal])
9862     SYSTEM_HYPH=
9863     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9864     if test "$COM" = "MSC"; then
9865         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9866     else
9867         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9868     fi
9870 AC_SUBST(SYSTEM_HYPH)
9871 AC_SUBST(HYPHEN_LIB)
9873 dnl ===================================================================
9874 dnl Checking for mythes
9875 dnl ===================================================================
9876 AC_MSG_CHECKING([which mythes to use])
9877 if test "$with_system_mythes" = "yes"; then
9878     AC_MSG_RESULT([external])
9879     SYSTEM_MYTHES=TRUE
9880     AC_LANG_PUSH([C++])
9881     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9882     if test "$MYTHES_PKGCONFIG" = "no"; then
9883         AC_CHECK_HEADER(mythes.hxx, [],
9884             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9885         AC_CHECK_LIB([mythes-1.2], [main], [:],
9886             [ MYTHES_FOUND=no], [])
9887     if test "$MYTHES_FOUND" = "no"; then
9888         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9889                 [ MYTHES_FOUND=no], [])
9890     fi
9891     if test "$MYTHES_FOUND" = "no"; then
9892         AC_MSG_ERROR([mythes library not found!.])
9893     fi
9894     fi
9895     AC_LANG_POP([C++])
9896     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9897     FilterLibs "${MYTHES_LIBS}"
9898     MYTHES_LIBS="${filteredlibs}"
9899 else
9900     AC_MSG_RESULT([internal])
9901     SYSTEM_MYTHES=
9902     BUILD_TYPE="$BUILD_TYPE MYTHES"
9903     if test "$COM" = "MSC"; then
9904         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9905     else
9906         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9907     fi
9909 AC_SUBST(SYSTEM_MYTHES)
9910 AC_SUBST(MYTHES_CFLAGS)
9911 AC_SUBST(MYTHES_LIBS)
9913 dnl ===================================================================
9914 dnl How should we build the linear programming solver ?
9915 dnl ===================================================================
9917 ENABLE_COINMP=
9918 AC_MSG_CHECKING([whether to build with CoinMP])
9919 if test "$enable_coinmp" != "no"; then
9920     ENABLE_COINMP=TRUE
9921     AC_MSG_RESULT([yes])
9922     if test "$with_system_coinmp" = "yes"; then
9923         SYSTEM_COINMP=TRUE
9924         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9925         FilterLibs "${COINMP_LIBS}"
9926         COINMP_LIBS="${filteredlibs}"
9927     else
9928         BUILD_TYPE="$BUILD_TYPE COINMP"
9929     fi
9930 else
9931     AC_MSG_RESULT([no])
9933 AC_SUBST(ENABLE_COINMP)
9934 AC_SUBST(SYSTEM_COINMP)
9935 AC_SUBST(COINMP_CFLAGS)
9936 AC_SUBST(COINMP_LIBS)
9938 ENABLE_LPSOLVE=
9939 AC_MSG_CHECKING([whether to build with lpsolve])
9940 if test "$enable_lpsolve" != "no"; then
9941     ENABLE_LPSOLVE=TRUE
9942     AC_MSG_RESULT([yes])
9943 else
9944     AC_MSG_RESULT([no])
9946 AC_SUBST(ENABLE_LPSOLVE)
9948 if test "$ENABLE_LPSOLVE" = TRUE; then
9949     AC_MSG_CHECKING([which lpsolve to use])
9950     if test "$with_system_lpsolve" = "yes"; then
9951         AC_MSG_RESULT([external])
9952         SYSTEM_LPSOLVE=TRUE
9953         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9954            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9955         save_LIBS=$LIBS
9956         # some systems need this. Like Ubuntu....
9957         AC_CHECK_LIB(m, floor)
9958         AC_CHECK_LIB(dl, dlopen)
9959         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9960             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9961         LIBS=$save_LIBS
9962     else
9963         AC_MSG_RESULT([internal])
9964         SYSTEM_LPSOLVE=
9965         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9966     fi
9968 AC_SUBST(SYSTEM_LPSOLVE)
9970 dnl ===================================================================
9971 dnl Checking for libexttextcat
9972 dnl ===================================================================
9973 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9974 if test "$with_system_libexttextcat" = "yes"; then
9975     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9977 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9979 dnl ===================================================================
9980 dnl Checking for libnumbertext
9981 dnl ===================================================================
9982 AC_MSG_CHECKING([whether to use libnumbertext])
9983 if test "$enable_libnumbertext" = "no"; then
9984     AC_MSG_RESULT([no])
9985     ENABLE_LIBNUMBERTEXT=
9986     SYSTEM_LIBNUMBERTEXT=
9987 else
9988     AC_MSG_RESULT([yes])
9989     ENABLE_LIBNUMBERTEXT=TRUE
9990     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9991     if test "$with_system_libnumbertext" = "yes"; then
9992         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9993         SYSTEM_LIBNUMBERTEXT=YES
9994     else
9995         SYSTEM_LIBNUMBERTEXT=
9996         AC_LANG_PUSH([C++])
9997         save_CPPFLAGS=$CPPFLAGS
9998         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9999         AC_CHECK_HEADERS([codecvt regex])
10000         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10001                 [ ENABLE_LIBNUMBERTEXT=''
10002                   LIBNUMBERTEXT_CFLAGS=''
10003                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10004                                Enable libnumbertext fallback (missing number to number name conversion).])
10005                 ])
10006         CPPFLAGS=$save_CPPFLAGS
10007         AC_LANG_POP([C++])
10008     fi
10009     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10010         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10011     fi
10013 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10014 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10015 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10016 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10018 dnl ***************************************
10019 dnl testing libc version for Linux...
10020 dnl ***************************************
10021 if test "$_os" = "Linux"; then
10022     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10023     exec 6>/dev/null # no output
10024     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10025     exec 6>&1 # output on again
10026     if test "$HAVE_LIBC"; then
10027         AC_MSG_RESULT([yes])
10028     else
10029         AC_MSG_ERROR([no, upgrade libc])
10030     fi
10033 dnl =========================================
10034 dnl Check for uuidgen
10035 dnl =========================================
10036 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10037     # presence is already tested above in the WINDOWS_SDK_HOME check
10038     UUIDGEN=uuidgen.exe
10039     AC_SUBST(UUIDGEN)
10040 else
10041     AC_PATH_PROG([UUIDGEN], [uuidgen])
10042     if test -z "$UUIDGEN"; then
10043         AC_MSG_WARN([uuid is needed for building installation sets])
10044     fi
10047 dnl ***************************************
10048 dnl Checking for bison and flex
10049 dnl ***************************************
10050 AC_PATH_PROG(BISON, bison)
10051 if test -z "$BISON"; then
10052     AC_MSG_ERROR([no bison found in \$PATH, install it])
10053 else
10054     AC_MSG_CHECKING([the bison version])
10055     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10056     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10057     # Accept newer than 2.0
10058     if test "$_bison_longver" -lt 2000; then
10059         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10060     fi
10063 AC_PATH_PROG(FLEX, flex)
10064 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10065     FLEX=`cygpath -m $FLEX`
10067 if test -z "$FLEX"; then
10068     AC_MSG_ERROR([no flex found in \$PATH, install it])
10069 else
10070     AC_MSG_CHECKING([the flex version])
10071     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10072     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10073         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10074     fi
10076 AC_SUBST([FLEX])
10077 dnl ***************************************
10078 dnl Checking for patch
10079 dnl ***************************************
10080 AC_PATH_PROG(PATCH, patch)
10081 if test -z "$PATCH"; then
10082     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10085 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10086 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10087     if test -z "$with_gnu_patch"; then
10088         GNUPATCH=$PATCH
10089     else
10090         if test -x "$with_gnu_patch"; then
10091             GNUPATCH=$with_gnu_patch
10092         else
10093             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10094         fi
10095     fi
10097     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10098     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10099         AC_MSG_RESULT([yes])
10100     else
10101         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10102     fi
10103 else
10104     GNUPATCH=$PATCH
10107 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10108     GNUPATCH=`cygpath -m $GNUPATCH`
10111 dnl We also need to check for --with-gnu-cp
10113 if test -z "$with_gnu_cp"; then
10114     # check the place where the good stuff is hidden on Solaris...
10115     if test -x /usr/gnu/bin/cp; then
10116         GNUCP=/usr/gnu/bin/cp
10117     else
10118         AC_PATH_PROGS(GNUCP, gnucp cp)
10119     fi
10120     if test -z $GNUCP; then
10121         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10122     fi
10123 else
10124     if test -x "$with_gnu_cp"; then
10125         GNUCP=$with_gnu_cp
10126     else
10127         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10128     fi
10131 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10132     GNUCP=`cygpath -m $GNUCP`
10135 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10136 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10137     AC_MSG_RESULT([yes])
10138 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10139     AC_MSG_RESULT([yes])
10140 else
10141     case "$build_os" in
10142     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10143         x_GNUCP=[\#]
10144         GNUCP=''
10145         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10146         ;;
10147     *)
10148         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10149         ;;
10150     esac
10153 AC_SUBST(GNUPATCH)
10154 AC_SUBST(GNUCP)
10155 AC_SUBST(x_GNUCP)
10157 dnl ***************************************
10158 dnl testing assembler path
10159 dnl ***************************************
10160 ML_EXE=""
10161 if test "$_os" = "WINNT"; then
10162     if test "$BITNESS_OVERRIDE" = ""; then
10163         assembler=ml.exe
10164         assembler_bin=$CL_DIR
10165     else
10166         assembler=ml64.exe
10167         assembler_bin=$CL_DIR
10168     fi
10170     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
10171     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
10172         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
10173         AC_MSG_RESULT([found])
10174         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
10175     else
10176         AC_MSG_ERROR([Configure did not find $assembler assembler.])
10177     fi
10179     PathFormat "$ASM_HOME"
10180     ASM_HOME="$formatted_path"
10181 else
10182     ASM_HOME=""
10185 AC_SUBST(ML_EXE)
10187 dnl ===================================================================
10188 dnl We need zip and unzip
10189 dnl ===================================================================
10190 AC_PATH_PROG(ZIP, zip)
10191 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10192 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10193     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],,)
10196 AC_PATH_PROG(UNZIP, unzip)
10197 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10199 dnl ===================================================================
10200 dnl Zip must be a specific type for different build types.
10201 dnl ===================================================================
10202 if test $build_os = cygwin; then
10203     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10204         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10205     fi
10208 dnl ===================================================================
10209 dnl We need touch with -h option support.
10210 dnl ===================================================================
10211 AC_PATH_PROG(TOUCH, touch)
10212 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10213 touch warn
10214 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10215     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],,)
10218 dnl ===================================================================
10219 dnl Check for system epoxy
10220 dnl ===================================================================
10221 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10223 dnl ===================================================================
10224 dnl Set vcl option: coordinate device in double or sal_Int32
10225 dnl ===================================================================
10227 dnl disabled for now, we don't want subtle differences between OSs
10228 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10229 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10230 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10231 dnl     AC_MSG_RESULT([double])
10232 dnl else
10233 dnl     AC_MSG_RESULT([sal_Int32])
10234 dnl fi
10236 dnl ===================================================================
10237 dnl Test which vclplugs have to be built.
10238 dnl ===================================================================
10239 R=""
10240 if test "$USING_X11" != TRUE; then
10241     enable_gtk=no
10242     enable_gtk3=no
10244 GTK3_CFLAGS=""
10245 GTK3_LIBS=""
10246 ENABLE_GTK3=""
10247 if test "x$enable_gtk3" = "xyes"; then
10248     if test "$with_system_cairo" = no; then
10249         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10250     fi
10251     : ${with_system_cairo:=yes}
10252     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, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
10253     if test "x$ENABLE_GTK3" = "xTRUE"; then
10254         R="gtk3"
10255         dnl Avoid installed by unpackaged files for now.
10256         if test -z "$PKGFORMAT"; then
10257             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10258         fi
10259     else
10260         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10261     fi
10262     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10263     FilterLibs "${GTK3_LIBS}"
10264     GTK3_LIBS="${filteredlibs}"
10266     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10267     if test "$with_system_epoxy" != "yes"; then
10268         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10269         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10270                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10271     fi
10273 AC_SUBST(GTK3_LIBS)
10274 AC_SUBST(GTK3_CFLAGS)
10275 AC_SUBST(ENABLE_GTK3)
10277 ENABLE_GTK=""
10278 if test "x$enable_gtk" = "xyes"; then
10279     if test "$with_system_cairo" = no; then
10280         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10281     fi
10282     : ${with_system_cairo:=yes}
10283     ENABLE_GTK="TRUE"
10284     AC_DEFINE(ENABLE_GTK)
10285     R="gtk $R"
10287 AC_SUBST(ENABLE_GTK)
10289 ENABLE_QT5=""
10290 if test "x$enable_qt5" = "xyes"; then
10291     ENABLE_QT5="TRUE"
10292     AC_DEFINE(ENABLE_QT5)
10293     R="$R qt5"
10295 AC_SUBST(ENABLE_QT5)
10297 ENABLE_KDE5=""
10298 if test "x$enable_kde5" = "xyes"; then
10299     ENABLE_KDE5="TRUE"
10300     AC_DEFINE(ENABLE_KDE5)
10301     R="$R kde5"
10303 AC_SUBST(ENABLE_KDE5)
10305 ENABLE_GTK3_KDE5=""
10306 if test "x$enable_gtk3_kde5" = "xyes"; then
10307     ENABLE_GTK3_KDE5="TRUE"
10308     AC_DEFINE(ENABLE_GTK3_KDE5)
10309     R="$R gtk3_kde5"
10311 AC_SUBST(ENABLE_GTK3_KDE5)
10313 build_vcl_plugins="$R"
10314 if test -z "$build_vcl_plugins"; then
10315     build_vcl_plugins="none"
10317 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10319 dnl ===================================================================
10320 dnl check for dbus support
10321 dnl ===================================================================
10322 ENABLE_DBUS=""
10323 DBUS_CFLAGS=""
10324 DBUS_LIBS=""
10325 DBUS_GLIB_CFLAGS=""
10326 DBUS_GLIB_LIBS=""
10327 DBUS_HAVE_GLIB=""
10329 if test "$enable_dbus" = "no"; then
10330     test_dbus=no
10333 AC_MSG_CHECKING([whether to enable DBUS support])
10334 if test "$test_dbus" = "yes"; then
10335     ENABLE_DBUS="TRUE"
10336     AC_MSG_RESULT([yes])
10337     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10338     AC_DEFINE(ENABLE_DBUS)
10339     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10340     FilterLibs "${DBUS_LIBS}"
10341     DBUS_LIBS="${filteredlibs}"
10343     # Glib is needed for BluetoothServer
10344     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10345     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10346         [
10347             DBUS_HAVE_GLIB="TRUE"
10348             AC_DEFINE(DBUS_HAVE_GLIB,1)
10349         ],
10350         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10351     )
10352 else
10353     AC_MSG_RESULT([no])
10356 AC_SUBST(ENABLE_DBUS)
10357 AC_SUBST(DBUS_CFLAGS)
10358 AC_SUBST(DBUS_LIBS)
10359 AC_SUBST(DBUS_GLIB_CFLAGS)
10360 AC_SUBST(DBUS_GLIB_LIBS)
10361 AC_SUBST(DBUS_HAVE_GLIB)
10363 AC_MSG_CHECKING([whether to enable Impress remote control])
10364 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10365     AC_MSG_RESULT([yes])
10366     ENABLE_SDREMOTE=TRUE
10367     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10369     # If not explicitly enabled or disabled, default
10370     if test -z "$enable_sdremote_bluetooth"; then
10371         case "$OS" in
10372         LINUX|MACOSX|WNT)
10373             # Default to yes for these
10374             enable_sdremote_bluetooth=yes
10375             ;;
10376         *)
10377             # otherwise no
10378             enable_sdremote_bluetooth=no
10379             ;;
10380         esac
10381     fi
10382     # $enable_sdremote_bluetooth is guaranteed non-empty now
10384     if test "$enable_sdremote_bluetooth" != "no"; then
10385         if test "$OS" = "LINUX"; then
10386             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10387                 AC_MSG_RESULT([yes])
10388                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10389                 dnl ===================================================================
10390                 dnl Check for system bluez
10391                 dnl ===================================================================
10392                 AC_MSG_CHECKING([which Bluetooth header to use])
10393                 if test "$with_system_bluez" = "yes"; then
10394                     AC_MSG_RESULT([external])
10395                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10396                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10397                     SYSTEM_BLUEZ=TRUE
10398                 else
10399                     AC_MSG_RESULT([internal])
10400                     SYSTEM_BLUEZ=
10401                 fi
10402             else
10403                 AC_MSG_RESULT([no, dbus disabled])
10404                 ENABLE_SDREMOTE_BLUETOOTH=
10405                 SYSTEM_BLUEZ=
10406             fi
10407         else
10408             AC_MSG_RESULT([yes])
10409             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10410             SYSTEM_BLUEZ=
10411         fi
10412     else
10413         AC_MSG_RESULT([no])
10414         ENABLE_SDREMOTE_BLUETOOTH=
10415         SYSTEM_BLUEZ=
10416     fi
10417 else
10418     ENABLE_SDREMOTE=
10419     SYSTEM_BLUEZ=
10420     AC_MSG_RESULT([no])
10422 AC_SUBST(ENABLE_SDREMOTE)
10423 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10424 AC_SUBST(SYSTEM_BLUEZ)
10426 dnl ===================================================================
10427 dnl Check whether the gtk 2.0 libraries are available.
10428 dnl ===================================================================
10430 GTK_CFLAGS=""
10431 GTK_LIBS=""
10432 if test  "$test_gtk" = "yes"; then
10434     if test "$ENABLE_GTK" = "TRUE"; then
10435         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0 gdk-pixbuf-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10436         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10437         FilterLibs "${GTK_LIBS}"
10438         GTK_LIBS="${filteredlibs}"
10439         PKG_CHECK_MODULES(GTHREAD, gthread-2.0,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10440         BUILD_TYPE="$BUILD_TYPE GTK"
10441         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10442         FilterLibs "${GTHREAD_LIBS}"
10443         GTHREAD_LIBS="${filteredlibs}"
10445         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10446         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10447                           [ENABLE_GTK_PRINT="TRUE"],
10448                           [ENABLE_GTK_PRINT=""])
10449         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10450         FilterLibs "${GTK_PRINT_LIBS}"
10451         GTK_PRINT_LIBS="${filteredlibs}"
10452     fi
10454     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10455         AC_MSG_CHECKING([whether to enable GIO support])
10456         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10457             dnl Need at least 2.26 for the dbus support.
10458             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10459                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10460             if test "$ENABLE_GIO" = "TRUE"; then
10461                 AC_DEFINE(ENABLE_GIO)
10462                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10463                 FilterLibs "${GIO_LIBS}"
10464                 GIO_LIBS="${filteredlibs}"
10465             fi
10466         else
10467             AC_MSG_RESULT([no])
10468         fi
10469     fi
10471 AC_SUBST(ENABLE_GIO)
10472 AC_SUBST(GIO_CFLAGS)
10473 AC_SUBST(GIO_LIBS)
10474 AC_SUBST(GTK_CFLAGS)
10475 AC_SUBST(GTK_LIBS)
10476 AC_SUBST(GTHREAD_CFLAGS)
10477 AC_SUBST(GTHREAD_LIBS)
10478 AC_SUBST([ENABLE_GTK_PRINT])
10479 AC_SUBST([GTK_PRINT_CFLAGS])
10480 AC_SUBST([GTK_PRINT_LIBS])
10483 dnl ===================================================================
10485 SPLIT_APP_MODULES=""
10486 if test "$enable_split_app_modules" = "yes"; then
10487     SPLIT_APP_MODULES="TRUE"
10489 AC_SUBST(SPLIT_APP_MODULES)
10491 SPLIT_OPT_FEATURES=""
10492 if test "$enable_split_opt_features" = "yes"; then
10493     SPLIT_OPT_FEATURES="TRUE"
10495 AC_SUBST(SPLIT_OPT_FEATURES)
10497 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10498     if test "$enable_cairo_canvas" = yes; then
10499         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10500     fi
10501     enable_cairo_canvas=no
10502 elif test -z "$enable_cairo_canvas"; then
10503     enable_cairo_canvas=yes
10506 ENABLE_CAIRO_CANVAS=""
10507 if test "$enable_cairo_canvas" = "yes"; then
10508     test_cairo=yes
10509     ENABLE_CAIRO_CANVAS="TRUE"
10510     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10512 AC_SUBST(ENABLE_CAIRO_CANVAS)
10514 dnl ===================================================================
10515 dnl Check whether the GStreamer libraries are available.
10516 dnl It's possible to build avmedia with both GStreamer backends!
10517 dnl ===================================================================
10519 ENABLE_GSTREAMER_1_0=""
10521 if test "$build_gstreamer_1_0" = "yes"; then
10523     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10524     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10525         ENABLE_GSTREAMER_1_0="TRUE"
10526         AC_MSG_RESULT([yes])
10527         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10528         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10529         FilterLibs "${GSTREAMER_1_0_LIBS}"
10530         GSTREAMER_1_0_LIBS="${filteredlibs}"
10531     else
10532         AC_MSG_RESULT([no])
10533     fi
10535 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10536 AC_SUBST(GSTREAMER_1_0_LIBS)
10537 AC_SUBST(ENABLE_GSTREAMER_1_0)
10540 ENABLE_GSTREAMER_0_10=""
10541 if test "$build_gstreamer_0_10" = "yes"; then
10543     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10544     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10545         ENABLE_GSTREAMER_0_10="TRUE"
10546         AC_MSG_RESULT([yes])
10547         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10548             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10549         ])
10550         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10551         FilterLibs "${GSTREAMER_0_10_LIBS}"
10552         GSTREAMER_0_10_LIBS="${filteredlibs}"
10553     else
10554         AC_MSG_RESULT([no])
10555     fi
10558 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10559 AC_SUBST(GSTREAMER_0_10_LIBS)
10560 AC_SUBST(ENABLE_GSTREAMER_0_10)
10562 dnl ===================================================================
10563 dnl Check whether to build the VLC avmedia backend
10564 dnl ===================================================================
10566 ENABLE_VLC=""
10568 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10569 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10570     ENABLE_VLC="TRUE"
10571     AC_MSG_RESULT([yes])
10572 else
10573     AC_MSG_RESULT([no])
10575 AC_SUBST(ENABLE_VLC)
10577 ENABLE_OPENGL_TRANSITIONS=
10578 ENABLE_OPENGL_CANVAS=
10579 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10580    : # disable
10581 elif test "$_os" = "Darwin"; then
10582     # We use frameworks on macOS, no need for detail checks
10583     ENABLE_OPENGL_TRANSITIONS=TRUE
10584     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10585     ENABLE_OPENGL_CANVAS=TRUE
10586 elif test $_os = WINNT; then
10587     ENABLE_OPENGL_TRANSITIONS=TRUE
10588     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10589     ENABLE_OPENGL_CANVAS=TRUE
10590 else
10591     if test "$USING_X11" = TRUE; then
10592         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10593         ENABLE_OPENGL_TRANSITIONS=TRUE
10594         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10595         ENABLE_OPENGL_CANVAS=TRUE
10596     fi
10599 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10600 AC_SUBST(ENABLE_OPENGL_CANVAS)
10602 dnl =================================================
10603 dnl Check whether to build with OpenCL support.
10604 dnl =================================================
10606 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10607     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10608     # platform (optional at run-time, used through clew).
10609     BUILD_TYPE="$BUILD_TYPE OPENCL"
10610     AC_DEFINE(HAVE_FEATURE_OPENCL)
10613 dnl =================================================
10614 dnl Check whether to build with dconf support.
10615 dnl =================================================
10617 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10618     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10619         if test "$enable_dconf" = yes; then
10620             AC_MSG_ERROR([dconf not found])
10621         else
10622             enable_dconf=no
10623         fi])
10625 AC_MSG_CHECKING([whether to enable dconf])
10626 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10627     DCONF_CFLAGS=
10628     DCONF_LIBS=
10629     ENABLE_DCONF=
10630     AC_MSG_RESULT([no])
10631 else
10632     ENABLE_DCONF=TRUE
10633     AC_DEFINE(ENABLE_DCONF)
10634     AC_MSG_RESULT([yes])
10636 AC_SUBST([DCONF_CFLAGS])
10637 AC_SUBST([DCONF_LIBS])
10638 AC_SUBST([ENABLE_DCONF])
10640 # pdf import?
10641 AC_MSG_CHECKING([whether to build the PDF import feature])
10642 ENABLE_PDFIMPORT=
10643 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10644     AC_MSG_RESULT([yes])
10645     ENABLE_PDFIMPORT=TRUE
10646     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10648     dnl ===================================================================
10649     dnl Check for system poppler
10650     dnl ===================================================================
10651     AC_MSG_CHECKING([which PDF import backend to use])
10652     if test "$with_system_poppler" = "yes"; then
10653         AC_MSG_RESULT([external])
10654         SYSTEM_POPPLER=TRUE
10655         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10656         AC_LANG_PUSH([C++])
10657         save_CXXFLAGS=$CXXFLAGS
10658         save_CPPFLAGS=$CPPFLAGS
10659         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10660         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10661         AC_CHECK_HEADER([cpp/poppler-version.h],
10662             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10663             [])
10664         CXXFLAGS=$save_CXXFLAGS
10665         CPPFLAGS=$save_CPPFLAGS
10666         AC_LANG_POP([C++])
10667         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10669         FilterLibs "${POPPLER_LIBS}"
10670         POPPLER_LIBS="${filteredlibs}"
10671     else
10672         AC_MSG_RESULT([internal])
10673         SYSTEM_POPPLER=
10674         BUILD_TYPE="$BUILD_TYPE POPPLER"
10675         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10676     fi
10677     AC_DEFINE([ENABLE_PDFIMPORT],1)
10678 else
10679     AC_MSG_RESULT([no])
10681 AC_SUBST(ENABLE_PDFIMPORT)
10682 AC_SUBST(SYSTEM_POPPLER)
10683 AC_SUBST(POPPLER_CFLAGS)
10684 AC_SUBST(POPPLER_LIBS)
10686 # pdf import?
10687 AC_MSG_CHECKING([whether to build PDFium])
10688 ENABLE_PDFIUM=
10689 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10690     AC_MSG_RESULT([yes])
10691     ENABLE_PDFIUM=TRUE
10692     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10693     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10694 else
10695     AC_MSG_RESULT([no])
10697 AC_SUBST(ENABLE_PDFIUM)
10699 SYSTEM_GPGMEPP=
10701 if test "$build_for_ios" = "YES"; then
10702     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10703     AC_MSG_RESULT([yes])
10704 elif test "$enable_mpl_subset" = "yes"; then
10705     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10706     AC_MSG_RESULT([yes])
10707 elif test "$enable_fuzzers" = "yes"; then
10708     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10709     AC_MSG_RESULT([yes])
10710 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10711     dnl ===================================================================
10712     dnl Check for system gpgme
10713     dnl ===================================================================
10714     AC_MSG_CHECKING([which gpgmepp to use])
10715     if test "$with_system_gpgmepp" = "yes"; then
10716         AC_MSG_RESULT([external])
10717         SYSTEM_GPGMEPP=TRUE
10719         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10720         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10721             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10722         # progress_callback is the only func with plain C linkage
10723         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10724         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10725             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10726         AC_CHECK_HEADER(gpgme.h, [],
10727             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10728     else
10729         AC_MSG_RESULT([internal])
10730         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10731         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10733         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10734         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10735         if test "$_os" != "WINNT"; then
10736             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10737             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10738         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10739             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10740         fi
10741     fi
10742     ENABLE_GPGMEPP=TRUE
10743     AC_DEFINE([HAVE_FEATURE_GPGME])
10744     AC_PATH_PROG(GPG, gpg)
10745     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10746     # so let's exclude that manually for the moment
10747     if test -n "$GPG" -a "$_os" != "WINNT"; then
10748         # make sure we not only have a working gpgme, but a full working
10749         # gpg installation to run OpenPGP signature verification
10750         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10751     fi
10752     if test "$_os" = "Linux"; then
10753       uid=`id -u`
10754       AC_MSG_CHECKING([for /run/user/$uid])
10755       if test -d /run/user/$uid; then
10756         AC_MSG_RESULT([yes])
10757         AC_PATH_PROG(GPGCONF, gpgconf)
10759         # Older versions of gpgconf are not working as expected, since
10760         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10761         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10762         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10763         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10764         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10765         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10766         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10767           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10768           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10769           if $GPGCONF --dump-options > /dev/null ; then
10770             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10771               AC_MSG_RESULT([yes])
10772               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10773               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10774             else
10775               AC_MSG_RESULT([no])
10776             fi
10777           else
10778             AC_MSG_RESULT([no. missing or broken gpgconf?])
10779           fi
10780         else
10781           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10782         fi
10783       else
10784         AC_MSG_RESULT([no])
10785      fi
10786    fi
10788 AC_SUBST(ENABLE_GPGMEPP)
10789 AC_SUBST(SYSTEM_GPGMEPP)
10790 AC_SUBST(GPG_ERROR_CFLAGS)
10791 AC_SUBST(GPG_ERROR_LIBS)
10792 AC_SUBST(LIBASSUAN_CFLAGS)
10793 AC_SUBST(LIBASSUAN_LIBS)
10794 AC_SUBST(GPGMEPP_CFLAGS)
10795 AC_SUBST(GPGMEPP_LIBS)
10797 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10798 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10799     AC_MSG_RESULT([yes])
10800     ENABLE_MEDIAWIKI=TRUE
10801     BUILD_TYPE="$BUILD_TYPE XSLTML"
10802     if test  "x$with_java" = "xno"; then
10803         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10804     fi
10805 else
10806     AC_MSG_RESULT([no])
10807     ENABLE_MEDIAWIKI=
10808     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10810 AC_SUBST(ENABLE_MEDIAWIKI)
10812 AC_MSG_CHECKING([whether to build the Report Builder])
10813 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10814     AC_MSG_RESULT([yes])
10815     ENABLE_REPORTBUILDER=TRUE
10816     AC_MSG_CHECKING([which jfreereport libs to use])
10817     if test "$with_system_jfreereport" = "yes"; then
10818         SYSTEM_JFREEREPORT=TRUE
10819         AC_MSG_RESULT([external])
10820         if test -z $SAC_JAR; then
10821             SAC_JAR=/usr/share/java/sac.jar
10822         fi
10823         if ! test -f $SAC_JAR; then
10824              AC_MSG_ERROR(sac.jar not found.)
10825         fi
10827         if test -z $LIBXML_JAR; then
10828             if test -f /usr/share/java/libxml-1.0.0.jar; then
10829                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10830             elif test -f /usr/share/java/libxml.jar; then
10831                 LIBXML_JAR=/usr/share/java/libxml.jar
10832             else
10833                 AC_MSG_ERROR(libxml.jar replacement not found.)
10834             fi
10835         elif ! test -f $LIBXML_JAR; then
10836             AC_MSG_ERROR(libxml.jar not found.)
10837         fi
10839         if test -z $FLUTE_JAR; then
10840             if test -f/usr/share/java/flute-1.3.0.jar; then
10841                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10842             elif test -f /usr/share/java/flute.jar; then
10843                 FLUTE_JAR=/usr/share/java/flute.jar
10844             else
10845                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10846             fi
10847         elif ! test -f $FLUTE_JAR; then
10848             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10849         fi
10851         if test -z $JFREEREPORT_JAR; then
10852             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10853                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10854             elif test -f /usr/share/java/flow-engine.jar; then
10855                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10856             else
10857                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10858             fi
10859         elif ! test -f  $JFREEREPORT_JAR; then
10860                 AC_MSG_ERROR(jfreereport.jar not found.)
10861         fi
10863         if test -z $LIBLAYOUT_JAR; then
10864             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10865                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10866             elif test -f /usr/share/java/liblayout.jar; then
10867                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10868             else
10869                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10870             fi
10871         elif ! test -f $LIBLAYOUT_JAR; then
10872                 AC_MSG_ERROR(liblayout.jar not found.)
10873         fi
10875         if test -z $LIBLOADER_JAR; then
10876             if test -f /usr/share/java/libloader-1.0.0.jar; then
10877                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10878             elif test -f /usr/share/java/libloader.jar; then
10879                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10880             else
10881                 AC_MSG_ERROR(libloader.jar replacement not found.)
10882             fi
10883         elif ! test -f  $LIBLOADER_JAR; then
10884             AC_MSG_ERROR(libloader.jar not found.)
10885         fi
10887         if test -z $LIBFORMULA_JAR; then
10888             if test -f /usr/share/java/libformula-0.2.0.jar; then
10889                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10890             elif test -f /usr/share/java/libformula.jar; then
10891                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10892             else
10893                 AC_MSG_ERROR(libformula.jar replacement not found.)
10894             fi
10895         elif ! test -f $LIBFORMULA_JAR; then
10896                 AC_MSG_ERROR(libformula.jar not found.)
10897         fi
10899         if test -z $LIBREPOSITORY_JAR; then
10900             if test -f /usr/share/java/librepository-1.0.0.jar; then
10901                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10902             elif test -f /usr/share/java/librepository.jar; then
10903                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10904             else
10905                 AC_MSG_ERROR(librepository.jar replacement not found.)
10906             fi
10907         elif ! test -f $LIBREPOSITORY_JAR; then
10908             AC_MSG_ERROR(librepository.jar not found.)
10909         fi
10911         if test -z $LIBFONTS_JAR; then
10912             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10913                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10914             elif test -f /usr/share/java/libfonts.jar; then
10915                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10916             else
10917                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10918             fi
10919         elif ! test -f $LIBFONTS_JAR; then
10920                 AC_MSG_ERROR(libfonts.jar not found.)
10921         fi
10923         if test -z $LIBSERIALIZER_JAR; then
10924             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10925                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10926             elif test -f /usr/share/java/libserializer.jar; then
10927                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10928             else
10929                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10930             fi
10931         elif ! test -f $LIBSERIALIZER_JAR; then
10932                 AC_MSG_ERROR(libserializer.jar not found.)
10933         fi
10935         if test -z $LIBBASE_JAR; then
10936             if test -f /usr/share/java/libbase-1.0.0.jar; then
10937                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10938             elif test -f /usr/share/java/libbase.jar; then
10939                 LIBBASE_JAR=/usr/share/java/libbase.jar
10940             else
10941                 AC_MSG_ERROR(libbase.jar replacement not found.)
10942             fi
10943         elif ! test -f $LIBBASE_JAR; then
10944             AC_MSG_ERROR(libbase.jar not found.)
10945         fi
10947     else
10948         AC_MSG_RESULT([internal])
10949         SYSTEM_JFREEREPORT=
10950         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10951         NEED_ANT=TRUE
10952     fi
10953 else
10954     AC_MSG_RESULT([no])
10955     ENABLE_REPORTBUILDER=
10956     SYSTEM_JFREEREPORT=
10958 AC_SUBST(ENABLE_REPORTBUILDER)
10959 AC_SUBST(SYSTEM_JFREEREPORT)
10960 AC_SUBST(SAC_JAR)
10961 AC_SUBST(LIBXML_JAR)
10962 AC_SUBST(FLUTE_JAR)
10963 AC_SUBST(JFREEREPORT_JAR)
10964 AC_SUBST(LIBBASE_JAR)
10965 AC_SUBST(LIBLAYOUT_JAR)
10966 AC_SUBST(LIBLOADER_JAR)
10967 AC_SUBST(LIBFORMULA_JAR)
10968 AC_SUBST(LIBREPOSITORY_JAR)
10969 AC_SUBST(LIBFONTS_JAR)
10970 AC_SUBST(LIBSERIALIZER_JAR)
10972 # this has to be here because both the Wiki Publisher and the SRB use
10973 # commons-logging
10974 COMMONS_LOGGING_VERSION=1.2
10975 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10976     AC_MSG_CHECKING([which Apache commons-* libs to use])
10977     if test "$with_system_apache_commons" = "yes"; then
10978         SYSTEM_APACHE_COMMONS=TRUE
10979         AC_MSG_RESULT([external])
10980         if test -z $COMMONS_LOGGING_JAR; then
10981             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10982                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10983            elif test -f /usr/share/java/commons-logging.jar; then
10984                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10985             else
10986                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10987             fi
10988         elif ! test -f $COMMONS_LOGGING_JAR; then
10989             AC_MSG_ERROR(commons-logging.jar not found.)
10990         fi
10991     else
10992         AC_MSG_RESULT([internal])
10993         SYSTEM_APACHE_COMMONS=
10994         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10995         NEED_ANT=TRUE
10996     fi
10998 AC_SUBST(SYSTEM_APACHE_COMMONS)
10999 AC_SUBST(COMMONS_LOGGING_JAR)
11000 AC_SUBST(COMMONS_LOGGING_VERSION)
11002 # scripting provider for BeanShell?
11003 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11004 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11005     AC_MSG_RESULT([yes])
11006     ENABLE_SCRIPTING_BEANSHELL=TRUE
11008     dnl ===================================================================
11009     dnl Check for system beanshell
11010     dnl ===================================================================
11011     AC_MSG_CHECKING([which beanshell to use])
11012     if test "$with_system_beanshell" = "yes"; then
11013         AC_MSG_RESULT([external])
11014         SYSTEM_BSH=TRUE
11015         if test -z $BSH_JAR; then
11016             BSH_JAR=/usr/share/java/bsh.jar
11017         fi
11018         if ! test -f $BSH_JAR; then
11019             AC_MSG_ERROR(bsh.jar not found.)
11020         fi
11021     else
11022         AC_MSG_RESULT([internal])
11023         SYSTEM_BSH=
11024         BUILD_TYPE="$BUILD_TYPE BSH"
11025     fi
11026 else
11027     AC_MSG_RESULT([no])
11028     ENABLE_SCRIPTING_BEANSHELL=
11029     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11031 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11032 AC_SUBST(SYSTEM_BSH)
11033 AC_SUBST(BSH_JAR)
11035 # scripting provider for JavaScript?
11036 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11037 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11038     AC_MSG_RESULT([yes])
11039     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11041     dnl ===================================================================
11042     dnl Check for system rhino
11043     dnl ===================================================================
11044     AC_MSG_CHECKING([which rhino to use])
11045     if test "$with_system_rhino" = "yes"; then
11046         AC_MSG_RESULT([external])
11047         SYSTEM_RHINO=TRUE
11048         if test -z $RHINO_JAR; then
11049             RHINO_JAR=/usr/share/java/js.jar
11050         fi
11051         if ! test -f $RHINO_JAR; then
11052             AC_MSG_ERROR(js.jar not found.)
11053         fi
11054     else
11055         AC_MSG_RESULT([internal])
11056         SYSTEM_RHINO=
11057         BUILD_TYPE="$BUILD_TYPE RHINO"
11058         NEED_ANT=TRUE
11059     fi
11060 else
11061     AC_MSG_RESULT([no])
11062     ENABLE_SCRIPTING_JAVASCRIPT=
11063     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11065 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11066 AC_SUBST(SYSTEM_RHINO)
11067 AC_SUBST(RHINO_JAR)
11069 # This is only used in Qt5/KDE5 checks to determine if /usr/lib64
11070 # paths should be added to library search path. So lets put all 64-bit
11071 # platforms there.
11072 supports_multilib=
11073 case "$host_cpu" in
11074 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11075     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11076         supports_multilib="yes"
11077     fi
11078     ;;
11080     ;;
11081 esac
11083 dnl ===================================================================
11084 dnl QT5 Integration
11085 dnl ===================================================================
11087 QT5_CFLAGS=""
11088 QT5_LIBS=""
11089 QMAKE5="qmake"
11090 MOC5="moc"
11091 QT5_GLIB_CFLAGS=""
11092 QT5_GLIB_LIBS=""
11093 QT5_HAVE_GLIB=""
11094 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11095         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11096         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11097 then
11098     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11099     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11101     if test -n "$supports_multilib"; then
11102         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11103     fi
11105     qt5_test_include="QtWidgets/qapplication.h"
11106     qt5_test_library="libQt5Widgets.so"
11108     dnl Check for qmake5
11109     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11110     if test "$QMAKE5" = "no"; then
11111         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11112     else
11113         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11114         if test -z "$qmake5_test_ver"; then
11115             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11116         fi
11117         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11118         qt5_minimal_minor="6"
11119         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11120             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11121         else
11122             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11123         fi
11124     fi
11126     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11127     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11129     AC_MSG_CHECKING([for Qt5 headers])
11130     qt5_incdir="no"
11131     for inc_dir in $qt5_incdirs; do
11132         if test -r "$inc_dir/$qt5_test_include"; then
11133             qt5_incdir="$inc_dir"
11134             break
11135         fi
11136     done
11137     AC_MSG_RESULT([$qt5_incdir])
11138     if test "x$qt5_incdir" = "xno"; then
11139         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11140     fi
11142     AC_MSG_CHECKING([for Qt5 libraries])
11143     qt5_libdir="no"
11144     for lib_dir in $qt5_libdirs; do
11145         if test -r "$lib_dir/$qt5_test_library"; then
11146             qt5_libdir="$lib_dir"
11147             break
11148         fi
11149     done
11150     AC_MSG_RESULT([$qt5_libdir])
11151     if test "x$qt5_libdir" = "xno"; then
11152         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11153     fi
11155     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11156     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11157     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11159     dnl Check for Meta Object Compiler
11161     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11162     if test "$MOC5" = "no"; then
11163         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11164 the root of your Qt installation by exporting QT5DIR before running "configure".])
11165     fi
11167     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11168     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11169     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11170         [
11171             QT5_HAVE_GLIB=1
11172             AC_DEFINE(QT5_HAVE_GLIB,1)
11173         ],
11174         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11175     )
11177 AC_SUBST(QT5_CFLAGS)
11178 AC_SUBST(QT5_LIBS)
11179 AC_SUBST(MOC5)
11180 AC_SUBST(QT5_GLIB_CFLAGS)
11181 AC_SUBST(QT5_GLIB_LIBS)
11182 AC_SUBST(QT5_HAVE_GLIB)
11184 dnl ===================================================================
11185 dnl KDE5 Integration
11186 dnl ===================================================================
11188 KF5_CFLAGS=""
11189 KF5_LIBS=""
11190 KF5_CONFIG="kf5-config"
11191 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11192         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11193         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11194 then
11195     if test "$OS" = "HAIKU"; then
11196         haiku_arch="`echo $RTL_ARCH | tr X x`"
11197         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11198         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11199     fi
11201     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11202     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11203     if test -n "$supports_multilib"; then
11204         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11205     fi
11207     kf5_test_include="KF5/kcoreaddons_version.h"
11208     kf5_test_library="libKF5CoreAddons.so"
11209     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11211     dnl kf5 KDE4 support compatibility installed
11212     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11213     if test "$KF5_CONFIG" != "no"; then
11214         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11215         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11216     fi
11218     dnl Check for KF5 headers
11219     AC_MSG_CHECKING([for KF5 headers])
11220     kf5_incdir="no"
11221     for kf5_check in $kf5_incdirs; do
11222         if test -r "$kf5_check/$kf5_test_include"; then
11223             kf5_incdir="$kf5_check/KF5"
11224             break
11225         fi
11226     done
11227     AC_MSG_RESULT([$kf5_incdir])
11228     if test "x$kf5_incdir" = "xno"; then
11229         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11230     fi
11232     dnl Check for KF5 libraries
11233     AC_MSG_CHECKING([for KF5 libraries])
11234     kf5_libdir="no"
11235     for kf5_check in $kf5_libdirs; do
11236         if test -r "$kf5_check/$kf5_test_library"; then
11237             kf5_libdir="$kf5_check"
11238             break
11239         fi
11240     done
11242     AC_MSG_RESULT([$kf5_libdir])
11243     if test "x$kf5_libdir" = "xno"; then
11244         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11245     fi
11247     if test "$USING_X11" = TRUE; then
11248         PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11249     fi
11251     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 $KF5_XCB_CFLAGS"
11252     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11253     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11255     if test "$USING_X11" = TRUE; then
11256         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11257     fi
11259     AC_LANG_PUSH([C++])
11260     save_CXXFLAGS=$CXXFLAGS
11261     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11262     AC_MSG_CHECKING([whether KDE is >= 5.0])
11263        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11264 #include <kcoreaddons_version.h>
11266 int main(int argc, char **argv) {
11267        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11268        else return 1;
11270        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11271     CXXFLAGS=$save_CXXFLAGS
11272     AC_LANG_POP([C++])
11274 AC_SUBST(KF5_CFLAGS)
11275 AC_SUBST(KF5_LIBS)
11277 dnl ===================================================================
11278 dnl Test whether to include Evolution 2 support
11279 dnl ===================================================================
11280 AC_MSG_CHECKING([whether to enable evolution 2 support])
11281 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11282     AC_MSG_RESULT([yes])
11283     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11284     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11285     FilterLibs "${GOBJECT_LIBS}"
11286     GOBJECT_LIBS="${filteredlibs}"
11287     ENABLE_EVOAB2="TRUE"
11288 else
11289     ENABLE_EVOAB2=""
11290     AC_MSG_RESULT([no])
11292 AC_SUBST(ENABLE_EVOAB2)
11293 AC_SUBST(GOBJECT_CFLAGS)
11294 AC_SUBST(GOBJECT_LIBS)
11296 dnl ===================================================================
11297 dnl Test which themes to include
11298 dnl ===================================================================
11299 AC_MSG_CHECKING([which themes to include])
11300 # if none given use default subset of available themes
11301 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11302     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga sifr sifr_dark tango"
11305 WITH_THEMES=""
11306 if test "x$with_theme" != "xno"; then
11307     for theme in $with_theme; do
11308         case $theme in
11309         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11310         default) real_theme=colibre ;;
11311         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11312         esac
11313         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11314     done
11316 AC_MSG_RESULT([$WITH_THEMES])
11317 AC_SUBST([WITH_THEMES])
11318 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11319 for theme in $with_theme; do
11320     case $theme in
11321     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11322     *) ;;
11323     esac
11324 done
11326 dnl ===================================================================
11327 dnl Test whether to integrate helppacks into the product's installer
11328 dnl ===================================================================
11329 AC_MSG_CHECKING([for helppack integration])
11330 if test "$with_helppack_integration" = "no"; then
11331     AC_MSG_RESULT([no integration])
11332 else
11333     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11334     AC_MSG_RESULT([integration])
11337 ###############################################################################
11338 # Extensions checking
11339 ###############################################################################
11340 AC_MSG_CHECKING([for extensions integration])
11341 if test "x$enable_extension_integration" != "xno"; then
11342     WITH_EXTENSION_INTEGRATION=TRUE
11343     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11344     AC_MSG_RESULT([yes, use integration])
11345 else
11346     WITH_EXTENSION_INTEGRATION=
11347     AC_MSG_RESULT([no, do not integrate])
11349 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11351 dnl Should any extra extensions be included?
11352 dnl There are standalone tests for each of these below.
11353 WITH_EXTRA_EXTENSIONS=
11354 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11356 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11357 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11358 if test "x$with_java" != "xno"; then
11359     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11360     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11363 AC_MSG_CHECKING([whether to build opens___.ttf])
11364 if test "$enable_build_opensymbol" = "yes"; then
11365     AC_MSG_RESULT([yes])
11366     AC_PATH_PROG(FONTFORGE, fontforge)
11367     if test -z "$FONTFORGE"; then
11368         AC_MSG_ERROR([fontforge not installed])
11369     fi
11370 else
11371     AC_MSG_RESULT([no])
11372     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11373     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11375 AC_SUBST(OPENSYMBOL_TTF)
11376 AC_SUBST(FONTFORGE)
11378 dnl ===================================================================
11379 dnl Test whether to include fonts
11380 dnl ===================================================================
11381 AC_MSG_CHECKING([whether to include third-party fonts])
11382 if test "$with_fonts" != "no"; then
11383     AC_MSG_RESULT([yes])
11384     WITH_FONTS=TRUE
11385     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11386     AC_DEFINE(HAVE_MORE_FONTS)
11387 else
11388     AC_MSG_RESULT([no])
11389     WITH_FONTS=
11390     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11392 AC_SUBST(WITH_FONTS)
11395 dnl ===================================================================
11396 dnl Test whether to enable online update service
11397 dnl ===================================================================
11398 AC_MSG_CHECKING([whether to enable online update])
11399 ENABLE_ONLINE_UPDATE=
11400 ENABLE_ONLINE_UPDATE_MAR=
11401 UPDATE_CONFIG=
11402 if test "$enable_online_update" = ""; then
11403     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11404         AC_MSG_RESULT([yes])
11405         ENABLE_ONLINE_UPDATE="TRUE"
11406     else
11407         AC_MSG_RESULT([no])
11408     fi
11409 else
11410     if test "$enable_online_update" = "mar"; then
11411         AC_MSG_RESULT([yes - MAR-based online update])
11412         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11413         if test "$with_update_config" = ""; then
11414             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11415         fi
11416         UPDATE_CONFIG="$with_update_config"
11417         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11418     elif test "$enable_online_update" = "yes"; then
11419         AC_MSG_RESULT([yes])
11420         ENABLE_ONLINE_UPDATE="TRUE"
11421     else
11422         AC_MSG_RESULT([no])
11423     fi
11425 AC_SUBST(ENABLE_ONLINE_UPDATE)
11426 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11427 AC_SUBST(UPDATE_CONFIG)
11429 dnl ===================================================================
11430 dnl Test whether we need bzip2
11431 dnl ===================================================================
11432 SYSTEM_BZIP2=
11433 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11434     AC_MSG_CHECKING([whether to use system bzip2])
11435     if test "$with_system_bzip2" = yes; then
11436         SYSTEM_BZIP2=TRUE
11437         AC_MSG_RESULT([yes])
11438         PKG_CHECK_MODULES(BZIP2, bzip2)
11439         FilterLibs "${BZIP2_LIBS}"
11440         BZIP2_LIBS="${filteredlibs}"
11441     else
11442         AC_MSG_RESULT([no])
11443         BUILD_TYPE="$BUILD_TYPE BZIP2"
11444     fi
11446 AC_SUBST(SYSTEM_BZIP2)
11447 AC_SUBST(BZIP2_CFLAGS)
11448 AC_SUBST(BZIP2_LIBS)
11450 dnl ===================================================================
11451 dnl Test whether to enable extension update
11452 dnl ===================================================================
11453 AC_MSG_CHECKING([whether to enable extension update])
11454 ENABLE_EXTENSION_UPDATE=
11455 if test "x$enable_extension_update" = "xno"; then
11456     AC_MSG_RESULT([no])
11457 else
11458     AC_MSG_RESULT([yes])
11459     ENABLE_EXTENSION_UPDATE="TRUE"
11460     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11461     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11463 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11466 dnl ===================================================================
11467 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11468 dnl ===================================================================
11469 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11470 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11471     AC_MSG_RESULT([no])
11472     ENABLE_SILENT_MSI=
11473 else
11474     AC_MSG_RESULT([yes])
11475     ENABLE_SILENT_MSI=TRUE
11476     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11478 AC_SUBST(ENABLE_SILENT_MSI)
11480 AC_MSG_CHECKING([whether and how to use Xinerama])
11481 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11482     if test "$x_libraries" = "default_x_libraries"; then
11483         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11484         if test "x$XINERAMALIB" = x; then
11485            XINERAMALIB="/usr/lib"
11486         fi
11487     else
11488         XINERAMALIB="$x_libraries"
11489     fi
11490     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11491         # we have both versions, let the user decide but use the dynamic one
11492         # per default
11493         USE_XINERAMA=TRUE
11494         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11495             XINERAMA_LINK=dynamic
11496         else
11497             XINERAMA_LINK=static
11498         fi
11499     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11500         # we have only the dynamic version
11501         USE_XINERAMA=TRUE
11502         XINERAMA_LINK=dynamic
11503     elif test -e "$XINERAMALIB/libXinerama.a"; then
11504         # static version
11505         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11506             USE_XINERAMA=TRUE
11507             XINERAMA_LINK=static
11508         else
11509             USE_XINERAMA=
11510             XINERAMA_LINK=none
11511         fi
11512     else
11513         # no Xinerama
11514         USE_XINERAMA=
11515         XINERAMA_LINK=none
11516     fi
11517     if test "$USE_XINERAMA" = "TRUE"; then
11518         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11519         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11520             [AC_MSG_ERROR(Xinerama header not found.)], [])
11521         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11522         if test "x$XEXTLIB" = x; then
11523            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11524         fi
11525         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11526         if test "$_os" = "FreeBSD"; then
11527             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11528         fi
11529         if test "$_os" = "Linux"; then
11530             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11531         fi
11532         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11533             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11534     else
11535         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11536     fi
11537 else
11538     USE_XINERAMA=
11539     XINERAMA_LINK=none
11540     AC_MSG_RESULT([no])
11542 AC_SUBST(USE_XINERAMA)
11543 AC_SUBST(XINERAMA_LINK)
11545 dnl ===================================================================
11546 dnl Test whether to build cairo or rely on the system version
11547 dnl ===================================================================
11549 if test "$USING_X11" = TRUE; then
11550     # Used in vcl/Library_vclplug_gen.mk
11551     test_cairo=yes
11554 if test "$test_cairo" = "yes"; then
11555     AC_MSG_CHECKING([whether to use the system cairo])
11557     : ${with_system_cairo:=$with_system_libs}
11558     if test "$with_system_cairo" = "yes"; then
11559         SYSTEM_CAIRO=TRUE
11560         AC_MSG_RESULT([yes])
11562         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11563         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11564         FilterLibs "${CAIRO_LIBS}"
11565         CAIRO_LIBS="${filteredlibs}"
11567         if test "$test_xrender" = "yes"; then
11568             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11569             AC_LANG_PUSH([C])
11570             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11571 #ifdef PictStandardA8
11572 #else
11573       return fail;
11574 #endif
11575 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11577             AC_LANG_POP([C])
11578         fi
11579     else
11580         SYSTEM_CAIRO=
11581         AC_MSG_RESULT([no])
11583         BUILD_TYPE="$BUILD_TYPE CAIRO"
11584     fi
11587 AC_SUBST(SYSTEM_CAIRO)
11588 AC_SUBST(CAIRO_CFLAGS)
11589 AC_SUBST(CAIRO_LIBS)
11591 dnl ===================================================================
11592 dnl Test whether to use avahi
11593 dnl ===================================================================
11594 if test "$_os" = "WINNT"; then
11595     # Windows uses bundled mDNSResponder
11596     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11597 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11598     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11599                       [ENABLE_AVAHI="TRUE"])
11600     AC_DEFINE(HAVE_FEATURE_AVAHI)
11601     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11602     FilterLibs "${AVAHI_LIBS}"
11603     AVAHI_LIBS="${filteredlibs}"
11606 AC_SUBST(ENABLE_AVAHI)
11607 AC_SUBST(AVAHI_CFLAGS)
11608 AC_SUBST(AVAHI_LIBS)
11610 dnl ===================================================================
11611 dnl Test whether to use liblangtag
11612 dnl ===================================================================
11613 SYSTEM_LIBLANGTAG=
11614 AC_MSG_CHECKING([whether to use system liblangtag])
11615 if test "$with_system_liblangtag" = yes; then
11616     SYSTEM_LIBLANGTAG=TRUE
11617     AC_MSG_RESULT([yes])
11618     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11619     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11620     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11621     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11622     FilterLibs "${LIBLANGTAG_LIBS}"
11623     LIBLANGTAG_LIBS="${filteredlibs}"
11624 else
11625     SYSTEM_LIBLANGTAG=
11626     AC_MSG_RESULT([no])
11627     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11628     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11629     if test "$COM" = "MSC"; then
11630         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11631     else
11632         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11633     fi
11635 AC_SUBST(SYSTEM_LIBLANGTAG)
11636 AC_SUBST(LIBLANGTAG_CFLAGS)
11637 AC_SUBST(LIBLANGTAG_LIBS)
11639 dnl ===================================================================
11640 dnl Test whether to build libpng or rely on the system version
11641 dnl ===================================================================
11643 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11645 dnl ===================================================================
11646 dnl Check for runtime JVM search path
11647 dnl ===================================================================
11648 if test "$ENABLE_JAVA" != ""; then
11649     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11650     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11651         AC_MSG_RESULT([yes])
11652         if ! test -d "$with_jvm_path"; then
11653             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11654         fi
11655         if ! test -d "$with_jvm_path"jvm; then
11656             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11657         fi
11658         JVM_ONE_PATH_CHECK="$with_jvm_path"
11659         AC_SUBST(JVM_ONE_PATH_CHECK)
11660     else
11661         AC_MSG_RESULT([no])
11662     fi
11665 dnl ===================================================================
11666 dnl Test for the presence of Ant and that it works
11667 dnl ===================================================================
11669 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11670     ANT_HOME=; export ANT_HOME
11671     WITH_ANT_HOME=; export WITH_ANT_HOME
11672     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11673         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11674             if test "$_os" = "WINNT"; then
11675                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11676             else
11677                 with_ant_home="$LODE_HOME/opt/ant"
11678             fi
11679         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11680             with_ant_home="$LODE_HOME/opt/ant"
11681         fi
11682     fi
11683     if test -z "$with_ant_home"; then
11684         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11685     else
11686         if test "$_os" = "WINNT"; then
11687             # AC_PATH_PROGS needs unix path
11688             with_ant_home=`cygpath -u "$with_ant_home"`
11689         fi
11690         AbsolutePath "$with_ant_home"
11691         with_ant_home=$absolute_path
11692         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11693         WITH_ANT_HOME=$with_ant_home
11694         ANT_HOME=$with_ant_home
11695     fi
11697     if test -z "$ANT"; then
11698         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11699     else
11700         # resolve relative or absolute symlink
11701         while test -h "$ANT"; do
11702             a_cwd=`pwd`
11703             a_basename=`basename "$ANT"`
11704             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11705             cd "`dirname "$ANT"`"
11706             cd "`dirname "$a_script"`"
11707             ANT="`pwd`"/"`basename "$a_script"`"
11708             cd "$a_cwd"
11709         done
11711         AC_MSG_CHECKING([if $ANT works])
11712         mkdir -p conftest.dir
11713         a_cwd=$(pwd)
11714         cd conftest.dir
11715         cat > conftest.java << EOF
11716         public class conftest {
11717             int testmethod(int a, int b) {
11718                     return a + b;
11719             }
11720         }
11723         cat > conftest.xml << EOF
11724         <project name="conftest" default="conftest">
11725         <target name="conftest">
11726             <javac srcdir="." includes="conftest.java">
11727             </javac>
11728         </target>
11729         </project>
11732         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11733         if test $? = 0 -a -f ./conftest.class; then
11734             AC_MSG_RESULT([Ant works])
11735             if test -z "$WITH_ANT_HOME"; then
11736                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11737                 if test -z "$ANT_HOME"; then
11738                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11739                 fi
11740             else
11741                 ANT_HOME="$WITH_ANT_HOME"
11742             fi
11743         else
11744             echo "configure: Ant test failed" >&5
11745             cat conftest.java >&5
11746             cat conftest.xml >&5
11747             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11748         fi
11749         cd "$a_cwd"
11750         rm -fr conftest.dir
11751     fi
11752     if test -z "$ANT_HOME"; then
11753         ANT_HOME="NO_ANT_HOME"
11754     else
11755         PathFormat "$ANT_HOME"
11756         ANT_HOME="$formatted_path"
11757         PathFormat "$ANT"
11758         ANT="$formatted_path"
11759     fi
11760     AC_SUBST(ANT_HOME)
11761     AC_SUBST(ANT)
11763     dnl Checking for ant.jar
11764     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11765         AC_MSG_CHECKING([Ant lib directory])
11766         if test -f $ANT_HOME/lib/ant.jar; then
11767             ANT_LIB="$ANT_HOME/lib"
11768         else
11769             if test -f $ANT_HOME/ant.jar; then
11770                 ANT_LIB="$ANT_HOME"
11771             else
11772                 if test -f /usr/share/java/ant.jar; then
11773                     ANT_LIB=/usr/share/java
11774                 else
11775                     if test -f /usr/share/ant-core/lib/ant.jar; then
11776                         ANT_LIB=/usr/share/ant-core/lib
11777                     else
11778                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11779                             ANT_LIB="$ANT_HOME/lib/ant"
11780                         else
11781                             if test -f /usr/share/lib/ant/ant.jar; then
11782                                 ANT_LIB=/usr/share/lib/ant
11783                             else
11784                                 AC_MSG_ERROR([Ant libraries not found!])
11785                             fi
11786                         fi
11787                     fi
11788                 fi
11789             fi
11790         fi
11791         PathFormat "$ANT_LIB"
11792         ANT_LIB="$formatted_path"
11793         AC_MSG_RESULT([Ant lib directory found.])
11794     fi
11795     AC_SUBST(ANT_LIB)
11797     ant_minver=1.6.0
11798     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11800     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11801     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11802     ant_version_major=`echo $ant_version | cut -d. -f1`
11803     ant_version_minor=`echo $ant_version | cut -d. -f2`
11804     echo "configure: ant_version $ant_version " >&5
11805     echo "configure: ant_version_major $ant_version_major " >&5
11806     echo "configure: ant_version_minor $ant_version_minor " >&5
11807     if test "$ant_version_major" -ge "2"; then
11808         AC_MSG_RESULT([yes, $ant_version])
11809     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11810         AC_MSG_RESULT([yes, $ant_version])
11811     else
11812         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11813     fi
11815     rm -f conftest* core core.* *.core
11818 OOO_JUNIT_JAR=
11819 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11820     AC_MSG_CHECKING([for JUnit 4])
11821     if test "$with_junit" = "yes"; then
11822         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11823             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11824         elif test -e /usr/share/java/junit4.jar; then
11825             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11826         else
11827            if test -e /usr/share/lib/java/junit.jar; then
11828               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11829            else
11830               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11831            fi
11832         fi
11833     else
11834         OOO_JUNIT_JAR=$with_junit
11835     fi
11836     if test "$_os" = "WINNT"; then
11837         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11838     fi
11839     printf 'import org.junit.Before;' > conftest.java
11840     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11841         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11842     else
11843         AC_MSG_ERROR(
11844 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11845  specify its pathname via --with-junit=..., or disable it via --without-junit])
11846     fi
11847     rm -f conftest.class conftest.java
11848     if test $OOO_JUNIT_JAR != ""; then
11849     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11850     fi
11852 AC_SUBST(OOO_JUNIT_JAR)
11854 HAMCREST_JAR=
11855 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11856     AC_MSG_CHECKING([for included Hamcrest])
11857     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11858     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11859         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11860     else
11861         AC_MSG_RESULT([Not included])
11862         AC_MSG_CHECKING([for standalone hamcrest jar.])
11863         if test "$with_hamcrest" = "yes"; then
11864             if test -e /usr/share/lib/java/hamcrest.jar; then
11865                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11866             elif test -e /usr/share/java/hamcrest/core.jar; then
11867                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11868             else
11869                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11870             fi
11871         else
11872             HAMCREST_JAR=$with_hamcrest
11873         fi
11874         if test "$_os" = "WINNT"; then
11875             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11876         fi
11877         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11878             AC_MSG_RESULT([$HAMCREST_JAR])
11879         else
11880             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),
11881                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11882         fi
11883     fi
11884     rm -f conftest.class conftest.java
11886 AC_SUBST(HAMCREST_JAR)
11889 AC_SUBST(SCPDEFS)
11892 # check for wget and curl
11894 WGET=
11895 CURL=
11897 if test "$enable_fetch_external" != "no"; then
11899 CURL=`which curl 2>/dev/null`
11901 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11902     # wget new enough?
11903     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11904     if test $? -eq 0; then
11905         WGET=$i
11906         break
11907     fi
11908 done
11910 if test -z "$WGET" -a -z "$CURL"; then
11911     AC_MSG_ERROR([neither wget nor curl found!])
11916 AC_SUBST(WGET)
11917 AC_SUBST(CURL)
11920 # check for sha256sum
11922 SHA256SUM=
11924 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11925     eval "$i -a 256 --version" > /dev/null 2>&1
11926     ret=$?
11927     if test $ret -eq 0; then
11928         SHA256SUM="$i -a 256"
11929         break
11930     fi
11931 done
11933 if test -z "$SHA256SUM"; then
11934     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11935         eval "$i --version" > /dev/null 2>&1
11936         ret=$?
11937         if test $ret -eq 0; then
11938             SHA256SUM=$i
11939             break
11940         fi
11941     done
11944 if test -z "$SHA256SUM"; then
11945     AC_MSG_ERROR([no sha256sum found!])
11948 AC_SUBST(SHA256SUM)
11950 dnl ===================================================================
11951 dnl Dealing with l10n options
11952 dnl ===================================================================
11953 AC_MSG_CHECKING([which languages to be built])
11954 # get list of all languages
11955 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11956 # the sed command does the following:
11957 #   + if a line ends with a backslash, append the next line to it
11958 #   + adds " on the beginning of the value (after =)
11959 #   + adds " at the end of the value
11960 #   + removes en-US; we want to put it on the beginning
11961 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11962 [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)]
11963 ALL_LANGS="en-US $completelangiso"
11964 # check the configured localizations
11965 WITH_LANG="$with_lang"
11967 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
11968 # (Norwegian is "nb" and "nn".)
11969 if test "$WITH_LANG" = "no"; then
11970     WITH_LANG=
11973 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11974     AC_MSG_RESULT([en-US])
11975 else
11976     AC_MSG_RESULT([$WITH_LANG])
11977     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11978     if test -z "$MSGFMT"; then
11979         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11980             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11981         elif test -x "/opt/lo/bin/msgfmt"; then
11982             MSGFMT="/opt/lo/bin/msgfmt"
11983         else
11984             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11985             if test -z "$MSGFMT"; then
11986                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11987             fi
11988         fi
11989     fi
11990     if test -z "$MSGUNIQ"; then
11991         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11992             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11993         elif test -x "/opt/lo/bin/msguniq"; then
11994             MSGUNIQ="/opt/lo/bin/msguniq"
11995         else
11996             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11997             if test -z "$MSGUNIQ"; then
11998                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11999             fi
12000         fi
12001     fi
12003 AC_SUBST(MSGFMT)
12004 AC_SUBST(MSGUNIQ)
12005 # check that the list is valid
12006 for lang in $WITH_LANG; do
12007     test "$lang" = "ALL" && continue
12008     # need to check for the exact string, so add space before and after the list of all languages
12009     for vl in $ALL_LANGS; do
12010         if test "$vl" = "$lang"; then
12011            break
12012         fi
12013     done
12014     if test "$vl" != "$lang"; then
12015         # if you're reading this - you prolly quoted your languages remove the quotes ...
12016         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12017     fi
12018 done
12019 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12020     echo $WITH_LANG | grep -q en-US
12021     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12023 # list with substituted ALL
12024 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12025 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12026 test "$WITH_LANG" = "en-US" && WITH_LANG=
12027 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12028     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12029     ALL_LANGS=`echo $ALL_LANGS qtz`
12031 AC_SUBST(ALL_LANGS)
12032 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12033 AC_SUBST(WITH_LANG)
12034 AC_SUBST(WITH_LANG_LIST)
12035 AC_SUBST(GIT_NEEDED_SUBMODULES)
12037 WITH_POOR_HELP_LOCALIZATIONS=
12038 if test -d "$SRC_ROOT/translations/source"; then
12039     for l in `ls -1 $SRC_ROOT/translations/source`; do
12040         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12041             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12042         fi
12043     done
12045 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12047 if test -n "$with_locales"; then
12048     WITH_LOCALES="$with_locales"
12050     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12051     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12052     # config_host/config_locales.h.in
12053     for locale in $WITH_LOCALES; do
12054         lang=${locale%_*}
12056         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12058         case $lang in
12059         hi|mr*ne)
12060             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12061             ;;
12062         bg|ru)
12063             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12064             ;;
12065         esac
12066     done
12067 else
12068     AC_DEFINE(WITH_LOCALE_ALL)
12070 AC_SUBST(WITH_LOCALES)
12072 dnl git submodule update --reference
12073 dnl ===================================================================
12074 if test -n "${GIT_REFERENCE_SRC}"; then
12075     for repo in ${GIT_NEEDED_SUBMODULES}; do
12076         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12077             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12078         fi
12079     done
12081 AC_SUBST(GIT_REFERENCE_SRC)
12083 dnl git submodules linked dirs
12084 dnl ===================================================================
12085 if test -n "${GIT_LINK_SRC}"; then
12086     for repo in ${GIT_NEEDED_SUBMODULES}; do
12087         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12088             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12089         fi
12090     done
12092 AC_SUBST(GIT_LINK_SRC)
12094 dnl branding
12095 dnl ===================================================================
12096 AC_MSG_CHECKING([for alternative branding images directory])
12097 # initialize mapped arrays
12098 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12099 brand_files="$BRAND_INTRO_IMAGES about.svg"
12101 if test -z "$with_branding" -o "$with_branding" = "no"; then
12102     AC_MSG_RESULT([none])
12103     DEFAULT_BRAND_IMAGES="$brand_files"
12104 else
12105     if ! test -d $with_branding ; then
12106         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12107     else
12108         AC_MSG_RESULT([$with_branding])
12109         CUSTOM_BRAND_DIR="$with_branding"
12110         for lfile in $brand_files
12111         do
12112             if ! test -f $with_branding/$lfile ; then
12113                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12114                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12115             else
12116                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12117             fi
12118         done
12119         check_for_progress="yes"
12120     fi
12122 AC_SUBST([BRAND_INTRO_IMAGES])
12123 AC_SUBST([CUSTOM_BRAND_DIR])
12124 AC_SUBST([CUSTOM_BRAND_IMAGES])
12125 AC_SUBST([DEFAULT_BRAND_IMAGES])
12128 AC_MSG_CHECKING([for 'intro' progress settings])
12129 PROGRESSBARCOLOR=
12130 PROGRESSSIZE=
12131 PROGRESSPOSITION=
12132 PROGRESSFRAMECOLOR=
12133 PROGRESSTEXTCOLOR=
12134 PROGRESSTEXTBASELINE=
12136 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12137     source "$with_branding/progress.conf"
12138     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12139 else
12140     AC_MSG_RESULT([none])
12143 AC_SUBST(PROGRESSBARCOLOR)
12144 AC_SUBST(PROGRESSSIZE)
12145 AC_SUBST(PROGRESSPOSITION)
12146 AC_SUBST(PROGRESSFRAMECOLOR)
12147 AC_SUBST(PROGRESSTEXTCOLOR)
12148 AC_SUBST(PROGRESSTEXTBASELINE)
12151 AC_MSG_CHECKING([for extra build ID])
12152 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12153     EXTRA_BUILDID="$with_extra_buildid"
12155 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12156 if test -n "$EXTRA_BUILDID" ; then
12157     AC_MSG_RESULT([$EXTRA_BUILDID])
12158 else
12159     AC_MSG_RESULT([not set])
12161 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12163 OOO_VENDOR=
12164 AC_MSG_CHECKING([for vendor])
12165 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12166     OOO_VENDOR="$USERNAME"
12168     if test -z "$OOO_VENDOR"; then
12169         OOO_VENDOR="$USER"
12170     fi
12172     if test -z "$OOO_VENDOR"; then
12173         OOO_VENDOR="`id -u -n`"
12174     fi
12176     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12177 else
12178     OOO_VENDOR="$with_vendor"
12179     AC_MSG_RESULT([$OOO_VENDOR])
12181 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12182 AC_SUBST(OOO_VENDOR)
12184 if test "$_os" = "Android" ; then
12185     ANDROID_PACKAGE_NAME=
12186     AC_MSG_CHECKING([for Android package name])
12187     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12188         if test -n "$ENABLE_DEBUG"; then
12189             # Default to the package name that makes ndk-gdb happy.
12190             ANDROID_PACKAGE_NAME="org.libreoffice"
12191         else
12192             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12193         fi
12195         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12196     else
12197         ANDROID_PACKAGE_NAME="$with_android_package_name"
12198         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12199     fi
12200     AC_SUBST(ANDROID_PACKAGE_NAME)
12203 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12204 if test "$with_compat_oowrappers" = "yes"; then
12205     WITH_COMPAT_OOWRAPPERS=TRUE
12206     AC_MSG_RESULT(yes)
12207 else
12208     WITH_COMPAT_OOWRAPPERS=
12209     AC_MSG_RESULT(no)
12211 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12213 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12214 AC_MSG_CHECKING([for install dirname])
12215 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12216     INSTALLDIRNAME="$with_install_dirname"
12218 AC_MSG_RESULT([$INSTALLDIRNAME])
12219 AC_SUBST(INSTALLDIRNAME)
12221 AC_MSG_CHECKING([for prefix])
12222 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12223 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12224 PREFIXDIR="$prefix"
12225 AC_MSG_RESULT([$PREFIXDIR])
12226 AC_SUBST(PREFIXDIR)
12228 LIBDIR=[$(eval echo $(eval echo $libdir))]
12229 AC_SUBST(LIBDIR)
12231 DATADIR=[$(eval echo $(eval echo $datadir))]
12232 AC_SUBST(DATADIR)
12234 MANDIR=[$(eval echo $(eval echo $mandir))]
12235 AC_SUBST(MANDIR)
12237 DOCDIR=[$(eval echo $(eval echo $docdir))]
12238 AC_SUBST(DOCDIR)
12240 BINDIR=[$(eval echo $(eval echo $bindir))]
12241 AC_SUBST(BINDIR)
12243 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12244 AC_SUBST(INSTALLDIR)
12246 TESTINSTALLDIR="${BUILDDIR}/test-install"
12247 AC_SUBST(TESTINSTALLDIR)
12250 # ===================================================================
12251 # OAuth2 id and secrets
12252 # ===================================================================
12254 AC_MSG_CHECKING([for Google Drive client id and secret])
12255 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12256     AC_MSG_RESULT([not set])
12257     GDRIVE_CLIENT_ID="\"\""
12258     GDRIVE_CLIENT_SECRET="\"\""
12259 else
12260     AC_MSG_RESULT([set])
12261     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12262     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12264 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12265 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12267 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12268 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12269     AC_MSG_RESULT([not set])
12270     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12271     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12272 else
12273     AC_MSG_RESULT([set])
12274     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12275     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12277 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12278 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12280 AC_MSG_CHECKING([for OneDrive client id and secret])
12281 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12282     AC_MSG_RESULT([not set])
12283     ONEDRIVE_CLIENT_ID="\"\""
12284     ONEDRIVE_CLIENT_SECRET="\"\""
12285 else
12286     AC_MSG_RESULT([set])
12287     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12288     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12290 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12291 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12294 dnl ===================================================================
12295 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12296 dnl --enable-dependency-tracking configure option
12297 dnl ===================================================================
12298 AC_MSG_CHECKING([whether to enable dependency tracking])
12299 if test "$enable_dependency_tracking" = "no"; then
12300     nodep=TRUE
12301     AC_MSG_RESULT([no])
12302 else
12303     AC_MSG_RESULT([yes])
12305 AC_SUBST(nodep)
12307 dnl ===================================================================
12308 dnl Number of CPUs to use during the build
12309 dnl ===================================================================
12310 AC_MSG_CHECKING([for number of processors to use])
12311 # plain --with-parallelism is just the default
12312 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12313     if test "$with_parallelism" = "no"; then
12314         PARALLELISM=0
12315     else
12316         PARALLELISM=$with_parallelism
12317     fi
12318 else
12319     if test "$enable_icecream" = "yes"; then
12320         PARALLELISM="10"
12321     else
12322         case `uname -s` in
12324         Darwin|FreeBSD|NetBSD|OpenBSD)
12325             PARALLELISM=`sysctl -n hw.ncpu`
12326             ;;
12328         Linux)
12329             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12330         ;;
12331         # what else than above does profit here *and* has /proc?
12332         *)
12333             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12334             ;;
12335         esac
12337         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12338         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12339     fi
12342 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12343     if test -z "$with_parallelism"; then
12344             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12345             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12346             PARALLELISM="1"
12347     else
12348         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."
12349     fi
12352 if test $PARALLELISM -eq 0; then
12353     AC_MSG_RESULT([explicit make -j option needed])
12354 else
12355     AC_MSG_RESULT([$PARALLELISM])
12357 AC_SUBST(PARALLELISM)
12359 IWYU_PATH="$with_iwyu"
12360 AC_SUBST(IWYU_PATH)
12361 if test ! -z "$IWYU_PATH"; then
12362     if test ! -f "$IWYU_PATH"; then
12363         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12364     fi
12368 # Set up ILIB for MSVC build
12370 ILIB1=
12371 if test "$build_os" = "cygwin"; then
12372     ILIB="."
12373     if test -n "$JAVA_HOME"; then
12374         ILIB="$ILIB;$JAVA_HOME/lib"
12375     fi
12376     ILIB1=-link
12377     if test "$BITNESS_OVERRIDE" = 64; then
12378         ILIB="$ILIB;$COMPATH/lib/x64"
12379         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12380         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12381         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12382         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12383             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12384             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12385         fi
12386         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12387         ucrtlibpath_formatted=$formatted_path
12388         ILIB="$ILIB;$ucrtlibpath_formatted"
12389         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12390     else
12391         ILIB="$ILIB;$COMPATH/lib/x86"
12392         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12393         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12394         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12395         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12396             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12397             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12398         fi
12399         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12400         ucrtlibpath_formatted=$formatted_path
12401         ILIB="$ILIB;$ucrtlibpath_formatted"
12402         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12403     fi
12404     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12405         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12406     else
12407         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12408     fi
12410     AC_SUBST(ILIB)
12413 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
12414 AC_MSG_CHECKING([that $CXX supports inline variables])
12415 AC_LANG_PUSH([C++])
12416 save_CXXFLAGS=$CXXFLAGS
12417 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12418 if test "$build_os" = cygwin; then
12419     save_LIB=$LIB
12420     export LIB=$ILIB
12422 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
12423         #if !defined __cpp_inline_variables
12424         // This tests for one specific aspect of inline variables that is actually used by
12425         // ORegistry::ROOT (registry/source/regimpl.cxx):
12426         struct S { constexpr S() {} };
12427         struct T { static constexpr S s{}; };
12428         S const * f() { return &T::s; }
12429         #endif
12430     ]])],
12431     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required inline variable support]))
12432 CXXFLAGS=$save_CXXFLAGS
12433 if test "$build_os" = cygwin; then
12434     LIB=$save_LIB
12436 AC_LANG_POP([C++])
12438 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
12439 AC_MSG_CHECKING(
12440     [that C++11 use of const_iterator in standard containers is not broken])
12441 save_CXXFLAGS=$CXXFLAGS
12442 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12443 AC_LANG_PUSH([C++])
12444 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12445     #include <list>
12446     ]],[[
12447         std::list<int> l;
12448         l.erase(l.cbegin());
12449     ]])],
12450     AC_MSG_RESULT([yes]),
12451     AC_MSG_ERROR([C++11 use of const_iterator in standard containers must not broken]))
12452 AC_LANG_POP([C++])
12453 CXXFLAGS=$save_CXXFLAGS
12455 # ===================================================================
12456 # Creating bigger shared library to link against
12457 # ===================================================================
12458 AC_MSG_CHECKING([whether to create huge library])
12459 MERGELIBS=
12461 if test $_os = iOS -o $_os = Android; then
12462     # Never any point in mergelibs for these as we build just static
12463     # libraries anyway...
12464     enable_mergelibs=no
12467 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12468     if test $_os != Linux -a $_os != WINNT; then
12469         add_warning "--enable-mergelibs is not tested for this platform"
12470     fi
12471     MERGELIBS="TRUE"
12472     AC_MSG_RESULT([yes])
12473 else
12474     AC_MSG_RESULT([no])
12476 AC_SUBST([MERGELIBS])
12478 dnl ===================================================================
12479 dnl icerun is a wrapper that stops us spawning tens of processes
12480 dnl locally - for tools that can't be executed on the compile cluster
12481 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12482 dnl ===================================================================
12483 AC_MSG_CHECKING([whether to use icerun wrapper])
12484 ICECREAM_RUN=
12485 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12486     ICECREAM_RUN=icerun
12487     AC_MSG_RESULT([yes])
12488 else
12489     AC_MSG_RESULT([no])
12491 AC_SUBST(ICECREAM_RUN)
12493 dnl ===================================================================
12494 dnl Setup the ICECC_VERSION for the build the same way it was set for
12495 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12496 dnl ===================================================================
12497 x_ICECC_VERSION=[\#]
12498 if test -n "$ICECC_VERSION" ; then
12499     x_ICECC_VERSION=
12501 AC_SUBST(x_ICECC_VERSION)
12502 AC_SUBST(ICECC_VERSION)
12504 dnl ===================================================================
12506 AC_MSG_CHECKING([MPL subset])
12507 MPL_SUBSET=
12509 if test "$enable_mpl_subset" = "yes"; then
12510     warn_report=false
12511     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12512         warn_report=true
12513     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12514         warn_report=true
12515     fi
12516     if test "$warn_report" = "true"; then
12517         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12518     fi
12519     if test "x$enable_postgresql_sdbc" != "xno"; then
12520         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12521     fi
12522     if test "$enable_lotuswordpro" = "yes"; then
12523         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12524     fi
12525     if test "$WITH_WEBDAV" = "neon"; then
12526         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12527     fi
12528     if test -n "$ENABLE_PDFIMPORT"; then
12529         if test "x$SYSTEM_POPPLER" = "x"; then
12530             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12531         fi
12532     fi
12533     # cf. m4/libo_check_extension.m4
12534     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12535         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12536     fi
12537     for theme in $WITH_THEMES; do
12538         case $theme in
12539         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12540             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12541         *) : ;;
12542         esac
12543     done
12545     ENABLE_OPENGL_TRANSITIONS=
12547     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12548         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12549     fi
12551     MPL_SUBSET="TRUE"
12552     AC_DEFINE(MPL_HAVE_SUBSET)
12553     AC_MSG_RESULT([only])
12554 else
12555     AC_MSG_RESULT([no restrictions])
12557 AC_SUBST(MPL_SUBSET)
12559 dnl ===================================================================
12561 AC_MSG_CHECKING([formula logger])
12562 ENABLE_FORMULA_LOGGER=
12564 if test "x$enable_formula_logger" = "xyes"; then
12565     AC_MSG_RESULT([yes])
12566     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12567     ENABLE_FORMULA_LOGGER=TRUE
12568 elif test -n "$ENABLE_DBGUTIL" ; then
12569     AC_MSG_RESULT([yes])
12570     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12571     ENABLE_FORMULA_LOGGER=TRUE
12572 else
12573     AC_MSG_RESULT([no])
12576 AC_SUBST(ENABLE_FORMULA_LOGGER)
12578 dnl ===================================================================
12579 dnl Setting up the environment.
12580 dnl ===================================================================
12581 AC_MSG_NOTICE([setting up the build environment variables...])
12583 AC_SUBST(COMPATH)
12585 if test "$build_os" = "cygwin"; then
12586     if test -d "$COMPATH/atlmfc/lib"; then
12587         ATL_LIB="$COMPATH/atlmfc/lib"
12588         ATL_INCLUDE="$COMPATH/atlmfc/include"
12589     else
12590         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12591         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12592     fi
12593     if test "$BITNESS_OVERRIDE" = 64; then
12594         if test $VCVER = "150"; then
12595             ATL_LIB="$ATL_LIB/x64"
12596         else
12597             ATL_LIB="$ATL_LIB/amd64"
12598         fi
12599     else
12600         if test $VCVER = "150"; then
12601             ATL_LIB="$ATL_LIB/x86"
12602         fi
12603     fi
12604     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12605     PathFormat "/usr/bin/find.exe"
12606     FIND="$formatted_path"
12607     PathFormat "/usr/bin/sort.exe"
12608     SORT="$formatted_path"
12609     PathFormat "/usr/bin/grep.exe"
12610     WIN_GREP="$formatted_path"
12611     PathFormat "/usr/bin/ls.exe"
12612     WIN_LS="$formatted_path"
12613     PathFormat "/usr/bin/touch.exe"
12614     WIN_TOUCH="$formatted_path"
12615 else
12616     FIND=find
12617     SORT=sort
12620 AC_SUBST(ATL_INCLUDE)
12621 AC_SUBST(ATL_LIB)
12622 AC_SUBST(FIND)
12623 AC_SUBST(SORT)
12624 AC_SUBST(WIN_GREP)
12625 AC_SUBST(WIN_LS)
12626 AC_SUBST(WIN_TOUCH)
12628 AC_SUBST(BUILD_TYPE)
12630 AC_SUBST(SOLARINC)
12632 PathFormat "$PERL"
12633 PERL="$formatted_path"
12634 AC_SUBST(PERL)
12636 if test -n "$TMPDIR"; then
12637     TEMP_DIRECTORY="$TMPDIR"
12638 else
12639     TEMP_DIRECTORY="/tmp"
12641 if test "$build_os" = "cygwin"; then
12642     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12644 AC_SUBST(TEMP_DIRECTORY)
12646 # setup the PATH for the environment
12647 if test -n "$LO_PATH_FOR_BUILD"; then
12648     LO_PATH="$LO_PATH_FOR_BUILD"
12649 else
12650     LO_PATH="$PATH"
12652     case "$host_os" in
12654     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12655         if test "$ENABLE_JAVA" != ""; then
12656             pathmunge "$JAVA_HOME/bin" "after"
12657         fi
12658         ;;
12660     cygwin*)
12661         # Win32 make needs native paths
12662         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12663             LO_PATH=`cygpath -p -m "$PATH"`
12664         fi
12665         if test "$BITNESS_OVERRIDE" = 64; then
12666             # needed for msi packaging
12667             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12668         fi
12669         # .NET 4.6 and higher don't have bin directory
12670         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12671             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12672         fi
12673         pathmunge "$ASM_HOME" "before"
12674         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12675         pathmunge "$CSC_PATH" "before"
12676         pathmunge "$MIDL_PATH" "before"
12677         pathmunge "$AL_PATH" "before"
12678         pathmunge "$MSPDB_PATH" "before"
12679         if test -n "$MSBUILD_PATH" ; then
12680             pathmunge "$MSBUILD_PATH" "before"
12681         fi
12682         if test "$BITNESS_OVERRIDE" = 64; then
12683             pathmunge "$COMPATH/bin/amd64" "before"
12684             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12685         else
12686             pathmunge "$COMPATH/bin" "before"
12687             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12688         fi
12689         if test "$ENABLE_JAVA" != ""; then
12690             if test -d "$JAVA_HOME/jre/bin/client"; then
12691                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12692             fi
12693             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12694                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12695             fi
12696             pathmunge "$JAVA_HOME/bin" "before"
12697         fi
12698         ;;
12700     solaris*)
12701         pathmunge "/usr/css/bin" "before"
12702         if test "$ENABLE_JAVA" != ""; then
12703             pathmunge "$JAVA_HOME/bin" "after"
12704         fi
12705         ;;
12706     esac
12709 AC_SUBST(LO_PATH)
12711 libo_FUZZ_SUMMARY
12713 # Generate a configuration sha256 we can use for deps
12714 if test -f config_host.mk; then
12715     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12717 if test -f config_host_lang.mk; then
12718     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12721 CFLAGS=$my_original_CFLAGS
12722 CXXFLAGS=$my_original_CXXFLAGS
12723 CPPFLAGS=$my_original_CPPFLAGS
12725 AC_CONFIG_FILES([config_host.mk
12726                  config_host_lang.mk
12727                  Makefile
12728                  bin/bffvalidator.sh
12729                  bin/odfvalidator.sh
12730                  bin/officeotron.sh
12731                  instsetoo_native/util/openoffice.lst
12732                  sysui/desktop/macosx/Info.plist])
12733 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12734 AC_CONFIG_HEADERS([config_host/config_clang.h])
12735 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12736 AC_CONFIG_HEADERS([config_host/config_eot.h])
12737 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12738 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12739 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12740 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12741 AC_CONFIG_HEADERS([config_host/config_features.h])
12742 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12743 AC_CONFIG_HEADERS([config_host/config_folders.h])
12744 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12745 AC_CONFIG_HEADERS([config_host/config_gio.h])
12746 AC_CONFIG_HEADERS([config_host/config_global.h])
12747 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12748 AC_CONFIG_HEADERS([config_host/config_java.h])
12749 AC_CONFIG_HEADERS([config_host/config_langs.h])
12750 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12751 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12752 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12753 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12754 AC_CONFIG_HEADERS([config_host/config_locales.h])
12755 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12756 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12757 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12758 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12759 AC_CONFIG_HEADERS([config_host/config_oox.h])
12760 AC_CONFIG_HEADERS([config_host/config_options.h])
12761 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12762 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12763 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12764 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12765 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12766 AC_CONFIG_HEADERS([config_host/config_version.h])
12767 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12768 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12769 AC_CONFIG_HEADERS([config_host/config_python.h])
12770 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12771 AC_OUTPUT
12773 if test "$CROSS_COMPILING" = TRUE; then
12774     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12777 # touch the config timestamp file
12778 if test ! -f config_host.mk.stamp; then
12779     echo > config_host.mk.stamp
12780 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12781     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12782 else
12783     echo > config_host.mk.stamp
12786 # touch the config lang timestamp file
12787 if test ! -f config_host_lang.mk.stamp; then
12788     echo > config_host_lang.mk.stamp
12789 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12790     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12791 else
12792     echo > config_host_lang.mk.stamp
12796 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12798 cat << _EOS
12799 ****************************************************************************
12800 WARNING:
12801 Your make version is known to be horribly slow, and hard to debug
12802 problems with. To get a reasonably functional make please do:
12804 to install a pre-compiled binary make for Win32
12806  mkdir -p /opt/lo/bin
12807  cd /opt/lo/bin
12808  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12809  cp make-4.2.1-msvc.exe make
12810  chmod +x make
12812 to install from source:
12813 place yourself in a working directory of you choice.
12815  git clone git://git.savannah.gnu.org/make.git
12817  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12818  set PATH=%PATH%;C:\Cygwin\bin
12819  [or Cygwin64, if that is what you have]
12820  cd path-to-make-repo-you-cloned-above
12821  build_w32.bat --without-guile
12823 should result in a WinRel/gnumake.exe.
12824 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12826 Then re-run autogen.sh
12828 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12829 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12831 _EOS
12834 cat << _EOF
12835 ****************************************************************************
12837 To build, run:
12838 $GNUMAKE
12840 To view some help, run:
12841 $GNUMAKE help
12843 _EOF
12845 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12846     cat << _EOF
12847 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12848 _EOF
12850     if test $_os = Darwin; then
12851         echo open instdir/$PRODUCTNAME.app
12852     else
12853         echo instdir/program/soffice
12854     fi
12855     cat << _EOF
12857 If you want to run the smoketest, run:
12858 $GNUMAKE check
12860 _EOF
12863 if test -f warn; then
12864     cat warn
12865     rm warn
12868 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: