Cosmetics.
[LibreOffice.git] / configure.ac
blob37f9b6ff62e2662196477b5c9d728a8bdf1e144c
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.4.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=<yes/no/system/base/normal/full>],
1079         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1080          Using 'system' will include only external headers, 'base' will add also headers
1081          from base modules, 'normal' will also add all headers except from the module built,
1082          'full' will use all suitable headers even from a module itself.])
1085 libo_FUZZ_ARG_ENABLE(epm,
1086     AS_HELP_STRING([--enable-epm],
1087         [LibreOffice includes self-packaging code, that requires epm, however epm is
1088          useless for large scale package building.])
1091 libo_FUZZ_ARG_ENABLE(odk,
1092     AS_HELP_STRING([--disable-odk],
1093         [LibreOffice includes an ODK, office development kit which some packagers may
1094          wish to build without.])
1097 AC_ARG_ENABLE(mpl-subset,
1098     AS_HELP_STRING([--enable-mpl-subset],
1099         [Don't compile any pieces which are not MPL or more liberally licensed])
1102 libo_FUZZ_ARG_ENABLE(evolution2,
1103     AS_HELP_STRING([--enable-evolution2],
1104         [Allows the built-in evolution 2 addressbook connectivity build to be
1105          enabled.])
1108 AC_ARG_ENABLE(avahi,
1109     AS_HELP_STRING([--enable-avahi],
1110         [Determines whether to use Avahi to advertise Impress to remote controls.])
1113 libo_FUZZ_ARG_ENABLE(werror,
1114     AS_HELP_STRING([--enable-werror],
1115         [Turn warnings to errors. (Has no effect in modules where the treating
1116          of warnings as errors is disabled explicitly.)]),
1119 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1120     AS_HELP_STRING([--enable-assert-always-abort],
1121         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1124 libo_FUZZ_ARG_ENABLE(dbgutil,
1125     AS_HELP_STRING([--enable-dbgutil],
1126         [Provide debugging support from --enable-debug and include additional debugging
1127          utilities such as object counting or more expensive checks.
1128          This is the recommended option for developers.
1129          Note that this makes the build ABI incompatible, it is not possible to mix object
1130          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1132 libo_FUZZ_ARG_ENABLE(debug,
1133     AS_HELP_STRING([--enable-debug],
1134         [Include debugging information, disable compiler optimization and inlining plus
1135          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1137 libo_FUZZ_ARG_ENABLE(split-debug,
1138     AS_HELP_STRING([--disable-split-debug],
1139         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1140          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1142 libo_FUZZ_ARG_ENABLE(gdb-index,
1143     AS_HELP_STRING([--disable-gdb-index],
1144         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1145          The feature requires the gold or lld linker.]))
1147 libo_FUZZ_ARG_ENABLE(sal-log,
1148     AS_HELP_STRING([--enable-sal-log],
1149         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1151 libo_FUZZ_ARG_ENABLE(symbols,
1152     AS_HELP_STRING([--enable-symbols],
1153         [Generate debug information.
1154          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1155          otherwise. It is possible to explicitly specify gbuild build targets
1156          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1157          everything in the directory; there is no ordering, more specific overrides
1158          more general, and disabling takes precedence).
1159          Example: --enable-symbols="all -sw/ -Library_sc".]))
1161 libo_FUZZ_ARG_ENABLE(optimized,
1162     AS_HELP_STRING([--disable-optimized],
1163         [Whether to compile with optimization flags.
1164          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1165          otherwise.]))
1167 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1168     AS_HELP_STRING([--disable-runtime-optimizations],
1169         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1170          JVM JIT) that are known to interact badly with certain dynamic analysis
1171          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1172          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1173          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1175 AC_ARG_WITH(valgrind,
1176     AS_HELP_STRING([--with-valgrind],
1177         [Make availability of Valgrind headers a hard requirement.]))
1179 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1180     AS_HELP_STRING([--enable-compiler-plugins],
1181         [Enable compiler plugins that will perform additional checks during
1182          building. Enabled automatically by --enable-dbgutil.
1183          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1184 COMPILER_PLUGINS_DEBUG=
1185 if test "$enable_compiler_plugins" = debug; then
1186     enable_compiler_plugins=yes
1187     COMPILER_PLUGINS_DEBUG=TRUE
1190 libo_FUZZ_ARG_ENABLE(ooenv,
1191     AS_HELP_STRING([--disable-ooenv],
1192         [Disable ooenv for the instdir installation.]))
1194 libo_FUZZ_ARG_ENABLE(libnumbertext,
1195     AS_HELP_STRING([--disable-libnumbertext],
1196         [Disable use of numbertext external library.]))
1198 AC_ARG_ENABLE(lto,
1199     AS_HELP_STRING([--enable-lto],
1200         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1201          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1202          linker. For MSVC, this option is broken at the moment. This is experimental work
1203          in progress that shouldn't be used unless you are working on it.)]))
1205 AC_ARG_ENABLE(python,
1206     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1207         [Enables or disables Python support at run-time.
1208          Also specifies what Python to use. 'auto' is the default.
1209          'fully-internal' even forces the internal version for uses of Python
1210          during the build.]))
1212 libo_FUZZ_ARG_ENABLE(gtk,
1213     AS_HELP_STRING([--disable-gtk],
1214         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1215 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1217 libo_FUZZ_ARG_ENABLE(gtk3,
1218     AS_HELP_STRING([--disable-gtk3],
1219         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1220 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1222 AC_ARG_ENABLE(split-app-modules,
1223     AS_HELP_STRING([--enable-split-app-modules],
1224         [Split file lists for app modules, e.g. base, calc.
1225          Has effect only with make distro-pack-install]),
1228 AC_ARG_ENABLE(split-opt-features,
1229     AS_HELP_STRING([--enable-split-opt-features],
1230         [Split file lists for some optional features, e.g. pyuno, testtool.
1231          Has effect only with make distro-pack-install]),
1234 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1235     AS_HELP_STRING([--disable-cairo-canvas],
1236         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1239 libo_FUZZ_ARG_ENABLE(dbus,
1240     AS_HELP_STRING([--disable-dbus],
1241         [Determines whether to enable features that depend on dbus.
1242          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1243 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1245 libo_FUZZ_ARG_ENABLE(sdremote,
1246     AS_HELP_STRING([--disable-sdremote],
1247         [Determines whether to enable Impress remote control (i.e. the server component).]),
1248 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1250 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1251     AS_HELP_STRING([--disable-sdremote-bluetooth],
1252         [Determines whether to build sdremote with bluetooth support.
1253          Requires dbus on Linux.]))
1255 libo_FUZZ_ARG_ENABLE(gio,
1256     AS_HELP_STRING([--disable-gio],
1257         [Determines whether to use the GIO support.]),
1258 ,test "${enable_gio+set}" = set || enable_gio=yes)
1260 AC_ARG_ENABLE(qt5,
1261     AS_HELP_STRING([--enable-qt5],
1262         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1263          available.]),
1266 AC_ARG_ENABLE(kde5,
1267     AS_HELP_STRING([--enable-kde5],
1268         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1269          KF5 are available.]),
1272 AC_ARG_ENABLE(gtk3_kde5,
1273     AS_HELP_STRING([--enable-gtk3-kde5],
1274         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1275          platforms where Gtk3, Qt5 and Plasma is available.]),
1278 libo_FUZZ_ARG_ENABLE(gui,
1279     AS_HELP_STRING([--disable-gui],
1280         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1281          command-line option. Not related to LibreOffice Online functionality. Don't use
1282          unless you are certain you need to. Nobody will help you if you insist on trying
1283          this and run into problems.]),
1284 ,test "${enable_gui+set}" = set || enable_gui=yes)
1286 libo_FUZZ_ARG_ENABLE(randr,
1287     AS_HELP_STRING([--disable-randr],
1288         [Disable RandR support in the vcl project.]),
1289 ,test "${enable_randr+set}" = set || enable_randr=yes)
1291 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1292     AS_HELP_STRING([--disable-gstreamer-1-0],
1293         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1294 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1296 AC_ARG_ENABLE(gstreamer-0-10,
1297     AS_HELP_STRING([--enable-gstreamer-0-10],
1298         [Enable building with the gstreamer 0.10 avmedia backend.]),
1299 ,enable_gstreamer_0_10=no)
1301 libo_FUZZ_ARG_ENABLE(vlc,
1302     AS_HELP_STRING([--enable-vlc],
1303         [Enable building with the (experimental) VLC avmedia backend.]),
1304 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1306 libo_FUZZ_ARG_ENABLE(neon,
1307     AS_HELP_STRING([--disable-neon],
1308         [Disable neon and the compilation of webdav binding.]),
1311 libo_FUZZ_ARG_ENABLE([eot],
1312     [AS_HELP_STRING([--enable-eot],
1313         [Enable support for Embedded OpenType fonts.])],
1314 ,test "${enable_eot+set}" = set || enable_eot=no)
1316 libo_FUZZ_ARG_ENABLE(cve-tests,
1317     AS_HELP_STRING([--disable-cve-tests],
1318         [Prevent CVE tests to be executed]),
1321 libo_FUZZ_ARG_ENABLE(chart-tests,
1322     AS_HELP_STRING([--enable-chart-tests],
1323         [Executes chart XShape tests. In a perfect world these tests would be
1324          stable and everyone could run them, in reality it is best to run them
1325          only on a few machines that are known to work and maintained by people
1326          who can judge if a test failure is a regression or not.]),
1329 AC_ARG_ENABLE(build-unowinreg,
1330     AS_HELP_STRING([--enable-build-unowinreg],
1331         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1332          compiler is needed on Linux.]),
1335 AC_ARG_ENABLE(build-opensymbol,
1336     AS_HELP_STRING([--enable-build-opensymbol],
1337         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1338          fontforge installed.]),
1341 AC_ARG_ENABLE(dependency-tracking,
1342     AS_HELP_STRING([--enable-dependency-tracking],
1343         [Do not reject slow dependency extractors.])[
1344   --disable-dependency-tracking
1345                           Disables generation of dependency information.
1346                           Speed up one-time builds.],
1349 AC_ARG_ENABLE(icecream,
1350     AS_HELP_STRING([--enable-icecream],
1351         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1352          It defaults to /opt/icecream for the location of the icecream gcc/g++
1353          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1356 AC_ARG_ENABLE(ld,
1357     AS_HELP_STRING([--enable-ld=<linker>],
1358         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1359          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1362 libo_FUZZ_ARG_ENABLE(cups,
1363     AS_HELP_STRING([--disable-cups],
1364         [Do not build cups support.])
1367 AC_ARG_ENABLE(ccache,
1368     AS_HELP_STRING([--disable-ccache],
1369         [Do not try to use ccache automatically.
1370          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1371          CC/CXX are not yet set, and --enable-icecream is not given, we
1372          attempt to use ccache. --disable-ccache disables ccache completely.
1373          Additionally ccache's depend mode is enabled if possible,
1374          use --enable-ccache=nodepend to enable ccache without depend mode.
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, *sif_svg, *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 libo_FUZZ_ARG_ENABLE(poppler,
1729     AS_HELP_STRING([--disable-poppler],
1730         [Disable building Poppler.])
1733 AC_ARG_WITH(system-poppler,
1734     AS_HELP_STRING([--with-system-poppler],
1735         [Use system poppler (only needed for PDF import).]),,
1736     [with_system_poppler="$with_system_libs"])
1738 AC_ARG_WITH(system-gpgmepp,
1739     AS_HELP_STRING([--with-system-gpgmepp],
1740         [Use gpgmepp already on system]),,
1741     [with_system_gpgmepp="$with_system_libs"])
1743 AC_ARG_WITH(system-apache-commons,
1744     AS_HELP_STRING([--with-system-apache-commons],
1745         [Use Apache commons libraries already on system.]),,
1746     [with_system_apache_commons="$with_system_jars"])
1748 AC_ARG_WITH(system-mariadb,
1749     AS_HELP_STRING([--with-system-mariadb],
1750         [Use MariaDB/MySQL libraries already on system.]),,
1751     [with_system_mariadb="$with_system_libs"])
1753 AC_ARG_ENABLE(bundle-mariadb,
1754     AS_HELP_STRING([--enable-bundle-mariadb],
1755         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1758 AC_ARG_WITH(system-postgresql,
1759     AS_HELP_STRING([--with-system-postgresql],
1760         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1761          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1762     [with_system_postgresql="$with_system_libs"])
1764 AC_ARG_WITH(libpq-path,
1765     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1766         [Use this PostgreSQL C interface (libpq) installation for building
1767          the PostgreSQL-SDBC extension.]),
1770 AC_ARG_WITH(system-firebird,
1771     AS_HELP_STRING([--with-system-firebird],
1772         [Use Firebird libraries already on system, for building the Firebird-SDBC
1773          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1774     [with_system_firebird="$with_system_libs"])
1776 AC_ARG_WITH(system-libtommath,
1777             AS_HELP_STRING([--with-system-libtommath],
1778                            [Use libtommath already on system]),,
1779             [with_system_libtommath="$with_system_libs"])
1781 AC_ARG_WITH(system-hsqldb,
1782     AS_HELP_STRING([--with-system-hsqldb],
1783         [Use hsqldb already on system.]))
1785 AC_ARG_WITH(hsqldb-jar,
1786     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1787         [Specify path to jarfile manually.]),
1788     HSQLDB_JAR=$withval)
1790 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1791     AS_HELP_STRING([--disable-scripting-beanshell],
1792         [Disable support for scripts in BeanShell.]),
1796 AC_ARG_WITH(system-beanshell,
1797     AS_HELP_STRING([--with-system-beanshell],
1798         [Use beanshell already on system.]),,
1799     [with_system_beanshell="$with_system_jars"])
1801 AC_ARG_WITH(beanshell-jar,
1802     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1803         [Specify path to jarfile manually.]),
1804     BSH_JAR=$withval)
1806 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1807     AS_HELP_STRING([--disable-scripting-javascript],
1808         [Disable support for scripts in JavaScript.]),
1812 AC_ARG_WITH(system-rhino,
1813     AS_HELP_STRING([--with-system-rhino],
1814         [Use rhino already on system.]),,)
1815 #    [with_system_rhino="$with_system_jars"])
1816 # Above is not used as we have different debug interface
1817 # patched into internal rhino. This code needs to be fixed
1818 # before we can enable it by default.
1820 AC_ARG_WITH(rhino-jar,
1821     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1822         [Specify path to jarfile manually.]),
1823     RHINO_JAR=$withval)
1825 AC_ARG_WITH(commons-logging-jar,
1826     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1827         [Specify path to jarfile manually.]),
1828     COMMONS_LOGGING_JAR=$withval)
1830 AC_ARG_WITH(system-jfreereport,
1831     AS_HELP_STRING([--with-system-jfreereport],
1832         [Use JFreeReport already on system.]),,
1833     [with_system_jfreereport="$with_system_jars"])
1835 AC_ARG_WITH(sac-jar,
1836     AS_HELP_STRING([--with-sac-jar=JARFILE],
1837         [Specify path to jarfile manually.]),
1838     SAC_JAR=$withval)
1840 AC_ARG_WITH(libxml-jar,
1841     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1842         [Specify path to jarfile manually.]),
1843     LIBXML_JAR=$withval)
1845 AC_ARG_WITH(flute-jar,
1846     AS_HELP_STRING([--with-flute-jar=JARFILE],
1847         [Specify path to jarfile manually.]),
1848     FLUTE_JAR=$withval)
1850 AC_ARG_WITH(jfreereport-jar,
1851     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1852         [Specify path to jarfile manually.]),
1853     JFREEREPORT_JAR=$withval)
1855 AC_ARG_WITH(liblayout-jar,
1856     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1857         [Specify path to jarfile manually.]),
1858     LIBLAYOUT_JAR=$withval)
1860 AC_ARG_WITH(libloader-jar,
1861     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1862         [Specify path to jarfile manually.]),
1863     LIBLOADER_JAR=$withval)
1865 AC_ARG_WITH(libformula-jar,
1866     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1867         [Specify path to jarfile manually.]),
1868     LIBFORMULA_JAR=$withval)
1870 AC_ARG_WITH(librepository-jar,
1871     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1872         [Specify path to jarfile manually.]),
1873     LIBREPOSITORY_JAR=$withval)
1875 AC_ARG_WITH(libfonts-jar,
1876     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1877         [Specify path to jarfile manually.]),
1878     LIBFONTS_JAR=$withval)
1880 AC_ARG_WITH(libserializer-jar,
1881     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1882         [Specify path to jarfile manually.]),
1883     LIBSERIALIZER_JAR=$withval)
1885 AC_ARG_WITH(libbase-jar,
1886     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1887         [Specify path to jarfile manually.]),
1888     LIBBASE_JAR=$withval)
1890 AC_ARG_WITH(system-odbc,
1891     AS_HELP_STRING([--with-system-odbc],
1892         [Use the odbc headers already on system.]),,
1893     [with_system_odbc="auto"])
1895 AC_ARG_WITH(system-sane,
1896     AS_HELP_STRING([--with-system-sane],
1897         [Use sane.h already on system.]),,
1898     [with_system_sane="$with_system_headers"])
1900 AC_ARG_WITH(system-bluez,
1901     AS_HELP_STRING([--with-system-bluez],
1902         [Use bluetooth.h already on system.]),,
1903     [with_system_bluez="$with_system_headers"])
1905 AC_ARG_WITH(system-curl,
1906     AS_HELP_STRING([--with-system-curl],
1907         [Use curl already on system.]),,
1908     [with_system_curl=auto])
1910 AC_ARG_WITH(system-boost,
1911     AS_HELP_STRING([--with-system-boost],
1912         [Use boost already on system.]),,
1913     [with_system_boost="$with_system_headers"])
1915 AC_ARG_WITH(system-glm,
1916     AS_HELP_STRING([--with-system-glm],
1917         [Use glm already on system.]),,
1918     [with_system_glm="$with_system_headers"])
1920 AC_ARG_WITH(system-hunspell,
1921     AS_HELP_STRING([--with-system-hunspell],
1922         [Use libhunspell already on system.]),,
1923     [with_system_hunspell="$with_system_libs"])
1925 AC_ARG_WITH(system-mythes,
1926     AS_HELP_STRING([--with-system-mythes],
1927         [Use mythes already on system.]),,
1928     [with_system_mythes="$with_system_libs"])
1930 AC_ARG_WITH(system-altlinuxhyph,
1931     AS_HELP_STRING([--with-system-altlinuxhyph],
1932         [Use ALTLinuxhyph already on system.]),,
1933     [with_system_altlinuxhyph="$with_system_libs"])
1935 AC_ARG_WITH(system-lpsolve,
1936     AS_HELP_STRING([--with-system-lpsolve],
1937         [Use lpsolve already on system.]),,
1938     [with_system_lpsolve="$with_system_libs"])
1940 AC_ARG_WITH(system-coinmp,
1941     AS_HELP_STRING([--with-system-coinmp],
1942         [Use CoinMP already on system.]),,
1943     [with_system_coinmp="$with_system_libs"])
1945 AC_ARG_WITH(system-liblangtag,
1946     AS_HELP_STRING([--with-system-liblangtag],
1947         [Use liblangtag library already on system.]),,
1948     [with_system_liblangtag="$with_system_libs"])
1950 AC_ARG_WITH(webdav,
1951     AS_HELP_STRING([--with-webdav],
1952         [Specify which library to use for webdav implementation.
1953          Possible values: "neon", "serf", "no". The default value is "neon".
1954          Example: --with-webdav="serf"]),
1955     WITH_WEBDAV=$withval,
1956     WITH_WEBDAV="neon")
1958 AC_ARG_WITH(linker-hash-style,
1959     AS_HELP_STRING([--with-linker-hash-style],
1960         [Use linker with --hash-style=<style> when linking shared objects.
1961          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1962          if supported on the build system, and "sysv" otherwise.]))
1964 AC_ARG_WITH(jdk-home,
1965     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1966         [If you have installed JDK 1.6 or later on your system please supply the
1967          path here. Note that this is not the location of the java command but the
1968          location of the entire distribution.]),
1971 AC_ARG_WITH(help,
1972     AS_HELP_STRING([--with-help],
1973         [Enable the build of help. There is a special parameter "common" that
1974          can be used to bundle only the common part, .e.g help-specific icons.
1975          This is useful when you build the helpcontent separately.])
1976     [
1977                           Usage:     --with-help    build the old local help
1978                                  --without-help     no local help (default)
1979                                  --with-help=html   build the new HTML local help
1980                                  --with-help=online build the new HTML online help
1981     ],
1984 libo_FUZZ_ARG_WITH(java,
1985     AS_HELP_STRING([--with-java=<java command>],
1986         [Specify the name of the Java interpreter command. Typically "java"
1987          which is the default.
1989          To build without support for Java components, applets, accessibility
1990          or the XML filters written in Java, use --without-java or --with-java=no.]),
1991     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1992     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1995 AC_ARG_WITH(jvm-path,
1996     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1997         [Use a specific JVM search path at runtime.
1998          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2001 AC_ARG_WITH(ant-home,
2002     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2003         [If you have installed Apache Ant on your system, please supply the path here.
2004          Note that this is not the location of the Ant binary but the location
2005          of the entire distribution.]),
2008 AC_ARG_WITH(symbol-config,
2009     AS_HELP_STRING([--with-symbol-config],
2010         [Configuration for the crashreport symbol upload]),
2011         [],
2012         [with_symbol_config=no])
2014 AC_ARG_WITH(export-validation,
2015     AS_HELP_STRING([--without-export-validation],
2016         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2017 ,with_export_validation=auto)
2019 AC_ARG_WITH(bffvalidator,
2020     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2021         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2022          Requires installed Microsoft Office Binary File Format Validator.
2023          Note: export-validation (--with-export-validation) is required to be turned on.
2024          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2025 ,with_bffvalidator=no)
2027 libo_FUZZ_ARG_WITH(junit,
2028     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2029         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2030          --without-junit disables those tests. Not relevant in the --without-java case.]),
2031 ,with_junit=yes)
2033 AC_ARG_WITH(hamcrest,
2034     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2035         [Specifies the hamcrest jar file to use for JUnit-based tests.
2036          --without-junit disables those tests. Not relevant in the --without-java case.]),
2037 ,with_hamcrest=yes)
2039 AC_ARG_WITH(perl-home,
2040     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2041         [If you have installed Perl 5 Distribution, on your system, please
2042          supply the path here. Note that this is not the location of the Perl
2043          binary but the location of the entire distribution.]),
2046 libo_FUZZ_ARG_WITH(doxygen,
2047     AS_HELP_STRING(
2048         [--with-doxygen=<absolute path to doxygen executable>],
2049         [Specifies the doxygen executable to use when generating ODK C/C++
2050          documentation. --without-doxygen disables generation of ODK C/C++
2051          documentation. Not relevant in the --disable-odk case.]),
2052 ,with_doxygen=yes)
2054 AC_ARG_WITH(visual-studio,
2055     AS_HELP_STRING([--with-visual-studio=<2017>],
2056         [Specify which Visual Studio version to use in case several are
2057          installed. Currently only 2017 is supported.]),
2060 AC_ARG_WITH(windows-sdk,
2061     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2062         [Specify which Windows SDK, or "Windows Kit", version to use
2063          in case the one that came with the selected Visual Studio
2064          is not what you want for some reason. Note that not all compiler/SDK
2065          combinations are supported. The intent is that this option should not
2066          be needed.]),
2069 AC_ARG_WITH(lang,
2070     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2071         [Use this option to build LibreOffice with additional UI language support.
2072          English (US) is always included by default.
2073          Separate multiple languages with space.
2074          For all languages, use --with-lang=ALL.]),
2077 AC_ARG_WITH(locales,
2078     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2079         [Use this option to limit the locale information built in.
2080          Separate multiple locales with space.
2081          Very experimental and might well break stuff.
2082          Just a desperate measure to shrink code and data size.
2083          By default all the locales available is included.
2084          This option is completely unrelated to --with-lang.])
2085     [
2086                           Affects also our character encoding conversion
2087                           tables for encodings mainly targeted for a
2088                           particular locale, like EUC-CN and EUC-TW for
2089                           zh, ISO-2022-JP for ja.
2091                           Affects also our add-on break iterator data for
2092                           some languages.
2094                           For the default, all locales, don't use this switch at all.
2095                           Specifying just the language part of a locale means all matching
2096                           locales will be included.
2097     ],
2100 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2101 libo_FUZZ_ARG_WITH(krb5,
2102     AS_HELP_STRING([--with-krb5],
2103         [Enable MIT Kerberos 5 support in modules that support it.
2104          By default automatically enabled on platforms
2105          where a good system Kerberos 5 is available.]),
2108 libo_FUZZ_ARG_WITH(gssapi,
2109     AS_HELP_STRING([--with-gssapi],
2110         [Enable GSSAPI support in modules that support it.
2111          By default automatically enabled on platforms
2112          where a good system GSSAPI is available.]),
2115 AC_ARG_WITH(iwyu,
2116     AS_HELP_STRING([--with-iwyu],
2117         [Use given IWYU binary path to check unneeded includes instead of building.
2118          Use only if you are hacking on it.]),
2121 libo_FUZZ_ARG_WITH(lxml,
2122     AS_HELP_STRING([--without-lxml],
2123         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2124          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2125          report widget classes and ids.]),
2128 dnl ===================================================================
2129 dnl Branding
2130 dnl ===================================================================
2132 AC_ARG_WITH(branding,
2133     AS_HELP_STRING([--with-branding=/path/to/images],
2134         [Use given path to retrieve branding images set.])
2135     [
2136                           Search for intro.png about.svg and flat_logo.svg.
2137                           If any is missing, default ones will be used instead.
2139                           Search also progress.conf for progress
2140                           settings on intro screen :
2142                           PROGRESSBARCOLOR="255,255,255" Set color of
2143                           progress bar. Comma separated RGB decimal values.
2144                           PROGRESSSIZE="407,6" Set size of progress bar.
2145                           Comma separated decimal values (width, height).
2146                           PROGRESSPOSITION="61,317" Set position of progress
2147                           bar from left,top. Comma separated decimal values.
2148                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2149                           bar frame. Comma separated RGB decimal values.
2150                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2151                           bar text. Comma separated RGB decimal values.
2152                           PROGRESSTEXTBASELINE="287" Set vertical position of
2153                           progress bar text from top. Decimal value.
2155                           Default values will be used if not found.
2156     ],
2160 AC_ARG_WITH(extra-buildid,
2161     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2162         [Show addition build identification in about dialog.]),
2166 AC_ARG_WITH(vendor,
2167     AS_HELP_STRING([--with-vendor="John the Builder"],
2168         [Set vendor of the build.]),
2171 AC_ARG_WITH(android-package-name,
2172     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2173         [Set Android package name of the build.]),
2176 AC_ARG_WITH(compat-oowrappers,
2177     AS_HELP_STRING([--with-compat-oowrappers],
2178         [Install oo* wrappers in parallel with
2179          lo* ones to keep backward compatibility.
2180          Has effect only with make distro-pack-install]),
2183 AC_ARG_WITH(os-version,
2184     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2185         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2188 AC_ARG_WITH(mingw-cross-compiler,
2189     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2190         [Specify the MinGW cross-compiler to use.
2191          When building on the ODK on Unix and building unowinreg.dll,
2192          specify the MinGW C++ cross-compiler.]),
2195 AC_ARG_WITH(idlc-cpp,
2196     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2197         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2200 AC_ARG_WITH(build-version,
2201     AS_HELP_STRING([--with-build-version="Built by Jim"],
2202         [Allows the builder to add a custom version tag that will appear in the
2203          Help/About box for QA purposes.]),
2204 with_build_version=$withval,
2207 AC_ARG_WITH(parallelism,
2208     AS_HELP_STRING([--with-parallelism],
2209         [Number of jobs to run simultaneously during build. Parallel builds can
2210         save a lot of time on multi-cpu machines. Defaults to the number of
2211         CPUs on the machine, unless you configure --enable-icecream - then to
2212         10.]),
2215 AC_ARG_WITH(all-tarballs,
2216     AS_HELP_STRING([--with-all-tarballs],
2217         [Download all external tarballs unconditionally]))
2219 AC_ARG_WITH(gdrive-client-id,
2220     AS_HELP_STRING([--with-gdrive-client-id],
2221         [Provides the client id of the application for OAuth2 authentication
2222         on Google Drive. If either this or --with-gdrive-client-secret is
2223         empty, the feature will be disabled]),
2226 AC_ARG_WITH(gdrive-client-secret,
2227     AS_HELP_STRING([--with-gdrive-client-secret],
2228         [Provides the client secret of the application for OAuth2
2229         authentication on Google Drive. If either this or
2230         --with-gdrive-client-id is empty, the feature will be disabled]),
2233 AC_ARG_WITH(alfresco-cloud-client-id,
2234     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2235         [Provides the client id of the application for OAuth2 authentication
2236         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2237         empty, the feature will be disabled]),
2240 AC_ARG_WITH(alfresco-cloud-client-secret,
2241     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2242         [Provides the client secret of the application for OAuth2
2243         authentication on Alfresco Cloud. If either this or
2244         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2247 AC_ARG_WITH(onedrive-client-id,
2248     AS_HELP_STRING([--with-onedrive-client-id],
2249         [Provides the client id of the application for OAuth2 authentication
2250         on OneDrive. If either this or --with-onedrive-client-secret is
2251         empty, the feature will be disabled]),
2254 AC_ARG_WITH(onedrive-client-secret,
2255     AS_HELP_STRING([--with-onedrive-client-secret],
2256         [Provides the client secret of the application for OAuth2
2257         authentication on OneDrive. If either this or
2258         --with-onedrive-client-id is empty, the feature will be disabled]),
2260 dnl ===================================================================
2261 dnl Do we want to use pre-build binary tarball for recompile
2262 dnl ===================================================================
2264 if test "$enable_library_bin_tar" = "yes" ; then
2265     USE_LIBRARY_BIN_TAR=TRUE
2266 else
2267     USE_LIBRARY_BIN_TAR=
2269 AC_SUBST(USE_LIBRARY_BIN_TAR)
2271 dnl ===================================================================
2272 dnl Test whether build target is Release Build
2273 dnl ===================================================================
2274 AC_MSG_CHECKING([whether build target is Release Build])
2275 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2276     AC_MSG_RESULT([no])
2277     ENABLE_RELEASE_BUILD=
2278 else
2279     AC_MSG_RESULT([yes])
2280     ENABLE_RELEASE_BUILD=TRUE
2282 AC_SUBST(ENABLE_RELEASE_BUILD)
2284 dnl ===================================================================
2285 dnl Test whether to sign Windows Build
2286 dnl ===================================================================
2287 AC_MSG_CHECKING([whether to sign windows build])
2288 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2289     AC_MSG_RESULT([yes])
2290     WINDOWS_BUILD_SIGNING="TRUE"
2291 else
2292     AC_MSG_RESULT([no])
2293     WINDOWS_BUILD_SIGNING="FALSE"
2295 AC_SUBST(WINDOWS_BUILD_SIGNING)
2297 dnl ===================================================================
2298 dnl MacOSX build and runtime environment options
2299 dnl ===================================================================
2301 AC_ARG_WITH(macosx-sdk,
2302     AS_HELP_STRING([--with-macosx-sdk=<version>],
2303         [Prefer a specific SDK for building.])
2304     [
2305                           If the requested SDK is not available, a search for the oldest one will be done.
2306                           With current Xcode versions, only the latest SDK is included, so this option is
2307                           not terribly useful. It works fine to build with a new SDK and run the result
2308                           on an older OS.
2310                           e. g.: --with-macosx-sdk=10.10
2312                           there are 3 options to control the MacOSX build:
2313                           --with-macosx-sdk (referred as 'sdk' below)
2314                           --with-macosx-version-min-required (referred as 'min' below)
2315                           --with-macosx-version-max-allowed (referred as 'max' below)
2317                           the connection between these value and the default they take is as follow:
2318                           ( ? means not specified on the command line, s means the SDK version found,
2319                           constraint: 8 <= x <= y <= z)
2321                           ==========================================
2322                            command line      || config result
2323                           ==========================================
2324                           min  | max  | sdk  || min   | max  | sdk  |
2325                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2326                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2327                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2328                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2329                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2330                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2331                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2332                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2335                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2336                           for a detailed technical explanation of these variables
2338                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2339     ],
2342 AC_ARG_WITH(macosx-version-min-required,
2343     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2344         [set the minimum OS version needed to run the built LibreOffice])
2345     [
2346                           e. g.: --with-macos-version-min-required=10.10
2347                           see --with-macosx-sdk for more info
2348     ],
2351 AC_ARG_WITH(macosx-version-max-allowed,
2352     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2353         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2354     [
2355                           e. g.: --with-macos-version-max-allowed=10.10
2356                           see --with-macosx-sdk for more info
2357     ],
2361 dnl ===================================================================
2362 dnl options for stuff used during cross-compilation build
2363 dnl Not quite superseded by --with-build-platform-configure-options.
2364 dnl TODO: check, if the "force" option is still needed anywhere.
2365 dnl ===================================================================
2367 AC_ARG_WITH(system-icu-for-build,
2368     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2369         [Use icu already on system for build tools (cross-compilation only).]))
2372 dnl ===================================================================
2373 dnl Check for incompatible options set by fuzzing, and reset those
2374 dnl automatically to working combinations
2375 dnl ===================================================================
2377 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2378         "$enable_dbus" != "$enable_avahi"; then
2379     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2380     enable_avahi=$enable_dbus
2383 dnl ===================================================================
2384 dnl check for required programs (grep, awk, sed, bash)
2385 dnl ===================================================================
2387 pathmunge ()
2389     if test -n "$1"; then
2390         if test "$build_os" = "cygwin"; then
2391             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2392                 PathFormat "$1"
2393                 new_path=`cygpath -sm "$formatted_path"`
2394             else
2395                 PathFormat "$1"
2396                 new_path=`cygpath -u "$formatted_path"`
2397             fi
2398         else
2399             new_path="$1"
2400         fi
2401         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2402             if test "$2" = "after"; then
2403                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2404             else
2405                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2406             fi
2407         fi
2408         unset new_path
2409     fi
2412 AC_PROG_AWK
2413 AC_PATH_PROG( AWK, $AWK)
2414 if test -z "$AWK"; then
2415     AC_MSG_ERROR([install awk to run this script])
2418 AC_PATH_PROG(BASH, bash)
2419 if test -z "$BASH"; then
2420     AC_MSG_ERROR([bash not found in \$PATH])
2422 AC_SUBST(BASH)
2424 AC_MSG_CHECKING([for GNU or BSD tar])
2425 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2426     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2427     if test $? -eq 0;  then
2428         GNUTAR=$a
2429         break
2430     fi
2431 done
2432 AC_MSG_RESULT($GNUTAR)
2433 if test -z "$GNUTAR"; then
2434     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2436 AC_SUBST(GNUTAR)
2438 AC_MSG_CHECKING([for tar's option to strip components])
2439 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2440 if test $? -eq 0; then
2441     STRIP_COMPONENTS="--strip-components"
2442 else
2443     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2444     if test $? -eq 0; then
2445         STRIP_COMPONENTS="--strip-path"
2446     else
2447         STRIP_COMPONENTS="unsupported"
2448     fi
2450 AC_MSG_RESULT($STRIP_COMPONENTS)
2451 if test x$STRIP_COMPONENTS = xunsupported; then
2452     AC_MSG_ERROR([you need a tar that is able to strip components.])
2454 AC_SUBST(STRIP_COMPONENTS)
2456 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2457 dnl desktop OSes from "mobile" ones.
2459 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2460 dnl In other words, that when building for an OS that is not a
2461 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2463 dnl Note the direction of the implication; there is no assumption that
2464 dnl cross-compiling would imply a non-desktop OS.
2466 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2467     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2468     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2469     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2472 # Whether to build "avmedia" functionality or not.
2474 if test -z "$enable_avmedia"; then
2475     enable_avmedia=yes
2478 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2479 if test "$enable_avmedia" = yes; then
2480     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2481 else
2482     USE_AVMEDIA_DUMMY='TRUE'
2484 AC_SUBST(USE_AVMEDIA_DUMMY)
2486 # Decide whether to build database connectivity stuff (including
2487 # Base) or not. We probably don't want to on non-desktop OSes.
2488 if test -z "$enable_database_connectivity"; then
2489     # --disable-database-connectivity is unfinished work in progress
2490     # and the iOS test app doesn't link if we actually try to use it.
2491     # if test $_os != iOS -a $_os != Android; then
2492     if test $_os != iOS; then
2493         enable_database_connectivity=yes
2494     fi
2497 if test "$enable_database_connectivity" = yes; then
2498     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2499     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2502 if test -z "$enable_extensions"; then
2503     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2504     if test $_os != iOS -a $_os != Android; then
2505         enable_extensions=yes
2506     fi
2509 if test "$enable_extensions" = yes; then
2510     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2511     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2514 if test -z "$enable_scripting"; then
2515     # Disable scripting for iOS unless specifically overridden
2516     # with --enable-scripting.
2517     if test $_os != iOS; then
2518         enable_scripting=yes
2519     fi
2522 DISABLE_SCRIPTING=''
2523 if test "$enable_scripting" = yes; then
2524     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2525     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2526 else
2527     DISABLE_SCRIPTING='TRUE'
2528     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2531 if test $_os = iOS -o $_os = Android; then
2532     # Disable dynamic_loading always for iOS and Android
2533     enable_dynamic_loading=no
2534 elif test -z "$enable_dynamic_loading"; then
2535     # Otherwise enable it unless specifically disabled
2536     enable_dynamic_loading=yes
2539 DISABLE_DYNLOADING=''
2540 if test "$enable_dynamic_loading" = yes; then
2541     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2542 else
2543     DISABLE_DYNLOADING='TRUE'
2545 AC_SUBST(DISABLE_DYNLOADING)
2547 # remember SYSBASE value
2548 AC_SUBST(SYSBASE)
2550 dnl ===================================================================
2551 dnl  Sort out various gallery compilation options
2552 dnl ===================================================================
2553 AC_MSG_CHECKING([how to build and package galleries])
2554 if test -n "${with_galleries}"; then
2555     if test "$with_galleries" = "build"; then
2556         WITH_GALLERY_BUILD=TRUE
2557         AC_MSG_RESULT([build from source images internally])
2558     elif test "$with_galleries" = "no"; then
2559         WITH_GALLERY_BUILD=
2560         AC_MSG_RESULT([disable non-internal gallery build])
2561     else
2562         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2563     fi
2564 else
2565     if test $_os != iOS -a $_os != Android; then
2566         WITH_GALLERY_BUILD=TRUE
2567         AC_MSG_RESULT([internal src images for desktop])
2568     else
2569         WITH_GALLERY_BUILD=
2570         AC_MSG_RESULT([disable src image build])
2571     fi
2573 AC_SUBST(WITH_GALLERY_BUILD)
2575 dnl ===================================================================
2576 dnl  Checks if ccache is available
2577 dnl ===================================================================
2578 CCACHE_DEPEND_MODE=
2579 if test "$_os" = "WINNT"; then
2580     # on windows/VC build do not use ccache
2581     CCACHE=""
2582 elif test "$enable_ccache" = "no"; then
2583     CCACHE=""
2584 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2585     case "%$CC%$CXX%" in
2586     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2587     # assume that's good then
2588     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2589         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2590         CCACHE_DEPEND_MODE=1
2591         ;;
2592     *)
2593         AC_PATH_PROG([CCACHE],[ccache],[not found])
2594         if test "$CCACHE" = "not found"; then
2595             CCACHE=""
2596         else
2597             CCACHE_DEPEND_MODE=1
2598             # Need to check for ccache version: otherwise prevents
2599             # caching of the results (like "-x objective-c++" for Mac)
2600             if test $_os = Darwin -o $_os = iOS; then
2601                 # Check ccache version
2602                 AC_MSG_CHECKING([whether version of ccache is suitable])
2603                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2604                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2605                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2606                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2607                 else
2608                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2609                     CCACHE=""
2610                     CCACHE_DEPEND_MODE=
2611                 fi
2612             fi
2613         fi
2614         ;;
2615     esac
2616 else
2617     CCACHE=""
2619 if test "$enable_ccache" = "nodepend"; then
2620     CCACHE_DEPEND_MODE=""
2622 AC_SUBST(CCACHE_DEPEND_MODE)
2624 if test "$CCACHE" != ""; then
2625     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2626     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2627     if test "$ccache_size" = ""; then
2628         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2629         if test "$ccache_size" = ""; then
2630             ccache_size=0
2631         fi
2632         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2633         if test $ccache_size -lt 1024; then
2634             CCACHE=""
2635             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2636             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2637         else
2638             # warn that ccache may be too small for debug build
2639             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2640             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2641         fi
2642     else
2643         if test $ccache_size -lt 5; then
2644             #warn that ccache may be too small for debug build
2645             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2646             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2647         fi
2648     fi
2651 dnl ===================================================================
2652 dnl  Checks for C compiler,
2653 dnl  The check for the C++ compiler is later on.
2654 dnl ===================================================================
2655 if test "$_os" != "WINNT"; then
2656     GCC_HOME_SET="true"
2657     AC_MSG_CHECKING([gcc home])
2658     if test -z "$with_gcc_home"; then
2659         if test "$enable_icecream" = "yes"; then
2660             if test -d "/usr/lib/icecc/bin"; then
2661                 GCC_HOME="/usr/lib/icecc/"
2662             elif test -d "/usr/libexec/icecc/bin"; then
2663                 GCC_HOME="/usr/libexec/icecc/"
2664             elif test -d "/opt/icecream/bin"; then
2665                 GCC_HOME="/opt/icecream/"
2666             else
2667                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2669             fi
2670         else
2671             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2672             GCC_HOME_SET="false"
2673         fi
2674     else
2675         GCC_HOME="$with_gcc_home"
2676     fi
2677     AC_MSG_RESULT($GCC_HOME)
2678     AC_SUBST(GCC_HOME)
2680     if test "$GCC_HOME_SET" = "true"; then
2681         if test -z "$CC"; then
2682             CC="$GCC_HOME/bin/gcc"
2683         fi
2684         if test -z "$CXX"; then
2685             CXX="$GCC_HOME/bin/g++"
2686         fi
2687     fi
2690 COMPATH=`dirname "$CC"`
2691 if test "$COMPATH" = "."; then
2692     AC_PATH_PROGS(COMPATH, $CC)
2693     dnl double square bracket to get single because of M4 quote...
2694     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2696 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2698 dnl ===================================================================
2699 dnl Java support
2700 dnl ===================================================================
2701 AC_MSG_CHECKING([whether to build with Java support])
2702 if test "$with_java" != "no"; then
2703     if test "$DISABLE_SCRIPTING" = TRUE; then
2704         AC_MSG_RESULT([no, overridden by --disable-scripting])
2705         ENABLE_JAVA=""
2706         with_java=no
2707     else
2708         AC_MSG_RESULT([yes])
2709         ENABLE_JAVA="TRUE"
2710         AC_DEFINE(HAVE_FEATURE_JAVA)
2711     fi
2712 else
2713     AC_MSG_RESULT([no])
2714     ENABLE_JAVA=""
2717 AC_SUBST(ENABLE_JAVA)
2719 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2721 dnl ENABLE_JAVA="" indicate no Java support at all
2723 dnl ===================================================================
2724 dnl Check macOS SDK and compiler
2725 dnl ===================================================================
2727 if test $_os = Darwin -o $_os = iOS; then
2729     # If no --with-macosx-sdk option is given, look for one
2731     # The intent is that for "most" Mac-based developers, a suitable
2732     # SDK will be found automatically without any configure options.
2734     # For developers with a current Xcode, the lowest-numbered SDK
2735     # higher than or equal to the minimum required should be found.
2737     AC_MSG_CHECKING([what macOS SDK to use])
2738     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2739         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2740         if test -d "$MACOSX_SDK_PATH"; then
2741             with_macosx_sdk="${_macosx_sdk}"
2742             break
2743         else
2744             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2745             if test -d "$MACOSX_SDK_PATH"; then
2746                 with_macosx_sdk="${_macosx_sdk}"
2747                 break
2748             fi
2749         fi
2750     done
2751     if test ! -d "$MACOSX_SDK_PATH"; then
2752         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2753     fi
2755     if test $_os = iOS; then
2756         if test "$enable_ios_simulator" = "yes"; then
2757             useos=iphonesimulator
2758         else
2759             useos=iphoneos
2760         fi
2761         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2762     fi
2763     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2766     case $with_macosx_sdk in
2767     10.12)
2768         MACOSX_SDK_VERSION=101200
2769         ;;
2770     10.13)
2771         MACOSX_SDK_VERSION=101300
2772         ;;
2773     10.14)
2774         MACOSX_SDK_VERSION=101400
2775         ;;
2776     10.15)
2777         MACOSX_SDK_VERSION=101500
2778         ;;
2779     *)
2780         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2781         ;;
2782     esac
2784     if test "$with_macosx_version_min_required" = "" ; then
2785         with_macosx_version_min_required="10.10";
2786     fi
2788     if test "$with_macosx_version_max_allowed" = "" ; then
2789         with_macosx_version_max_allowed="$with_macosx_sdk"
2790     fi
2792     # export this so that "xcrun" invocations later return matching values
2793     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2794     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2795     export DEVELOPER_DIR
2796     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2797     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2799     AC_MSG_CHECKING([whether Xcode is new enough])
2800     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2801     my_xcode_ver2=${my_xcode_ver1#Xcode }
2802     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2803     if test "$my_xcode_ver3" -ge 903; then
2804         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2805     else
2806         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2807     fi
2809     case "$with_macosx_version_min_required" in
2810     10.10)
2811         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2812         ;;
2813     10.11)
2814         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2815         ;;
2816     10.12)
2817         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2818         ;;
2819     10.13)
2820         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2821         ;;
2822     10.14)
2823         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2824         ;;
2825     10.15)
2826         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2827         ;;
2828     *)
2829         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2830         ;;
2831     esac
2832     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2834     LIBTOOL=/usr/bin/libtool
2835     INSTALL_NAME_TOOL=install_name_tool
2836     if test -z "$save_CC"; then
2837         AC_MSG_CHECKING([what compiler to use])
2838         stdlib=-stdlib=libc++
2839         if test "$ENABLE_LTO" = TRUE; then
2840             lto=-flto
2841         fi
2842         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2843         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2844         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2845         AR=`xcrun -find ar`
2846         NM=`xcrun -find nm`
2847         STRIP=`xcrun -find strip`
2848         LIBTOOL=`xcrun -find libtool`
2849         RANLIB=`xcrun -find ranlib`
2850         AC_MSG_RESULT([$CC and $CXX])
2851     fi
2853     case "$with_macosx_version_max_allowed" in
2854     10.10)
2855         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2856         ;;
2857     10.11)
2858         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2859         ;;
2860     10.12)
2861         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2862         ;;
2863     10.13)
2864         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2865         ;;
2866     10.14)
2867         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2868         ;;
2869     10.15)
2870         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2871         ;;
2872     *)
2873         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2874         ;;
2875     esac
2877     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2878     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2879         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])
2880     else
2881         AC_MSG_RESULT([ok])
2882     fi
2884     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2885     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2886         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2887     else
2888         AC_MSG_RESULT([ok])
2889     fi
2890     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2891     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2893     AC_MSG_CHECKING([whether to do code signing])
2895     if test "$enable_macosx_code_signing" = yes; then
2896         # By default use the first suitable certificate (?).
2898         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2899         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2900         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2901         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2902         # "Developer ID Application" one.
2904         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2905         if test -n "$identity"; then
2906             MACOSX_CODESIGNING_IDENTITY=$identity
2907             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2908             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2909         else
2910             AC_MSG_ERROR([cannot determine identity to use])
2911         fi
2912     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2913         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2914         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2915         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2916     else
2917         AC_MSG_RESULT([no])
2918     fi
2920     AC_MSG_CHECKING([whether to create a Mac App Store package])
2922     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2923         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2924     elif test "$enable_macosx_package_signing" = yes; then
2925         # By default use the first suitable certificate.
2926         # It should be a "3rd Party Mac Developer Installer" one
2928         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2929         if test -n "$identity"; then
2930             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2931             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2932             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2933         else
2934             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2935         fi
2936     elif test -n "$enable_macosx_package_signing"; then
2937         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2938         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2939         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2940     else
2941         AC_MSG_RESULT([no])
2942     fi
2944     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2945         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2946     fi
2948     AC_MSG_CHECKING([whether to sandbox the application])
2950     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2951         AC_MSG_ERROR([macOS sandboxing requires code signing])
2952     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2953         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2954     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2955         ENABLE_MACOSX_SANDBOX=TRUE
2956         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2957         AC_MSG_RESULT([yes])
2958     else
2959         AC_MSG_RESULT([no])
2960     fi
2962     AC_MSG_CHECKING([what macOS app bundle identifier to use])
2963     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2964     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2966 AC_SUBST(MACOSX_SDK_PATH)
2967 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2968 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2969 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2970 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2971 AC_SUBST(INSTALL_NAME_TOOL)
2972 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
2973 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2974 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2975 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2976 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2978 dnl ===================================================================
2979 dnl Check iOS SDK and compiler
2980 dnl ===================================================================
2982 if test $_os = iOS; then
2983     AC_MSG_CHECKING([what iOS SDK to use])
2984     current_sdk_ver=12.2
2985     older_sdk_vers="13.0 12.1 12.0 11.4"
2986     if test "$enable_ios_simulator" = "yes"; then
2987         platform=iPhoneSimulator
2988         versionmin=-mios-simulator-version-min=11.0
2989     else
2990         platform=iPhoneOS
2991         versionmin=-miphoneos-version-min=11.0
2992     fi
2993     xcode_developer=`xcode-select -print-path`
2995     for sdkver in $current_sdk_ver $older_sdk_vers; do
2996         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2997         if test -d $t; then
2998             sysroot=$t
2999             break
3000         fi
3001     done
3003     if test -z "$sysroot"; then
3004         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3005     fi
3007     AC_MSG_RESULT($sysroot)
3009     # LTO is not really recommended for iOS builds,
3010     # the link time will be astronomical
3011     if test "$ENABLE_LTO" = TRUE; then
3012         lto=-flto
3013     fi
3015     stdlib="-stdlib=libc++"
3017     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3018     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3020     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3021     AR=`xcrun -find ar`
3022     NM=`xcrun -find nm`
3023     STRIP=`xcrun -find strip`
3024     LIBTOOL=`xcrun -find libtool`
3025     RANLIB=`xcrun -find ranlib`
3028 AC_MSG_CHECKING([whether to treat the installation as read-only])
3030 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3031         "$enable_extensions" != yes; then
3032     enable_readonly_installset=yes
3034 if test "$enable_readonly_installset" = yes; then
3035     AC_MSG_RESULT([yes])
3036     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3037 else
3038     AC_MSG_RESULT([no])
3041 dnl ===================================================================
3042 dnl Structure of install set
3043 dnl ===================================================================
3045 if test $_os = Darwin; then
3046     LIBO_BIN_FOLDER=MacOS
3047     LIBO_ETC_FOLDER=Resources
3048     LIBO_LIBEXEC_FOLDER=MacOS
3049     LIBO_LIB_FOLDER=Frameworks
3050     LIBO_LIB_PYUNO_FOLDER=Resources
3051     LIBO_SHARE_FOLDER=Resources
3052     LIBO_SHARE_HELP_FOLDER=Resources/help
3053     LIBO_SHARE_JAVA_FOLDER=Resources/java
3054     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3055     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3056     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3057     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3058     LIBO_URE_BIN_FOLDER=MacOS
3059     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3060     LIBO_URE_LIB_FOLDER=Frameworks
3061     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3062     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3063 elif test $_os = WINNT; then
3064     LIBO_BIN_FOLDER=program
3065     LIBO_ETC_FOLDER=program
3066     LIBO_LIBEXEC_FOLDER=program
3067     LIBO_LIB_FOLDER=program
3068     LIBO_LIB_PYUNO_FOLDER=program
3069     LIBO_SHARE_FOLDER=share
3070     LIBO_SHARE_HELP_FOLDER=help
3071     LIBO_SHARE_JAVA_FOLDER=program/classes
3072     LIBO_SHARE_PRESETS_FOLDER=presets
3073     LIBO_SHARE_READMES_FOLDER=readmes
3074     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3075     LIBO_SHARE_SHELL_FOLDER=program/shell
3076     LIBO_URE_BIN_FOLDER=program
3077     LIBO_URE_ETC_FOLDER=program
3078     LIBO_URE_LIB_FOLDER=program
3079     LIBO_URE_MISC_FOLDER=program
3080     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3081 else
3082     LIBO_BIN_FOLDER=program
3083     LIBO_ETC_FOLDER=program
3084     LIBO_LIBEXEC_FOLDER=program
3085     LIBO_LIB_FOLDER=program
3086     LIBO_LIB_PYUNO_FOLDER=program
3087     LIBO_SHARE_FOLDER=share
3088     LIBO_SHARE_HELP_FOLDER=help
3089     LIBO_SHARE_JAVA_FOLDER=program/classes
3090     LIBO_SHARE_PRESETS_FOLDER=presets
3091     LIBO_SHARE_READMES_FOLDER=readmes
3092     if test "$enable_fuzzers" != yes; then
3093         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3094     else
3095         LIBO_SHARE_RESOURCE_FOLDER=resource
3096     fi
3097     LIBO_SHARE_SHELL_FOLDER=program/shell
3098     LIBO_URE_BIN_FOLDER=program
3099     LIBO_URE_ETC_FOLDER=program
3100     LIBO_URE_LIB_FOLDER=program
3101     LIBO_URE_MISC_FOLDER=program
3102     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3104 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3105 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3106 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3107 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3108 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3109 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3110 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3111 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3112 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3113 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3114 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3115 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3116 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3117 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3118 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3119 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3121 # Not all of them needed in config_host.mk, add more if need arises
3122 AC_SUBST(LIBO_BIN_FOLDER)
3123 AC_SUBST(LIBO_ETC_FOLDER)
3124 AC_SUBST(LIBO_LIB_FOLDER)
3125 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3126 AC_SUBST(LIBO_SHARE_FOLDER)
3127 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3128 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3129 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3130 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3131 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3132 AC_SUBST(LIBO_URE_BIN_FOLDER)
3133 AC_SUBST(LIBO_URE_ETC_FOLDER)
3134 AC_SUBST(LIBO_URE_LIB_FOLDER)
3135 AC_SUBST(LIBO_URE_MISC_FOLDER)
3136 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3138 dnl ===================================================================
3139 dnl Windows specific tests and stuff
3140 dnl ===================================================================
3142 reg_get_value()
3144     # Return value: $regvalue
3145     unset regvalue
3147     local _regentry="/proc/registry${1}/${2}"
3148     if test -f "$_regentry"; then
3149         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3150         # Registry keys read via /proc/registry* are always \0 terminated!
3151         local _regvalue=$(tr -d '\0' < "$_regentry")
3152         if test $? -eq 0; then
3153             regvalue=$_regvalue
3154         fi
3155     fi
3158 # Get a value from the 32-bit side of the Registry
3159 reg_get_value_32()
3161     reg_get_value "32" "$1"
3164 # Get a value from the 64-bit side of the Registry
3165 reg_get_value_64()
3167     reg_get_value "64" "$1"
3170 if test "$_os" = "WINNT"; then
3171     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3172     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3173         AC_MSG_RESULT([no])
3174         WINDOWS_SDK_ARCH="x86"
3175     else
3176         AC_MSG_RESULT([yes])
3177         WINDOWS_SDK_ARCH="x64"
3178         BITNESS_OVERRIDE=64
3179     fi
3181 if test "$_os" = "iOS"; then
3182     cross_compiling="yes"
3185 if test "$cross_compiling" = "yes"; then
3186     export CROSS_COMPILING=TRUE
3187 else
3188     CROSS_COMPILING=
3189     BUILD_TYPE="$BUILD_TYPE NATIVE"
3191 AC_SUBST(CROSS_COMPILING)
3193 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3194 # NOTE: must _not_ be used for bundled external libraries!
3195 ISYSTEM=
3196 if test "$GCC" = "yes"; then
3197     AC_MSG_CHECKING( for -isystem )
3198     save_CFLAGS=$CFLAGS
3199     CFLAGS="$CFLAGS -Werror"
3200     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3201     CFLAGS=$save_CFLAGS
3202     if test -n "$ISYSTEM"; then
3203         AC_MSG_RESULT(yes)
3204     else
3205         AC_MSG_RESULT(no)
3206     fi
3208 if test -z "$ISYSTEM"; then
3209     # fall back to using -I
3210     ISYSTEM=-I
3212 AC_SUBST(ISYSTEM)
3214 dnl ===================================================================
3215 dnl  Check which Visual Studio compiler is used
3216 dnl ===================================================================
3218 map_vs_year_to_version()
3220     # Return value: $vsversion
3222     unset vsversion
3224     case $1 in
3225     2017)
3226         vsversion=15;;
3227     2019)
3228         vsversion=16;;
3229     *)
3230         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3231     esac
3234 vs_versions_to_check()
3236     # Args: $1 (optional) : versions to check, in the order of preference
3237     # Return value: $vsversions
3239     unset vsversions
3241     if test -n "$1"; then
3242         map_vs_year_to_version "$1"
3243         vsversions=$vsversion
3244     else
3245         # We accept only 2017
3246         vsversions="15"
3247     fi
3250 win_get_env_from_vsvars32bat()
3252     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3253     # Also seems to be located in another directory under the same name: vsvars32.bat
3254     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3255     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3256     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3257     chmod +x $WRAPPERBATCHFILEPATH
3258     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3259     rm -f $WRAPPERBATCHFILEPATH
3260     printf '%s' "$_win_get_env_from_vsvars32bat"
3263 find_ucrt()
3265     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3266     if test -n "$regvalue"; then
3267         PathFormat "$regvalue"
3268         UCRTSDKDIR=$formatted_path
3269         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3270         UCRTVERSION=$regvalue
3271         # Rest if not exist
3272         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3273           UCRTSDKDIR=
3274         fi
3275     fi
3276     if test -z "$UCRTSDKDIR"; then
3277         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3278         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3279         if test -f "$ide_env_file"; then
3280             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3281             UCRTSDKDIR=$formatted_path
3282             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3283             dnl Hack needed at least by tml:
3284             if test "$UCRTVERSION" = 10.0.15063.0 \
3285                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3286                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3287             then
3288                 UCRTVERSION=10.0.14393.0
3289             fi
3290         else
3291           AC_MSG_ERROR([No UCRT found])
3292         fi
3293     fi
3296 find_msvc()
3298     # Find Visual C++ 2017/2019
3299     # Args: $1 (optional) : The VS version year
3300     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3302     unset vctest vcnum vcnumwithdot vcbuildnumber
3304     vs_versions_to_check "$1"
3305     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3306     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3307     PathFormat "$vswhere"
3308     vswhere=$formatted_path
3309     for ver in $vsversions; do
3310         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3311         if test -n "$vswhereoutput"; then
3312             PathFormat "$vswhereoutput"
3313             vctest=$formatted_path
3314             break
3315         fi
3316     done
3318     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3319     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3320     # should be removed when upgrading baseline.
3321     if ! test -n "$vctest"; then
3322         for ver in $vsversions; do
3323             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3324             if test -n "$regvalue"; then
3325                 vctest=$regvalue
3326                 break
3327             fi
3328             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3329             if test -n "$regvalue"; then
3330                 AC_MSG_RESULT([found: $regvalue])
3331                 PathFormat "$regvalue"
3332                 vctest=$formatted_path
3333                 break
3334             fi
3335         done
3336     fi
3338     if test -n "$vctest"; then
3339         vcnumwithdot="$ver.0"
3340         case "$vcnumwithdot" in
3341         15.0)
3342             vcyear=2017
3343             vcnum=150
3344             ;;
3345         16.0)
3346             vcyear=2019
3347             vcnum=160
3348             ;;
3349         esac
3350         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3352     fi
3355 SOLARINC=
3356 MSBUILD_PATH=
3357 DEVENV=
3358 if test "$_os" = "WINNT"; then
3359     AC_MSG_CHECKING([Visual C++])
3360     find_msvc "$with_visual_studio"
3361     if test -z "$vctest"; then
3362         if test -n "$with_visual_studio"; then
3363             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3364         else
3365             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3366         fi
3367     fi
3369     if test "$BITNESS_OVERRIDE" = ""; then
3370         if test -f "$vctest/bin/cl.exe"; then
3371             VC_PRODUCT_DIR=$vctest
3372         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3373             VC_PRODUCT_DIR=$vctest/VC
3374         else
3375             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3376         fi
3377     else
3378         if test -f "$vctest/bin/amd64/cl.exe"; then
3379             VC_PRODUCT_DIR=$vctest
3380         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3381             VC_PRODUCT_DIR=$vctest/VC
3382         else
3383             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])
3384         fi
3385     fi
3387     AC_MSG_CHECKING([for short pathname of VC product directory])
3388     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3389     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3391     UCRTSDKDIR=
3392     UCRTVERSION=
3394     AC_MSG_CHECKING([for UCRT location])
3395     find_ucrt
3396     # find_ucrt errors out if it doesn't find it
3397     AC_MSG_RESULT([found])
3398     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3399     ucrtincpath_formatted=$formatted_path
3400     # SOLARINC is used for external modules and must be set too.
3401     # And no, it's not sufficient to set SOLARINC only, as configure
3402     # itself doesn't honour it.
3403     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3404     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3405     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3406     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3408     AC_SUBST(UCRTSDKDIR)
3409     AC_SUBST(UCRTVERSION)
3411     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3412     # Find the proper version of MSBuild.exe to use based on the VS version
3413     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3414     if test -n "$regvalue" ; then
3415         AC_MSG_RESULT([found: $regvalue])
3416         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3417     else
3418         if test "$vcnumwithdot" = "16.0"; then
3419             if test "$BITNESS_OVERRIDE" = ""; then
3420                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3421             else
3422                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3423             fi
3424         else
3425             if test "$BITNESS_OVERRIDE" = ""; then
3426                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3427             else
3428                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3429             fi
3430         fi
3431         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3432         AC_MSG_RESULT([$regvalue])
3433     fi
3435     # Find the version of devenv.exe
3436     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3437     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3438     if test ! -e "$DEVENV"; then
3439         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3440     fi
3442     dnl ===========================================================
3443     dnl  Check for the corresponding mspdb*.dll
3444     dnl ===========================================================
3446     MSPDB_PATH=
3447     CL_DIR=
3448     CL_LIB=
3450     if test "$BITNESS_OVERRIDE" = ""; then
3451         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3452         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3453     else
3454         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3455         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3456     fi
3458     # MSVC 15.0 has libraries from 14.0?
3459     mspdbnum="140"
3461     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3462         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3463     fi
3465     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3466     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3468     dnl The path needs to be added before cl is called
3469     PATH="$MSPDB_PATH:$PATH"
3471     AC_MSG_CHECKING([cl.exe])
3473     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3474     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3475     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3476     # is not enough?
3478     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3479     dnl needed when building CLR code:
3480     if test -z "$MSVC_CXX"; then
3481         if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3482             MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3483         fi
3485         # This gives us a posix path with 8.3 filename restrictions
3486         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3487     fi
3489     if test -z "$CC"; then
3490         CC=$MSVC_CXX
3491     fi
3492     if test "$BITNESS_OVERRIDE" = ""; then
3493         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3494         MSVC_CXX="$MSVC_CXX -arch:SSE"
3495     fi
3497     if test -n "$CC"; then
3498         # Remove /cl.exe from CC case insensitive
3499         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3500         if test "$BITNESS_OVERRIDE" = ""; then
3501            COMPATH="$VC_PRODUCT_DIR"
3502         else
3503             if test -n "$VC_PRODUCT_DIR"; then
3504                 COMPATH=$VC_PRODUCT_DIR
3505             fi
3506         fi
3507         if test "$BITNESS_OVERRIDE" = ""; then
3508             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3509             CC="$CC -arch:SSE"
3510         fi
3512         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3514         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3516         PathFormat "$COMPATH"
3517         COMPATH="$formatted_path"
3519         VCVER=$vcnum
3520         MSVSVER=$vcyear
3522         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3523         # are always "better", we list them in reverse chronological order.
3525         case "$vcnum" in
3526         150|160)
3527             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3528             ;;
3529         esac
3531         # The expectation is that --with-windows-sdk should not need to be used
3532         if test -n "$with_windows_sdk"; then
3533             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3534             *" "$with_windows_sdk" "*)
3535                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3536                 ;;
3537             *)
3538                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3539                 ;;
3540             esac
3541         fi
3543         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3544         ac_objext=obj
3545         ac_exeext=exe
3547     else
3548         AC_MSG_ERROR([Visual C++ not found after all, huh])
3549     fi
3551     AC_MSG_CHECKING([$CC is at least Visual Studio 2017 version 15.7])
3552     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3553         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3554         // between Visual Studio versions and _MSC_VER:
3555         #if _MSC_VER < 1914
3556         #error
3557         #endif
3558     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3560     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3561     # version of the Explorer extension (and maybe other small
3562     # bits, too) needed when installing a 32-bit LibreOffice on a
3563     # 64-bit OS. The 64-bit Explorer extension is a feature that
3564     # has been present since long in OOo. Don't confuse it with
3565     # building LibreOffice itself as 64-bit code.
3567     BUILD_X64=
3568     CXX_X64_BINARY=
3570     if test "$BITNESS_OVERRIDE" = ""; then
3571         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3572         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3573             # Prefer native x64 compiler to cross-compiler, in case we are running
3574             # the build on a 64-bit OS.
3575             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3576                 BUILD_X64=TRUE
3577                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3578             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3579                 BUILD_X64=TRUE
3580                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3581             fi
3582         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3583              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3584             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3585             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3586                 BUILD_X64=TRUE
3587                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3588             fi
3589         fi
3590         if test "$BUILD_X64" = TRUE; then
3591             AC_MSG_RESULT([found])
3592         else
3593             AC_MSG_RESULT([not found])
3594             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3595         fi
3596     fi
3597     AC_SUBST(BUILD_X64)
3599     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3600     AC_SUBST(CXX_X64_BINARY)
3602     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3603     # needed to support TWAIN scan on both 32- and 64-bit systems
3605     BUILD_X86=
3607     if test "$BITNESS_OVERRIDE" = "64"; then
3608         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3609         if test -n "$CXX_X86_BINARY"; then
3610             BUILD_X86=TRUE
3611             AC_MSG_RESULT([preset])
3612         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3613             BUILD_X86=TRUE
3614             CXX_X86_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe -arch:SSE"
3615             AC_MSG_RESULT([found])
3616         else
3617             CXX_X86_BINARY=
3618             AC_MSG_RESULT([not found])
3619             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3620         fi
3621     else
3622         BUILD_X86=TRUE
3623         CXX_X86_BINARY=$MSVC_CXX
3624     fi
3625     AC_SUBST(BUILD_X86)
3626     AC_SUBST(CXX_X86_BINARY)
3628 AC_SUBST(VCVER)
3629 AC_SUBST(DEVENV)
3630 PathFormat "$MSPDB_PATH"
3631 MSPDB_PATH="$formatted_path"
3632 AC_SUBST(MSVC_CXX)
3635 # unowinreg.dll
3637 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3638 AC_SUBST(UNOWINREG_DLL)
3640 COM_IS_CLANG=
3641 AC_MSG_CHECKING([whether the compiler is actually Clang])
3642 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3643     #ifndef __clang__
3644     you lose
3645     #endif
3646     int foo=42;
3647     ]])],
3648     [AC_MSG_RESULT([yes])
3649      COM_IS_CLANG=TRUE],
3650     [AC_MSG_RESULT([no])])
3651 AC_SUBST(COM_IS_CLANG)
3653 CC_PLAIN=$CC
3654 CLANGVER=
3655 if test "$COM_IS_CLANG" = TRUE; then
3656     AC_MSG_CHECKING([whether Clang is new enough])
3657     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3658         #if !defined __apple_build_version__
3659         #error
3660         #endif
3661         ]])],
3662         [my_apple_clang=yes],[my_apple_clang=])
3663     if test "$my_apple_clang" = yes; then
3664         AC_MSG_RESULT([assumed yes (Apple Clang)])
3665     else
3666         if test "$_os" = WINNT; then
3667             dnl In which case, assume clang-cl:
3668             my_args="/EP /TC"
3669             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3670             dnl clang-cl:
3671             CC_PLAIN=
3672             for i in $CC; do
3673                 case $i in
3674                 -FIIntrin.h)
3675                     ;;
3676                 *)
3677                     CC_PLAIN="$CC_PLAIN $i"
3678                     ;;
3679                 esac
3680             done
3681         else
3682             my_args="-E -P"
3683         fi
3684         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3685         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3686         CLANGVER=`echo $clang_version \
3687             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3688         if test "$CLANGVER" -ge 50002; then
3689             AC_MSG_RESULT([yes ($clang_version)])
3690         else
3691             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3692         fi
3693         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3694         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3695     fi
3698 SHOWINCLUDES_PREFIX=
3699 if test "$_os" = WINNT; then
3700     dnl We need to guess the prefix of the -showIncludes output, it can be
3701     dnl localized
3702     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3703     echo "#include <stdlib.h>" > conftest.c
3704     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3705         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3706     rm -f conftest.c conftest.obj
3707     if test -z "$SHOWINCLUDES_PREFIX"; then
3708         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3709     else
3710         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3711     fi
3713 AC_SUBST(SHOWINCLUDES_PREFIX)
3716 # prefix C with ccache if needed
3718 if test "$CCACHE" != ""; then
3719     AC_MSG_CHECKING([whether $CC is already ccached])
3721     AC_LANG_PUSH([C])
3722     save_CFLAGS=$CFLAGS
3723     CFLAGS="$CFLAGS --ccache-skip -O2"
3724     dnl an empty program will do, we're checking the compiler flags
3725     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3726                       [use_ccache=yes], [use_ccache=no])
3727     if test $use_ccache = yes; then
3728         AC_MSG_RESULT([yes])
3729     else
3730         CC="$CCACHE $CC"
3731         AC_MSG_RESULT([no])
3732     fi
3733     CFLAGS=$save_CFLAGS
3734     AC_LANG_POP([C])
3737 # ===================================================================
3738 # check various GCC options that Clang does not support now but maybe
3739 # will somewhen in the future, check them even for GCC, so that the
3740 # flags are set
3741 # ===================================================================
3743 HAVE_GCC_GGDB2=
3744 if test "$GCC" = "yes"; then
3745     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3746     save_CFLAGS=$CFLAGS
3747     CFLAGS="$CFLAGS -Werror -ggdb2"
3748     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3749     CFLAGS=$save_CFLAGS
3750     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3751         AC_MSG_RESULT([yes])
3752     else
3753         AC_MSG_RESULT([no])
3754     fi
3756     if test "$host_cpu" = "m68k"; then
3757         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3758         save_CFLAGS=$CFLAGS
3759         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3760         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3761         CFLAGS=$save_CFLAGS
3762         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3763             AC_MSG_RESULT([yes])
3764         else
3765             AC_MSG_ERROR([no])
3766         fi
3767     fi
3769 AC_SUBST(HAVE_GCC_GGDB2)
3771 dnl ===================================================================
3772 dnl  Test the gcc version
3773 dnl ===================================================================
3774 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3775     AC_MSG_CHECKING([the GCC version])
3776     _gcc_version=`$CC -dumpversion`
3777     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3778         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3779     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3781     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3783     if test "$gcc_full_version" -lt 70000; then
3784         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3785     fi
3786 else
3787     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3788     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3789     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3790     # (which reports itself as GCC 4.2.1).
3791     GCC_VERSION=
3793 AC_SUBST(GCC_VERSION)
3795 dnl Set the ENABLE_DBGUTIL variable
3796 dnl ===================================================================
3797 AC_MSG_CHECKING([whether to build with additional debug utilities])
3798 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3799     ENABLE_DBGUTIL="TRUE"
3800     # this is an extra var so it can have different default on different MSVC
3801     # versions (in case there are version specific problems with it)
3802     MSVC_USE_DEBUG_RUNTIME="TRUE"
3804     AC_MSG_RESULT([yes])
3805     # cppunit and graphite expose STL in public headers
3806     if test "$with_system_cppunit" = "yes"; then
3807         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3808     else
3809         with_system_cppunit=no
3810     fi
3811     if test "$with_system_graphite" = "yes"; then
3812         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3813     else
3814         with_system_graphite=no
3815     fi
3816     if test "$with_system_orcus" = "yes"; then
3817         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3818     else
3819         with_system_orcus=no
3820     fi
3821     if test "$with_system_libcmis" = "yes"; then
3822         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3823     else
3824         with_system_libcmis=no
3825     fi
3826     if test "$with_system_hunspell" = "yes"; then
3827         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3828     else
3829         with_system_hunspell=no
3830     fi
3831     if test "$with_system_gpgmepp" = "yes"; then
3832         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3833     else
3834         with_system_gpgmepp=no
3835     fi
3836     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3837     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3838     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3839     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3840     # of those two is using the system variant:
3841     if test "$with_system_libnumbertext" = "yes"; then
3842         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3843     else
3844         with_system_libnumbertext=no
3845     fi
3846     if test "$with_system_libwps" = "yes"; then
3847         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3848     else
3849         with_system_libwps=no
3850     fi
3851 else
3852     ENABLE_DBGUTIL=""
3853     MSVC_USE_DEBUG_RUNTIME=""
3854     AC_MSG_RESULT([no])
3856 AC_SUBST(ENABLE_DBGUTIL)
3857 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3859 dnl Set the ENABLE_DEBUG variable.
3860 dnl ===================================================================
3861 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3862     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3864 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3865     if test -z "$libo_fuzzed_enable_debug"; then
3866         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3867     else
3868         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3869         enable_debug=yes
3870     fi
3873 AC_MSG_CHECKING([whether to do a debug build])
3874 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3875     ENABLE_DEBUG="TRUE"
3876     if test -n "$ENABLE_DBGUTIL" ; then
3877         AC_MSG_RESULT([yes (dbgutil)])
3878     else
3879         AC_MSG_RESULT([yes])
3880     fi
3881 else
3882     ENABLE_DEBUG=""
3883     AC_MSG_RESULT([no])
3885 AC_SUBST(ENABLE_DEBUG)
3887 AC_MSG_CHECKING([whether special RTTI visibility flags are needed for Clang Linux UBSan])
3888 NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=
3889 dnl Clang 9 is known fixed since
3890 dnl <https://github.com/llvm/llvm-project/commit/5745eccef54ddd3caca278d1d292a88b2281528b> "Adapt
3891 dnl -fsanitize=function to SANITIZER_NON_UNIQUE_TYPEINFO":
3892 if test "$COM_IS_CLANG" = TRUE && test "$CLANGVER" -lt 90000 && test "$_os" = Linux; then
3893     for i in $CC; do
3894         case $i in
3895         -fsanitize=*)
3896             NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=TRUE
3897             break
3898             ;;
3899         esac
3900     done
3902 if test "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY" = TRUE; then
3903     AC_MSG_RESULT([yes])
3904 else
3905     AC_MSG_RESULT([no])
3907 AC_SUBST([NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY])
3909 dnl ===================================================================
3910 dnl Select the linker to use (gold/lld/ld.bfd).
3911 dnl This is done only after compiler checks (need to know if Clang is
3912 dnl used, for different defaults) and after checking if a debug build
3913 dnl is wanted (non-debug builds get the default linker if not explicitly
3914 dnl specified otherwise).
3915 dnl All checks for linker features/options should come after this.
3916 dnl ===================================================================
3917 check_use_ld()
3919     use_ld=$1
3920     use_ld_fail_if_error=$2
3921     use_ld_ok=
3922     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3923     use_ld_ldflags_save="$LDFLAGS"
3924     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3925     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3926 #include <stdio.h>
3927         ],[
3928 printf ("hello world\n");
3929         ])], USE_LD=$use_ld, [])
3930     if test -n "$USE_LD"; then
3931         AC_MSG_RESULT( yes )
3932         use_ld_ok=yes
3933         dnl For obscure reasons, unxgcc.mk uses the --dynamic-list-cpp-typeinfo linker option
3934         dnl if NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY, and lld doesn't support this option.
3935         if test -n "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY"; then
3936             AC_MSG_CHECKING([for --dynamic-list-cpp-typeinfo linker support (-fuse-ld=$use_ld)])
3937             use_ld_ldflags_save_2="$LDFLAGS"
3938             LDFLAGS="$LDFLAGS -Wl,--dynamic-list-cpp-typeinfo"
3939             use_ld_has_cpp_typeinfo=
3940             AC_LINK_IFELSE([AC_LANG_PROGRAM([
3941 #include <stdio.h>
3942                 ],[
3943 printf ("hello world\n");
3944                 ])], use_ld_has_cpp_typeinfo=yes, [])
3945             LDFLAGS="$use_ld_ldflags_save_2"
3946             if test -n "$use_ld_has_cpp_typeinfo"; then
3947                 AC_MSG_RESULT( yes )
3948             else
3949                 if test -n "$use_ld_fail_if_error"; then
3950                     AC_MSG_ERROR( no )
3951                 else
3952                     AC_MSG_RESULT( no )
3953                 fi
3954                 use_ld_ok=
3955             fi
3956         fi
3957     else
3958         if test -n "$use_ld_fail_if_error"; then
3959             AC_MSG_ERROR( no )
3960         else
3961             AC_MSG_RESULT( no )
3962         fi
3963     fi
3964     if test -n "$use_ld_ok"; then
3965         dnl keep the value of LDFLAGS
3966         return 0
3967     fi
3968     LDFLAGS="$use_ld_ldflags_save"
3969     return 1
3971 USE_LD=
3972 if test "$enable_ld" != "no"; then
3973     if test "$GCC" = "yes"; then
3974         if test -n "$enable_ld"; then
3975             check_use_ld "$enable_ld" fail_if_error
3976         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3977             dnl non-debug builds default to the default linker
3978             true
3979         elif test -n "$COM_IS_CLANG"; then
3980             check_use_ld lld
3981             if test $? -ne 0; then
3982                 check_use_ld gold
3983             fi
3984         else
3985             check_use_ld gold
3986         fi
3987         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
3988         rm conftest.out
3989         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
3990         if test -z "$ld_used"; then
3991             ld_used="unknown"
3992         fi
3993         AC_MSG_CHECKING([for linker that is used])
3994         AC_MSG_RESULT([$ld_used])
3995         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3996             if echo "$ld_used" | grep -q "^GNU ld"; then
3997                 if test -n "$COM_IS_CLANG"; then
3998                     AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
3999                     add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4000                 else
4001                     AC_MSG_WARN([The default GNU linker is slow, consider using the GNU gold linker.])
4002                     add_warning "The default GNU linker is slow, consider using the GNU gold linker."
4003                 fi
4004             fi
4005         fi
4006     else
4007         if test "$enable_ld" = "yes"; then
4008             AC_MSG_ERROR([--enable-ld not supported])
4009         fi
4010     fi
4012 AC_SUBST(USE_LD)
4014 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4015 if test "$GCC" = "yes"; then
4016     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4017     bsymbolic_functions_ldflags_save=$LDFLAGS
4018     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4019     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4020 #include <stdio.h>
4021         ],[
4022 printf ("hello world\n");
4023         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4024     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4025         AC_MSG_RESULT( found )
4026     else
4027         AC_MSG_RESULT( not found )
4028     fi
4029     LDFLAGS=$bsymbolic_functions_ldflags_save
4031 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4034 HAVE_GSPLIT_DWARF=
4035 if test "$enable_split_debug" != no; then
4036     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4037     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4038         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
4039         save_CFLAGS=$CFLAGS
4040         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4041         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4042         CFLAGS=$save_CFLAGS
4043         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4044             AC_MSG_RESULT([yes])
4045         else
4046             if test "$enable_split_debug" = yes; then
4047                 AC_MSG_ERROR([no])
4048             else
4049                 AC_MSG_RESULT([no])
4050             fi
4051         fi
4052     fi
4053     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4054         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4055         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4056     fi
4058 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4060 ENABLE_GDB_INDEX=
4061 if test "$enable_gdb_index" != "no"; then
4062     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4063     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4064         AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
4065         save_CFLAGS=$CFLAGS
4066         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4067         have_ggnu_pubnames=
4068         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4069         if test "$have_ggnu_pubnames" != "TRUE"; then
4070             if test "$enable_gdb_index" = "yes"; then
4071                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4072             else
4073                 AC_MSG_RESULT( no )
4074             fi
4075         else
4076             AC_MSG_RESULT( yes )
4077             AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
4078             ldflags_save=$LDFLAGS
4079             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4080             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4081 #include <stdio.h>
4082                 ],[
4083 printf ("hello world\n");
4084                 ])], ENABLE_GDB_INDEX=TRUE, [])
4085             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4086                 AC_MSG_RESULT( yes )
4087             else
4088                 if test "$enable_gdb_index" = "yes"; then
4089                     AC_MSG_ERROR( no )
4090                 else
4091                     AC_MSG_RESULT( no )
4092                 fi
4093             fi
4094             LDFLAGS=$ldflags_save
4095         fi
4096         CFLAGS=$save_CFLAGS
4097         fi
4098     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4099         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4100         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4101     fi
4103 AC_SUBST(ENABLE_GDB_INDEX)
4105 if test "$enable_sal_log" = yes; then
4106     ENABLE_SAL_LOG=TRUE
4108 AC_SUBST(ENABLE_SAL_LOG)
4110 dnl Check for enable symbols option
4111 dnl ===================================================================
4112 AC_MSG_CHECKING([whether to generate debug information])
4113 if test -z "$enable_symbols"; then
4114     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4115         enable_symbols=yes
4116     else
4117         enable_symbols=no
4118     fi
4120 if test "$enable_symbols" = yes; then
4121     ENABLE_SYMBOLS_FOR=all
4122     AC_MSG_RESULT([yes])
4123 elif test "$enable_symbols" = no; then
4124     ENABLE_SYMBOLS_FOR=
4125     AC_MSG_RESULT([no])
4126 else
4127     # Selective debuginfo.
4128     ENABLE_SYMBOLS_FOR="$enable_symbols"
4129     AC_MSG_RESULT([for "$enable_symbols"])
4131 AC_SUBST(ENABLE_SYMBOLS_FOR)
4133 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4134     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4135     AC_MSG_CHECKING([whether enough memory is available for linking])
4136     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4137     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4138     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4139         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4140     else
4141         AC_MSG_RESULT([yes])
4142     fi
4145 AC_MSG_CHECKING([whether to compile with optimization flags])
4146 if test -z "$enable_optimized"; then
4147     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4148         enable_optimized=no
4149     else
4150         enable_optimized=yes
4151     fi
4153 if test "$enable_optimized" != no; then
4154     ENABLE_OPTIMIZED=TRUE
4155     AC_MSG_RESULT([yes])
4156 else
4157     ENABLE_OPTIMIZED=
4158     AC_MSG_RESULT([no])
4160 AC_SUBST(ENABLE_OPTIMIZED)
4163 # determine CPUNAME, OS, ...
4164 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4166 case "$host_os" in
4168 aix*)
4169     COM=GCC
4170     CPUNAME=POWERPC
4171     USING_X11=TRUE
4172     OS=AIX
4173     RTL_OS=AIX
4174     RTL_ARCH=PowerPC
4175     PLATFORMID=aix_powerpc
4176     P_SEP=:
4177     ;;
4179 cygwin*)
4180     COM=MSC
4181     USING_X11=
4182     OS=WNT
4183     RTL_OS=Windows
4184     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4185         P_SEP=";"
4186     else
4187         P_SEP=:
4188     fi
4189     case "$host_cpu" in
4190     i*86|x86_64)
4191         if test "$BITNESS_OVERRIDE" = 64; then
4192             CPUNAME=X86_64
4193             RTL_ARCH=X86_64
4194             PLATFORMID=windows_x86_64
4195             WINDOWS_X64=1
4196             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4197         else
4198             CPUNAME=INTEL
4199             RTL_ARCH=x86
4200             PLATFORMID=windows_x86
4201         fi
4202         ;;
4203     *)
4204         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4205         ;;
4206     esac
4207     SCPDEFS="$SCPDEFS -D_MSC_VER"
4208     ;;
4210 darwin*)
4211     COM=GCC
4212     USING_X11=
4213     OS=MACOSX
4214     RTL_OS=MacOSX
4215     P_SEP=:
4217     case "$host_cpu" in
4218     arm)
4219         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4220         ;;
4221     arm64)
4222         OS=iOS
4223         if test "$enable_ios_simulator" = "yes"; then
4224             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4225         else
4226             CPUNAME=ARM64
4227             RTL_ARCH=ARM_EABI
4228             PLATFORMID=ios_arm64
4229         fi
4230         ;;
4231     i*86)
4232         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4233         ;;
4234     x86_64)
4235         if test "$enable_ios_simulator" = "yes"; then
4236             OS=iOS
4237         fi
4238         CPUNAME=X86_64
4239         RTL_ARCH=X86_64
4240         PLATFORMID=macosx_x86_64
4241         ;;
4242     *)
4243         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4244         ;;
4245     esac
4246     ;;
4248 dragonfly*)
4249     COM=GCC
4250     USING_X11=TRUE
4251     OS=DRAGONFLY
4252     RTL_OS=DragonFly
4253     P_SEP=:
4255     case "$host_cpu" in
4256     i*86)
4257         CPUNAME=INTEL
4258         RTL_ARCH=x86
4259         PLATFORMID=dragonfly_x86
4260         ;;
4261     x86_64)
4262         CPUNAME=X86_64
4263         RTL_ARCH=X86_64
4264         PLATFORMID=dragonfly_x86_64
4265         ;;
4266     *)
4267         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4268         ;;
4269     esac
4270     ;;
4272 freebsd*)
4273     COM=GCC
4274     USING_X11=TRUE
4275     RTL_OS=FreeBSD
4276     OS=FREEBSD
4277     P_SEP=:
4279     case "$host_cpu" in
4280     i*86)
4281         CPUNAME=INTEL
4282         RTL_ARCH=x86
4283         PLATFORMID=freebsd_x86
4284         ;;
4285     x86_64|amd64)
4286         CPUNAME=X86_64
4287         RTL_ARCH=X86_64
4288         PLATFORMID=freebsd_x86_64
4289         ;;
4290     *)
4291         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4292         ;;
4293     esac
4294     ;;
4296 haiku*)
4297     COM=GCC
4298     USING_X11=
4299     GUIBASE=haiku
4300     RTL_OS=Haiku
4301     OS=HAIKU
4302     P_SEP=:
4304     case "$host_cpu" in
4305     i*86)
4306         CPUNAME=INTEL
4307         RTL_ARCH=x86
4308         PLATFORMID=haiku_x86
4309         ;;
4310     x86_64|amd64)
4311         CPUNAME=X86_64
4312         RTL_ARCH=X86_64
4313         PLATFORMID=haiku_x86_64
4314         ;;
4315     *)
4316         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4317         ;;
4318     esac
4319     ;;
4321 kfreebsd*)
4322     COM=GCC
4323     USING_X11=TRUE
4324     OS=LINUX
4325     RTL_OS=kFreeBSD
4326     P_SEP=:
4328     case "$host_cpu" in
4330     i*86)
4331         CPUNAME=INTEL
4332         RTL_ARCH=x86
4333         PLATFORMID=kfreebsd_x86
4334         ;;
4335     x86_64)
4336         CPUNAME=X86_64
4337         RTL_ARCH=X86_64
4338         PLATFORMID=kfreebsd_x86_64
4339         ;;
4340     *)
4341         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4342         ;;
4343     esac
4344     ;;
4346 linux-gnu*)
4347     COM=GCC
4348     USING_X11=TRUE
4349     OS=LINUX
4350     RTL_OS=Linux
4351     P_SEP=:
4353     case "$host_cpu" in
4355     aarch64)
4356         CPUNAME=AARCH64
4357         PLATFORMID=linux_aarch64
4358         RTL_ARCH=AARCH64
4359         ;;
4360     alpha)
4361         CPUNAME=AXP
4362         RTL_ARCH=ALPHA
4363         PLATFORMID=linux_alpha
4364         ;;
4365     arm*)
4366         CPUNAME=ARM
4367         EPM_FLAGS="-a arm"
4368         RTL_ARCH=ARM_EABI
4369         PLATFORMID=linux_arm_eabi
4370         case "$host_cpu" in
4371         arm*-linux)
4372             RTL_ARCH=ARM_OABI
4373             PLATFORMID=linux_arm_oabi
4374             ;;
4375         esac
4376         ;;
4377     hppa)
4378         CPUNAME=HPPA
4379         RTL_ARCH=HPPA
4380         EPM_FLAGS="-a hppa"
4381         PLATFORMID=linux_hppa
4382         ;;
4383     i*86)
4384         CPUNAME=INTEL
4385         RTL_ARCH=x86
4386         PLATFORMID=linux_x86
4387         ;;
4388     ia64)
4389         CPUNAME=IA64
4390         RTL_ARCH=IA64
4391         PLATFORMID=linux_ia64
4392         ;;
4393     mips)
4394         CPUNAME=GODSON
4395         RTL_ARCH=MIPS_EB
4396         EPM_FLAGS="-a mips"
4397         PLATFORMID=linux_mips_eb
4398         ;;
4399     mips64)
4400         CPUNAME=GODSON64
4401         RTL_ARCH=MIPS64_EB
4402         EPM_FLAGS="-a mips64"
4403         PLATFORMID=linux_mips64_eb
4404         ;;
4405     mips64el)
4406         CPUNAME=GODSON64
4407         RTL_ARCH=MIPS64_EL
4408         EPM_FLAGS="-a mips64el"
4409         PLATFORMID=linux_mips64_el
4410         ;;
4411     mipsel)
4412         CPUNAME=GODSON
4413         RTL_ARCH=MIPS_EL
4414         EPM_FLAGS="-a mipsel"
4415         PLATFORMID=linux_mips_el
4416         ;;
4417     m68k)
4418         CPUNAME=M68K
4419         RTL_ARCH=M68K
4420         PLATFORMID=linux_m68k
4421         ;;
4422     powerpc)
4423         CPUNAME=POWERPC
4424         RTL_ARCH=PowerPC
4425         PLATFORMID=linux_powerpc
4426         ;;
4427     powerpc64)
4428         CPUNAME=POWERPC64
4429         RTL_ARCH=PowerPC_64
4430         PLATFORMID=linux_powerpc64
4431         ;;
4432     powerpc64le)
4433         CPUNAME=POWERPC64
4434         RTL_ARCH=PowerPC_64_LE
4435         PLATFORMID=linux_powerpc64_le
4436         ;;
4437     sparc)
4438         CPUNAME=SPARC
4439         RTL_ARCH=SPARC
4440         PLATFORMID=linux_sparc
4441         ;;
4442     sparc64)
4443         CPUNAME=SPARC64
4444         RTL_ARCH=SPARC64
4445         PLATFORMID=linux_sparc64
4446         ;;
4447     s390)
4448         CPUNAME=S390
4449         RTL_ARCH=S390
4450         PLATFORMID=linux_s390
4451         ;;
4452     s390x)
4453         CPUNAME=S390X
4454         RTL_ARCH=S390x
4455         PLATFORMID=linux_s390x
4456         ;;
4457     x86_64)
4458         CPUNAME=X86_64
4459         RTL_ARCH=X86_64
4460         PLATFORMID=linux_x86_64
4461         ;;
4462     *)
4463         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4464         ;;
4465     esac
4466     ;;
4468 linux-android*)
4469     COM=GCC
4470     USING_X11=
4471     OS=ANDROID
4472     RTL_OS=Android
4473     P_SEP=:
4475     case "$host_cpu" in
4477     arm|armel)
4478         CPUNAME=ARM
4479         RTL_ARCH=ARM_EABI
4480         PLATFORMID=android_arm_eabi
4481         ;;
4482     aarch64)
4483         CPUNAME=AARCH64
4484         RTL_ARCH=AARCH64
4485         PLATFORMID=android_aarch64
4486         ;;
4487     mips|mipsel)
4488         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4489         RTL_ARCH=MIPS_EL
4490         PLATFORMID=android_mips_el
4491         ;;
4492     i*86)
4493         CPUNAME=INTEL
4494         RTL_ARCH=x86
4495         PLATFORMID=android_x86
4496         ;;
4497     *)
4498         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4499         ;;
4500     esac
4501     ;;
4503 *netbsd*)
4504     COM=GCC
4505     USING_X11=TRUE
4506     OS=NETBSD
4507     RTL_OS=NetBSD
4508     P_SEP=:
4510     case "$host_cpu" in
4511     i*86)
4512         CPUNAME=INTEL
4513         RTL_ARCH=x86
4514         PLATFORMID=netbsd_x86
4515         ;;
4516     powerpc)
4517         CPUNAME=POWERPC
4518         RTL_ARCH=PowerPC
4519         PLATFORMID=netbsd_powerpc
4520         ;;
4521     sparc)
4522         CPUNAME=SPARC
4523         RTL_ARCH=SPARC
4524         PLATFORMID=netbsd_sparc
4525         ;;
4526     x86_64)
4527         CPUNAME=X86_64
4528         RTL_ARCH=X86_64
4529         PLATFORMID=netbsd_x86_64
4530         ;;
4531     *)
4532         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4533         ;;
4534     esac
4535     ;;
4537 openbsd*)
4538     COM=GCC
4539     USING_X11=TRUE
4540     OS=OPENBSD
4541     RTL_OS=OpenBSD
4542     P_SEP=:
4544     case "$host_cpu" in
4545     i*86)
4546         CPUNAME=INTEL
4547         RTL_ARCH=x86
4548         PLATFORMID=openbsd_x86
4549         ;;
4550     x86_64)
4551         CPUNAME=X86_64
4552         RTL_ARCH=X86_64
4553         PLATFORMID=openbsd_x86_64
4554         ;;
4555     *)
4556         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4557         ;;
4558     esac
4559     SOLARINC="$SOLARINC -I/usr/local/include"
4560     ;;
4562 solaris*)
4563     COM=GCC
4564     USING_X11=TRUE
4565     OS=SOLARIS
4566     RTL_OS=Solaris
4567     P_SEP=:
4569     case "$host_cpu" in
4570     i*86)
4571         CPUNAME=INTEL
4572         RTL_ARCH=x86
4573         PLATFORMID=solaris_x86
4574         ;;
4575     sparc)
4576         CPUNAME=SPARC
4577         RTL_ARCH=SPARC
4578         PLATFORMID=solaris_sparc
4579         ;;
4580     sparc64)
4581         CPUNAME=SPARC64
4582         RTL_ARCH=SPARC64
4583         PLATFORMID=solaris_sparc64
4584         ;;
4585     *)
4586         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4587         ;;
4588     esac
4589     SOLARINC="$SOLARINC -I/usr/local/include"
4590     ;;
4593     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4594     ;;
4595 esac
4597 if test "$with_x" = "no"; then
4598     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4601 DISABLE_GUI=""
4602 if test "$enable_gui" = "no"; then
4603     if test "$USING_X11" != TRUE; then
4604         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4605     fi
4606     USING_X11=
4607     DISABLE_GUI=TRUE
4608     AC_DEFINE(HAVE_FEATURE_UI,0)
4609     test_cairo=yes
4611 AC_SUBST(DISABLE_GUI)
4613 WORKDIR="${BUILDDIR}/workdir"
4614 INSTDIR="${BUILDDIR}/instdir"
4615 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4616 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4617 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4618 AC_SUBST(COM)
4619 AC_SUBST(CPUNAME)
4620 AC_SUBST(RTL_OS)
4621 AC_SUBST(RTL_ARCH)
4622 AC_SUBST(EPM_FLAGS)
4623 AC_SUBST(USING_X11)
4624 AC_SUBST([INSTDIR])
4625 AC_SUBST([INSTROOT])
4626 AC_SUBST([INSTROOTBASE])
4627 AC_SUBST(OS)
4628 AC_SUBST(P_SEP)
4629 AC_SUBST(WORKDIR)
4630 AC_SUBST(PLATFORMID)
4631 AC_SUBST(WINDOWS_X64)
4632 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4634 dnl ===================================================================
4635 dnl Test which package format to use
4636 dnl ===================================================================
4637 AC_MSG_CHECKING([which package format to use])
4638 if test -n "$with_package_format" -a "$with_package_format" != no; then
4639     for i in $with_package_format; do
4640         case "$i" in
4641         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4642             ;;
4643         *)
4644             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4645 aix - AIX software distribution
4646 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4647 deb - Debian software distribution
4648 pkg - Solaris software distribution
4649 rpm - RedHat software distribution
4651 LibreOffice additionally supports:
4652 archive - .tar.gz or .zip
4653 dmg - macOS .dmg
4654 installed - installation tree
4655 msi - Windows .msi
4656         ])
4657             ;;
4658         esac
4659     done
4660     # fakeroot is needed to ensure correct file ownerships/permissions
4661     # inside deb packages and tar archives created on Linux and Solaris.
4662     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4663         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4664         if test "$FAKEROOT" = "no"; then
4665             AC_MSG_ERROR(
4666                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4667         fi
4668     fi
4669     PKGFORMAT="$with_package_format"
4670     AC_MSG_RESULT([$PKGFORMAT])
4671 else
4672     PKGFORMAT=
4673     AC_MSG_RESULT([none])
4675 AC_SUBST(PKGFORMAT)
4677 dnl ===================================================================
4678 dnl Set up a different compiler to produce tools to run on the build
4679 dnl machine when doing cross-compilation
4680 dnl ===================================================================
4682 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4683 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4684 if test "$cross_compiling" = "yes"; then
4685     AC_MSG_CHECKING([for BUILD platform configuration])
4686     echo
4687     rm -rf CONF-FOR-BUILD config_build.mk
4688     mkdir CONF-FOR-BUILD
4689     # Here must be listed all files needed when running the configure script. In particular, also
4690     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4691     # keep them in the same order as there.
4692     (cd $SRC_ROOT && tar cf - \
4693         config.guess \
4694         bin/get_config_variables \
4695         solenv/bin/getcompver.awk \
4696         solenv/inc/langlist.mk \
4697         download.lst \
4698         config_host.mk.in \
4699         config_host_lang.mk.in \
4700         Makefile.in \
4701         bin/bffvalidator.sh.in \
4702         bin/odfvalidator.sh.in \
4703         bin/officeotron.sh.in \
4704         instsetoo_native/util/openoffice.lst.in \
4705         config_host/*.in \
4706         sysui/desktop/macosx/Info.plist.in) \
4707     | (cd CONF-FOR-BUILD && tar xf -)
4708     cp configure CONF-FOR-BUILD
4709     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4710     (
4711     unset COM USING_X11 OS CPUNAME
4712     unset CC CXX SYSBASE CFLAGS
4713     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4714     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4715     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4716     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4717     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4718     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4719     cd CONF-FOR-BUILD
4720     sub_conf_opts=""
4721     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4722     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4723     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4724     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4725     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4726     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4727     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4728     # Don't bother having configure look for stuff not needed for the build platform anyway
4729     ./configure \
4730         --disable-cups \
4731         --disable-gstreamer-1-0 \
4732         --disable-gstreamer-0-10 \
4733         --disable-gtk \
4734         --disable-gtk3 \
4735         --disable-pdfimport \
4736         --disable-postgresql-sdbc \
4737         --with-parallelism="$with_parallelism" \
4738         --without-doxygen \
4739         --without-java \
4740         $sub_conf_opts \
4741         --srcdir=$srcdir \
4742         2>&1 | sed -e 's/^/    /'
4743     test -f ./config_host.mk 2>/dev/null || exit
4744     cp config_host.mk ../config_build.mk
4745     cp config_host_lang.mk ../config_build_lang.mk
4746     mv config.log ../config.Build.log
4747     mkdir -p ../config_build
4748     mv config_host/*.h ../config_build
4749     . ./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
4751     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
4752         VV='$'$V
4753         VV=`eval "echo $VV"`
4754         if test -n "$VV"; then
4755             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4756             echo "$line" >>build-config
4757         fi
4758     done
4760     for V in INSTDIR INSTROOT WORKDIR; do
4761         VV='$'$V
4762         VV=`eval "echo $VV"`
4763         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4764         if test -n "$VV"; then
4765             line="${V}_FOR_BUILD='$VV'"
4766             echo "$line" >>build-config
4767         fi
4768     done
4770     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4771     echo "$line" >>build-config
4773     )
4774     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4775     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])
4776     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4777              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4779     eval `cat CONF-FOR-BUILD/build-config`
4781     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4783     rm -rf CONF-FOR-BUILD
4784 else
4785     OS_FOR_BUILD="$OS"
4786     CC_FOR_BUILD="$CC"
4787     CXX_FOR_BUILD="$CXX"
4788     INSTDIR_FOR_BUILD="$INSTDIR"
4789     INSTROOT_FOR_BUILD="$INSTROOT"
4790     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4791     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4792     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4793     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4794     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4795     WORKDIR_FOR_BUILD="$WORKDIR"
4797 AC_SUBST(OS_FOR_BUILD)
4798 AC_SUBST(INSTDIR_FOR_BUILD)
4799 AC_SUBST(INSTROOT_FOR_BUILD)
4800 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4801 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4802 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4803 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4804 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4805 AC_SUBST(WORKDIR_FOR_BUILD)
4807 dnl ===================================================================
4808 dnl Check for syslog header
4809 dnl ===================================================================
4810 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4812 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4813 dnl ===================================================================
4814 AC_MSG_CHECKING([whether to turn warnings to errors])
4815 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4816     ENABLE_WERROR="TRUE"
4817     AC_MSG_RESULT([yes])
4818 else
4819     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4820         ENABLE_WERROR="TRUE"
4821         AC_MSG_RESULT([yes])
4822     else
4823         AC_MSG_RESULT([no])
4824     fi
4826 AC_SUBST(ENABLE_WERROR)
4828 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4829 dnl ===================================================================
4830 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4831 if test -z "$enable_assert_always_abort"; then
4832    if test "$ENABLE_DEBUG" = TRUE; then
4833        enable_assert_always_abort=yes
4834    else
4835        enable_assert_always_abort=no
4836    fi
4838 if test "$enable_assert_always_abort" = "yes"; then
4839     ASSERT_ALWAYS_ABORT="TRUE"
4840     AC_MSG_RESULT([yes])
4841 else
4842     ASSERT_ALWAYS_ABORT="FALSE"
4843     AC_MSG_RESULT([no])
4845 AC_SUBST(ASSERT_ALWAYS_ABORT)
4847 # Determine whether to use ooenv for the instdir installation
4848 # ===================================================================
4849 if test $_os != "WINNT" -a $_os != "Darwin"; then
4850     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4851     if test "$enable_ooenv" = "no"; then
4852         AC_MSG_RESULT([no])
4853     else
4854         ENABLE_OOENV="TRUE"
4855         AC_MSG_RESULT([yes])
4856     fi
4858 AC_SUBST(ENABLE_OOENV)
4860 if test "$USING_X11" != TRUE; then
4861     # be sure to do not mess with unneeded stuff
4862     test_randr=no
4863     test_xrender=no
4864     test_cups=no
4865     test_dbus=no
4866     test_gtk=no
4867     build_gstreamer_1_0=no
4868     build_gstreamer_0_10=no
4869     test_kde5=no
4870     test_qt5=no
4871     test_gtk3_kde5=no
4872     enable_cairo_canvas=no
4875 if test "$OS" = "HAIKU"; then
4876     enable_cairo_canvas=yes
4877     test_kde5=yes
4880 if test "$test_kde5" = "yes"; then
4881     test_qt5=yes
4884 if test "$test_kde5" = "yes" -a  "$enable_kde5" = "yes"; then
4885     if test "$enable_qt5" = "no"; then
4886         AC_MSG_ERROR([KDE5 support depends on QT5, so it conflicts with --disable-qt5])
4887     else
4888         enable_qt5=yes
4889     fi
4892 dnl ===================================================================
4893 dnl check for cups support
4894 dnl ===================================================================
4895 ENABLE_CUPS=""
4897 if test "$enable_cups" = "no"; then
4898     test_cups=no
4901 AC_MSG_CHECKING([whether to enable CUPS support])
4902 if test "$test_cups" = "yes"; then
4903     ENABLE_CUPS="TRUE"
4904     AC_MSG_RESULT([yes])
4906     AC_MSG_CHECKING([whether cups support is present])
4907     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4908     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4909     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4910         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4911     fi
4913 else
4914     AC_MSG_RESULT([no])
4917 AC_SUBST(ENABLE_CUPS)
4919 # fontconfig checks
4920 if test "$test_fontconfig" = "yes"; then
4921     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4922     SYSTEM_FONTCONFIG=TRUE
4923     FilterLibs "${FONTCONFIG_LIBS}"
4924     FONTCONFIG_LIBS="${filteredlibs}"
4926 AC_SUBST(FONTCONFIG_CFLAGS)
4927 AC_SUBST(FONTCONFIG_LIBS)
4928 AC_SUBST([SYSTEM_FONTCONFIG])
4930 dnl whether to find & fetch external tarballs?
4931 dnl ===================================================================
4932 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4933    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4934        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4935    else
4936        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4937    fi
4939 if test -z "$TARFILE_LOCATION"; then
4940     if test -d "$SRC_ROOT/src" ; then
4941         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4942         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4943     fi
4944     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4945 else
4946     AbsolutePath "$TARFILE_LOCATION"
4947     PathFormat "${absolute_path}"
4948     TARFILE_LOCATION="${formatted_path}"
4950 AC_SUBST(TARFILE_LOCATION)
4952 AC_MSG_CHECKING([whether we want to fetch tarballs])
4953 if test "$enable_fetch_external" != "no"; then
4954     if test "$with_all_tarballs" = "yes"; then
4955         AC_MSG_RESULT([yes, all of them])
4956         DO_FETCH_TARBALLS="ALL"
4957     else
4958         AC_MSG_RESULT([yes, if we use them])
4959         DO_FETCH_TARBALLS="TRUE"
4960     fi
4961 else
4962     AC_MSG_RESULT([no])
4963     DO_FETCH_TARBALLS=
4965 AC_SUBST(DO_FETCH_TARBALLS)
4967 AC_MSG_CHECKING([whether to build help])
4968 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4969     BUILD_TYPE="$BUILD_TYPE HELP"
4970     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4971     case "$with_help" in
4972     "html")
4973         ENABLE_HTMLHELP=TRUE
4974         SCPDEFS="$SCPDEFS -DWITH_HELP"
4975         AC_MSG_RESULT([HTML])
4976         ;;
4977     "online")
4978         ENABLE_HTMLHELP=TRUE
4979         HELP_ONLINE=TRUE
4980         AC_MSG_RESULT([HTML])
4981         ;;
4982     yes)
4983         SCPDEFS="$SCPDEFS -DWITH_HELP"
4984         AC_MSG_RESULT([yes])
4985         ;;
4986     *)
4987         AC_MSG_ERROR([Unknown --with-help=$with_help])
4988         ;;
4989     esac
4990 else
4991     AC_MSG_RESULT([no])
4993 AC_SUBST([ENABLE_HTMLHELP])
4994 AC_SUBST([HELP_ONLINE])
4996 dnl Test whether to include MySpell dictionaries
4997 dnl ===================================================================
4998 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4999 if test "$with_myspell_dicts" = "yes"; then
5000     AC_MSG_RESULT([yes])
5001     WITH_MYSPELL_DICTS=TRUE
5002     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5003     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5004 else
5005     AC_MSG_RESULT([no])
5006     WITH_MYSPELL_DICTS=
5008 AC_SUBST(WITH_MYSPELL_DICTS)
5010 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5011 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5012     if test "$with_system_dicts" = yes; then
5013         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5014     fi
5015     with_system_dicts=no
5018 AC_MSG_CHECKING([whether to use dicts from external paths])
5019 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5020     AC_MSG_RESULT([yes])
5021     SYSTEM_DICTS=TRUE
5022     AC_MSG_CHECKING([for spelling dictionary directory])
5023     if test -n "$with_external_dict_dir"; then
5024         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5025     else
5026         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5027         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5028             DICT_SYSTEM_DIR=file:///usr/share/myspell
5029         fi
5030     fi
5031     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5032     AC_MSG_CHECKING([for hyphenation patterns directory])
5033     if test -n "$with_external_hyph_dir"; then
5034         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5035     else
5036         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5037     fi
5038     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5039     AC_MSG_CHECKING([for thesaurus directory])
5040     if test -n "$with_external_thes_dir"; then
5041         THES_SYSTEM_DIR=file://$with_external_thes_dir
5042     else
5043         THES_SYSTEM_DIR=file:///usr/share/mythes
5044     fi
5045     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5046 else
5047     AC_MSG_RESULT([no])
5048     SYSTEM_DICTS=
5050 AC_SUBST(SYSTEM_DICTS)
5051 AC_SUBST(DICT_SYSTEM_DIR)
5052 AC_SUBST(HYPH_SYSTEM_DIR)
5053 AC_SUBST(THES_SYSTEM_DIR)
5055 dnl ===================================================================
5056 dnl Precompiled headers.
5057 ENABLE_PCH=""
5058 AC_MSG_CHECKING([whether to enable pch feature])
5059 if test -z "$enable_pch"; then
5060     if test "$_os" = "WINNT"; then
5061         # Enabled by default on Windows.
5062         enable_pch=yes
5063     else
5064         enable_pch=no
5065     fi
5067 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5068     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5070 if test "$enable_pch" = "system"; then
5071     ENABLE_PCH="1"
5072     AC_MSG_RESULT([yes (system headers)])
5073 elif test "$enable_pch" = "base"; then
5074     ENABLE_PCH="2"
5075     AC_MSG_RESULT([yes (system and base headers)])
5076 elif test "$enable_pch" = "normal"; then
5077     ENABLE_PCH="3"
5078     AC_MSG_RESULT([yes (normal)])
5079 elif test "$enable_pch" = "full"; then
5080     ENABLE_PCH="4"
5081     AC_MSG_RESULT([yes (full)])
5082 elif test "$enable_pch" = "yes"; then
5083     # Pick a suitable default.
5084     if test "$GCC" = "yes"; then
5085         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5086         # while making the PCHs larger and rebuilds more likely.
5087         ENABLE_PCH="2"
5088         AC_MSG_RESULT([yes (system and base headers)])
5089     else
5090         # With MSVC the highest level makes a significant difference,
5091         # and it was the default when there used to be no PCH levels.
5092         ENABLE_PCH="4"
5093         AC_MSG_RESULT([yes (full)])
5094     fi
5095 elif test "$enable_pch" = "no"; then
5096     AC_MSG_RESULT([no])
5097 else
5098     AC_MSG_ERROR([Unknown value for --enable-pch])
5100 AC_SUBST(ENABLE_PCH)
5101 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5102 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5103     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5104     if test "$CCACHE_BIN" != "not found"; then
5105         AC_MSG_CHECKING([ccache version])
5106         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5107         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5108         AC_MSG_RESULT([$CCACHE_VERSION])
5109         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5110         if test "$CCACHE_NUMVER" -gt "030701"; then
5111             AC_MSG_RESULT([yes])
5112         else
5113             AC_MSG_RESULT([no (not newer than 3.7.1)])
5114             CCACHE_DEPEND_MODE=
5115         fi
5116     fi
5119 TAB=`printf '\t'`
5121 AC_MSG_CHECKING([the GNU Make version])
5122 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5123 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5124 if test "$_make_longver" -ge "038200"; then
5125     AC_MSG_RESULT([$GNUMAKE $_make_version])
5127 elif test "$_make_longver" -ge "038100"; then
5128     if test "$build_os" = "cygwin"; then
5129         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5130     fi
5131     AC_MSG_RESULT([$GNUMAKE $_make_version])
5133     dnl ===================================================================
5134     dnl Search all the common names for sha1sum
5135     dnl ===================================================================
5136     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5137     if test -z "$SHA1SUM"; then
5138         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5139     elif test "$SHA1SUM" = "openssl"; then
5140         SHA1SUM="openssl sha1"
5141     fi
5142     AC_MSG_CHECKING([for GNU Make bug 20033])
5143     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5144     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5145 A := \$(wildcard *.a)
5147 .PHONY: all
5148 all: \$(A:.a=.b)
5149 <TAB>@echo survived bug20033.
5151 .PHONY: setup
5152 setup:
5153 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5155 define d1
5156 @echo lala \$(1)
5157 @sleep 1
5158 endef
5160 define d2
5161 @echo tyty \$(1)
5162 @sleep 1
5163 endef
5165 %.b : %.a
5166 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5167 <TAB>\$(call d1,\$(CHECKSUM)),\
5168 <TAB>\$(call d2,\$(CHECKSUM)))
5170     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5171         no_parallelism_make="YES"
5172         AC_MSG_RESULT([yes, disable parallelism])
5173     else
5174         AC_MSG_RESULT([no, keep parallelism enabled])
5175     fi
5176     rm -rf $TESTGMAKEBUG20033
5177 else
5178     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5181 # find if gnumake support file function
5182 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5183 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5184 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5185     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5187 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5188 \$(file >test.txt,Success )
5190 .PHONY: all
5191 all:
5192 <TAB>@cat test.txt
5195 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5196 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5197     HAVE_GNUMAKE_FILE_FUNC=TRUE
5198     AC_MSG_RESULT([yes])
5199 else
5200     AC_MSG_RESULT([no])
5202 rm -rf $TESTGMAKEFILEFUNC
5203 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5204 AC_SUBST(GNUMAKE_WIN_NATIVE)
5206 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5207 STALE_MAKE=
5208 if test "$_make_ver_check" = ""; then
5209    STALE_MAKE=TRUE
5212 HAVE_LD_HASH_STYLE=FALSE
5213 WITH_LINKER_HASH_STYLE=
5214 AC_MSG_CHECKING([for --hash-style gcc linker support])
5215 if test "$GCC" = "yes"; then
5216     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5217         hash_styles="gnu sysv"
5218     elif test "$with_linker_hash_style" = "no"; then
5219         hash_styles=
5220     else
5221         hash_styles="$with_linker_hash_style"
5222     fi
5224     for hash_style in $hash_styles; do
5225         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5226         hash_style_ldflags_save=$LDFLAGS
5227         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5229         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5230             [
5231 #include <stdio.h>
5232             ],[
5233 printf ("");
5234             ])],
5235             [
5236                   HAVE_LD_HASH_STYLE=TRUE
5237                   WITH_LINKER_HASH_STYLE=$hash_style
5238             ],
5239             [HAVE_LD_HASH_STYLE=FALSE],
5240             [HAVE_LD_HASH_STYLE=FALSE])
5241         LDFLAGS=$hash_style_ldflags_save
5242     done
5244     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5245         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5246     else
5247         AC_MSG_RESULT( no )
5248     fi
5249     LDFLAGS=$hash_style_ldflags_save
5250 else
5251     AC_MSG_RESULT( no )
5253 AC_SUBST(HAVE_LD_HASH_STYLE)
5254 AC_SUBST(WITH_LINKER_HASH_STYLE)
5256 dnl ===================================================================
5257 dnl Check whether there's a Perl version available.
5258 dnl ===================================================================
5259 if test -z "$with_perl_home"; then
5260     AC_PATH_PROG(PERL, perl)
5261 else
5262     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5263     _perl_path="$with_perl_home/bin/perl"
5264     if test -x "$_perl_path"; then
5265         PERL=$_perl_path
5266     else
5267         AC_MSG_ERROR([$_perl_path not found])
5268     fi
5271 dnl ===================================================================
5272 dnl Testing for Perl version 5 or greater.
5273 dnl $] is the Perl version variable, it is returned as an integer
5274 dnl ===================================================================
5275 if test "$PERL"; then
5276     AC_MSG_CHECKING([the Perl version])
5277     ${PERL} -e "exit($]);"
5278     _perl_version=$?
5279     if test "$_perl_version" -lt 5; then
5280         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5281     fi
5282     AC_MSG_RESULT([Perl $_perl_version])
5283 else
5284     AC_MSG_ERROR([Perl not found, install Perl 5])
5287 dnl ===================================================================
5288 dnl Testing for required Perl modules
5289 dnl ===================================================================
5291 AC_MSG_CHECKING([for required Perl modules])
5292 perl_use_string="use Cwd ; use Digest::MD5"
5293 if test "$_os" = "WINNT"; then
5294     if test -n "$PKGFORMAT"; then
5295         for i in $PKGFORMAT; do
5296             case "$i" in
5297             msi)
5298                 # for getting fonts versions to use in MSI
5299                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5300                 ;;
5301             esac
5302         done
5303     fi
5305 if test "$with_system_hsqldb" = "yes"; then
5306         perl_use_string="$perl_use_string ; use Archive::Zip"
5308 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5309     AC_MSG_RESULT([all modules found])
5310 else
5311     AC_MSG_RESULT([failed to find some modules])
5312     # Find out which modules are missing.
5313     for i in $perl_use_string; do
5314         if test "$i" != "use" -a "$i" != ";"; then
5315             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5316                 missing_perl_modules="$missing_perl_modules $i"
5317             fi
5318         fi
5319     done
5320     AC_MSG_ERROR([
5321     The missing Perl modules are: $missing_perl_modules
5322     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5325 dnl ===================================================================
5326 dnl Check for pkg-config
5327 dnl ===================================================================
5328 if test "$_os" != "WINNT"; then
5329     PKG_PROG_PKG_CONFIG
5332 if test "$_os" != "WINNT"; then
5334     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5335     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5336     # explicitly. Or put /path/to/compiler in PATH yourself.
5338     # Use wrappers for LTO
5339     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5340         AC_CHECK_TOOL(AR,gcc-ar)
5341         AC_CHECK_TOOL(NM,gcc-nm)
5342         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5343     else
5344         AC_CHECK_TOOL(AR,ar)
5345         AC_CHECK_TOOL(NM,nm)
5346         AC_CHECK_TOOL(RANLIB,ranlib)
5347     fi
5348     AC_CHECK_TOOL(OBJDUMP,objdump)
5349     AC_CHECK_TOOL(READELF,readelf)
5350     AC_CHECK_TOOL(STRIP,strip)
5351     if test "$_os" = "WINNT"; then
5352         AC_CHECK_TOOL(DLLTOOL,dlltool)
5353         AC_CHECK_TOOL(WINDRES,windres)
5354     fi
5356 AC_SUBST(AR)
5357 AC_SUBST(DLLTOOL)
5358 AC_SUBST(NM)
5359 AC_SUBST(OBJDUMP)
5360 AC_SUBST(PKG_CONFIG)
5361 AC_SUBST(RANLIB)
5362 AC_SUBST(READELF)
5363 AC_SUBST(STRIP)
5364 AC_SUBST(WINDRES)
5366 dnl ===================================================================
5367 dnl pkg-config checks on macOS
5368 dnl ===================================================================
5370 if test $_os = Darwin; then
5371     AC_MSG_CHECKING([for bogus pkg-config])
5372     if test -n "$PKG_CONFIG"; then
5373         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5374             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5375         else
5376             if test "$enable_bogus_pkg_config" = "yes"; then
5377                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5378             else
5379                 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.])
5380             fi
5381         fi
5382     else
5383         AC_MSG_RESULT([no, good])
5384     fi
5387 find_csc()
5389     # Return value: $csctest
5391     unset csctest
5393     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5394     if test -n "$regvalue"; then
5395         csctest=$regvalue
5396         return
5397     fi
5400 find_al()
5402     # Return value: $altest
5404     unset altest
5406     # We need this check to detect 4.6.1 or above.
5407     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5408         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5409         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5410             altest=$regvalue
5411             return
5412         fi
5413     done
5415     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5416         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5417         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5418             altest=$regvalue
5419             return
5420         fi
5421     done
5426 find_dotnetsdk46()
5428     unset frametest
5430     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5431         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5432         if test -n "$regvalue"; then
5433             frametest=$regvalue
5434             return
5435         fi
5436     done
5439 find_winsdk_version()
5441     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5442     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5444     unset winsdktest winsdkbinsubdir winsdklibsubdir
5446     case "$1" in
5447     7.*)
5448         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5449         if test -n "$regvalue"; then
5450             winsdktest=$regvalue
5451             winsdklibsubdir=.
5452             return
5453         fi
5454         ;;
5455     8.0|8.0A)
5456         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5457         if test -n "$regvalue"; then
5458             winsdktest=$regvalue
5459             winsdklibsubdir=win8
5460             return
5461         fi
5462         ;;
5463     8.1|8.1A)
5464         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5465         if test -n "$regvalue"; then
5466             winsdktest=$regvalue
5467             winsdklibsubdir=winv6.3
5468             return
5469         fi
5470         ;;
5471     10.0)
5472         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5473         if test -n "$regvalue"; then
5474             winsdktest=$regvalue
5475             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5476             if test -n "$regvalue"; then
5477                 winsdkbinsubdir="$regvalue".0
5478                 winsdklibsubdir=$winsdkbinsubdir
5479                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5480                 # test exist the SDK path
5481                 if test -d "$tmppath"; then
5482                    # when path is convertible to a short path then path is okay
5483                    if ! cygpath -d "$tmppath"; then
5484                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5485                    fi
5486                 else
5487                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5488                 fi
5489             fi
5490             return
5491         fi
5492         ;;
5493     esac
5496 find_winsdk()
5498     # Return value: From find_winsdk_version
5500     unset winsdktest
5502     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5503         find_winsdk_version $ver
5504         if test -n "$winsdktest"; then
5505             return
5506         fi
5507     done
5510 find_msms()
5512     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5513     case "$VCVER" in
5514         150|160)
5515         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5516         ;;
5517     esac
5518     AC_MSG_CHECKING([for ${my_msm_files}])
5519     msmdir=
5520     for ver in 14.0 15.0; do
5521         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5522         if test -n "$regvalue"; then
5523             for f in ${my_msm_files}; do
5524                 if test -e "$regvalue/${f}"; then
5525                     msmdir=$regvalue
5526                     break
5527                 fi
5528             done
5529         fi
5530     done
5531     dnl Is the following fallback really necessary, or was it added in response
5532     dnl to never having started Visual Studio on a given machine, so the
5533     dnl registry keys checked above had presumably not yet been created?
5534     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5535     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5536     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5537     dnl expanding to "C:\Program Files\Common Files"), which would need
5538     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5539     dnl obtain its value from cygwin:
5540     if test -z "$msmdir"; then
5541         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5542         for f in ${my_msm_files}; do
5543             if test -e "$my_msm_dir/${f}"; then
5544                 msmdir=$my_msm_dir
5545             fi
5546         done
5547     fi
5549     dnl Starting from MSVC 15.0, merge modules are located in different directory
5550     case "$VCVER" in
5551     150|160)
5552         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5553             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5554             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5555             for f in ${my_msm_files}; do
5556                 if test -e "$my_msm_dir/${f}"; then
5557                     msmdir=$my_msm_dir
5558                     break
5559                 fi
5560             done
5561         done
5562         ;;
5563     esac
5565     if test -n "$msmdir"; then
5566         msmdir=`cygpath -m "$msmdir"`
5567         AC_MSG_RESULT([$msmdir])
5568     else
5569         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5570             AC_MSG_ERROR([not found])
5571         else
5572             AC_MSG_WARN([not found])
5573             add_warning "MSM none of ${my_msm_files} found"
5574         fi
5575     fi
5578 find_msvc_x64_dlls()
5580     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5581     case "$VCVER" in
5582     150|160)
5583         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5584             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5585             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5586                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5587                 break
5588             fi
5589             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT])
5590             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5591                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5592                 break
5593             fi
5594             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5595                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5596                 break
5597             fi
5598         done
5599         ;;
5600     esac
5601     msvcdlls="msvcp140.dll vcruntime140.dll"
5602     for dll in $msvcdlls; do
5603         if ! test -f "$msvcdllpath/$dll"; then
5604             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5605         fi
5606     done
5609 dnl =========================================
5610 dnl Check for the Windows  SDK.
5611 dnl =========================================
5612 if test "$_os" = "WINNT"; then
5613     AC_MSG_CHECKING([for Windows SDK])
5614     if test "$build_os" = "cygwin"; then
5615         find_winsdk
5616         WINDOWS_SDK_HOME=$winsdktest
5618         # normalize if found
5619         if test -n "$WINDOWS_SDK_HOME"; then
5620             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5621             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5622         fi
5624         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5625     fi
5627     if test -n "$WINDOWS_SDK_HOME"; then
5628         # Remove a possible trailing backslash
5629         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5631         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5632              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5633              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5634             have_windows_sdk_headers=yes
5635         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5636              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5637              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5638             have_windows_sdk_headers=yes
5639         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5640              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5641              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5642             have_windows_sdk_headers=yes
5643         else
5644             have_windows_sdk_headers=no
5645         fi
5647         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5648             have_windows_sdk_libs=yes
5649         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5650             have_windows_sdk_libs=yes
5651         else
5652             have_windows_sdk_libs=no
5653         fi
5655         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5656             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5657 the  Windows SDK are installed.])
5658         fi
5659     fi
5661     if test -z "$WINDOWS_SDK_HOME"; then
5662         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5663     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5664         WINDOWS_SDK_VERSION=70
5665         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5666     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5667         WINDOWS_SDK_VERSION=80
5668         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5669     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5670         WINDOWS_SDK_VERSION=81
5671         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5672     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5673         WINDOWS_SDK_VERSION=10
5674         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5675     else
5676         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5677     fi
5678     PathFormat "$WINDOWS_SDK_HOME"
5679     WINDOWS_SDK_HOME="$formatted_path"
5680     if test "$build_os" = "cygwin"; then
5681         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5682         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5683             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5684         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5685             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5686         fi
5687     fi
5689     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5690     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5691     dnl but not in v8.0), so allow this to be overridden with a
5692     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5693     dnl and configuration error if no WiLangId.vbs is found would arguably be
5694     dnl better, but I do not know under which conditions exactly it is needed by
5695     dnl msiglobal.pm:
5696     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5697         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5698         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5699             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5700         fi
5701         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5702             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5703         fi
5704         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5705             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5706         fi
5707     fi
5708     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5709         if test -n "$with_package_format" -a "$with_package_format" != no; then
5710             for i in "$with_package_format"; do
5711                 if test "$i" = "msi"; then
5712                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5713                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5714                     fi
5715                 fi
5716             done
5717         fi
5718     fi
5720 AC_SUBST(WINDOWS_SDK_HOME)
5721 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5722 AC_SUBST(WINDOWS_SDK_VERSION)
5723 AC_SUBST(WINDOWS_SDK_WILANGID)
5725 if test "$build_os" = "cygwin"; then
5726     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5727     dnl dir, it also determines that dir's path w/o an arch segment if any,
5728     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5729     AC_MSG_CHECKING([for midl.exe])
5731     find_winsdk
5732     if test -n "$winsdkbinsubdir" \
5733         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5734     then
5735         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5736         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5737     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5738         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5739         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5740     elif test -f "$winsdktest/Bin/midl.exe"; then
5741         MIDL_PATH=$winsdktest/Bin
5742         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5743     fi
5744     if test ! -f "$MIDL_PATH/midl.exe"; then
5745         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5746     else
5747         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5748     fi
5750     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5751     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5753     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5754          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5755          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5756          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5757     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5758          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5759          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5760          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5761     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5762          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5763          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5764          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5765     else
5766         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5767     fi
5769     dnl Check csc.exe
5770     AC_MSG_CHECKING([for csc.exe])
5771     find_csc
5772     if test -f "$csctest/csc.exe"; then
5773         CSC_PATH="$csctest"
5774     fi
5775     if test ! -f "$CSC_PATH/csc.exe"; then
5776         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5777     else
5778         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5779     fi
5781     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5783     dnl Check al.exe
5784     AC_MSG_CHECKING([for al.exe])
5785     find_winsdk
5786     if test -n "$winsdkbinsubdir" \
5787         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5788     then
5789         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5790     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5791         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5792     elif test -f "$winsdktest/Bin/al.exe"; then
5793         AL_PATH="$winsdktest/Bin"
5794     fi
5796     if test -z "$AL_PATH"; then
5797         find_al
5798         if test -f "$altest/bin/al.exe"; then
5799             AL_PATH="$altest/bin"
5800         elif test -f "$altest/al.exe"; then
5801             AL_PATH="$altest"
5802         fi
5803     fi
5804     if test ! -f "$AL_PATH/al.exe"; then
5805         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5806     else
5807         AC_MSG_RESULT([$AL_PATH/al.exe])
5808     fi
5810     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5812     dnl Check mscoree.lib / .NET Framework dir
5813     AC_MSG_CHECKING(.NET Framework)
5814     find_dotnetsdk46
5815     PathFormat "$frametest"
5816     frametest="$formatted_path"
5817     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5818         DOTNET_FRAMEWORK_HOME="$frametest"
5819     else
5820         find_winsdk
5821         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5822             DOTNET_FRAMEWORK_HOME="$winsdktest"
5823         fi
5824     fi
5825     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
5826         AC_MSG_ERROR([mscoree.lib not found])
5827     fi
5828     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5830     PathFormat "$MIDL_PATH"
5831     MIDL_PATH="$formatted_path"
5833     PathFormat "$AL_PATH"
5834     AL_PATH="$formatted_path"
5836     PathFormat "$DOTNET_FRAMEWORK_HOME"
5837     DOTNET_FRAMEWORK_HOME="$formatted_path"
5839     PathFormat "$CSC_PATH"
5840     CSC_PATH="$formatted_path"
5843 dnl ===================================================================
5844 dnl Check if stdc headers are available excluding MSVC.
5845 dnl ===================================================================
5846 if test "$_os" != "WINNT"; then
5847     AC_HEADER_STDC
5850 dnl ===================================================================
5851 dnl Testing for C++ compiler and version...
5852 dnl ===================================================================
5854 if test "$_os" != "WINNT"; then
5855     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5856     save_CXXFLAGS=$CXXFLAGS
5857     AC_PROG_CXX
5858     CXXFLAGS=$save_CXXFLAGS
5859 else
5860     if test -n "$CC" -a -z "$CXX"; then
5861         CXX="$CC"
5862     fi
5865 dnl check for GNU C++ compiler version
5866 if test "$GXX" = "yes"; then
5867     AC_MSG_CHECKING([the GNU C++ compiler version])
5869     _gpp_version=`$CXX -dumpversion`
5870     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5872     if test "$_gpp_majmin" -lt "401"; then
5873         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5874     else
5875         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5876     fi
5878     dnl see https://code.google.com/p/android/issues/detail?id=41770
5879     if test "$_gpp_majmin" -ge "401"; then
5880         glibcxx_threads=no
5881         AC_LANG_PUSH([C++])
5882         AC_REQUIRE_CPP
5883         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5884         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5885             #include <bits/c++config.h>]],[[
5886             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5887             && !defined(_GLIBCXX__PTHREADS) \
5888             && !defined(_GLIBCXX_HAS_GTHREADS)
5889             choke me
5890             #endif
5891         ]])],[AC_MSG_RESULT([yes])
5892         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5893         AC_LANG_POP([C++])
5894         if test $glibcxx_threads = yes; then
5895             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5896         fi
5897      fi
5899 AC_SUBST(BOOST_CXXFLAGS)
5902 # prefx CXX with ccache if needed
5904 if test "$CCACHE" != ""; then
5905     AC_MSG_CHECKING([whether $CXX is already ccached])
5906     AC_LANG_PUSH([C++])
5907     save_CXXFLAGS=$CXXFLAGS
5908     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5909     dnl an empty program will do, we're checking the compiler flags
5910     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5911                       [use_ccache=yes], [use_ccache=no])
5912     if test $use_ccache = yes; then
5913         AC_MSG_RESULT([yes])
5914     else
5915         CXX="$CCACHE $CXX"
5916         AC_MSG_RESULT([no])
5917     fi
5918     CXXFLAGS=$save_CXXFLAGS
5919     AC_LANG_POP([C++])
5922 dnl ===================================================================
5923 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5924 dnl ===================================================================
5926 if test "$_os" != "WINNT"; then
5927     AC_PROG_CXXCPP
5929     dnl Check whether there's a C pre-processor.
5930     AC_PROG_CPP
5934 dnl ===================================================================
5935 dnl Find integral type sizes and alignments
5936 dnl ===================================================================
5938 if test "$_os" != "WINNT"; then
5940 if test "$_os" == "iOS"; then
5941     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5942     ac_cv_sizeof_long=8
5943     ac_cv_sizeof_short=2
5944     ac_cv_sizeof_int=4
5945     ac_cv_sizeof_long_long=8
5946     ac_cv_sizeof_double=8
5947     ac_cv_sizeof_voidp=8
5948 else
5949     AC_CHECK_SIZEOF(long)
5950     AC_CHECK_SIZEOF(short)
5951     AC_CHECK_SIZEOF(int)
5952     AC_CHECK_SIZEOF(long long)
5953     AC_CHECK_SIZEOF(double)
5954     AC_CHECK_SIZEOF(void*)
5957     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5958     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5959     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5960     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5961     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5963     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5964     m4_pattern_allow([AC_CHECK_ALIGNOF])
5965     m4_ifdef([AC_CHECK_ALIGNOF],
5966         [
5967             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5968             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5969             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5970             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5971         ],
5972         [
5973             case "$_os-$host_cpu" in
5974             Linux-i686)
5975                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5976                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5977                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5978                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5979                 ;;
5980             Linux-x86_64)
5981                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5982                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5983                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5984                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5985                 ;;
5986             *)
5987                 if test -z "$ac_cv_alignof_short" -o \
5988                         -z "$ac_cv_alignof_int" -o \
5989                         -z "$ac_cv_alignof_long" -o \
5990                         -z "$ac_cv_alignof_double"; then
5991                    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.])
5992                 fi
5993                 ;;
5994             esac
5995         ])
5997     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5998     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5999     if test $ac_cv_sizeof_long -eq 8; then
6000         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6001     elif test $ac_cv_sizeof_double -eq 8; then
6002         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6003     else
6004         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6005     fi
6007     dnl Check for large file support
6008     AC_SYS_LARGEFILE
6009     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6010         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6011     fi
6012     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6013         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6014     fi
6015 else
6016     # Hardcode for MSVC
6017     SAL_TYPES_SIZEOFSHORT=2
6018     SAL_TYPES_SIZEOFINT=4
6019     SAL_TYPES_SIZEOFLONG=4
6020     SAL_TYPES_SIZEOFLONGLONG=8
6021     if test "$BITNESS_OVERRIDE" = ""; then
6022         SAL_TYPES_SIZEOFPOINTER=4
6023     else
6024         SAL_TYPES_SIZEOFPOINTER=8
6025     fi
6026     SAL_TYPES_ALIGNMENT2=2
6027     SAL_TYPES_ALIGNMENT4=4
6028     SAL_TYPES_ALIGNMENT8=8
6029     LFS_CFLAGS=''
6031 AC_SUBST(LFS_CFLAGS)
6033 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6034 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6035 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6036 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6037 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6038 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6039 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6040 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6042 dnl ===================================================================
6043 dnl Check whether to enable runtime optimizations
6044 dnl ===================================================================
6045 ENABLE_RUNTIME_OPTIMIZATIONS=
6046 AC_MSG_CHECKING([whether to enable runtime optimizations])
6047 if test -z "$enable_runtime_optimizations"; then
6048     for i in $CC; do
6049         case $i in
6050         -fsanitize=*)
6051             enable_runtime_optimizations=no
6052             break
6053             ;;
6054         esac
6055     done
6057 if test "$enable_runtime_optimizations" != no; then
6058     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6059     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6060     AC_MSG_RESULT([yes])
6061 else
6062     AC_MSG_RESULT([no])
6064 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6066 dnl ===================================================================
6067 dnl Check if valgrind headers are available
6068 dnl ===================================================================
6069 ENABLE_VALGRIND=
6070 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6071     prev_cppflags=$CPPFLAGS
6072     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6073     # or where does it come from?
6074     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6075     AC_CHECK_HEADER([valgrind/valgrind.h],
6076         [ENABLE_VALGRIND=TRUE])
6077     CPPFLAGS=$prev_cppflags
6079 AC_SUBST([ENABLE_VALGRIND])
6080 if test -z "$ENABLE_VALGRIND"; then
6081     if test "$with_valgrind" = yes; then
6082         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6083     fi
6084     VALGRIND_CFLAGS=
6086 AC_SUBST([VALGRIND_CFLAGS])
6089 dnl ===================================================================
6090 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6091 dnl ===================================================================
6093 # We need at least the sys/sdt.h include header.
6094 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6095 if test "$SDT_H_FOUND" = "TRUE"; then
6096     # Found sys/sdt.h header, now make sure the c++ compiler works.
6097     # Old g++ versions had problems with probes in constructors/destructors.
6098     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6099     AC_LANG_PUSH([C++])
6100     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6101     #include <sys/sdt.h>
6102     class ProbeClass
6103     {
6104     private:
6105       int& ref;
6106       const char *name;
6108     public:
6109       ProbeClass(int& v, const char *n) : ref(v), name(n)
6110       {
6111         DTRACE_PROBE2(_test_, cons, name, ref);
6112       }
6114       void method(int min)
6115       {
6116         DTRACE_PROBE3(_test_, meth, name, ref, min);
6117         ref -= min;
6118       }
6120       ~ProbeClass()
6121       {
6122         DTRACE_PROBE2(_test_, dest, name, ref);
6123       }
6124     };
6125     ]],[[
6126     int i = 64;
6127     DTRACE_PROBE1(_test_, call, i);
6128     ProbeClass inst = ProbeClass(i, "call");
6129     inst.method(24);
6130     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6131           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6132     AC_LANG_POP([C++])
6134 AC_CONFIG_HEADERS([config_host/config_probes.h])
6136 dnl ===================================================================
6137 dnl GCC features
6138 dnl ===================================================================
6139 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6140     AC_MSG_CHECKING([whether $CC supports -mno-avx])
6141     save_CFLAGS=$CFLAGS
6142     CFLAGS="$CFLAGS -Werror -mno-avx"
6143     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6144     CFLAGS=$save_CFLAGS
6145     if test "$HAVE_GCC_AVX" = "TRUE"; then
6146         AC_MSG_RESULT([yes])
6147     else
6148         AC_MSG_RESULT([no])
6149     fi
6151     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
6152     save_CFLAGS=$CFLAGS
6153     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
6154     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
6155     CFLAGS=$save_CFLAGS
6156     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
6157         AC_MSG_RESULT([yes])
6158     else
6159         AC_MSG_RESULT([no])
6160     fi
6162     AC_MSG_CHECKING([whether $CC supports atomic functions])
6163     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6164     int v = 0;
6165     if (__sync_add_and_fetch(&v, 1) != 1 ||
6166         __sync_sub_and_fetch(&v, 1) != 0)
6167         return 1;
6168     __sync_synchronize();
6169     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6170         v != 1)
6171         return 1;
6172     return 0;
6173 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6174     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6175         AC_MSG_RESULT([yes])
6176         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6177     else
6178         AC_MSG_RESULT([no])
6179     fi
6181     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
6182     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6183     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6184         AC_MSG_RESULT([yes])
6185         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6186     else
6187         AC_MSG_RESULT([no])
6188     fi
6190     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6191     save_CFLAGS=$CFLAGS
6192     CFLAGS="$CFLAGS -Werror"
6193     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6194             __attribute__((deprecated("test"))) void f();
6195         ])], [
6196             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6197             AC_MSG_RESULT([yes])
6198         ], [AC_MSG_RESULT([no])])
6199     CFLAGS=$save_CFLAGS
6201     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
6202     AC_LANG_PUSH([C++])
6203     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6204             #include <cstddef>
6205             #include <cxxabi.h>
6206             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6207         ])], [
6208             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6209             AC_MSG_RESULT([yes])
6210         ], [AC_MSG_RESULT([no])])
6211     AC_LANG_POP([C++])
6213     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
6214     AC_LANG_PUSH([C++])
6215     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6216             #include <cstddef>
6217             #include <cxxabi.h>
6218             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6219         ])], [
6220             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6221             AC_MSG_RESULT([yes])
6222         ], [AC_MSG_RESULT([no])])
6223     AC_LANG_POP([C++])
6225     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6226     AC_LANG_PUSH([C++])
6227     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6228             #include <cxxabi.h>
6229             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6230         ])], [
6231             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6232             AC_MSG_RESULT([yes])
6233         ], [AC_MSG_RESULT([no])])
6234     AC_LANG_POP([C++])
6236     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6237     AC_LANG_PUSH([C++])
6238     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6239             #include <cstddef>
6240             #include <cxxabi.h>
6241             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6242         ])], [
6243             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6244             AC_MSG_RESULT([yes])
6245         ], [AC_MSG_RESULT([no])])
6246     AC_LANG_POP([C++])
6248     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6249     AC_LANG_PUSH([C++])
6250     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6251             #include <cstddef>
6252             #include <cxxabi.h>
6253             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6254         ])], [
6255             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6256             AC_MSG_RESULT([yes])
6257         ], [AC_MSG_RESULT([no])])
6258     AC_LANG_POP([C++])
6260     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6261     AC_LANG_PUSH([C++])
6262     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6263             #include <cxxabi.h>
6264             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6265         ])], [
6266             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6267             AC_MSG_RESULT([yes])
6268         ], [AC_MSG_RESULT([no])])
6269     AC_LANG_POP([C++])
6271     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6272     AC_LANG_PUSH([C++])
6273     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6274             #include <cxxabi.h>
6275             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6276         ])], [
6277             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6278             AC_MSG_RESULT([yes])
6279         ], [AC_MSG_RESULT([no])])
6280     AC_LANG_POP([C++])
6282     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6283     AC_LANG_PUSH([C++])
6284     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6285             #include <cxxabi.h>
6286             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6287         ])], [
6288             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6289             AC_MSG_RESULT([yes])
6290         ], [AC_MSG_RESULT([no])])
6291     AC_LANG_POP([C++])
6293     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6294     AC_LANG_PUSH([C++])
6295     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6296             #include <cstddef>
6297             #include <cxxabi.h>
6298             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6299         ])], [
6300             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6301             AC_MSG_RESULT([yes])
6302         ], [AC_MSG_RESULT([no])])
6303     AC_LANG_POP([C++])
6305     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6306     AC_LANG_PUSH([C++])
6307     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6308             #include <cstddef>
6309             #include <cxxabi.h>
6310             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6311         ])], [
6312             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6313             AC_MSG_RESULT([yes])
6314         ], [AC_MSG_RESULT([no])])
6315     AC_LANG_POP([C++])
6317     dnl Available in GCC 4.9 and at least since Clang 3.4:
6318     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6319     AC_LANG_PUSH([C++])
6320     save_CXXFLAGS=$CXXFLAGS
6321     CXXFLAGS="$CXXFLAGS -Werror"
6322     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6323             struct __attribute__((warn_unused)) dummy {};
6324         ])], [
6325             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6326             AC_MSG_RESULT([yes])
6327         ], [AC_MSG_RESULT([no])])
6328     CXXFLAGS=$save_CXXFLAGS
6329 AC_LANG_POP([C++])
6332 AC_SUBST(HAVE_GCC_AVX)
6333 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6334 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6335 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6337 dnl ===================================================================
6338 dnl Identify the C++ library
6339 dnl ===================================================================
6341 AC_MSG_CHECKING([what the C++ library is])
6342 AC_LANG_PUSH([C++])
6343 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6344 #include <utility>
6345 #ifndef __GLIBCXX__
6346 foo bar
6347 #endif
6348 ]])],
6349     [CPP_LIBRARY=GLIBCXX
6350      cpp_library_name="GNU libstdc++"
6351     ],
6352     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6353 #include <utility>
6354 #ifndef _LIBCPP_VERSION
6355 foo bar
6356 #endif
6357 ]])],
6358     [CPP_LIBRARY=LIBCPP
6359      cpp_library_name="LLVM libc++"
6360      AC_DEFINE([HAVE_LIBCXX])
6361     ],
6362     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6363 #include <utility>
6364 #ifndef _MSC_VER
6365 foo bar
6366 #endif
6367 ]])],
6368     [CPP_LIBRARY=MSVCRT
6369      cpp_library_name="Microsoft"
6370     ],
6371     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6372 AC_MSG_RESULT([$cpp_library_name])
6373 AC_LANG_POP([C++])
6375 dnl ===================================================================
6376 dnl Check for gperf
6377 dnl ===================================================================
6378 AC_PATH_PROG(GPERF, gperf)
6379 if test -z "$GPERF"; then
6380     AC_MSG_ERROR([gperf not found but needed. Install it.])
6382 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6383     GPERF=`cygpath -m $GPERF`
6385 AC_MSG_CHECKING([whether gperf is new enough])
6386 my_gperf_ver1=$($GPERF --version | head -n 1)
6387 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6388 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6389 if test "$my_gperf_ver3" -ge 301; then
6390     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6391 else
6392     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6394 AC_SUBST(GPERF)
6396 dnl ===================================================================
6397 dnl Check for system libcmis
6398 dnl ===================================================================
6399 # libcmis requires curl and we can't build curl for iOS
6400 if test $_os != iOS; then
6401     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6402     ENABLE_LIBCMIS=TRUE
6403 else
6404     ENABLE_LIBCMIS=
6406 AC_SUBST(ENABLE_LIBCMIS)
6408 dnl ===================================================================
6409 dnl C++11
6410 dnl ===================================================================
6412 AC_MSG_CHECKING([whether $CXX supports C++17])
6413 CXXFLAGS_CXX11=
6414 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6415     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6416 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6417     my_flags='-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z'
6418     for flag in $my_flags; do
6419         if test "$COM" = MSC; then
6420             flag="-Xclang $flag"
6421         fi
6422         save_CXXFLAGS=$CXXFLAGS
6423         CXXFLAGS="$CXXFLAGS $flag -Werror"
6424         if test "$SYSTEM_LIBCMIS" = TRUE; then
6425             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6426         fi
6427         AC_LANG_PUSH([C++])
6428         dnl Clang 3.9 supports __float128 since
6429         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6430         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6431         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6432         dnl $flag is supported below, so check this first):
6433         my_float128hack=
6434         my_float128hack_impl=-D__float128=void
6435         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6436             #include <vector>
6437             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6438             // (__float128)
6439             ]])
6440         ],,[
6441             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6442             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6443             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6444             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6445             dnl place where __float128 is used is in a template specialization, -D__float128=void
6446             dnl will avoid the problem there while still causing a problem if somebody actually uses
6447             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6448             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6449             dnl "fixed" with this hack):
6450             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6451             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6452                 #include <vector>
6453                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6454                 // (__float128)
6455                 ]])
6456             ],[my_float128hack=$my_float128hack_impl])
6457         ])
6458         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6459             #include <algorithm>
6460             #include <cmath>
6461             #include <functional>
6462             #include <vector>
6464             #if defined SYSTEM_LIBCMIS
6465             // See ucb/source/ucp/cmis/auth_provider.hxx:
6466             #if !defined __clang__
6467             #pragma GCC diagnostic push
6468             #pragma GCC diagnostic ignored "-Wdeprecated"
6469             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6470             #endif
6471             #include <libcmis/libcmis.hxx>
6472             #if !defined __clang__
6473             #pragma GCC diagnostic pop
6474             #endif
6475             #endif
6477             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6478                 std::sort(v.begin(), v.end(), fn);
6479             }
6481             // At least with glibc-headers-2.28-26.fc29.x86_64, when building for Linux x86 32-bit
6482             // (via -m32) and passed-in CXXFLAGS setting -O1 (or higher; overriding -Os as set in
6483             // solenv/gbuild/platform/LINUX_INTEL_GCC.mk), std=gnu* would cause math_errhandling to
6484             // get undef'ed in /usr/include/bits/mathinline.h, while std=c* keeps it defined (as
6485             // needed by sc/source/core/tool/math.cxx):
6486             int g() { return math_errhandling; }
6487             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6488         AC_LANG_POP([C++])
6489         CXXFLAGS=$save_CXXFLAGS
6490         if test -n "$CXXFLAGS_CXX11"; then
6491             break
6492         fi
6493     done
6495 if test -n "$CXXFLAGS_CXX11"; then
6496     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6497 else
6498     AC_MSG_ERROR(no)
6500 AC_SUBST(CXXFLAGS_CXX11)
6502 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6503 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6504 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6505 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6506 dnl again towards 4.7.2:
6507 if test $CPP_LIBRARY = GLIBCXX; then
6508     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6509     AC_LANG_PUSH([C++])
6510     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6511 #include <list>
6512 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6513     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6514     //   GCC 4.7.0: 20120322
6515     //   GCC 4.7.1: 20120614
6516     // and using a range check is not possible as the mapping between
6517     // __GLIBCXX__ values and GCC versions is not monotonic
6518 /* ok */
6519 #else
6520 abi broken
6521 #endif
6522         ]])], [AC_MSG_RESULT(no, ok)],
6523         [AC_MSG_ERROR(yes)])
6524     AC_LANG_POP([C++])
6527 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6528 save_CXXFLAGS=$CXXFLAGS
6529 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6530 AC_LANG_PUSH([C++])
6532 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6533 #include <stddef.h>
6535 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6537 namespace
6539         struct b
6540         {
6541                 int i;
6542                 int j;
6543         };
6545 ]], [[
6546 struct a
6548         int i;
6549         int j;
6551 a thinga[]={{0,0}, {1,1}};
6552 b thingb[]={{0,0}, {1,1}};
6553 size_t i = sizeof(sal_n_array_size(thinga));
6554 size_t j = sizeof(sal_n_array_size(thingb));
6555 return !(i != 0 && j != 0);
6557     ], [ AC_MSG_RESULT(yes) ],
6558     [ AC_MSG_ERROR(no)])
6559 AC_LANG_POP([C++])
6560 CXXFLAGS=$save_CXXFLAGS
6562 dnl _Pragma support (may require C++11)
6563 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6564     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6565     AC_LANG_PUSH([C++])
6566     save_CXXFLAGS=$CXXFLAGS
6567     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6568     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6569             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6570         ])], [
6571             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6572             AC_MSG_RESULT([yes])
6573         ], [AC_MSG_RESULT([no])])
6574     AC_LANG_POP([C++])
6575     CXXFLAGS=$save_CXXFLAGS
6578 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6579 if test "$GCC" = yes; then
6580     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6581     AC_LANG_PUSH([C++])
6582     save_CXXFLAGS=$CXXFLAGS
6583     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6584     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6585     CXXFLAGS=$save_CXXFLAGS
6586     AC_LANG_POP([C++])
6587     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6588         AC_MSG_RESULT([yes])
6589     else
6590         AC_MSG_RESULT([no])
6591     fi
6593 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6595 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6596 AC_LANG_PUSH([C++])
6597 save_CXXFLAGS=$CXXFLAGS
6598 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6599 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6600         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6601         // supporting it:
6602         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6603         struct S {
6604         private:
6605             S(S const &);
6606         public:
6607             S();
6608             ~S();
6609         };
6610         S copy();
6611         void f() { S c(copy()); }
6612         #endif
6613     ])], [
6614         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6615         AC_MSG_RESULT([yes])
6616     ], [AC_MSG_RESULT([no])])
6617 CXXFLAGS=$save_CXXFLAGS
6618 AC_LANG_POP([C++])
6620 AC_MSG_CHECKING([whether $CXX has GCC bug 87150])
6621 AC_LANG_PUSH([C++])
6622 save_CXXFLAGS=$CXXFLAGS
6623 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6624 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6625         struct S1 { S1(S1 &&); };
6626         struct S2: S1 {};
6627         S1 f(S2 s) { return s; }
6628     ])], [
6629         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6630         AC_MSG_RESULT([yes])
6631     ], [AC_MSG_RESULT([no])])
6632 CXXFLAGS=$save_CXXFLAGS
6633 AC_LANG_POP([C++])
6635 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6636 dnl uninitialized warning for code like
6638 dnl   OString f();
6639 dnl   boost::optional<OString> * g(bool b) {
6640 dnl       boost::optional<OString> o;
6641 dnl       if (b) o = f();
6642 dnl       return new boost::optional<OString>(o);
6643 dnl   }
6645 dnl (as is e.g. present, in a slightly more elaborate form, in
6646 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6647 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6648 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6649 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6650     AC_MSG_CHECKING([whether $CXX might report false -Werror=maybe-uninitialized])
6651     AC_LANG_PUSH([C++])
6652     save_CXXFLAGS=$CXXFLAGS
6653     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6654     if test "$ENABLE_OPTIMIZED" = TRUE; then
6655         CXXFLAGS="$CXXFLAGS -O2"
6656     else
6657         CXXFLAGS="$CXXFLAGS -O0"
6658     fi
6659     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6660             #include <new>
6661             void f1(int);
6662             struct S1 {
6663                 ~S1() { f1(n); }
6664                 int n = 0;
6665             };
6666             struct S2 {
6667                 S2() {}
6668                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6669                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6670                 void set(S1 s) {
6671                     new (stg) S1(s);
6672                     init = true;
6673                 }
6674                 bool init = false;
6675                 char stg[sizeof (S1)];
6676             } ;
6677             S1 f2();
6678             S2 * f3(bool b) {
6679                 S2 o;
6680                 if (b) o.set(f2());
6681                 return new S2(o);
6682             }
6683         ]])], [AC_MSG_RESULT([no])], [
6684             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6685             AC_MSG_RESULT([yes])
6686         ])
6687     CXXFLAGS=$save_CXXFLAGS
6688     AC_LANG_POP([C++])
6690 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6692 dnl ===================================================================
6693 dnl system stl sanity tests
6694 dnl ===================================================================
6695 if test "$_os" != "WINNT"; then
6697     AC_LANG_PUSH([C++])
6699     save_CPPFLAGS="$CPPFLAGS"
6700     if test -n "$MACOSX_SDK_PATH"; then
6701         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6702     fi
6704     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6705     # only.
6706     if test "$CPP_LIBRARY" = GLIBCXX; then
6707         dnl gcc#19664, gcc#22482, rhbz#162935
6708         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6709         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6710         AC_MSG_RESULT([$stlvisok])
6711         if test "$stlvisok" = "no"; then
6712             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6713         fi
6714     fi
6716     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6717     # when we don't make any dynamic libraries?
6718     if test "$DISABLE_DYNLOADING" = ""; then
6719         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6720         cat > conftestlib1.cc <<_ACEOF
6721 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6722 struct S2: S1<int> { virtual ~S2(); };
6723 S2::~S2() {}
6724 _ACEOF
6725         cat > conftestlib2.cc <<_ACEOF
6726 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6727 struct S2: S1<int> { virtual ~S2(); };
6728 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6729 _ACEOF
6730         gccvisinlineshiddenok=yes
6731         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6732             gccvisinlineshiddenok=no
6733         else
6734             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6735             dnl known to not work with -z defs (unsetting which makes the test
6736             dnl moot, though):
6737             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6738             if test "$COM_IS_CLANG" = TRUE; then
6739                 for i in $CXX $CXXFLAGS; do
6740                     case $i in
6741                     -fsanitize=*)
6742                         my_linkflagsnoundefs=
6743                         break
6744                         ;;
6745                     esac
6746                 done
6747             fi
6748             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6749                 gccvisinlineshiddenok=no
6750             fi
6751         fi
6753         rm -fr libconftest*
6754         AC_MSG_RESULT([$gccvisinlineshiddenok])
6755         if test "$gccvisinlineshiddenok" = "no"; then
6756             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6757         fi
6758     fi
6760    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6761     cat >visibility.cxx <<_ACEOF
6762 #pragma GCC visibility push(hidden)
6763 struct __attribute__ ((visibility ("default"))) TestStruct {
6764   static void Init();
6766 __attribute__ ((visibility ("default"))) void TestFunc() {
6767   TestStruct::Init();
6769 _ACEOF
6770     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6771         gccvisbroken=yes
6772     else
6773         case "$host_cpu" in
6774         i?86|x86_64)
6775             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6776                 gccvisbroken=no
6777             else
6778                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6779                     gccvisbroken=no
6780                 else
6781                     gccvisbroken=yes
6782                 fi
6783             fi
6784             ;;
6785         *)
6786             gccvisbroken=no
6787             ;;
6788         esac
6789     fi
6790     rm -f visibility.s visibility.cxx
6792     AC_MSG_RESULT([$gccvisbroken])
6793     if test "$gccvisbroken" = "yes"; then
6794         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6795     fi
6797     CPPFLAGS="$save_CPPFLAGS"
6799     AC_LANG_POP([C++])
6802 dnl ===================================================================
6803 dnl  Clang++ tests
6804 dnl ===================================================================
6806 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6807 if test "$GCC" = "yes"; then
6808     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6809     AC_LANG_PUSH([C++])
6810     save_CXXFLAGS=$CXXFLAGS
6811     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6812     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6813     CXXFLAGS=$save_CXXFLAGS
6814     AC_LANG_POP([C++])
6815     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6816         AC_MSG_RESULT([yes])
6817     else
6818         AC_MSG_RESULT([no])
6819     fi
6821 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6823 dnl ===================================================================
6824 dnl Compiler plugins
6825 dnl ===================================================================
6827 COMPILER_PLUGINS=
6828 # currently only Clang
6830 if test "$COM_IS_CLANG" != "TRUE"; then
6831     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6832         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6833         enable_compiler_plugins=no
6834     fi
6837 if test "$COM_IS_CLANG" = "TRUE"; then
6838     if test -n "$enable_compiler_plugins"; then
6839         compiler_plugins="$enable_compiler_plugins"
6840     elif test -n "$ENABLE_DBGUTIL"; then
6841         compiler_plugins=test
6842     else
6843         compiler_plugins=no
6844     fi
6845     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 50002; then
6846         if test "$compiler_plugins" = yes; then
6847             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
6848         else
6849             compiler_plugins=no
6850         fi
6851     fi
6852     if test "$compiler_plugins" != "no"; then
6853         dnl The prefix where Clang resides, override to where Clang resides if
6854         dnl using a source build:
6855         if test -z "$CLANGDIR"; then
6856             CLANGDIR=/usr
6857         fi
6858         AC_LANG_PUSH([C++])
6859         save_CPPFLAGS=$CPPFLAGS
6860         save_CXX=$CXX
6861         save_CXXCPP=$CXXCPP
6862         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6863         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
6864         CXX=$COMPILER_PLUGINS_CXX
6865         CXXCPP="$COMPILER_PLUGINS_CXX -E"
6866         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6867         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6868             [COMPILER_PLUGINS=TRUE],
6869             [
6870             if test "$compiler_plugins" = "yes"; then
6871                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6872             else
6873                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6874                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6875             fi
6876             ])
6877         CXX=$save_CXX
6878         CXXCPP=$save_CXXCPP
6879         CPPFLAGS=$save_CPPFLAGS
6880         AC_LANG_POP([C++])
6881     fi
6882 else
6883     if test "$enable_compiler_plugins" = "yes"; then
6884         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6885     fi
6887 AC_SUBST(COMPILER_PLUGINS)
6888 AC_SUBST(COMPILER_PLUGINS_CXX)
6889 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6890 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6891 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
6892 AC_SUBST(CLANGDIR)
6893 AC_SUBST(CLANGLIBDIR)
6895 # Plugin to help linker.
6896 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6897 # This makes --enable-lto build with clang work.
6898 AC_SUBST(LD_PLUGIN)
6900 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6901 AC_SUBST(HAVE_POSIX_FALLOCATE)
6903 dnl ===================================================================
6904 dnl Custom build version
6905 dnl ===================================================================
6907 AC_MSG_CHECKING([whether to add custom build version])
6908 if test "$with_build_version" != ""; then
6909     BUILD_VER_STRING=$with_build_version
6910     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6911 else
6912     BUILD_VER_STRING=
6913     AC_MSG_RESULT([no])
6915 AC_SUBST(BUILD_VER_STRING)
6917 JITC_PROCESSOR_TYPE=""
6918 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6919     # IBMs JDK needs this...
6920     JITC_PROCESSOR_TYPE=6
6921     export JITC_PROCESSOR_TYPE
6923 AC_SUBST([JITC_PROCESSOR_TYPE])
6925 # Misc Windows Stuff
6926 AC_ARG_WITH(ucrt-dir,
6927     AS_HELP_STRING([--with-ucrt-dir],
6928         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6929         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6930         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6931             Windows6.1-KB2999226-x64.msu
6932             Windows6.1-KB2999226-x86.msu
6933             Windows8.1-KB2999226-x64.msu
6934             Windows8.1-KB2999226-x86.msu
6935             Windows8-RT-KB2999226-x64.msu
6936             Windows8-RT-KB2999226-x86.msu
6937         A zip archive including those files is available from Microsoft site:
6938         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6940 UCRT_REDISTDIR="$with_ucrt_dir"
6941 if test $_os = "WINNT"; then
6942     find_msvc_x64_dlls
6943     find_msms
6944     MSVC_DLL_PATH="$msvcdllpath"
6945     MSVC_DLLS="$msvcdlls"
6946     MSM_PATH="$msmdir"
6947     # MSVC 15.3 changed it to VC141
6948     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6949         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6950     else
6951         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6952     fi
6953     if test "$UCRT_REDISTDIR" = "no"; then
6954         dnl explicitly disabled
6955         UCRT_REDISTDIR=""
6956     else
6957         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6958                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6959                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6960                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6961                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6962                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6963             UCRT_REDISTDIR=""
6964             if test -n "$PKGFORMAT"; then
6965                for i in $PKGFORMAT; do
6966                    case "$i" in
6967                    msi)
6968                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6969                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6970                        ;;
6971                    esac
6972                done
6973             fi
6974         fi
6975     fi
6978 AC_SUBST(UCRT_REDISTDIR)
6979 AC_SUBST(MSVC_DLL_PATH)
6980 AC_SUBST(MSVC_DLLS)
6981 AC_SUBST(MSM_PATH)
6983 dnl ===================================================================
6984 dnl Checks for Java
6985 dnl ===================================================================
6986 if test "$ENABLE_JAVA" != ""; then
6988     # Windows-specific tests
6989     if test "$build_os" = "cygwin"; then
6990         if test "$BITNESS_OVERRIDE" = 64; then
6991             bitness=64
6992         else
6993             bitness=32
6994         fi
6996         if test -z "$with_jdk_home"; then
6997             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6998             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6999             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7000             if test -n "$regvalue"; then
7001                 ver=$regvalue
7002                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7003                 _jdk_home=$regvalue
7004             fi
7005             if test -z "$with_jdk_home"; then
7006                 for ver in 1.8 1.7 1.6; do
7007                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7008                     if test -n "$regvalue"; then
7009                         _jdk_home=$regvalue
7010                         break
7011                     fi
7012                 done
7013             fi
7014             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7015                 with_jdk_home="$_jdk_home"
7016                 howfound="found automatically"
7017             else
7018                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7019             fi
7020         else
7021             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7022             howfound="you passed"
7023         fi
7024     fi
7026     # 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.
7027     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7028     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7029         with_jdk_home=`/usr/libexec/java_home`
7030     fi
7032     JAVA_HOME=; export JAVA_HOME
7033     if test -z "$with_jdk_home"; then
7034         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7035     else
7036         _java_path="$with_jdk_home/bin/$with_java"
7037         dnl Check if there is a Java interpreter at all.
7038         if test -x "$_java_path"; then
7039             JAVAINTERPRETER=$_java_path
7040         else
7041             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7042         fi
7043     fi
7045     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7046     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7047     dnl loaded by java to run JunitTests:
7048     if test "$build_os" = "cygwin"; then
7049         shortjdkhome=`cygpath -d "$with_jdk_home"`
7050         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
7051             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7052             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7053         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
7054             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7055             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7056         fi
7058         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7059             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7060         fi
7061         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7062     elif test "$cross_compiling" != "yes"; then
7063         case $CPUNAME in
7064             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7065                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7066                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7067                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7068                 fi
7069                 ;;
7070             *) # assumption: everything else 32-bit
7071                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7072                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7073                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7074                 fi
7075                 ;;
7076         esac
7077     fi
7080 dnl ===================================================================
7081 dnl Checks for JDK.
7082 dnl ===================================================================
7084 # Note that JAVA_HOME as for now always means the *build* platform's
7085 # JAVA_HOME. Whether all the complexity here actually is needed any
7086 # more or not, no idea.
7088 if test "$ENABLE_JAVA" != ""; then
7089     _gij_longver=0
7090     AC_MSG_CHECKING([the installed JDK])
7091     if test -n "$JAVAINTERPRETER"; then
7092         dnl java -version sends output to stderr!
7093         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7094             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7095         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7096             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7097         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7098             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7099         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7100             JDK=ibm
7102             dnl IBM JDK specific tests
7103             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7104             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7106             if test "$_jdk_ver" -lt 10600; then
7107                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
7108             fi
7110             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
7112             if test "$with_jdk_home" = ""; then
7113                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7114 you must use the "--with-jdk-home" configure option explicitly])
7115             fi
7117             JAVA_HOME=$with_jdk_home
7118         else
7119             JDK=sun
7121             dnl Sun JDK specific tests
7122             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $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([JDK is too old, you need at least 1.6])
7127             fi
7128             if test "$_jdk_ver" -gt 10600; then
7129                 JAVA_CLASSPATH_NOT_SET=TRUE
7130             fi
7132             AC_MSG_RESULT([checked (JDK $_jdk)])
7133             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7134             if test "$_os" = "WINNT"; then
7135                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7136             fi
7138             # set to limit VM usage for JunitTests
7139             JAVAIFLAGS=-Xmx64M
7140             # set to limit VM usage for javac
7141             JAVAFLAGS=-J-Xmx128M
7142         fi
7143     else
7144         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
7145     fi
7146 else
7147     dnl Java disabled
7148     JAVA_HOME=
7149     export JAVA_HOME
7152 dnl ===================================================================
7153 dnl Checks for javac
7154 dnl ===================================================================
7155 if test "$ENABLE_JAVA" != ""; then
7156     javacompiler="javac"
7157     : ${JAVA_SOURCE_VER=1.6}
7158     : ${JAVA_TARGET_VER=1.6}
7159     if test -z "$with_jdk_home"; then
7160         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7161     else
7162         _javac_path="$with_jdk_home/bin/$javacompiler"
7163         dnl Check if there is a Java compiler at all.
7164         if test -x "$_javac_path"; then
7165             JAVACOMPILER=$_javac_path
7166         fi
7167     fi
7168     if test -z "$JAVACOMPILER"; then
7169         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7170     fi
7171     if test "$build_os" = "cygwin"; then
7172         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7173             JAVACOMPILER="${JAVACOMPILER}.exe"
7174         fi
7175         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7176     fi
7179 dnl ===================================================================
7180 dnl Checks for javadoc
7181 dnl ===================================================================
7182 if test "$ENABLE_JAVA" != ""; then
7183     if test -z "$with_jdk_home"; then
7184         AC_PATH_PROG(JAVADOC, javadoc)
7185     else
7186         _javadoc_path="$with_jdk_home/bin/javadoc"
7187         dnl Check if there is a javadoc at all.
7188         if test -x "$_javadoc_path"; then
7189             JAVADOC=$_javadoc_path
7190         else
7191             AC_PATH_PROG(JAVADOC, javadoc)
7192         fi
7193     fi
7194     if test -z "$JAVADOC"; then
7195         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7196     fi
7197     if test "$build_os" = "cygwin"; then
7198         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7199             JAVADOC="${JAVADOC}.exe"
7200         fi
7201         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7202     fi
7204     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7205     JAVADOCISGJDOC="yes"
7206     fi
7208 AC_SUBST(JAVADOCISGJDOC)
7210 if test "$ENABLE_JAVA" != ""; then
7211     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7212     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7213         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7214            # try to recover first by looking whether we have an alternative
7215            # system as in Debian or newer SuSEs where following /usr/bin/javac
7216            # over /etc/alternatives/javac leads to the right bindir where we
7217            # just need to strip a bit away to get a valid JAVA_HOME
7218            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7219         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7220             # maybe only one level of symlink (e.g. on Mac)
7221             JAVA_HOME=$(readlink $JAVACOMPILER)
7222             if test "$(dirname $JAVA_HOME)" = "."; then
7223                 # we've got no path to trim back
7224                 JAVA_HOME=""
7225             fi
7226         else
7227             # else warn
7228             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7229             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7230             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7231             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7232         fi
7233         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7234         if test "$JAVA_HOME" != "/usr"; then
7235             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7236                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7237                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7238                 dnl Tiger already returns a JDK path..
7239                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7240             else
7241                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7242                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7243                 dnl that checks which version to run
7244                 if test -f "$JAVA_HOME"; then
7245                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7246                 fi
7247             fi
7248         fi
7249     fi
7250     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7252     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7253     if test -z "$JAVA_HOME"; then
7254         if test "x$with_jdk_home" = "x"; then
7255             cat > findhome.java <<_ACEOF
7256 [import java.io.File;
7258 class findhome
7260     public static void main(String args[])
7261     {
7262         String jrelocation = System.getProperty("java.home");
7263         File jre = new File(jrelocation);
7264         System.out.println(jre.getParent());
7265     }
7267 _ACEOF
7268             AC_MSG_CHECKING([if javac works])
7269             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7270             AC_TRY_EVAL(javac_cmd)
7271             if test $? = 0 -a -f ./findhome.class; then
7272                 AC_MSG_RESULT([javac works])
7273             else
7274                 echo "configure: javac test failed" >&5
7275                 cat findhome.java >&5
7276                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7277             fi
7278             AC_MSG_CHECKING([if gij knows its java.home])
7279             JAVA_HOME=`$JAVAINTERPRETER findhome`
7280             if test $? = 0 -a "$JAVA_HOME" != ""; then
7281                 AC_MSG_RESULT([$JAVA_HOME])
7282             else
7283                 echo "configure: java test failed" >&5
7284                 cat findhome.java >&5
7285                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7286             fi
7287             # clean-up after ourselves
7288             rm -f ./findhome.java ./findhome.class
7289         else
7290             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7291         fi
7292     fi
7294     # now check if $JAVA_HOME is really valid
7295     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7296         case "${JAVA_HOME}" in
7297             /Library/Java/JavaVirtualMachines/*)
7298                 ;;
7299             *)
7300                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7301                 ;;
7302         esac
7303         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7304             JAVA_HOME_OK="NO"
7305         fi
7306     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7307         JAVA_HOME_OK="NO"
7308     fi
7309     if test "$JAVA_HOME_OK" = "NO"; then
7310         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7311         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7312         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7313         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7314         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7315         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7316     fi
7317     PathFormat "$JAVA_HOME"
7318     JAVA_HOME="$formatted_path"
7321 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7322     "$_os" != Darwin
7323 then
7324     AC_MSG_CHECKING([for JAWT lib])
7325     if test "$_os" = WINNT; then
7326         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7327         JAWTLIB=jawt.lib
7328     else
7329         case "$host_cpu" in
7330         arm*)
7331             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7332             JAVA_ARCH=$my_java_arch
7333             ;;
7334         i*86)
7335             my_java_arch=i386
7336             ;;
7337         m68k)
7338             my_java_arch=m68k
7339             ;;
7340         powerpc)
7341             my_java_arch=ppc
7342             ;;
7343         powerpc64)
7344             my_java_arch=ppc64
7345             ;;
7346         powerpc64le)
7347             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7348             JAVA_ARCH=$my_java_arch
7349             ;;
7350         sparc64)
7351             my_java_arch=sparcv9
7352             ;;
7353         x86_64)
7354             my_java_arch=amd64
7355             ;;
7356         *)
7357             my_java_arch=$host_cpu
7358             ;;
7359         esac
7360         # This is where JDK9 puts the library
7361         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7362             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7363         else
7364             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7365         fi
7366         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7367     fi
7368     AC_MSG_RESULT([$JAWTLIB])
7370 AC_SUBST(JAWTLIB)
7372 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7373     case "$host_os" in
7375     aix*)
7376         JAVAINC="-I$JAVA_HOME/include"
7377         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7378         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7379         ;;
7381     cygwin*)
7382         JAVAINC="-I$JAVA_HOME/include/win32"
7383         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7384         ;;
7386     darwin*)
7387         if test -d "$JAVA_HOME/include/darwin"; then
7388             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7389         else
7390             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7391         fi
7392         ;;
7394     dragonfly*)
7395         JAVAINC="-I$JAVA_HOME/include"
7396         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7397         ;;
7399     freebsd*)
7400         JAVAINC="-I$JAVA_HOME/include"
7401         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7402         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7403         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7404         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7405         ;;
7407     k*bsd*-gnu*)
7408         JAVAINC="-I$JAVA_HOME/include"
7409         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7410         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7411         ;;
7413     linux-gnu*)
7414         JAVAINC="-I$JAVA_HOME/include"
7415         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7416         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7417         ;;
7419     *netbsd*)
7420         JAVAINC="-I$JAVA_HOME/include"
7421         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7422         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7423        ;;
7425     openbsd*)
7426         JAVAINC="-I$JAVA_HOME/include"
7427         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7428         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7429         ;;
7431     solaris*)
7432         JAVAINC="-I$JAVA_HOME/include"
7433         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7434         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7435         ;;
7436     esac
7438 SOLARINC="$SOLARINC $JAVAINC"
7440 if test "$ENABLE_JAVA" != "" -a "x" != "x$JAVACOMPILER" && test "$_jdk_ver" -ge 10900; then
7441     url_check_unknown=0
7442     java_base="testurlcheck"
7443     java_src="${java_base}.java"
7444     java_cls="${java_base}.class"
7445     cat > "${java_src}" <<_ACEOF
7446 [import jdk.internal.loader.URLClassPath;
7447 import java.lang.reflect.Field;
7448 import java.net.URL;
7450 class ${java_base}
7452     public static void main(String args[])
7453     {
7454         try {
7455             URLClassPath cp = new URLClassPath(new URL[0], null);
7456             Field field = cp.getClass().getDeclaredField("DISABLE_CP_URL_CHECK");
7457             field.setAccessible(true);
7458             System.out.println(field.get(cp).toString());
7459         } catch(Exception e) {
7460             System.out.println("unknown");
7461         }
7462     }
7464 _ACEOF
7465     AC_MSG_CHECKING([if jdk.net.URLClassPath.ClassPathURLCheck is disabled])
7466     java_cmd="$JAVACOMPILER --add-exports java.base/jdk.internal.loader=ALL-UNNAMED ${java_src} 1>&2"
7467     AC_TRY_EVAL(java_cmd)
7468     if test $? = 0 -a -f "./${java_cls}"; then
7469         java_res=`$JAVAINTERPRETER --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ${java_base} 2>/dev/null`
7470         if test $? = 0; then
7471             case "${java_res}" in
7472             true) AC_MSG_RESULT([yes]) ;;
7473             false)
7474                 rm -f "./${java_src}" "./${java_cls}"
7475                 AC_MSG_ERROR([no - Java unit tests will break!])
7476                 ;;
7477             *) url_check_unknown=1 ;;
7478             esac
7479         else
7480             url_check_unknown=1
7481         fi
7482     else
7483         url_check_unknown=1
7484     fi
7485     if test $url_check_unknown -eq 1; then
7486         AC_MSG_RESULT([unknown - assuming yes])
7487         add_warning "Unable to find the default value for jdk.net.URLClassPath.ClassPathURLCheck - java tests might fail!"
7488     fi
7489     rm -f "./${java_src}" "./${java_cls}"
7492 AC_SUBST(JAVACOMPILER)
7493 AC_SUBST(JAVADOC)
7494 AC_SUBST(JAVAINTERPRETER)
7495 AC_SUBST(JAVAIFLAGS)
7496 AC_SUBST(JAVAFLAGS)
7497 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7498 AC_SUBST(JAVA_HOME)
7499 AC_SUBST(JAVA_SOURCE_VER)
7500 AC_SUBST(JAVA_TARGET_VER)
7501 AC_SUBST(JDK)
7504 dnl ===================================================================
7505 dnl Export file validation
7506 dnl ===================================================================
7507 AC_MSG_CHECKING([whether to enable export file validation])
7508 if test "$with_export_validation" != "no"; then
7509     if test -z "$ENABLE_JAVA"; then
7510         if test "$with_export_validation" = "yes"; then
7511             AC_MSG_ERROR([requested, but Java is disabled])
7512         else
7513             AC_MSG_RESULT([no, as Java is disabled])
7514         fi
7515     elif test "$_jdk_ver" -lt 10800; then
7516         if test "$with_export_validation" = "yes"; then
7517             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7518         else
7519             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7520         fi
7521     else
7522         AC_MSG_RESULT([yes])
7523         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7525         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7526         if test -z "$ODFVALIDATOR"; then
7527             # remember to download the ODF toolkit with validator later
7528             AC_MSG_NOTICE([no odfvalidator found, will download it])
7529             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7530             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7532             # and fetch name of odfvalidator jar name from download.lst
7533             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7534             AC_SUBST(ODFVALIDATOR_JAR)
7536             if test -z "$ODFVALIDATOR_JAR"; then
7537                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7538             fi
7539         fi
7540         if test "$build_os" = "cygwin"; then
7541             # In case of Cygwin it will be executed from Windows,
7542             # so we need to run bash and absolute path to validator
7543             # so instead of "odfvalidator" it will be
7544             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7545             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7546         else
7547             ODFVALIDATOR="sh $ODFVALIDATOR"
7548         fi
7549         AC_SUBST(ODFVALIDATOR)
7552         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7553         if test -z "$OFFICEOTRON"; then
7554             # remember to download the officeotron with validator later
7555             AC_MSG_NOTICE([no officeotron found, will download it])
7556             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7557             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7559             # and fetch name of officeotron jar name from download.lst
7560             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7561             AC_SUBST(OFFICEOTRON_JAR)
7563             if test -z "$OFFICEOTRON_JAR"; then
7564                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7565             fi
7566         else
7567             # check version of existing officeotron
7568             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7569             if test 0"$OFFICEOTRON_VER" -lt 704; then
7570                 AC_MSG_ERROR([officeotron too old])
7571             fi
7572         fi
7573         if test "$build_os" = "cygwin"; then
7574             # In case of Cygwin it will be executed from Windows,
7575             # so we need to run bash and absolute path to validator
7576             # so instead of "odfvalidator" it will be
7577             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7578             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7579         else
7580             OFFICEOTRON="sh $OFFICEOTRON"
7581         fi
7582     fi
7583     AC_SUBST(OFFICEOTRON)
7584 else
7585     AC_MSG_RESULT([no])
7588 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7589 if test "$with_bffvalidator" != "no"; then
7590     AC_DEFINE(HAVE_BFFVALIDATOR)
7592     if test "$with_export_validation" = "no"; then
7593         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7594     fi
7596     if test "$with_bffvalidator" = "yes"; then
7597         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7598     else
7599         BFFVALIDATOR="$with_bffvalidator"
7600     fi
7602     if test "$build_os" = "cygwin"; then
7603         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7604             AC_MSG_RESULT($BFFVALIDATOR)
7605         else
7606             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7607         fi
7608     elif test -n "$BFFVALIDATOR"; then
7609         # We are not in Cygwin but need to run Windows binary with wine
7610         AC_PATH_PROGS(WINE, wine)
7612         # so swap in a shell wrapper that converts paths transparently
7613         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7614         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7615         AC_SUBST(BFFVALIDATOR_EXE)
7616         AC_MSG_RESULT($BFFVALIDATOR)
7617     else
7618         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7619     fi
7620     AC_SUBST(BFFVALIDATOR)
7621 else
7622     AC_MSG_RESULT([no])
7625 dnl ===================================================================
7626 dnl Check for C preprocessor to use
7627 dnl ===================================================================
7628 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7629 if test -n "$with_idlc_cpp"; then
7630     AC_MSG_RESULT([$with_idlc_cpp])
7631     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7632 else
7633     AC_MSG_RESULT([ucpp])
7634     AC_MSG_CHECKING([which ucpp tp use])
7635     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7636         AC_MSG_RESULT([external])
7637         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7638     else
7639         AC_MSG_RESULT([internal])
7640         BUILD_TYPE="$BUILD_TYPE UCPP"
7641     fi
7643 AC_SUBST(SYSTEM_UCPP)
7645 dnl ===================================================================
7646 dnl Check for epm (not needed for Windows)
7647 dnl ===================================================================
7648 AC_MSG_CHECKING([whether to enable EPM for packing])
7649 if test "$enable_epm" = "yes"; then
7650     AC_MSG_RESULT([yes])
7651     if test "$_os" != "WINNT"; then
7652         if test $_os = Darwin; then
7653             EPM=internal
7654         elif test -n "$with_epm"; then
7655             EPM=$with_epm
7656         else
7657             AC_PATH_PROG(EPM, epm, no)
7658         fi
7659         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7660             AC_MSG_NOTICE([EPM will be built.])
7661             BUILD_TYPE="$BUILD_TYPE EPM"
7662             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7663         else
7664             # Gentoo has some epm which is something different...
7665             AC_MSG_CHECKING([whether the found epm is the right epm])
7666             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7667                 AC_MSG_RESULT([yes])
7668             else
7669                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7670             fi
7671             AC_MSG_CHECKING([epm version])
7672             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7673             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7674                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7675                 AC_MSG_RESULT([OK, >= 3.7])
7676             else
7677                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7678                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7679             fi
7680         fi
7681     fi
7683     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7684         AC_MSG_CHECKING([for rpm])
7685         for a in "$RPM" rpmbuild rpm; do
7686             $a --usage >/dev/null 2> /dev/null
7687             if test $? -eq 0; then
7688                 RPM=$a
7689                 break
7690             else
7691                 $a --version >/dev/null 2> /dev/null
7692                 if test $? -eq 0; then
7693                     RPM=$a
7694                     break
7695                 fi
7696             fi
7697         done
7698         if test -z "$RPM"; then
7699             AC_MSG_ERROR([not found])
7700         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7701             RPM_PATH=`which $RPM`
7702             AC_MSG_RESULT([$RPM_PATH])
7703             SCPDEFS="$SCPDEFS -DWITH_RPM"
7704         else
7705             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7706         fi
7707     fi
7708     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7709         AC_PATH_PROG(DPKG, dpkg, no)
7710         if test "$DPKG" = "no"; then
7711             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7712         fi
7713     fi
7714     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7715        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7716         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7717             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7718                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7719                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7720                     AC_MSG_RESULT([yes])
7721                 else
7722                     AC_MSG_RESULT([no])
7723                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7724                         _pt="rpm"
7725                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7726                         add_warning "the rpms will need to be installed with --nodeps"
7727                     else
7728                         _pt="pkg"
7729                     fi
7730                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7731                     add_warning "the ${_pt}s will not be relocatable"
7732                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7733                                  relocation will work, you need to patch your epm with the
7734                                  patch in epm/epm-3.7.patch or build with
7735                                  --with-epm=internal which will build a suitable epm])
7736                 fi
7737             fi
7738         fi
7739     fi
7740     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7741         AC_PATH_PROG(PKGMK, pkgmk, no)
7742         if test "$PKGMK" = "no"; then
7743             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7744         fi
7745     fi
7746     AC_SUBST(RPM)
7747     AC_SUBST(DPKG)
7748     AC_SUBST(PKGMK)
7749 else
7750     for i in $PKGFORMAT; do
7751         case "$i" in
7752         aix | bsd | deb | pkg | rpm | native | portable)
7753             AC_MSG_ERROR(
7754                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7755             ;;
7756         esac
7757     done
7758     AC_MSG_RESULT([no])
7759     EPM=NO
7761 AC_SUBST(EPM)
7763 ENABLE_LWP=
7764 if test "$enable_lotuswordpro" = "yes"; then
7765     ENABLE_LWP="TRUE"
7767 AC_SUBST(ENABLE_LWP)
7769 dnl ===================================================================
7770 dnl Check for building ODK
7771 dnl ===================================================================
7772 if test "$enable_odk" = no; then
7773     unset DOXYGEN
7774 else
7775     if test "$with_doxygen" = no; then
7776         AC_MSG_CHECKING([for doxygen])
7777         unset DOXYGEN
7778         AC_MSG_RESULT([no])
7779     else
7780         if test "$with_doxygen" = yes; then
7781             AC_PATH_PROG([DOXYGEN], [doxygen])
7782             if test -z "$DOXYGEN"; then
7783                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7784             fi
7785             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7786                 if ! dot -V 2>/dev/null; then
7787                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7788                 fi
7789             fi
7790         else
7791             AC_MSG_CHECKING([for doxygen])
7792             DOXYGEN=$with_doxygen
7793             AC_MSG_RESULT([$DOXYGEN])
7794         fi
7795         if test -n "$DOXYGEN"; then
7796             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7797             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7798             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7799                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7800             fi
7801         fi
7802     fi
7804 AC_SUBST([DOXYGEN])
7806 AC_MSG_CHECKING([whether to build the ODK])
7807 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7808     AC_MSG_RESULT([yes])
7810     if test "$with_java" != "no"; then
7811         AC_MSG_CHECKING([whether to build unowinreg.dll])
7812         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7813             # build on Win by default
7814             enable_build_unowinreg=yes
7815         fi
7816         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7817             AC_MSG_RESULT([no])
7818             BUILD_UNOWINREG=
7819         else
7820             AC_MSG_RESULT([yes])
7821             BUILD_UNOWINREG=TRUE
7822         fi
7823         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7824             if test -z "$with_mingw_cross_compiler"; then
7825                 dnl Guess...
7826                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7827             elif test -x "$with_mingw_cross_compiler"; then
7828                  MINGWCXX="$with_mingw_cross_compiler"
7829             else
7830                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7831             fi
7833             if test "$MINGWCXX" = "false"; then
7834                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7835             fi
7837             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7838             if test -x "$mingwstrip_test"; then
7839                 MINGWSTRIP="$mingwstrip_test"
7840             else
7841                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7842             fi
7844             if test "$MINGWSTRIP" = "false"; then
7845                 AC_MSG_ERROR(MinGW32 binutils not found.)
7846             fi
7847         fi
7848     fi
7849     BUILD_TYPE="$BUILD_TYPE ODK"
7850 else
7851     AC_MSG_RESULT([no])
7852     BUILD_UNOWINREG=
7854 AC_SUBST(BUILD_UNOWINREG)
7855 AC_SUBST(MINGWCXX)
7856 AC_SUBST(MINGWSTRIP)
7858 dnl ===================================================================
7859 dnl Check for system zlib
7860 dnl ===================================================================
7861 if test "$with_system_zlib" = "auto"; then
7862     case "$_os" in
7863     WINNT)
7864         with_system_zlib="$with_system_libs"
7865         ;;
7866     *)
7867         if test "$enable_fuzzers" != "yes"; then
7868             with_system_zlib=yes
7869         else
7870             with_system_zlib=no
7871         fi
7872         ;;
7873     esac
7876 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
7877 dnl and has no pkg-config for it at least on some tinderboxes,
7878 dnl so leaving that out for now
7879 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7880 AC_MSG_CHECKING([which zlib to use])
7881 if test "$with_system_zlib" = "yes"; then
7882     AC_MSG_RESULT([external])
7883     SYSTEM_ZLIB=TRUE
7884     AC_CHECK_HEADER(zlib.h, [],
7885         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7886     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7887         [AC_MSG_ERROR(zlib not found or functional)], [])
7888 else
7889     AC_MSG_RESULT([internal])
7890     SYSTEM_ZLIB=
7891     BUILD_TYPE="$BUILD_TYPE ZLIB"
7892     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7893     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7895 AC_SUBST(ZLIB_CFLAGS)
7896 AC_SUBST(ZLIB_LIBS)
7897 AC_SUBST(SYSTEM_ZLIB)
7899 dnl ===================================================================
7900 dnl Check for system jpeg
7901 dnl ===================================================================
7902 AC_MSG_CHECKING([which libjpeg to use])
7903 if test "$with_system_jpeg" = "yes"; then
7904     AC_MSG_RESULT([external])
7905     SYSTEM_LIBJPEG=TRUE
7906     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7907         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7908     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7909         [AC_MSG_ERROR(jpeg library not found or functional)], [])
7910 else
7911     SYSTEM_LIBJPEG=
7912     AC_MSG_RESULT([internal, libjpeg-turbo])
7913     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7914     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7915     if test "$COM" = "MSC"; then
7916         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7917     else
7918         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7919     fi
7921     case "$host_cpu" in
7922     x86_64 | amd64 | i*86 | x86 | ia32)
7923         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7924         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7925             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7926                 NASM="$LODE_HOME/opt/bin/nasm"
7927             elif test -x "/opt/lo/bin/nasm"; then
7928                 NASM="/opt/lo/bin/nasm"
7929             fi
7930         fi
7932         if test -n "$NASM"; then
7933             AC_MSG_CHECKING([for object file format of host system])
7934             case "$host_os" in
7935               cygwin* | mingw* | pw32* | interix*)
7936                 case "$host_cpu" in
7937                   x86_64)
7938                     objfmt='Win64-COFF'
7939                     ;;
7940                   *)
7941                     objfmt='Win32-COFF'
7942                     ;;
7943                 esac
7944               ;;
7945               msdosdjgpp* | go32*)
7946                 objfmt='COFF'
7947               ;;
7948               os2-emx*)                 # not tested
7949                 objfmt='MSOMF'          # obj
7950               ;;
7951               linux*coff* | linux*oldld*)
7952                 objfmt='COFF'           # ???
7953               ;;
7954               linux*aout*)
7955                 objfmt='a.out'
7956               ;;
7957               linux*)
7958                 case "$host_cpu" in
7959                   x86_64)
7960                     objfmt='ELF64'
7961                     ;;
7962                   *)
7963                     objfmt='ELF'
7964                     ;;
7965                 esac
7966               ;;
7967               kfreebsd* | freebsd* | netbsd* | openbsd*)
7968                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7969                   objfmt='BSD-a.out'
7970                 else
7971                   case "$host_cpu" in
7972                     x86_64 | amd64)
7973                       objfmt='ELF64'
7974                       ;;
7975                     *)
7976                       objfmt='ELF'
7977                       ;;
7978                   esac
7979                 fi
7980               ;;
7981               solaris* | sunos* | sysv* | sco*)
7982                 case "$host_cpu" in
7983                   x86_64)
7984                     objfmt='ELF64'
7985                     ;;
7986                   *)
7987                     objfmt='ELF'
7988                     ;;
7989                 esac
7990               ;;
7991               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7992                 case "$host_cpu" in
7993                   x86_64)
7994                     objfmt='Mach-O64'
7995                     ;;
7996                   *)
7997                     objfmt='Mach-O'
7998                     ;;
7999                 esac
8000               ;;
8001               *)
8002                 objfmt='ELF ?'
8003               ;;
8004             esac
8006             AC_MSG_RESULT([$objfmt])
8007             if test "$objfmt" = 'ELF ?'; then
8008               objfmt='ELF'
8009               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8010             fi
8012             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8013             case "$objfmt" in
8014               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8015               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8016               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8017               COFF)       NAFLAGS='-fcoff -DCOFF';;
8018               a.out)      NAFLAGS='-faout -DAOUT';;
8019               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8020               ELF)        NAFLAGS='-felf -DELF';;
8021               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8022               RDF)        NAFLAGS='-frdf -DRDF';;
8023               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8024               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8025             esac
8026             AC_MSG_RESULT([$NAFLAGS])
8028             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8029             cat > conftest.asm << EOF
8030             [%line __oline__ "configure"
8031                     section .text
8032                     global  _main,main
8033             _main:
8034             main:   xor     eax,eax
8035                     ret
8036             ]
8038             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8039             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8040               AC_MSG_RESULT(yes)
8041             else
8042               echo "configure: failed program was:" >&AC_FD_CC
8043               cat conftest.asm >&AC_FD_CC
8044               rm -rf conftest*
8045               AC_MSG_RESULT(no)
8046               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8047               NASM=""
8048             fi
8050         fi
8052         if test -z "$NASM"; then
8053 cat << _EOS
8054 ****************************************************************************
8055 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8056 To get one please:
8058 _EOS
8059             if test "$build_os" = "cygwin"; then
8060 cat << _EOS
8061 install a pre-compiled binary for Win32
8063 mkdir -p /opt/lo/bin
8064 cd /opt/lo/bin
8065 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8066 chmod +x nasm
8068 or get and install one from http://www.nasm.us/
8070 Then re-run autogen.sh
8072 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8073 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8075 _EOS
8076             else
8077 cat << _EOS
8078 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8080 _EOS
8081             fi
8082             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8083             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8084         fi
8085       ;;
8086     esac
8089 AC_SUBST(NASM)
8090 AC_SUBST(LIBJPEG_CFLAGS)
8091 AC_SUBST(LIBJPEG_LIBS)
8092 AC_SUBST(SYSTEM_LIBJPEG)
8094 dnl ===================================================================
8095 dnl Check for system clucene
8096 dnl ===================================================================
8097 dnl we should rather be using
8098 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8099 dnl but the contribs-lib check seems tricky
8100 AC_MSG_CHECKING([which clucene to use])
8101 if test "$with_system_clucene" = "yes"; then
8102     AC_MSG_RESULT([external])
8103     SYSTEM_CLUCENE=TRUE
8104     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8105     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8106     FilterLibs "${CLUCENE_LIBS}"
8107     CLUCENE_LIBS="${filteredlibs}"
8108     AC_LANG_PUSH([C++])
8109     save_CXXFLAGS=$CXXFLAGS
8110     save_CPPFLAGS=$CPPFLAGS
8111     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8112     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8113     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8114     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8115     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8116                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8117     CXXFLAGS=$save_CXXFLAGS
8118     CPPFLAGS=$save_CPPFLAGS
8119     AC_LANG_POP([C++])
8121     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8122 else
8123     AC_MSG_RESULT([internal])
8124     SYSTEM_CLUCENE=
8125     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8127 AC_SUBST(SYSTEM_CLUCENE)
8128 AC_SUBST(CLUCENE_CFLAGS)
8129 AC_SUBST(CLUCENE_LIBS)
8131 dnl ===================================================================
8132 dnl Check for system expat
8133 dnl ===================================================================
8134 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8136 dnl ===================================================================
8137 dnl Check for system xmlsec
8138 dnl ===================================================================
8139 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
8141 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8142 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8143     ENABLE_EOT="TRUE"
8144     AC_DEFINE([ENABLE_EOT])
8145     AC_MSG_RESULT([yes])
8147     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8148 else
8149     ENABLE_EOT=
8150     AC_MSG_RESULT([no])
8152 AC_SUBST([ENABLE_EOT])
8154 dnl ===================================================================
8155 dnl Check for DLP libs
8156 dnl ===================================================================
8157 AS_IF([test "$COM" = "MSC"],
8158       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8159       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8161 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8163 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8165 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8167 AS_IF([test "$COM" = "MSC"],
8168       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8169       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8171 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8173 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8175 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8176 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8178 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8180 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8182 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8184 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8185 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8187 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8188 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8190 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8192 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8193 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8195 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8197 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8199 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8201 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8203 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8204 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8206 dnl ===================================================================
8207 dnl Check for system lcms2
8208 dnl ===================================================================
8209 if test "$with_system_lcms2" != "yes"; then
8210     SYSTEM_LCMS2=
8212 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8213 if test "$GCC" = "yes"; then
8214     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8216 if test "$COM" = "MSC"; then # override the above
8217     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8220 dnl ===================================================================
8221 dnl Check for system cppunit
8222 dnl ===================================================================
8223 if test "$_os" != "Android" ; then
8224     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8227 dnl ===================================================================
8228 dnl Check whether freetype is available
8229 dnl ===================================================================
8230 if test  "$test_freetype" = "yes"; then
8231     AC_MSG_CHECKING([whether freetype is available])
8232     # FreeType has 3 different kinds of versions
8233     # * release, like 2.4.10
8234     # * libtool, like 13.0.7 (this what pkg-config returns)
8235     # * soname
8236     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8237     #
8238     # 9.9.3 is 2.2.0
8239     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8240     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8241     FilterLibs "${FREETYPE_LIBS}"
8242     FREETYPE_LIBS="${filteredlibs}"
8243     SYSTEM_FREETYPE=TRUE
8244 else
8245     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8246     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8248 AC_SUBST(FREETYPE_CFLAGS)
8249 AC_SUBST(FREETYPE_LIBS)
8250 AC_SUBST([SYSTEM_FREETYPE])
8252 # ===================================================================
8253 # Check for system libxslt
8254 # to prevent incompatibilities between internal libxml2 and external libxslt,
8255 # or vice versa, use with_system_libxml here
8256 # ===================================================================
8257 if test "$with_system_libxml" = "auto"; then
8258     case "$_os" in
8259     WINNT|iOS|Android)
8260         with_system_libxml="$with_system_libs"
8261         ;;
8262     *)
8263         if test "$enable_fuzzers" != "yes"; then
8264             with_system_libxml=yes
8265         else
8266             with_system_libxml=no
8267         fi
8268         ;;
8269     esac
8272 AC_MSG_CHECKING([which libxslt to use])
8273 if test "$with_system_libxml" = "yes"; then
8274     AC_MSG_RESULT([external])
8275     SYSTEM_LIBXSLT=TRUE
8276     if test "$_os" = "Darwin"; then
8277         dnl make sure to use SDK path
8278         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8279         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8280         dnl omit -L/usr/lib
8281         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8282         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8283     else
8284         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8285         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8286         FilterLibs "${LIBXSLT_LIBS}"
8287         LIBXSLT_LIBS="${filteredlibs}"
8288         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8289         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8290         FilterLibs "${LIBEXSLT_LIBS}"
8291         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8292     fi
8294     dnl Check for xsltproc
8295     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8296     if test "$XSLTPROC" = "no"; then
8297         AC_MSG_ERROR([xsltproc is required])
8298     fi
8299 else
8300     AC_MSG_RESULT([internal])
8301     SYSTEM_LIBXSLT=
8302     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8304     if test "$cross_compiling" = "yes"; then
8305         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8306         if test "$XSLTPROC" = "no"; then
8307             AC_MSG_ERROR([xsltproc is required])
8308         fi
8309     fi
8311 AC_SUBST(SYSTEM_LIBXSLT)
8312 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8313     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8315 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8317 AC_SUBST(LIBEXSLT_CFLAGS)
8318 AC_SUBST(LIBEXSLT_LIBS)
8319 AC_SUBST(LIBXSLT_CFLAGS)
8320 AC_SUBST(LIBXSLT_LIBS)
8321 AC_SUBST(XSLTPROC)
8323 # ===================================================================
8324 # Check for system libxml
8325 # ===================================================================
8326 AC_MSG_CHECKING([which libxml to use])
8327 if test "$with_system_libxml" = "yes"; then
8328     AC_MSG_RESULT([external])
8329     SYSTEM_LIBXML=TRUE
8330     if test "$_os" = "Darwin"; then
8331         dnl make sure to use SDK path
8332         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8333         dnl omit -L/usr/lib
8334         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8335     elif test $_os = iOS; then
8336         dnl make sure to use SDK path
8337         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8338         LIBXML_CFLAGS="-I$usr/include/libxml2"
8339         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8340     else
8341         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8342         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8343         FilterLibs "${LIBXML_LIBS}"
8344         LIBXML_LIBS="${filteredlibs}"
8345     fi
8347     dnl Check for xmllint
8348     AC_PATH_PROG(XMLLINT, xmllint, no)
8349     if test "$XMLLINT" = "no"; then
8350         AC_MSG_ERROR([xmllint is required])
8351     fi
8352 else
8353     AC_MSG_RESULT([internal])
8354     SYSTEM_LIBXML=
8355     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8356     if test "$COM" = "MSC"; then
8357         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8358     fi
8359     if test "$COM" = "MSC"; then
8360         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8361     else
8362         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8363     fi
8364     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8366 AC_SUBST(SYSTEM_LIBXML)
8367 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8368     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8370 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8371 AC_SUBST(LIBXML_CFLAGS)
8372 AC_SUBST(LIBXML_LIBS)
8373 AC_SUBST(XMLLINT)
8375 # =====================================================================
8376 # Checking for a Python interpreter with version >= 2.7.
8377 # Build and runtime requires Python 3 compatible version (>= 2.7).
8378 # Optionally user can pass an option to configure, i. e.
8379 # ./configure PYTHON=/usr/bin/python
8380 # =====================================================================
8381 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8382     # This allows a lack of system python with no error, we use internal one in that case.
8383     AM_PATH_PYTHON([2.7],, [:])
8384     # Clean PYTHON_VERSION checked below if cross-compiling
8385     PYTHON_VERSION=""
8386     if test "$PYTHON" != ":"; then
8387         PYTHON_FOR_BUILD=$PYTHON
8388     fi
8390 AC_SUBST(PYTHON_FOR_BUILD)
8392 # Checks for Python to use for Pyuno
8393 AC_MSG_CHECKING([which Python to use for Pyuno])
8394 case "$enable_python" in
8395 no|disable)
8396     if test -z $PYTHON_FOR_BUILD; then
8397         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8398         # requirement from the choice whether to include Python stuff in the installer, but why
8399         # bother?
8400         AC_MSG_ERROR([Python is required at build time.])
8401     fi
8402     enable_python=no
8403     AC_MSG_RESULT([none])
8404     ;;
8405 ""|yes|auto)
8406     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8407         AC_MSG_RESULT([no, overridden by --disable-scripting])
8408         enable_python=no
8409     elif test $build_os = cygwin; then
8410         dnl When building on Windows we don't attempt to use any installed
8411         dnl "system"  Python.
8412         AC_MSG_RESULT([fully internal])
8413         enable_python=internal
8414     elif test "$cross_compiling" = yes; then
8415         AC_MSG_RESULT([system])
8416         enable_python=system
8417     else
8418         # Unset variables set by the above AM_PATH_PYTHON so that
8419         # we actually do check anew.
8420         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
8421         AM_PATH_PYTHON([3.3],, [:])
8422         if test "$PYTHON" = ":"; then
8423             if test -z "$PYTHON_FOR_BUILD"; then
8424                 AC_MSG_RESULT([fully internal])
8425             else
8426                 AC_MSG_RESULT([internal])
8427             fi
8428             enable_python=internal
8429         else
8430             AC_MSG_RESULT([system])
8431             enable_python=system
8432         fi
8433     fi
8434     ;;
8435 internal)
8436     AC_MSG_RESULT([internal])
8437     ;;
8438 fully-internal)
8439     AC_MSG_RESULT([fully internal])
8440     enable_python=internal
8441     ;;
8442 system)
8443     AC_MSG_RESULT([system])
8444     if test "$_os" = Darwin; then
8445         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])
8446     fi
8447     ;;
8449     AC_MSG_ERROR([Incorrect --enable-python option])
8450     ;;
8451 esac
8453 if test $enable_python != no; then
8454     BUILD_TYPE="$BUILD_TYPE PYUNO"
8457 if test $enable_python = system; then
8458     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8459         # Fallback: Accept these in the environment, or as set above
8460         # for MacOSX.
8461         :
8462     elif test "$cross_compiling" != yes; then
8463         # Unset variables set by the above AM_PATH_PYTHON so that
8464         # we actually do check anew.
8465         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
8466         # This causes an error if no python command is found
8467         AM_PATH_PYTHON([3.3])
8468         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8469         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8470         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8471         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8472         if test -z "$PKG_CONFIG"; then
8473             PYTHON_CFLAGS="-I$python_include"
8474             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8475         elif $PKG_CONFIG --exists python-$python_version; then
8476             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8477             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8478         else
8479             PYTHON_CFLAGS="-I$python_include"
8480             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8481         fi
8482         FilterLibs "${PYTHON_LIBS}"
8483         PYTHON_LIBS="${filteredlibs}"
8484     else
8485         dnl How to find out the cross-compilation Python installation path?
8486         AC_MSG_CHECKING([for python version])
8487         AS_IF([test -n "$PYTHON_VERSION"],
8488               [AC_MSG_RESULT([$PYTHON_VERSION])],
8489               [AC_MSG_RESULT([not found])
8490                AC_MSG_ERROR([no usable python found])])
8491         test -n "$PYTHON_CFLAGS" && break
8492     fi
8494     dnl Check if the headers really work
8495     save_CPPFLAGS="$CPPFLAGS"
8496     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8497     AC_CHECK_HEADER(Python.h)
8498     CPPFLAGS="$save_CPPFLAGS"
8500     # let the PYTHON_FOR_BUILD match the same python installation that
8501     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8502     # better for PythonTests.
8503     PYTHON_FOR_BUILD=$PYTHON
8506 if test "$with_lxml" != no; then
8507     if test -z "$PYTHON_FOR_BUILD"; then
8508         case $build_os in
8509             cygwin)
8510                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8511                 ;;
8512             *)
8513                 if test "$cross_compiling" != yes ; then
8514                     BUILD_TYPE="$BUILD_TYPE LXML"
8515                 fi
8516                 ;;
8517         esac
8518     else
8519         AC_MSG_CHECKING([for python lxml])
8520         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8521             AC_MSG_RESULT([yes])
8522         else
8523             case $build_os in
8524                 cygwin)
8525                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8526                     ;;
8527                 *)
8528                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8529                         BUILD_TYPE="$BUILD_TYPE LXML"
8530                         AC_MSG_RESULT([no, using internal lxml])
8531                     else
8532                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8533                     fi
8534                     ;;
8535             esac
8536         fi
8537     fi
8540 dnl By now enable_python should be "system", "internal" or "no"
8541 case $enable_python in
8542 system)
8543     SYSTEM_PYTHON=TRUE
8545     if test "x$ac_cv_header_Python_h" != "xyes"; then
8546        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8547     fi
8549     AC_LANG_PUSH(C)
8550     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8551     AC_MSG_CHECKING([for correct python library version])
8552        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8553 #include <Python.h>
8555 int main(int argc, char **argv) {
8556    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8557        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8558    else return 1;
8560        ]])],[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])])
8561     CFLAGS=$save_CFLAGS
8562     AC_LANG_POP(C)
8564     dnl FIXME Check if the Python library can be linked with, too?
8565     ;;
8567 internal)
8568     SYSTEM_PYTHON=
8569     PYTHON_VERSION_MAJOR=3
8570     PYTHON_VERSION_MINOR=5
8571     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8572     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8573         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8574     fi
8575     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8576     BUILD_TYPE="$BUILD_TYPE PYTHON"
8577     # Embedded Python dies without Home set
8578     if test "$HOME" = ""; then
8579         export HOME=""
8580     fi
8581     ;;
8583     DISABLE_PYTHON=TRUE
8584     SYSTEM_PYTHON=
8585     ;;
8587     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8588     ;;
8589 esac
8591 AC_SUBST(DISABLE_PYTHON)
8592 AC_SUBST(SYSTEM_PYTHON)
8593 AC_SUBST(PYTHON_CFLAGS)
8594 AC_SUBST(PYTHON_LIBS)
8595 AC_SUBST(PYTHON_VERSION)
8596 AC_SUBST(PYTHON_VERSION_MAJOR)
8597 AC_SUBST(PYTHON_VERSION_MINOR)
8599 ENABLE_MARIADBC=TRUE
8600 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8601     ENABLE_MARIADBC=
8603 MARIADBC_MAJOR=1
8604 MARIADBC_MINOR=0
8605 MARIADBC_MICRO=2
8606 if test "$ENABLE_MARIADBC" = "TRUE"; then
8607     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8610 AC_SUBST(ENABLE_MARIADBC)
8611 AC_SUBST(MARIADBC_MAJOR)
8612 AC_SUBST(MARIADBC_MINOR)
8613 AC_SUBST(MARIADBC_MICRO)
8615 if test "$ENABLE_MARIADBC" = "TRUE"; then
8616     dnl ===================================================================
8617     dnl Check for system MariaDB
8618     dnl ===================================================================
8619     AC_MSG_CHECKING([which MariaDB to use])
8620     if test "$with_system_mariadb" = "yes"; then
8621         AC_MSG_RESULT([external])
8622         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8623         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8624         if test -z "$MARIADBCONFIG"; then
8625             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8626             if test -z "$MARIADBCONFIG"; then
8627                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8628                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8629             fi
8630         fi
8631         AC_MSG_CHECKING([MariaDB version])
8632         MARIADB_VERSION=`$MARIADBCONFIG --version`
8633         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8634         if test "$MARIADB_MAJOR" -ge "5"; then
8635             AC_MSG_RESULT([OK])
8636         else
8637             AC_MSG_ERROR([too old, use 5.0.x or later])
8638         fi
8639         AC_MSG_CHECKING([for MariaDB Client library])
8640         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8641         if test "$COM_IS_CLANG" = TRUE; then
8642             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8643         fi
8644         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8645         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8646         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8647         dnl linux32:
8648         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8649             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8650             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8651                 | sed -e 's|/lib64/|/lib/|')
8652         fi
8653         FilterLibs "${MARIADB_LIBS}"
8654         MARIADB_LIBS="${filteredlibs}"
8655         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8656         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8657         if test "$enable_bundle_mariadb" = "yes"; then
8658             AC_MSG_RESULT([yes])
8659             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8660             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8662 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8664 /g' | grep -E '(mysqlclient|mariadb)')
8665             if test "$_os" = "Darwin"; then
8666                 LIBMARIADB=${LIBMARIADB}.dylib
8667             elif test "$_os" = "WINNT"; then
8668                 LIBMARIADB=${LIBMARIADB}.dll
8669             else
8670                 LIBMARIADB=${LIBMARIADB}.so
8671             fi
8672             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8673             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8674             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8675                 AC_MSG_RESULT([found.])
8676                 PathFormat "$LIBMARIADB_PATH"
8677                 LIBMARIADB_PATH="$formatted_path"
8678             else
8679                 AC_MSG_ERROR([not found.])
8680             fi
8681         else
8682             AC_MSG_RESULT([no])
8683             BUNDLE_MARIADB_CONNECTOR_C=
8684         fi
8685     else
8686         AC_MSG_RESULT([internal])
8687         SYSTEM_MARIADB_CONNECTOR_C=
8688         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8689         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8690         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8691     fi
8693     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8694     AC_SUBST(MARIADB_CFLAGS)
8695     AC_SUBST(MARIADB_LIBS)
8696     AC_SUBST(LIBMARIADB)
8697     AC_SUBST(LIBMARIADB_PATH)
8698     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8701 dnl ===================================================================
8702 dnl Check for system hsqldb
8703 dnl ===================================================================
8704 if test "$with_java" != "no"; then
8705     HSQLDB_USE_JDBC_4_1=
8706     AC_MSG_CHECKING([which hsqldb to use])
8707     if test "$with_system_hsqldb" = "yes"; then
8708         AC_MSG_RESULT([external])
8709         SYSTEM_HSQLDB=TRUE
8710         if test -z $HSQLDB_JAR; then
8711             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8712         fi
8713         if ! test -f $HSQLDB_JAR; then
8714                AC_MSG_ERROR(hsqldb.jar not found.)
8715         fi
8716         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8717         export HSQLDB_JAR
8718         if $PERL -e \
8719            'use Archive::Zip;
8720             my $file = "$ENV{'HSQLDB_JAR'}";
8721             my $zip = Archive::Zip->new( $file );
8722             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8723             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8724             {
8725                 push @l, split(/\n/, $mf);
8726                 foreach my $line (@l)
8727                 {
8728                     if ($line =~ m/Specification-Version:/)
8729                     {
8730                         ($t, $version) = split (/:/,$line);
8731                         $version =~ s/^\s//;
8732                         ($a, $b, $c, $d) = split (/\./,$version);
8733                         if ($c == "0" && $d > "8")
8734                         {
8735                             exit 0;
8736                         }
8737                         else
8738                         {
8739                             exit 1;
8740                         }
8741                     }
8742                 }
8743             }
8744             else
8745             {
8746                 exit 1;
8747             }'; then
8748             AC_MSG_RESULT([yes])
8749         else
8750             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8751         fi
8752     else
8753         AC_MSG_RESULT([internal])
8754         SYSTEM_HSQLDB=
8755         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8756         NEED_ANT=TRUE
8757         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8758         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8759         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8760             AC_MSG_RESULT([yes])
8761             HSQLDB_USE_JDBC_4_1=TRUE
8762         else
8763             AC_MSG_RESULT([no])
8764         fi
8765     fi
8766     AC_SUBST(SYSTEM_HSQLDB)
8767     AC_SUBST(HSQLDB_JAR)
8768     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8771 dnl ===================================================================
8772 dnl Check for PostgreSQL stuff
8773 dnl ===================================================================
8774 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8775 if test "x$enable_postgresql_sdbc" != "xno"; then
8776     AC_MSG_RESULT([yes])
8777     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8779     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8780         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8781     fi
8782     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8783         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8784     fi
8786     postgres_interface=""
8787     if test "$with_system_postgresql" = "yes"; then
8788         postgres_interface="external PostgreSQL"
8789         SYSTEM_POSTGRESQL=TRUE
8790         if test "$_os" = Darwin; then
8791             supp_path=''
8792             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8793                 pg_supp_path="$P_SEP$d$pg_supp_path"
8794             done
8795         fi
8796         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8797         if test -n "$PGCONFIG"; then
8798             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8799             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8800         else
8801             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
8802               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
8803               POSTGRESQL_LIB=$POSTGRESQL_LIBS
8804             ],[
8805               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
8806             ])
8807         fi
8808         FilterLibs "${POSTGRESQL_LIB}"
8809         POSTGRESQL_LIB="${filteredlibs}"
8810     else
8811         # if/when anything else than PostgreSQL uses Kerberos,
8812         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8813         WITH_KRB5=
8814         WITH_GSSAPI=
8815         case "$_os" in
8816         Darwin)
8817             # macOS has system MIT Kerberos 5 since 10.4
8818             if test "$with_krb5" != "no"; then
8819                 WITH_KRB5=TRUE
8820                 save_LIBS=$LIBS
8821                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8822                 # that the libraries where these functions are located on macOS will change, is it?
8823                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8824                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8825                 KRB5_LIBS=$LIBS
8826                 LIBS=$save_LIBS
8827                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8828                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8829                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8830                 LIBS=$save_LIBS
8831             fi
8832             if test "$with_gssapi" != "no"; then
8833                 WITH_GSSAPI=TRUE
8834                 save_LIBS=$LIBS
8835                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8836                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8837                 GSSAPI_LIBS=$LIBS
8838                 LIBS=$save_LIBS
8839             fi
8840             ;;
8841         WINNT)
8842             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8843                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8844             fi
8845             ;;
8846         Linux|GNU|*BSD|DragonFly)
8847             if test "$with_krb5" != "no"; then
8848                 WITH_KRB5=TRUE
8849                 save_LIBS=$LIBS
8850                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8851                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8852                 KRB5_LIBS=$LIBS
8853                 LIBS=$save_LIBS
8854                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8855                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8856                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8857                 LIBS=$save_LIBS
8858             fi
8859             if test "$with_gssapi" != "no"; then
8860                 WITH_GSSAPI=TRUE
8861                 save_LIBS=$LIBS
8862                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8863                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8864                 GSSAPI_LIBS=$LIBS
8865                 LIBS=$save_LIBS
8866             fi
8867             ;;
8868         *)
8869             if test "$with_krb5" = "yes"; then
8870                 WITH_KRB5=TRUE
8871                 save_LIBS=$LIBS
8872                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8873                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8874                 KRB5_LIBS=$LIBS
8875                 LIBS=$save_LIBS
8876                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8877                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8878                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8879                 LIBS=$save_LIBS
8880             fi
8881             if test "$with_gssapi" = "yes"; then
8882                 WITH_GSSAPI=TRUE
8883                 save_LIBS=$LIBS
8884                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8885                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8886                 LIBS=$save_LIBS
8887                 GSSAPI_LIBS=$LIBS
8888             fi
8889         esac
8891         if test -n "$with_libpq_path"; then
8892             SYSTEM_POSTGRESQL=TRUE
8893             postgres_interface="external libpq"
8894             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8895             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8896         else
8897             SYSTEM_POSTGRESQL=
8898             postgres_interface="internal"
8899             POSTGRESQL_LIB=""
8900             POSTGRESQL_INC="%OVERRIDE_ME%"
8901             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8902         fi
8903     fi
8905     AC_MSG_CHECKING([PostgreSQL C interface])
8906     AC_MSG_RESULT([$postgres_interface])
8908     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8909         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8910         save_CFLAGS=$CFLAGS
8911         save_CPPFLAGS=$CPPFLAGS
8912         save_LIBS=$LIBS
8913         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8914         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8915         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8916         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8917             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8918         CFLAGS=$save_CFLAGS
8919         CPPFLAGS=$save_CPPFLAGS
8920         LIBS=$save_LIBS
8921     fi
8922     BUILD_POSTGRESQL_SDBC=TRUE
8923 else
8924     AC_MSG_RESULT([no])
8926 AC_SUBST(WITH_KRB5)
8927 AC_SUBST(WITH_GSSAPI)
8928 AC_SUBST(GSSAPI_LIBS)
8929 AC_SUBST(KRB5_LIBS)
8930 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8931 AC_SUBST(SYSTEM_POSTGRESQL)
8932 AC_SUBST(POSTGRESQL_INC)
8933 AC_SUBST(POSTGRESQL_LIB)
8935 dnl ===================================================================
8936 dnl Check for Firebird stuff
8937 dnl ===================================================================
8938 ENABLE_FIREBIRD_SDBC=
8939 if test "$enable_firebird_sdbc" = "yes" ; then
8940     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8942     dnl ===================================================================
8943     dnl Check for system Firebird
8944     dnl ===================================================================
8945     AC_MSG_CHECKING([which Firebird to use])
8946     if test "$with_system_firebird" = "yes"; then
8947         AC_MSG_RESULT([external])
8948         SYSTEM_FIREBIRD=TRUE
8949         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8950         if test -z "$FIREBIRDCONFIG"; then
8951             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8952             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8953                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8954             ])
8955             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8956         else
8957             AC_MSG_NOTICE([fb_config found])
8958             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8959             AC_MSG_CHECKING([for Firebird Client library])
8960             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8961             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8962             FilterLibs "${FIREBIRD_LIBS}"
8963             FIREBIRD_LIBS="${filteredlibs}"
8964         fi
8965         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8966         AC_MSG_CHECKING([Firebird version])
8967         if test -n "${FIREBIRD_VERSION}"; then
8968             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8969             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8970             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8971                 AC_MSG_RESULT([OK])
8972             else
8973                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8974             fi
8975         else
8976             __save_CFLAGS="${CFLAGS}"
8977             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8978             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8979 #if defined(FB_API_VER) && FB_API_VER == 30
8980 int fb_api_is_30(void) { return 0; }
8981 #else
8982 #error "Wrong Firebird API version"
8983 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8984             CFLAGS="${__save_CFLAGS}"
8985         fi
8986         ENABLE_FIREBIRD_SDBC=TRUE
8987         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8988     elif test "$enable_database_connectivity" != yes; then
8989         AC_MSG_RESULT([none])
8990     elif test "$cross_compiling" = "yes"; then
8991         AC_MSG_RESULT([none])
8992     else
8993         dnl Embedded Firebird has version 3.0
8994         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8995         dnl We need libatomic_ops for any non X86/X64 system
8996         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8997             dnl ===================================================================
8998             dnl Check for system libatomic_ops
8999             dnl ===================================================================
9000             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9001             if test "$with_system_libatomic_ops" = "yes"; then
9002                 SYSTEM_LIBATOMIC_OPS=TRUE
9003                 AC_CHECK_HEADERS(atomic_ops.h, [],
9004                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9005             else
9006                 SYSTEM_LIBATOMIC_OPS=
9007                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9008                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9009                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9010             fi
9011         fi
9013         AC_MSG_RESULT([internal])
9014         SYSTEM_FIREBIRD=
9015         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9016         FIREBIRD_LIBS="-lfbclient"
9018         if test "$with_system_libtommath" = "yes"; then
9019             SYSTEM_LIBTOMMATH=TRUE
9020             dnl check for tommath presence
9021             save_LIBS=$LIBS
9022             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9023             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9024             LIBS=$save_LIBS
9025         else
9026             SYSTEM_LIBTOMMATH=
9027             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9028             LIBTOMMATH_LIBS="-ltommath"
9029             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9030         fi
9032         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9033         ENABLE_FIREBIRD_SDBC=TRUE
9034         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9035     fi
9037 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9038 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9039 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9040 AC_SUBST(LIBATOMIC_OPS_LIBS)
9041 AC_SUBST(SYSTEM_FIREBIRD)
9042 AC_SUBST(FIREBIRD_CFLAGS)
9043 AC_SUBST(FIREBIRD_LIBS)
9044 AC_SUBST([TOMMATH_CFLAGS])
9045 AC_SUBST([TOMMATH_LIBS])
9047 dnl ===================================================================
9048 dnl Check for system curl
9049 dnl ===================================================================
9050 AC_MSG_CHECKING([which libcurl to use])
9051 if test "$with_system_curl" = "auto"; then
9052     with_system_curl="$with_system_libs"
9055 if test "$with_system_curl" = "yes"; then
9056     AC_MSG_RESULT([external])
9057     SYSTEM_CURL=TRUE
9059     # First try PKGCONFIG and then fall back
9060     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9062     if test -n "$CURL_PKG_ERRORS"; then
9063         AC_PATH_PROG(CURLCONFIG, curl-config)
9064         if test -z "$CURLCONFIG"; then
9065             AC_MSG_ERROR([curl development files not found])
9066         fi
9067         CURL_LIBS=`$CURLCONFIG --libs`
9068         FilterLibs "${CURL_LIBS}"
9069         CURL_LIBS="${filteredlibs}"
9070         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9071         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9073         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9074         case $curl_version in
9075         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9076         dnl so they need to be doubled to end up in the configure script
9077         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9078             AC_MSG_RESULT([yes])
9079             ;;
9080         *)
9081             AC_MSG_ERROR([no, you have $curl_version])
9082             ;;
9083         esac
9084     fi
9086     ENABLE_CURL=TRUE
9087 elif test $_os = iOS; then
9088     # Let's see if we need curl, I think not?
9089     AC_MSG_RESULT([none])
9090     ENABLE_CURL=
9091 else
9092     AC_MSG_RESULT([internal])
9093     SYSTEM_CURL=
9094     BUILD_TYPE="$BUILD_TYPE CURL"
9095     ENABLE_CURL=TRUE
9097 AC_SUBST(SYSTEM_CURL)
9098 AC_SUBST(CURL_CFLAGS)
9099 AC_SUBST(CURL_LIBS)
9100 AC_SUBST(ENABLE_CURL)
9102 dnl ===================================================================
9103 dnl Check for system boost
9104 dnl ===================================================================
9105 AC_MSG_CHECKING([which boost to use])
9106 if test "$with_system_boost" = "yes"; then
9107     AC_MSG_RESULT([external])
9108     SYSTEM_BOOST=TRUE
9109     AX_BOOST_BASE(1.47)
9110     AX_BOOST_DATE_TIME
9111     AX_BOOST_FILESYSTEM
9112     AX_BOOST_IOSTREAMS
9113     AX_BOOST_LOCALE
9114     AC_LANG_PUSH([C++])
9115     save_CXXFLAGS=$CXXFLAGS
9116     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9117     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9118        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9119     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9120        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9121     CXXFLAGS=$save_CXXFLAGS
9122     AC_LANG_POP([C++])
9123     # this is in m4/ax_boost_base.m4
9124     FilterLibs "${BOOST_LDFLAGS}"
9125     BOOST_LDFLAGS="${filteredlibs}"
9126 else
9127     AC_MSG_RESULT([internal])
9128     BUILD_TYPE="$BUILD_TYPE BOOST"
9129     SYSTEM_BOOST=
9130     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9131         # use warning-suppressing wrapper headers
9132         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9133     else
9134         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9135     fi
9137 AC_SUBST(SYSTEM_BOOST)
9139 dnl ===================================================================
9140 dnl Check for system mdds
9141 dnl ===================================================================
9142 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9144 dnl ===================================================================
9145 dnl Check for system glm
9146 dnl ===================================================================
9147 AC_MSG_CHECKING([which glm to use])
9148 if test "$with_system_glm" = "yes"; then
9149     AC_MSG_RESULT([external])
9150     SYSTEM_GLM=TRUE
9151     AC_LANG_PUSH([C++])
9152     AC_CHECK_HEADER([glm/glm.hpp], [],
9153        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9154     AC_LANG_POP([C++])
9155 else
9156     AC_MSG_RESULT([internal])
9157     BUILD_TYPE="$BUILD_TYPE GLM"
9158     SYSTEM_GLM=
9159     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9161 AC_SUBST([GLM_CFLAGS])
9162 AC_SUBST([SYSTEM_GLM])
9164 dnl ===================================================================
9165 dnl Check for system odbc
9166 dnl ===================================================================
9167 AC_MSG_CHECKING([which odbc headers to use])
9168 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
9169     AC_MSG_RESULT([external])
9170     SYSTEM_ODBC_HEADERS=TRUE
9172     if test "$build_os" = "cygwin"; then
9173         save_CPPFLAGS=$CPPFLAGS
9174         find_winsdk
9175         PathFormat "$winsdktest"
9176         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"
9177         AC_CHECK_HEADER(sqlext.h, [],
9178             [AC_MSG_ERROR(odbc not found. install odbc)],
9179             [#include <windows.h>])
9180         CPPFLAGS=$save_CPPFLAGS
9181     else
9182         AC_CHECK_HEADER(sqlext.h, [],
9183             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9184     fi
9185 elif test "$enable_database_connectivity" != yes; then
9186     AC_MSG_RESULT([none])
9187 else
9188     AC_MSG_RESULT([internal])
9189     SYSTEM_ODBC_HEADERS=
9191 AC_SUBST(SYSTEM_ODBC_HEADERS)
9193 dnl ===================================================================
9194 dnl Enable LDAP support
9195 dnl ===================================================================
9197 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9198 AC_MSG_CHECKING([whether to enable LDAP support])
9199     if test "$enable_ldap" != "yes"; then
9200         AC_MSG_RESULT([no])
9201         ENABLE_LDAP=""
9202         enable_ldap=no
9203     else
9204         AC_MSG_RESULT([yes])
9205         ENABLE_LDAP="TRUE"
9206         AC_DEFINE(HAVE_FEATURE_LDAP)
9207     fi
9209 AC_SUBST(ENABLE_LDAP)
9211 dnl ===================================================================
9212 dnl Check for system openldap
9213 dnl ===================================================================
9215 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9216 AC_MSG_CHECKING([which openldap library to use])
9217 if test "$with_system_openldap" = "yes"; then
9218     AC_MSG_RESULT([external])
9219     SYSTEM_OPENLDAP=TRUE
9220     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9221     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9222     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9223 else
9224     AC_MSG_RESULT([internal])
9225     SYSTEM_OPENLDAP=
9226     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9229 AC_SUBST(SYSTEM_OPENLDAP)
9231 dnl ===================================================================
9232 dnl Check for system NSS
9233 dnl ===================================================================
9234 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9235     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9236     AC_DEFINE(HAVE_FEATURE_NSS)
9237     ENABLE_NSS="TRUE"
9238     AC_DEFINE(ENABLE_NSS)
9239 elif test $_os != iOS ; then
9240     with_tls=openssl
9242 AC_SUBST(ENABLE_NSS)
9244 dnl ===================================================================
9245 dnl Check for TLS/SSL and cryptographic implementation to use
9246 dnl ===================================================================
9247 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9248 if test -n "$with_tls"; then
9249     case $with_tls in
9250     openssl)
9251         AC_DEFINE(USE_TLS_OPENSSL)
9252         TLS=OPENSSL
9254         if test "$enable_openssl" != "yes"; then
9255             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9256         fi
9258         # warn that OpenSSL has been selected but not all TLS code has this option
9259         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9260         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9261         ;;
9262     nss)
9263         AC_DEFINE(USE_TLS_NSS)
9264         TLS=NSS
9265         ;;
9266     no)
9267         AC_MSG_WARN([Skipping TLS/SSL])
9268         ;;
9269     *)
9270         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9271 openssl - OpenSSL
9272 nss - Mozilla's Network Security Services (NSS)
9273     ])
9274         ;;
9275     esac
9276 else
9277     # default to using NSS, it results in smaller oox lib
9278     AC_DEFINE(USE_TLS_NSS)
9279     TLS=NSS
9281 AC_MSG_RESULT([$TLS])
9282 AC_SUBST(TLS)
9284 dnl ===================================================================
9285 dnl Check for system sane
9286 dnl ===================================================================
9287 AC_MSG_CHECKING([which sane header to use])
9288 if test "$with_system_sane" = "yes"; then
9289     AC_MSG_RESULT([external])
9290     AC_CHECK_HEADER(sane/sane.h, [],
9291       [AC_MSG_ERROR(sane not found. install sane)], [])
9292 else
9293     AC_MSG_RESULT([internal])
9294     BUILD_TYPE="$BUILD_TYPE SANE"
9297 dnl ===================================================================
9298 dnl Check for system icu
9299 dnl ===================================================================
9300 SYSTEM_GENBRK=
9301 SYSTEM_GENCCODE=
9302 SYSTEM_GENCMN=
9304 ICU_MAJOR=63
9305 ICU_MINOR=1
9306 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9307 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9308 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9309 AC_MSG_CHECKING([which icu to use])
9310 if test "$with_system_icu" = "yes"; then
9311     AC_MSG_RESULT([external])
9312     SYSTEM_ICU=TRUE
9313     AC_LANG_PUSH([C++])
9314     AC_MSG_CHECKING([for unicode/rbbi.h])
9315     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9316     AC_LANG_POP([C++])
9318     if test "$cross_compiling" != "yes"; then
9319         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9320         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9321         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9322         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9323     fi
9325     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9326         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9327         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9328         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9329         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9330         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9331             AC_MSG_RESULT([yes])
9332         else
9333             AC_MSG_RESULT([no])
9334             if test "$with_system_icu_for_build" != "force"; then
9335                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9336 You can use --with-system-icu-for-build=force to use it anyway.])
9337             fi
9338         fi
9339     fi
9341     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9342         # using the system icu tools can lead to version confusion, use the
9343         # ones from the build environment when cross-compiling
9344         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9345         if test -z "$SYSTEM_GENBRK"; then
9346             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9347         fi
9348         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9349         if test -z "$SYSTEM_GENCCODE"; then
9350             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9351         fi
9352         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9353         if test -z "$SYSTEM_GENCMN"; then
9354             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9355         fi
9356         if test "$ICU_MAJOR" -ge "49"; then
9357             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9358             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9359             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9360         else
9361             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9362             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9363             ICU_RECLASSIFIED_HEBREW_LETTER=
9364         fi
9365     fi
9367     if test "$cross_compiling" = "yes"; then
9368         if test "$ICU_MAJOR" -ge "50"; then
9369             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9370             ICU_MINOR=""
9371         fi
9372     fi
9373 else
9374     AC_MSG_RESULT([internal])
9375     SYSTEM_ICU=
9376     BUILD_TYPE="$BUILD_TYPE ICU"
9377     # surprisingly set these only for "internal" (to be used by various other
9378     # external libs): the system icu-config is quite unhelpful and spits out
9379     # dozens of weird flags and also default path -I/usr/include
9380     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9381     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9383 if test "$ICU_MAJOR" -ge "59"; then
9384     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9385     # with -std=c++11 but not all external libraries can be built with that,
9386     # for those use a bit-compatible typedef uint16_t UChar; see
9387     # icu/source/common/unicode/umachine.h
9388     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9389 else
9390     ICU_UCHAR_TYPE=""
9392 AC_SUBST(SYSTEM_ICU)
9393 AC_SUBST(SYSTEM_GENBRK)
9394 AC_SUBST(SYSTEM_GENCCODE)
9395 AC_SUBST(SYSTEM_GENCMN)
9396 AC_SUBST(ICU_MAJOR)
9397 AC_SUBST(ICU_MINOR)
9398 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9399 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9400 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9401 AC_SUBST(ICU_CFLAGS)
9402 AC_SUBST(ICU_LIBS)
9403 AC_SUBST(ICU_UCHAR_TYPE)
9405 dnl ==================================================================
9406 dnl Breakpad
9407 dnl ==================================================================
9408 AC_MSG_CHECKING([whether to enable breakpad])
9409 if test "$enable_breakpad" != yes; then
9410     AC_MSG_RESULT([no])
9411 else
9412     AC_MSG_RESULT([yes])
9413     ENABLE_BREAKPAD="TRUE"
9414     AC_DEFINE(ENABLE_BREAKPAD)
9415     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9416     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9418     AC_MSG_CHECKING([for crashreport config])
9419     if test "$with_symbol_config" = "no"; then
9420         BREAKPAD_SYMBOL_CONFIG="invalid"
9421         AC_MSG_RESULT([no])
9422     else
9423         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9424         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9425         AC_MSG_RESULT([yes])
9426     fi
9427     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9429 AC_SUBST(ENABLE_BREAKPAD)
9431 dnl ==================================================================
9432 dnl libfuzzer
9433 dnl ==================================================================
9434 AC_MSG_CHECKING([whether to enable fuzzers])
9435 if test "$enable_fuzzers" != yes; then
9436     AC_MSG_RESULT([no])
9437 else
9438     AC_MSG_RESULT([yes])
9439     ENABLE_FUZZERS="TRUE"
9440     AC_DEFINE([ENABLE_FUZZERS],1)
9441     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9443 AC_SUBST(ENABLE_FUZZERS)
9445 dnl ===================================================================
9446 dnl Orcus
9447 dnl ===================================================================
9448 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9449 if test "$with_system_orcus" != "yes"; then
9450     if test "$SYSTEM_BOOST" = "TRUE"; then
9451         # ===========================================================
9452         # Determine if we are going to need to link with Boost.System
9453         # ===========================================================
9454         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9455         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9456         dnl in documentation has no effect.
9457         AC_MSG_CHECKING([if we need to link with Boost.System])
9458         AC_LANG_PUSH([C++])
9459         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9460                 @%:@include <boost/version.hpp>
9461             ]],[[
9462                 #if BOOST_VERSION >= 105000
9463                 #   error yes, we need to link with Boost.System
9464                 #endif
9465             ]])],[
9466                 AC_MSG_RESULT([no])
9467             ],[
9468                 AC_MSG_RESULT([yes])
9469                 AX_BOOST_SYSTEM
9470         ])
9471         AC_LANG_POP([C++])
9472     fi
9474 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9475 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9476 AC_SUBST([BOOST_SYSTEM_LIB])
9477 AC_SUBST(SYSTEM_LIBORCUS)
9479 dnl ===================================================================
9480 dnl HarfBuzz
9481 dnl ===================================================================
9482 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9483                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9484                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9486 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9487                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9488                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9490 if test "$COM" = "MSC"; then # override the above
9491     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9492     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9495 if test "$with_system_harfbuzz" = "yes"; then
9496     if test "$with_system_graphite" = "no"; then
9497         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9498     fi
9499     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9500     _save_libs="$LIBS"
9501     _save_cflags="$CFLAGS"
9502     LIBS="$LIBS $HARFBUZZ_LIBS"
9503     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9504     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9505     LIBS="$_save_libs"
9506     CFLAGS="$_save_cflags"
9507 else
9508     if test "$with_system_graphite" = "yes"; then
9509         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9510     fi
9513 AC_MSG_CHECKING([whether to use X11])
9514 dnl ***************************************
9515 dnl testing for X libraries and includes...
9516 dnl ***************************************
9517 if test "$USING_X11" = TRUE; then
9518     AC_DEFINE(HAVE_FEATURE_X11)
9520 AC_MSG_RESULT([$USING_X11])
9522 if test "$USING_X11" = TRUE; then
9523     AC_PATH_X
9524     AC_PATH_XTRA
9525     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9527     if test -z "$x_includes"; then
9528         x_includes="default_x_includes"
9529     fi
9530     if test -z "$x_libraries"; then
9531         x_libraries="default_x_libraries"
9532     fi
9533     CFLAGS="$CFLAGS $X_CFLAGS"
9534     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9535     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9536 else
9537     x_includes="no_x_includes"
9538     x_libraries="no_x_libraries"
9541 if test "$USING_X11" = TRUE; then
9542     dnl ===================================================================
9543     dnl Check for extension headers
9544     dnl ===================================================================
9545     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9546      [#include <X11/extensions/shape.h>])
9548     # vcl needs ICE and SM
9549     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9550     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9551         [AC_MSG_ERROR(ICE library not found)])
9552     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9553     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9554         [AC_MSG_ERROR(SM library not found)])
9557 dnl ===================================================================
9558 dnl Check for system Xrender
9559 dnl ===================================================================
9560 AC_MSG_CHECKING([whether to use Xrender])
9561 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9562     AC_MSG_RESULT([yes])
9563     PKG_CHECK_MODULES(XRENDER, xrender)
9564     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9565     FilterLibs "${XRENDER_LIBS}"
9566     XRENDER_LIBS="${filteredlibs}"
9567     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9568       [AC_MSG_ERROR(libXrender not found or functional)], [])
9569     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9570       [AC_MSG_ERROR(Xrender not found. install X)], [])
9571 else
9572     AC_MSG_RESULT([no])
9574 AC_SUBST(XRENDER_CFLAGS)
9575 AC_SUBST(XRENDER_LIBS)
9577 dnl ===================================================================
9578 dnl Check for XRandr
9579 dnl ===================================================================
9580 AC_MSG_CHECKING([whether to enable RandR support])
9581 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9582     AC_MSG_RESULT([yes])
9583     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9584     if test "$ENABLE_RANDR" != "TRUE"; then
9585         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9586                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9587         XRANDR_CFLAGS=" "
9588         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9589           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9590         XRANDR_LIBS="-lXrandr "
9591         ENABLE_RANDR="TRUE"
9592     fi
9593     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9594     FilterLibs "${XRANDR_LIBS}"
9595     XRANDR_LIBS="${filteredlibs}"
9596 else
9597     ENABLE_RANDR=""
9598     AC_MSG_RESULT([no])
9600 AC_SUBST(XRANDR_CFLAGS)
9601 AC_SUBST(XRANDR_LIBS)
9602 AC_SUBST(ENABLE_RANDR)
9604 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9605     WITH_WEBDAV="serf"
9607 if test $_os = iOS -o $_os = Android; then
9608     WITH_WEBDAV="no"
9610 AC_MSG_CHECKING([for webdav library])
9611 case "$WITH_WEBDAV" in
9612 serf)
9613     AC_MSG_RESULT([serf])
9614     # Check for system apr-util
9615     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9616                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9617                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9618     if test "$COM" = "MSC"; then
9619         APR_LIB_DIR="LibR"
9620         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9621         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9622     fi
9624     # Check for system serf
9625     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9626                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9627     if test "$COM" = "MSC"; then
9628         SERF_LIB_DIR="Release"
9629         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9630         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9631     fi
9632     ;;
9633 neon)
9634     AC_MSG_RESULT([neon])
9635     # Check for system neon
9636     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9637     if test "$with_system_neon" = "yes"; then
9638         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9639     else
9640         NEON_VERSION=0295
9641     fi
9642     AC_SUBST(NEON_VERSION)
9643     ;;
9645     AC_MSG_RESULT([none, disabled])
9646     WITH_WEBDAV=""
9647     ;;
9648 esac
9649 AC_SUBST(WITH_WEBDAV)
9651 dnl ===================================================================
9652 dnl Check for disabling cve_tests
9653 dnl ===================================================================
9654 AC_MSG_CHECKING([whether to execute CVE tests])
9655 # If not explicitly enabled or disabled, default
9656 if test -z "$enable_cve_tests"; then
9657     case "$OS" in
9658     WNT)
9659         # Default cves off for Windows with its wild and wonderful
9660         # variety of AV software kicking in and panicking
9661         enable_cve_tests=no
9662         ;;
9663     *)
9664         # otherwise yes
9665         enable_cve_tests=yes
9666         ;;
9667     esac
9669 if test "$enable_cve_tests" = "no"; then
9670     AC_MSG_RESULT([no])
9671     DISABLE_CVE_TESTS=TRUE
9672     AC_SUBST(DISABLE_CVE_TESTS)
9673 else
9674     AC_MSG_RESULT([yes])
9677 dnl ===================================================================
9678 dnl Check for enabling chart XShape tests
9679 dnl ===================================================================
9680 AC_MSG_CHECKING([whether to execute chart XShape tests])
9681 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9682     AC_MSG_RESULT([yes])
9683     ENABLE_CHART_TESTS=TRUE
9684     AC_SUBST(ENABLE_CHART_TESTS)
9685 else
9686     AC_MSG_RESULT([no])
9689 dnl ===================================================================
9690 dnl Check for system openssl
9691 dnl ===================================================================
9692 DISABLE_OPENSSL=
9693 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9694 if test "$enable_openssl" = "yes"; then
9695     AC_MSG_RESULT([no])
9696     if test "$_os" = Darwin ; then
9697         # OpenSSL is deprecated when building for 10.7 or later.
9698         #
9699         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9700         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9702         with_system_openssl=no
9703         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9704     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9705             && test "$with_system_openssl" != "no"; then
9706         with_system_openssl=yes
9707         SYSTEM_OPENSSL=TRUE
9708         OPENSSL_CFLAGS=
9709         OPENSSL_LIBS="-lssl -lcrypto"
9710     else
9711         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9712     fi
9713     if test "$with_system_openssl" = "yes"; then
9714         AC_MSG_CHECKING([whether openssl supports SHA512])
9715         AC_LANG_PUSH([C])
9716         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9717             SHA512_CTX context;
9718 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9719         AC_LANG_POP(C)
9720     fi
9721 else
9722     AC_MSG_RESULT([yes])
9723     DISABLE_OPENSSL=TRUE
9725     # warn that although OpenSSL is disabled, system libraries may depend on it
9726     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system libraries may create indirect dependencies])
9727     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system libraries may create indirect dependencies"
9730 AC_SUBST([DISABLE_OPENSSL])
9732 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9733     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9734         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9735         enable_cipher_openssl_backend=no
9736     else
9737         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9738     fi
9740 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9741 ENABLE_CIPHER_OPENSSL_BACKEND=
9742 if test "$enable_cipher_openssl_backend" = yes; then
9743     AC_MSG_RESULT([yes])
9744     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9745 else
9746     AC_MSG_RESULT([no])
9748 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9750 dnl ===================================================================
9751 dnl Check for building gnutls
9752 dnl ===================================================================
9753 AC_MSG_CHECKING([whether to use gnutls])
9754 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9755     AC_MSG_RESULT([yes])
9756     AM_PATH_LIBGCRYPT()
9757     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9758         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9759                       available in the system to use as replacement.]]))
9760     FilterLibs "${LIBGCRYPT_LIBS}"
9761     LIBGCRYPT_LIBS="${filteredlibs}"
9762 else
9763     AC_MSG_RESULT([no])
9766 AC_SUBST([LIBGCRYPT_CFLAGS])
9767 AC_SUBST([LIBGCRYPT_LIBS])
9769 dnl ===================================================================
9770 dnl Check for system redland
9771 dnl ===================================================================
9772 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9773 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9774 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9775 if test "$with_system_redland" = "yes"; then
9776     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9777             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9778 else
9779     RAPTOR_MAJOR="0"
9780     RASQAL_MAJOR="3"
9781     REDLAND_MAJOR="0"
9783 AC_SUBST(RAPTOR_MAJOR)
9784 AC_SUBST(RASQAL_MAJOR)
9785 AC_SUBST(REDLAND_MAJOR)
9787 dnl ===================================================================
9788 dnl Check for system hunspell
9789 dnl ===================================================================
9790 AC_MSG_CHECKING([which libhunspell to use])
9791 if test "$with_system_hunspell" = "yes"; then
9792     AC_MSG_RESULT([external])
9793     SYSTEM_HUNSPELL=TRUE
9794     AC_LANG_PUSH([C++])
9795     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9796     if test "$HUNSPELL_PC" != "TRUE"; then
9797         AC_CHECK_HEADER(hunspell.hxx, [],
9798             [
9799             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9800             [AC_MSG_ERROR(hunspell headers not found.)], [])
9801             ], [])
9802         AC_CHECK_LIB([hunspell], [main], [:],
9803            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9804         HUNSPELL_LIBS=-lhunspell
9805     fi
9806     AC_LANG_POP([C++])
9807     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9808     FilterLibs "${HUNSPELL_LIBS}"
9809     HUNSPELL_LIBS="${filteredlibs}"
9810 else
9811     AC_MSG_RESULT([internal])
9812     SYSTEM_HUNSPELL=
9813     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9814     if test "$COM" = "MSC"; then
9815         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9816     else
9817         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
9818     fi
9819     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9821 AC_SUBST(SYSTEM_HUNSPELL)
9822 AC_SUBST(HUNSPELL_CFLAGS)
9823 AC_SUBST(HUNSPELL_LIBS)
9825 dnl ===================================================================
9826 dnl Checking for altlinuxhyph
9827 dnl ===================================================================
9828 AC_MSG_CHECKING([which altlinuxhyph to use])
9829 if test "$with_system_altlinuxhyph" = "yes"; then
9830     AC_MSG_RESULT([external])
9831     SYSTEM_HYPH=TRUE
9832     AC_CHECK_HEADER(hyphen.h, [],
9833        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9834     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9835        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9836        [#include <hyphen.h>])
9837     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9838         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9839     if test -z "$HYPHEN_LIB"; then
9840         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9841            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9842     fi
9843     if test -z "$HYPHEN_LIB"; then
9844         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9845            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9846     fi
9847 else
9848     AC_MSG_RESULT([internal])
9849     SYSTEM_HYPH=
9850     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9851     if test "$COM" = "MSC"; then
9852         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9853     else
9854         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9855     fi
9857 AC_SUBST(SYSTEM_HYPH)
9858 AC_SUBST(HYPHEN_LIB)
9860 dnl ===================================================================
9861 dnl Checking for mythes
9862 dnl ===================================================================
9863 AC_MSG_CHECKING([which mythes to use])
9864 if test "$with_system_mythes" = "yes"; then
9865     AC_MSG_RESULT([external])
9866     SYSTEM_MYTHES=TRUE
9867     AC_LANG_PUSH([C++])
9868     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9869     if test "$MYTHES_PKGCONFIG" = "no"; then
9870         AC_CHECK_HEADER(mythes.hxx, [],
9871             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9872         AC_CHECK_LIB([mythes-1.2], [main], [:],
9873             [ MYTHES_FOUND=no], [])
9874     if test "$MYTHES_FOUND" = "no"; then
9875         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9876                 [ MYTHES_FOUND=no], [])
9877     fi
9878     if test "$MYTHES_FOUND" = "no"; then
9879         AC_MSG_ERROR([mythes library not found!.])
9880     fi
9881     fi
9882     AC_LANG_POP([C++])
9883     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9884     FilterLibs "${MYTHES_LIBS}"
9885     MYTHES_LIBS="${filteredlibs}"
9886 else
9887     AC_MSG_RESULT([internal])
9888     SYSTEM_MYTHES=
9889     BUILD_TYPE="$BUILD_TYPE MYTHES"
9890     if test "$COM" = "MSC"; then
9891         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9892     else
9893         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9894     fi
9896 AC_SUBST(SYSTEM_MYTHES)
9897 AC_SUBST(MYTHES_CFLAGS)
9898 AC_SUBST(MYTHES_LIBS)
9900 dnl ===================================================================
9901 dnl How should we build the linear programming solver ?
9902 dnl ===================================================================
9904 ENABLE_COINMP=
9905 AC_MSG_CHECKING([whether to build with CoinMP])
9906 if test "$enable_coinmp" != "no"; then
9907     ENABLE_COINMP=TRUE
9908     AC_MSG_RESULT([yes])
9909     if test "$with_system_coinmp" = "yes"; then
9910         SYSTEM_COINMP=TRUE
9911         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9912         FilterLibs "${COINMP_LIBS}"
9913         COINMP_LIBS="${filteredlibs}"
9914     else
9915         BUILD_TYPE="$BUILD_TYPE COINMP"
9916     fi
9917 else
9918     AC_MSG_RESULT([no])
9920 AC_SUBST(ENABLE_COINMP)
9921 AC_SUBST(SYSTEM_COINMP)
9922 AC_SUBST(COINMP_CFLAGS)
9923 AC_SUBST(COINMP_LIBS)
9925 ENABLE_LPSOLVE=
9926 AC_MSG_CHECKING([whether to build with lpsolve])
9927 if test "$enable_lpsolve" != "no"; then
9928     ENABLE_LPSOLVE=TRUE
9929     AC_MSG_RESULT([yes])
9930 else
9931     AC_MSG_RESULT([no])
9933 AC_SUBST(ENABLE_LPSOLVE)
9935 if test "$ENABLE_LPSOLVE" = TRUE; then
9936     AC_MSG_CHECKING([which lpsolve to use])
9937     if test "$with_system_lpsolve" = "yes"; then
9938         AC_MSG_RESULT([external])
9939         SYSTEM_LPSOLVE=TRUE
9940         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9941            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9942         save_LIBS=$LIBS
9943         # some systems need this. Like Ubuntu....
9944         AC_CHECK_LIB(m, floor)
9945         AC_CHECK_LIB(dl, dlopen)
9946         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9947             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9948         LIBS=$save_LIBS
9949     else
9950         AC_MSG_RESULT([internal])
9951         SYSTEM_LPSOLVE=
9952         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9953     fi
9955 AC_SUBST(SYSTEM_LPSOLVE)
9957 dnl ===================================================================
9958 dnl Checking for libexttextcat
9959 dnl ===================================================================
9960 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9961 if test "$with_system_libexttextcat" = "yes"; then
9962     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9964 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9966 dnl ===================================================================
9967 dnl Checking for libnumbertext
9968 dnl ===================================================================
9969 AC_MSG_CHECKING([whether to use libnumbertext])
9970 if test "$enable_libnumbertext" = "no"; then
9971     AC_MSG_RESULT([no])
9972     ENABLE_LIBNUMBERTEXT=
9973     SYSTEM_LIBNUMBERTEXT=
9974 else
9975     AC_MSG_RESULT([yes])
9976     ENABLE_LIBNUMBERTEXT=TRUE
9977     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9978     if test "$with_system_libnumbertext" = "yes"; then
9979         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9980         SYSTEM_LIBNUMBERTEXT=YES
9981     else
9982         SYSTEM_LIBNUMBERTEXT=
9983         AC_LANG_PUSH([C++])
9984         save_CPPFLAGS=$CPPFLAGS
9985         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9986         AC_CHECK_HEADERS([codecvt regex])
9987         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9988                 [ ENABLE_LIBNUMBERTEXT=''
9989                   LIBNUMBERTEXT_CFLAGS=''
9990                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9991                                Enable libnumbertext fallback (missing number to number name conversion).])
9992                 ])
9993         CPPFLAGS=$save_CPPFLAGS
9994         AC_LANG_POP([C++])
9995     fi
9996     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9997         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9998     fi
10000 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10001 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10002 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10003 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10005 dnl ***************************************
10006 dnl testing libc version for Linux...
10007 dnl ***************************************
10008 if test "$_os" = "Linux"; then
10009     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10010     exec 6>/dev/null # no output
10011     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10012     exec 6>&1 # output on again
10013     if test "$HAVE_LIBC"; then
10014         AC_MSG_RESULT([yes])
10015     else
10016         AC_MSG_ERROR([no, upgrade libc])
10017     fi
10020 dnl =========================================
10021 dnl Check for uuidgen
10022 dnl =========================================
10023 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10024     # presence is already tested above in the WINDOWS_SDK_HOME check
10025     UUIDGEN=uuidgen.exe
10026     AC_SUBST(UUIDGEN)
10027 else
10028     AC_PATH_PROG([UUIDGEN], [uuidgen])
10029     if test -z "$UUIDGEN"; then
10030         AC_MSG_WARN([uuid is needed for building installation sets])
10031     fi
10034 dnl ***************************************
10035 dnl Checking for bison and flex
10036 dnl ***************************************
10037 AC_PATH_PROG(BISON, bison)
10038 if test -z "$BISON"; then
10039     AC_MSG_ERROR([no bison found in \$PATH, install it])
10040 else
10041     AC_MSG_CHECKING([the bison version])
10042     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10043     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10044     # Accept newer than 2.0
10045     if test "$_bison_longver" -lt 2000; then
10046         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10047     fi
10050 AC_PATH_PROG(FLEX, flex)
10051 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10052     FLEX=`cygpath -m $FLEX`
10054 if test -z "$FLEX"; then
10055     AC_MSG_ERROR([no flex found in \$PATH, install it])
10056 else
10057     AC_MSG_CHECKING([the flex version])
10058     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10059     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10060         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10061     fi
10063 AC_SUBST([FLEX])
10064 dnl ***************************************
10065 dnl Checking for patch
10066 dnl ***************************************
10067 AC_PATH_PROG(PATCH, patch)
10068 if test -z "$PATCH"; then
10069     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10072 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10073 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10074     if test -z "$with_gnu_patch"; then
10075         GNUPATCH=$PATCH
10076     else
10077         if test -x "$with_gnu_patch"; then
10078             GNUPATCH=$with_gnu_patch
10079         else
10080             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10081         fi
10082     fi
10084     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10085     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10086         AC_MSG_RESULT([yes])
10087     else
10088         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10089     fi
10090 else
10091     GNUPATCH=$PATCH
10094 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10095     GNUPATCH=`cygpath -m $GNUPATCH`
10098 dnl We also need to check for --with-gnu-cp
10100 if test -z "$with_gnu_cp"; then
10101     # check the place where the good stuff is hidden on Solaris...
10102     if test -x /usr/gnu/bin/cp; then
10103         GNUCP=/usr/gnu/bin/cp
10104     else
10105         AC_PATH_PROGS(GNUCP, gnucp cp)
10106     fi
10107     if test -z $GNUCP; then
10108         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10109     fi
10110 else
10111     if test -x "$with_gnu_cp"; then
10112         GNUCP=$with_gnu_cp
10113     else
10114         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10115     fi
10118 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10119     GNUCP=`cygpath -m $GNUCP`
10122 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10123 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10124     AC_MSG_RESULT([yes])
10125 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10126     AC_MSG_RESULT([yes])
10127 else
10128     case "$build_os" in
10129     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10130         x_GNUCP=[\#]
10131         GNUCP=''
10132         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10133         ;;
10134     *)
10135         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10136         ;;
10137     esac
10140 AC_SUBST(GNUPATCH)
10141 AC_SUBST(GNUCP)
10142 AC_SUBST(x_GNUCP)
10144 dnl ***************************************
10145 dnl testing assembler path
10146 dnl ***************************************
10147 ML_EXE=""
10148 if test "$_os" = "WINNT"; then
10149     if test "$BITNESS_OVERRIDE" = ""; then
10150         assembler=ml.exe
10151         assembler_bin=$CL_DIR
10152     else
10153         assembler=ml64.exe
10154         assembler_bin=$CL_DIR
10155     fi
10157     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
10158     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
10159         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
10160         AC_MSG_RESULT([found])
10161         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
10162     else
10163         AC_MSG_ERROR([Configure did not find $assembler assembler.])
10164     fi
10166     PathFormat "$ASM_HOME"
10167     ASM_HOME="$formatted_path"
10168 else
10169     ASM_HOME=""
10172 AC_SUBST(ML_EXE)
10174 dnl ===================================================================
10175 dnl We need zip and unzip
10176 dnl ===================================================================
10177 AC_PATH_PROG(ZIP, zip)
10178 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10179 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10180     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],,)
10183 AC_PATH_PROG(UNZIP, unzip)
10184 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10186 dnl ===================================================================
10187 dnl Zip must be a specific type for different build types.
10188 dnl ===================================================================
10189 if test $build_os = cygwin; then
10190     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10191         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10192     fi
10195 dnl ===================================================================
10196 dnl We need touch with -h option support.
10197 dnl ===================================================================
10198 AC_PATH_PROG(TOUCH, touch)
10199 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10200 touch warn
10201 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10202     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],,)
10205 dnl ===================================================================
10206 dnl Check for system epoxy
10207 dnl ===================================================================
10208 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10210 dnl ===================================================================
10211 dnl Set vcl option: coordinate device in double or sal_Int32
10212 dnl ===================================================================
10214 dnl disabled for now, we don't want subtle differences between OSs
10215 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10216 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10217 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10218 dnl     AC_MSG_RESULT([double])
10219 dnl else
10220 dnl     AC_MSG_RESULT([sal_Int32])
10221 dnl fi
10223 dnl ===================================================================
10224 dnl Test which vclplugs have to be built.
10225 dnl ===================================================================
10226 R=""
10227 if test "$USING_X11" != TRUE; then
10228     enable_gtk=no
10229     enable_gtk3=no
10231 GTK3_CFLAGS=""
10232 GTK3_LIBS=""
10233 ENABLE_GTK3=""
10234 if test "x$enable_gtk3" = "xyes"; then
10235     if test "$with_system_cairo" = no; then
10236         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10237     fi
10238     : ${with_system_cairo:=yes}
10239     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="")
10240     if test "x$ENABLE_GTK3" = "xTRUE"; then
10241         AC_DEFINE(ENABLE_GTK3)
10242         R="gtk3"
10243         dnl Avoid installed by unpackaged files for now.
10244         if test -z "$PKGFORMAT"; then
10245             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10246         fi
10247     else
10248         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10249     fi
10250     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10251     FilterLibs "${GTK3_LIBS}"
10252     GTK3_LIBS="${filteredlibs}"
10254     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10255     if test "$with_system_epoxy" != "yes"; then
10256         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10257         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10258                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10259     fi
10261 AC_SUBST(GTK3_LIBS)
10262 AC_SUBST(GTK3_CFLAGS)
10263 AC_SUBST(ENABLE_GTK3)
10265 ENABLE_GTK=""
10266 if test "x$enable_gtk" = "xyes"; then
10267     if test "$with_system_cairo" = no; then
10268         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10269     fi
10270     : ${with_system_cairo:=yes}
10271     ENABLE_GTK="TRUE"
10272     AC_DEFINE(ENABLE_GTK)
10273     R="gtk $R"
10275 AC_SUBST(ENABLE_GTK)
10277 ENABLE_QT5=""
10278 if test "x$enable_qt5" = "xyes"; then
10279     ENABLE_QT5="TRUE"
10280     AC_DEFINE(ENABLE_QT5)
10281     R="$R qt5"
10283 AC_SUBST(ENABLE_QT5)
10285 ENABLE_KDE5=""
10286 if test "x$enable_kde5" = "xyes"; then
10287     ENABLE_KDE5="TRUE"
10288     AC_DEFINE(ENABLE_KDE5)
10289     R="$R kde5"
10291 AC_SUBST(ENABLE_KDE5)
10293 ENABLE_GTK3_KDE5=""
10294 if test "x$enable_gtk3_kde5" = "xyes"; then
10295     ENABLE_GTK3_KDE5="TRUE"
10296     AC_DEFINE(ENABLE_GTK3_KDE5)
10297     R="$R gtk3_kde5"
10299 AC_SUBST(ENABLE_GTK3_KDE5)
10301 build_vcl_plugins="$R"
10302 if test -z "$build_vcl_plugins"; then
10303     build_vcl_plugins="none"
10305 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10307 dnl ===================================================================
10308 dnl check for dbus support
10309 dnl ===================================================================
10310 ENABLE_DBUS=""
10311 DBUS_CFLAGS=""
10312 DBUS_LIBS=""
10313 DBUS_GLIB_CFLAGS=""
10314 DBUS_GLIB_LIBS=""
10315 DBUS_HAVE_GLIB=""
10317 if test "$enable_dbus" = "no"; then
10318     test_dbus=no
10321 AC_MSG_CHECKING([whether to enable DBUS support])
10322 if test "$test_dbus" = "yes"; then
10323     ENABLE_DBUS="TRUE"
10324     AC_MSG_RESULT([yes])
10325     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10326     AC_DEFINE(ENABLE_DBUS)
10327     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10328     FilterLibs "${DBUS_LIBS}"
10329     DBUS_LIBS="${filteredlibs}"
10331     # Glib is needed for BluetoothServer
10332     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10333     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10334         [
10335             DBUS_HAVE_GLIB="TRUE"
10336             AC_DEFINE(DBUS_HAVE_GLIB,1)
10337         ],
10338         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10339     )
10340 else
10341     AC_MSG_RESULT([no])
10344 AC_SUBST(ENABLE_DBUS)
10345 AC_SUBST(DBUS_CFLAGS)
10346 AC_SUBST(DBUS_LIBS)
10347 AC_SUBST(DBUS_GLIB_CFLAGS)
10348 AC_SUBST(DBUS_GLIB_LIBS)
10349 AC_SUBST(DBUS_HAVE_GLIB)
10351 AC_MSG_CHECKING([whether to enable Impress remote control])
10352 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10353     AC_MSG_RESULT([yes])
10354     ENABLE_SDREMOTE=TRUE
10355     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10357     if test $OS = MACOSX -a "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10358         # The Bluetooth code doesn't compile with macOS SDK 10.15
10359         enable_sdremote_bluetooth=no
10360     fi
10361     # If not explicitly enabled or disabled, default
10362     if test -z "$enable_sdremote_bluetooth"; then
10363         case "$OS" in
10364         LINUX|MACOSX|WNT)
10365             # Default to yes for these
10366             enable_sdremote_bluetooth=yes
10367             ;;
10368         *)
10369             # otherwise no
10370             enable_sdremote_bluetooth=no
10371             ;;
10372         esac
10373     fi
10374     # $enable_sdremote_bluetooth is guaranteed non-empty now
10376     if test "$enable_sdremote_bluetooth" != "no"; then
10377         if test "$OS" = "LINUX"; then
10378             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10379                 AC_MSG_RESULT([yes])
10380                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10381                 dnl ===================================================================
10382                 dnl Check for system bluez
10383                 dnl ===================================================================
10384                 AC_MSG_CHECKING([which Bluetooth header to use])
10385                 if test "$with_system_bluez" = "yes"; then
10386                     AC_MSG_RESULT([external])
10387                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10388                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10389                     SYSTEM_BLUEZ=TRUE
10390                 else
10391                     AC_MSG_RESULT([internal])
10392                     SYSTEM_BLUEZ=
10393                 fi
10394             else
10395                 AC_MSG_RESULT([no, dbus disabled])
10396                 ENABLE_SDREMOTE_BLUETOOTH=
10397                 SYSTEM_BLUEZ=
10398             fi
10399         else
10400             AC_MSG_RESULT([yes])
10401             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10402             SYSTEM_BLUEZ=
10403         fi
10404     else
10405         AC_MSG_RESULT([no])
10406         ENABLE_SDREMOTE_BLUETOOTH=
10407         SYSTEM_BLUEZ=
10408     fi
10409 else
10410     ENABLE_SDREMOTE=
10411     SYSTEM_BLUEZ=
10412     AC_MSG_RESULT([no])
10414 AC_SUBST(ENABLE_SDREMOTE)
10415 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10416 AC_SUBST(SYSTEM_BLUEZ)
10418 dnl ===================================================================
10419 dnl Check whether the gtk 2.0 libraries are available.
10420 dnl ===================================================================
10422 GTK_CFLAGS=""
10423 GTK_LIBS=""
10424 if test  "$test_gtk" = "yes"; then
10426     if test "$ENABLE_GTK" = "TRUE"; then
10427         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]))
10428         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10429         FilterLibs "${GTK_LIBS}"
10430         GTK_LIBS="${filteredlibs}"
10431         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]))
10432         BUILD_TYPE="$BUILD_TYPE GTK"
10433         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10434         FilterLibs "${GTHREAD_LIBS}"
10435         GTHREAD_LIBS="${filteredlibs}"
10437         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10438         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10439                           [ENABLE_GTK_PRINT="TRUE"],
10440                           [ENABLE_GTK_PRINT=""])
10441         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10442         FilterLibs "${GTK_PRINT_LIBS}"
10443         GTK_PRINT_LIBS="${filteredlibs}"
10444     fi
10446     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10447         AC_MSG_CHECKING([whether to enable GIO support])
10448         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10449             dnl Need at least 2.26 for the dbus support.
10450             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10451                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10452             if test "$ENABLE_GIO" = "TRUE"; then
10453                 AC_DEFINE(ENABLE_GIO)
10454                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10455                 FilterLibs "${GIO_LIBS}"
10456                 GIO_LIBS="${filteredlibs}"
10457             fi
10458         else
10459             AC_MSG_RESULT([no])
10460         fi
10461     fi
10463 AC_SUBST(ENABLE_GIO)
10464 AC_SUBST(GIO_CFLAGS)
10465 AC_SUBST(GIO_LIBS)
10466 AC_SUBST(GTK_CFLAGS)
10467 AC_SUBST(GTK_LIBS)
10468 AC_SUBST(GTHREAD_CFLAGS)
10469 AC_SUBST(GTHREAD_LIBS)
10470 AC_SUBST([ENABLE_GTK_PRINT])
10471 AC_SUBST([GTK_PRINT_CFLAGS])
10472 AC_SUBST([GTK_PRINT_LIBS])
10475 dnl ===================================================================
10477 SPLIT_APP_MODULES=""
10478 if test "$enable_split_app_modules" = "yes"; then
10479     SPLIT_APP_MODULES="TRUE"
10481 AC_SUBST(SPLIT_APP_MODULES)
10483 SPLIT_OPT_FEATURES=""
10484 if test "$enable_split_opt_features" = "yes"; then
10485     SPLIT_OPT_FEATURES="TRUE"
10487 AC_SUBST(SPLIT_OPT_FEATURES)
10489 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10490     if test "$enable_cairo_canvas" = yes; then
10491         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10492     fi
10493     enable_cairo_canvas=no
10494 elif test -z "$enable_cairo_canvas"; then
10495     enable_cairo_canvas=yes
10498 ENABLE_CAIRO_CANVAS=""
10499 if test "$enable_cairo_canvas" = "yes"; then
10500     test_cairo=yes
10501     ENABLE_CAIRO_CANVAS="TRUE"
10502     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10504 AC_SUBST(ENABLE_CAIRO_CANVAS)
10506 dnl ===================================================================
10507 dnl Check whether the GStreamer libraries are available.
10508 dnl It's possible to build avmedia with both GStreamer backends!
10509 dnl ===================================================================
10511 ENABLE_GSTREAMER_1_0=""
10513 if test "$build_gstreamer_1_0" = "yes"; then
10515     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10516     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10517         ENABLE_GSTREAMER_1_0="TRUE"
10518         AC_MSG_RESULT([yes])
10519         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10520         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10521         FilterLibs "${GSTREAMER_1_0_LIBS}"
10522         GSTREAMER_1_0_LIBS="${filteredlibs}"
10523     else
10524         AC_MSG_RESULT([no])
10525     fi
10527 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10528 AC_SUBST(GSTREAMER_1_0_LIBS)
10529 AC_SUBST(ENABLE_GSTREAMER_1_0)
10532 ENABLE_GSTREAMER_0_10=""
10533 if test "$build_gstreamer_0_10" = "yes"; then
10535     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10536     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10537         ENABLE_GSTREAMER_0_10="TRUE"
10538         AC_MSG_RESULT([yes])
10539         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10540             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10541         ])
10542         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10543         FilterLibs "${GSTREAMER_0_10_LIBS}"
10544         GSTREAMER_0_10_LIBS="${filteredlibs}"
10545     else
10546         AC_MSG_RESULT([no])
10547     fi
10550 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10551 AC_SUBST(GSTREAMER_0_10_LIBS)
10552 AC_SUBST(ENABLE_GSTREAMER_0_10)
10554 dnl ===================================================================
10555 dnl Check whether to build the VLC avmedia backend
10556 dnl ===================================================================
10558 ENABLE_VLC=""
10560 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10561 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10562     ENABLE_VLC="TRUE"
10563     AC_MSG_RESULT([yes])
10564 else
10565     AC_MSG_RESULT([no])
10567 AC_SUBST(ENABLE_VLC)
10569 ENABLE_OPENGL_TRANSITIONS=
10570 ENABLE_OPENGL_CANVAS=
10571 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10572    : # disable
10573 elif test "$_os" = "Darwin"; then
10574     # We use frameworks on macOS, no need for detail checks
10575     ENABLE_OPENGL_TRANSITIONS=TRUE
10576     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10577     ENABLE_OPENGL_CANVAS=TRUE
10578 elif test $_os = WINNT; then
10579     ENABLE_OPENGL_TRANSITIONS=TRUE
10580     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10581     ENABLE_OPENGL_CANVAS=TRUE
10582 else
10583     if test "$USING_X11" = TRUE; then
10584         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10585         ENABLE_OPENGL_TRANSITIONS=TRUE
10586         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10587         ENABLE_OPENGL_CANVAS=TRUE
10588     fi
10591 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10592 AC_SUBST(ENABLE_OPENGL_CANVAS)
10594 dnl =================================================
10595 dnl Check whether to build with OpenCL support.
10596 dnl =================================================
10598 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10599     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10600     # platform (optional at run-time, used through clew).
10601     BUILD_TYPE="$BUILD_TYPE OPENCL"
10602     AC_DEFINE(HAVE_FEATURE_OPENCL)
10605 dnl =================================================
10606 dnl Check whether to build with dconf support.
10607 dnl =================================================
10609 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10610     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10611         if test "$enable_dconf" = yes; then
10612             AC_MSG_ERROR([dconf not found])
10613         else
10614             enable_dconf=no
10615         fi])
10617 AC_MSG_CHECKING([whether to enable dconf])
10618 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10619     DCONF_CFLAGS=
10620     DCONF_LIBS=
10621     ENABLE_DCONF=
10622     AC_MSG_RESULT([no])
10623 else
10624     ENABLE_DCONF=TRUE
10625     AC_DEFINE(ENABLE_DCONF)
10626     AC_MSG_RESULT([yes])
10628 AC_SUBST([DCONF_CFLAGS])
10629 AC_SUBST([DCONF_LIBS])
10630 AC_SUBST([ENABLE_DCONF])
10632 # pdf import?
10633 AC_MSG_CHECKING([whether to build the PDF import feature])
10634 ENABLE_PDFIMPORT=
10635 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10636     AC_MSG_RESULT([yes])
10637     ENABLE_PDFIMPORT=TRUE
10638     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10639 else
10640     AC_MSG_RESULT([no])
10643 # Pdfium?
10644 AC_MSG_CHECKING([whether to build PDFium])
10645 ENABLE_PDFIUM=
10646 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_pdfium" = yes; then
10647     AC_MSG_RESULT([yes])
10648     ENABLE_PDFIUM=TRUE
10649     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10650     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10651 else
10652     AC_MSG_RESULT([no])
10654 AC_SUBST(ENABLE_PDFIUM)
10656 dnl ===================================================================
10657 dnl Check for poppler
10658 dnl ===================================================================
10659 ENABLE_POPPLER=
10660 AC_MSG_CHECKING([whether to build Poppler])
10661 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_poppler" = yes; then
10662     AC_MSG_RESULT([yes])
10663     ENABLE_POPPLER=TRUE
10664     AC_DEFINE(HAVE_FEATURE_POPPLER)
10665 else
10666     AC_MSG_RESULT([no])
10668 AC_SUBST(ENABLE_POPPLER)
10670 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10671     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10674 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" == "TRUE" -o "$ENABLE_PDFIUM" == "TRUE" \); then
10675     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10678 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" == "TRUE"; then
10679     dnl ===================================================================
10680     dnl Check for system poppler
10681     dnl ===================================================================
10682     AC_MSG_CHECKING([which PDF import poppler to use])
10683     if test "$with_system_poppler" = "yes"; then
10684         AC_MSG_RESULT([external])
10685         SYSTEM_POPPLER=TRUE
10686         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10687         AC_LANG_PUSH([C++])
10688         save_CXXFLAGS=$CXXFLAGS
10689         save_CPPFLAGS=$CPPFLAGS
10690         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10691         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10692         AC_CHECK_HEADER([cpp/poppler-version.h],
10693             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10694             [])
10695         CXXFLAGS=$save_CXXFLAGS
10696         CPPFLAGS=$save_CPPFLAGS
10697         AC_LANG_POP([C++])
10698         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10700         FilterLibs "${POPPLER_LIBS}"
10701         POPPLER_LIBS="${filteredlibs}"
10702     else
10703         AC_MSG_RESULT([internal])
10704         SYSTEM_POPPLER=
10705         BUILD_TYPE="$BUILD_TYPE POPPLER"
10706         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10707     fi
10708     AC_DEFINE([ENABLE_PDFIMPORT],1)
10710 AC_SUBST(ENABLE_PDFIMPORT)
10711 AC_SUBST(SYSTEM_POPPLER)
10712 AC_SUBST(POPPLER_CFLAGS)
10713 AC_SUBST(POPPLER_LIBS)
10715 SYSTEM_GPGMEPP=
10717 if test "$build_for_ios" = "YES"; then
10718     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10719     AC_MSG_RESULT([yes])
10720 elif test "$enable_mpl_subset" = "yes"; then
10721     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10722     AC_MSG_RESULT([yes])
10723 elif test "$enable_fuzzers" = "yes"; then
10724     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10725     AC_MSG_RESULT([yes])
10726 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10727     dnl ===================================================================
10728     dnl Check for system gpgme
10729     dnl ===================================================================
10730     AC_MSG_CHECKING([which gpgmepp to use])
10731     if test "$with_system_gpgmepp" = "yes"; then
10732         AC_MSG_RESULT([external])
10733         SYSTEM_GPGMEPP=TRUE
10735         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10736         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10737             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10738         # progress_callback is the only func with plain C linkage
10739         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10740         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10741             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10742         AC_CHECK_HEADER(gpgme.h, [],
10743             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10744     else
10745         AC_MSG_RESULT([internal])
10746         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10747         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10749         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10750         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10751         if test "$_os" != "WINNT"; then
10752             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10753             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10754         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10755             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10756         fi
10757     fi
10758     ENABLE_GPGMEPP=TRUE
10759     AC_DEFINE([HAVE_FEATURE_GPGME])
10760     AC_PATH_PROG(GPG, gpg)
10761     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10762     # so let's exclude that manually for the moment
10763     if test -n "$GPG" -a "$_os" != "WINNT"; then
10764         # make sure we not only have a working gpgme, but a full working
10765         # gpg installation to run OpenPGP signature verification
10766         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10767     fi
10768     if test "$_os" = "Linux"; then
10769       uid=`id -u`
10770       AC_MSG_CHECKING([for /run/user/$uid])
10771       if test -d /run/user/$uid; then
10772         AC_MSG_RESULT([yes])
10773         AC_PATH_PROG(GPGCONF, gpgconf)
10775         # Older versions of gpgconf are not working as expected, since
10776         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10777         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10778         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10779         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10780         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10781         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10782         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10783           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10784           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10785           if $GPGCONF --dump-options > /dev/null ; then
10786             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10787               AC_MSG_RESULT([yes])
10788               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10789               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10790             else
10791               AC_MSG_RESULT([no])
10792             fi
10793           else
10794             AC_MSG_RESULT([no. missing or broken gpgconf?])
10795           fi
10796         else
10797           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10798         fi
10799       else
10800         AC_MSG_RESULT([no])
10801      fi
10802    fi
10804 AC_SUBST(ENABLE_GPGMEPP)
10805 AC_SUBST(SYSTEM_GPGMEPP)
10806 AC_SUBST(GPG_ERROR_CFLAGS)
10807 AC_SUBST(GPG_ERROR_LIBS)
10808 AC_SUBST(LIBASSUAN_CFLAGS)
10809 AC_SUBST(LIBASSUAN_LIBS)
10810 AC_SUBST(GPGMEPP_CFLAGS)
10811 AC_SUBST(GPGMEPP_LIBS)
10813 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10814 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10815     AC_MSG_RESULT([yes])
10816     ENABLE_MEDIAWIKI=TRUE
10817     BUILD_TYPE="$BUILD_TYPE XSLTML"
10818     if test  "x$with_java" = "xno"; then
10819         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10820     fi
10821 else
10822     AC_MSG_RESULT([no])
10823     ENABLE_MEDIAWIKI=
10824     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10826 AC_SUBST(ENABLE_MEDIAWIKI)
10828 AC_MSG_CHECKING([whether to build the Report Builder])
10829 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10830     AC_MSG_RESULT([yes])
10831     ENABLE_REPORTBUILDER=TRUE
10832     AC_MSG_CHECKING([which jfreereport libs to use])
10833     if test "$with_system_jfreereport" = "yes"; then
10834         SYSTEM_JFREEREPORT=TRUE
10835         AC_MSG_RESULT([external])
10836         if test -z $SAC_JAR; then
10837             SAC_JAR=/usr/share/java/sac.jar
10838         fi
10839         if ! test -f $SAC_JAR; then
10840              AC_MSG_ERROR(sac.jar not found.)
10841         fi
10843         if test -z $LIBXML_JAR; then
10844             if test -f /usr/share/java/libxml-1.0.0.jar; then
10845                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10846             elif test -f /usr/share/java/libxml.jar; then
10847                 LIBXML_JAR=/usr/share/java/libxml.jar
10848             else
10849                 AC_MSG_ERROR(libxml.jar replacement not found.)
10850             fi
10851         elif ! test -f $LIBXML_JAR; then
10852             AC_MSG_ERROR(libxml.jar not found.)
10853         fi
10855         if test -z $FLUTE_JAR; then
10856             if test -f/usr/share/java/flute-1.3.0.jar; then
10857                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10858             elif test -f /usr/share/java/flute.jar; then
10859                 FLUTE_JAR=/usr/share/java/flute.jar
10860             else
10861                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10862             fi
10863         elif ! test -f $FLUTE_JAR; then
10864             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10865         fi
10867         if test -z $JFREEREPORT_JAR; then
10868             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10869                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10870             elif test -f /usr/share/java/flow-engine.jar; then
10871                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10872             else
10873                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10874             fi
10875         elif ! test -f  $JFREEREPORT_JAR; then
10876                 AC_MSG_ERROR(jfreereport.jar not found.)
10877         fi
10879         if test -z $LIBLAYOUT_JAR; then
10880             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10881                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10882             elif test -f /usr/share/java/liblayout.jar; then
10883                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10884             else
10885                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10886             fi
10887         elif ! test -f $LIBLAYOUT_JAR; then
10888                 AC_MSG_ERROR(liblayout.jar not found.)
10889         fi
10891         if test -z $LIBLOADER_JAR; then
10892             if test -f /usr/share/java/libloader-1.0.0.jar; then
10893                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10894             elif test -f /usr/share/java/libloader.jar; then
10895                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10896             else
10897                 AC_MSG_ERROR(libloader.jar replacement not found.)
10898             fi
10899         elif ! test -f  $LIBLOADER_JAR; then
10900             AC_MSG_ERROR(libloader.jar not found.)
10901         fi
10903         if test -z $LIBFORMULA_JAR; then
10904             if test -f /usr/share/java/libformula-0.2.0.jar; then
10905                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10906             elif test -f /usr/share/java/libformula.jar; then
10907                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10908             else
10909                 AC_MSG_ERROR(libformula.jar replacement not found.)
10910             fi
10911         elif ! test -f $LIBFORMULA_JAR; then
10912                 AC_MSG_ERROR(libformula.jar not found.)
10913         fi
10915         if test -z $LIBREPOSITORY_JAR; then
10916             if test -f /usr/share/java/librepository-1.0.0.jar; then
10917                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10918             elif test -f /usr/share/java/librepository.jar; then
10919                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10920             else
10921                 AC_MSG_ERROR(librepository.jar replacement not found.)
10922             fi
10923         elif ! test -f $LIBREPOSITORY_JAR; then
10924             AC_MSG_ERROR(librepository.jar not found.)
10925         fi
10927         if test -z $LIBFONTS_JAR; then
10928             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10929                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10930             elif test -f /usr/share/java/libfonts.jar; then
10931                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10932             else
10933                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10934             fi
10935         elif ! test -f $LIBFONTS_JAR; then
10936                 AC_MSG_ERROR(libfonts.jar not found.)
10937         fi
10939         if test -z $LIBSERIALIZER_JAR; then
10940             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10941                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10942             elif test -f /usr/share/java/libserializer.jar; then
10943                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10944             else
10945                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10946             fi
10947         elif ! test -f $LIBSERIALIZER_JAR; then
10948                 AC_MSG_ERROR(libserializer.jar not found.)
10949         fi
10951         if test -z $LIBBASE_JAR; then
10952             if test -f /usr/share/java/libbase-1.0.0.jar; then
10953                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10954             elif test -f /usr/share/java/libbase.jar; then
10955                 LIBBASE_JAR=/usr/share/java/libbase.jar
10956             else
10957                 AC_MSG_ERROR(libbase.jar replacement not found.)
10958             fi
10959         elif ! test -f $LIBBASE_JAR; then
10960             AC_MSG_ERROR(libbase.jar not found.)
10961         fi
10963     else
10964         AC_MSG_RESULT([internal])
10965         SYSTEM_JFREEREPORT=
10966         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10967         NEED_ANT=TRUE
10968     fi
10969 else
10970     AC_MSG_RESULT([no])
10971     ENABLE_REPORTBUILDER=
10972     SYSTEM_JFREEREPORT=
10974 AC_SUBST(ENABLE_REPORTBUILDER)
10975 AC_SUBST(SYSTEM_JFREEREPORT)
10976 AC_SUBST(SAC_JAR)
10977 AC_SUBST(LIBXML_JAR)
10978 AC_SUBST(FLUTE_JAR)
10979 AC_SUBST(JFREEREPORT_JAR)
10980 AC_SUBST(LIBBASE_JAR)
10981 AC_SUBST(LIBLAYOUT_JAR)
10982 AC_SUBST(LIBLOADER_JAR)
10983 AC_SUBST(LIBFORMULA_JAR)
10984 AC_SUBST(LIBREPOSITORY_JAR)
10985 AC_SUBST(LIBFONTS_JAR)
10986 AC_SUBST(LIBSERIALIZER_JAR)
10988 # this has to be here because both the Wiki Publisher and the SRB use
10989 # commons-logging
10990 COMMONS_LOGGING_VERSION=1.2
10991 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10992     AC_MSG_CHECKING([which Apache commons-* libs to use])
10993     if test "$with_system_apache_commons" = "yes"; then
10994         SYSTEM_APACHE_COMMONS=TRUE
10995         AC_MSG_RESULT([external])
10996         if test -z $COMMONS_LOGGING_JAR; then
10997             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10998                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10999            elif test -f /usr/share/java/commons-logging.jar; then
11000                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11001             else
11002                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11003             fi
11004         elif ! test -f $COMMONS_LOGGING_JAR; then
11005             AC_MSG_ERROR(commons-logging.jar not found.)
11006         fi
11007     else
11008         AC_MSG_RESULT([internal])
11009         SYSTEM_APACHE_COMMONS=
11010         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11011         NEED_ANT=TRUE
11012     fi
11014 AC_SUBST(SYSTEM_APACHE_COMMONS)
11015 AC_SUBST(COMMONS_LOGGING_JAR)
11016 AC_SUBST(COMMONS_LOGGING_VERSION)
11018 # scripting provider for BeanShell?
11019 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11020 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11021     AC_MSG_RESULT([yes])
11022     ENABLE_SCRIPTING_BEANSHELL=TRUE
11024     dnl ===================================================================
11025     dnl Check for system beanshell
11026     dnl ===================================================================
11027     AC_MSG_CHECKING([which beanshell to use])
11028     if test "$with_system_beanshell" = "yes"; then
11029         AC_MSG_RESULT([external])
11030         SYSTEM_BSH=TRUE
11031         if test -z $BSH_JAR; then
11032             BSH_JAR=/usr/share/java/bsh.jar
11033         fi
11034         if ! test -f $BSH_JAR; then
11035             AC_MSG_ERROR(bsh.jar not found.)
11036         fi
11037     else
11038         AC_MSG_RESULT([internal])
11039         SYSTEM_BSH=
11040         BUILD_TYPE="$BUILD_TYPE BSH"
11041     fi
11042 else
11043     AC_MSG_RESULT([no])
11044     ENABLE_SCRIPTING_BEANSHELL=
11045     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11047 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11048 AC_SUBST(SYSTEM_BSH)
11049 AC_SUBST(BSH_JAR)
11051 # scripting provider for JavaScript?
11052 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11053 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11054     AC_MSG_RESULT([yes])
11055     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11057     dnl ===================================================================
11058     dnl Check for system rhino
11059     dnl ===================================================================
11060     AC_MSG_CHECKING([which rhino to use])
11061     if test "$with_system_rhino" = "yes"; then
11062         AC_MSG_RESULT([external])
11063         SYSTEM_RHINO=TRUE
11064         if test -z $RHINO_JAR; then
11065             RHINO_JAR=/usr/share/java/js.jar
11066         fi
11067         if ! test -f $RHINO_JAR; then
11068             AC_MSG_ERROR(js.jar not found.)
11069         fi
11070     else
11071         AC_MSG_RESULT([internal])
11072         SYSTEM_RHINO=
11073         BUILD_TYPE="$BUILD_TYPE RHINO"
11074         NEED_ANT=TRUE
11075     fi
11076 else
11077     AC_MSG_RESULT([no])
11078     ENABLE_SCRIPTING_JAVASCRIPT=
11079     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11081 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11082 AC_SUBST(SYSTEM_RHINO)
11083 AC_SUBST(RHINO_JAR)
11085 # This is only used in Qt5/KDE5 checks to determine if /usr/lib64
11086 # paths should be added to library search path. So lets put all 64-bit
11087 # platforms there.
11088 supports_multilib=
11089 case "$host_cpu" in
11090 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11091     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11092         supports_multilib="yes"
11093     fi
11094     ;;
11096     ;;
11097 esac
11099 dnl ===================================================================
11100 dnl QT5 Integration
11101 dnl ===================================================================
11103 QT5_CFLAGS=""
11104 QT5_LIBS=""
11105 QMAKE5="qmake"
11106 MOC5="moc"
11107 QT5_GLIB_CFLAGS=""
11108 QT5_GLIB_LIBS=""
11109 QT5_HAVE_GLIB=""
11110 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11111         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11112         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11113 then
11114     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11115     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11117     if test -n "$supports_multilib"; then
11118         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11119     fi
11121     qt5_test_include="QtWidgets/qapplication.h"
11122     qt5_test_library="libQt5Widgets.so"
11124     dnl Check for qmake5
11125     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11126     if test "$QMAKE5" = "no"; then
11127         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11128     else
11129         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11130         if test -z "$qmake5_test_ver"; then
11131             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11132         fi
11133         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11134         qt5_minimal_minor="6"
11135         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11136             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11137         else
11138             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11139         fi
11140     fi
11142     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11143     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11145     AC_MSG_CHECKING([for Qt5 headers])
11146     qt5_incdir="no"
11147     for inc_dir in $qt5_incdirs; do
11148         if test -r "$inc_dir/$qt5_test_include"; then
11149             qt5_incdir="$inc_dir"
11150             break
11151         fi
11152     done
11153     AC_MSG_RESULT([$qt5_incdir])
11154     if test "x$qt5_incdir" = "xno"; then
11155         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11156     fi
11158     AC_MSG_CHECKING([for Qt5 libraries])
11159     qt5_libdir="no"
11160     for lib_dir in $qt5_libdirs; do
11161         if test -r "$lib_dir/$qt5_test_library"; then
11162             qt5_libdir="$lib_dir"
11163             break
11164         fi
11165     done
11166     AC_MSG_RESULT([$qt5_libdir])
11167     if test "x$qt5_libdir" = "xno"; then
11168         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11169     fi
11171     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11172     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11173     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11175     dnl Check for Meta Object Compiler
11177     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11178     if test "$MOC5" = "no"; then
11179         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11180 the root of your Qt installation by exporting QT5DIR before running "configure".])
11181     fi
11183     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11184     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11185     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11186         [
11187             QT5_HAVE_GLIB=1
11188         ],
11189         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11190     )
11192 AC_SUBST(QT5_CFLAGS)
11193 AC_SUBST(QT5_LIBS)
11194 AC_SUBST(MOC5)
11195 AC_SUBST(QT5_GLIB_CFLAGS)
11196 AC_SUBST(QT5_GLIB_LIBS)
11197 AC_SUBST(QT5_HAVE_GLIB)
11199 dnl ===================================================================
11200 dnl KDE5 Integration
11201 dnl ===================================================================
11203 KF5_CFLAGS=""
11204 KF5_LIBS=""
11205 KF5_CONFIG="kf5-config"
11206 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11207         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11208         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11209 then
11210     if test "$OS" = "HAIKU"; then
11211         haiku_arch="`echo $RTL_ARCH | tr X x`"
11212         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11213         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11214     fi
11216     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11217     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11218     if test -n "$supports_multilib"; then
11219         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11220     fi
11222     kf5_test_include="KF5/kcoreaddons_version.h"
11223     kf5_test_library="libKF5CoreAddons.so"
11224     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11226     dnl kf5 KDE4 support compatibility installed
11227     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11228     if test "$KF5_CONFIG" != "no"; then
11229         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11230         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11231     fi
11233     dnl Check for KF5 headers
11234     AC_MSG_CHECKING([for KF5 headers])
11235     kf5_incdir="no"
11236     for kf5_check in $kf5_incdirs; do
11237         if test -r "$kf5_check/$kf5_test_include"; then
11238             kf5_incdir="$kf5_check/KF5"
11239             break
11240         fi
11241     done
11242     AC_MSG_RESULT([$kf5_incdir])
11243     if test "x$kf5_incdir" = "xno"; then
11244         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11245     fi
11247     dnl Check for KF5 libraries
11248     AC_MSG_CHECKING([for KF5 libraries])
11249     kf5_libdir="no"
11250     for kf5_check in $kf5_libdirs; do
11251         if test -r "$kf5_check/$kf5_test_library"; then
11252             kf5_libdir="$kf5_check"
11253             break
11254         fi
11255     done
11257     AC_MSG_RESULT([$kf5_libdir])
11258     if test "x$kf5_libdir" = "xno"; then
11259         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11260     fi
11262     if test "$USING_X11" = TRUE; then
11263         PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11264     fi
11266     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"
11267     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11268     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11270     if test "$USING_X11" = TRUE; then
11271         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11272     fi
11274     AC_LANG_PUSH([C++])
11275     save_CXXFLAGS=$CXXFLAGS
11276     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11277     AC_MSG_CHECKING([whether KDE is >= 5.0])
11278        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11279 #include <kcoreaddons_version.h>
11281 int main(int argc, char **argv) {
11282        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11283        else return 1;
11285        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11286     CXXFLAGS=$save_CXXFLAGS
11287     AC_LANG_POP([C++])
11289 AC_SUBST(KF5_CFLAGS)
11290 AC_SUBST(KF5_LIBS)
11292 dnl ===================================================================
11293 dnl Test whether to include Evolution 2 support
11294 dnl ===================================================================
11295 AC_MSG_CHECKING([whether to enable evolution 2 support])
11296 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11297     AC_MSG_RESULT([yes])
11298     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11299     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11300     FilterLibs "${GOBJECT_LIBS}"
11301     GOBJECT_LIBS="${filteredlibs}"
11302     ENABLE_EVOAB2="TRUE"
11303 else
11304     ENABLE_EVOAB2=""
11305     AC_MSG_RESULT([no])
11307 AC_SUBST(ENABLE_EVOAB2)
11308 AC_SUBST(GOBJECT_CFLAGS)
11309 AC_SUBST(GOBJECT_LIBS)
11311 dnl ===================================================================
11312 dnl Test which themes to include
11313 dnl ===================================================================
11314 AC_MSG_CHECKING([which themes to include])
11315 # if none given use default subset of available themes
11316 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11317     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga sifr sifr_svg sifr_dark tango"
11320 WITH_THEMES=""
11321 if test "x$with_theme" != "xno"; then
11322     for theme in $with_theme; do
11323         case $theme in
11324         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|sifr|sifr_svg|sifr_dark|tango) real_theme="$theme" ;;
11325         default) real_theme=colibre ;;
11326         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11327         esac
11328         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11329     done
11331 AC_MSG_RESULT([$WITH_THEMES])
11332 AC_SUBST([WITH_THEMES])
11333 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11334 for theme in $with_theme; do
11335     case $theme in
11336     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11337     *) ;;
11338     esac
11339 done
11341 dnl ===================================================================
11342 dnl Test whether to integrate helppacks into the product's installer
11343 dnl ===================================================================
11344 AC_MSG_CHECKING([for helppack integration])
11345 if test "$with_helppack_integration" = "no"; then
11346     AC_MSG_RESULT([no integration])
11347 else
11348     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11349     AC_MSG_RESULT([integration])
11352 ###############################################################################
11353 # Extensions checking
11354 ###############################################################################
11355 AC_MSG_CHECKING([for extensions integration])
11356 if test "x$enable_extension_integration" != "xno"; then
11357     WITH_EXTENSION_INTEGRATION=TRUE
11358     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11359     AC_MSG_RESULT([yes, use integration])
11360 else
11361     WITH_EXTENSION_INTEGRATION=
11362     AC_MSG_RESULT([no, do not integrate])
11364 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11366 dnl Should any extra extensions be included?
11367 dnl There are standalone tests for each of these below.
11368 WITH_EXTRA_EXTENSIONS=
11369 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11371 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11372 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11373 if test "x$with_java" != "xno"; then
11374     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11375     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11378 AC_MSG_CHECKING([whether to build opens___.ttf])
11379 if test "$enable_build_opensymbol" = "yes"; then
11380     AC_MSG_RESULT([yes])
11381     AC_PATH_PROG(FONTFORGE, fontforge)
11382     if test -z "$FONTFORGE"; then
11383         AC_MSG_ERROR([fontforge not installed])
11384     fi
11385 else
11386     AC_MSG_RESULT([no])
11387     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11388     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11390 AC_SUBST(OPENSYMBOL_TTF)
11391 AC_SUBST(FONTFORGE)
11393 dnl ===================================================================
11394 dnl Test whether to include fonts
11395 dnl ===================================================================
11396 AC_MSG_CHECKING([whether to include third-party fonts])
11397 if test "$with_fonts" != "no"; then
11398     AC_MSG_RESULT([yes])
11399     WITH_FONTS=TRUE
11400     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11401     AC_DEFINE(HAVE_MORE_FONTS)
11402 else
11403     AC_MSG_RESULT([no])
11404     WITH_FONTS=
11405     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11407 AC_SUBST(WITH_FONTS)
11410 dnl ===================================================================
11411 dnl Test whether to enable online update service
11412 dnl ===================================================================
11413 AC_MSG_CHECKING([whether to enable online update])
11414 ENABLE_ONLINE_UPDATE=
11415 ENABLE_ONLINE_UPDATE_MAR=
11416 UPDATE_CONFIG=
11417 if test "$enable_online_update" = ""; then
11418     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11419         AC_MSG_RESULT([yes])
11420         ENABLE_ONLINE_UPDATE="TRUE"
11421     else
11422         AC_MSG_RESULT([no])
11423     fi
11424 else
11425     if test "$enable_online_update" = "mar"; then
11426         AC_MSG_RESULT([yes - MAR-based online update])
11427         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11428         if test "$with_update_config" = ""; then
11429             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11430         fi
11431         UPDATE_CONFIG="$with_update_config"
11432         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11433     elif test "$enable_online_update" = "yes"; then
11434         AC_MSG_RESULT([yes])
11435         ENABLE_ONLINE_UPDATE="TRUE"
11436     else
11437         AC_MSG_RESULT([no])
11438     fi
11440 AC_SUBST(ENABLE_ONLINE_UPDATE)
11441 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11442 AC_SUBST(UPDATE_CONFIG)
11444 dnl ===================================================================
11445 dnl Test whether we need bzip2
11446 dnl ===================================================================
11447 SYSTEM_BZIP2=
11448 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11449     AC_MSG_CHECKING([whether to use system bzip2])
11450     if test "$with_system_bzip2" = yes; then
11451         SYSTEM_BZIP2=TRUE
11452         AC_MSG_RESULT([yes])
11453         PKG_CHECK_MODULES(BZIP2, bzip2)
11454         FilterLibs "${BZIP2_LIBS}"
11455         BZIP2_LIBS="${filteredlibs}"
11456     else
11457         AC_MSG_RESULT([no])
11458         BUILD_TYPE="$BUILD_TYPE BZIP2"
11459     fi
11461 AC_SUBST(SYSTEM_BZIP2)
11462 AC_SUBST(BZIP2_CFLAGS)
11463 AC_SUBST(BZIP2_LIBS)
11465 dnl ===================================================================
11466 dnl Test whether to enable extension update
11467 dnl ===================================================================
11468 AC_MSG_CHECKING([whether to enable extension update])
11469 ENABLE_EXTENSION_UPDATE=
11470 if test "x$enable_extension_update" = "xno"; then
11471     AC_MSG_RESULT([no])
11472 else
11473     AC_MSG_RESULT([yes])
11474     ENABLE_EXTENSION_UPDATE="TRUE"
11475     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11476     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11478 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11481 dnl ===================================================================
11482 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11483 dnl ===================================================================
11484 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11485 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11486     AC_MSG_RESULT([no])
11487     ENABLE_SILENT_MSI=
11488 else
11489     AC_MSG_RESULT([yes])
11490     ENABLE_SILENT_MSI=TRUE
11491     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11493 AC_SUBST(ENABLE_SILENT_MSI)
11495 AC_MSG_CHECKING([whether and how to use Xinerama])
11496 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11497     if test "$x_libraries" = "default_x_libraries"; then
11498         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11499         if test "x$XINERAMALIB" = x; then
11500            XINERAMALIB="/usr/lib"
11501         fi
11502     else
11503         XINERAMALIB="$x_libraries"
11504     fi
11505     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11506         # we have both versions, let the user decide but use the dynamic one
11507         # per default
11508         USE_XINERAMA=TRUE
11509         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11510             XINERAMA_LINK=dynamic
11511         else
11512             XINERAMA_LINK=static
11513         fi
11514     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11515         # we have only the dynamic version
11516         USE_XINERAMA=TRUE
11517         XINERAMA_LINK=dynamic
11518     elif test -e "$XINERAMALIB/libXinerama.a"; then
11519         # static version
11520         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11521             USE_XINERAMA=TRUE
11522             XINERAMA_LINK=static
11523         else
11524             USE_XINERAMA=
11525             XINERAMA_LINK=none
11526         fi
11527     else
11528         # no Xinerama
11529         USE_XINERAMA=
11530         XINERAMA_LINK=none
11531     fi
11532     if test "$USE_XINERAMA" = "TRUE"; then
11533         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11534         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11535             [AC_MSG_ERROR(Xinerama header not found.)], [])
11536         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11537         if test "x$XEXTLIB" = x; then
11538            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11539         fi
11540         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11541         if test "$_os" = "FreeBSD"; then
11542             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11543         fi
11544         if test "$_os" = "Linux"; then
11545             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11546         fi
11547         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11548             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11549     else
11550         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11551     fi
11552 else
11553     USE_XINERAMA=
11554     XINERAMA_LINK=none
11555     AC_MSG_RESULT([no])
11557 AC_SUBST(USE_XINERAMA)
11558 AC_SUBST(XINERAMA_LINK)
11560 dnl ===================================================================
11561 dnl Test whether to build cairo or rely on the system version
11562 dnl ===================================================================
11564 if test "$USING_X11" = TRUE; then
11565     # Used in vcl/Library_vclplug_gen.mk
11566     test_cairo=yes
11569 if test "$test_cairo" = "yes"; then
11570     AC_MSG_CHECKING([whether to use the system cairo])
11572     : ${with_system_cairo:=$with_system_libs}
11573     if test "$with_system_cairo" = "yes"; then
11574         SYSTEM_CAIRO=TRUE
11575         AC_MSG_RESULT([yes])
11577         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11578         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11579         FilterLibs "${CAIRO_LIBS}"
11580         CAIRO_LIBS="${filteredlibs}"
11582         if test "$test_xrender" = "yes"; then
11583             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11584             AC_LANG_PUSH([C])
11585             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11586 #ifdef PictStandardA8
11587 #else
11588       return fail;
11589 #endif
11590 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11592             AC_LANG_POP([C])
11593         fi
11594     else
11595         SYSTEM_CAIRO=
11596         AC_MSG_RESULT([no])
11598         BUILD_TYPE="$BUILD_TYPE CAIRO"
11599     fi
11602 AC_SUBST(SYSTEM_CAIRO)
11603 AC_SUBST(CAIRO_CFLAGS)
11604 AC_SUBST(CAIRO_LIBS)
11606 dnl ===================================================================
11607 dnl Test whether to use avahi
11608 dnl ===================================================================
11609 if test "$_os" = "WINNT"; then
11610     # Windows uses bundled mDNSResponder
11611     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11612 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11613     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11614                       [ENABLE_AVAHI="TRUE"])
11615     AC_DEFINE(HAVE_FEATURE_AVAHI)
11616     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11617     FilterLibs "${AVAHI_LIBS}"
11618     AVAHI_LIBS="${filteredlibs}"
11621 AC_SUBST(ENABLE_AVAHI)
11622 AC_SUBST(AVAHI_CFLAGS)
11623 AC_SUBST(AVAHI_LIBS)
11625 dnl ===================================================================
11626 dnl Test whether to use liblangtag
11627 dnl ===================================================================
11628 SYSTEM_LIBLANGTAG=
11629 AC_MSG_CHECKING([whether to use system liblangtag])
11630 if test "$with_system_liblangtag" = yes; then
11631     SYSTEM_LIBLANGTAG=TRUE
11632     AC_MSG_RESULT([yes])
11633     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11634     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11635     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11636     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11637     FilterLibs "${LIBLANGTAG_LIBS}"
11638     LIBLANGTAG_LIBS="${filteredlibs}"
11639 else
11640     SYSTEM_LIBLANGTAG=
11641     AC_MSG_RESULT([no])
11642     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11643     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11644     if test "$COM" = "MSC"; then
11645         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11646     else
11647         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11648     fi
11650 AC_SUBST(SYSTEM_LIBLANGTAG)
11651 AC_SUBST(LIBLANGTAG_CFLAGS)
11652 AC_SUBST(LIBLANGTAG_LIBS)
11654 dnl ===================================================================
11655 dnl Test whether to build libpng or rely on the system version
11656 dnl ===================================================================
11658 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11660 dnl ===================================================================
11661 dnl Check for runtime JVM search path
11662 dnl ===================================================================
11663 if test "$ENABLE_JAVA" != ""; then
11664     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11665     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11666         AC_MSG_RESULT([yes])
11667         if ! test -d "$with_jvm_path"; then
11668             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11669         fi
11670         if ! test -d "$with_jvm_path"jvm; then
11671             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11672         fi
11673         JVM_ONE_PATH_CHECK="$with_jvm_path"
11674         AC_SUBST(JVM_ONE_PATH_CHECK)
11675     else
11676         AC_MSG_RESULT([no])
11677     fi
11680 dnl ===================================================================
11681 dnl Test for the presence of Ant and that it works
11682 dnl ===================================================================
11684 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11685     ANT_HOME=; export ANT_HOME
11686     WITH_ANT_HOME=; export WITH_ANT_HOME
11687     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11688         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11689             if test "$_os" = "WINNT"; then
11690                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11691             else
11692                 with_ant_home="$LODE_HOME/opt/ant"
11693             fi
11694         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11695             with_ant_home="$LODE_HOME/opt/ant"
11696         fi
11697     fi
11698     if test -z "$with_ant_home"; then
11699         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11700     else
11701         if test "$_os" = "WINNT"; then
11702             # AC_PATH_PROGS needs unix path
11703             with_ant_home=`cygpath -u "$with_ant_home"`
11704         fi
11705         AbsolutePath "$with_ant_home"
11706         with_ant_home=$absolute_path
11707         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11708         WITH_ANT_HOME=$with_ant_home
11709         ANT_HOME=$with_ant_home
11710     fi
11712     if test -z "$ANT"; then
11713         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11714     else
11715         # resolve relative or absolute symlink
11716         while test -h "$ANT"; do
11717             a_cwd=`pwd`
11718             a_basename=`basename "$ANT"`
11719             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11720             cd "`dirname "$ANT"`"
11721             cd "`dirname "$a_script"`"
11722             ANT="`pwd`"/"`basename "$a_script"`"
11723             cd "$a_cwd"
11724         done
11726         AC_MSG_CHECKING([if $ANT works])
11727         mkdir -p conftest.dir
11728         a_cwd=$(pwd)
11729         cd conftest.dir
11730         cat > conftest.java << EOF
11731         public class conftest {
11732             int testmethod(int a, int b) {
11733                     return a + b;
11734             }
11735         }
11738         cat > conftest.xml << EOF
11739         <project name="conftest" default="conftest">
11740         <target name="conftest">
11741             <javac srcdir="." includes="conftest.java">
11742             </javac>
11743         </target>
11744         </project>
11747         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11748         if test $? = 0 -a -f ./conftest.class; then
11749             AC_MSG_RESULT([Ant works])
11750             if test -z "$WITH_ANT_HOME"; then
11751                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11752                 if test -z "$ANT_HOME"; then
11753                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11754                 fi
11755             else
11756                 ANT_HOME="$WITH_ANT_HOME"
11757             fi
11758         else
11759             echo "configure: Ant test failed" >&5
11760             cat conftest.java >&5
11761             cat conftest.xml >&5
11762             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11763         fi
11764         cd "$a_cwd"
11765         rm -fr conftest.dir
11766     fi
11767     if test -z "$ANT_HOME"; then
11768         ANT_HOME="NO_ANT_HOME"
11769     else
11770         PathFormat "$ANT_HOME"
11771         ANT_HOME="$formatted_path"
11772         PathFormat "$ANT"
11773         ANT="$formatted_path"
11774     fi
11775     AC_SUBST(ANT_HOME)
11776     AC_SUBST(ANT)
11778     dnl Checking for ant.jar
11779     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11780         AC_MSG_CHECKING([Ant lib directory])
11781         if test -f $ANT_HOME/lib/ant.jar; then
11782             ANT_LIB="$ANT_HOME/lib"
11783         else
11784             if test -f $ANT_HOME/ant.jar; then
11785                 ANT_LIB="$ANT_HOME"
11786             else
11787                 if test -f /usr/share/java/ant.jar; then
11788                     ANT_LIB=/usr/share/java
11789                 else
11790                     if test -f /usr/share/ant-core/lib/ant.jar; then
11791                         ANT_LIB=/usr/share/ant-core/lib
11792                     else
11793                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11794                             ANT_LIB="$ANT_HOME/lib/ant"
11795                         else
11796                             if test -f /usr/share/lib/ant/ant.jar; then
11797                                 ANT_LIB=/usr/share/lib/ant
11798                             else
11799                                 AC_MSG_ERROR([Ant libraries not found!])
11800                             fi
11801                         fi
11802                     fi
11803                 fi
11804             fi
11805         fi
11806         PathFormat "$ANT_LIB"
11807         ANT_LIB="$formatted_path"
11808         AC_MSG_RESULT([Ant lib directory found.])
11809     fi
11810     AC_SUBST(ANT_LIB)
11812     ant_minver=1.6.0
11813     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11815     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11816     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11817     ant_version_major=`echo $ant_version | cut -d. -f1`
11818     ant_version_minor=`echo $ant_version | cut -d. -f2`
11819     echo "configure: ant_version $ant_version " >&5
11820     echo "configure: ant_version_major $ant_version_major " >&5
11821     echo "configure: ant_version_minor $ant_version_minor " >&5
11822     if test "$ant_version_major" -ge "2"; then
11823         AC_MSG_RESULT([yes, $ant_version])
11824     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11825         AC_MSG_RESULT([yes, $ant_version])
11826     else
11827         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11828     fi
11830     rm -f conftest* core core.* *.core
11833 OOO_JUNIT_JAR=
11834 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11835     AC_MSG_CHECKING([for JUnit 4])
11836     if test "$with_junit" = "yes"; then
11837         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11838             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11839         elif test -e /usr/share/java/junit4.jar; then
11840             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11841         else
11842            if test -e /usr/share/lib/java/junit.jar; then
11843               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11844            else
11845               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11846            fi
11847         fi
11848     else
11849         OOO_JUNIT_JAR=$with_junit
11850     fi
11851     if test "$_os" = "WINNT"; then
11852         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11853     fi
11854     printf 'import org.junit.Before;' > conftest.java
11855     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11856         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11857     else
11858         AC_MSG_ERROR(
11859 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11860  specify its pathname via --with-junit=..., or disable it via --without-junit])
11861     fi
11862     rm -f conftest.class conftest.java
11863     if test $OOO_JUNIT_JAR != ""; then
11864     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11865     fi
11867 AC_SUBST(OOO_JUNIT_JAR)
11869 HAMCREST_JAR=
11870 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11871     AC_MSG_CHECKING([for included Hamcrest])
11872     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11873     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11874         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11875     else
11876         AC_MSG_RESULT([Not included])
11877         AC_MSG_CHECKING([for standalone hamcrest jar.])
11878         if test "$with_hamcrest" = "yes"; then
11879             if test -e /usr/share/lib/java/hamcrest.jar; then
11880                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11881             elif test -e /usr/share/java/hamcrest/core.jar; then
11882                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11883             else
11884                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11885             fi
11886         else
11887             HAMCREST_JAR=$with_hamcrest
11888         fi
11889         if test "$_os" = "WINNT"; then
11890             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11891         fi
11892         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11893             AC_MSG_RESULT([$HAMCREST_JAR])
11894         else
11895             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),
11896                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11897         fi
11898     fi
11899     rm -f conftest.class conftest.java
11901 AC_SUBST(HAMCREST_JAR)
11904 AC_SUBST(SCPDEFS)
11907 # check for wget and curl
11909 WGET=
11910 CURL=
11912 if test "$enable_fetch_external" != "no"; then
11914 CURL=`which curl 2>/dev/null`
11916 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11917     # wget new enough?
11918     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11919     if test $? -eq 0; then
11920         WGET=$i
11921         break
11922     fi
11923 done
11925 if test -z "$WGET" -a -z "$CURL"; then
11926     AC_MSG_ERROR([neither wget nor curl found!])
11931 AC_SUBST(WGET)
11932 AC_SUBST(CURL)
11935 # check for sha256sum
11937 SHA256SUM=
11939 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11940     eval "$i -a 256 --version" > /dev/null 2>&1
11941     ret=$?
11942     if test $ret -eq 0; then
11943         SHA256SUM="$i -a 256"
11944         break
11945     fi
11946 done
11948 if test -z "$SHA256SUM"; then
11949     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11950         eval "$i --version" > /dev/null 2>&1
11951         ret=$?
11952         if test $ret -eq 0; then
11953             SHA256SUM=$i
11954             break
11955         fi
11956     done
11959 if test -z "$SHA256SUM"; then
11960     AC_MSG_ERROR([no sha256sum found!])
11963 AC_SUBST(SHA256SUM)
11965 dnl ===================================================================
11966 dnl Dealing with l10n options
11967 dnl ===================================================================
11968 AC_MSG_CHECKING([which languages to be built])
11969 # get list of all languages
11970 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11971 # the sed command does the following:
11972 #   + if a line ends with a backslash, append the next line to it
11973 #   + adds " on the beginning of the value (after =)
11974 #   + adds " at the end of the value
11975 #   + removes en-US; we want to put it on the beginning
11976 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11977 [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)]
11978 ALL_LANGS="en-US $completelangiso"
11979 # check the configured localizations
11980 WITH_LANG="$with_lang"
11982 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
11983 # (Norwegian is "nb" and "nn".)
11984 if test "$WITH_LANG" = "no"; then
11985     WITH_LANG=
11988 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11989     AC_MSG_RESULT([en-US])
11990 else
11991     AC_MSG_RESULT([$WITH_LANG])
11992     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11993     if test -z "$MSGFMT"; then
11994         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11995             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11996         elif test -x "/opt/lo/bin/msgfmt"; then
11997             MSGFMT="/opt/lo/bin/msgfmt"
11998         else
11999             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12000             if test -z "$MSGFMT"; then
12001                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12002             fi
12003         fi
12004     fi
12005     if test -z "$MSGUNIQ"; then
12006         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12007             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12008         elif test -x "/opt/lo/bin/msguniq"; then
12009             MSGUNIQ="/opt/lo/bin/msguniq"
12010         else
12011             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12012             if test -z "$MSGUNIQ"; then
12013                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12014             fi
12015         fi
12016     fi
12018 AC_SUBST(MSGFMT)
12019 AC_SUBST(MSGUNIQ)
12020 # check that the list is valid
12021 for lang in $WITH_LANG; do
12022     test "$lang" = "ALL" && continue
12023     # need to check for the exact string, so add space before and after the list of all languages
12024     for vl in $ALL_LANGS; do
12025         if test "$vl" = "$lang"; then
12026            break
12027         fi
12028     done
12029     if test "$vl" != "$lang"; then
12030         # if you're reading this - you prolly quoted your languages remove the quotes ...
12031         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12032     fi
12033 done
12034 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12035     echo $WITH_LANG | grep -q en-US
12036     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12038 # list with substituted ALL
12039 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12040 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12041 test "$WITH_LANG" = "en-US" && WITH_LANG=
12042 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12043     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12044     ALL_LANGS=`echo $ALL_LANGS qtz`
12046 AC_SUBST(ALL_LANGS)
12047 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12048 AC_SUBST(WITH_LANG)
12049 AC_SUBST(WITH_LANG_LIST)
12050 AC_SUBST(GIT_NEEDED_SUBMODULES)
12052 WITH_POOR_HELP_LOCALIZATIONS=
12053 if test -d "$SRC_ROOT/translations/source"; then
12054     for l in `ls -1 $SRC_ROOT/translations/source`; do
12055         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12056             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12057         fi
12058     done
12060 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12062 if test -n "$with_locales"; then
12063     WITH_LOCALES="$with_locales"
12065     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12066     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12067     # config_host/config_locales.h.in
12068     for locale in $WITH_LOCALES; do
12069         lang=${locale%_*}
12071         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12073         case $lang in
12074         hi|mr*ne)
12075             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12076             ;;
12077         bg|ru)
12078             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12079             ;;
12080         esac
12081     done
12082 else
12083     AC_DEFINE(WITH_LOCALE_ALL)
12085 AC_SUBST(WITH_LOCALES)
12087 dnl git submodule update --reference
12088 dnl ===================================================================
12089 if test -n "${GIT_REFERENCE_SRC}"; then
12090     for repo in ${GIT_NEEDED_SUBMODULES}; do
12091         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12092             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12093         fi
12094     done
12096 AC_SUBST(GIT_REFERENCE_SRC)
12098 dnl git submodules linked dirs
12099 dnl ===================================================================
12100 if test -n "${GIT_LINK_SRC}"; then
12101     for repo in ${GIT_NEEDED_SUBMODULES}; do
12102         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12103             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12104         fi
12105     done
12107 AC_SUBST(GIT_LINK_SRC)
12109 dnl branding
12110 dnl ===================================================================
12111 AC_MSG_CHECKING([for alternative branding images directory])
12112 # initialize mapped arrays
12113 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12114 brand_files="$BRAND_INTRO_IMAGES about.svg"
12116 if test -z "$with_branding" -o "$with_branding" = "no"; then
12117     AC_MSG_RESULT([none])
12118     DEFAULT_BRAND_IMAGES="$brand_files"
12119 else
12120     if ! test -d $with_branding ; then
12121         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12122     else
12123         AC_MSG_RESULT([$with_branding])
12124         CUSTOM_BRAND_DIR="$with_branding"
12125         for lfile in $brand_files
12126         do
12127             if ! test -f $with_branding/$lfile ; then
12128                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12129                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12130             else
12131                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12132             fi
12133         done
12134         check_for_progress="yes"
12135     fi
12137 AC_SUBST([BRAND_INTRO_IMAGES])
12138 AC_SUBST([CUSTOM_BRAND_DIR])
12139 AC_SUBST([CUSTOM_BRAND_IMAGES])
12140 AC_SUBST([DEFAULT_BRAND_IMAGES])
12143 AC_MSG_CHECKING([for 'intro' progress settings])
12144 PROGRESSBARCOLOR=
12145 PROGRESSSIZE=
12146 PROGRESSPOSITION=
12147 PROGRESSFRAMECOLOR=
12148 PROGRESSTEXTCOLOR=
12149 PROGRESSTEXTBASELINE=
12151 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12152     source "$with_branding/progress.conf"
12153     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12154 else
12155     AC_MSG_RESULT([none])
12158 AC_SUBST(PROGRESSBARCOLOR)
12159 AC_SUBST(PROGRESSSIZE)
12160 AC_SUBST(PROGRESSPOSITION)
12161 AC_SUBST(PROGRESSFRAMECOLOR)
12162 AC_SUBST(PROGRESSTEXTCOLOR)
12163 AC_SUBST(PROGRESSTEXTBASELINE)
12166 AC_MSG_CHECKING([for extra build ID])
12167 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12168     EXTRA_BUILDID="$with_extra_buildid"
12170 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12171 if test -n "$EXTRA_BUILDID" ; then
12172     AC_MSG_RESULT([$EXTRA_BUILDID])
12173 else
12174     AC_MSG_RESULT([not set])
12176 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12178 OOO_VENDOR=
12179 AC_MSG_CHECKING([for vendor])
12180 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12181     OOO_VENDOR="$USERNAME"
12183     if test -z "$OOO_VENDOR"; then
12184         OOO_VENDOR="$USER"
12185     fi
12187     if test -z "$OOO_VENDOR"; then
12188         OOO_VENDOR="`id -u -n`"
12189     fi
12191     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12192 else
12193     OOO_VENDOR="$with_vendor"
12194     AC_MSG_RESULT([$OOO_VENDOR])
12196 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12197 AC_SUBST(OOO_VENDOR)
12199 if test "$_os" = "Android" ; then
12200     ANDROID_PACKAGE_NAME=
12201     AC_MSG_CHECKING([for Android package name])
12202     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12203         if test -n "$ENABLE_DEBUG"; then
12204             # Default to the package name that makes ndk-gdb happy.
12205             ANDROID_PACKAGE_NAME="org.libreoffice"
12206         else
12207             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12208         fi
12210         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12211     else
12212         ANDROID_PACKAGE_NAME="$with_android_package_name"
12213         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12214     fi
12215     AC_SUBST(ANDROID_PACKAGE_NAME)
12218 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12219 if test "$with_compat_oowrappers" = "yes"; then
12220     WITH_COMPAT_OOWRAPPERS=TRUE
12221     AC_MSG_RESULT(yes)
12222 else
12223     WITH_COMPAT_OOWRAPPERS=
12224     AC_MSG_RESULT(no)
12226 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12228 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12229 AC_MSG_CHECKING([for install dirname])
12230 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12231     INSTALLDIRNAME="$with_install_dirname"
12233 AC_MSG_RESULT([$INSTALLDIRNAME])
12234 AC_SUBST(INSTALLDIRNAME)
12236 AC_MSG_CHECKING([for prefix])
12237 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12238 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12239 PREFIXDIR="$prefix"
12240 AC_MSG_RESULT([$PREFIXDIR])
12241 AC_SUBST(PREFIXDIR)
12243 LIBDIR=[$(eval echo $(eval echo $libdir))]
12244 AC_SUBST(LIBDIR)
12246 DATADIR=[$(eval echo $(eval echo $datadir))]
12247 AC_SUBST(DATADIR)
12249 MANDIR=[$(eval echo $(eval echo $mandir))]
12250 AC_SUBST(MANDIR)
12252 DOCDIR=[$(eval echo $(eval echo $docdir))]
12253 AC_SUBST(DOCDIR)
12255 BINDIR=[$(eval echo $(eval echo $bindir))]
12256 AC_SUBST(BINDIR)
12258 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12259 AC_SUBST(INSTALLDIR)
12261 TESTINSTALLDIR="${BUILDDIR}/test-install"
12262 AC_SUBST(TESTINSTALLDIR)
12265 # ===================================================================
12266 # OAuth2 id and secrets
12267 # ===================================================================
12269 AC_MSG_CHECKING([for Google Drive client id and secret])
12270 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12271     AC_MSG_RESULT([not set])
12272     GDRIVE_CLIENT_ID="\"\""
12273     GDRIVE_CLIENT_SECRET="\"\""
12274 else
12275     AC_MSG_RESULT([set])
12276     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12277     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12279 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12280 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12282 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12283 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12284     AC_MSG_RESULT([not set])
12285     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12286     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12287 else
12288     AC_MSG_RESULT([set])
12289     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12290     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12292 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12293 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12295 AC_MSG_CHECKING([for OneDrive client id and secret])
12296 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12297     AC_MSG_RESULT([not set])
12298     ONEDRIVE_CLIENT_ID="\"\""
12299     ONEDRIVE_CLIENT_SECRET="\"\""
12300 else
12301     AC_MSG_RESULT([set])
12302     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12303     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12305 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12306 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12309 dnl ===================================================================
12310 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12311 dnl --enable-dependency-tracking configure option
12312 dnl ===================================================================
12313 AC_MSG_CHECKING([whether to enable dependency tracking])
12314 if test "$enable_dependency_tracking" = "no"; then
12315     nodep=TRUE
12316     AC_MSG_RESULT([no])
12317 else
12318     AC_MSG_RESULT([yes])
12320 AC_SUBST(nodep)
12322 dnl ===================================================================
12323 dnl Number of CPUs to use during the build
12324 dnl ===================================================================
12325 AC_MSG_CHECKING([for number of processors to use])
12326 # plain --with-parallelism is just the default
12327 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12328     if test "$with_parallelism" = "no"; then
12329         PARALLELISM=0
12330     else
12331         PARALLELISM=$with_parallelism
12332     fi
12333 else
12334     if test "$enable_icecream" = "yes"; then
12335         PARALLELISM="10"
12336     else
12337         case `uname -s` in
12339         Darwin|FreeBSD|NetBSD|OpenBSD)
12340             PARALLELISM=`sysctl -n hw.ncpu`
12341             ;;
12343         Linux)
12344             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12345         ;;
12346         # what else than above does profit here *and* has /proc?
12347         *)
12348             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12349             ;;
12350         esac
12352         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12353         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12354     fi
12357 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12358     if test -z "$with_parallelism"; then
12359             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12360             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12361             PARALLELISM="1"
12362     else
12363         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."
12364     fi
12367 if test $PARALLELISM -eq 0; then
12368     AC_MSG_RESULT([explicit make -j option needed])
12369 else
12370     AC_MSG_RESULT([$PARALLELISM])
12372 AC_SUBST(PARALLELISM)
12374 IWYU_PATH="$with_iwyu"
12375 AC_SUBST(IWYU_PATH)
12376 if test ! -z "$IWYU_PATH"; then
12377     if test ! -f "$IWYU_PATH"; then
12378         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12379     fi
12383 # Set up ILIB for MSVC build
12385 ILIB1=
12386 if test "$build_os" = "cygwin"; then
12387     ILIB="."
12388     if test -n "$JAVA_HOME"; then
12389         ILIB="$ILIB;$JAVA_HOME/lib"
12390     fi
12391     ILIB1=-link
12392     if test "$BITNESS_OVERRIDE" = 64; then
12393         ILIB="$ILIB;$COMPATH/lib/x64"
12394         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12395         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12396         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12397         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12398             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12399             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12400         fi
12401         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12402         ucrtlibpath_formatted=$formatted_path
12403         ILIB="$ILIB;$ucrtlibpath_formatted"
12404         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12405     else
12406         ILIB="$ILIB;$COMPATH/lib/x86"
12407         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12408         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12409         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12410         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12411             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12412             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12413         fi
12414         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12415         ucrtlibpath_formatted=$formatted_path
12416         ILIB="$ILIB;$ucrtlibpath_formatted"
12417         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12418     fi
12419     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12420         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12421     else
12422         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12423     fi
12425     AC_SUBST(ILIB)
12428 # ===================================================================
12429 # Creating bigger shared library to link against
12430 # ===================================================================
12431 AC_MSG_CHECKING([whether to create huge library])
12432 MERGELIBS=
12434 if test $_os = iOS -o $_os = Android; then
12435     # Never any point in mergelibs for these as we build just static
12436     # libraries anyway...
12437     enable_mergelibs=no
12440 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12441     if test $_os != Linux -a $_os != WINNT; then
12442         add_warning "--enable-mergelibs is not tested for this platform"
12443     fi
12444     MERGELIBS="TRUE"
12445     AC_MSG_RESULT([yes])
12446 else
12447     AC_MSG_RESULT([no])
12449 AC_SUBST([MERGELIBS])
12451 dnl ===================================================================
12452 dnl icerun is a wrapper that stops us spawning tens of processes
12453 dnl locally - for tools that can't be executed on the compile cluster
12454 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12455 dnl ===================================================================
12456 AC_MSG_CHECKING([whether to use icerun wrapper])
12457 ICECREAM_RUN=
12458 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12459     ICECREAM_RUN=icerun
12460     AC_MSG_RESULT([yes])
12461 else
12462     AC_MSG_RESULT([no])
12464 AC_SUBST(ICECREAM_RUN)
12466 dnl ===================================================================
12467 dnl Setup the ICECC_VERSION for the build the same way it was set for
12468 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12469 dnl ===================================================================
12470 x_ICECC_VERSION=[\#]
12471 if test -n "$ICECC_VERSION" ; then
12472     x_ICECC_VERSION=
12474 AC_SUBST(x_ICECC_VERSION)
12475 AC_SUBST(ICECC_VERSION)
12477 dnl ===================================================================
12479 AC_MSG_CHECKING([MPL subset])
12480 MPL_SUBSET=
12482 if test "$enable_mpl_subset" = "yes"; then
12483     warn_report=false
12484     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12485         warn_report=true
12486     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12487         warn_report=true
12488     fi
12489     if test "$warn_report" = "true"; then
12490         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12491     fi
12492     if test "x$enable_postgresql_sdbc" != "xno"; then
12493         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12494     fi
12495     if test "$enable_lotuswordpro" = "yes"; then
12496         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12497     fi
12498     if test "$WITH_WEBDAV" = "neon"; then
12499         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12500     fi
12501     if test -n "$ENABLE_POPPLER"; then
12502         if test "x$SYSTEM_POPPLER" = "x"; then
12503             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12504         fi
12505     fi
12506     # cf. m4/libo_check_extension.m4
12507     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12508         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12509     fi
12510     for theme in $WITH_THEMES; do
12511         case $theme in
12512         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12513             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12514         *) : ;;
12515         esac
12516     done
12518     ENABLE_OPENGL_TRANSITIONS=
12520     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12521         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12522     fi
12524     MPL_SUBSET="TRUE"
12525     AC_DEFINE(MPL_HAVE_SUBSET)
12526     AC_MSG_RESULT([only])
12527 else
12528     AC_MSG_RESULT([no restrictions])
12530 AC_SUBST(MPL_SUBSET)
12532 dnl ===================================================================
12534 AC_MSG_CHECKING([formula logger])
12535 ENABLE_FORMULA_LOGGER=
12537 if test "x$enable_formula_logger" = "xyes"; then
12538     AC_MSG_RESULT([yes])
12539     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12540     ENABLE_FORMULA_LOGGER=TRUE
12541 elif test -n "$ENABLE_DBGUTIL" ; then
12542     AC_MSG_RESULT([yes])
12543     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12544     ENABLE_FORMULA_LOGGER=TRUE
12545 else
12546     AC_MSG_RESULT([no])
12549 AC_SUBST(ENABLE_FORMULA_LOGGER)
12551 dnl ===================================================================
12552 dnl Setting up the environment.
12553 dnl ===================================================================
12554 AC_MSG_NOTICE([setting up the build environment variables...])
12556 AC_SUBST(COMPATH)
12558 if test "$build_os" = "cygwin"; then
12559     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12560         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12561         ATL_INCLUDE="$COMPATH/atlmfc/include"
12562     elif test -d "$COMPATH/atlmfc/lib"; then
12563         ATL_LIB="$COMPATH/atlmfc/lib"
12564         ATL_INCLUDE="$COMPATH/atlmfc/include"
12565     else
12566         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12567         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12568     fi
12569     if test "$BITNESS_OVERRIDE" = 64; then
12570         ATL_LIB="$ATL_LIB/x64"
12571     else
12572         ATL_LIB="$ATL_LIB/x86"
12573     fi
12574     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12575     PathFormat "/usr/bin/find.exe"
12576     FIND="$formatted_path"
12577     PathFormat "/usr/bin/sort.exe"
12578     SORT="$formatted_path"
12579     PathFormat "/usr/bin/grep.exe"
12580     WIN_GREP="$formatted_path"
12581     PathFormat "/usr/bin/ls.exe"
12582     WIN_LS="$formatted_path"
12583     PathFormat "/usr/bin/touch.exe"
12584     WIN_TOUCH="$formatted_path"
12585 else
12586     FIND=find
12587     SORT=sort
12590 AC_SUBST(ATL_INCLUDE)
12591 AC_SUBST(ATL_LIB)
12592 AC_SUBST(FIND)
12593 AC_SUBST(SORT)
12594 AC_SUBST(WIN_GREP)
12595 AC_SUBST(WIN_LS)
12596 AC_SUBST(WIN_TOUCH)
12598 AC_SUBST(BUILD_TYPE)
12600 AC_SUBST(SOLARINC)
12602 PathFormat "$PERL"
12603 PERL="$formatted_path"
12604 AC_SUBST(PERL)
12606 if test -n "$TMPDIR"; then
12607     TEMP_DIRECTORY="$TMPDIR"
12608 else
12609     TEMP_DIRECTORY="/tmp"
12611 if test "$build_os" = "cygwin"; then
12612     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12614 AC_SUBST(TEMP_DIRECTORY)
12616 # setup the PATH for the environment
12617 if test -n "$LO_PATH_FOR_BUILD"; then
12618     LO_PATH="$LO_PATH_FOR_BUILD"
12619 else
12620     LO_PATH="$PATH"
12622     case "$host_os" in
12624     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12625         if test "$ENABLE_JAVA" != ""; then
12626             pathmunge "$JAVA_HOME/bin" "after"
12627         fi
12628         ;;
12630     cygwin*)
12631         # Win32 make needs native paths
12632         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12633             LO_PATH=`cygpath -p -m "$PATH"`
12634         fi
12635         if test "$BITNESS_OVERRIDE" = 64; then
12636             # needed for msi packaging
12637             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12638         fi
12639         # .NET 4.6 and higher don't have bin directory
12640         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12641             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12642         fi
12643         pathmunge "$ASM_HOME" "before"
12644         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12645         pathmunge "$CSC_PATH" "before"
12646         pathmunge "$MIDL_PATH" "before"
12647         pathmunge "$AL_PATH" "before"
12648         pathmunge "$MSPDB_PATH" "before"
12649         if test -n "$MSBUILD_PATH" ; then
12650             pathmunge "$MSBUILD_PATH" "before"
12651         fi
12652         if test "$BITNESS_OVERRIDE" = 64; then
12653             pathmunge "$COMPATH/bin/amd64" "before"
12654             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12655         else
12656             pathmunge "$COMPATH/bin" "before"
12657             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12658         fi
12659         if test "$ENABLE_JAVA" != ""; then
12660             if test -d "$JAVA_HOME/jre/bin/client"; then
12661                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12662             fi
12663             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12664                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12665             fi
12666             pathmunge "$JAVA_HOME/bin" "before"
12667         fi
12668         ;;
12670     solaris*)
12671         pathmunge "/usr/css/bin" "before"
12672         if test "$ENABLE_JAVA" != ""; then
12673             pathmunge "$JAVA_HOME/bin" "after"
12674         fi
12675         ;;
12676     esac
12679 AC_SUBST(LO_PATH)
12681 libo_FUZZ_SUMMARY
12683 # Generate a configuration sha256 we can use for deps
12684 if test -f config_host.mk; then
12685     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12687 if test -f config_host_lang.mk; then
12688     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12691 CFLAGS=$my_original_CFLAGS
12692 CXXFLAGS=$my_original_CXXFLAGS
12693 CPPFLAGS=$my_original_CPPFLAGS
12695 AC_CONFIG_FILES([config_host.mk
12696                  config_host_lang.mk
12697                  Makefile
12698                  bin/bffvalidator.sh
12699                  bin/odfvalidator.sh
12700                  bin/officeotron.sh
12701                  instsetoo_native/util/openoffice.lst
12702                  sysui/desktop/macosx/Info.plist])
12703 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12704 AC_CONFIG_HEADERS([config_host/config_clang.h])
12705 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12706 AC_CONFIG_HEADERS([config_host/config_eot.h])
12707 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12708 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12709 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12710 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12711 AC_CONFIG_HEADERS([config_host/config_features.h])
12712 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12713 AC_CONFIG_HEADERS([config_host/config_folders.h])
12714 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12715 AC_CONFIG_HEADERS([config_host/config_gio.h])
12716 AC_CONFIG_HEADERS([config_host/config_global.h])
12717 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12718 AC_CONFIG_HEADERS([config_host/config_java.h])
12719 AC_CONFIG_HEADERS([config_host/config_langs.h])
12720 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12721 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12722 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12723 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12724 AC_CONFIG_HEADERS([config_host/config_locales.h])
12725 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12726 AC_CONFIG_HEADERS([config_host/config_oox.h])
12727 AC_CONFIG_HEADERS([config_host/config_options.h])
12728 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12729 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12730 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12731 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12732 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12733 AC_CONFIG_HEADERS([config_host/config_version.h])
12734 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12735 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12736 AC_CONFIG_HEADERS([config_host/config_python.h])
12737 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12738 AC_OUTPUT
12740 if test "$CROSS_COMPILING" = TRUE; then
12741     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12744 # touch the config timestamp file
12745 if test ! -f config_host.mk.stamp; then
12746     echo > config_host.mk.stamp
12747 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12748     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12749 else
12750     echo > config_host.mk.stamp
12753 # touch the config lang timestamp file
12754 if test ! -f config_host_lang.mk.stamp; then
12755     echo > config_host_lang.mk.stamp
12756 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12757     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12758 else
12759     echo > config_host_lang.mk.stamp
12763 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12765 cat << _EOS
12766 ****************************************************************************
12767 WARNING:
12768 Your make version is known to be horribly slow, and hard to debug
12769 problems with. To get a reasonably functional make please do:
12771 to install a pre-compiled binary make for Win32
12773  mkdir -p /opt/lo/bin
12774  cd /opt/lo/bin
12775  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12776  cp make-4.2.1-msvc.exe make
12777  chmod +x make
12779 to install from source:
12780 place yourself in a working directory of you choice.
12782  git clone git://git.savannah.gnu.org/make.git
12784  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12785  set PATH=%PATH%;C:\Cygwin\bin
12786  [or Cygwin64, if that is what you have]
12787  cd path-to-make-repo-you-cloned-above
12788  build_w32.bat --without-guile
12790 should result in a WinRel/gnumake.exe.
12791 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12793 Then re-run autogen.sh
12795 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12796 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12798 _EOS
12801 cat << _EOF
12802 ****************************************************************************
12804 To build, run:
12805 $GNUMAKE
12807 To view some help, run:
12808 $GNUMAKE help
12810 _EOF
12812 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12813     cat << _EOF
12814 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12815 _EOF
12817     if test $_os = Darwin; then
12818         echo open instdir/$PRODUCTNAME.app
12819     else
12820         echo instdir/program/soffice
12821     fi
12822     cat << _EOF
12824 If you want to run the smoketest, run:
12825 $GNUMAKE check
12827 _EOF
12830 if test -f warn; then
12831     cat warn
12832     rm warn
12835 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: