update credits
[LibreOffice.git] / configure.ac
blob1b723d6e824deedd7795d705dda3385730652505
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([Collabora Office],[6.4.10.3],[],[],[https://collaboraoffice.com/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
188     PRODUCTNAME=AC_PACKAGE_NAME
190 AC_MSG_RESULT([$PRODUCTNAME])
191 AC_SUBST(PRODUCTNAME)
192 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
193 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
195 dnl ===================================================================
196 dnl Our version is defined by the AC_INIT() at the top of this script.
197 dnl ===================================================================
199 AC_MSG_CHECKING([for package version])
200 if test -n "$with_package_version" -a "$with_package_version" != no; then
201     PACKAGE_VERSION="$with_package_version"
203 AC_MSG_RESULT([$PACKAGE_VERSION])
205 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
207 LIBO_VERSION_MAJOR=$1
208 LIBO_VERSION_MINOR=$2
209 LIBO_VERSION_MICRO=$3
210 LIBO_VERSION_PATCH=$4
212 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
213 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
214 # no way to encode that into an integer in general.
215 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
217 LIBO_VERSION_SUFFIX=$5
218 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
219 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
220 # they get undoubled before actually passed to sed.
221 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
222 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
223 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
224 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
226 AC_SUBST(LIBO_VERSION_MAJOR)
227 AC_SUBST(LIBO_VERSION_MINOR)
228 AC_SUBST(LIBO_VERSION_MICRO)
229 AC_SUBST(LIBO_VERSION_PATCH)
230 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
231 AC_SUBST(LIBO_VERSION_SUFFIX)
232 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
237 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
239 LIBO_THIS_YEAR=`date +%Y`
240 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
242 dnl ===================================================================
243 dnl Product version
244 dnl ===================================================================
245 AC_MSG_CHECKING([for product version])
246 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
247 AC_MSG_RESULT([$PRODUCTVERSION])
248 AC_SUBST(PRODUCTVERSION)
250 AC_PROG_EGREP
251 # AC_PROG_EGREP doesn't set GREP on all systems as well
252 AC_PATH_PROG(GREP, grep)
254 BUILDDIR=`pwd`
255 cd $srcdir
256 SRC_ROOT=`pwd`
257 cd $BUILDDIR
258 x_Cygwin=[\#]
260 dnl ======================================
261 dnl Required GObject introspection version
262 dnl ======================================
263 INTROSPECTION_REQUIRED_VERSION=1.32.0
265 dnl ===================================================================
266 dnl Search all the common names for GNU Make
267 dnl ===================================================================
268 AC_MSG_CHECKING([for GNU Make])
270 # try to use our own make if it is available and GNUMAKE was not already defined
271 if test -z "$GNUMAKE"; then
272     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
273         GNUMAKE="$LODE_HOME/opt/bin/make"
274     elif test -x "/opt/lo/bin/make"; then
275         GNUMAKE="/opt/lo/bin/make"
276     fi
279 GNUMAKE_WIN_NATIVE=
280 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
281     if test -n "$a"; then
282         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
283         if test $? -eq 0;  then
284             if test "$build_os" = "cygwin"; then
285                 if test -n "$($a -v | grep 'Built for Windows')" ; then
286                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
287                     GNUMAKE_WIN_NATIVE="TRUE"
288                 else
289                     GNUMAKE=`which $a`
290                 fi
291             else
292                 GNUMAKE=`which $a`
293             fi
294             break
295         fi
296     fi
297 done
298 AC_MSG_RESULT($GNUMAKE)
299 if test -z "$GNUMAKE"; then
300     AC_MSG_ERROR([not found. install GNU Make.])
301 else
302     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
303         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
304     fi
307 win_short_path_for_make()
309     local_short_path="$1"
310     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
311         cygpath -sm "$local_short_path"
312     else
313         cygpath -u "$(cygpath -d "$local_short_path")"
314     fi
318 if test "$build_os" = "cygwin"; then
319     PathFormat "$SRC_ROOT"
320     SRC_ROOT="$formatted_path"
321     PathFormat "$BUILDDIR"
322     BUILDDIR="$formatted_path"
323     x_Cygwin=
324     AC_MSG_CHECKING(for explicit COMSPEC)
325     if test -z "$COMSPEC"; then
326         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
327     else
328         AC_MSG_RESULT([found: $COMSPEC])
329     fi
332 AC_SUBST(SRC_ROOT)
333 AC_SUBST(BUILDDIR)
334 AC_SUBST(x_Cygwin)
335 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
336 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
337 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
339 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
340     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
343 # need sed in os checks...
344 AC_PATH_PROGS(SED, sed)
345 if test -z "$SED"; then
346     AC_MSG_ERROR([install sed to run this script])
349 # Set the ENABLE_LTO variable
350 # ===================================================================
351 AC_MSG_CHECKING([whether to use link-time optimization])
352 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
353     ENABLE_LTO="TRUE"
354     AC_MSG_RESULT([yes])
355     AC_DEFINE(STATIC_LINKING)
356 else
357     ENABLE_LTO=""
358     AC_MSG_RESULT([no])
360 AC_SUBST(ENABLE_LTO)
362 AC_ARG_ENABLE(fuzz-options,
363     AS_HELP_STRING([--enable-fuzz-options],
364         [Randomly enable or disable each of those configurable options
365          that are supposed to be freely selectable without interdependencies,
366          or where bad interaction from interdependencies is automatically avoided.])
369 dnl ===================================================================
370 dnl When building for Android, --with-android-ndk,
371 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
372 dnl mandatory
373 dnl ===================================================================
375 AC_ARG_WITH(android-ndk,
376     AS_HELP_STRING([--with-android-ndk],
377         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
380 AC_ARG_WITH(android-ndk-toolchain-version,
381     AS_HELP_STRING([--with-android-ndk-toolchain-version],
382         [Specify which toolchain version to use, of those present in the
383         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
384         with_android_ndk_toolchain_version=clang5.0)
386 AC_ARG_WITH(android-sdk,
387     AS_HELP_STRING([--with-android-sdk],
388         [Specify location of the Android SDK. Mandatory when building for Android.]),
391 AC_ARG_WITH(android-api-level,
392     AS_HELP_STRING([--with-android-api-level],
393         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
396 ANDROID_NDK_HOME=
397 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
398     with_android_ndk="$SRC_ROOT/external/android-ndk"
400 if test -n "$with_android_ndk"; then
401     eval ANDROID_NDK_HOME=$with_android_ndk
403     # Set up a lot of pre-canned defaults
405     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
406         if test ! -f $ANDROID_NDK_HOME/source.properties; then
407             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
408         fi
409         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
410     else
411         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
412     fi
413     if test -z "$ANDROID_NDK_VERSION";  then
414         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
415     fi
416     case $ANDROID_NDK_VERSION in
417     r9*|r10*)
418         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
419         ;;
420     11.1.*|12.1.*|13.1.*|14.1.*)
421         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
422         ;;
423     16.*|17.*|18.*|19.*|20.*)
424         ;;
425     *)
426         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
427         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
428         ;;
429     esac
431     ANDROID_API_LEVEL=16
432     if test -n "$with_android_api_level" ; then
433         ANDROID_API_LEVEL="$with_android_api_level"
434     fi
436     android_cpu=$host_cpu
437     if test $host_cpu = arm; then
438         android_platform_prefix=arm-linux-androideabi
439         android_gnu_prefix=$android_platform_prefix
440         LLVM_TRIPLE=armv7a-linux-androideabi
441         ANDROID_APP_ABI=armeabi-v7a
442         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
443     elif test $host_cpu = aarch64; then
444         android_platform_prefix=aarch64-linux-android
445         android_gnu_prefix=$android_platform_prefix
446         LLVM_TRIPLE=$android_platform_prefix
447         # minimum android version that supports aarch64
448         if test "$ANDROID_API_LEVEL" -lt "21" ; then
449             ANDROID_API_LEVEL=21
450         fi
451         ANDROID_APP_ABI=arm64-v8a
452     elif test $host_cpu = x86_64; then
453         android_platform_prefix=x86_64-linux-android
454         android_gnu_prefix=$android_platform_prefix
455         LLVM_TRIPLE=$android_platform_prefix
456         # minimum android version that supports x86_64
457         ANDROID_API_LEVEL=21
458         ANDROID_APP_ABI=x86_64
459     else
460         # host_cpu is something like "i386" or "i686" I guess, NDK uses
461         # "x86" in some contexts
462         android_cpu=x86
463         android_platform_prefix=$android_cpu
464         android_gnu_prefix=i686-linux-android
465         LLVM_TRIPLE=$android_gnu_prefix
466         ANDROID_APP_ABI=x86
467     fi
469     case "$with_android_ndk_toolchain_version" in
470     clang5.0)
471         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
472         ;;
473     *)
474         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
475     esac
477     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
479     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
480     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
481     # manage to link the (app-specific) single huge .so that is built for the app in
482     # android/source/ if there is debug information in a significant part of the object files.
483     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
484     # all objects have been built with debug information.)
485     case $build_os in
486     linux-gnu*)
487         android_HOST_TAG=linux-x86_64
488         ;;
489     darwin*)
490         android_HOST_TAG=darwin-x86_64
491         ;;
492     *)
493         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
494         # ndk would also support windows and windows-x86_64
495         ;;
496     esac
497     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
498     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
499     dnl TODO: NSS build uses it...
500     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
501     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
503     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
504     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
505     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
506     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
507     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
510     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
511     if test "$ENABLE_LTO" = TRUE; then
512         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
513         # $CC and $CXX when building external libraries
514         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
515     fi
517     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
519     if test -z "$CC"; then
520         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
521         CC_BASE="clang"
522     fi
523     if test -z "$CXX"; then
524         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
525         CXX_BASE="clang++"
526     fi
528     # remember to download the ownCloud Android library later
529     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
531 AC_SUBST(ANDROID_NDK_HOME)
532 AC_SUBST(ANDROID_APP_ABI)
533 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
535 dnl ===================================================================
536 dnl --with-android-sdk
537 dnl ===================================================================
538 ANDROID_SDK_HOME=
539 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
540     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
542 if test -n "$with_android_sdk"; then
543     eval ANDROID_SDK_HOME=$with_android_sdk
544     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
546 AC_SUBST(ANDROID_SDK_HOME)
548 AC_ARG_ENABLE([android-lok],
549     AS_HELP_STRING([--enable-android-lok],
550         [The Android app from the android/ subdir needs several tweaks all
551          over the place that break the LOK when used in the Online-based
552          Android app.  This switch indicates that the intent of this build is
553          actually the Online-based, non-modified LOK.])
555 ENABLE_ANDROID_LOK=
556 if test -n "$ANDROID_NDK_HOME" ; then
557     if test "$enable_android_lok" = yes; then
558         ENABLE_ANDROID_LOK=TRUE
559         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
560         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
561     else
562         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
563     fi
565 AC_SUBST([ENABLE_ANDROID_LOK])
567 libo_FUZZ_ARG_ENABLE([android-editing],
568     AS_HELP_STRING([--enable-android-editing],
569         [Enable the experimental editing feature on Android.])
571 ENABLE_ANDROID_EDITING=
572 if test "$enable_android_editing" = yes; then
573     ENABLE_ANDROID_EDITING=TRUE
575 AC_SUBST([ENABLE_ANDROID_EDITING])
577 dnl ===================================================================
578 dnl The following is a list of supported systems.
579 dnl Sequential to keep the logic very simple
580 dnl These values may be checked and reset later.
581 dnl ===================================================================
582 #defaults unless the os test overrides this:
583 test_randr=yes
584 test_xrender=yes
585 test_cups=yes
586 test_dbus=yes
587 test_fontconfig=yes
588 test_cairo=no
589 test_gdb_index=no
590 test_split_debug=no
592 # Default values, as such probably valid just for Linux, set
593 # differently below just for Mac OSX, but at least better than
594 # hardcoding these as we used to do. Much of this is duplicated also
595 # in solenv for old build system and for gbuild, ideally we should
596 # perhaps define stuff like this only here in configure.ac?
598 LINKFLAGSSHL="-shared"
599 PICSWITCH="-fpic"
600 DLLPOST=".so"
602 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
604 INSTROOTBASESUFFIX=
605 INSTROOTCONTENTSUFFIX=
606 SDKDIRNAME=sdk
608 case "$host_os" in
610 solaris*)
611     build_gstreamer_1_0=yes
612     test_freetype=yes
613     _os=SunOS
615     dnl ===========================================================
616     dnl Check whether we're using Solaris 10 - SPARC or Intel.
617     dnl ===========================================================
618     AC_MSG_CHECKING([the Solaris operating system release])
619     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
620     if test "$_os_release" -lt "10"; then
621         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
622     else
623         AC_MSG_RESULT([ok ($_os_release)])
624     fi
626     dnl Check whether we're using a SPARC or i386 processor
627     AC_MSG_CHECKING([the processor type])
628     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
629         AC_MSG_RESULT([ok ($host_cpu)])
630     else
631         AC_MSG_ERROR([only SPARC and i386 processors are supported])
632     fi
633     ;;
635 linux-gnu*|k*bsd*-gnu*)
636     build_gstreamer_1_0=yes
637     test_kf5=yes
638     test_gtk3_kde5=yes
639     test_gdb_index=yes
640     test_split_debug=yes
641     if test "$enable_fuzzers" != yes; then
642         test_freetype=yes
643         test_fontconfig=yes
644     else
645         test_freetype=no
646         test_fontconfig=no
647         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
648     fi
649     _os=Linux
650     ;;
652 gnu)
653     test_randr=no
654     test_xrender=no
655     _os=GNU
656      ;;
658 cygwin*|interix*)
660     # When building on Windows normally with MSVC under Cygwin,
661     # configure thinks that the host platform (the platform the
662     # built code will run on) is Cygwin, even if it obviously is
663     # Windows, which in Autoconf terminology is called
664     # "mingw32". (Which is misleading as MinGW is the name of the
665     # tool-chain, not an operating system.)
667     # Somewhat confusing, yes. But this configure script doesn't
668     # look at $host etc that much, it mostly uses its own $_os
669     # variable, set here in this case statement.
671     test_cups=no
672     test_dbus=no
673     test_randr=no
674     test_xrender=no
675     test_freetype=no
676     test_fontconfig=no
677     _os=WINNT
679     DLLPOST=".dll"
680     LINKFLAGSNOUNDEFS=
681     ;;
683 darwin*) # macOS or iOS
684     test_randr=no
685     test_xrender=no
686     test_freetype=no
687     test_fontconfig=no
688     test_dbus=no
689     if test -n "$LODE_HOME" ; then
690         mac_sanitize_path
691         AC_MSG_NOTICE([sanitized the PATH to $PATH])
692     fi
693     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
694         build_for_ios=YES
695         _os=iOS
696         test_cups=no
697         enable_mpl_subset=yes
698         enable_lotuswordpro=no
699         enable_coinmp=no
700         enable_lpsolve=no
701         enable_postgresql_sdbc=no
702         enable_extension_integration=no
703         enable_report_builder=no
704         with_ppds=no
705         if test "$enable_ios_simulator" = "yes"; then
706             host=x86_64-apple-darwin
707         fi
708     else
709         _os=Darwin
710         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
711         INSTROOTCONTENTSUFFIX=/Contents
712         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
713     fi
714     # See comment above the case "$host_os"
715     LINKFLAGSSHL="-dynamiclib -single_module"
717     # -fPIC is default
718     PICSWITCH=""
720     DLLPOST=".dylib"
722     # -undefined error is the default
723     LINKFLAGSNOUNDEFS=""
726 freebsd*)
727     build_gstreamer_1_0=yes
728     test_kf5=yes
729     test_gtk3_kde5=yes
730     test_freetype=yes
731     AC_MSG_CHECKING([the FreeBSD operating system release])
732     if test -n "$with_os_version"; then
733         OSVERSION="$with_os_version"
734     else
735         OSVERSION=`/sbin/sysctl -n kern.osreldate`
736     fi
737     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
738     AC_MSG_CHECKING([which thread library to use])
739     if test "$OSVERSION" -lt "500016"; then
740         PTHREAD_CFLAGS="-D_THREAD_SAFE"
741         PTHREAD_LIBS="-pthread"
742     elif test "$OSVERSION" -lt "502102"; then
743         PTHREAD_CFLAGS="-D_THREAD_SAFE"
744         PTHREAD_LIBS="-lc_r"
745     else
746         PTHREAD_CFLAGS=""
747         PTHREAD_LIBS="-pthread"
748     fi
749     AC_MSG_RESULT([$PTHREAD_LIBS])
750     _os=FreeBSD
751     ;;
753 *netbsd*)
754     build_gstreamer_1_0=yes
755     test_kf5=yes
756     test_gtk3_kde5=yes
757     test_freetype=yes
758     PTHREAD_LIBS="-pthread -lpthread"
759     _os=NetBSD
760     ;;
762 aix*)
763     test_randr=no
764     test_freetype=yes
765     PTHREAD_LIBS=-pthread
766     _os=AIX
767     ;;
769 openbsd*)
770     test_freetype=yes
771     PTHREAD_CFLAGS="-D_THREAD_SAFE"
772     PTHREAD_LIBS="-pthread"
773     _os=OpenBSD
774     ;;
776 dragonfly*)
777     build_gstreamer_1_0=yes
778     test_kf5=yes
779     test_gtk3_kde5=yes
780     test_freetype=yes
781     PTHREAD_LIBS="-pthread"
782     _os=DragonFly
783     ;;
785 linux-android*)
786     build_gstreamer_1_0=no
787     enable_lotuswordpro=no
788     enable_mpl_subset=yes
789     enable_coinmp=yes
790     enable_lpsolve=no
791     enable_report_builder=no
792     enable_odk=no
793     enable_postgresql_sdbc=no
794     enable_python=no
795     test_cups=no
796     test_dbus=no
797     test_fontconfig=no
798     test_freetype=no
799     test_kf5=no
800     test_qt5=no
801     test_gtk3_kde5=no
802     test_randr=no
803     test_xrender=no
804     _os=Android
806     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
807     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
808     ;;
810 haiku*)
811     test_cups=no
812     test_dbus=no
813     test_randr=no
814     test_xrender=no
815     test_freetype=yes
816     enable_odk=no
817     enable_gstreamer_1_0=no
818     enable_vlc=no
819     enable_coinmp=no
820     enable_pdfium=no
821     enable_sdremote=no
822     enable_postgresql_sdbc=no
823     enable_firebird_sdbc=no
824     _os=Haiku
825     ;;
828     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
829     ;;
830 esac
832 if test "$_os" = "Android" ; then
833     # Verify that the NDK and SDK options are proper
834     if test -z "$with_android_ndk"; then
835         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
836     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
837         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
838     fi
840     if test -z "$ANDROID_SDK_HOME"; then
841         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
842     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
843         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
844     fi
846     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
847     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
848         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
849                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
850                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
851         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
852         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
853         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
854     fi
855     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
856         AC_MSG_WARN([android support repository not found - install with
857                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
858                      to allow the build to download the specified version of the android support libraries])
859         add_warning "android support repository not found - install with"
860         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
861         add_warning "to allow the build to download the specified version of the android support libraries"
862     fi
865 if test "$_os" = "AIX"; then
866     AC_PATH_PROG(GAWK, gawk)
867     if test -z "$GAWK"; then
868         AC_MSG_ERROR([gawk not found in \$PATH])
869     fi
872 AC_SUBST(SDKDIRNAME)
874 AC_SUBST(PTHREAD_CFLAGS)
875 AC_SUBST(PTHREAD_LIBS)
877 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
878 # By default use the ones specified by our build system,
879 # but explicit override is possible.
880 AC_MSG_CHECKING(for explicit AFLAGS)
881 if test -n "$AFLAGS"; then
882     AC_MSG_RESULT([$AFLAGS])
883     x_AFLAGS=
884 else
885     AC_MSG_RESULT(no)
886     x_AFLAGS=[\#]
888 AC_MSG_CHECKING(for explicit CFLAGS)
889 if test -n "$CFLAGS"; then
890     AC_MSG_RESULT([$CFLAGS])
891     x_CFLAGS=
892 else
893     AC_MSG_RESULT(no)
894     x_CFLAGS=[\#]
896 AC_MSG_CHECKING(for explicit CXXFLAGS)
897 if test -n "$CXXFLAGS"; then
898     AC_MSG_RESULT([$CXXFLAGS])
899     x_CXXFLAGS=
900 else
901     AC_MSG_RESULT(no)
902     x_CXXFLAGS=[\#]
904 AC_MSG_CHECKING(for explicit OBJCFLAGS)
905 if test -n "$OBJCFLAGS"; then
906     AC_MSG_RESULT([$OBJCFLAGS])
907     x_OBJCFLAGS=
908 else
909     AC_MSG_RESULT(no)
910     x_OBJCFLAGS=[\#]
912 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
913 if test -n "$OBJCXXFLAGS"; then
914     AC_MSG_RESULT([$OBJCXXFLAGS])
915     x_OBJCXXFLAGS=
916 else
917     AC_MSG_RESULT(no)
918     x_OBJCXXFLAGS=[\#]
920 AC_MSG_CHECKING(for explicit LDFLAGS)
921 if test -n "$LDFLAGS"; then
922     AC_MSG_RESULT([$LDFLAGS])
923     x_LDFLAGS=
924 else
925     AC_MSG_RESULT(no)
926     x_LDFLAGS=[\#]
928 AC_SUBST(AFLAGS)
929 AC_SUBST(CFLAGS)
930 AC_SUBST(CXXFLAGS)
931 AC_SUBST(OBJCFLAGS)
932 AC_SUBST(OBJCXXFLAGS)
933 AC_SUBST(LDFLAGS)
934 AC_SUBST(x_AFLAGS)
935 AC_SUBST(x_CFLAGS)
936 AC_SUBST(x_CXXFLAGS)
937 AC_SUBST(x_OBJCFLAGS)
938 AC_SUBST(x_OBJCXXFLAGS)
939 AC_SUBST(x_LDFLAGS)
941 dnl These are potentially set for MSVC, in the code checking for UCRT below:
942 my_original_CFLAGS=$CFLAGS
943 my_original_CXXFLAGS=$CXXFLAGS
944 my_original_CPPFLAGS=$CPPFLAGS
946 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
947 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
948 dnl AC_PROG_CC internally.
949 if test "$_os" != "WINNT"; then
950     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
951     save_CFLAGS=$CFLAGS
952     AC_PROG_CC
953     CFLAGS=$save_CFLAGS
954     if test -z "$CC_BASE"; then
955         CC_BASE=`first_arg_basename "$CC"`
956     fi
959 if test "$_os" != "WINNT"; then
960     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
961 else
962     ENDIANNESS=little
964 AC_SUBST(ENDIANNESS)
966 if test $_os != "WINNT"; then
967     save_LIBS="$LIBS"
968     AC_SEARCH_LIBS([dlsym], [dl],
969         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
970         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
971     LIBS="$save_LIBS"
973 AC_SUBST(DLOPEN_LIBS)
975 AC_ARG_ENABLE(ios-simulator,
976     AS_HELP_STRING([--enable-ios-simulator],
977         [build i386 or x86_64 for ios simulator])
980 AC_ARG_ENABLE(ios-libreofficelight-app,
981     AS_HELP_STRING([--enable-ios-libreofficelight-app],
982         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
983          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
984          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
987 ENABLE_IOS_LIBREOFFICELIGHT_APP=
988 if test "$enable_ios_libreofficelight_app" = yes; then
989     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
991 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
993 ###############################################################################
994 # Extensions switches --enable/--disable
995 ###############################################################################
996 # By default these should be enabled unless having extra dependencies.
997 # If there is extra dependency over configure options then the enable should
998 # be automagic based on whether the requiring feature is enabled or not.
999 # All this options change anything only with --enable-extension-integration.
1001 # The name of this option and its help string makes it sound as if
1002 # extensions are built anyway, just not integrated in the installer,
1003 # if you use --disable-extension-integration. Is that really the
1004 # case?
1006 libo_FUZZ_ARG_ENABLE(extension-integration,
1007     AS_HELP_STRING([--disable-extension-integration],
1008         [Disable integration of the built extensions in the installer of the
1009          product. Use this switch to disable the integration.])
1012 AC_ARG_ENABLE(avmedia,
1013     AS_HELP_STRING([--disable-avmedia],
1014         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1017 AC_ARG_ENABLE(database-connectivity,
1018     AS_HELP_STRING([--disable-database-connectivity],
1019         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1022 # This doesn't mean not building (or "integrating") extensions
1023 # (although it probably should; i.e. it should imply
1024 # --disable-extension-integration I guess), it means not supporting
1025 # any extension mechanism at all
1026 libo_FUZZ_ARG_ENABLE(extensions,
1027     AS_HELP_STRING([--disable-extensions],
1028         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1031 AC_ARG_ENABLE(scripting,
1032     AS_HELP_STRING([--disable-scripting],
1033         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1036 # This is mainly for Android and iOS, but could potentially be used in some
1037 # special case otherwise, too, so factored out as a separate setting
1039 AC_ARG_ENABLE(dynamic-loading,
1040     AS_HELP_STRING([--disable-dynamic-loading],
1041         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1044 libo_FUZZ_ARG_ENABLE(report-builder,
1045     AS_HELP_STRING([--disable-report-builder],
1046         [Disable the Report Builder.])
1049 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1050     AS_HELP_STRING([--enable-ext-wiki-publisher],
1051         [Enable the Wiki Publisher extension.])
1054 libo_FUZZ_ARG_ENABLE(lpsolve,
1055     AS_HELP_STRING([--disable-lpsolve],
1056         [Disable compilation of the lp solve solver ])
1058 libo_FUZZ_ARG_ENABLE(coinmp,
1059     AS_HELP_STRING([--disable-coinmp],
1060         [Disable compilation of the CoinMP solver ])
1063 libo_FUZZ_ARG_ENABLE(pdfimport,
1064     AS_HELP_STRING([--disable-pdfimport],
1065         [Disable building the PDF import feature.])
1068 libo_FUZZ_ARG_ENABLE(pdfium,
1069     AS_HELP_STRING([--disable-pdfium],
1070         [Disable building PDFium.])
1073 ###############################################################################
1075 dnl ---------- *** ----------
1077 libo_FUZZ_ARG_ENABLE(mergelibs,
1078     AS_HELP_STRING([--enable-mergelibs],
1079         [Merge several of the smaller libraries into one big, "merged", one.])
1082 libo_FUZZ_ARG_ENABLE(breakpad,
1083     AS_HELP_STRING([--enable-breakpad],
1084         [Enables breakpad for crash reporting.])
1087 libo_FUZZ_ARG_ENABLE(crashdump,
1088     AS_HELP_STRING([--disable-crashdump],
1089         [Disable dump.ini and dump-file, when --enable-breakpad])
1092 AC_ARG_ENABLE(fetch-external,
1093     AS_HELP_STRING([--disable-fetch-external],
1094         [Disables fetching external tarballs from web sources.])
1097 AC_ARG_ENABLE(fuzzers,
1098     AS_HELP_STRING([--enable-fuzzers],
1099         [Enables building libfuzzer targets for fuzz testing.])
1102 libo_FUZZ_ARG_ENABLE(pch,
1103     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1104         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1105          Using 'system' will include only external headers, 'base' will add also headers
1106          from base modules, 'normal' will also add all headers except from the module built,
1107          'full' will use all suitable headers even from a module itself.])
1110 libo_FUZZ_ARG_ENABLE(epm,
1111     AS_HELP_STRING([--enable-epm],
1112         [LibreOffice includes self-packaging code, that requires epm, however epm is
1113          useless for large scale package building.])
1116 libo_FUZZ_ARG_ENABLE(odk,
1117     AS_HELP_STRING([--disable-odk],
1118         [LibreOffice includes an ODK, office development kit which some packagers may
1119          wish to build without.])
1122 AC_ARG_ENABLE(mpl-subset,
1123     AS_HELP_STRING([--enable-mpl-subset],
1124         [Don't compile any pieces which are not MPL or more liberally licensed])
1127 libo_FUZZ_ARG_ENABLE(evolution2,
1128     AS_HELP_STRING([--enable-evolution2],
1129         [Allows the built-in evolution 2 addressbook connectivity build to be
1130          enabled.])
1133 AC_ARG_ENABLE(avahi,
1134     AS_HELP_STRING([--enable-avahi],
1135         [Determines whether to use Avahi to advertise Impress to remote controls.])
1138 libo_FUZZ_ARG_ENABLE(werror,
1139     AS_HELP_STRING([--enable-werror],
1140         [Turn warnings to errors. (Has no effect in modules where the treating
1141          of warnings as errors is disabled explicitly.)]),
1144 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1145     AS_HELP_STRING([--enable-assert-always-abort],
1146         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1149 libo_FUZZ_ARG_ENABLE(dbgutil,
1150     AS_HELP_STRING([--enable-dbgutil],
1151         [Provide debugging support from --enable-debug and include additional debugging
1152          utilities such as object counting or more expensive checks.
1153          This is the recommended option for developers.
1154          Note that this makes the build ABI incompatible, it is not possible to mix object
1155          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1157 libo_FUZZ_ARG_ENABLE(debug,
1158     AS_HELP_STRING([--enable-debug],
1159         [Include debugging information, disable compiler optimization and inlining plus
1160          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1162 libo_FUZZ_ARG_ENABLE(split-debug,
1163     AS_HELP_STRING([--disable-split-debug],
1164         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1165          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1167 libo_FUZZ_ARG_ENABLE(gdb-index,
1168     AS_HELP_STRING([--disable-gdb-index],
1169         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1170          The feature requires the gold or lld linker.]))
1172 libo_FUZZ_ARG_ENABLE(sal-log,
1173     AS_HELP_STRING([--enable-sal-log],
1174         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1176 libo_FUZZ_ARG_ENABLE(symbols,
1177     AS_HELP_STRING([--enable-symbols],
1178         [Generate debug information.
1179          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1180          otherwise. It is possible to explicitly specify gbuild build targets
1181          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1182          everything in the directory; there is no ordering, more specific overrides
1183          more general, and disabling takes precedence).
1184          Example: --enable-symbols="all -sw/ -Library_sc".]))
1186 libo_FUZZ_ARG_ENABLE(optimized,
1187     AS_HELP_STRING([--disable-optimized],
1188         [Whether to compile with optimization flags.
1189          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1190          otherwise.]))
1192 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1193     AS_HELP_STRING([--disable-runtime-optimizations],
1194         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1195          JVM JIT) that are known to interact badly with certain dynamic analysis
1196          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1197          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1198          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1200 AC_ARG_WITH(valgrind,
1201     AS_HELP_STRING([--with-valgrind],
1202         [Make availability of Valgrind headers a hard requirement.]))
1204 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1205     AS_HELP_STRING([--enable-compiler-plugins],
1206         [Enable compiler plugins that will perform additional checks during
1207          building. Enabled automatically by --enable-dbgutil.
1208          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1209 COMPILER_PLUGINS_DEBUG=
1210 if test "$enable_compiler_plugins" = debug; then
1211     enable_compiler_plugins=yes
1212     COMPILER_PLUGINS_DEBUG=TRUE
1215 libo_FUZZ_ARG_ENABLE(ooenv,
1216     AS_HELP_STRING([--disable-ooenv],
1217         [Disable ooenv for the instdir installation.]))
1219 libo_FUZZ_ARG_ENABLE(libnumbertext,
1220     AS_HELP_STRING([--disable-libnumbertext],
1221         [Disable use of numbertext external library.]))
1223 AC_ARG_ENABLE(lto,
1224     AS_HELP_STRING([--enable-lto],
1225         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1226          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1227          linker. For MSVC, this option is broken at the moment. This is experimental work
1228          in progress that shouldn't be used unless you are working on it.)]))
1230 AC_ARG_ENABLE(python,
1231     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1232         [Enables or disables Python support at run-time.
1233          Also specifies what Python to use. 'auto' is the default.
1234          'fully-internal' even forces the internal version for uses of Python
1235          during the build.]))
1237 libo_FUZZ_ARG_ENABLE(gtk3,
1238     AS_HELP_STRING([--disable-gtk3],
1239         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1240 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1242 AC_ARG_ENABLE(introspection,
1243     AS_HELP_STRING([--enable-introspection],
1244         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1245          Linux distributions.)]))
1247 AC_ARG_ENABLE(split-app-modules,
1248     AS_HELP_STRING([--enable-split-app-modules],
1249         [Split file lists for app modules, e.g. base, calc.
1250          Has effect only with make distro-pack-install]),
1253 AC_ARG_ENABLE(split-opt-features,
1254     AS_HELP_STRING([--enable-split-opt-features],
1255         [Split file lists for some optional features, e.g. pyuno, testtool.
1256          Has effect only with make distro-pack-install]),
1259 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1260     AS_HELP_STRING([--disable-cairo-canvas],
1261         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1264 libo_FUZZ_ARG_ENABLE(dbus,
1265     AS_HELP_STRING([--disable-dbus],
1266         [Determines whether to enable features that depend on dbus.
1267          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1268 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1270 libo_FUZZ_ARG_ENABLE(sdremote,
1271     AS_HELP_STRING([--disable-sdremote],
1272         [Determines whether to enable Impress remote control (i.e. the server component).]),
1273 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1275 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1276     AS_HELP_STRING([--disable-sdremote-bluetooth],
1277         [Determines whether to build sdremote with bluetooth support.
1278          Requires dbus on Linux.]))
1280 libo_FUZZ_ARG_ENABLE(gio,
1281     AS_HELP_STRING([--disable-gio],
1282         [Determines whether to use the GIO support.]),
1283 ,test "${enable_gio+set}" = set || enable_gio=yes)
1285 AC_ARG_ENABLE(qt5,
1286     AS_HELP_STRING([--enable-qt5],
1287         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1288          available.]),
1291 AC_ARG_ENABLE(kf5,
1292     AS_HELP_STRING([--enable-kf5],
1293         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1294          KF5 are available.]),
1297 AC_ARG_ENABLE(kde5,
1298     AS_HELP_STRING([--enable-kde5],
1299         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1302 AC_ARG_ENABLE(gtk3_kde5,
1303     AS_HELP_STRING([--enable-gtk3-kde5],
1304         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1305          platforms where Gtk3, Qt5 and Plasma is available.]),
1308 AC_ARG_ENABLE(gui,
1309     AS_HELP_STRING([--disable-gui],
1310         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1311 ,enable_gui=yes)
1313 libo_FUZZ_ARG_ENABLE(randr,
1314     AS_HELP_STRING([--disable-randr],
1315         [Disable RandR support in the vcl project.]),
1316 ,test "${enable_randr+set}" = set || enable_randr=yes)
1318 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1319     AS_HELP_STRING([--disable-gstreamer-1-0],
1320         [Disable building with the gstreamer 1.0 avmedia backend.]),
1321 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1323 libo_FUZZ_ARG_ENABLE(vlc,
1324     AS_HELP_STRING([--enable-vlc],
1325         [Enable building with the (experimental) VLC avmedia backend.]),
1326 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1328 libo_FUZZ_ARG_ENABLE(neon,
1329     AS_HELP_STRING([--disable-neon],
1330         [Disable neon and the compilation of webdav binding.]),
1333 libo_FUZZ_ARG_ENABLE([eot],
1334     [AS_HELP_STRING([--enable-eot],
1335         [Enable support for Embedded OpenType fonts.])],
1336 ,test "${enable_eot+set}" = set || enable_eot=no)
1338 libo_FUZZ_ARG_ENABLE(cve-tests,
1339     AS_HELP_STRING([--disable-cve-tests],
1340         [Prevent CVE tests to be executed]),
1343 libo_FUZZ_ARG_ENABLE(chart-tests,
1344     AS_HELP_STRING([--enable-chart-tests],
1345         [Executes chart XShape tests. In a perfect world these tests would be
1346          stable and everyone could run them, in reality it is best to run them
1347          only on a few machines that are known to work and maintained by people
1348          who can judge if a test failure is a regression or not.]),
1351 AC_ARG_ENABLE(build-unowinreg,
1352     AS_HELP_STRING([--enable-build-unowinreg],
1353         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1354          compiler is needed on Linux.]),
1357 AC_ARG_ENABLE(build-opensymbol,
1358     AS_HELP_STRING([--enable-build-opensymbol],
1359         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1360          fontforge installed.]),
1363 AC_ARG_ENABLE(dependency-tracking,
1364     AS_HELP_STRING([--enable-dependency-tracking],
1365         [Do not reject slow dependency extractors.])[
1366   --disable-dependency-tracking
1367                           Disables generation of dependency information.
1368                           Speed up one-time builds.],
1371 AC_ARG_ENABLE(icecream,
1372     AS_HELP_STRING([--enable-icecream],
1373         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1374          It defaults to /opt/icecream for the location of the icecream gcc/g++
1375          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1378 AC_ARG_ENABLE(ld,
1379     AS_HELP_STRING([--enable-ld=<linker>],
1380         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1381          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1384 libo_FUZZ_ARG_ENABLE(cups,
1385     AS_HELP_STRING([--disable-cups],
1386         [Do not build cups support.])
1389 AC_ARG_ENABLE(ccache,
1390     AS_HELP_STRING([--disable-ccache],
1391         [Do not try to use ccache automatically.
1392          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1393          CC/CXX are not yet set, and --enable-icecream is not given, we
1394          attempt to use ccache. --disable-ccache disables ccache completely.
1395          Additionally ccache's depend mode is enabled if possible,
1396          use --enable-ccache=nodepend to enable ccache without depend mode.
1400 AC_ARG_ENABLE(64-bit,
1401     AS_HELP_STRING([--enable-64-bit],
1402         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1403          At the moment meaningful only for Windows.]), ,)
1405 libo_FUZZ_ARG_ENABLE(online-update,
1406     AS_HELP_STRING([--enable-online-update],
1407         [Enable the online update service that will check for new versions of
1408          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1409          If the value is "mar", the experimental Mozilla-like update will be
1410          enabled instead of the traditional update mechanism.]),
1413 AC_ARG_WITH(update-config,
1414     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1415                    [Path to the update config ini file]))
1417 libo_FUZZ_ARG_ENABLE(extension-update,
1418     AS_HELP_STRING([--disable-extension-update],
1419         [Disable possibility to update installed extensions.]),
1422 libo_FUZZ_ARG_ENABLE(release-build,
1423     AS_HELP_STRING([--enable-release-build],
1424         [Enable release build. Note that the "release build" choice is orthogonal to
1425          whether symbols are present, debug info is generated, or optimization
1426          is done.
1427          See http://wiki.documentfoundation.org/Development/DevBuild]),
1430 AC_ARG_ENABLE(windows-build-signing,
1431     AS_HELP_STRING([--enable-windows-build-signing],
1432         [Enable signing of windows binaries (*.exe, *.dll)]),
1435 AC_ARG_ENABLE(silent-msi,
1436     AS_HELP_STRING([--enable-silent-msi],
1437         [Enable MSI with LIMITUI=1 (silent install).]),
1440 AC_ARG_ENABLE(macosx-code-signing,
1441     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1442         [Sign executables, dylibs, frameworks and the app bundle. If you
1443          don't provide an identity the first suitable certificate
1444          in your keychain is used.]),
1447 AC_ARG_ENABLE(macosx-package-signing,
1448     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1449         [Create a .pkg suitable for uploading to the Mac App Store and sign
1450          it. If you don't provide an identity the first suitable certificate
1451          in your keychain is used.]),
1454 AC_ARG_ENABLE(macosx-sandbox,
1455     AS_HELP_STRING([--enable-macosx-sandbox],
1456         [Make the app bundle run in a sandbox. Requires code signing.
1457          Is required by apps distributed in the Mac App Store, and implies
1458          adherence to App Store rules.]),
1461 AC_ARG_WITH(macosx-bundle-identifier,
1462     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1463         [Define the macOS bundle identifier. Default is the somewhat weird
1464          org.libreoffice.script ("script", huh?).]),
1465 ,with_macosx_bundle_identifier=org.libreoffice.script)
1467 AC_ARG_WITH(product-name,
1468     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1469         [Define the product name. Default is AC_PACKAGE_NAME.]),
1470 ,with_product_name=$PRODUCTNAME)
1472 AC_ARG_WITH(package-version,
1473     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1474         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1477 libo_FUZZ_ARG_ENABLE(readonly-installset,
1478     AS_HELP_STRING([--enable-readonly-installset],
1479         [Prevents any attempts by LibreOffice to write into its installation. That means
1480          at least that no "system-wide" extensions can be added. Partly experimental work in
1481          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1484 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1485     AS_HELP_STRING([--disable-postgresql-sdbc],
1486         [Disable the build of the PostgreSQL-SDBC driver.])
1489 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1490     AS_HELP_STRING([--disable-lotuswordpro],
1491         [Disable the build of the Lotus Word Pro filter.]),
1492 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1494 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1495     AS_HELP_STRING([--disable-firebird-sdbc],
1496         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1497 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1499 AC_ARG_ENABLE(bogus-pkg-config,
1500     AS_HELP_STRING([--enable-bogus-pkg-config],
1501         [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.]),
1504 AC_ARG_ENABLE(openssl,
1505     AS_HELP_STRING([--disable-openssl],
1506         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1507          components will either use GNUTLS or NSS. Work in progress,
1508          use only if you are hacking on it.]),
1509 ,enable_openssl=yes)
1511 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1512     AS_HELP_STRING([--enable-cipher-openssl-backend],
1513         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1514          Requires --enable-openssl.]))
1516 AC_ARG_ENABLE(library-bin-tar,
1517     AS_HELP_STRING([--enable-library-bin-tar],
1518         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1519         Some libraries can save their build result in a tarball
1520         stored in TARFILE_LOCATION. That binary tarball is
1521         uniquely identified by the source tarball,
1522         the content of the config_host.mk file and the content
1523         of the top-level directory in core for that library
1524         If this option is enabled, then if such a tarfile exist, it will be untarred
1525         instead of the source tarfile, and the build step will be skipped for that
1526         library.
1527         If a proper tarfile does not exist, then the normal source-based
1528         build is done for that library and a proper binary tarfile is created
1529         for the next time.]),
1532 AC_ARG_ENABLE(dconf,
1533     AS_HELP_STRING([--disable-dconf],
1534         [Disable the dconf configuration backend (enabled by default where
1535          available).]))
1537 libo_FUZZ_ARG_ENABLE(formula-logger,
1538     AS_HELP_STRING(
1539         [--enable-formula-logger],
1540         [Enable formula logger for logging formula calculation flow in Calc.]
1541     )
1544 AC_ARG_ENABLE(ldap,
1545     AS_HELP_STRING([--disable-ldap],
1546         [Disable LDAP support.]),
1547 ,enable_ldap=yes)
1549 dnl ===================================================================
1550 dnl Optional Packages (--with/without-)
1551 dnl ===================================================================
1553 AC_ARG_WITH(gcc-home,
1554     AS_HELP_STRING([--with-gcc-home],
1555         [Specify the location of gcc/g++ manually. This can be used in conjunction
1556          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1557          non-default path.]),
1560 AC_ARG_WITH(gnu-patch,
1561     AS_HELP_STRING([--with-gnu-patch],
1562         [Specify location of GNU patch on Solaris or FreeBSD.]),
1565 AC_ARG_WITH(build-platform-configure-options,
1566     AS_HELP_STRING([--with-build-platform-configure-options],
1567         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1570 AC_ARG_WITH(gnu-cp,
1571     AS_HELP_STRING([--with-gnu-cp],
1572         [Specify location of GNU cp on Solaris or FreeBSD.]),
1575 AC_ARG_WITH(external-tar,
1576     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1577         [Specify an absolute path of where to find (and store) tarfiles.]),
1578     TARFILE_LOCATION=$withval ,
1581 AC_ARG_WITH(referenced-git,
1582     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1583         [Specify another checkout directory to reference. This makes use of
1584                  git submodule update --reference, and saves a lot of diskspace
1585                  when having multiple trees side-by-side.]),
1586     GIT_REFERENCE_SRC=$withval ,
1589 AC_ARG_WITH(linked-git,
1590     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1591         [Specify a directory where the repositories of submodules are located.
1592          This uses a method similar to git-new-workdir to get submodules.]),
1593     GIT_LINK_SRC=$withval ,
1596 AC_ARG_WITH(galleries,
1597     AS_HELP_STRING([--with-galleries],
1598         [Specify how galleries should be built. It is possible either to
1599          build these internally from source ("build"),
1600          or to disable them ("no")]),
1603 AC_ARG_WITH(theme,
1604     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1605         [Choose which themes to include. By default those themes with an '*' are included.
1606          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1607          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *tango.]),
1610 libo_FUZZ_ARG_WITH(helppack-integration,
1611     AS_HELP_STRING([--without-helppack-integration],
1612         [It will not integrate the helppacks to the installer
1613          of the product. Please use this switch to use the online help
1614          or separate help packages.]),
1617 libo_FUZZ_ARG_WITH(fonts,
1618     AS_HELP_STRING([--without-fonts],
1619         [LibreOffice includes some third-party fonts to provide a reliable basis for
1620          help content, templates, samples, etc. When these fonts are already
1621          known to be available on the system then you should use this option.]),
1624 AC_ARG_ENABLE(noto-font,
1625     AS_HELP_STRING([--enable-noto-font],
1626         [Add more Google Noto fonts.]),
1629 AC_ARG_WITH(epm,
1630     AS_HELP_STRING([--with-epm],
1631         [Decides which epm to use. Default is to use the one from the system if
1632          one is built. When either this is not there or you say =internal epm
1633          will be built.]),
1636 AC_ARG_WITH(package-format,
1637     AS_HELP_STRING([--with-package-format],
1638         [Specify package format(s) for LibreOffice installation sets. The
1639          implicit --without-package-format leads to no installation sets being
1640          generated. Possible values: aix, archive, bsd, deb, dmg,
1641          installed, msi, pkg, and rpm.
1642          Example: --with-package-format='deb rpm']),
1645 AC_ARG_WITH(tls,
1646     AS_HELP_STRING([--with-tls],
1647         [Decides which TLS/SSL and cryptographic implementations to use for
1648          LibreOffice's code. Notice that this doesn't apply for depending
1649          libraries like "neon", for example. Default is to use OpenSSL
1650          although NSS is also possible. Notice that selecting NSS restricts
1651          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1652          restrict by now the usage of NSS in LO's code. Possible values:
1653          openssl, nss. Example: --with-tls="nss"]),
1656 AC_ARG_WITH(system-libs,
1657     AS_HELP_STRING([--with-system-libs],
1658         [Use libraries already on system -- enables all --with-system-* flags.]),
1661 AC_ARG_WITH(system-bzip2,
1662     AS_HELP_STRING([--with-system-bzip2],
1663         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1664     [with_system_bzip2="$with_system_libs"])
1666 AC_ARG_WITH(system-headers,
1667     AS_HELP_STRING([--with-system-headers],
1668         [Use headers already on system -- enables all --with-system-* flags for
1669          external packages whose headers are the only entities used i.e.
1670          boost/odbc/sane-header(s).]),,
1671     [with_system_headers="$with_system_libs"])
1673 AC_ARG_WITH(system-jars,
1674     AS_HELP_STRING([--without-system-jars],
1675         [When building with --with-system-libs, also the needed jars are expected
1676          on the system. Use this to disable that]),,
1677     [with_system_jars="$with_system_libs"])
1679 AC_ARG_WITH(system-cairo,
1680     AS_HELP_STRING([--with-system-cairo],
1681         [Use cairo libraries already on system.  Happens automatically for
1682          (implicit) --enable-gtk3.]))
1684 AC_ARG_WITH(system-epoxy,
1685     AS_HELP_STRING([--with-system-epoxy],
1686         [Use epoxy libraries already on system.  Happens automatically for
1687          (implicit) --enable-gtk3.]),,
1688        [with_system_epoxy="$with_system_libs"])
1690 AC_ARG_WITH(myspell-dicts,
1691     AS_HELP_STRING([--with-myspell-dicts],
1692         [Adds myspell dictionaries to the LibreOffice installation set]),
1695 AC_ARG_WITH(system-dicts,
1696     AS_HELP_STRING([--without-system-dicts],
1697         [Do not use dictionaries from system paths.]),
1700 AC_ARG_WITH(external-dict-dir,
1701     AS_HELP_STRING([--with-external-dict-dir],
1702         [Specify external dictionary dir.]),
1705 AC_ARG_WITH(external-hyph-dir,
1706     AS_HELP_STRING([--with-external-hyph-dir],
1707         [Specify external hyphenation pattern dir.]),
1710 AC_ARG_WITH(external-thes-dir,
1711     AS_HELP_STRING([--with-external-thes-dir],
1712         [Specify external thesaurus dir.]),
1715 AC_ARG_WITH(system-zlib,
1716     AS_HELP_STRING([--with-system-zlib],
1717         [Use zlib already on system.]),,
1718     [with_system_zlib=auto])
1720 AC_ARG_WITH(system-jpeg,
1721     AS_HELP_STRING([--with-system-jpeg],
1722         [Use jpeg already on system.]),,
1723     [with_system_jpeg="$with_system_libs"])
1725 AC_ARG_WITH(system-clucene,
1726     AS_HELP_STRING([--with-system-clucene],
1727         [Use clucene already on system.]),,
1728     [with_system_clucene="$with_system_libs"])
1730 AC_ARG_WITH(system-expat,
1731     AS_HELP_STRING([--with-system-expat],
1732         [Use expat already on system.]),,
1733     [with_system_expat="$with_system_libs"])
1735 AC_ARG_WITH(system-libxml,
1736     AS_HELP_STRING([--with-system-libxml],
1737         [Use libxml/libxslt already on system.]),,
1738     [with_system_libxml=auto])
1740 AC_ARG_WITH(system-icu,
1741     AS_HELP_STRING([--with-system-icu],
1742         [Use icu already on system.]),,
1743     [with_system_icu="$with_system_libs"])
1745 AC_ARG_WITH(system-ucpp,
1746     AS_HELP_STRING([--with-system-ucpp],
1747         [Use ucpp already on system.]),,
1748     [])
1750 AC_ARG_WITH(system-openldap,
1751     AS_HELP_STRING([--with-system-openldap],
1752         [Use the OpenLDAP LDAP SDK already on system.]),,
1753     [with_system_openldap="$with_system_libs"])
1755 libo_FUZZ_ARG_ENABLE(poppler,
1756     AS_HELP_STRING([--disable-poppler],
1757         [Disable building Poppler.])
1760 AC_ARG_WITH(system-poppler,
1761     AS_HELP_STRING([--with-system-poppler],
1762         [Use system poppler (only needed for PDF import).]),,
1763     [with_system_poppler="$with_system_libs"])
1765 AC_ARG_WITH(system-gpgmepp,
1766     AS_HELP_STRING([--with-system-gpgmepp],
1767         [Use gpgmepp already on system]),,
1768     [with_system_gpgmepp="$with_system_libs"])
1770 AC_ARG_WITH(system-apache-commons,
1771     AS_HELP_STRING([--with-system-apache-commons],
1772         [Use Apache commons libraries already on system.]),,
1773     [with_system_apache_commons="$with_system_jars"])
1775 AC_ARG_WITH(system-mariadb,
1776     AS_HELP_STRING([--with-system-mariadb],
1777         [Use MariaDB/MySQL libraries already on system.]),,
1778     [with_system_mariadb="$with_system_libs"])
1780 AC_ARG_ENABLE(bundle-mariadb,
1781     AS_HELP_STRING([--enable-bundle-mariadb],
1782         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1785 AC_ARG_WITH(system-postgresql,
1786     AS_HELP_STRING([--with-system-postgresql],
1787         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1788          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1789     [with_system_postgresql="$with_system_libs"])
1791 AC_ARG_WITH(libpq-path,
1792     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1793         [Use this PostgreSQL C interface (libpq) installation for building
1794          the PostgreSQL-SDBC extension.]),
1797 AC_ARG_WITH(system-firebird,
1798     AS_HELP_STRING([--with-system-firebird],
1799         [Use Firebird libraries already on system, for building the Firebird-SDBC
1800          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1801     [with_system_firebird="$with_system_libs"])
1803 AC_ARG_WITH(system-libtommath,
1804             AS_HELP_STRING([--with-system-libtommath],
1805                            [Use libtommath already on system]),,
1806             [with_system_libtommath="$with_system_libs"])
1808 AC_ARG_WITH(system-hsqldb,
1809     AS_HELP_STRING([--with-system-hsqldb],
1810         [Use hsqldb already on system.]))
1812 AC_ARG_WITH(hsqldb-jar,
1813     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1814         [Specify path to jarfile manually.]),
1815     HSQLDB_JAR=$withval)
1817 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1818     AS_HELP_STRING([--disable-scripting-beanshell],
1819         [Disable support for scripts in BeanShell.]),
1823 AC_ARG_WITH(system-beanshell,
1824     AS_HELP_STRING([--with-system-beanshell],
1825         [Use beanshell already on system.]),,
1826     [with_system_beanshell="$with_system_jars"])
1828 AC_ARG_WITH(beanshell-jar,
1829     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1830         [Specify path to jarfile manually.]),
1831     BSH_JAR=$withval)
1833 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1834     AS_HELP_STRING([--disable-scripting-javascript],
1835         [Disable support for scripts in JavaScript.]),
1839 AC_ARG_WITH(system-rhino,
1840     AS_HELP_STRING([--with-system-rhino],
1841         [Use rhino already on system.]),,)
1842 #    [with_system_rhino="$with_system_jars"])
1843 # Above is not used as we have different debug interface
1844 # patched into internal rhino. This code needs to be fixed
1845 # before we can enable it by default.
1847 AC_ARG_WITH(rhino-jar,
1848     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     RHINO_JAR=$withval)
1852 AC_ARG_WITH(commons-logging-jar,
1853     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     COMMONS_LOGGING_JAR=$withval)
1857 AC_ARG_WITH(system-jfreereport,
1858     AS_HELP_STRING([--with-system-jfreereport],
1859         [Use JFreeReport already on system.]),,
1860     [with_system_jfreereport="$with_system_jars"])
1862 AC_ARG_WITH(sac-jar,
1863     AS_HELP_STRING([--with-sac-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     SAC_JAR=$withval)
1867 AC_ARG_WITH(libxml-jar,
1868     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     LIBXML_JAR=$withval)
1872 AC_ARG_WITH(flute-jar,
1873     AS_HELP_STRING([--with-flute-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     FLUTE_JAR=$withval)
1877 AC_ARG_WITH(jfreereport-jar,
1878     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     JFREEREPORT_JAR=$withval)
1882 AC_ARG_WITH(liblayout-jar,
1883     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     LIBLAYOUT_JAR=$withval)
1887 AC_ARG_WITH(libloader-jar,
1888     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBLOADER_JAR=$withval)
1892 AC_ARG_WITH(libformula-jar,
1893     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1894         [Specify path to jarfile manually.]),
1895     LIBFORMULA_JAR=$withval)
1897 AC_ARG_WITH(librepository-jar,
1898     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1899         [Specify path to jarfile manually.]),
1900     LIBREPOSITORY_JAR=$withval)
1902 AC_ARG_WITH(libfonts-jar,
1903     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1904         [Specify path to jarfile manually.]),
1905     LIBFONTS_JAR=$withval)
1907 AC_ARG_WITH(libserializer-jar,
1908     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1909         [Specify path to jarfile manually.]),
1910     LIBSERIALIZER_JAR=$withval)
1912 AC_ARG_WITH(libbase-jar,
1913     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1914         [Specify path to jarfile manually.]),
1915     LIBBASE_JAR=$withval)
1917 AC_ARG_WITH(system-odbc,
1918     AS_HELP_STRING([--with-system-odbc],
1919         [Use the odbc headers already on system.]),,
1920     [with_system_odbc="auto"])
1922 AC_ARG_WITH(system-sane,
1923     AS_HELP_STRING([--with-system-sane],
1924         [Use sane.h already on system.]),,
1925     [with_system_sane="$with_system_headers"])
1927 AC_ARG_WITH(system-bluez,
1928     AS_HELP_STRING([--with-system-bluez],
1929         [Use bluetooth.h already on system.]),,
1930     [with_system_bluez="$with_system_headers"])
1932 AC_ARG_WITH(system-curl,
1933     AS_HELP_STRING([--with-system-curl],
1934         [Use curl already on system.]),,
1935     [with_system_curl=auto])
1937 AC_ARG_WITH(system-boost,
1938     AS_HELP_STRING([--with-system-boost],
1939         [Use boost already on system.]),,
1940     [with_system_boost="$with_system_headers"])
1942 AC_ARG_WITH(system-glm,
1943     AS_HELP_STRING([--with-system-glm],
1944         [Use glm already on system.]),,
1945     [with_system_glm="$with_system_headers"])
1947 AC_ARG_WITH(system-hunspell,
1948     AS_HELP_STRING([--with-system-hunspell],
1949         [Use libhunspell already on system.]),,
1950     [with_system_hunspell="$with_system_libs"])
1952 AC_ARG_WITH(system-qrcodegen,
1953     AS_HELP_STRING([--with-system-qrcodegen],
1954         [Use libqrcodegen already on system.]),,
1955     [with_system_qrcodegen="$with_system_libs"])
1957 AC_ARG_WITH(system-mythes,
1958     AS_HELP_STRING([--with-system-mythes],
1959         [Use mythes already on system.]),,
1960     [with_system_mythes="$with_system_libs"])
1962 AC_ARG_WITH(system-altlinuxhyph,
1963     AS_HELP_STRING([--with-system-altlinuxhyph],
1964         [Use ALTLinuxhyph already on system.]),,
1965     [with_system_altlinuxhyph="$with_system_libs"])
1967 AC_ARG_WITH(system-lpsolve,
1968     AS_HELP_STRING([--with-system-lpsolve],
1969         [Use lpsolve already on system.]),,
1970     [with_system_lpsolve="$with_system_libs"])
1972 AC_ARG_WITH(system-coinmp,
1973     AS_HELP_STRING([--with-system-coinmp],
1974         [Use CoinMP already on system.]),,
1975     [with_system_coinmp="$with_system_libs"])
1977 AC_ARG_WITH(system-liblangtag,
1978     AS_HELP_STRING([--with-system-liblangtag],
1979         [Use liblangtag library already on system.]),,
1980     [with_system_liblangtag="$with_system_libs"])
1982 AC_ARG_WITH(webdav,
1983     AS_HELP_STRING([--with-webdav],
1984         [Specify which library to use for webdav implementation.
1985          Possible values: "neon", "serf", "no". The default value is "neon".
1986          Example: --with-webdav="serf"]),
1987     WITH_WEBDAV=$withval,
1988     WITH_WEBDAV="neon")
1990 AC_ARG_WITH(linker-hash-style,
1991     AS_HELP_STRING([--with-linker-hash-style],
1992         [Use linker with --hash-style=<style> when linking shared objects.
1993          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1994          if supported on the build system, and "sysv" otherwise.]))
1996 AC_ARG_WITH(jdk-home,
1997     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1998         [If you have installed JDK 8 or later on your system please supply the
1999          path here. Note that this is not the location of the java command but the
2000          location of the entire distribution.]),
2003 AC_ARG_WITH(help,
2004     AS_HELP_STRING([--with-help],
2005         [Enable the build of help. There is a special parameter "common" that
2006          can be used to bundle only the common part, .e.g help-specific icons.
2007          This is useful when you build the helpcontent separately.])
2008     [
2009                           Usage:     --with-help    build the old local help
2010                                  --without-help     no local help (default)
2011                                  --with-help=html   build the new HTML local help
2012                                  --with-help=online build the new HTML online help
2013     ],
2016 AC_ARG_WITH(omindex,
2017    AS_HELP_STRING([--with-omindex],
2018         [Enable the support of xapian-omega index for online help.])
2019    [
2020                          Usage: --with-omindex=server prepare the pages for omindex
2021                                 but let xapian-omega be built in server.
2022                                 --with-omindex=noxap do not prepare online pages
2023                                 for xapian-omega
2024   ],
2027 libo_FUZZ_ARG_WITH(java,
2028     AS_HELP_STRING([--with-java=<java command>],
2029         [Specify the name of the Java interpreter command. Typically "java"
2030          which is the default.
2032          To build without support for Java components, applets, accessibility
2033          or the XML filters written in Java, use --without-java or --with-java=no.]),
2034     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2035     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2038 AC_ARG_WITH(jvm-path,
2039     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2040         [Use a specific JVM search path at runtime.
2041          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2044 AC_ARG_WITH(ant-home,
2045     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2046         [If you have installed Apache Ant on your system, please supply the path here.
2047          Note that this is not the location of the Ant binary but the location
2048          of the entire distribution.]),
2051 AC_ARG_WITH(symbol-config,
2052     AS_HELP_STRING([--with-symbol-config],
2053         [Configuration for the crashreport symbol upload]),
2054         [],
2055         [with_symbol_config=no])
2057 AC_ARG_WITH(export-validation,
2058     AS_HELP_STRING([--without-export-validation],
2059         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2060 ,with_export_validation=auto)
2062 AC_ARG_WITH(bffvalidator,
2063     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2064         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2065          Requires installed Microsoft Office Binary File Format Validator.
2066          Note: export-validation (--with-export-validation) is required to be turned on.
2067          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2068 ,with_bffvalidator=no)
2070 libo_FUZZ_ARG_WITH(junit,
2071     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2072         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2073          --without-junit disables those tests. Not relevant in the --without-java case.]),
2074 ,with_junit=yes)
2076 AC_ARG_WITH(hamcrest,
2077     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2078         [Specifies the hamcrest jar file to use for JUnit-based tests.
2079          --without-junit disables those tests. Not relevant in the --without-java case.]),
2080 ,with_hamcrest=yes)
2082 AC_ARG_WITH(perl-home,
2083     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2084         [If you have installed Perl 5 Distribution, on your system, please
2085          supply the path here. Note that this is not the location of the Perl
2086          binary but the location of the entire distribution.]),
2089 libo_FUZZ_ARG_WITH(doxygen,
2090     AS_HELP_STRING(
2091         [--with-doxygen=<absolute path to doxygen executable>],
2092         [Specifies the doxygen executable to use when generating ODK C/C++
2093          documentation. --without-doxygen disables generation of ODK C/C++
2094          documentation. Not relevant in the --disable-odk case.]),
2095 ,with_doxygen=yes)
2097 AC_ARG_WITH(visual-studio,
2098     AS_HELP_STRING([--with-visual-studio=<2017>],
2099         [Specify which Visual Studio version to use in case several are
2100          installed. Currently only 2017 is supported.]),
2103 AC_ARG_WITH(windows-sdk,
2104     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2105         [Specify which Windows SDK, or "Windows Kit", version to use
2106          in case the one that came with the selected Visual Studio
2107          is not what you want for some reason. Note that not all compiler/SDK
2108          combinations are supported. The intent is that this option should not
2109          be needed.]),
2112 AC_ARG_WITH(lang,
2113     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2114         [Use this option to build LibreOffice with additional UI language support.
2115          English (US) is always included by default.
2116          Separate multiple languages with space.
2117          For all languages, use --with-lang=ALL.]),
2120 AC_ARG_WITH(locales,
2121     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2122         [Use this option to limit the locale information built in.
2123          Separate multiple locales with space.
2124          Very experimental and might well break stuff.
2125          Just a desperate measure to shrink code and data size.
2126          By default all the locales available is included.
2127          This option is completely unrelated to --with-lang.])
2128     [
2129                           Affects also our character encoding conversion
2130                           tables for encodings mainly targeted for a
2131                           particular locale, like EUC-CN and EUC-TW for
2132                           zh, ISO-2022-JP for ja.
2134                           Affects also our add-on break iterator data for
2135                           some languages.
2137                           For the default, all locales, don't use this switch at all.
2138                           Specifying just the language part of a locale means all matching
2139                           locales will be included.
2140     ],
2143 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2144 libo_FUZZ_ARG_WITH(krb5,
2145     AS_HELP_STRING([--with-krb5],
2146         [Enable MIT Kerberos 5 support in modules that support it.
2147          By default automatically enabled on platforms
2148          where a good system Kerberos 5 is available.]),
2151 libo_FUZZ_ARG_WITH(gssapi,
2152     AS_HELP_STRING([--with-gssapi],
2153         [Enable GSSAPI support in modules that support it.
2154          By default automatically enabled on platforms
2155          where a good system GSSAPI is available.]),
2158 AC_ARG_WITH(iwyu,
2159     AS_HELP_STRING([--with-iwyu],
2160         [Use given IWYU binary path to check unneeded includes instead of building.
2161          Use only if you are hacking on it.]),
2164 libo_FUZZ_ARG_WITH(lxml,
2165     AS_HELP_STRING([--without-lxml],
2166         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2167          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2168          report widget classes and ids.]),
2171 libo_FUZZ_ARG_WITH(latest-c++,
2172     AS_HELP_STRING([--with-latest-c++],
2173         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2174          published standard.]),,
2175         [with_latest_c__=no])
2177 dnl ===================================================================
2178 dnl Branding
2179 dnl ===================================================================
2181 AC_ARG_WITH(branding,
2182     AS_HELP_STRING([--with-branding=/path/to/images],
2183         [Use given path to retrieve branding images set.])
2184     [
2185                           Search for intro.png about.svg and flat_logo.svg.
2186                           If any is missing, default ones will be used instead.
2188                           Search also progress.conf for progress
2189                           settings on intro screen :
2191                           PROGRESSBARCOLOR="255,255,255" Set color of
2192                           progress bar. Comma separated RGB decimal values.
2193                           PROGRESSSIZE="407,6" Set size of progress bar.
2194                           Comma separated decimal values (width, height).
2195                           PROGRESSPOSITION="61,317" Set position of progress
2196                           bar from left,top. Comma separated decimal values.
2197                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2198                           bar frame. Comma separated RGB decimal values.
2199                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2200                           bar text. Comma separated RGB decimal values.
2201                           PROGRESSTEXTBASELINE="287" Set vertical position of
2202                           progress bar text from top. Decimal value.
2204                           Default values will be used if not found.
2205     ],
2209 AC_ARG_WITH(extra-buildid,
2210     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2211         [Show addition build identification in about dialog.]),
2215 AC_ARG_WITH(vendor,
2216     AS_HELP_STRING([--with-vendor="John the Builder"],
2217         [Set vendor of the build.]),
2220 AC_ARG_WITH(android-package-name,
2221     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2222         [Set Android package name of the build.]),
2225 AC_ARG_WITH(compat-oowrappers,
2226     AS_HELP_STRING([--with-compat-oowrappers],
2227         [Install oo* wrappers in parallel with
2228          lo* ones to keep backward compatibility.
2229          Has effect only with make distro-pack-install]),
2232 AC_ARG_WITH(os-version,
2233     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2234         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2237 AC_ARG_WITH(mingw-cross-compiler,
2238     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2239         [Specify the MinGW cross-compiler to use.
2240          When building on the ODK on Unix and building unowinreg.dll,
2241          specify the MinGW C++ cross-compiler.]),
2244 AC_ARG_WITH(idlc-cpp,
2245     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2246         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2249 AC_ARG_WITH(build-version,
2250     AS_HELP_STRING([--with-build-version="Built by Jim"],
2251         [Allows the builder to add a custom version tag that will appear in the
2252          Help/About box for QA purposes.]),
2253 with_build_version=$withval,
2256 AC_ARG_WITH(parallelism,
2257     AS_HELP_STRING([--with-parallelism],
2258         [Number of jobs to run simultaneously during build. Parallel builds can
2259         save a lot of time on multi-cpu machines. Defaults to the number of
2260         CPUs on the machine, unless you configure --enable-icecream - then to
2261         40.]),
2264 AC_ARG_WITH(all-tarballs,
2265     AS_HELP_STRING([--with-all-tarballs],
2266         [Download all external tarballs unconditionally]))
2268 AC_ARG_WITH(gdrive-client-id,
2269     AS_HELP_STRING([--with-gdrive-client-id],
2270         [Provides the client id of the application for OAuth2 authentication
2271         on Google Drive. If either this or --with-gdrive-client-secret is
2272         empty, the feature will be disabled]),
2275 AC_ARG_WITH(gdrive-client-secret,
2276     AS_HELP_STRING([--with-gdrive-client-secret],
2277         [Provides the client secret of the application for OAuth2
2278         authentication on Google Drive. If either this or
2279         --with-gdrive-client-id is empty, the feature will be disabled]),
2282 AC_ARG_WITH(alfresco-cloud-client-id,
2283     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2284         [Provides the client id of the application for OAuth2 authentication
2285         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2286         empty, the feature will be disabled]),
2289 AC_ARG_WITH(alfresco-cloud-client-secret,
2290     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2291         [Provides the client secret of the application for OAuth2
2292         authentication on Alfresco Cloud. If either this or
2293         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2296 AC_ARG_WITH(onedrive-client-id,
2297     AS_HELP_STRING([--with-onedrive-client-id],
2298         [Provides the client id of the application for OAuth2 authentication
2299         on OneDrive. If either this or --with-onedrive-client-secret is
2300         empty, the feature will be disabled]),
2303 AC_ARG_WITH(onedrive-client-secret,
2304     AS_HELP_STRING([--with-onedrive-client-secret],
2305         [Provides the client secret of the application for OAuth2
2306         authentication on OneDrive. If either this or
2307         --with-onedrive-client-id is empty, the feature will be disabled]),
2309 dnl ===================================================================
2310 dnl Do we want to use pre-build binary tarball for recompile
2311 dnl ===================================================================
2313 if test "$enable_library_bin_tar" = "yes" ; then
2314     USE_LIBRARY_BIN_TAR=TRUE
2315 else
2316     USE_LIBRARY_BIN_TAR=
2318 AC_SUBST(USE_LIBRARY_BIN_TAR)
2320 dnl ===================================================================
2321 dnl Test whether build target is Release Build
2322 dnl ===================================================================
2323 AC_MSG_CHECKING([whether build target is Release Build])
2324 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2325     AC_MSG_RESULT([no])
2326     ENABLE_RELEASE_BUILD=
2327 else
2328     AC_MSG_RESULT([yes])
2329     ENABLE_RELEASE_BUILD=TRUE
2331 AC_SUBST(ENABLE_RELEASE_BUILD)
2333 dnl ===================================================================
2334 dnl Test whether to sign Windows Build
2335 dnl ===================================================================
2336 AC_MSG_CHECKING([whether to sign windows build])
2337 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2338     AC_MSG_RESULT([yes])
2339     WINDOWS_BUILD_SIGNING="TRUE"
2340 else
2341     AC_MSG_RESULT([no])
2342     WINDOWS_BUILD_SIGNING="FALSE"
2344 AC_SUBST(WINDOWS_BUILD_SIGNING)
2346 dnl ===================================================================
2347 dnl MacOSX build and runtime environment options
2348 dnl ===================================================================
2350 AC_ARG_WITH(macosx-sdk,
2351     AS_HELP_STRING([--with-macosx-sdk=<version>],
2352         [Prefer a specific SDK for building.])
2353     [
2354                           If the requested SDK is not available, a search for the oldest one will be done.
2355                           With current Xcode versions, only the latest SDK is included, so this option is
2356                           not terribly useful. It works fine to build with a new SDK and run the result
2357                           on an older OS.
2359                           e. g.: --with-macosx-sdk=10.10
2361                           there are 3 options to control the MacOSX build:
2362                           --with-macosx-sdk (referred as 'sdk' below)
2363                           --with-macosx-version-min-required (referred as 'min' below)
2364                           --with-macosx-version-max-allowed (referred as 'max' below)
2366                           the connection between these value and the default they take is as follow:
2367                           ( ? means not specified on the command line, s means the SDK version found,
2368                           constraint: 8 <= x <= y <= z)
2370                           ==========================================
2371                            command line      || config result
2372                           ==========================================
2373                           min  | max  | sdk  || min   | max  | sdk  |
2374                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2375                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2376                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2377                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2378                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2379                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2380                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2381                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2384                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2385                           for a detailed technical explanation of these variables
2387                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2388     ],
2391 AC_ARG_WITH(macosx-version-min-required,
2392     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2393         [set the minimum OS version needed to run the built LibreOffice])
2394     [
2395                           e. g.: --with-macos-version-min-required=10.10
2396                           see --with-macosx-sdk for more info
2397     ],
2400 AC_ARG_WITH(macosx-version-max-allowed,
2401     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2402         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2403     [
2404                           e. g.: --with-macos-version-max-allowed=10.10
2405                           see --with-macosx-sdk for more info
2406     ],
2410 dnl ===================================================================
2411 dnl options for stuff used during cross-compilation build
2412 dnl Not quite superseded by --with-build-platform-configure-options.
2413 dnl TODO: check, if the "force" option is still needed anywhere.
2414 dnl ===================================================================
2416 AC_ARG_WITH(system-icu-for-build,
2417     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2418         [Use icu already on system for build tools (cross-compilation only).]))
2421 dnl ===================================================================
2422 dnl Check for incompatible options set by fuzzing, and reset those
2423 dnl automatically to working combinations
2424 dnl ===================================================================
2426 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2427         "$enable_dbus" != "$enable_avahi"; then
2428     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2429     enable_avahi=$enable_dbus
2432 add_lopath_after ()
2434     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2435         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2436     fi
2439 add_lopath_before ()
2441     local IFS=${P_SEP}
2442     local path_cleanup
2443     local dir
2444     for dir in $LO_PATH ; do
2445         if test "$dir" != "$1" ; then
2446             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2447         fi
2448     done
2449     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2452 dnl ===================================================================
2453 dnl check for required programs (grep, awk, sed, bash)
2454 dnl ===================================================================
2456 pathmunge ()
2458     if test -n "$1"; then
2459         if test "$build_os" = "cygwin"; then
2460             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2461                 PathFormat "$1"
2462                 new_path=`cygpath -sm "$formatted_path"`
2463             else
2464                 PathFormat "$1"
2465                 new_path=`cygpath -u "$formatted_path"`
2466             fi
2467         else
2468             new_path="$1"
2469         fi
2470         if test "$2" = "after"; then
2471             add_lopath_after "$new_path"
2472         else
2473             add_lopath_before "$new_path"
2474         fi
2475         unset new_path
2476     fi
2479 AC_PROG_AWK
2480 AC_PATH_PROG( AWK, $AWK)
2481 if test -z "$AWK"; then
2482     AC_MSG_ERROR([install awk to run this script])
2485 AC_PATH_PROG(BASH, bash)
2486 if test -z "$BASH"; then
2487     AC_MSG_ERROR([bash not found in \$PATH])
2489 AC_SUBST(BASH)
2491 AC_MSG_CHECKING([for GNU or BSD tar])
2492 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2493     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2494     if test $? -eq 0;  then
2495         GNUTAR=$a
2496         break
2497     fi
2498 done
2499 AC_MSG_RESULT($GNUTAR)
2500 if test -z "$GNUTAR"; then
2501     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2503 AC_SUBST(GNUTAR)
2505 AC_MSG_CHECKING([for tar's option to strip components])
2506 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2507 if test $? -eq 0; then
2508     STRIP_COMPONENTS="--strip-components"
2509 else
2510     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2511     if test $? -eq 0; then
2512         STRIP_COMPONENTS="--strip-path"
2513     else
2514         STRIP_COMPONENTS="unsupported"
2515     fi
2517 AC_MSG_RESULT($STRIP_COMPONENTS)
2518 if test x$STRIP_COMPONENTS = xunsupported; then
2519     AC_MSG_ERROR([you need a tar that is able to strip components.])
2521 AC_SUBST(STRIP_COMPONENTS)
2523 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2524 dnl desktop OSes from "mobile" ones.
2526 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2527 dnl In other words, that when building for an OS that is not a
2528 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2530 dnl Note the direction of the implication; there is no assumption that
2531 dnl cross-compiling would imply a non-desktop OS.
2533 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2534     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2535     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2536     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2539 # Whether to build "avmedia" functionality or not.
2541 if test -z "$enable_avmedia"; then
2542     enable_avmedia=yes
2545 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2546 if test "$enable_avmedia" = yes; then
2547     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2548 else
2549     USE_AVMEDIA_DUMMY='TRUE'
2551 AC_SUBST(USE_AVMEDIA_DUMMY)
2553 # Decide whether to build database connectivity stuff (including
2554 # Base) or not. We probably don't want to on non-desktop OSes.
2555 if test -z "$enable_database_connectivity"; then
2556     # --disable-database-connectivity is unfinished work in progress
2557     # and the iOS test app doesn't link if we actually try to use it.
2558     # if test $_os != iOS -a $_os != Android; then
2559     if test $_os != iOS; then
2560         enable_database_connectivity=yes
2561     fi
2564 if test "$enable_database_connectivity" = yes; then
2565     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2566     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2569 if test -z "$enable_extensions"; then
2570     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2571     if test $_os != iOS; then
2572         enable_extensions=yes
2573     fi
2576 if test "$enable_extensions" = yes; then
2577     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2578     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2581 if test -z "$enable_scripting"; then
2582     # Disable scripting for iOS unless specifically overridden
2583     # with --enable-scripting.
2584     if test $_os != iOS; then
2585         enable_scripting=yes
2586     fi
2589 DISABLE_SCRIPTING=''
2590 if test "$enable_scripting" = yes; then
2591     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2592     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2593 else
2594     DISABLE_SCRIPTING='TRUE'
2595     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2598 if test $_os = iOS -o $_os = Android; then
2599     # Disable dynamic_loading always for iOS and Android
2600     enable_dynamic_loading=no
2601 elif test -z "$enable_dynamic_loading"; then
2602     # Otherwise enable it unless specifically disabled
2603     enable_dynamic_loading=yes
2606 DISABLE_DYNLOADING=''
2607 if test "$enable_dynamic_loading" = yes; then
2608     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2609 else
2610     DISABLE_DYNLOADING='TRUE'
2612 AC_SUBST(DISABLE_DYNLOADING)
2614 # remember SYSBASE value
2615 AC_SUBST(SYSBASE)
2617 dnl ===================================================================
2618 dnl  Sort out various gallery compilation options
2619 dnl ===================================================================
2620 AC_MSG_CHECKING([how to build and package galleries])
2621 if test -n "${with_galleries}"; then
2622     if test "$with_galleries" = "build"; then
2623         WITH_GALLERY_BUILD=TRUE
2624         AC_MSG_RESULT([build from source images internally])
2625     elif test "$with_galleries" = "no"; then
2626         WITH_GALLERY_BUILD=
2627         AC_MSG_RESULT([disable non-internal gallery build])
2628     else
2629         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2630     fi
2631 else
2632     if test $_os != iOS -a $_os != Android; then
2633         WITH_GALLERY_BUILD=TRUE
2634         AC_MSG_RESULT([internal src images for desktop])
2635     else
2636         WITH_GALLERY_BUILD=
2637         AC_MSG_RESULT([disable src image build])
2638     fi
2640 AC_SUBST(WITH_GALLERY_BUILD)
2642 dnl ===================================================================
2643 dnl  Checks if ccache is available
2644 dnl ===================================================================
2645 CCACHE_DEPEND_MODE=
2646 if test "$_os" = "WINNT"; then
2647     # on windows/VC build do not use ccache
2648     CCACHE=""
2649 elif test "$enable_ccache" = "no"; then
2650     CCACHE=""
2651 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2652     case "%$CC%$CXX%" in
2653     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2654     # assume that's good then
2655     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2656         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2657         CCACHE_DEPEND_MODE=1
2658         ;;
2659     *)
2660         AC_PATH_PROG([CCACHE],[ccache],[not found])
2661         if test "$CCACHE" = "not found"; then
2662             CCACHE=""
2663         else
2664             CCACHE_DEPEND_MODE=1
2665             # Need to check for ccache version: otherwise prevents
2666             # caching of the results (like "-x objective-c++" for Mac)
2667             if test $_os = Darwin -o $_os = iOS; then
2668                 # Check ccache version
2669                 AC_MSG_CHECKING([whether version of ccache is suitable])
2670                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2671                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2672                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2673                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2674                 else
2675                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2676                     CCACHE=""
2677                     CCACHE_DEPEND_MODE=
2678                 fi
2679             fi
2680         fi
2681         ;;
2682     esac
2683 else
2684     CCACHE=""
2686 if test "$enable_ccache" = "nodepend"; then
2687     CCACHE_DEPEND_MODE=""
2689 AC_SUBST(CCACHE_DEPEND_MODE)
2691 if test "$CCACHE" != ""; then
2692     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2693     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2694     if test "$ccache_size" = ""; then
2695         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2696         if test "$ccache_size" = ""; then
2697             ccache_size=0
2698         fi
2699         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2700         if test $ccache_size -lt 1024; then
2701             CCACHE=""
2702             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2703             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2704         else
2705             # warn that ccache may be too small for debug build
2706             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2707             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2708         fi
2709     else
2710         if test $ccache_size -lt 5; then
2711             #warn that ccache may be too small for debug build
2712             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2713             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2714         fi
2715     fi
2718 dnl ===================================================================
2719 dnl  Checks for C compiler,
2720 dnl  The check for the C++ compiler is later on.
2721 dnl ===================================================================
2722 if test "$_os" != "WINNT"; then
2723     GCC_HOME_SET="true"
2724     AC_MSG_CHECKING([gcc home])
2725     if test -z "$with_gcc_home"; then
2726         if test "$enable_icecream" = "yes"; then
2727             if test -d "/usr/lib/icecc/bin"; then
2728                 GCC_HOME="/usr/lib/icecc/"
2729             elif test -d "/usr/libexec/icecc/bin"; then
2730                 GCC_HOME="/usr/libexec/icecc/"
2731             elif test -d "/opt/icecream/bin"; then
2732                 GCC_HOME="/opt/icecream/"
2733             else
2734                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2736             fi
2737         else
2738             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2739             GCC_HOME_SET="false"
2740         fi
2741     else
2742         GCC_HOME="$with_gcc_home"
2743     fi
2744     AC_MSG_RESULT($GCC_HOME)
2745     AC_SUBST(GCC_HOME)
2747     if test "$GCC_HOME_SET" = "true"; then
2748         if test -z "$CC"; then
2749             CC="$GCC_HOME/bin/gcc"
2750             CC_BASE="gcc"
2751         fi
2752         if test -z "$CXX"; then
2753             CXX="$GCC_HOME/bin/g++"
2754             CXX_BASE="g++"
2755         fi
2756     fi
2759 COMPATH=`dirname "$CC"`
2760 if test "$COMPATH" = "."; then
2761     AC_PATH_PROGS(COMPATH, $CC)
2762     dnl double square bracket to get single because of M4 quote...
2763     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2765 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2767 dnl ===================================================================
2768 dnl Java support
2769 dnl ===================================================================
2770 AC_MSG_CHECKING([whether to build with Java support])
2771 if test "$with_java" != "no"; then
2772     if test "$DISABLE_SCRIPTING" = TRUE; then
2773         AC_MSG_RESULT([no, overridden by --disable-scripting])
2774         ENABLE_JAVA=""
2775         with_java=no
2776     else
2777         AC_MSG_RESULT([yes])
2778         ENABLE_JAVA="TRUE"
2779         AC_DEFINE(HAVE_FEATURE_JAVA)
2780     fi
2781 else
2782     AC_MSG_RESULT([no])
2783     ENABLE_JAVA=""
2786 AC_SUBST(ENABLE_JAVA)
2788 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2790 dnl ENABLE_JAVA="" indicate no Java support at all
2792 dnl ===================================================================
2793 dnl Check macOS SDK and compiler
2794 dnl ===================================================================
2796 HAVE_MACOS_LD_PLATFORMVERSION=
2797 if test $_os = Darwin; then
2799     # If no --with-macosx-sdk option is given, look for one
2801     # The intent is that for "most" Mac-based developers, a suitable
2802     # SDK will be found automatically without any configure options.
2804     # For developers with a current Xcode, the lowest-numbered SDK
2805     # higher than or equal to the minimum required should be found.
2807     AC_MSG_CHECKING([what macOS SDK to use])
2808     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2809         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2810         if test -d "$MACOSX_SDK_PATH"; then
2811             with_macosx_sdk="${_macosx_sdk}"
2812             break
2813         else
2814             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2815             if test -d "$MACOSX_SDK_PATH"; then
2816                 with_macosx_sdk="${_macosx_sdk}"
2817                 break
2818             fi
2819         fi
2820     done
2821     if test ! -d "$MACOSX_SDK_PATH"; then
2822         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2823     fi
2825     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2827     case $with_macosx_sdk in
2828     10.12)
2829         MACOSX_SDK_VERSION=101200
2830         ;;
2831     10.13)
2832         MACOSX_SDK_VERSION=101300
2833         ;;
2834     10.14)
2835         MACOSX_SDK_VERSION=101400
2836         ;;
2837     10.15)
2838         MACOSX_SDK_VERSION=101500
2839         ;;
2840     *)
2841         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2842         ;;
2843     esac
2845     if test "$with_macosx_version_min_required" = "" ; then
2846         with_macosx_version_min_required="10.10";
2847     fi
2849     if test "$with_macosx_version_max_allowed" = "" ; then
2850         with_macosx_version_max_allowed="$with_macosx_sdk"
2851     fi
2853     # export this so that "xcrun" invocations later return matching values
2854     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2855     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2856     export DEVELOPER_DIR
2857     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2858     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2860     AC_MSG_CHECKING([whether Xcode is new enough])
2861     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2862     my_xcode_ver2=${my_xcode_ver1#Xcode }
2863     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2864     if test "$my_xcode_ver3" -ge 903; then
2865         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2866     else
2867         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2868     fi
2870     case "$with_macosx_version_min_required" in
2871     10.10)
2872         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2873         ;;
2874     10.11)
2875         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2876         ;;
2877     10.12)
2878         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2879         ;;
2880     10.13)
2881         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2882         ;;
2883     10.14)
2884         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2885         ;;
2886     10.15)
2887         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2888         ;;
2889     *)
2890         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2891         ;;
2892     esac
2893     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2895     LIBTOOL=/usr/bin/libtool
2896     INSTALL_NAME_TOOL=install_name_tool
2897     if test -z "$save_CC"; then
2898         stdlib=-stdlib=libc++
2899         if test "$ENABLE_LTO" = TRUE; then
2900             lto=-flto
2901         fi
2903         AC_MSG_CHECKING([what C compiler to use])
2904         CC="`xcrun -find clang`"
2905         CC_BASE=`first_arg_basename "$CC"`
2906         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2907         AC_MSG_RESULT([$CC])
2909         AC_MSG_CHECKING([what C++ compiler to use])
2910         CXX="`xcrun -find clang++`"
2911         CXX_BASE=`first_arg_basename "$CXX"`
2912         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2913         AC_MSG_RESULT([$CXX])
2915         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2916         AR=`xcrun -find ar`
2917         NM=`xcrun -find nm`
2918         STRIP=`xcrun -find strip`
2919         LIBTOOL=`xcrun -find libtool`
2920         RANLIB=`xcrun -find ranlib`
2921     fi
2923     case "$with_macosx_version_max_allowed" in
2924     10.10)
2925         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2926         ;;
2927     10.11)
2928         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2929         ;;
2930     10.12)
2931         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2932         ;;
2933     10.13)
2934         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2935         ;;
2936     10.14)
2937         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2938         ;;
2939     10.15)
2940         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2941         ;;
2942     *)
2943         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2944         ;;
2945     esac
2947     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2948     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2949         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])
2950     else
2951         AC_MSG_RESULT([ok])
2952     fi
2954     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2955     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2956         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2957     else
2958         AC_MSG_RESULT([ok])
2959     fi
2960     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2961     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2963     AC_MSG_CHECKING([whether to do code signing])
2965     if test "$enable_macosx_code_signing" = yes; then
2966         # By default use the first suitable certificate (?).
2968         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2969         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2970         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2971         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2972         # "Developer ID Application" one.
2974         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2975         if test -n "$identity"; then
2976             MACOSX_CODESIGNING_IDENTITY=$identity
2977             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2978             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2979         else
2980             AC_MSG_ERROR([cannot determine identity to use])
2981         fi
2982     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2983         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2984         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2985         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2986     else
2987         AC_MSG_RESULT([no])
2988     fi
2990     AC_MSG_CHECKING([whether to create a Mac App Store package])
2992     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2993         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2994     elif test "$enable_macosx_package_signing" = yes; then
2995         # By default use the first suitable certificate.
2996         # It should be a "3rd Party Mac Developer Installer" one
2998         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2999         if test -n "$identity"; then
3000             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3001             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3002             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3003         else
3004             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3005         fi
3006     elif test -n "$enable_macosx_package_signing"; then
3007         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3008         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3009         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3010     else
3011         AC_MSG_RESULT([no])
3012     fi
3014     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3015         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3016     fi
3018     AC_MSG_CHECKING([whether to sandbox the application])
3020     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3021         AC_MSG_ERROR([macOS sandboxing requires code signing])
3022     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3023         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3024     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3025         ENABLE_MACOSX_SANDBOX=TRUE
3026         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3027         AC_MSG_RESULT([yes])
3028     else
3029         AC_MSG_RESULT([no])
3030     fi
3032     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3033     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3034     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3036     AC_MSG_CHECKING([whether the linker supports -platform_version])
3037     save_LDFLAGS=$LDFLAGS
3038     LDFLAGS="$LDFLAGS -Xlinker -platform_version -Xlinker macos \
3039         -Xlinker $MAC_OS_X_VERSION_MIN_REQUIRED_DOTS -Xlinker 0.0.0"
3040     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3041         [AC_MSG_RESULT([yes])
3042          HAVE_MACOS_LD_PLATFORMVERSION=TRUE],
3043         [AC_MSG_RESULT([no])])
3044     LDFLAGS=$save_LDFLAGS
3046 AC_SUBST(MACOSX_SDK_PATH)
3047 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3048 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3049 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3050 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3051 AC_SUBST(INSTALL_NAME_TOOL)
3052 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3053 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3054 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3055 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3056 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3057 AC_SUBST(HAVE_MACOS_LD_PLATFORMVERSION)
3059 dnl ===================================================================
3060 dnl Check iOS SDK and compiler
3061 dnl ===================================================================
3063 if test $_os = iOS; then
3064     AC_MSG_CHECKING([what iOS SDK to use])
3065     current_sdk_ver=13.6
3066     older_sdk_vers="13.5 13.4 13.2 13.1 13.0 12.4 12.2"
3067     if test "$enable_ios_simulator" = "yes"; then
3068         platform=iPhoneSimulator
3069         versionmin=-mios-simulator-version-min=12.2
3070     else
3071         platform=iPhoneOS
3072         versionmin=-miphoneos-version-min=12.2
3073     fi
3074     xcode_developer=`xcode-select -print-path`
3076     for sdkver in $current_sdk_ver $older_sdk_vers; do
3077         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3078         if test -d $t; then
3079             sysroot=$t
3080             break
3081         fi
3082     done
3084     if test -z "$sysroot"; then
3085         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3086     fi
3088     AC_MSG_RESULT($sysroot)
3090     # LTO is not really recommended for iOS builds,
3091     # the link time will be astronomical
3092     if test "$ENABLE_LTO" = TRUE; then
3093         lto=-flto
3094     fi
3096     stdlib="-stdlib=libc++"
3098     AC_MSG_CHECKING([what C compiler to use])
3099     CC="`xcrun -find clang`"
3100     CC_BASE=`first_arg_basename "$CC"`
3101     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3102     AC_MSG_RESULT([$CC])
3104     AC_MSG_CHECKING([what C++ compiler to use])
3105     CXX="`xcrun -find clang++`"
3106     CXX_BASE=`first_arg_basename "$CXX"`
3107     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3108     AC_MSG_RESULT([$CXX])
3110     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3111     AR=`xcrun -find ar`
3112     NM=`xcrun -find nm`
3113     STRIP=`xcrun -find strip`
3114     LIBTOOL=`xcrun -find libtool`
3115     RANLIB=`xcrun -find ranlib`
3118 AC_MSG_CHECKING([whether to treat the installation as read-only])
3120 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3121         "$enable_extensions" != yes; then
3122     enable_readonly_installset=yes
3124 if test "$enable_readonly_installset" = yes; then
3125     AC_MSG_RESULT([yes])
3126     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3127 else
3128     AC_MSG_RESULT([no])
3131 dnl ===================================================================
3132 dnl Structure of install set
3133 dnl ===================================================================
3135 if test $_os = Darwin; then
3136     LIBO_BIN_FOLDER=MacOS
3137     LIBO_ETC_FOLDER=Resources
3138     LIBO_LIBEXEC_FOLDER=MacOS
3139     LIBO_LIB_FOLDER=Frameworks
3140     LIBO_LIB_PYUNO_FOLDER=Resources
3141     LIBO_SHARE_FOLDER=Resources
3142     LIBO_SHARE_HELP_FOLDER=Resources/help
3143     LIBO_SHARE_JAVA_FOLDER=Resources/java
3144     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3145     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3146     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3147     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3148     LIBO_URE_BIN_FOLDER=MacOS
3149     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3150     LIBO_URE_LIB_FOLDER=Frameworks
3151     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3152     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3153 elif test $_os = WINNT; then
3154     LIBO_BIN_FOLDER=program
3155     LIBO_ETC_FOLDER=program
3156     LIBO_LIBEXEC_FOLDER=program
3157     LIBO_LIB_FOLDER=program
3158     LIBO_LIB_PYUNO_FOLDER=program
3159     LIBO_SHARE_FOLDER=share
3160     LIBO_SHARE_HELP_FOLDER=help
3161     LIBO_SHARE_JAVA_FOLDER=program/classes
3162     LIBO_SHARE_PRESETS_FOLDER=presets
3163     LIBO_SHARE_READMES_FOLDER=readmes
3164     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3165     LIBO_SHARE_SHELL_FOLDER=program/shell
3166     LIBO_URE_BIN_FOLDER=program
3167     LIBO_URE_ETC_FOLDER=program
3168     LIBO_URE_LIB_FOLDER=program
3169     LIBO_URE_MISC_FOLDER=program
3170     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3171 else
3172     LIBO_BIN_FOLDER=program
3173     LIBO_ETC_FOLDER=program
3174     LIBO_LIBEXEC_FOLDER=program
3175     LIBO_LIB_FOLDER=program
3176     LIBO_LIB_PYUNO_FOLDER=program
3177     LIBO_SHARE_FOLDER=share
3178     LIBO_SHARE_HELP_FOLDER=help
3179     LIBO_SHARE_JAVA_FOLDER=program/classes
3180     LIBO_SHARE_PRESETS_FOLDER=presets
3181     LIBO_SHARE_READMES_FOLDER=readmes
3182     if test "$enable_fuzzers" != yes; then
3183         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3184     else
3185         LIBO_SHARE_RESOURCE_FOLDER=resource
3186     fi
3187     LIBO_SHARE_SHELL_FOLDER=program/shell
3188     LIBO_URE_BIN_FOLDER=program
3189     LIBO_URE_ETC_FOLDER=program
3190     LIBO_URE_LIB_FOLDER=program
3191     LIBO_URE_MISC_FOLDER=program
3192     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3194 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3195 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3196 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3197 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3198 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3199 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3200 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3201 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3202 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3203 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3204 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3205 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3206 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3207 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3208 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3209 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3211 # Not all of them needed in config_host.mk, add more if need arises
3212 AC_SUBST(LIBO_BIN_FOLDER)
3213 AC_SUBST(LIBO_ETC_FOLDER)
3214 AC_SUBST(LIBO_LIB_FOLDER)
3215 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3216 AC_SUBST(LIBO_SHARE_FOLDER)
3217 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3218 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3219 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3220 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3221 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3222 AC_SUBST(LIBO_URE_BIN_FOLDER)
3223 AC_SUBST(LIBO_URE_ETC_FOLDER)
3224 AC_SUBST(LIBO_URE_LIB_FOLDER)
3225 AC_SUBST(LIBO_URE_MISC_FOLDER)
3226 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3228 dnl ===================================================================
3229 dnl Windows specific tests and stuff
3230 dnl ===================================================================
3232 reg_get_value()
3234     # Return value: $regvalue
3235     unset regvalue
3237     local _regentry="/proc/registry${1}/${2}"
3238     if test -f "$_regentry"; then
3239         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3240         # Registry keys read via /proc/registry* are always \0 terminated!
3241         local _regvalue=$(tr -d '\0' < "$_regentry")
3242         if test $? -eq 0; then
3243             regvalue=$_regvalue
3244         fi
3245     fi
3248 # Get a value from the 32-bit side of the Registry
3249 reg_get_value_32()
3251     reg_get_value "32" "$1"
3254 # Get a value from the 64-bit side of the Registry
3255 reg_get_value_64()
3257     reg_get_value "64" "$1"
3260 if test "$_os" = "WINNT"; then
3261     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3262     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3263         AC_MSG_RESULT([no])
3264         WINDOWS_SDK_ARCH="x86"
3265     else
3266         AC_MSG_RESULT([yes])
3267         WINDOWS_SDK_ARCH="x64"
3268         BITNESS_OVERRIDE=64
3269     fi
3271 AC_SUBST(WINDOWS_SDK_ARCH)
3272 if test "$_os" = "iOS"; then
3273     cross_compiling="yes"
3276 if test "$cross_compiling" = "yes"; then
3277     export CROSS_COMPILING=TRUE
3278 else
3279     CROSS_COMPILING=
3280     BUILD_TYPE="$BUILD_TYPE NATIVE"
3282 AC_SUBST(CROSS_COMPILING)
3284 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3285 # NOTE: must _not_ be used for bundled external libraries!
3286 ISYSTEM=
3287 if test "$GCC" = "yes"; then
3288     AC_MSG_CHECKING( for -isystem )
3289     save_CFLAGS=$CFLAGS
3290     CFLAGS="$CFLAGS -Werror"
3291     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3292     CFLAGS=$save_CFLAGS
3293     if test -n "$ISYSTEM"; then
3294         AC_MSG_RESULT(yes)
3295     else
3296         AC_MSG_RESULT(no)
3297     fi
3299 if test -z "$ISYSTEM"; then
3300     # fall back to using -I
3301     ISYSTEM=-I
3303 AC_SUBST(ISYSTEM)
3305 dnl ===================================================================
3306 dnl  Check which Visual Studio compiler is used
3307 dnl ===================================================================
3309 map_vs_year_to_version()
3311     # Return value: $vsversion
3313     unset vsversion
3315     case $1 in
3316     2017)
3317         vsversion=15;;
3318     2019)
3319         vsversion=16;;
3320     *)
3321         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3322     esac
3325 vs_versions_to_check()
3327     # Args: $1 (optional) : versions to check, in the order of preference
3328     # Return value: $vsversions
3330     unset vsversions
3332     if test -n "$1"; then
3333         map_vs_year_to_version "$1"
3334         vsversions=$vsversion
3335     else
3336         # We accept only 2017
3337         vsversions="15"
3338     fi
3341 win_get_env_from_vsvars32bat()
3343     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3344     # Also seems to be located in another directory under the same name: vsvars32.bat
3345     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3346     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3347     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3348     chmod +x $WRAPPERBATCHFILEPATH
3349     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3350     rm -f $WRAPPERBATCHFILEPATH
3351     printf '%s' "$_win_get_env_from_vsvars32bat"
3354 find_ucrt()
3356     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3357     if test -n "$regvalue"; then
3358         PathFormat "$regvalue"
3359         UCRTSDKDIR=$formatted_path
3360         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3361         UCRTVERSION=$regvalue
3362         # Rest if not exist
3363         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3364           UCRTSDKDIR=
3365         fi
3366     fi
3367     if test -z "$UCRTSDKDIR"; then
3368         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3369         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3370         if test -f "$ide_env_file"; then
3371             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3372             UCRTSDKDIR=$formatted_path
3373             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3374             dnl Hack needed at least by tml:
3375             if test "$UCRTVERSION" = 10.0.15063.0 \
3376                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3377                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3378             then
3379                 UCRTVERSION=10.0.14393.0
3380             fi
3381         else
3382           AC_MSG_ERROR([No UCRT found])
3383         fi
3384     fi
3387 find_msvc()
3389     # Find Visual C++ 2017/2019
3390     # Args: $1 (optional) : The VS version year
3391     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3393     unset vctest vcnum vcnumwithdot vcbuildnumber
3395     vs_versions_to_check "$1"
3396     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3397     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3398     PathFormat "$vswhere"
3399     vswhere=$formatted_path
3400     for ver in $vsversions; do
3401         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3402         if test -n "$vswhereoutput"; then
3403             PathFormat "$vswhereoutput"
3404             vctest=$formatted_path
3405             break
3406         fi
3407     done
3409     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3410     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3411     # should be removed when upgrading baseline.
3412     if ! test -n "$vctest"; then
3413         for ver in $vsversions; do
3414             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3415             if test -n "$regvalue"; then
3416                 vctest=$regvalue
3417                 break
3418             fi
3419             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3420             if test -n "$regvalue"; then
3421                 AC_MSG_RESULT([found: $regvalue])
3422                 PathFormat "$regvalue"
3423                 vctest=$formatted_path
3424                 break
3425             fi
3426         done
3427     fi
3429     if test -n "$vctest"; then
3430         vcnumwithdot="$ver.0"
3431         case "$vcnumwithdot" in
3432         15.0)
3433             vcyear=2017
3434             vcnum=150
3435             ;;
3436         16.0)
3437             vcyear=2019
3438             vcnum=160
3439             ;;
3440         esac
3441         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3443     fi
3446 SOLARINC=
3447 MSBUILD_PATH=
3448 DEVENV=
3449 if test "$_os" = "WINNT"; then
3450     AC_MSG_CHECKING([Visual C++])
3451     find_msvc "$with_visual_studio"
3452     if test -z "$vctest"; then
3453         if test -n "$with_visual_studio"; then
3454             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3455         else
3456             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3457         fi
3458     fi
3460     if test "$BITNESS_OVERRIDE" = ""; then
3461         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3462             VC_PRODUCT_DIR=$vctest/VC
3463         else
3464             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3465         fi
3466     else
3467         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3468             VC_PRODUCT_DIR=$vctest/VC
3469         else
3470             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3471         fi
3472     fi
3473     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3475     AC_MSG_CHECKING([for short pathname of VC product directory])
3476     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3477     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3479     UCRTSDKDIR=
3480     UCRTVERSION=
3482     AC_MSG_CHECKING([for UCRT location])
3483     find_ucrt
3484     # find_ucrt errors out if it doesn't find it
3485     AC_MSG_RESULT([found])
3486     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3487     ucrtincpath_formatted=$formatted_path
3488     # SOLARINC is used for external modules and must be set too.
3489     # And no, it's not sufficient to set SOLARINC only, as configure
3490     # itself doesn't honour it.
3491     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3492     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3493     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3494     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3496     AC_SUBST(UCRTSDKDIR)
3497     AC_SUBST(UCRTVERSION)
3499     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3500     # Find the proper version of MSBuild.exe to use based on the VS version
3501     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3502     if test -n "$regvalue" ; then
3503         AC_MSG_RESULT([found: $regvalue])
3504         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3505     else
3506         if test "$vcnumwithdot" = "16.0"; then
3507             if test "$BITNESS_OVERRIDE" = ""; then
3508                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3509             else
3510                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3511             fi
3512         else
3513             if test "$BITNESS_OVERRIDE" = ""; then
3514                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3515             else
3516                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3517             fi
3518         fi
3519         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3520         AC_MSG_RESULT([$regvalue])
3521     fi
3523     # Find the version of devenv.exe
3524     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3525     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3526     if test ! -e "$DEVENV"; then
3527         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3528     fi
3530     dnl ===========================================================
3531     dnl  Check for the corresponding mspdb*.dll
3532     dnl ===========================================================
3534     VC_HOST_DIR=
3535     MSPDB_PATH=
3536     CL_PATH=
3538     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3539         VC_HOST_DIR="HostX64"
3540         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3541     else
3542         VC_HOST_DIR="HostX86"
3543         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3544     fi
3546     if test "$BITNESS_OVERRIDE" = ""; then
3547         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3548     else
3549         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3550     fi
3552     # MSVC 15.0 has libraries from 14.0?
3553     mspdbnum="140"
3555     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3556         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3557     fi
3559     dnl The path needs to be added before cl is called
3560     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3561     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3563     AC_MSG_CHECKING([cl.exe])
3565     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3566     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3567     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3568     # is not enough?
3570     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3571     dnl needed when building CLR code:
3572     if test -z "$MSVC_CXX"; then
3573         if test -f "$CL_PATH/cl.exe"; then
3574             MSVC_CXX="$CL_PATH/cl.exe"
3575         fi
3577         # This gives us a posix path with 8.3 filename restrictions
3578         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3579     fi
3581     if test -z "$CC"; then
3582         CC=$MSVC_CXX
3583         CC_BASE=`first_arg_basename "$CC"`
3584     fi
3585     if test "$BITNESS_OVERRIDE" = ""; then
3586         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3587         MSVC_CXX="$MSVC_CXX -arch:SSE"
3588     fi
3589     if test -z "$CXX"; then
3590         CXX=$MSVC_CXX
3591         CXX_BASE=`first_arg_basename "$CXX"`
3592     fi
3594     if test -n "$CC"; then
3595         # Remove /cl.exe from CC case insensitive
3596         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3597         if test "$BITNESS_OVERRIDE" = ""; then
3598            COMPATH="$VC_PRODUCT_DIR"
3599         else
3600             if test -n "$VC_PRODUCT_DIR"; then
3601                 COMPATH=$VC_PRODUCT_DIR
3602             fi
3603         fi
3604         if test "$BITNESS_OVERRIDE" = ""; then
3605             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3606             CC="$CC -arch:SSE"
3607         fi
3609         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3611         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3613         PathFormat "$COMPATH"
3614         COMPATH=`win_short_path_for_make "$formatted_path"`
3616         VCVER=$vcnum
3617         MSVSVER=$vcyear
3619         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3620         # are always "better", we list them in reverse chronological order.
3622         case "$vcnum" in
3623         150|160)
3624             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3625             ;;
3626         esac
3628         # The expectation is that --with-windows-sdk should not need to be used
3629         if test -n "$with_windows_sdk"; then
3630             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3631             *" "$with_windows_sdk" "*)
3632                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3633                 ;;
3634             *)
3635                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3636                 ;;
3637             esac
3638         fi
3640         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3641         ac_objext=obj
3642         ac_exeext=exe
3644     else
3645         AC_MSG_ERROR([Visual C++ not found after all, huh])
3646     fi
3648     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3649     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3650         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3651         // between Visual Studio versions and _MSC_VER:
3652         #if _MSC_VER < 1914
3653         #error
3654         #endif
3655     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3657     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3658     # version of the Explorer extension (and maybe other small
3659     # bits, too) needed when installing a 32-bit LibreOffice on a
3660     # 64-bit OS. The 64-bit Explorer extension is a feature that
3661     # has been present since long in OOo. Don't confuse it with
3662     # building LibreOffice itself as 64-bit code.
3664     BUILD_X64=
3665     CXX_X64_BINARY=
3667     if test "$BITNESS_OVERRIDE" = ""; then
3668         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3669         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3670              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3671             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3672                 BUILD_X64=TRUE
3673                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3674             fi
3675         fi
3676         if test "$BUILD_X64" = TRUE; then
3677             AC_MSG_RESULT([found])
3678         else
3679             AC_MSG_RESULT([not found])
3680             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3681         fi
3682     else
3683         CXX_X64_BINARY=$CXX
3684     fi
3685     AC_SUBST(BUILD_X64)
3687     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3688     AC_SUBST(CXX_X64_BINARY)
3690     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3691     # needed to support TWAIN scan on both 32- and 64-bit systems
3693     BUILD_X86=
3695     if test "$BITNESS_OVERRIDE" = "64"; then
3696         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3697         if test -n "$CXX_X86_BINARY"; then
3698             BUILD_X86=TRUE
3699             AC_MSG_RESULT([preset])
3700         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3701             BUILD_X86=TRUE
3702             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3703             CXX_X86_BINARY+=" /arch:SSE"
3704             AC_MSG_RESULT([found])
3705         else
3706             CXX_X86_BINARY=
3707             AC_MSG_RESULT([not found])
3708             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3709         fi
3710     else
3711         BUILD_X86=TRUE
3712         CXX_X86_BINARY=$MSVC_CXX
3713     fi
3714     AC_SUBST(BUILD_X86)
3715     AC_SUBST(CXX_X86_BINARY)
3717 AC_SUBST(VCVER)
3718 AC_SUBST(DEVENV)
3719 AC_SUBST(MSVC_CXX)
3722 # unowinreg.dll
3724 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3725 AC_SUBST(UNOWINREG_DLL)
3727 COM_IS_CLANG=
3728 AC_MSG_CHECKING([whether the compiler is actually Clang])
3729 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3730     #ifndef __clang__
3731     you lose
3732     #endif
3733     int foo=42;
3734     ]])],
3735     [AC_MSG_RESULT([yes])
3736      COM_IS_CLANG=TRUE],
3737     [AC_MSG_RESULT([no])])
3738 AC_SUBST(COM_IS_CLANG)
3740 CC_PLAIN=$CC
3741 CLANGVER=
3742 if test "$COM_IS_CLANG" = TRUE; then
3743     AC_MSG_CHECKING([whether Clang is new enough])
3744     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3745         #if !defined __apple_build_version__
3746         #error
3747         #endif
3748         ]])],
3749         [my_apple_clang=yes],[my_apple_clang=])
3750     if test "$my_apple_clang" = yes; then
3751         AC_MSG_RESULT([assumed yes (Apple Clang)])
3752     else
3753         if test "$_os" = WINNT; then
3754             dnl In which case, assume clang-cl:
3755             my_args="/EP /TC"
3756             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3757             dnl clang-cl:
3758             CC_PLAIN=
3759             for i in $CC; do
3760                 case $i in
3761                 -FIIntrin.h)
3762                     ;;
3763                 *)
3764                     CC_PLAIN="$CC_PLAIN $i"
3765                     ;;
3766                 esac
3767             done
3768         else
3769             my_args="-E -P"
3770         fi
3771         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3772         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3773         CLANGVER=`echo $clang_version \
3774             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3775         if test "$CLANGVER" -ge 50002; then
3776             AC_MSG_RESULT([yes ($clang_version)])
3777         else
3778             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3779         fi
3780         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3781         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3782     fi
3785 SHOWINCLUDES_PREFIX=
3786 if test "$_os" = WINNT; then
3787     dnl We need to guess the prefix of the -showIncludes output, it can be
3788     dnl localized
3789     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3790     echo "#include <stdlib.h>" > conftest.c
3791     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3792         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3793     rm -f conftest.c conftest.obj
3794     if test -z "$SHOWINCLUDES_PREFIX"; then
3795         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3796     else
3797         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3798     fi
3800 AC_SUBST(SHOWINCLUDES_PREFIX)
3803 # prefix C with ccache if needed
3805 if test "$CCACHE" != ""; then
3806     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3808     AC_LANG_PUSH([C])
3809     save_CFLAGS=$CFLAGS
3810     CFLAGS="$CFLAGS --ccache-skip -O2"
3811     dnl an empty program will do, we're checking the compiler flags
3812     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3813                       [use_ccache=yes], [use_ccache=no])
3814     if test $use_ccache = yes; then
3815         AC_MSG_RESULT([yes])
3816     else
3817         CC="$CCACHE $CC"
3818         CC_BASE="ccache $CC_BASE"
3819         AC_MSG_RESULT([no])
3820     fi
3821     CFLAGS=$save_CFLAGS
3822     AC_LANG_POP([C])
3825 # ===================================================================
3826 # check various GCC options that Clang does not support now but maybe
3827 # will somewhen in the future, check them even for GCC, so that the
3828 # flags are set
3829 # ===================================================================
3831 HAVE_GCC_GGDB2=
3832 if test "$GCC" = "yes"; then
3833     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3834     save_CFLAGS=$CFLAGS
3835     CFLAGS="$CFLAGS -Werror -ggdb2"
3836     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3837     CFLAGS=$save_CFLAGS
3838     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3839         AC_MSG_RESULT([yes])
3840     else
3841         AC_MSG_RESULT([no])
3842     fi
3844     if test "$host_cpu" = "m68k"; then
3845         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3846         save_CFLAGS=$CFLAGS
3847         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3848         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3849         CFLAGS=$save_CFLAGS
3850         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3851             AC_MSG_RESULT([yes])
3852         else
3853             AC_MSG_ERROR([no])
3854         fi
3855     fi
3857 AC_SUBST(HAVE_GCC_GGDB2)
3859 dnl ===================================================================
3860 dnl  Test the gcc version
3861 dnl ===================================================================
3862 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3863     AC_MSG_CHECKING([the GCC version])
3864     _gcc_version=`$CC -dumpversion`
3865     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3866         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3867     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3869     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3871     if test "$gcc_full_version" -lt 70000; then
3872         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3873     fi
3874 else
3875     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3876     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3877     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3878     # (which reports itself as GCC 4.2.1).
3879     GCC_VERSION=
3881 AC_SUBST(GCC_VERSION)
3883 dnl Set the ENABLE_DBGUTIL variable
3884 dnl ===================================================================
3885 AC_MSG_CHECKING([whether to build with additional debug utilities])
3886 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3887     ENABLE_DBGUTIL="TRUE"
3888     # this is an extra var so it can have different default on different MSVC
3889     # versions (in case there are version specific problems with it)
3890     MSVC_USE_DEBUG_RUNTIME="TRUE"
3892     AC_MSG_RESULT([yes])
3893     # cppunit and graphite expose STL in public headers
3894     if test "$with_system_cppunit" = "yes"; then
3895         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3896     else
3897         with_system_cppunit=no
3898     fi
3899     if test "$with_system_graphite" = "yes"; then
3900         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3901     else
3902         with_system_graphite=no
3903     fi
3904     if test "$with_system_orcus" = "yes"; then
3905         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3906     else
3907         with_system_orcus=no
3908     fi
3909     if test "$with_system_libcmis" = "yes"; then
3910         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3911     else
3912         with_system_libcmis=no
3913     fi
3914     if test "$with_system_hunspell" = "yes"; then
3915         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3916     else
3917         with_system_hunspell=no
3918     fi
3919     if test "$with_system_gpgmepp" = "yes"; then
3920         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3921     else
3922         with_system_gpgmepp=no
3923     fi
3924     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3925     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3926     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3927     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3928     # of those two is using the system variant:
3929     if test "$with_system_libnumbertext" = "yes"; then
3930         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3931     else
3932         with_system_libnumbertext=no
3933     fi
3934     if test "$with_system_libwps" = "yes"; then
3935         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3936     else
3937         with_system_libwps=no
3938     fi
3939 else
3940     ENABLE_DBGUTIL=""
3941     MSVC_USE_DEBUG_RUNTIME=""
3942     AC_MSG_RESULT([no])
3944 AC_SUBST(ENABLE_DBGUTIL)
3945 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3947 dnl Set the ENABLE_DEBUG variable.
3948 dnl ===================================================================
3949 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3950     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3952 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3953     if test -z "$libo_fuzzed_enable_debug"; then
3954         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3955     else
3956         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3957         enable_debug=yes
3958     fi
3961 AC_MSG_CHECKING([whether to do a debug build])
3962 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3963     ENABLE_DEBUG="TRUE"
3964     if test -n "$ENABLE_DBGUTIL" ; then
3965         AC_MSG_RESULT([yes (dbgutil)])
3966     else
3967         AC_MSG_RESULT([yes])
3968     fi
3969 else
3970     ENABLE_DEBUG=""
3971     AC_MSG_RESULT([no])
3973 AC_SUBST(ENABLE_DEBUG)
3975 dnl ===================================================================
3976 dnl Select the linker to use (gold/lld/ld.bfd).
3977 dnl This is done only after compiler checks (need to know if Clang is
3978 dnl used, for different defaults) and after checking if a debug build
3979 dnl is wanted (non-debug builds get the default linker if not explicitly
3980 dnl specified otherwise).
3981 dnl All checks for linker features/options should come after this.
3982 dnl ===================================================================
3983 check_use_ld()
3985     use_ld=$1
3986     use_ld_fail_if_error=$2
3987     use_ld_ok=
3988     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3989     use_ld_ldflags_save="$LDFLAGS"
3990     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3991     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3992 #include <stdio.h>
3993         ],[
3994 printf ("hello world\n");
3995         ])], USE_LD=$use_ld, [])
3996     if test -n "$USE_LD"; then
3997         AC_MSG_RESULT( yes )
3998         use_ld_ok=yes
3999     else
4000         if test -n "$use_ld_fail_if_error"; then
4001             AC_MSG_ERROR( no )
4002         else
4003             AC_MSG_RESULT( no )
4004         fi
4005     fi
4006     if test -n "$use_ld_ok"; then
4007         dnl keep the value of LDFLAGS
4008         return 0
4009     fi
4010     LDFLAGS="$use_ld_ldflags_save"
4011     return 1
4013 USE_LD=
4014 if test "$enable_ld" != "no"; then
4015     if test "$GCC" = "yes"; then
4016         if test -n "$enable_ld"; then
4017             check_use_ld "$enable_ld" fail_if_error
4018         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4019             dnl non-debug builds default to the default linker
4020             true
4021         elif test -n "$COM_IS_CLANG"; then
4022             check_use_ld lld
4023             if test $? -ne 0; then
4024                 check_use_ld gold
4025             fi
4026         else
4027             # For gcc first try gold, new versions also support lld.
4028             check_use_ld gold
4029             if test $? -ne 0; then
4030                 check_use_ld lld
4031             fi
4032         fi
4033         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4034         rm conftest.out
4035         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4036         if test -z "$ld_used"; then
4037             ld_used="unknown"
4038         fi
4039         AC_MSG_CHECKING([for linker that is used])
4040         AC_MSG_RESULT([$ld_used])
4041         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4042             if echo "$ld_used" | grep -q "^GNU ld"; then
4043                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4044                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4045             fi
4046         fi
4047     else
4048         if test "$enable_ld" = "yes"; then
4049             AC_MSG_ERROR([--enable-ld not supported])
4050         fi
4051     fi
4053 AC_SUBST(USE_LD)
4055 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4056 if test "$GCC" = "yes"; then
4057     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4058     bsymbolic_functions_ldflags_save=$LDFLAGS
4059     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4060     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4061 #include <stdio.h>
4062         ],[
4063 printf ("hello world\n");
4064         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4065     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4066         AC_MSG_RESULT( found )
4067     else
4068         AC_MSG_RESULT( not found )
4069     fi
4070     LDFLAGS=$bsymbolic_functions_ldflags_save
4072 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4075 HAVE_GSPLIT_DWARF=
4076 if test "$enable_split_debug" != no; then
4077     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4078     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4079         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4080         save_CFLAGS=$CFLAGS
4081         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4082         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4083         CFLAGS=$save_CFLAGS
4084         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4085             AC_MSG_RESULT([yes])
4086         else
4087             if test "$enable_split_debug" = yes; then
4088                 AC_MSG_ERROR([no])
4089             else
4090                 AC_MSG_RESULT([no])
4091             fi
4092         fi
4093     fi
4094     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4095         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4096         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4097     fi
4099 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4101 ENABLE_GDB_INDEX=
4102 if test "$enable_gdb_index" != "no"; then
4103     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4104     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4105         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4106         save_CFLAGS=$CFLAGS
4107         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4108         have_ggnu_pubnames=
4109         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4110         if test "$have_ggnu_pubnames" != "TRUE"; then
4111             if test "$enable_gdb_index" = "yes"; then
4112                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4113             else
4114                 AC_MSG_RESULT( no )
4115             fi
4116         else
4117             AC_MSG_RESULT( yes )
4118             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4119             ldflags_save=$LDFLAGS
4120             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4121             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4122 #include <stdio.h>
4123                 ],[
4124 printf ("hello world\n");
4125                 ])], ENABLE_GDB_INDEX=TRUE, [])
4126             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4127                 AC_MSG_RESULT( yes )
4128             else
4129                 if test "$enable_gdb_index" = "yes"; then
4130                     AC_MSG_ERROR( no )
4131                 else
4132                     AC_MSG_RESULT( no )
4133                 fi
4134             fi
4135             LDFLAGS=$ldflags_save
4136         fi
4137         CFLAGS=$save_CFLAGS
4138         fi
4139     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4140         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4141         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4142     fi
4144 AC_SUBST(ENABLE_GDB_INDEX)
4146 if test "$enable_sal_log" = yes; then
4147     ENABLE_SAL_LOG=TRUE
4149 AC_SUBST(ENABLE_SAL_LOG)
4151 dnl Check for enable symbols option
4152 dnl ===================================================================
4153 AC_MSG_CHECKING([whether to generate debug information])
4154 if test -z "$enable_symbols"; then
4155     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4156         enable_symbols=yes
4157     else
4158         enable_symbols=no
4159     fi
4161 if test "$enable_symbols" = yes; then
4162     ENABLE_SYMBOLS_FOR=all
4163     AC_MSG_RESULT([yes])
4164 elif test "$enable_symbols" = no; then
4165     ENABLE_SYMBOLS_FOR=
4166     AC_MSG_RESULT([no])
4167 else
4168     # Selective debuginfo.
4169     ENABLE_SYMBOLS_FOR="$enable_symbols"
4170     AC_MSG_RESULT([for "$enable_symbols"])
4172 AC_SUBST(ENABLE_SYMBOLS_FOR)
4174 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4175     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4176     AC_MSG_CHECKING([whether enough memory is available for linking])
4177     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4178     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4179     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4180         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4181     else
4182         AC_MSG_RESULT([yes])
4183     fi
4186 AC_MSG_CHECKING([whether to compile with optimization flags])
4187 if test -z "$enable_optimized"; then
4188     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4189         enable_optimized=no
4190     else
4191         enable_optimized=yes
4192     fi
4194 if test "$enable_optimized" != no; then
4195     ENABLE_OPTIMIZED=TRUE
4196     AC_MSG_RESULT([yes])
4197 else
4198     ENABLE_OPTIMIZED=
4199     AC_MSG_RESULT([no])
4201 AC_SUBST(ENABLE_OPTIMIZED)
4204 # determine CPUNAME, OS, ...
4205 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4207 case "$host_os" in
4209 aix*)
4210     COM=GCC
4211     CPUNAME=POWERPC
4212     USING_X11=TRUE
4213     OS=AIX
4214     RTL_OS=AIX
4215     RTL_ARCH=PowerPC
4216     PLATFORMID=aix_powerpc
4217     P_SEP=:
4218     ;;
4220 cygwin*)
4221     COM=MSC
4222     USING_X11=
4223     OS=WNT
4224     RTL_OS=Windows
4225     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4226         P_SEP=";"
4227     else
4228         P_SEP=:
4229     fi
4230     case "$host_cpu" in
4231     i*86|x86_64)
4232         if test "$BITNESS_OVERRIDE" = 64; then
4233             CPUNAME=X86_64
4234             RTL_ARCH=X86_64
4235             PLATFORMID=windows_x86_64
4236             WINDOWS_X64=1
4237             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4238         else
4239             CPUNAME=INTEL
4240             RTL_ARCH=x86
4241             PLATFORMID=windows_x86
4242         fi
4243         ;;
4244     *)
4245         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4246         ;;
4247     esac
4248     SCPDEFS="$SCPDEFS -D_MSC_VER"
4249     ;;
4251 darwin*)
4252     COM=GCC
4253     USING_X11=
4254     OS=MACOSX
4255     RTL_OS=MacOSX
4256     P_SEP=:
4258     case "$host_cpu" in
4259     arm)
4260         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4261         ;;
4262     arm64)
4263         OS=iOS
4264         RTL_OS=iOS
4265         if test "$enable_ios_simulator" = "yes"; then
4266             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4267         else
4268             CPUNAME=ARM64
4269             RTL_ARCH=ARM_EABI
4270             PLATFORMID=ios_arm64
4271         fi
4272         ;;
4273     i*86)
4274         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4275         ;;
4276     x86_64)
4277         if test "$enable_ios_simulator" = "yes"; then
4278             OS=iOS
4279         fi
4280         CPUNAME=X86_64
4281         RTL_ARCH=X86_64
4282         PLATFORMID=macosx_x86_64
4283         ;;
4284     *)
4285         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4286         ;;
4287     esac
4288     ;;
4290 dragonfly*)
4291     COM=GCC
4292     USING_X11=TRUE
4293     OS=DRAGONFLY
4294     RTL_OS=DragonFly
4295     P_SEP=:
4297     case "$host_cpu" in
4298     i*86)
4299         CPUNAME=INTEL
4300         RTL_ARCH=x86
4301         PLATFORMID=dragonfly_x86
4302         ;;
4303     x86_64)
4304         CPUNAME=X86_64
4305         RTL_ARCH=X86_64
4306         PLATFORMID=dragonfly_x86_64
4307         ;;
4308     *)
4309         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4310         ;;
4311     esac
4312     ;;
4314 freebsd*)
4315     COM=GCC
4316     USING_X11=TRUE
4317     RTL_OS=FreeBSD
4318     OS=FREEBSD
4319     P_SEP=:
4321     case "$host_cpu" in
4322     i*86)
4323         CPUNAME=INTEL
4324         RTL_ARCH=x86
4325         PLATFORMID=freebsd_x86
4326         ;;
4327     x86_64|amd64)
4328         CPUNAME=X86_64
4329         RTL_ARCH=X86_64
4330         PLATFORMID=freebsd_x86_64
4331         ;;
4332     *)
4333         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4334         ;;
4335     esac
4336     ;;
4338 haiku*)
4339     COM=GCC
4340     USING_X11=
4341     GUIBASE=haiku
4342     RTL_OS=Haiku
4343     OS=HAIKU
4344     P_SEP=:
4346     case "$host_cpu" in
4347     i*86)
4348         CPUNAME=INTEL
4349         RTL_ARCH=x86
4350         PLATFORMID=haiku_x86
4351         ;;
4352     x86_64|amd64)
4353         CPUNAME=X86_64
4354         RTL_ARCH=X86_64
4355         PLATFORMID=haiku_x86_64
4356         ;;
4357     *)
4358         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4359         ;;
4360     esac
4361     ;;
4363 kfreebsd*)
4364     COM=GCC
4365     USING_X11=TRUE
4366     OS=LINUX
4367     RTL_OS=kFreeBSD
4368     P_SEP=:
4370     case "$host_cpu" in
4372     i*86)
4373         CPUNAME=INTEL
4374         RTL_ARCH=x86
4375         PLATFORMID=kfreebsd_x86
4376         ;;
4377     x86_64)
4378         CPUNAME=X86_64
4379         RTL_ARCH=X86_64
4380         PLATFORMID=kfreebsd_x86_64
4381         ;;
4382     *)
4383         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4384         ;;
4385     esac
4386     ;;
4388 linux-gnu*)
4389     COM=GCC
4390     USING_X11=TRUE
4391     OS=LINUX
4392     RTL_OS=Linux
4393     P_SEP=:
4395     case "$host_cpu" in
4397     aarch64)
4398         CPUNAME=AARCH64
4399         PLATFORMID=linux_aarch64
4400         RTL_ARCH=AARCH64
4401         ;;
4402     alpha)
4403         CPUNAME=AXP
4404         RTL_ARCH=ALPHA
4405         PLATFORMID=linux_alpha
4406         ;;
4407     arm*)
4408         CPUNAME=ARM
4409         EPM_FLAGS="-a arm"
4410         RTL_ARCH=ARM_EABI
4411         PLATFORMID=linux_arm_eabi
4412         case "$host_cpu" in
4413         arm*-linux)
4414             RTL_ARCH=ARM_OABI
4415             PLATFORMID=linux_arm_oabi
4416             ;;
4417         esac
4418         ;;
4419     hppa)
4420         CPUNAME=HPPA
4421         RTL_ARCH=HPPA
4422         EPM_FLAGS="-a hppa"
4423         PLATFORMID=linux_hppa
4424         ;;
4425     i*86)
4426         CPUNAME=INTEL
4427         RTL_ARCH=x86
4428         PLATFORMID=linux_x86
4429         ;;
4430     ia64)
4431         CPUNAME=IA64
4432         RTL_ARCH=IA64
4433         PLATFORMID=linux_ia64
4434         ;;
4435     mips)
4436         CPUNAME=GODSON
4437         RTL_ARCH=MIPS_EB
4438         EPM_FLAGS="-a mips"
4439         PLATFORMID=linux_mips_eb
4440         ;;
4441     mips64)
4442         CPUNAME=GODSON64
4443         RTL_ARCH=MIPS64_EB
4444         EPM_FLAGS="-a mips64"
4445         PLATFORMID=linux_mips64_eb
4446         ;;
4447     mips64el)
4448         CPUNAME=GODSON64
4449         RTL_ARCH=MIPS64_EL
4450         EPM_FLAGS="-a mips64el"
4451         PLATFORMID=linux_mips64_el
4452         ;;
4453     mipsel)
4454         CPUNAME=GODSON
4455         RTL_ARCH=MIPS_EL
4456         EPM_FLAGS="-a mipsel"
4457         PLATFORMID=linux_mips_el
4458         ;;
4459     m68k)
4460         CPUNAME=M68K
4461         RTL_ARCH=M68K
4462         PLATFORMID=linux_m68k
4463         ;;
4464     powerpc)
4465         CPUNAME=POWERPC
4466         RTL_ARCH=PowerPC
4467         PLATFORMID=linux_powerpc
4468         ;;
4469     powerpc64)
4470         CPUNAME=POWERPC64
4471         RTL_ARCH=PowerPC_64
4472         PLATFORMID=linux_powerpc64
4473         ;;
4474     powerpc64le)
4475         CPUNAME=POWERPC64
4476         RTL_ARCH=PowerPC_64_LE
4477         PLATFORMID=linux_powerpc64_le
4478         ;;
4479     sparc)
4480         CPUNAME=SPARC
4481         RTL_ARCH=SPARC
4482         PLATFORMID=linux_sparc
4483         ;;
4484     sparc64)
4485         CPUNAME=SPARC64
4486         RTL_ARCH=SPARC64
4487         PLATFORMID=linux_sparc64
4488         ;;
4489     s390)
4490         CPUNAME=S390
4491         RTL_ARCH=S390
4492         PLATFORMID=linux_s390
4493         ;;
4494     s390x)
4495         CPUNAME=S390X
4496         RTL_ARCH=S390x
4497         PLATFORMID=linux_s390x
4498         ;;
4499     x86_64)
4500         CPUNAME=X86_64
4501         RTL_ARCH=X86_64
4502         PLATFORMID=linux_x86_64
4503         ;;
4504     *)
4505         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4506         ;;
4507     esac
4508     ;;
4510 linux-android*)
4511     COM=GCC
4512     USING_X11=
4513     OS=ANDROID
4514     RTL_OS=Android
4515     P_SEP=:
4517     case "$host_cpu" in
4519     arm|armel)
4520         CPUNAME=ARM
4521         RTL_ARCH=ARM_EABI
4522         PLATFORMID=android_arm_eabi
4523         ;;
4524     aarch64)
4525         CPUNAME=AARCH64
4526         RTL_ARCH=AARCH64
4527         PLATFORMID=android_aarch64
4528         ;;
4529     i*86)
4530         CPUNAME=INTEL
4531         RTL_ARCH=x86
4532         PLATFORMID=android_x86
4533         ;;
4534     x86_64)
4535         CPUNAME=X86_64
4536         RTL_ARCH=X86_64
4537         PLATFORMID=android_x86_64
4538         ;;
4539     *)
4540         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4541         ;;
4542     esac
4543     ;;
4545 *netbsd*)
4546     COM=GCC
4547     USING_X11=TRUE
4548     OS=NETBSD
4549     RTL_OS=NetBSD
4550     P_SEP=:
4552     case "$host_cpu" in
4553     i*86)
4554         CPUNAME=INTEL
4555         RTL_ARCH=x86
4556         PLATFORMID=netbsd_x86
4557         ;;
4558     powerpc)
4559         CPUNAME=POWERPC
4560         RTL_ARCH=PowerPC
4561         PLATFORMID=netbsd_powerpc
4562         ;;
4563     sparc)
4564         CPUNAME=SPARC
4565         RTL_ARCH=SPARC
4566         PLATFORMID=netbsd_sparc
4567         ;;
4568     x86_64)
4569         CPUNAME=X86_64
4570         RTL_ARCH=X86_64
4571         PLATFORMID=netbsd_x86_64
4572         ;;
4573     *)
4574         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4575         ;;
4576     esac
4577     ;;
4579 openbsd*)
4580     COM=GCC
4581     USING_X11=TRUE
4582     OS=OPENBSD
4583     RTL_OS=OpenBSD
4584     P_SEP=:
4586     case "$host_cpu" in
4587     i*86)
4588         CPUNAME=INTEL
4589         RTL_ARCH=x86
4590         PLATFORMID=openbsd_x86
4591         ;;
4592     x86_64)
4593         CPUNAME=X86_64
4594         RTL_ARCH=X86_64
4595         PLATFORMID=openbsd_x86_64
4596         ;;
4597     *)
4598         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4599         ;;
4600     esac
4601     SOLARINC="$SOLARINC -I/usr/local/include"
4602     ;;
4604 solaris*)
4605     COM=GCC
4606     USING_X11=TRUE
4607     OS=SOLARIS
4608     RTL_OS=Solaris
4609     P_SEP=:
4611     case "$host_cpu" in
4612     i*86)
4613         CPUNAME=INTEL
4614         RTL_ARCH=x86
4615         PLATFORMID=solaris_x86
4616         ;;
4617     sparc)
4618         CPUNAME=SPARC
4619         RTL_ARCH=SPARC
4620         PLATFORMID=solaris_sparc
4621         ;;
4622     sparc64)
4623         CPUNAME=SPARC64
4624         RTL_ARCH=SPARC64
4625         PLATFORMID=solaris_sparc64
4626         ;;
4627     *)
4628         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4629         ;;
4630     esac
4631     SOLARINC="$SOLARINC -I/usr/local/include"
4632     ;;
4635     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4636     ;;
4637 esac
4639 if test "$with_x" = "no"; then
4640     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4643 DISABLE_GUI=""
4644 if test "$enable_gui" = "no"; then
4645     if test "$USING_X11" != TRUE; then
4646         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4647     fi
4648     USING_X11=
4649     DISABLE_GUI=TRUE
4650     AC_DEFINE(HAVE_FEATURE_UI,0)
4651     test_cairo=yes
4653 AC_SUBST(DISABLE_GUI)
4655 WORKDIR="${BUILDDIR}/workdir"
4656 INSTDIR="${BUILDDIR}/instdir"
4657 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4658 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4659 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4660 AC_SUBST(COM)
4661 AC_SUBST(CPUNAME)
4662 AC_SUBST(RTL_OS)
4663 AC_SUBST(RTL_ARCH)
4664 AC_SUBST(EPM_FLAGS)
4665 AC_SUBST(USING_X11)
4666 AC_SUBST([INSTDIR])
4667 AC_SUBST([INSTROOT])
4668 AC_SUBST([INSTROOTBASE])
4669 AC_SUBST(OS)
4670 AC_SUBST(P_SEP)
4671 AC_SUBST(WORKDIR)
4672 AC_SUBST(PLATFORMID)
4673 AC_SUBST(WINDOWS_X64)
4674 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4676 dnl ===================================================================
4677 dnl Test which package format to use
4678 dnl ===================================================================
4679 AC_MSG_CHECKING([which package format to use])
4680 if test -n "$with_package_format" -a "$with_package_format" != no; then
4681     for i in $with_package_format; do
4682         case "$i" in
4683         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4684             ;;
4685         *)
4686             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4687 aix - AIX software distribution
4688 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4689 deb - Debian software distribution
4690 pkg - Solaris software distribution
4691 rpm - RedHat software distribution
4693 LibreOffice additionally supports:
4694 archive - .tar.gz or .zip
4695 dmg - macOS .dmg
4696 installed - installation tree
4697 msi - Windows .msi
4698         ])
4699             ;;
4700         esac
4701     done
4702     # fakeroot is needed to ensure correct file ownerships/permissions
4703     # inside deb packages and tar archives created on Linux and Solaris.
4704     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4705         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4706         if test "$FAKEROOT" = "no"; then
4707             AC_MSG_ERROR(
4708                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4709         fi
4710     fi
4711     PKGFORMAT="$with_package_format"
4712     AC_MSG_RESULT([$PKGFORMAT])
4713 else
4714     PKGFORMAT=
4715     AC_MSG_RESULT([none])
4717 AC_SUBST(PKGFORMAT)
4719 dnl ===================================================================
4720 dnl Set up a different compiler to produce tools to run on the build
4721 dnl machine when doing cross-compilation
4722 dnl ===================================================================
4724 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4725 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4726 if test "$cross_compiling" = "yes"; then
4727     AC_MSG_CHECKING([for BUILD platform configuration])
4728     echo
4729     rm -rf CONF-FOR-BUILD config_build.mk
4730     mkdir CONF-FOR-BUILD
4731     # Here must be listed all files needed when running the configure script. In particular, also
4732     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4733     # keep them in the same order as there.
4734     (cd $SRC_ROOT && tar cf - \
4735         config.guess \
4736         bin/get_config_variables \
4737         solenv/bin/getcompver.awk \
4738         solenv/inc/langlist.mk \
4739         download.lst \
4740         config_host.mk.in \
4741         config_host_lang.mk.in \
4742         Makefile.in \
4743         bin/bffvalidator.sh.in \
4744         bin/odfvalidator.sh.in \
4745         bin/officeotron.sh.in \
4746         instsetoo_native/util/openoffice.lst.in \
4747         setup_native/source/packinfo/finals_instsetoo.txt.in \
4748         config_host/*.in \
4749         sysui/desktop/macosx/Info.plist.in) \
4750     | (cd CONF-FOR-BUILD && tar xf -)
4751     cp configure CONF-FOR-BUILD
4752     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4753     (
4754     unset COM USING_X11 OS CPUNAME
4755     unset CC CXX SYSBASE CFLAGS
4756     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4757     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4758     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4759     if test -n "$CC_FOR_BUILD"; then
4760         export CC="$CC_FOR_BUILD"
4761         CC_BASE=`first_arg_basename "$CC"`
4762     fi
4763     if test -n "$CXX_FOR_BUILD"; then
4764         export CXX="$CXX_FOR_BUILD"
4765         CXX_BASE=`first_arg_basename "$CXX"`
4766     fi
4767     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4768     cd CONF-FOR-BUILD
4769     sub_conf_opts=""
4770     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4771     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4772     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4773     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4774     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4775     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4776     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4777     # Don't bother having configure look for stuff not needed for the build platform anyway
4778     ./configure \
4779         --disable-cups \
4780         --disable-gstreamer-1-0 \
4781         --disable-gtk3 \
4782         --disable-pdfimport \
4783         --disable-postgresql-sdbc \
4784         --enable-icecream="$enable_icecream" \
4785         --with-parallelism="$with_parallelism" \
4786         --without-doxygen \
4787         --without-java \
4788         $sub_conf_opts \
4789         --srcdir=$srcdir \
4790         2>&1 | sed -e 's/^/    /'
4791     test -f ./config_host.mk 2>/dev/null || exit
4792     cp config_host.mk ../config_build.mk
4793     cp config_host_lang.mk ../config_build_lang.mk
4794     mv config.log ../config.Build.log
4795     mkdir -p ../config_build
4796     mv config_host/*.h ../config_build
4797     . ./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
4799     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
4800         VV='$'$V
4801         VV=`eval "echo $VV"`
4802         if test -n "$VV"; then
4803             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4804             echo "$line" >>build-config
4805         fi
4806     done
4808     for V in INSTDIR INSTROOT WORKDIR; do
4809         VV='$'$V
4810         VV=`eval "echo $VV"`
4811         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4812         if test -n "$VV"; then
4813             line="${V}_FOR_BUILD='$VV'"
4814             echo "$line" >>build-config
4815         fi
4816     done
4818     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4819     echo "$line" >>build-config
4821     )
4822     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4823     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])
4824     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4825              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4827     eval `cat CONF-FOR-BUILD/build-config`
4829     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4831     rm -rf CONF-FOR-BUILD
4832 else
4833     OS_FOR_BUILD="$OS"
4834     CC_FOR_BUILD="$CC"
4835     CXX_FOR_BUILD="$CXX"
4836     INSTDIR_FOR_BUILD="$INSTDIR"
4837     INSTROOT_FOR_BUILD="$INSTROOT"
4838     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4839     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4840     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4841     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4842     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4843     WORKDIR_FOR_BUILD="$WORKDIR"
4845 AC_SUBST(OS_FOR_BUILD)
4846 AC_SUBST(INSTDIR_FOR_BUILD)
4847 AC_SUBST(INSTROOT_FOR_BUILD)
4848 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4849 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4850 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4851 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4852 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4853 AC_SUBST(WORKDIR_FOR_BUILD)
4855 dnl ===================================================================
4856 dnl Check for syslog header
4857 dnl ===================================================================
4858 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4860 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4861 dnl ===================================================================
4862 AC_MSG_CHECKING([whether to turn warnings to errors])
4863 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4864     ENABLE_WERROR="TRUE"
4865     AC_MSG_RESULT([yes])
4866 else
4867     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4868         ENABLE_WERROR="TRUE"
4869         AC_MSG_RESULT([yes])
4870     else
4871         AC_MSG_RESULT([no])
4872     fi
4874 AC_SUBST(ENABLE_WERROR)
4876 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4877 dnl ===================================================================
4878 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4879 if test -z "$enable_assert_always_abort"; then
4880    if test "$ENABLE_DEBUG" = TRUE; then
4881        enable_assert_always_abort=yes
4882    else
4883        enable_assert_always_abort=no
4884    fi
4886 if test "$enable_assert_always_abort" = "yes"; then
4887     ASSERT_ALWAYS_ABORT="TRUE"
4888     AC_MSG_RESULT([yes])
4889 else
4890     ASSERT_ALWAYS_ABORT="FALSE"
4891     AC_MSG_RESULT([no])
4893 AC_SUBST(ASSERT_ALWAYS_ABORT)
4895 # Determine whether to use ooenv for the instdir installation
4896 # ===================================================================
4897 if test $_os != "WINNT" -a $_os != "Darwin"; then
4898     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4899     if test "$enable_ooenv" = "no"; then
4900         AC_MSG_RESULT([no])
4901     else
4902         ENABLE_OOENV="TRUE"
4903         AC_MSG_RESULT([yes])
4904     fi
4906 AC_SUBST(ENABLE_OOENV)
4908 if test "$USING_X11" != TRUE; then
4909     # be sure to do not mess with unneeded stuff
4910     test_randr=no
4911     test_xrender=no
4912     test_cups=no
4913     test_dbus=no
4914     build_gstreamer_1_0=no
4915     test_kf5=no
4916     test_qt5=no
4917     test_gtk3_kde5=no
4918     enable_cairo_canvas=no
4921 if test "$OS" = "HAIKU"; then
4922     enable_cairo_canvas=yes
4923     test_kf5=yes
4926 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4927     AC_MSG_WARN([The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!])
4928     add_warning "The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!"
4929     enable_kf5=yes
4932 if test "$test_kf5" = "yes"; then
4933     test_qt5=yes
4936 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4937     if test "$enable_qt5" = "no"; then
4938         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4939     else
4940         enable_qt5=yes
4941     fi
4944 dnl ===================================================================
4945 dnl check for cups support
4946 dnl ===================================================================
4947 ENABLE_CUPS=""
4949 if test "$enable_cups" = "no"; then
4950     test_cups=no
4953 AC_MSG_CHECKING([whether to enable CUPS support])
4954 if test "$test_cups" = "yes"; then
4955     ENABLE_CUPS="TRUE"
4956     AC_MSG_RESULT([yes])
4958     AC_MSG_CHECKING([whether cups support is present])
4959     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4960     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4961     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4962         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4963     fi
4965 else
4966     AC_MSG_RESULT([no])
4969 AC_SUBST(ENABLE_CUPS)
4971 # fontconfig checks
4972 if test "$test_fontconfig" = "yes"; then
4973     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4974     SYSTEM_FONTCONFIG=TRUE
4975     FilterLibs "${FONTCONFIG_LIBS}"
4976     FONTCONFIG_LIBS="${filteredlibs}"
4978 AC_SUBST(FONTCONFIG_CFLAGS)
4979 AC_SUBST(FONTCONFIG_LIBS)
4980 AC_SUBST([SYSTEM_FONTCONFIG])
4982 dnl whether to find & fetch external tarballs?
4983 dnl ===================================================================
4984 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4985    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4986        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4987    else
4988        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4989    fi
4991 if test -z "$TARFILE_LOCATION"; then
4992     if test -d "$SRC_ROOT/src" ; then
4993         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4994         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4995     fi
4996     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4997 else
4998     AbsolutePath "$TARFILE_LOCATION"
4999     PathFormat "${absolute_path}"
5000     TARFILE_LOCATION="${formatted_path}"
5002 AC_SUBST(TARFILE_LOCATION)
5004 AC_MSG_CHECKING([whether we want to fetch tarballs])
5005 if test "$enable_fetch_external" != "no"; then
5006     if test "$with_all_tarballs" = "yes"; then
5007         AC_MSG_RESULT([yes, all of them])
5008         DO_FETCH_TARBALLS="ALL"
5009     else
5010         AC_MSG_RESULT([yes, if we use them])
5011         DO_FETCH_TARBALLS="TRUE"
5012     fi
5013 else
5014     AC_MSG_RESULT([no])
5015     DO_FETCH_TARBALLS=
5017 AC_SUBST(DO_FETCH_TARBALLS)
5019 AC_MSG_CHECKING([whether to build help])
5020 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5021     BUILD_TYPE="$BUILD_TYPE HELP"
5022     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5023     case "$with_help" in
5024     "html")
5025         ENABLE_HTMLHELP=TRUE
5026         SCPDEFS="$SCPDEFS -DWITH_HELP"
5027         AC_MSG_RESULT([HTML])
5028         ;;
5029     "online")
5030         ENABLE_HTMLHELP=TRUE
5031         HELP_ONLINE=TRUE
5032         AC_MSG_RESULT([HTML])
5033         ;;
5034     yes)
5035         SCPDEFS="$SCPDEFS -DWITH_HELP"
5036         AC_MSG_RESULT([yes])
5037         ;;
5038     *)
5039         AC_MSG_ERROR([Unknown --with-help=$with_help])
5040         ;;
5041     esac
5042 else
5043     AC_MSG_RESULT([no])
5045 AC_SUBST([ENABLE_HTMLHELP])
5046 AC_SUBST([HELP_ONLINE])
5048 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5049 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5050     BUILD_TYPE="$BUILD_TYPE HELP"
5051     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5052     case "$with_omindex" in
5053     "server")
5054         ENABLE_HTMLHELP=TRUE
5055         HELP_ONLINE=TRUE
5056         HELP_OMINDEX_PAGE=TRUE
5057         AC_MSG_RESULT([SERVER])
5058         ;;
5059     "noxap")
5060         ENABLE_HTMLHELP=TRUE
5061         HELP_ONLINE=TRUE
5062         HELP_OMINDEX_PAGE=FALSE
5063         AC_MSG_RESULT([NOXAP])
5064         ;;
5065     *)
5066         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5067         ;;
5068     esac
5069 else
5070     HELP_OMINDEX_PAGE=FALSE
5071     AC_MSG_RESULT([no])
5073 AC_SUBST([ENABLE_HTMLHELP])
5074 AC_SUBST([HELP_OMINDEX_PAGE])
5075 AC_SUBST([HELP_ONLINE])
5078 dnl Test whether to include MySpell dictionaries
5079 dnl ===================================================================
5080 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5081 if test "$with_myspell_dicts" = "yes"; then
5082     AC_MSG_RESULT([yes])
5083     WITH_MYSPELL_DICTS=TRUE
5084     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5085     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5086 else
5087     AC_MSG_RESULT([no])
5088     WITH_MYSPELL_DICTS=
5090 AC_SUBST(WITH_MYSPELL_DICTS)
5092 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5093 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5094     if test "$with_system_dicts" = yes; then
5095         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5096     fi
5097     with_system_dicts=no
5100 AC_MSG_CHECKING([whether to use dicts from external paths])
5101 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5102     AC_MSG_RESULT([yes])
5103     SYSTEM_DICTS=TRUE
5104     AC_MSG_CHECKING([for spelling dictionary directory])
5105     if test -n "$with_external_dict_dir"; then
5106         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5107     else
5108         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5109         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5110             DICT_SYSTEM_DIR=file:///usr/share/myspell
5111         fi
5112     fi
5113     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5114     AC_MSG_CHECKING([for hyphenation patterns directory])
5115     if test -n "$with_external_hyph_dir"; then
5116         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5117     else
5118         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5119     fi
5120     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5121     AC_MSG_CHECKING([for thesaurus directory])
5122     if test -n "$with_external_thes_dir"; then
5123         THES_SYSTEM_DIR=file://$with_external_thes_dir
5124     else
5125         THES_SYSTEM_DIR=file:///usr/share/mythes
5126     fi
5127     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5128 else
5129     AC_MSG_RESULT([no])
5130     SYSTEM_DICTS=
5132 AC_SUBST(SYSTEM_DICTS)
5133 AC_SUBST(DICT_SYSTEM_DIR)
5134 AC_SUBST(HYPH_SYSTEM_DIR)
5135 AC_SUBST(THES_SYSTEM_DIR)
5137 dnl ===================================================================
5138 dnl Precompiled headers.
5139 ENABLE_PCH=""
5140 AC_MSG_CHECKING([whether to enable pch feature])
5141 if test -z "$enable_pch"; then
5142     if test "$_os" = "WINNT"; then
5143         # Enabled by default on Windows.
5144         enable_pch=yes
5145     else
5146         enable_pch=no
5147     fi
5149 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5150     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5152 if test "$enable_pch" = "system"; then
5153     ENABLE_PCH="1"
5154     AC_MSG_RESULT([yes (system headers)])
5155 elif test "$enable_pch" = "base"; then
5156     ENABLE_PCH="2"
5157     AC_MSG_RESULT([yes (system and base headers)])
5158 elif test "$enable_pch" = "normal"; then
5159     ENABLE_PCH="3"
5160     AC_MSG_RESULT([yes (normal)])
5161 elif test "$enable_pch" = "full"; then
5162     ENABLE_PCH="4"
5163     AC_MSG_RESULT([yes (full)])
5164 elif test "$enable_pch" = "yes"; then
5165     # Pick a suitable default.
5166     if test "$GCC" = "yes"; then
5167         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5168         # while making the PCHs larger and rebuilds more likely.
5169         ENABLE_PCH="2"
5170         AC_MSG_RESULT([yes (system and base headers)])
5171     else
5172         # With MSVC the highest level makes a significant difference,
5173         # and it was the default when there used to be no PCH levels.
5174         ENABLE_PCH="4"
5175         AC_MSG_RESULT([yes (full)])
5176     fi
5177 elif test "$enable_pch" = "no"; then
5178     AC_MSG_RESULT([no])
5179 else
5180     AC_MSG_ERROR([Unknown value for --enable-pch])
5182 AC_SUBST(ENABLE_PCH)
5183 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5184 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5185     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5186     if test "$CCACHE_BIN" != "not found"; then
5187         AC_MSG_CHECKING([ccache version])
5188         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5189         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5190         AC_MSG_RESULT([$CCACHE_VERSION])
5191         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5192         if test "$CCACHE_NUMVER" -gt "030701"; then
5193             AC_MSG_RESULT([yes])
5194         else
5195             AC_MSG_RESULT([no (not newer than 3.7.1)])
5196             CCACHE_DEPEND_MODE=
5197         fi
5198     fi
5201 TAB=`printf '\t'`
5203 AC_MSG_CHECKING([the GNU Make version])
5204 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5205 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5206 if test "$_make_longver" -ge "038200"; then
5207     AC_MSG_RESULT([$GNUMAKE $_make_version])
5209 elif test "$_make_longver" -ge "038100"; then
5210     if test "$build_os" = "cygwin"; then
5211         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5212     fi
5213     AC_MSG_RESULT([$GNUMAKE $_make_version])
5215     dnl ===================================================================
5216     dnl Search all the common names for sha1sum
5217     dnl ===================================================================
5218     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5219     if test -z "$SHA1SUM"; then
5220         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5221     elif test "$SHA1SUM" = "openssl"; then
5222         SHA1SUM="openssl sha1"
5223     fi
5224     AC_MSG_CHECKING([for GNU Make bug 20033])
5225     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5226     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5227 A := \$(wildcard *.a)
5229 .PHONY: all
5230 all: \$(A:.a=.b)
5231 <TAB>@echo survived bug20033.
5233 .PHONY: setup
5234 setup:
5235 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5237 define d1
5238 @echo lala \$(1)
5239 @sleep 1
5240 endef
5242 define d2
5243 @echo tyty \$(1)
5244 @sleep 1
5245 endef
5247 %.b : %.a
5248 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5249 <TAB>\$(call d1,\$(CHECKSUM)),\
5250 <TAB>\$(call d2,\$(CHECKSUM)))
5252     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5253         no_parallelism_make="YES"
5254         AC_MSG_RESULT([yes, disable parallelism])
5255     else
5256         AC_MSG_RESULT([no, keep parallelism enabled])
5257     fi
5258     rm -rf $TESTGMAKEBUG20033
5259 else
5260     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5263 # find if gnumake support file function
5264 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5265 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5266 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5267     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5269 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5270 \$(file >test.txt,Success )
5272 .PHONY: all
5273 all:
5274 <TAB>@cat test.txt
5277 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5278 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5279     HAVE_GNUMAKE_FILE_FUNC=TRUE
5280     AC_MSG_RESULT([yes])
5281 else
5282     AC_MSG_RESULT([no])
5284 rm -rf $TESTGMAKEFILEFUNC
5285 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5286 AC_SUBST(GNUMAKE_WIN_NATIVE)
5288 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5289 STALE_MAKE=
5290 if test "$_make_ver_check" = ""; then
5291    STALE_MAKE=TRUE
5294 HAVE_LD_HASH_STYLE=FALSE
5295 WITH_LINKER_HASH_STYLE=
5296 AC_MSG_CHECKING([for --hash-style gcc linker support])
5297 if test "$GCC" = "yes"; then
5298     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5299         hash_styles="gnu sysv"
5300     elif test "$with_linker_hash_style" = "no"; then
5301         hash_styles=
5302     else
5303         hash_styles="$with_linker_hash_style"
5304     fi
5306     for hash_style in $hash_styles; do
5307         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5308         hash_style_ldflags_save=$LDFLAGS
5309         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5311         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5312             [
5313 #include <stdio.h>
5314             ],[
5315 printf ("");
5316             ])],
5317             [
5318                   HAVE_LD_HASH_STYLE=TRUE
5319                   WITH_LINKER_HASH_STYLE=$hash_style
5320             ],
5321             [HAVE_LD_HASH_STYLE=FALSE],
5322             [HAVE_LD_HASH_STYLE=FALSE])
5323         LDFLAGS=$hash_style_ldflags_save
5324     done
5326     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5327         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5328     else
5329         AC_MSG_RESULT( no )
5330     fi
5331     LDFLAGS=$hash_style_ldflags_save
5332 else
5333     AC_MSG_RESULT( no )
5335 AC_SUBST(HAVE_LD_HASH_STYLE)
5336 AC_SUBST(WITH_LINKER_HASH_STYLE)
5338 dnl ===================================================================
5339 dnl Check whether there's a Perl version available.
5340 dnl ===================================================================
5341 if test -z "$with_perl_home"; then
5342     AC_PATH_PROG(PERL, perl)
5343 else
5344     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5345     _perl_path="$with_perl_home/bin/perl"
5346     if test -x "$_perl_path"; then
5347         PERL=$_perl_path
5348     else
5349         AC_MSG_ERROR([$_perl_path not found])
5350     fi
5353 dnl ===================================================================
5354 dnl Testing for Perl version 5 or greater.
5355 dnl $] is the Perl version variable, it is returned as an integer
5356 dnl ===================================================================
5357 if test "$PERL"; then
5358     AC_MSG_CHECKING([the Perl version])
5359     ${PERL} -e "exit($]);"
5360     _perl_version=$?
5361     if test "$_perl_version" -lt 5; then
5362         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5363     fi
5364     AC_MSG_RESULT([Perl $_perl_version])
5365 else
5366     AC_MSG_ERROR([Perl not found, install Perl 5])
5369 dnl ===================================================================
5370 dnl Testing for required Perl modules
5371 dnl ===================================================================
5373 AC_MSG_CHECKING([for required Perl modules])
5374 perl_use_string="use Cwd ; use Digest::MD5"
5375 if test "$_os" = "WINNT"; then
5376     if test -n "$PKGFORMAT"; then
5377         for i in $PKGFORMAT; do
5378             case "$i" in
5379             msi)
5380                 # for getting fonts versions to use in MSI
5381                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5382                 ;;
5383             esac
5384         done
5385     fi
5387 if test "$with_system_hsqldb" = "yes"; then
5388     perl_use_string="$perl_use_string ; use Archive::Zip"
5390 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5391     AC_MSG_RESULT([all modules found])
5392 else
5393     AC_MSG_RESULT([failed to find some modules])
5394     # Find out which modules are missing.
5395     for i in $perl_use_string; do
5396         if test "$i" != "use" -a "$i" != ";"; then
5397             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5398                 missing_perl_modules="$missing_perl_modules $i"
5399             fi
5400         fi
5401     done
5402     AC_MSG_ERROR([
5403     The missing Perl modules are: $missing_perl_modules
5404     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5407 dnl ===================================================================
5408 dnl Check for pkg-config
5409 dnl ===================================================================
5410 if test "$_os" != "WINNT"; then
5411     PKG_PROG_PKG_CONFIG
5414 if test "$_os" != "WINNT"; then
5416     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5417     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5418     # explicitly. Or put /path/to/compiler in PATH yourself.
5420     # Use wrappers for LTO
5421     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5422         AC_CHECK_TOOL(AR,gcc-ar)
5423         AC_CHECK_TOOL(NM,gcc-nm)
5424         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5425     else
5426         AC_CHECK_TOOL(AR,ar)
5427         AC_CHECK_TOOL(NM,nm)
5428         AC_CHECK_TOOL(RANLIB,ranlib)
5429     fi
5430     AC_CHECK_TOOL(OBJDUMP,objdump)
5431     AC_CHECK_TOOL(READELF,readelf)
5432     AC_CHECK_TOOL(STRIP,strip)
5433     if test "$_os" = "WINNT"; then
5434         AC_CHECK_TOOL(DLLTOOL,dlltool)
5435         AC_CHECK_TOOL(WINDRES,windres)
5436     fi
5438 AC_SUBST(AR)
5439 AC_SUBST(DLLTOOL)
5440 AC_SUBST(NM)
5441 AC_SUBST(OBJDUMP)
5442 AC_SUBST(PKG_CONFIG)
5443 AC_SUBST(RANLIB)
5444 AC_SUBST(READELF)
5445 AC_SUBST(STRIP)
5446 AC_SUBST(WINDRES)
5448 dnl ===================================================================
5449 dnl pkg-config checks on macOS
5450 dnl ===================================================================
5452 if test $_os = Darwin; then
5453     AC_MSG_CHECKING([for bogus pkg-config])
5454     if test -n "$PKG_CONFIG"; then
5455         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5456             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5457         else
5458             if test "$enable_bogus_pkg_config" = "yes"; then
5459                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5460             else
5461                 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.])
5462             fi
5463         fi
5464     else
5465         AC_MSG_RESULT([no, good])
5466     fi
5469 find_csc()
5471     # Return value: $csctest
5473     unset csctest
5475     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5476     if test -n "$regvalue"; then
5477         csctest=$regvalue
5478         return
5479     fi
5482 find_al()
5484     # Return value: $altest
5486     unset altest
5488     # We need this check to detect 4.6.1 or above.
5489     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5490         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5491         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5492             altest=$regvalue
5493             return
5494         fi
5495     done
5497     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5498         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5499         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5500             altest=$regvalue
5501             return
5502         fi
5503     done
5508 find_dotnetsdk46()
5510     unset frametest
5512     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5513         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5514         if test -n "$regvalue"; then
5515             frametest=$regvalue
5516             return
5517         fi
5518     done
5521 find_winsdk_version()
5523     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5524     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5526     unset winsdktest winsdkbinsubdir winsdklibsubdir
5528     case "$1" in
5529     8.0|8.0A)
5530         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5531         if test -n "$regvalue"; then
5532             winsdktest=$regvalue
5533             winsdklibsubdir=win8
5534             return
5535         fi
5536         ;;
5537     8.1|8.1A)
5538         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5539         if test -n "$regvalue"; then
5540             winsdktest=$regvalue
5541             winsdklibsubdir=winv6.3
5542             return
5543         fi
5544         ;;
5545     10.0)
5546         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5547         if test -n "$regvalue"; then
5548             winsdktest=$regvalue
5549             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5550             if test -n "$regvalue"; then
5551                 winsdkbinsubdir="$regvalue".0
5552                 winsdklibsubdir=$winsdkbinsubdir
5553                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5554                 # test exist the SDK path
5555                 if test -d "$tmppath"; then
5556                    # when path is convertible to a short path then path is okay
5557                    cygpath -d "$tmppath" >/dev/null 2>&1
5558                    if test $? -ne 0; then
5559                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5560                    fi
5561                 else
5562                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5563                 fi
5564             fi
5565             return
5566         fi
5567         ;;
5568     esac
5571 find_winsdk()
5573     # Return value: From find_winsdk_version
5575     unset winsdktest
5577     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5578         find_winsdk_version $ver
5579         if test -n "$winsdktest"; then
5580             return
5581         fi
5582     done
5585 find_msms()
5587     AC_MSG_CHECKING([for MSVC merge modules directory])
5588     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5589     case "$VCVER" in
5590         150|160)
5591         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5592         ;;
5593     esac
5594     for f in $my_msm_files; do
5595         echo "$as_me:$LINENO: searching for $f" >&5
5596     done
5598     msmdir=
5599     for ver in 14.0 15.0; do
5600         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5601         if test -n "$regvalue"; then
5602             for f in ${my_msm_files}; do
5603                 if test -e "$regvalue/${f}"; then
5604                     msmdir=$regvalue
5605                     break
5606                 fi
5607             done
5608         fi
5609     done
5610     dnl Is the following fallback really necessary, or was it added in response
5611     dnl to never having started Visual Studio on a given machine, so the
5612     dnl registry keys checked above had presumably not yet been created?
5613     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5614     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5615     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5616     dnl expanding to "C:\Program Files\Common Files"), which would need
5617     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5618     dnl obtain its value from cygwin:
5619     if test -z "$msmdir"; then
5620         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5621         for f in ${my_msm_files}; do
5622             if test -e "$my_msm_dir/${f}"; then
5623                 msmdir=$my_msm_dir
5624             fi
5625         done
5626     fi
5628     dnl Starting from MSVC 15.0, merge modules are located in different directory
5629     case "$VCVER" in
5630     150|160)
5631         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5632             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5633             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5634             for f in ${my_msm_files}; do
5635                 if test -e "$my_msm_dir/${f}"; then
5636                     msmdir=$my_msm_dir
5637                     break
5638                 fi
5639             done
5640         done
5641         ;;
5642     esac
5644     if test -n "$msmdir"; then
5645         msmdir=`cygpath -m "$msmdir"`
5646         AC_MSG_RESULT([$msmdir])
5647     else
5648         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5649             AC_MSG_FAILURE([not found])
5650         else
5651             AC_MSG_WARN([not found (check config.log)])
5652             add_warning "MSM none of ${my_msm_files} found"
5653         fi
5654     fi
5657 find_msvc_x64_dlls()
5659     AC_MSG_CHECKING([for MSVC x64 DLL path])
5660     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5661     case "$VCVER" in
5662     150|160)
5663         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5664             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5665             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5666                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5667                 break
5668             fi
5669             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5670             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5671                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5672                 break
5673             fi
5674             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5675             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5676                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5677                 break
5678             fi
5679         done
5680         ;;
5681     esac
5682     AC_MSG_RESULT([$msvcdllpath])
5683     AC_MSG_CHECKING([for MSVC x64 DLLs])
5684     msvcdlls="msvcp140.dll vcruntime140.dll"
5685     for dll in $msvcdlls; do
5686         if ! test -f "$msvcdllpath/$dll"; then
5687             AC_MSG_FAILURE([missing $dll])
5688         fi
5689     done
5690     AC_MSG_RESULT([found all ($msvcdlls)])
5693 dnl =========================================
5694 dnl Check for the Windows  SDK.
5695 dnl =========================================
5696 if test "$_os" = "WINNT"; then
5697     AC_MSG_CHECKING([for Windows SDK])
5698     if test "$build_os" = "cygwin"; then
5699         find_winsdk
5700         WINDOWS_SDK_HOME=$winsdktest
5702         # normalize if found
5703         if test -n "$WINDOWS_SDK_HOME"; then
5704             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5705             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5706         fi
5708         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5709     fi
5711     if test -n "$WINDOWS_SDK_HOME"; then
5712         # Remove a possible trailing backslash
5713         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5715         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5716              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5717              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5718             have_windows_sdk_headers=yes
5719         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5720              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5721              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5722             have_windows_sdk_headers=yes
5723         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5724              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5725              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5726             have_windows_sdk_headers=yes
5727         else
5728             have_windows_sdk_headers=no
5729         fi
5731         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5732             have_windows_sdk_libs=yes
5733         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5734             have_windows_sdk_libs=yes
5735         else
5736             have_windows_sdk_libs=no
5737         fi
5739         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5740             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5741 the  Windows SDK are installed.])
5742         fi
5743     fi
5745     if test -z "$WINDOWS_SDK_HOME"; then
5746         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5747     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5748         WINDOWS_SDK_VERSION=80
5749         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5750     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5751         WINDOWS_SDK_VERSION=81
5752         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5753     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5754         WINDOWS_SDK_VERSION=10
5755         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5756     else
5757         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5758     fi
5759     PathFormat "$WINDOWS_SDK_HOME"
5760     WINDOWS_SDK_HOME="$formatted_path"
5761     if test "$build_os" = "cygwin"; then
5762         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5763         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5764             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5765         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5766             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5767         fi
5768     fi
5770     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5771     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5772     dnl but not in v8.0), so allow this to be overridden with a
5773     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5774     dnl and configuration error if no WiLangId.vbs is found would arguably be
5775     dnl better, but I do not know under which conditions exactly it is needed by
5776     dnl msiglobal.pm:
5777     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5778         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5779         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5780             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5781         fi
5782         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5783             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5784         fi
5785         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5786             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5787         fi
5788     fi
5789     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5790         if test -n "$with_package_format" -a "$with_package_format" != no; then
5791             for i in "$with_package_format"; do
5792                 if test "$i" = "msi"; then
5793                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5794                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5795                     fi
5796                 fi
5797             done
5798         fi
5799     fi
5801 AC_SUBST(WINDOWS_SDK_HOME)
5802 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5803 AC_SUBST(WINDOWS_SDK_VERSION)
5804 AC_SUBST(WINDOWS_SDK_WILANGID)
5806 if test "$build_os" = "cygwin"; then
5807     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5808     dnl dir, it also determines that dir's path w/o an arch segment if any,
5809     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5810     AC_MSG_CHECKING([for midl.exe])
5812     find_winsdk
5813     if test -n "$winsdkbinsubdir" \
5814         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5815     then
5816         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5817         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5818     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5819         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5820         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5821     elif test -f "$winsdktest/Bin/midl.exe"; then
5822         MIDL_PATH=$winsdktest/Bin
5823         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5824     fi
5825     if test ! -f "$MIDL_PATH/midl.exe"; then
5826         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5827     else
5828         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5829     fi
5831     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5832     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5834     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5835          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5836          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5837          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5838     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5839          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5840          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5841          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5842     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5843          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5844          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5845          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5846     else
5847         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5848     fi
5850     dnl Check csc.exe
5851     AC_MSG_CHECKING([for csc.exe])
5852     find_csc
5853     if test -f "$csctest/csc.exe"; then
5854         CSC_PATH="$csctest"
5855     fi
5856     if test ! -f "$CSC_PATH/csc.exe"; then
5857         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5858     else
5859         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5860     fi
5862     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5864     dnl Check al.exe
5865     AC_MSG_CHECKING([for al.exe])
5866     find_winsdk
5867     if test -n "$winsdkbinsubdir" \
5868         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5869     then
5870         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5871     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5872         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5873     elif test -f "$winsdktest/Bin/al.exe"; then
5874         AL_PATH="$winsdktest/Bin"
5875     fi
5877     if test -z "$AL_PATH"; then
5878         find_al
5879         if test -f "$altest/bin/al.exe"; then
5880             AL_PATH="$altest/bin"
5881         elif test -f "$altest/al.exe"; then
5882             AL_PATH="$altest"
5883         fi
5884     fi
5885     if test ! -f "$AL_PATH/al.exe"; then
5886         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5887     else
5888         AC_MSG_RESULT([$AL_PATH/al.exe])
5889     fi
5891     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5893     dnl Check mscoree.lib / .NET Framework dir
5894     AC_MSG_CHECKING(.NET Framework)
5895     find_dotnetsdk46
5896     PathFormat "$frametest"
5897     frametest="$formatted_path"
5898     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5899         DOTNET_FRAMEWORK_HOME="$frametest"
5900     else
5901         find_winsdk
5902         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5903             DOTNET_FRAMEWORK_HOME="$winsdktest"
5904         fi
5905     fi
5906     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
5907         AC_MSG_ERROR([mscoree.lib not found])
5908     fi
5909     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5911     PathFormat "$MIDL_PATH"
5912     MIDL_PATH="$formatted_path"
5914     PathFormat "$AL_PATH"
5915     AL_PATH="$formatted_path"
5917     PathFormat "$DOTNET_FRAMEWORK_HOME"
5918     DOTNET_FRAMEWORK_HOME="$formatted_path"
5920     PathFormat "$CSC_PATH"
5921     CSC_PATH="$formatted_path"
5924 dnl ===================================================================
5925 dnl Check if stdc headers are available excluding MSVC.
5926 dnl ===================================================================
5927 if test "$_os" != "WINNT"; then
5928     AC_HEADER_STDC
5931 dnl ===================================================================
5932 dnl Testing for C++ compiler and version...
5933 dnl ===================================================================
5935 if test "$_os" != "WINNT"; then
5936     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5937     save_CXXFLAGS=$CXXFLAGS
5938     AC_PROG_CXX
5939     CXXFLAGS=$save_CXXFLAGS
5940     if test -z "$CXX_BASE"; then
5941         CXX_BASE=`first_arg_basename "$CXX"`
5942     fi
5945 dnl check for GNU C++ compiler version
5946 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5947     AC_MSG_CHECKING([the GNU C++ compiler version])
5949     _gpp_version=`$CXX -dumpversion`
5950     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5952     if test "$_gpp_majmin" -lt "700"; then
5953         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5954     else
5955         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5956     fi
5958     dnl see https://code.google.com/p/android/issues/detail?id=41770
5959         glibcxx_threads=no
5960         AC_LANG_PUSH([C++])
5961         AC_REQUIRE_CPP
5962         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5963         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5964             #include <bits/c++config.h>]],[[
5965             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5966             && !defined(_GLIBCXX__PTHREADS) \
5967             && !defined(_GLIBCXX_HAS_GTHREADS)
5968             choke me
5969             #endif
5970         ]])],[AC_MSG_RESULT([yes])
5971         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5972         AC_LANG_POP([C++])
5973         if test $glibcxx_threads = yes; then
5974             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5975         fi
5977 AC_SUBST(BOOST_CXXFLAGS)
5980 # prefx CXX with ccache if needed
5982 if test "$CCACHE" != ""; then
5983     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5984     AC_LANG_PUSH([C++])
5985     save_CXXFLAGS=$CXXFLAGS
5986     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5987     dnl an empty program will do, we're checking the compiler flags
5988     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5989                       [use_ccache=yes], [use_ccache=no])
5990     if test $use_ccache = yes; then
5991         AC_MSG_RESULT([yes])
5992     else
5993         CXX="$CCACHE $CXX"
5994         CXX_BASE="ccache $CXX_BASE"
5995         AC_MSG_RESULT([no])
5996     fi
5997     CXXFLAGS=$save_CXXFLAGS
5998     AC_LANG_POP([C++])
6001 dnl ===================================================================
6002 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6003 dnl ===================================================================
6005 if test "$_os" != "WINNT"; then
6006     AC_PROG_CXXCPP
6008     dnl Check whether there's a C pre-processor.
6009     AC_PROG_CPP
6013 dnl ===================================================================
6014 dnl Find integral type sizes and alignments
6015 dnl ===================================================================
6017 if test "$_os" != "WINNT"; then
6019 if test "$_os" = "iOS"; then
6020     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6021     ac_cv_sizeof_long=8
6022     ac_cv_sizeof_short=2
6023     ac_cv_sizeof_int=4
6024     ac_cv_sizeof_long_long=8
6025     ac_cv_sizeof_double=8
6026     ac_cv_sizeof_voidp=8
6027 else
6028     AC_CHECK_SIZEOF(long)
6029     AC_CHECK_SIZEOF(short)
6030     AC_CHECK_SIZEOF(int)
6031     AC_CHECK_SIZEOF(long long)
6032     AC_CHECK_SIZEOF(double)
6033     AC_CHECK_SIZEOF(void*)
6036     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6037     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6038     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6039     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6040     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6042     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6043     m4_pattern_allow([AC_CHECK_ALIGNOF])
6044     m4_ifdef([AC_CHECK_ALIGNOF],
6045         [
6046             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6047             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6048             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6049             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6050         ],
6051         [
6052             case "$_os-$host_cpu" in
6053             Linux-i686)
6054                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6055                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6056                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6057                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6058                 ;;
6059             Linux-x86_64)
6060                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6061                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6062                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6063                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6064                 ;;
6065             *)
6066                 if test -z "$ac_cv_alignof_short" -o \
6067                         -z "$ac_cv_alignof_int" -o \
6068                         -z "$ac_cv_alignof_long" -o \
6069                         -z "$ac_cv_alignof_double"; then
6070                    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.])
6071                 fi
6072                 ;;
6073             esac
6074         ])
6076     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6077     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6078     if test $ac_cv_sizeof_long -eq 8; then
6079         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6080     elif test $ac_cv_sizeof_double -eq 8; then
6081         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6082     else
6083         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6084     fi
6086     dnl Check for large file support
6087     AC_SYS_LARGEFILE
6088     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6089         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6090     fi
6091     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6092         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6093     fi
6094 else
6095     # Hardcode for MSVC
6096     SAL_TYPES_SIZEOFSHORT=2
6097     SAL_TYPES_SIZEOFINT=4
6098     SAL_TYPES_SIZEOFLONG=4
6099     SAL_TYPES_SIZEOFLONGLONG=8
6100     if test "$BITNESS_OVERRIDE" = ""; then
6101         SAL_TYPES_SIZEOFPOINTER=4
6102     else
6103         SAL_TYPES_SIZEOFPOINTER=8
6104     fi
6105     SAL_TYPES_ALIGNMENT2=2
6106     SAL_TYPES_ALIGNMENT4=4
6107     SAL_TYPES_ALIGNMENT8=8
6108     LFS_CFLAGS=''
6110 AC_SUBST(LFS_CFLAGS)
6112 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6113 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6114 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6115 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6116 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6117 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6118 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6119 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6121 dnl ===================================================================
6122 dnl Check whether to enable runtime optimizations
6123 dnl ===================================================================
6124 ENABLE_RUNTIME_OPTIMIZATIONS=
6125 AC_MSG_CHECKING([whether to enable runtime optimizations])
6126 if test -z "$enable_runtime_optimizations"; then
6127     for i in $CC; do
6128         case $i in
6129         -fsanitize=*)
6130             enable_runtime_optimizations=no
6131             break
6132             ;;
6133         esac
6134     done
6136 if test "$enable_runtime_optimizations" != no; then
6137     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6138     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6139     AC_MSG_RESULT([yes])
6140 else
6141     AC_MSG_RESULT([no])
6143 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6145 dnl ===================================================================
6146 dnl Check if valgrind headers are available
6147 dnl ===================================================================
6148 ENABLE_VALGRIND=
6149 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6150     prev_cppflags=$CPPFLAGS
6151     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6152     # or where does it come from?
6153     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6154     AC_CHECK_HEADER([valgrind/valgrind.h],
6155         [ENABLE_VALGRIND=TRUE])
6156     CPPFLAGS=$prev_cppflags
6158 AC_SUBST([ENABLE_VALGRIND])
6159 if test -z "$ENABLE_VALGRIND"; then
6160     if test "$with_valgrind" = yes; then
6161         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6162     fi
6163     VALGRIND_CFLAGS=
6165 AC_SUBST([VALGRIND_CFLAGS])
6168 dnl ===================================================================
6169 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6170 dnl ===================================================================
6172 # We need at least the sys/sdt.h include header.
6173 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6174 if test "$SDT_H_FOUND" = "TRUE"; then
6175     # Found sys/sdt.h header, now make sure the c++ compiler works.
6176     # Old g++ versions had problems with probes in constructors/destructors.
6177     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6178     AC_LANG_PUSH([C++])
6179     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6180     #include <sys/sdt.h>
6181     class ProbeClass
6182     {
6183     private:
6184       int& ref;
6185       const char *name;
6187     public:
6188       ProbeClass(int& v, const char *n) : ref(v), name(n)
6189       {
6190         DTRACE_PROBE2(_test_, cons, name, ref);
6191       }
6193       void method(int min)
6194       {
6195         DTRACE_PROBE3(_test_, meth, name, ref, min);
6196         ref -= min;
6197       }
6199       ~ProbeClass()
6200       {
6201         DTRACE_PROBE2(_test_, dest, name, ref);
6202       }
6203     };
6204     ]],[[
6205     int i = 64;
6206     DTRACE_PROBE1(_test_, call, i);
6207     ProbeClass inst = ProbeClass(i, "call");
6208     inst.method(24);
6209     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6210           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6211     AC_LANG_POP([C++])
6213 AC_CONFIG_HEADERS([config_host/config_probes.h])
6215 dnl ===================================================================
6216 dnl GCC features
6217 dnl ===================================================================
6218 HAVE_GCC_STACK_CLASH_PROTECTION=
6219 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6220     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6221     save_CFLAGS=$CFLAGS
6222     CFLAGS="$CFLAGS -fstack-clash-protection"
6223     AC_LINK_IFELSE(
6224         [AC_LANG_PROGRAM(, [[return 0;]])],
6225         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6226         [AC_MSG_RESULT([no])])
6227     CFLAGS=$save_CFLAGS
6229     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6230     save_CFLAGS=$CFLAGS
6231     CFLAGS="$CFLAGS -Werror -mno-avx"
6232     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6233     CFLAGS=$save_CFLAGS
6234     if test "$HAVE_GCC_AVX" = "TRUE"; then
6235         AC_MSG_RESULT([yes])
6236     else
6237         AC_MSG_RESULT([no])
6238     fi
6240     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6241     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6242     int v = 0;
6243     if (__sync_add_and_fetch(&v, 1) != 1 ||
6244         __sync_sub_and_fetch(&v, 1) != 0)
6245         return 1;
6246     __sync_synchronize();
6247     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6248         v != 1)
6249         return 1;
6250     return 0;
6251 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6252     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6253         AC_MSG_RESULT([yes])
6254         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6255     else
6256         AC_MSG_RESULT([no])
6257     fi
6259     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6260     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6261     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6262         AC_MSG_RESULT([yes])
6263         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6264     else
6265         AC_MSG_RESULT([no])
6266     fi
6268     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6269     save_CFLAGS=$CFLAGS
6270     CFLAGS="$CFLAGS -Werror"
6271     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6272             __attribute__((deprecated("test"))) void f();
6273         ])], [
6274             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6275             AC_MSG_RESULT([yes])
6276         ], [AC_MSG_RESULT([no])])
6277     CFLAGS=$save_CFLAGS
6279     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6280     AC_LANG_PUSH([C++])
6281     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6282             #include <cstddef>
6283             #include <cxxabi.h>
6284             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6285         ])], [
6286             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6287             AC_MSG_RESULT([yes])
6288         ], [AC_MSG_RESULT([no])])
6289     AC_LANG_POP([C++])
6291     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6292     AC_LANG_PUSH([C++])
6293     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6294             #include <cstddef>
6295             #include <cxxabi.h>
6296             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6297         ])], [
6298             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6299             AC_MSG_RESULT([yes])
6300         ], [AC_MSG_RESULT([no])])
6301     AC_LANG_POP([C++])
6303     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6304     AC_LANG_PUSH([C++])
6305     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6306             #include <cxxabi.h>
6307             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6308         ])], [
6309             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6310             AC_MSG_RESULT([yes])
6311         ], [AC_MSG_RESULT([no])])
6312     AC_LANG_POP([C++])
6314     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6315     AC_LANG_PUSH([C++])
6316     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6317             #include <cstddef>
6318             #include <cxxabi.h>
6319             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6320         ])], [
6321             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6322             AC_MSG_RESULT([yes])
6323         ], [AC_MSG_RESULT([no])])
6324     AC_LANG_POP([C++])
6326     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6327     AC_LANG_PUSH([C++])
6328     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6329             #include <cstddef>
6330             #include <cxxabi.h>
6331             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6332         ])], [
6333             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6334             AC_MSG_RESULT([yes])
6335         ], [AC_MSG_RESULT([no])])
6336     AC_LANG_POP([C++])
6338     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6339     AC_LANG_PUSH([C++])
6340     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6341             #include <cxxabi.h>
6342             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6343         ])], [
6344             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6345             AC_MSG_RESULT([yes])
6346         ], [AC_MSG_RESULT([no])])
6347     AC_LANG_POP([C++])
6349     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6350     AC_LANG_PUSH([C++])
6351     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6352             #include <cxxabi.h>
6353             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6354         ])], [
6355             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6356             AC_MSG_RESULT([yes])
6357         ], [AC_MSG_RESULT([no])])
6358     AC_LANG_POP([C++])
6360     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6361     AC_LANG_PUSH([C++])
6362     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6363             #include <cxxabi.h>
6364             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6365         ])], [
6366             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6367             AC_MSG_RESULT([yes])
6368         ], [AC_MSG_RESULT([no])])
6369     AC_LANG_POP([C++])
6371     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6372     AC_LANG_PUSH([C++])
6373     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6374             #include <cstddef>
6375             #include <cxxabi.h>
6376             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6377         ])], [
6378             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6379             AC_MSG_RESULT([yes])
6380         ], [AC_MSG_RESULT([no])])
6381     AC_LANG_POP([C++])
6383     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6384     AC_LANG_PUSH([C++])
6385     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6386             #include <cstddef>
6387             #include <cxxabi.h>
6388             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6389         ])], [
6390             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6391             AC_MSG_RESULT([yes])
6392         ], [AC_MSG_RESULT([no])])
6393     AC_LANG_POP([C++])
6395     dnl Available in GCC 4.9 and at least since Clang 3.4:
6396     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6397     AC_LANG_PUSH([C++])
6398     save_CXXFLAGS=$CXXFLAGS
6399     CXXFLAGS="$CXXFLAGS -Werror"
6400     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6401             struct __attribute__((warn_unused)) dummy {};
6402         ])], [
6403             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6404             AC_MSG_RESULT([yes])
6405         ], [AC_MSG_RESULT([no])])
6406     CXXFLAGS=$save_CXXFLAGS
6407 AC_LANG_POP([C++])
6410 AC_SUBST(HAVE_GCC_AVX)
6411 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6412 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6413 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6415 dnl ===================================================================
6416 dnl Identify the C++ library
6417 dnl ===================================================================
6419 AC_MSG_CHECKING([what the C++ library is])
6420 AC_LANG_PUSH([C++])
6421 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6422 #include <utility>
6423 #ifndef __GLIBCXX__
6424 foo bar
6425 #endif
6426 ]])],
6427     [CPP_LIBRARY=GLIBCXX
6428      cpp_library_name="GNU libstdc++"
6429     ],
6430     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6431 #include <utility>
6432 #ifndef _LIBCPP_VERSION
6433 foo bar
6434 #endif
6435 ]])],
6436     [CPP_LIBRARY=LIBCPP
6437      cpp_library_name="LLVM libc++"
6438      AC_DEFINE([HAVE_LIBCXX])
6439     ],
6440     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6441 #include <utility>
6442 #ifndef _MSC_VER
6443 foo bar
6444 #endif
6445 ]])],
6446     [CPP_LIBRARY=MSVCRT
6447      cpp_library_name="Microsoft"
6448     ],
6449     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6450 AC_MSG_RESULT([$cpp_library_name])
6451 AC_LANG_POP([C++])
6453 dnl ===================================================================
6454 dnl Check for gperf
6455 dnl ===================================================================
6456 AC_PATH_PROG(GPERF, gperf)
6457 if test -z "$GPERF"; then
6458     AC_MSG_ERROR([gperf not found but needed. Install it.])
6460 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6461     GPERF=`cygpath -m $GPERF`
6463 AC_MSG_CHECKING([whether gperf is new enough])
6464 my_gperf_ver1=$($GPERF --version | head -n 1)
6465 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6466 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6467 if test "$my_gperf_ver3" -ge 301; then
6468     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6469 else
6470     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6472 AC_SUBST(GPERF)
6474 dnl ===================================================================
6475 dnl Check for system libcmis
6476 dnl ===================================================================
6477 # libcmis requires curl and we can't build curl for iOS
6478 if test $_os != iOS; then
6479     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6480     ENABLE_LIBCMIS=TRUE
6481 else
6482     ENABLE_LIBCMIS=
6484 AC_SUBST(ENABLE_LIBCMIS)
6486 dnl ===================================================================
6487 dnl C++11
6488 dnl ===================================================================
6490 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6491 CXXFLAGS_CXX11=
6492 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6493     if test "$with_latest_c__" = yes; then
6494         CXXFLAGS_CXX11=-std:c++latest
6495     else
6496         CXXFLAGS_CXX11=-std:c++17
6497     fi
6498     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6499 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6500     my_flags='-std=c++17 -std=c++1z'
6501     if test "$with_latest_c__" = yes; then
6502         my_flags="-std=gnu++2a -std=c++2a $my_flags"
6503     fi
6504     for flag in $my_flags; do
6505         if test "$COM" = MSC; then
6506             flag="-Xclang $flag"
6507         fi
6508         save_CXXFLAGS=$CXXFLAGS
6509         CXXFLAGS="$CXXFLAGS $flag -Werror"
6510         if test "$SYSTEM_LIBCMIS" = TRUE; then
6511             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6512         fi
6513         AC_LANG_PUSH([C++])
6514         dnl Clang 3.9 supports __float128 since
6515         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6516         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6517         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6518         dnl $flag is supported below, so check this first):
6519         my_float128hack=
6520         my_float128hack_impl=-D__float128=void
6521         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6522             #include <vector>
6523             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6524             // (__float128)
6525             ]])
6526         ],,[
6527             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6528             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6529             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6530             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6531             dnl place where __float128 is used is in a template specialization, -D__float128=void
6532             dnl will avoid the problem there while still causing a problem if somebody actually uses
6533             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6534             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6535             dnl "fixed" with this hack):
6536             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6537             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6538                 #include <vector>
6539                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6540                 // (__float128)
6541                 ]])
6542             ],[my_float128hack=$my_float128hack_impl])
6543         ])
6544         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6545             #include <algorithm>
6546             #include <functional>
6547             #include <vector>
6549             #if defined SYSTEM_LIBCMIS
6550             // See ucb/source/ucp/cmis/auth_provider.hxx:
6551             #if !defined __clang__
6552             #pragma GCC diagnostic push
6553             #pragma GCC diagnostic ignored "-Wdeprecated"
6554             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6555             #endif
6556             #include <libcmis/libcmis.hxx>
6557             #if !defined __clang__
6558             #pragma GCC diagnostic pop
6559             #endif
6560             #endif
6562             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6563                 std::sort(v.begin(), v.end(), fn);
6564             }
6565             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6566         AC_LANG_POP([C++])
6567         CXXFLAGS=$save_CXXFLAGS
6568         if test -n "$CXXFLAGS_CXX11"; then
6569             break
6570         fi
6571     done
6573 if test -n "$CXXFLAGS_CXX11"; then
6574     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6575 else
6576     AC_MSG_ERROR(no)
6578 AC_SUBST(CXXFLAGS_CXX11)
6580 if test "$GCC" = "yes"; then
6581     save_CXXFLAGS=$CXXFLAGS
6582     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6583     CHECK_L_ATOMIC
6584     CXXFLAGS=$save_CXXFLAGS
6585     AC_SUBST(ATOMIC_LIB)
6588 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6589 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6590 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6591 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6592 dnl again towards 4.7.2:
6593 if test $CPP_LIBRARY = GLIBCXX; then
6594     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6595     AC_LANG_PUSH([C++])
6596     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6597 #include <list>
6598 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6599     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6600     //   GCC 4.7.0: 20120322
6601     //   GCC 4.7.1: 20120614
6602     // and using a range check is not possible as the mapping between
6603     // __GLIBCXX__ values and GCC versions is not monotonic
6604 /* ok */
6605 #else
6606 abi broken
6607 #endif
6608         ]])], [AC_MSG_RESULT(no, ok)],
6609         [AC_MSG_ERROR(yes)])
6610     AC_LANG_POP([C++])
6613 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6614 save_CXXFLAGS=$CXXFLAGS
6615 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6616 AC_LANG_PUSH([C++])
6618 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6619 #include <stddef.h>
6621 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6623 namespace
6625         struct b
6626         {
6627                 int i;
6628                 int j;
6629         };
6631 ]], [[
6632 struct a
6634         int i;
6635         int j;
6637 a thinga[]={{0,0}, {1,1}};
6638 b thingb[]={{0,0}, {1,1}};
6639 size_t i = sizeof(sal_n_array_size(thinga));
6640 size_t j = sizeof(sal_n_array_size(thingb));
6641 return !(i != 0 && j != 0);
6643     ], [ AC_MSG_RESULT(yes) ],
6644     [ AC_MSG_ERROR(no)])
6645 AC_LANG_POP([C++])
6646 CXXFLAGS=$save_CXXFLAGS
6648 dnl _Pragma support (may require C++11)
6649 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6650     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6651     AC_LANG_PUSH([C++])
6652     save_CXXFLAGS=$CXXFLAGS
6653     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6654     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6655             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6656         ])], [
6657             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6658             AC_MSG_RESULT([yes])
6659         ], [AC_MSG_RESULT([no])])
6660     AC_LANG_POP([C++])
6661     CXXFLAGS=$save_CXXFLAGS
6664 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6665 if test "$GCC" = yes; then
6666     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6667     AC_LANG_PUSH([C++])
6668     save_CXXFLAGS=$CXXFLAGS
6669     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6670     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6671     CXXFLAGS=$save_CXXFLAGS
6672     AC_LANG_POP([C++])
6673     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6674         AC_MSG_RESULT([yes])
6675     else
6676         AC_MSG_RESULT([no])
6677     fi
6679 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6681 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6682 AC_LANG_PUSH([C++])
6683 save_CXXFLAGS=$CXXFLAGS
6684 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6685 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6686         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6687         // supporting it:
6688         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6689         struct S {
6690         private:
6691             S(S const &);
6692         public:
6693             S();
6694             ~S();
6695         };
6696         S copy();
6697         void f() { S c(copy()); }
6698         #endif
6699     ])], [
6700         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6701         AC_MSG_RESULT([yes])
6702     ], [AC_MSG_RESULT([no])])
6703 CXXFLAGS=$save_CXXFLAGS
6704 AC_LANG_POP([C++])
6706 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6707 AC_LANG_PUSH([C++])
6708 save_CXXFLAGS=$CXXFLAGS
6709 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6710 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6711         #include <algorithm>
6712         #include <initializer_list>
6713         #include <vector>
6714         template<typename T> class S {
6715         private:
6716             std::vector<T> v_;
6717         public:
6718             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6719         };
6720         constinit S<int> s{3, 2, 1};
6721     ])], [
6722         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6723         AC_MSG_RESULT([yes])
6724     ], [AC_MSG_RESULT([no])])
6725 CXXFLAGS=$save_CXXFLAGS
6726 AC_LANG_POP([C++])
6728 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6729 AC_LANG_PUSH([C++])
6730 save_CXXFLAGS=$CXXFLAGS
6731 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6732 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6733         #include <span>
6734         #include <type_traits>
6735         // Don't check size_type directly, as it was called index_type before P1872R0:
6736         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6737     ])], [
6738         AC_DEFINE([HAVE_CPP_SPAN],[1])
6739         AC_MSG_RESULT([yes])
6740     ], [AC_MSG_RESULT([no])])
6741 CXXFLAGS=$save_CXXFLAGS
6742 AC_LANG_POP([C++])
6744 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6745 AC_LANG_PUSH([C++])
6746 save_CXXFLAGS=$CXXFLAGS
6747 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6748 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6749         struct S1 { S1(S1 &&); };
6750         struct S2: S1 {};
6751         S1 f(S2 s) { return s; }
6752     ])], [
6753         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6754         AC_MSG_RESULT([yes])
6755     ], [AC_MSG_RESULT([no])])
6756 CXXFLAGS=$save_CXXFLAGS
6757 AC_LANG_POP([C++])
6759 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6760 dnl uninitialized warning for code like
6762 dnl   OString f();
6763 dnl   boost::optional<OString> * g(bool b) {
6764 dnl       boost::optional<OString> o;
6765 dnl       if (b) o = f();
6766 dnl       return new boost::optional<OString>(o);
6767 dnl   }
6769 dnl (as is e.g. present, in a slightly more elaborate form, in
6770 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6771 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6772 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6773 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6774     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6775     AC_LANG_PUSH([C++])
6776     save_CXXFLAGS=$CXXFLAGS
6777     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6778     if test "$ENABLE_OPTIMIZED" = TRUE; then
6779         CXXFLAGS="$CXXFLAGS -O2"
6780     else
6781         CXXFLAGS="$CXXFLAGS -O0"
6782     fi
6783     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6784             #include <new>
6785             void f1(int);
6786             struct S1 {
6787                 ~S1() { f1(n); }
6788                 int n = 0;
6789             };
6790             struct S2 {
6791                 S2() {}
6792                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6793                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6794                 void set(S1 s) {
6795                     new (stg) S1(s);
6796                     init = true;
6797                 }
6798                 bool init = false;
6799                 char stg[sizeof (S1)];
6800             } ;
6801             S1 f2();
6802             S2 * f3(bool b) {
6803                 S2 o;
6804                 if (b) o.set(f2());
6805                 return new S2(o);
6806             }
6807         ]])], [AC_MSG_RESULT([no])], [
6808             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6809             AC_MSG_RESULT([yes])
6810         ])
6811     CXXFLAGS=$save_CXXFLAGS
6812     AC_LANG_POP([C++])
6814 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6816 dnl ===================================================================
6817 dnl CPU Intrinsics support - SSE, AVX
6818 dnl ===================================================================
6820 INTRINSICS_CXXFLAGS=""
6822 if test "$GCC" = "yes"; then
6823     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6824     AC_LANG_PUSH([C++])
6825     save_CXXFLAGS=$CXXFLAGS
6826     CXXFLAGS="$CXXFLAGS -msse2"
6827     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6828         #include <emmintrin.h>
6829         int main () {
6830             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6831             c = _mm_xor_si128 (a, b);
6832             return 0;
6833         }
6834         ])],
6835         [can_compile_sse2=yes],
6836         [can_compile_sse2=no])
6837     AC_LANG_POP([C++])
6838     CXXFLAGS=$save_CXXFLAGS
6839     AC_MSG_RESULT([${can_compile_sse2}])
6840     if test "${can_compile_sse2}" = "yes" ; then
6841         INTRINSICS_CXXFLAGS="-msse2"
6842     else
6843         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6844     fi
6846     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6847     AC_LANG_PUSH([C++])
6848     save_CXXFLAGS=$CXXFLAGS
6849     CXXFLAGS="$CXXFLAGS -mssse3"
6850     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6851         #include <tmmintrin.h>
6852         int main () {
6853             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6854             c = _mm_maddubs_epi16 (a, b);
6855             return 0;
6856         }
6857         ])],
6858         [can_compile_ssse3=yes],
6859         [can_compile_ssse3=no])
6860     AC_LANG_POP([C++])
6861     CXXFLAGS=$save_CXXFLAGS
6862     AC_MSG_RESULT([${can_compile_ssse3}])
6863     if test "${can_compile_ssse3}" = "yes" ; then
6864         INTRINSICS_CXXFLAGS="-mssse3"
6865     else
6866         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6867     fi
6869     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6870     AC_LANG_PUSH([C++])
6871     save_CXXFLAGS=$CXXFLAGS
6872     CXXFLAGS="$CXXFLAGS -mavx"
6873     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6874         #include <immintrin.h>
6875         int main () {
6876             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6877             c = _mm256_xor_ps(a, b);
6878             return 0;
6879         }
6880         ])],
6881         [can_compile_avx=yes],
6882         [can_compile_avx=no])
6883     AC_LANG_POP([C++])
6884     CXXFLAGS=$save_CXXFLAGS
6885     AC_MSG_RESULT([${can_compile_avx}])
6886     if test "${can_compile_avx}" = "yes" ; then
6887         INTRINSICS_CXXFLAGS="-mavx"
6888     else
6889         AC_MSG_WARN([cannot compile AVX intrinsics])
6890     fi
6892     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6893     AC_LANG_PUSH([C++])
6894     save_CXXFLAGS=$CXXFLAGS
6895     CXXFLAGS="$CXXFLAGS -mavx2"
6896     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6897         #include <immintrin.h>
6898         int main () {
6899             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6900             c = _mm256_maddubs_epi16(a, b);
6901             return 0;
6902         }
6903         ])],
6904         [can_compile_avx2=yes],
6905         [can_compile_avx2=no])
6906     AC_LANG_POP([C++])
6907     CXXFLAGS=$save_CXXFLAGS
6908     AC_MSG_RESULT([${can_compile_avx2}])
6909     if test "${can_compile_avx2}" = "yes" ; then
6910         INTRINSICS_CXXFLAGS="-mavx2"
6911     else
6912         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6913     fi
6916 AC_SUBST([INTRINSICS_CXXFLAGS])
6918 dnl ===================================================================
6919 dnl system stl sanity tests
6920 dnl ===================================================================
6921 if test "$_os" != "WINNT"; then
6923     AC_LANG_PUSH([C++])
6925     save_CPPFLAGS="$CPPFLAGS"
6926     if test -n "$MACOSX_SDK_PATH"; then
6927         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6928     fi
6930     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6931     # only.
6932     if test "$CPP_LIBRARY" = GLIBCXX; then
6933         dnl gcc#19664, gcc#22482, rhbz#162935
6934         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6935         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6936         AC_MSG_RESULT([$stlvisok])
6937         if test "$stlvisok" = "no"; then
6938             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6939         fi
6940     fi
6942     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6943     # when we don't make any dynamic libraries?
6944     if test "$DISABLE_DYNLOADING" = ""; then
6945         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6946         cat > conftestlib1.cc <<_ACEOF
6947 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6948 struct S2: S1<int> { virtual ~S2(); };
6949 S2::~S2() {}
6950 _ACEOF
6951         cat > conftestlib2.cc <<_ACEOF
6952 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6953 struct S2: S1<int> { virtual ~S2(); };
6954 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6955 _ACEOF
6956         gccvisinlineshiddenok=yes
6957         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6958             gccvisinlineshiddenok=no
6959         else
6960             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6961             dnl known to not work with -z defs (unsetting which makes the test
6962             dnl moot, though):
6963             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6964             if test "$COM_IS_CLANG" = TRUE; then
6965                 for i in $CXX $CXXFLAGS; do
6966                     case $i in
6967                     -fsanitize=*)
6968                         my_linkflagsnoundefs=
6969                         break
6970                         ;;
6971                     esac
6972                 done
6973             fi
6974             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6975                 gccvisinlineshiddenok=no
6976             fi
6977         fi
6979         rm -fr libconftest*
6980         AC_MSG_RESULT([$gccvisinlineshiddenok])
6981         if test "$gccvisinlineshiddenok" = "no"; then
6982             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6983         fi
6984     fi
6986    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6987     cat >visibility.cxx <<_ACEOF
6988 #pragma GCC visibility push(hidden)
6989 struct __attribute__ ((visibility ("default"))) TestStruct {
6990   static void Init();
6992 __attribute__ ((visibility ("default"))) void TestFunc() {
6993   TestStruct::Init();
6995 _ACEOF
6996     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6997         gccvisbroken=yes
6998     else
6999         case "$host_cpu" in
7000         i?86|x86_64)
7001             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7002                 gccvisbroken=no
7003             else
7004                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7005                     gccvisbroken=no
7006                 else
7007                     gccvisbroken=yes
7008                 fi
7009             fi
7010             ;;
7011         *)
7012             gccvisbroken=no
7013             ;;
7014         esac
7015     fi
7016     rm -f visibility.s visibility.cxx
7018     AC_MSG_RESULT([$gccvisbroken])
7019     if test "$gccvisbroken" = "yes"; then
7020         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7021     fi
7023     CPPFLAGS="$save_CPPFLAGS"
7025     AC_LANG_POP([C++])
7028 dnl ===================================================================
7029 dnl  Clang++ tests
7030 dnl ===================================================================
7032 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7033 if test "$GCC" = "yes"; then
7034     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7035     AC_LANG_PUSH([C++])
7036     save_CXXFLAGS=$CXXFLAGS
7037     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7038     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7039     CXXFLAGS=$save_CXXFLAGS
7040     AC_LANG_POP([C++])
7041     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7042         AC_MSG_RESULT([yes])
7043     else
7044         AC_MSG_RESULT([no])
7045     fi
7047 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7049 dnl ===================================================================
7050 dnl Compiler plugins
7051 dnl ===================================================================
7053 COMPILER_PLUGINS=
7054 # currently only Clang
7056 if test "$COM_IS_CLANG" != "TRUE"; then
7057     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7058         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7059         enable_compiler_plugins=no
7060     fi
7063 if test "$COM_IS_CLANG" = "TRUE"; then
7064     if test -n "$enable_compiler_plugins"; then
7065         compiler_plugins="$enable_compiler_plugins"
7066     elif test -n "$ENABLE_DBGUTIL"; then
7067         compiler_plugins=test
7068     else
7069         compiler_plugins=no
7070     fi
7071     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7072         if test "$CLANGVER" -lt 50002; then
7073             if test "$compiler_plugins" = yes; then
7074                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7075             else
7076                 compiler_plugins=no
7077             fi
7078         fi
7079     fi
7080     if test "$compiler_plugins" != "no"; then
7081         dnl The prefix where Clang resides, override to where Clang resides if
7082         dnl using a source build:
7083         if test -z "$CLANGDIR"; then
7084             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7085         fi
7086         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7087         if test -z "$COMPILER_PLUGINS_CXX"; then
7088             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7089         fi
7090         clangbindir=$CLANGDIR/bin
7091         if test "$build_os" = "cygwin"; then
7092             clangbindir=$(cygpath -u "$clangbindir")
7093         fi
7094         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7095         if test -n "$LLVM_CONFIG"; then
7096             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7097             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7098             if test -z "$CLANGLIBDIR"; then
7099                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7100             fi
7101             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7102             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7103             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7104             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7105                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7106             fi
7107             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7108             clangobjdir=$($LLVM_CONFIG --obj-root)
7109             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7110                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7111             fi
7112         fi
7113         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7114         AC_LANG_PUSH([C++])
7115         save_CXX=$CXX
7116         save_CXXCPP=$CXXCPP
7117         save_CPPFLAGS=$CPPFLAGS
7118         save_CXXFLAGS=$CXXFLAGS
7119         save_LDFLAGS=$LDFLAGS
7120         save_LIBS=$LIBS
7121         CXX=$COMPILER_PLUGINS_CXX
7122         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7123         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7124         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7125         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7126             [COMPILER_PLUGINS=TRUE],
7127             [
7128             if test "$compiler_plugins" = "yes"; then
7129                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7130             else
7131                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7132                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7133             fi
7134             ])
7135         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7136         dnl comment in compilerplugins/Makefile-clang.mk:
7137         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7138             LDFLAGS=""
7139             AC_MSG_CHECKING([for clang libraries to use])
7140             if test -z "$CLANGTOOLLIBS"; then
7141                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7142  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7143                 AC_LINK_IFELSE([
7144                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7145                         [[ clang::FullSourceLoc().dump(); ]])
7146                 ],[CLANGTOOLLIBS="$LIBS"],[])
7147             fi
7148             if test -z "$CLANGTOOLLIBS"; then
7149                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7150                 AC_LINK_IFELSE([
7151                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7152                         [[ clang::FullSourceLoc().dump(); ]])
7153                 ],[CLANGTOOLLIBS="$LIBS"],[])
7154             fi
7155             AC_MSG_RESULT([$CLANGTOOLLIBS])
7156             if test -z "$CLANGTOOLLIBS"; then
7157                 if test "$compiler_plugins" = "yes"; then
7158                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7159                 else
7160                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7161                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7162                 fi
7163                 COMPILER_PLUGINS=
7164             fi
7165             if test -n "$COMPILER_PLUGINS"; then
7166                 if test -z "$CLANGSYSINCLUDE"; then
7167                     if test -n "$LLVM_CONFIG"; then
7168                         # Path to the clang system headers (no idea if there's a better way to get it).
7169                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7170                     fi
7171                 fi
7172             fi
7173         fi
7174         CXX=$save_CXX
7175         CXXCPP=$save_CXXCPP
7176         CPPFLAGS=$save_CPPFLAGS
7177         CXXFLAGS=$save_CXXFLAGS
7178         LDFLAGS=$save_LDFLAGS
7179         LIBS="$save_LIBS"
7180         AC_LANG_POP([C++])
7181     fi
7182 else
7183     if test "$enable_compiler_plugins" = "yes"; then
7184         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7185     fi
7187 AC_SUBST(COMPILER_PLUGINS)
7188 AC_SUBST(COMPILER_PLUGINS_CXX)
7189 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7190 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7191 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7192 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7193 AC_SUBST(CLANGDIR)
7194 AC_SUBST(CLANGLIBDIR)
7195 AC_SUBST(CLANGTOOLLIBS)
7196 AC_SUBST(CLANGSYSINCLUDE)
7198 # Plugin to help linker.
7199 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7200 # This makes --enable-lto build with clang work.
7201 AC_SUBST(LD_PLUGIN)
7203 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7204 AC_SUBST(HAVE_POSIX_FALLOCATE)
7206 dnl ===================================================================
7207 dnl Custom build version
7208 dnl ===================================================================
7210 AC_MSG_CHECKING([whether to add custom build version])
7211 if test "$with_build_version" != ""; then
7212     BUILD_VER_STRING=$with_build_version
7213     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7214 else
7215     BUILD_VER_STRING=
7216     AC_MSG_RESULT([no])
7218 AC_SUBST(BUILD_VER_STRING)
7220 JITC_PROCESSOR_TYPE=""
7221 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7222     # IBMs JDK needs this...
7223     JITC_PROCESSOR_TYPE=6
7224     export JITC_PROCESSOR_TYPE
7226 AC_SUBST([JITC_PROCESSOR_TYPE])
7228 # Misc Windows Stuff
7229 AC_ARG_WITH(ucrt-dir,
7230     AS_HELP_STRING([--with-ucrt-dir],
7231         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7232         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7233         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7234             Windows6.1-KB2999226-x64.msu
7235             Windows6.1-KB2999226-x86.msu
7236             Windows8.1-KB2999226-x64.msu
7237             Windows8.1-KB2999226-x86.msu
7238             Windows8-RT-KB2999226-x64.msu
7239             Windows8-RT-KB2999226-x86.msu
7240         A zip archive including those files is available from Microsoft site:
7241         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7243 UCRT_REDISTDIR="$with_ucrt_dir"
7244 if test $_os = "WINNT"; then
7245     find_msvc_x64_dlls
7246     find_msms
7247     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7248     MSVC_DLLS="$msvcdlls"
7249     MSM_PATH=`win_short_path_for_make "$msmdir"`
7250     # MSVC 15.3 changed it to VC141
7251     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7252         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7253     else
7254         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7255     fi
7257     if test "$UCRT_REDISTDIR" = "no"; then
7258         dnl explicitly disabled
7259         UCRT_REDISTDIR=""
7260     else
7261         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7262                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7263                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7264                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7265                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7266                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7267             UCRT_REDISTDIR=""
7268             if test -n "$PKGFORMAT"; then
7269                for i in $PKGFORMAT; do
7270                    case "$i" in
7271                    msi)
7272                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7273                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7274                        ;;
7275                    esac
7276                done
7277             fi
7278         fi
7279     fi
7282 AC_SUBST(UCRT_REDISTDIR)
7283 AC_SUBST(MSVC_DLL_PATH)
7284 AC_SUBST(MSVC_DLLS)
7285 AC_SUBST(MSM_PATH)
7287 dnl ===================================================================
7288 dnl Checks for Java
7289 dnl ===================================================================
7290 if test "$ENABLE_JAVA" != ""; then
7292     # Windows-specific tests
7293     if test "$build_os" = "cygwin"; then
7294         if test "$BITNESS_OVERRIDE" = 64; then
7295             bitness=64
7296         else
7297             bitness=32
7298         fi
7300         if test -z "$with_jdk_home"; then
7301             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7302             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7303             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7304             if test -n "$regvalue"; then
7305                 ver=$regvalue
7306                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7307                 _jdk_home=$regvalue
7308             fi
7309             if test -z "$with_jdk_home"; then
7310                 for ver in 1.8; do
7311                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7312                     if test -n "$regvalue"; then
7313                         _jdk_home=$regvalue
7314                         break
7315                     fi
7316                 done
7317             fi
7318             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7319                 with_jdk_home="$_jdk_home"
7320                 howfound="found automatically"
7321             else
7322                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7323             fi
7324         else
7325             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7326             howfound="you passed"
7327         fi
7328     fi
7330     # 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.
7331     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7332     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7333         with_jdk_home=`/usr/libexec/java_home`
7334     fi
7336     JAVA_HOME=; export JAVA_HOME
7337     if test -z "$with_jdk_home"; then
7338         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7339     else
7340         _java_path="$with_jdk_home/bin/$with_java"
7341         dnl Check if there is a Java interpreter at all.
7342         if test -x "$_java_path"; then
7343             JAVAINTERPRETER=$_java_path
7344         else
7345             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7346         fi
7347     fi
7349     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7350     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7351     dnl loaded by java to run JunitTests:
7352     if test "$build_os" = "cygwin"; then
7353         shortjdkhome=`cygpath -d "$with_jdk_home"`
7354         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
7355             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7356             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7357         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
7358             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7359             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7360         fi
7362         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7363             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7364         fi
7365         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7366     elif test "$cross_compiling" != "yes"; then
7367         case $CPUNAME in
7368             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7369                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7370                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7371                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7372                 fi
7373                 ;;
7374             *) # assumption: everything else 32-bit
7375                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7376                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7377                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7378                 fi
7379                 ;;
7380         esac
7381     fi
7384 dnl ===================================================================
7385 dnl Checks for JDK.
7386 dnl ===================================================================
7388 # Note that JAVA_HOME as for now always means the *build* platform's
7389 # JAVA_HOME. Whether all the complexity here actually is needed any
7390 # more or not, no idea.
7392 if test "$ENABLE_JAVA" != ""; then
7393     _gij_longver=0
7394     AC_MSG_CHECKING([the installed JDK])
7395     if test -n "$JAVAINTERPRETER"; then
7396         dnl java -version sends output to stderr!
7397         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7398             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7399         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7400             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7401         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7402             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7403         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7404             JDK=ibm
7406             dnl IBM JDK specific tests
7407             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7408             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7410             if test "$_jdk_ver" -lt 10800; then
7411                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7412             fi
7414             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7416             if test "$with_jdk_home" = ""; then
7417                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7418 you must use the "--with-jdk-home" configure option explicitly])
7419             fi
7421             JAVA_HOME=$with_jdk_home
7422         else
7423             JDK=sun
7425             dnl Sun JDK specific tests
7426             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7427             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7429             if test "$_jdk_ver" -lt 10800; then
7430                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7431             fi
7432             if test "$_jdk_ver" -gt 10800; then
7433                 JAVA_CLASSPATH_NOT_SET=TRUE
7434             fi
7436             AC_MSG_RESULT([found (JDK $_jdk)])
7437             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7438             if test "$_os" = "WINNT"; then
7439                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7440             fi
7442             # set to limit VM usage for JunitTests
7443             JAVAIFLAGS=-Xmx64M
7444             # set to limit VM usage for javac
7445             JAVAFLAGS=-J-Xmx128M
7446         fi
7447     else
7448         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7449     fi
7450 else
7451     dnl Java disabled
7452     JAVA_HOME=
7453     export JAVA_HOME
7456 dnl ===================================================================
7457 dnl Checks for javac
7458 dnl ===================================================================
7459 if test "$ENABLE_JAVA" != ""; then
7460     javacompiler="javac"
7461     : ${JAVA_SOURCE_VER=8}
7462     : ${JAVA_TARGET_VER=8}
7463     if test -z "$with_jdk_home"; then
7464         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7465     else
7466         _javac_path="$with_jdk_home/bin/$javacompiler"
7467         dnl Check if there is a Java compiler at all.
7468         if test -x "$_javac_path"; then
7469             JAVACOMPILER=$_javac_path
7470         fi
7471     fi
7472     if test -z "$JAVACOMPILER"; then
7473         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7474     fi
7475     if test "$build_os" = "cygwin"; then
7476         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7477             JAVACOMPILER="${JAVACOMPILER}.exe"
7478         fi
7479         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7480     fi
7483 dnl ===================================================================
7484 dnl Checks for javadoc
7485 dnl ===================================================================
7486 if test "$ENABLE_JAVA" != ""; then
7487     if test -z "$with_jdk_home"; then
7488         AC_PATH_PROG(JAVADOC, javadoc)
7489     else
7490         _javadoc_path="$with_jdk_home/bin/javadoc"
7491         dnl Check if there is a javadoc at all.
7492         if test -x "$_javadoc_path"; then
7493             JAVADOC=$_javadoc_path
7494         else
7495             AC_PATH_PROG(JAVADOC, javadoc)
7496         fi
7497     fi
7498     if test -z "$JAVADOC"; then
7499         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7500     fi
7501     if test "$build_os" = "cygwin"; then
7502         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7503             JAVADOC="${JAVADOC}.exe"
7504         fi
7505         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7506     fi
7508     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7509     JAVADOCISGJDOC="yes"
7510     fi
7512 AC_SUBST(JAVADOCISGJDOC)
7514 if test "$ENABLE_JAVA" != ""; then
7515     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7516     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7517         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7518            # try to recover first by looking whether we have an alternative
7519            # system as in Debian or newer SuSEs where following /usr/bin/javac
7520            # over /etc/alternatives/javac leads to the right bindir where we
7521            # just need to strip a bit away to get a valid JAVA_HOME
7522            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7523         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7524             # maybe only one level of symlink (e.g. on Mac)
7525             JAVA_HOME=$(readlink $JAVACOMPILER)
7526             if test "$(dirname $JAVA_HOME)" = "."; then
7527                 # we've got no path to trim back
7528                 JAVA_HOME=""
7529             fi
7530         else
7531             # else warn
7532             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7533             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7534             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7535             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7536         fi
7537         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7538         if test "$JAVA_HOME" != "/usr"; then
7539             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7540                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7541                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7542                 dnl Tiger already returns a JDK path...
7543                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7544             else
7545                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7546                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7547                 dnl that checks which version to run
7548                 if test -f "$JAVA_HOME"; then
7549                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7550                 fi
7551             fi
7552         fi
7553     fi
7554     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7556     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7557     if test -z "$JAVA_HOME"; then
7558         if test "x$with_jdk_home" = "x"; then
7559             cat > findhome.java <<_ACEOF
7560 [import java.io.File;
7562 class findhome
7564     public static void main(String args[])
7565     {
7566         String jrelocation = System.getProperty("java.home");
7567         File jre = new File(jrelocation);
7568         System.out.println(jre.getParent());
7569     }
7571 _ACEOF
7572             AC_MSG_CHECKING([if javac works])
7573             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7574             AC_TRY_EVAL(javac_cmd)
7575             if test $? = 0 -a -f ./findhome.class; then
7576                 AC_MSG_RESULT([javac works])
7577             else
7578                 echo "configure: javac test failed" >&5
7579                 cat findhome.java >&5
7580                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7581             fi
7582             AC_MSG_CHECKING([if gij knows its java.home])
7583             JAVA_HOME=`$JAVAINTERPRETER findhome`
7584             if test $? = 0 -a "$JAVA_HOME" != ""; then
7585                 AC_MSG_RESULT([$JAVA_HOME])
7586             else
7587                 echo "configure: java test failed" >&5
7588                 cat findhome.java >&5
7589                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7590             fi
7591             # clean-up after ourselves
7592             rm -f ./findhome.java ./findhome.class
7593         else
7594             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7595         fi
7596     fi
7598     # now check if $JAVA_HOME is really valid
7599     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7600         case "${JAVA_HOME}" in
7601             /Library/Java/JavaVirtualMachines/*)
7602                 ;;
7603             *)
7604                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7605                 ;;
7606         esac
7607         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7608             JAVA_HOME_OK="NO"
7609         fi
7610     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7611         JAVA_HOME_OK="NO"
7612     fi
7613     if test "$JAVA_HOME_OK" = "NO"; then
7614         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7615         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7616         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7617         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7618         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7619         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7620     fi
7621     PathFormat "$JAVA_HOME"
7622     JAVA_HOME="$formatted_path"
7625 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7626     "$_os" != Darwin
7627 then
7628     AC_MSG_CHECKING([for JAWT lib])
7629     if test "$_os" = WINNT; then
7630         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7631         JAWTLIB=jawt.lib
7632     else
7633         case "$host_cpu" in
7634         arm*)
7635             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7636             JAVA_ARCH=$my_java_arch
7637             ;;
7638         i*86)
7639             my_java_arch=i386
7640             ;;
7641         m68k)
7642             my_java_arch=m68k
7643             ;;
7644         powerpc)
7645             my_java_arch=ppc
7646             ;;
7647         powerpc64)
7648             my_java_arch=ppc64
7649             ;;
7650         powerpc64le)
7651             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7652             JAVA_ARCH=$my_java_arch
7653             ;;
7654         sparc64)
7655             my_java_arch=sparcv9
7656             ;;
7657         x86_64)
7658             my_java_arch=amd64
7659             ;;
7660         *)
7661             my_java_arch=$host_cpu
7662             ;;
7663         esac
7664         # This is where JDK9 puts the library
7665         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7666             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7667         else
7668             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7669         fi
7670         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7671     fi
7672     AC_MSG_RESULT([$JAWTLIB])
7674 AC_SUBST(JAWTLIB)
7676 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7677     case "$host_os" in
7679     aix*)
7680         JAVAINC="-I$JAVA_HOME/include"
7681         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7682         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7683         ;;
7685     cygwin*)
7686         JAVAINC="-I$JAVA_HOME/include/win32"
7687         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7688         ;;
7690     darwin*)
7691         if test -d "$JAVA_HOME/include/darwin"; then
7692             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7693         else
7694             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7695         fi
7696         ;;
7698     dragonfly*)
7699         JAVAINC="-I$JAVA_HOME/include"
7700         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7701         ;;
7703     freebsd*)
7704         JAVAINC="-I$JAVA_HOME/include"
7705         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7706         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7707         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7708         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7709         ;;
7711     k*bsd*-gnu*)
7712         JAVAINC="-I$JAVA_HOME/include"
7713         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7714         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7715         ;;
7717     linux-gnu*)
7718         JAVAINC="-I$JAVA_HOME/include"
7719         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7720         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7721         ;;
7723     *netbsd*)
7724         JAVAINC="-I$JAVA_HOME/include"
7725         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7726         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7727        ;;
7729     openbsd*)
7730         JAVAINC="-I$JAVA_HOME/include"
7731         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7732         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7733         ;;
7735     solaris*)
7736         JAVAINC="-I$JAVA_HOME/include"
7737         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7738         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7739         ;;
7740     esac
7742 SOLARINC="$SOLARINC $JAVAINC"
7744 AC_SUBST(JAVACOMPILER)
7745 AC_SUBST(JAVADOC)
7746 AC_SUBST(JAVAINTERPRETER)
7747 AC_SUBST(JAVAIFLAGS)
7748 AC_SUBST(JAVAFLAGS)
7749 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7750 AC_SUBST(JAVA_HOME)
7751 AC_SUBST(JAVA_SOURCE_VER)
7752 AC_SUBST(JAVA_TARGET_VER)
7753 AC_SUBST(JDK)
7756 dnl ===================================================================
7757 dnl Export file validation
7758 dnl ===================================================================
7759 AC_MSG_CHECKING([whether to enable export file validation])
7760 if test "$with_export_validation" != "no"; then
7761     if test -z "$ENABLE_JAVA"; then
7762         if test "$with_export_validation" = "yes"; then
7763             AC_MSG_ERROR([requested, but Java is disabled])
7764         else
7765             AC_MSG_RESULT([no, as Java is disabled])
7766         fi
7767     elif ! test -d "${SRC_ROOT}/schema"; then
7768         if test "$with_export_validation" = "yes"; then
7769             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7770         else
7771             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7772         fi
7773     else
7774         AC_MSG_RESULT([yes])
7775         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7777         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7778         if test -z "$ODFVALIDATOR"; then
7779             # remember to download the ODF toolkit with validator later
7780             AC_MSG_NOTICE([no odfvalidator found, will download it])
7781             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7782             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7784             # and fetch name of odfvalidator jar name from download.lst
7785             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7786             AC_SUBST(ODFVALIDATOR_JAR)
7788             if test -z "$ODFVALIDATOR_JAR"; then
7789                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7790             fi
7791         fi
7792         if test "$build_os" = "cygwin"; then
7793             # In case of Cygwin it will be executed from Windows,
7794             # so we need to run bash and absolute path to validator
7795             # so instead of "odfvalidator" it will be
7796             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7797             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7798         else
7799             ODFVALIDATOR="sh $ODFVALIDATOR"
7800         fi
7801         AC_SUBST(ODFVALIDATOR)
7804         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7805         if test -z "$OFFICEOTRON"; then
7806             # remember to download the officeotron with validator later
7807             AC_MSG_NOTICE([no officeotron found, will download it])
7808             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7809             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7811             # and fetch name of officeotron jar name from download.lst
7812             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7813             AC_SUBST(OFFICEOTRON_JAR)
7815             if test -z "$OFFICEOTRON_JAR"; then
7816                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7817             fi
7818         else
7819             # check version of existing officeotron
7820             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7821             if test 0"$OFFICEOTRON_VER" -lt 704; then
7822                 AC_MSG_ERROR([officeotron too old])
7823             fi
7824         fi
7825         if test "$build_os" = "cygwin"; then
7826             # In case of Cygwin it will be executed from Windows,
7827             # so we need to run bash and absolute path to validator
7828             # so instead of "odfvalidator" it will be
7829             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7830             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7831         else
7832             OFFICEOTRON="sh $OFFICEOTRON"
7833         fi
7834     fi
7835     AC_SUBST(OFFICEOTRON)
7836 else
7837     AC_MSG_RESULT([no])
7840 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7841 if test "$with_bffvalidator" != "no"; then
7842     AC_DEFINE(HAVE_BFFVALIDATOR)
7844     if test "$with_export_validation" = "no"; then
7845         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7846     fi
7848     if test "$with_bffvalidator" = "yes"; then
7849         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7850     else
7851         BFFVALIDATOR="$with_bffvalidator"
7852     fi
7854     if test "$build_os" = "cygwin"; then
7855         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7856             AC_MSG_RESULT($BFFVALIDATOR)
7857         else
7858             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7859         fi
7860     elif test -n "$BFFVALIDATOR"; then
7861         # We are not in Cygwin but need to run Windows binary with wine
7862         AC_PATH_PROGS(WINE, wine)
7864         # so swap in a shell wrapper that converts paths transparently
7865         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7866         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7867         AC_SUBST(BFFVALIDATOR_EXE)
7868         AC_MSG_RESULT($BFFVALIDATOR)
7869     else
7870         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7871     fi
7872     AC_SUBST(BFFVALIDATOR)
7873 else
7874     AC_MSG_RESULT([no])
7877 dnl ===================================================================
7878 dnl Check for C preprocessor to use
7879 dnl ===================================================================
7880 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7881 if test -n "$with_idlc_cpp"; then
7882     AC_MSG_RESULT([$with_idlc_cpp])
7883     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7884 else
7885     AC_MSG_RESULT([ucpp])
7886     AC_MSG_CHECKING([which ucpp tp use])
7887     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7888         AC_MSG_RESULT([external])
7889         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7890     else
7891         AC_MSG_RESULT([internal])
7892         BUILD_TYPE="$BUILD_TYPE UCPP"
7893     fi
7895 AC_SUBST(SYSTEM_UCPP)
7897 dnl ===================================================================
7898 dnl Check for epm (not needed for Windows)
7899 dnl ===================================================================
7900 AC_MSG_CHECKING([whether to enable EPM for packing])
7901 if test "$enable_epm" = "yes"; then
7902     AC_MSG_RESULT([yes])
7903     if test "$_os" != "WINNT"; then
7904         if test $_os = Darwin; then
7905             EPM=internal
7906         elif test -n "$with_epm"; then
7907             EPM=$with_epm
7908         else
7909             AC_PATH_PROG(EPM, epm, no)
7910         fi
7911         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7912             AC_MSG_NOTICE([EPM will be built.])
7913             BUILD_TYPE="$BUILD_TYPE EPM"
7914             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7915         else
7916             # Gentoo has some epm which is something different...
7917             AC_MSG_CHECKING([whether the found epm is the right epm])
7918             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7919                 AC_MSG_RESULT([yes])
7920             else
7921                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7922             fi
7923             AC_MSG_CHECKING([epm version])
7924             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7925             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7926                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7927                 AC_MSG_RESULT([OK, >= 3.7])
7928             else
7929                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7930                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7931             fi
7932         fi
7933     fi
7935     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7936         AC_MSG_CHECKING([for rpm])
7937         for a in "$RPM" rpmbuild rpm; do
7938             $a --usage >/dev/null 2> /dev/null
7939             if test $? -eq 0; then
7940                 RPM=$a
7941                 break
7942             else
7943                 $a --version >/dev/null 2> /dev/null
7944                 if test $? -eq 0; then
7945                     RPM=$a
7946                     break
7947                 fi
7948             fi
7949         done
7950         if test -z "$RPM"; then
7951             AC_MSG_ERROR([not found])
7952         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7953             RPM_PATH=`which $RPM`
7954             AC_MSG_RESULT([$RPM_PATH])
7955             SCPDEFS="$SCPDEFS -DWITH_RPM"
7956         else
7957             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7958         fi
7959     fi
7960     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7961         AC_PATH_PROG(DPKG, dpkg, no)
7962         if test "$DPKG" = "no"; then
7963             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7964         fi
7965     fi
7966     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7967        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7968         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7969             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7970                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7971                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7972                     AC_MSG_RESULT([yes])
7973                 else
7974                     AC_MSG_RESULT([no])
7975                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7976                         _pt="rpm"
7977                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7978                         add_warning "the rpms will need to be installed with --nodeps"
7979                     else
7980                         _pt="pkg"
7981                     fi
7982                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7983                     add_warning "the ${_pt}s will not be relocatable"
7984                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7985                                  relocation will work, you need to patch your epm with the
7986                                  patch in epm/epm-3.7.patch or build with
7987                                  --with-epm=internal which will build a suitable epm])
7988                 fi
7989             fi
7990         fi
7991     fi
7992     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7993         AC_PATH_PROG(PKGMK, pkgmk, no)
7994         if test "$PKGMK" = "no"; then
7995             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7996         fi
7997     fi
7998     AC_SUBST(RPM)
7999     AC_SUBST(DPKG)
8000     AC_SUBST(PKGMK)
8001 else
8002     for i in $PKGFORMAT; do
8003         case "$i" in
8004         aix | bsd | deb | pkg | rpm | native | portable)
8005             AC_MSG_ERROR(
8006                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8007             ;;
8008         esac
8009     done
8010     AC_MSG_RESULT([no])
8011     EPM=NO
8013 AC_SUBST(EPM)
8015 ENABLE_LWP=
8016 if test "$enable_lotuswordpro" = "yes"; then
8017     ENABLE_LWP="TRUE"
8019 AC_SUBST(ENABLE_LWP)
8021 dnl ===================================================================
8022 dnl Check for building ODK
8023 dnl ===================================================================
8024 if test "$enable_odk" = no; then
8025     unset DOXYGEN
8026 else
8027     if test "$with_doxygen" = no; then
8028         AC_MSG_CHECKING([for doxygen])
8029         unset DOXYGEN
8030         AC_MSG_RESULT([no])
8031     else
8032         if test "$with_doxygen" = yes; then
8033             AC_PATH_PROG([DOXYGEN], [doxygen])
8034             if test -z "$DOXYGEN"; then
8035                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8036             fi
8037             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8038                 if ! dot -V 2>/dev/null; then
8039                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8040                 fi
8041             fi
8042         else
8043             AC_MSG_CHECKING([for doxygen])
8044             DOXYGEN=$with_doxygen
8045             AC_MSG_RESULT([$DOXYGEN])
8046         fi
8047         if test -n "$DOXYGEN"; then
8048             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8049             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8050             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8051                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8052             fi
8053         fi
8054     fi
8056 AC_SUBST([DOXYGEN])
8058 AC_MSG_CHECKING([whether to build the ODK])
8059 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8060     AC_MSG_RESULT([yes])
8062     if test "$with_java" != "no"; then
8063         AC_MSG_CHECKING([whether to build unowinreg.dll])
8064         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8065             # build on Win by default
8066             enable_build_unowinreg=yes
8067         fi
8068         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8069             AC_MSG_RESULT([no])
8070             BUILD_UNOWINREG=
8071         else
8072             AC_MSG_RESULT([yes])
8073             BUILD_UNOWINREG=TRUE
8074         fi
8075         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8076             if test -z "$with_mingw_cross_compiler"; then
8077                 dnl Guess...
8078                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8079             elif test -x "$with_mingw_cross_compiler"; then
8080                  MINGWCXX="$with_mingw_cross_compiler"
8081             else
8082                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8083             fi
8085             if test "$MINGWCXX" = "false"; then
8086                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8087             fi
8089             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8090             if test -x "$mingwstrip_test"; then
8091                 MINGWSTRIP="$mingwstrip_test"
8092             else
8093                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8094             fi
8096             if test "$MINGWSTRIP" = "false"; then
8097                 AC_MSG_ERROR(MinGW32 binutils not found.)
8098             fi
8099         fi
8100     fi
8101     BUILD_TYPE="$BUILD_TYPE ODK"
8102 else
8103     AC_MSG_RESULT([no])
8104     BUILD_UNOWINREG=
8106 AC_SUBST(BUILD_UNOWINREG)
8107 AC_SUBST(MINGWCXX)
8108 AC_SUBST(MINGWSTRIP)
8110 dnl ===================================================================
8111 dnl Check for system zlib
8112 dnl ===================================================================
8113 if test "$with_system_zlib" = "auto"; then
8114     case "$_os" in
8115     WINNT)
8116         with_system_zlib="$with_system_libs"
8117         ;;
8118     *)
8119         if test "$enable_fuzzers" != "yes"; then
8120             with_system_zlib=yes
8121         else
8122             with_system_zlib=no
8123         fi
8124         ;;
8125     esac
8128 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8129 dnl and has no pkg-config for it at least on some tinderboxes,
8130 dnl so leaving that out for now
8131 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8132 AC_MSG_CHECKING([which zlib to use])
8133 if test "$with_system_zlib" = "yes"; then
8134     AC_MSG_RESULT([external])
8135     SYSTEM_ZLIB=TRUE
8136     AC_CHECK_HEADER(zlib.h, [],
8137         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8138     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8139         [AC_MSG_ERROR(zlib not found or functional)], [])
8140 else
8141     AC_MSG_RESULT([internal])
8142     SYSTEM_ZLIB=
8143     BUILD_TYPE="$BUILD_TYPE ZLIB"
8144     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8145     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8147 AC_SUBST(ZLIB_CFLAGS)
8148 AC_SUBST(ZLIB_LIBS)
8149 AC_SUBST(SYSTEM_ZLIB)
8151 dnl ===================================================================
8152 dnl Check for system jpeg
8153 dnl ===================================================================
8154 AC_MSG_CHECKING([which libjpeg to use])
8155 if test "$with_system_jpeg" = "yes"; then
8156     AC_MSG_RESULT([external])
8157     SYSTEM_LIBJPEG=TRUE
8158     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8159         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8160     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8161         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8162 else
8163     SYSTEM_LIBJPEG=
8164     AC_MSG_RESULT([internal, libjpeg-turbo])
8165     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8166     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8167     if test "$COM" = "MSC"; then
8168         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8169     else
8170         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8171     fi
8173     case "$host_cpu" in
8174     x86_64 | amd64 | i*86 | x86 | ia32)
8175         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8176         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8177             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8178                 NASM="$LODE_HOME/opt/bin/nasm"
8179             elif test -x "/opt/lo/bin/nasm"; then
8180                 NASM="/opt/lo/bin/nasm"
8181             fi
8182         fi
8184         if test -n "$NASM"; then
8185             AC_MSG_CHECKING([for object file format of host system])
8186             case "$host_os" in
8187               cygwin* | mingw* | pw32* | interix*)
8188                 case "$host_cpu" in
8189                   x86_64)
8190                     objfmt='Win64-COFF'
8191                     ;;
8192                   *)
8193                     objfmt='Win32-COFF'
8194                     ;;
8195                 esac
8196               ;;
8197               msdosdjgpp* | go32*)
8198                 objfmt='COFF'
8199               ;;
8200               os2-emx*) # not tested
8201                 objfmt='MSOMF' # obj
8202               ;;
8203               linux*coff* | linux*oldld*)
8204                 objfmt='COFF' # ???
8205               ;;
8206               linux*aout*)
8207                 objfmt='a.out'
8208               ;;
8209               linux*)
8210                 case "$host_cpu" in
8211                   x86_64)
8212                     objfmt='ELF64'
8213                     ;;
8214                   *)
8215                     objfmt='ELF'
8216                     ;;
8217                 esac
8218               ;;
8219               kfreebsd* | freebsd* | netbsd* | openbsd*)
8220                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8221                   objfmt='BSD-a.out'
8222                 else
8223                   case "$host_cpu" in
8224                     x86_64 | amd64)
8225                       objfmt='ELF64'
8226                       ;;
8227                     *)
8228                       objfmt='ELF'
8229                       ;;
8230                   esac
8231                 fi
8232               ;;
8233               solaris* | sunos* | sysv* | sco*)
8234                 case "$host_cpu" in
8235                   x86_64)
8236                     objfmt='ELF64'
8237                     ;;
8238                   *)
8239                     objfmt='ELF'
8240                     ;;
8241                 esac
8242               ;;
8243               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8244                 case "$host_cpu" in
8245                   x86_64)
8246                     objfmt='Mach-O64'
8247                     ;;
8248                   *)
8249                     objfmt='Mach-O'
8250                     ;;
8251                 esac
8252               ;;
8253               *)
8254                 objfmt='ELF ?'
8255               ;;
8256             esac
8258             AC_MSG_RESULT([$objfmt])
8259             if test "$objfmt" = 'ELF ?'; then
8260               objfmt='ELF'
8261               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8262             fi
8264             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8265             case "$objfmt" in
8266               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8267               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8268               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8269               COFF)       NAFLAGS='-fcoff -DCOFF';;
8270               a.out)      NAFLAGS='-faout -DAOUT';;
8271               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8272               ELF)        NAFLAGS='-felf -DELF';;
8273               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8274               RDF)        NAFLAGS='-frdf -DRDF';;
8275               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8276               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8277             esac
8278             AC_MSG_RESULT([$NAFLAGS])
8280             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8281             cat > conftest.asm << EOF
8282             [%line __oline__ "configure"
8283                     section .text
8284                     global  _main,main
8285             _main:
8286             main:   xor     eax,eax
8287                     ret
8288             ]
8290             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8291             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8292               AC_MSG_RESULT(yes)
8293             else
8294               echo "configure: failed program was:" >&AC_FD_CC
8295               cat conftest.asm >&AC_FD_CC
8296               rm -rf conftest*
8297               AC_MSG_RESULT(no)
8298               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8299               NASM=""
8300             fi
8302         fi
8304         if test -z "$NASM"; then
8305 cat << _EOS
8306 ****************************************************************************
8307 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8308 To get one please:
8310 _EOS
8311             if test "$build_os" = "cygwin"; then
8312 cat << _EOS
8313 install a pre-compiled binary for Win32
8315 mkdir -p /opt/lo/bin
8316 cd /opt/lo/bin
8317 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8318 chmod +x nasm
8320 or get and install one from http://www.nasm.us/
8322 Then re-run autogen.sh
8324 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8325 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8327 _EOS
8328             else
8329 cat << _EOS
8330 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8332 _EOS
8333             fi
8334             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8335             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8336         fi
8337       ;;
8338     esac
8341 AC_SUBST(NASM)
8342 AC_SUBST(LIBJPEG_CFLAGS)
8343 AC_SUBST(LIBJPEG_LIBS)
8344 AC_SUBST(SYSTEM_LIBJPEG)
8346 dnl ===================================================================
8347 dnl Check for system clucene
8348 dnl ===================================================================
8349 dnl we should rather be using
8350 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8351 dnl but the contribs-lib check seems tricky
8352 AC_MSG_CHECKING([which clucene to use])
8353 if test "$with_system_clucene" = "yes"; then
8354     AC_MSG_RESULT([external])
8355     SYSTEM_CLUCENE=TRUE
8356     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8357     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8358     FilterLibs "${CLUCENE_LIBS}"
8359     CLUCENE_LIBS="${filteredlibs}"
8360     AC_LANG_PUSH([C++])
8361     save_CXXFLAGS=$CXXFLAGS
8362     save_CPPFLAGS=$CPPFLAGS
8363     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8364     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8365     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8366     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8367     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8368                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8369     CXXFLAGS=$save_CXXFLAGS
8370     CPPFLAGS=$save_CPPFLAGS
8371     AC_LANG_POP([C++])
8373     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8374 else
8375     AC_MSG_RESULT([internal])
8376     SYSTEM_CLUCENE=
8377     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8379 AC_SUBST(SYSTEM_CLUCENE)
8380 AC_SUBST(CLUCENE_CFLAGS)
8381 AC_SUBST(CLUCENE_LIBS)
8383 dnl ===================================================================
8384 dnl Check for system expat
8385 dnl ===================================================================
8386 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8388 dnl ===================================================================
8389 dnl Check for system xmlsec
8390 dnl ===================================================================
8391 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8393 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8394 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8395     ENABLE_EOT="TRUE"
8396     AC_DEFINE([ENABLE_EOT])
8397     AC_MSG_RESULT([yes])
8399     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8400 else
8401     ENABLE_EOT=
8402     AC_MSG_RESULT([no])
8404 AC_SUBST([ENABLE_EOT])
8406 dnl ===================================================================
8407 dnl Check for DLP libs
8408 dnl ===================================================================
8409 AS_IF([test "$COM" = "MSC"],
8410       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8411       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8413 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8415 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8417 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8419 AS_IF([test "$COM" = "MSC"],
8420       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8421       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8423 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8425 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8427 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8428 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8430 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8432 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8434 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8436 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8437 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8439 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8440 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8442 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8444 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8445 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8447 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8449 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8451 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8453 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8455 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8456 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8458 dnl ===================================================================
8459 dnl Check for system lcms2
8460 dnl ===================================================================
8461 if test "$with_system_lcms2" != "yes"; then
8462     SYSTEM_LCMS2=
8464 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8465 if test "$GCC" = "yes"; then
8466     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8468 if test "$COM" = "MSC"; then # override the above
8469     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8472 dnl ===================================================================
8473 dnl Check for system cppunit
8474 dnl ===================================================================
8475 if test "$_os" != "Android" ; then
8476     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8479 dnl ===================================================================
8480 dnl Check whether freetype is available
8481 dnl ===================================================================
8482 if test  "$test_freetype" = "yes"; then
8483     AC_MSG_CHECKING([whether freetype is available])
8484     # FreeType has 3 different kinds of versions
8485     # * release, like 2.4.10
8486     # * libtool, like 13.0.7 (this what pkg-config returns)
8487     # * soname
8488     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8489     #
8490     # 9.9.3 is 2.2.0
8491     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8492     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8493     FilterLibs "${FREETYPE_LIBS}"
8494     FREETYPE_LIBS="${filteredlibs}"
8495     SYSTEM_FREETYPE=TRUE
8496 else
8497     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8498     if test "x$ac_config_site_64bit_host" = xYES; then
8499         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8500     else
8501         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8502     fi
8504 AC_SUBST(FREETYPE_CFLAGS)
8505 AC_SUBST(FREETYPE_LIBS)
8506 AC_SUBST([SYSTEM_FREETYPE])
8508 # ===================================================================
8509 # Check for system libxslt
8510 # to prevent incompatibilities between internal libxml2 and external libxslt,
8511 # or vice versa, use with_system_libxml here
8512 # ===================================================================
8513 if test "$with_system_libxml" = "auto"; then
8514     case "$_os" in
8515     WINNT|iOS|Android)
8516         with_system_libxml="$with_system_libs"
8517         ;;
8518     *)
8519         if test "$enable_fuzzers" != "yes"; then
8520             with_system_libxml=yes
8521         else
8522             with_system_libxml=no
8523         fi
8524         ;;
8525     esac
8528 AC_MSG_CHECKING([which libxslt to use])
8529 if test "$with_system_libxml" = "yes"; then
8530     AC_MSG_RESULT([external])
8531     SYSTEM_LIBXSLT=TRUE
8532     if test "$_os" = "Darwin"; then
8533         dnl make sure to use SDK path
8534         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8535         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8536         dnl omit -L/usr/lib
8537         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8538         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8539     else
8540         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8541         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8542         FilterLibs "${LIBXSLT_LIBS}"
8543         LIBXSLT_LIBS="${filteredlibs}"
8544         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8545         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8546         FilterLibs "${LIBEXSLT_LIBS}"
8547         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8548     fi
8550     dnl Check for xsltproc
8551     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8552     if test "$XSLTPROC" = "no"; then
8553         AC_MSG_ERROR([xsltproc is required])
8554     fi
8555 else
8556     AC_MSG_RESULT([internal])
8557     SYSTEM_LIBXSLT=
8558     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8560     if test "$cross_compiling" = "yes"; then
8561         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8562         if test "$XSLTPROC" = "no"; then
8563             AC_MSG_ERROR([xsltproc is required])
8564         fi
8565     fi
8567 AC_SUBST(SYSTEM_LIBXSLT)
8568 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8569     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8571 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8573 AC_SUBST(LIBEXSLT_CFLAGS)
8574 AC_SUBST(LIBEXSLT_LIBS)
8575 AC_SUBST(LIBXSLT_CFLAGS)
8576 AC_SUBST(LIBXSLT_LIBS)
8577 AC_SUBST(XSLTPROC)
8579 # ===================================================================
8580 # Check for system libxml
8581 # ===================================================================
8582 AC_MSG_CHECKING([which libxml to use])
8583 if test "$with_system_libxml" = "yes"; then
8584     AC_MSG_RESULT([external])
8585     SYSTEM_LIBXML=TRUE
8586     if test "$_os" = "Darwin"; then
8587         dnl make sure to use SDK path
8588         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8589         dnl omit -L/usr/lib
8590         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8591     elif test $_os = iOS; then
8592         dnl make sure to use SDK path
8593         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8594         LIBXML_CFLAGS="-I$usr/include/libxml2"
8595         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8596     else
8597         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8598         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8599         FilterLibs "${LIBXML_LIBS}"
8600         LIBXML_LIBS="${filteredlibs}"
8601     fi
8603     dnl Check for xmllint
8604     AC_PATH_PROG(XMLLINT, xmllint, no)
8605     if test "$XMLLINT" = "no"; then
8606         AC_MSG_ERROR([xmllint is required])
8607     fi
8608 else
8609     AC_MSG_RESULT([internal])
8610     SYSTEM_LIBXML=
8611     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8612     if test "$COM" = "MSC"; then
8613         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8614     fi
8615     if test "$COM" = "MSC"; then
8616         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8617     else
8618         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8619     fi
8620     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8622 AC_SUBST(SYSTEM_LIBXML)
8623 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8624     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8626 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8627 AC_SUBST(LIBXML_CFLAGS)
8628 AC_SUBST(LIBXML_LIBS)
8629 AC_SUBST(XMLLINT)
8631 # =====================================================================
8632 # Checking for a Python interpreter with version >= 2.7.
8633 # Build and runtime requires Python 3 compatible version (>= 2.7).
8634 # Optionally user can pass an option to configure, i. e.
8635 # ./configure PYTHON=/usr/bin/python
8636 # =====================================================================
8637 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8638     if test -n "$PYTHON"; then
8639         PYTHON_FOR_BUILD=$PYTHON
8640     else
8641         # This allows a lack of system python with no error, we use internal one in that case.
8642         AM_PATH_PYTHON([2.7],, [:])
8643         # Clean PYTHON_VERSION checked below if cross-compiling
8644         PYTHON_VERSION=""
8645         if test "$PYTHON" != ":"; then
8646             PYTHON_FOR_BUILD=$PYTHON
8647         fi
8648     fi
8650 AC_SUBST(PYTHON_FOR_BUILD)
8652 # Checks for Python to use for Pyuno
8653 AC_MSG_CHECKING([which Python to use for Pyuno])
8654 case "$enable_python" in
8655 no|disable)
8656     if test -z $PYTHON_FOR_BUILD; then
8657         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8658         # requirement from the choice whether to include Python stuff in the installer, but why
8659         # bother?
8660         AC_MSG_ERROR([Python is required at build time.])
8661     fi
8662     enable_python=no
8663     AC_MSG_RESULT([none])
8664     ;;
8665 ""|yes|auto)
8666     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8667         AC_MSG_RESULT([no, overridden by --disable-scripting])
8668         enable_python=no
8669     elif test $build_os = cygwin; then
8670         dnl When building on Windows we don't attempt to use any installed
8671         dnl "system"  Python.
8672         AC_MSG_RESULT([fully internal])
8673         enable_python=internal
8674     elif test "$cross_compiling" = yes; then
8675         AC_MSG_RESULT([system])
8676         enable_python=system
8677     else
8678         # Unset variables set by the above AM_PATH_PYTHON so that
8679         # we actually do check anew.
8680         AC_MSG_RESULT([])
8681         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
8682         AM_PATH_PYTHON([3.3],, [:])
8683         AC_MSG_CHECKING([which Python to use for Pyuno])
8684         if test "$PYTHON" = ":"; then
8685             if test -z "$PYTHON_FOR_BUILD"; then
8686                 AC_MSG_RESULT([fully internal])
8687             else
8688                 AC_MSG_RESULT([internal])
8689             fi
8690             enable_python=internal
8691         else
8692             AC_MSG_RESULT([system])
8693             enable_python=system
8694         fi
8695     fi
8696     ;;
8697 internal)
8698     AC_MSG_RESULT([internal])
8699     ;;
8700 fully-internal)
8701     AC_MSG_RESULT([fully internal])
8702     enable_python=internal
8703     ;;
8704 system)
8705     AC_MSG_RESULT([system])
8706     if test "$_os" = Darwin; then
8707         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])
8708     fi
8709     ;;
8711     AC_MSG_ERROR([Incorrect --enable-python option])
8712     ;;
8713 esac
8715 if test $enable_python != no; then
8716     BUILD_TYPE="$BUILD_TYPE PYUNO"
8719 if test $enable_python = system; then
8720     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8721         # Fallback: Accept these in the environment, or as set above
8722         # for MacOSX.
8723         :
8724     elif test "$cross_compiling" != yes; then
8725         # Unset variables set by the above AM_PATH_PYTHON so that
8726         # we actually do check anew.
8727         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
8728         # This causes an error if no python command is found
8729         AM_PATH_PYTHON([3.3])
8730         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8731         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8732         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8733         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8734         if test -z "$PKG_CONFIG"; then
8735             PYTHON_CFLAGS="-I$python_include"
8736             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8737         elif $PKG_CONFIG --exists python-$python_version-embed; then
8738             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8739             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8740         elif $PKG_CONFIG --exists python-$python_version; then
8741             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8742             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8743         else
8744             PYTHON_CFLAGS="-I$python_include"
8745             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8746         fi
8747         FilterLibs "${PYTHON_LIBS}"
8748         PYTHON_LIBS="${filteredlibs}"
8749     else
8750         dnl How to find out the cross-compilation Python installation path?
8751         AC_MSG_CHECKING([for python version])
8752         AS_IF([test -n "$PYTHON_VERSION"],
8753               [AC_MSG_RESULT([$PYTHON_VERSION])],
8754               [AC_MSG_RESULT([not found])
8755                AC_MSG_ERROR([no usable python found])])
8756         test -n "$PYTHON_CFLAGS" && break
8757     fi
8759     dnl Check if the headers really work
8760     save_CPPFLAGS="$CPPFLAGS"
8761     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8762     AC_CHECK_HEADER(Python.h)
8763     CPPFLAGS="$save_CPPFLAGS"
8765     # let the PYTHON_FOR_BUILD match the same python installation that
8766     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8767     # better for PythonTests.
8768     PYTHON_FOR_BUILD=$PYTHON
8771 if test "$with_lxml" != no; then
8772     if test -z "$PYTHON_FOR_BUILD"; then
8773         case $build_os in
8774             cygwin)
8775                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8776                 ;;
8777             *)
8778                 if test "$cross_compiling" != yes ; then
8779                     BUILD_TYPE="$BUILD_TYPE LXML"
8780                 fi
8781                 ;;
8782         esac
8783     else
8784         AC_MSG_CHECKING([for python lxml])
8785         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8786             AC_MSG_RESULT([yes])
8787         else
8788             case $build_os in
8789                 cygwin)
8790                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8791                     ;;
8792                 *)
8793                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8794                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8795                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8796                         else
8797                             BUILD_TYPE="$BUILD_TYPE LXML"
8798                             AC_MSG_RESULT([no, using internal lxml])
8799                         fi
8800                     else
8801                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8802                     fi
8803                     ;;
8804             esac
8805         fi
8806     fi
8809 dnl By now enable_python should be "system", "internal" or "no"
8810 case $enable_python in
8811 system)
8812     SYSTEM_PYTHON=TRUE
8814     if test "x$ac_cv_header_Python_h" != "xyes"; then
8815        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8816     fi
8818     AC_LANG_PUSH(C)
8819     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8820     AC_MSG_CHECKING([for correct python library version])
8821        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8822 #include <Python.h>
8824 int main(int argc, char **argv) {
8825    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8826        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8827    else return 1;
8829        ]])],[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])])
8830     CFLAGS=$save_CFLAGS
8831     AC_LANG_POP(C)
8833     dnl FIXME Check if the Python library can be linked with, too?
8834     ;;
8836 internal)
8837     SYSTEM_PYTHON=
8838     PYTHON_VERSION_MAJOR=3
8839     PYTHON_VERSION_MINOR=7
8840     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8841     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8842         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8843     fi
8844     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8845     BUILD_TYPE="$BUILD_TYPE PYTHON"
8846     if test "$OS" = LINUX; then
8847         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8848     fi
8849     # Embedded Python dies without Home set
8850     if test "$HOME" = ""; then
8851         export HOME=""
8852     fi
8853     ;;
8855     DISABLE_PYTHON=TRUE
8856     SYSTEM_PYTHON=
8857     ;;
8859     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8860     ;;
8861 esac
8863 AC_SUBST(DISABLE_PYTHON)
8864 AC_SUBST(SYSTEM_PYTHON)
8865 AC_SUBST(PYTHON_CFLAGS)
8866 AC_SUBST(PYTHON_LIBS)
8867 AC_SUBST(PYTHON_VERSION)
8868 AC_SUBST(PYTHON_VERSION_MAJOR)
8869 AC_SUBST(PYTHON_VERSION_MINOR)
8871 ENABLE_MARIADBC=TRUE
8872 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8873     ENABLE_MARIADBC=
8875 MARIADBC_MAJOR=1
8876 MARIADBC_MINOR=0
8877 MARIADBC_MICRO=2
8878 if test "$ENABLE_MARIADBC" = "TRUE"; then
8879     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8882 AC_SUBST(ENABLE_MARIADBC)
8883 AC_SUBST(MARIADBC_MAJOR)
8884 AC_SUBST(MARIADBC_MINOR)
8885 AC_SUBST(MARIADBC_MICRO)
8887 if test "$ENABLE_MARIADBC" = "TRUE"; then
8888     dnl ===================================================================
8889     dnl Check for system MariaDB
8890     dnl ===================================================================
8891     AC_MSG_CHECKING([which MariaDB to use])
8892     if test "$with_system_mariadb" = "yes"; then
8893         AC_MSG_RESULT([external])
8894         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8895         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8896         if test -z "$MARIADBCONFIG"; then
8897             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8898             if test -z "$MARIADBCONFIG"; then
8899                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8900                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8901             fi
8902         fi
8903         AC_MSG_CHECKING([MariaDB version])
8904         MARIADB_VERSION=`$MARIADBCONFIG --version`
8905         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8906         if test "$MARIADB_MAJOR" -ge "5"; then
8907             AC_MSG_RESULT([OK])
8908         else
8909             AC_MSG_ERROR([too old, use 5.0.x or later])
8910         fi
8911         AC_MSG_CHECKING([for MariaDB Client library])
8912         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8913         if test "$COM_IS_CLANG" = TRUE; then
8914             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8915         fi
8916         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8917         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8918         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8919         dnl linux32:
8920         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8921             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8922             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8923                 | sed -e 's|/lib64/|/lib/|')
8924         fi
8925         FilterLibs "${MARIADB_LIBS}"
8926         MARIADB_LIBS="${filteredlibs}"
8927         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8928         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8929         if test "$enable_bundle_mariadb" = "yes"; then
8930             AC_MSG_RESULT([yes])
8931             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8932             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8934 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8936 /g' | grep -E '(mysqlclient|mariadb)')
8937             if test "$_os" = "Darwin"; then
8938                 LIBMARIADB=${LIBMARIADB}.dylib
8939             elif test "$_os" = "WINNT"; then
8940                 LIBMARIADB=${LIBMARIADB}.dll
8941             else
8942                 LIBMARIADB=${LIBMARIADB}.so
8943             fi
8944             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8945             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8946             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8947                 AC_MSG_RESULT([found.])
8948                 PathFormat "$LIBMARIADB_PATH"
8949                 LIBMARIADB_PATH="$formatted_path"
8950             else
8951                 AC_MSG_ERROR([not found.])
8952             fi
8953         else
8954             AC_MSG_RESULT([no])
8955             BUNDLE_MARIADB_CONNECTOR_C=
8956         fi
8957     else
8958         AC_MSG_RESULT([internal])
8959         SYSTEM_MARIADB_CONNECTOR_C=
8960         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8961         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8962         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8963     fi
8965     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8966     AC_SUBST(MARIADB_CFLAGS)
8967     AC_SUBST(MARIADB_LIBS)
8968     AC_SUBST(LIBMARIADB)
8969     AC_SUBST(LIBMARIADB_PATH)
8970     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8973 dnl ===================================================================
8974 dnl Check for system hsqldb
8975 dnl ===================================================================
8976 if test "$with_java" != "no"; then
8977     HSQLDB_USE_JDBC_4_1=
8978     AC_MSG_CHECKING([which hsqldb to use])
8979     if test "$with_system_hsqldb" = "yes"; then
8980         AC_MSG_RESULT([external])
8981         SYSTEM_HSQLDB=TRUE
8982         if test -z $HSQLDB_JAR; then
8983             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8984         fi
8985         if ! test -f $HSQLDB_JAR; then
8986                AC_MSG_ERROR(hsqldb.jar not found.)
8987         fi
8988         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8989         export HSQLDB_JAR
8990         if $PERL -e \
8991            'use Archive::Zip;
8992             my $file = "$ENV{'HSQLDB_JAR'}";
8993             my $zip = Archive::Zip->new( $file );
8994             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8995             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8996             {
8997                 push @l, split(/\n/, $mf);
8998                 foreach my $line (@l)
8999                 {
9000                     if ($line =~ m/Specification-Version:/)
9001                     {
9002                         ($t, $version) = split (/:/,$line);
9003                         $version =~ s/^\s//;
9004                         ($a, $b, $c, $d) = split (/\./,$version);
9005                         if ($c == "0" && $d > "8")
9006                         {
9007                             exit 0;
9008                         }
9009                         else
9010                         {
9011                             exit 1;
9012                         }
9013                     }
9014                 }
9015             }
9016             else
9017             {
9018                 exit 1;
9019             }'; then
9020             AC_MSG_RESULT([yes])
9021         else
9022             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9023         fi
9024     else
9025         AC_MSG_RESULT([internal])
9026         SYSTEM_HSQLDB=
9027         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9028         NEED_ANT=TRUE
9029         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9030         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9031         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9032             AC_MSG_RESULT([yes])
9033             HSQLDB_USE_JDBC_4_1=TRUE
9034         else
9035             AC_MSG_RESULT([no])
9036         fi
9037     fi
9038     AC_SUBST(SYSTEM_HSQLDB)
9039     AC_SUBST(HSQLDB_JAR)
9040     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9043 dnl ===================================================================
9044 dnl Check for PostgreSQL stuff
9045 dnl ===================================================================
9046 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9047 if test "x$enable_postgresql_sdbc" != "xno"; then
9048     AC_MSG_RESULT([yes])
9049     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9051     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9052         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9053     fi
9054     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9055         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9056     fi
9058     postgres_interface=""
9059     if test "$with_system_postgresql" = "yes"; then
9060         postgres_interface="external PostgreSQL"
9061         SYSTEM_POSTGRESQL=TRUE
9062         if test "$_os" = Darwin; then
9063             supp_path=''
9064             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9065                 pg_supp_path="$P_SEP$d$pg_supp_path"
9066             done
9067         fi
9068         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9069         if test -n "$PGCONFIG"; then
9070             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9071             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9072         else
9073             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9074               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9075               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9076             ],[
9077               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9078             ])
9079         fi
9080         FilterLibs "${POSTGRESQL_LIB}"
9081         POSTGRESQL_LIB="${filteredlibs}"
9082     else
9083         # if/when anything else than PostgreSQL uses Kerberos,
9084         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9085         WITH_KRB5=
9086         WITH_GSSAPI=
9087         case "$_os" in
9088         Darwin)
9089             # macOS has system MIT Kerberos 5 since 10.4
9090             if test "$with_krb5" != "no"; then
9091                 WITH_KRB5=TRUE
9092                 save_LIBS=$LIBS
9093                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9094                 # that the libraries where these functions are located on macOS will change, is it?
9095                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9096                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9097                 KRB5_LIBS=$LIBS
9098                 LIBS=$save_LIBS
9099                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9100                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9101                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9102                 LIBS=$save_LIBS
9103             fi
9104             if test "$with_gssapi" != "no"; then
9105                 WITH_GSSAPI=TRUE
9106                 save_LIBS=$LIBS
9107                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9108                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9109                 GSSAPI_LIBS=$LIBS
9110                 LIBS=$save_LIBS
9111             fi
9112             ;;
9113         WINNT)
9114             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9115                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9116             fi
9117             ;;
9118         Linux|GNU|*BSD|DragonFly)
9119             if test "$with_krb5" != "no"; then
9120                 WITH_KRB5=TRUE
9121                 save_LIBS=$LIBS
9122                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9123                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9124                 KRB5_LIBS=$LIBS
9125                 LIBS=$save_LIBS
9126                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9127                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9128                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9129                 LIBS=$save_LIBS
9130             fi
9131             if test "$with_gssapi" != "no"; then
9132                 WITH_GSSAPI=TRUE
9133                 save_LIBS=$LIBS
9134                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9135                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9136                 GSSAPI_LIBS=$LIBS
9137                 LIBS=$save_LIBS
9138             fi
9139             ;;
9140         *)
9141             if test "$with_krb5" = "yes"; then
9142                 WITH_KRB5=TRUE
9143                 save_LIBS=$LIBS
9144                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9145                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9146                 KRB5_LIBS=$LIBS
9147                 LIBS=$save_LIBS
9148                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9149                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9150                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9151                 LIBS=$save_LIBS
9152             fi
9153             if test "$with_gssapi" = "yes"; then
9154                 WITH_GSSAPI=TRUE
9155                 save_LIBS=$LIBS
9156                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9157                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9158                 LIBS=$save_LIBS
9159                 GSSAPI_LIBS=$LIBS
9160             fi
9161         esac
9163         if test -n "$with_libpq_path"; then
9164             SYSTEM_POSTGRESQL=TRUE
9165             postgres_interface="external libpq"
9166             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9167             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9168         else
9169             SYSTEM_POSTGRESQL=
9170             postgres_interface="internal"
9171             POSTGRESQL_LIB=""
9172             POSTGRESQL_INC="%OVERRIDE_ME%"
9173             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9174         fi
9175     fi
9177     AC_MSG_CHECKING([PostgreSQL C interface])
9178     AC_MSG_RESULT([$postgres_interface])
9180     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9181         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9182         save_CFLAGS=$CFLAGS
9183         save_CPPFLAGS=$CPPFLAGS
9184         save_LIBS=$LIBS
9185         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9186         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9187         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9188         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9189             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9190         CFLAGS=$save_CFLAGS
9191         CPPFLAGS=$save_CPPFLAGS
9192         LIBS=$save_LIBS
9193     fi
9194     BUILD_POSTGRESQL_SDBC=TRUE
9195 else
9196     AC_MSG_RESULT([no])
9198 AC_SUBST(WITH_KRB5)
9199 AC_SUBST(WITH_GSSAPI)
9200 AC_SUBST(GSSAPI_LIBS)
9201 AC_SUBST(KRB5_LIBS)
9202 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9203 AC_SUBST(SYSTEM_POSTGRESQL)
9204 AC_SUBST(POSTGRESQL_INC)
9205 AC_SUBST(POSTGRESQL_LIB)
9207 dnl ===================================================================
9208 dnl Check for Firebird stuff
9209 dnl ===================================================================
9210 ENABLE_FIREBIRD_SDBC=
9211 if test "$enable_firebird_sdbc" = "yes" ; then
9212     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9214     dnl ===================================================================
9215     dnl Check for system Firebird
9216     dnl ===================================================================
9217     AC_MSG_CHECKING([which Firebird to use])
9218     if test "$with_system_firebird" = "yes"; then
9219         AC_MSG_RESULT([external])
9220         SYSTEM_FIREBIRD=TRUE
9221         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9222         if test -z "$FIREBIRDCONFIG"; then
9223             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9224             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9225                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9226             ])
9227             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9228         else
9229             AC_MSG_NOTICE([fb_config found])
9230             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9231             AC_MSG_CHECKING([for Firebird Client library])
9232             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9233             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9234             FilterLibs "${FIREBIRD_LIBS}"
9235             FIREBIRD_LIBS="${filteredlibs}"
9236         fi
9237         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9238         AC_MSG_CHECKING([Firebird version])
9239         if test -n "${FIREBIRD_VERSION}"; then
9240             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9241             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9242             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9243                 AC_MSG_RESULT([OK])
9244             else
9245                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9246             fi
9247         else
9248             __save_CFLAGS="${CFLAGS}"
9249             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9250             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9251 #if defined(FB_API_VER) && FB_API_VER == 30
9252 int fb_api_is_30(void) { return 0; }
9253 #else
9254 #error "Wrong Firebird API version"
9255 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9256             CFLAGS="${__save_CFLAGS}"
9257         fi
9258         ENABLE_FIREBIRD_SDBC=TRUE
9259         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9260     elif test "$enable_database_connectivity" != yes; then
9261         AC_MSG_RESULT([none])
9262     elif test "$cross_compiling" = "yes"; then
9263         AC_MSG_RESULT([none])
9264     else
9265         dnl Embedded Firebird has version 3.0
9266         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9267         dnl We need libatomic_ops for any non X86/X64 system
9268         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9269             dnl ===================================================================
9270             dnl Check for system libatomic_ops
9271             dnl ===================================================================
9272             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9273             if test "$with_system_libatomic_ops" = "yes"; then
9274                 SYSTEM_LIBATOMIC_OPS=TRUE
9275                 AC_CHECK_HEADERS(atomic_ops.h, [],
9276                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9277             else
9278                 SYSTEM_LIBATOMIC_OPS=
9279                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9280                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9281                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9282             fi
9283         fi
9285         AC_MSG_RESULT([internal])
9286         SYSTEM_FIREBIRD=
9287         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9288         FIREBIRD_LIBS="-lfbclient"
9290         if test "$with_system_libtommath" = "yes"; then
9291             SYSTEM_LIBTOMMATH=TRUE
9292             dnl check for tommath presence
9293             save_LIBS=$LIBS
9294             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9295             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9296             LIBS=$save_LIBS
9297         else
9298             SYSTEM_LIBTOMMATH=
9299             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9300             LIBTOMMATH_LIBS="-ltommath"
9301             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9302         fi
9304         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9305         ENABLE_FIREBIRD_SDBC=TRUE
9306         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9307     fi
9309 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9310 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9311 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9312 AC_SUBST(LIBATOMIC_OPS_LIBS)
9313 AC_SUBST(SYSTEM_FIREBIRD)
9314 AC_SUBST(FIREBIRD_CFLAGS)
9315 AC_SUBST(FIREBIRD_LIBS)
9316 AC_SUBST([TOMMATH_CFLAGS])
9317 AC_SUBST([TOMMATH_LIBS])
9319 dnl ===================================================================
9320 dnl Check for system curl
9321 dnl ===================================================================
9322 AC_MSG_CHECKING([which libcurl to use])
9323 if test "$with_system_curl" = "auto"; then
9324     with_system_curl="$with_system_libs"
9327 if test "$with_system_curl" = "yes"; then
9328     AC_MSG_RESULT([external])
9329     SYSTEM_CURL=TRUE
9331     # First try PKGCONFIG and then fall back
9332     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9334     if test -n "$CURL_PKG_ERRORS"; then
9335         AC_PATH_PROG(CURLCONFIG, curl-config)
9336         if test -z "$CURLCONFIG"; then
9337             AC_MSG_ERROR([curl development files not found])
9338         fi
9339         CURL_LIBS=`$CURLCONFIG --libs`
9340         FilterLibs "${CURL_LIBS}"
9341         CURL_LIBS="${filteredlibs}"
9342         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9343         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9345         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9346         case $curl_version in
9347         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9348         dnl so they need to be doubled to end up in the configure script
9349         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9350             AC_MSG_RESULT([yes])
9351             ;;
9352         *)
9353             AC_MSG_ERROR([no, you have $curl_version])
9354             ;;
9355         esac
9356     fi
9358     ENABLE_CURL=TRUE
9359 elif test $_os = iOS; then
9360     # Let's see if we need curl, I think not?
9361     AC_MSG_RESULT([none])
9362     ENABLE_CURL=
9363 else
9364     AC_MSG_RESULT([internal])
9365     SYSTEM_CURL=
9366     BUILD_TYPE="$BUILD_TYPE CURL"
9367     ENABLE_CURL=TRUE
9369 AC_SUBST(SYSTEM_CURL)
9370 AC_SUBST(CURL_CFLAGS)
9371 AC_SUBST(CURL_LIBS)
9372 AC_SUBST(ENABLE_CURL)
9374 dnl ===================================================================
9375 dnl Check for system boost
9376 dnl ===================================================================
9377 AC_MSG_CHECKING([which boost to use])
9378 if test "$with_system_boost" = "yes"; then
9379     AC_MSG_RESULT([external])
9380     SYSTEM_BOOST=TRUE
9381     AX_BOOST_BASE(1.47)
9382     AX_BOOST_DATE_TIME
9383     AX_BOOST_FILESYSTEM
9384     AX_BOOST_IOSTREAMS
9385     AX_BOOST_LOCALE
9386     AC_LANG_PUSH([C++])
9387     save_CXXFLAGS=$CXXFLAGS
9388     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9389     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9390        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9391     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9392        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9393     CXXFLAGS=$save_CXXFLAGS
9394     AC_LANG_POP([C++])
9395     # this is in m4/ax_boost_base.m4
9396     FilterLibs "${BOOST_LDFLAGS}"
9397     BOOST_LDFLAGS="${filteredlibs}"
9398 else
9399     AC_MSG_RESULT([internal])
9400     BUILD_TYPE="$BUILD_TYPE BOOST"
9401     SYSTEM_BOOST=
9402     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9403         # use warning-suppressing wrapper headers
9404         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9405     else
9406         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9407     fi
9409 AC_SUBST(SYSTEM_BOOST)
9411 dnl ===================================================================
9412 dnl Check for system mdds
9413 dnl ===================================================================
9414 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9416 dnl ===================================================================
9417 dnl Check for system glm
9418 dnl ===================================================================
9419 AC_MSG_CHECKING([which glm to use])
9420 if test "$with_system_glm" = "yes"; then
9421     AC_MSG_RESULT([external])
9422     SYSTEM_GLM=TRUE
9423     AC_LANG_PUSH([C++])
9424     AC_CHECK_HEADER([glm/glm.hpp], [],
9425        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9426     AC_LANG_POP([C++])
9427 else
9428     AC_MSG_RESULT([internal])
9429     BUILD_TYPE="$BUILD_TYPE GLM"
9430     SYSTEM_GLM=
9431     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9433 AC_SUBST([GLM_CFLAGS])
9434 AC_SUBST([SYSTEM_GLM])
9436 dnl ===================================================================
9437 dnl Check for system odbc
9438 dnl ===================================================================
9439 AC_MSG_CHECKING([which odbc headers to use])
9440 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
9441     AC_MSG_RESULT([external])
9442     SYSTEM_ODBC_HEADERS=TRUE
9444     if test "$build_os" = "cygwin"; then
9445         save_CPPFLAGS=$CPPFLAGS
9446         find_winsdk
9447         PathFormat "$winsdktest"
9448         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"
9449         AC_CHECK_HEADER(sqlext.h, [],
9450             [AC_MSG_ERROR(odbc not found. install odbc)],
9451             [#include <windows.h>])
9452         CPPFLAGS=$save_CPPFLAGS
9453     else
9454         AC_CHECK_HEADER(sqlext.h, [],
9455             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9456     fi
9457 elif test "$enable_database_connectivity" != yes; then
9458     AC_MSG_RESULT([none])
9459 else
9460     AC_MSG_RESULT([internal])
9461     SYSTEM_ODBC_HEADERS=
9463 AC_SUBST(SYSTEM_ODBC_HEADERS)
9465 dnl ===================================================================
9466 dnl Enable LDAP support
9467 dnl ===================================================================
9469 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9470 AC_MSG_CHECKING([whether to enable LDAP support])
9471     if test "$enable_ldap" != "yes"; then
9472         AC_MSG_RESULT([no])
9473         ENABLE_LDAP=""
9474         enable_ldap=no
9475     else
9476         AC_MSG_RESULT([yes])
9477         ENABLE_LDAP="TRUE"
9478         AC_DEFINE(HAVE_FEATURE_LDAP)
9479     fi
9481 AC_SUBST(ENABLE_LDAP)
9483 dnl ===================================================================
9484 dnl Check for system openldap
9485 dnl ===================================================================
9487 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9488 AC_MSG_CHECKING([which openldap library to use])
9489 if test "$with_system_openldap" = "yes"; then
9490     AC_MSG_RESULT([external])
9491     SYSTEM_OPENLDAP=TRUE
9492     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9493     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9494     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9495 else
9496     AC_MSG_RESULT([internal])
9497     SYSTEM_OPENLDAP=
9498     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9501 AC_SUBST(SYSTEM_OPENLDAP)
9503 dnl ===================================================================
9504 dnl Check for system NSS
9505 dnl ===================================================================
9506 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9507     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9508     AC_DEFINE(HAVE_FEATURE_NSS)
9509     ENABLE_NSS="TRUE"
9510     AC_DEFINE(ENABLE_NSS)
9511 elif test $_os != iOS ; then
9512     with_tls=openssl
9514 AC_SUBST(ENABLE_NSS)
9516 dnl ===================================================================
9517 dnl Check for TLS/SSL and cryptographic implementation to use
9518 dnl ===================================================================
9519 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9520 if test -n "$with_tls"; then
9521     case $with_tls in
9522     openssl)
9523         AC_DEFINE(USE_TLS_OPENSSL)
9524         TLS=OPENSSL
9526         if test "$enable_openssl" != "yes"; then
9527             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9528         fi
9530         # warn that OpenSSL has been selected but not all TLS code has this option
9531         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9532         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9533         ;;
9534     nss)
9535         AC_DEFINE(USE_TLS_NSS)
9536         TLS=NSS
9537         ;;
9538     no)
9539         AC_MSG_WARN([Skipping TLS/SSL])
9540         ;;
9541     *)
9542         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9543 openssl - OpenSSL
9544 nss - Mozilla's Network Security Services (NSS)
9545     ])
9546         ;;
9547     esac
9548 else
9549     # default to using NSS, it results in smaller oox lib
9550     AC_DEFINE(USE_TLS_NSS)
9551     TLS=NSS
9553 AC_MSG_RESULT([$TLS])
9554 AC_SUBST(TLS)
9556 dnl ===================================================================
9557 dnl Check for system sane
9558 dnl ===================================================================
9559 AC_MSG_CHECKING([which sane header to use])
9560 if test "$with_system_sane" = "yes"; then
9561     AC_MSG_RESULT([external])
9562     AC_CHECK_HEADER(sane/sane.h, [],
9563       [AC_MSG_ERROR(sane not found. install sane)], [])
9564 else
9565     AC_MSG_RESULT([internal])
9566     BUILD_TYPE="$BUILD_TYPE SANE"
9569 dnl ===================================================================
9570 dnl Check for system icu
9571 dnl ===================================================================
9572 SYSTEM_GENBRK=
9573 SYSTEM_GENCCODE=
9574 SYSTEM_GENCMN=
9576 ICU_MAJOR=65
9577 ICU_MINOR=1
9578 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9579 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9580 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9581 AC_MSG_CHECKING([which icu to use])
9582 if test "$with_system_icu" = "yes"; then
9583     AC_MSG_RESULT([external])
9584     SYSTEM_ICU=TRUE
9585     AC_LANG_PUSH([C++])
9586     AC_MSG_CHECKING([for unicode/rbbi.h])
9587     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9588     AC_LANG_POP([C++])
9590     if test "$cross_compiling" != "yes"; then
9591         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9592         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9593         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9594         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9595     fi
9597     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9598         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9599         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9600         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9601         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9602         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9603             AC_MSG_RESULT([yes])
9604         else
9605             AC_MSG_RESULT([no])
9606             if test "$with_system_icu_for_build" != "force"; then
9607                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9608 You can use --with-system-icu-for-build=force to use it anyway.])
9609             fi
9610         fi
9611     fi
9613     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9614         # using the system icu tools can lead to version confusion, use the
9615         # ones from the build environment when cross-compiling
9616         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9617         if test -z "$SYSTEM_GENBRK"; then
9618             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9619         fi
9620         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9621         if test -z "$SYSTEM_GENCCODE"; then
9622             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9623         fi
9624         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9625         if test -z "$SYSTEM_GENCMN"; then
9626             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9627         fi
9628         if test "$ICU_MAJOR" -ge "49"; then
9629             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9630             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9631             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9632         else
9633             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9634             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9635             ICU_RECLASSIFIED_HEBREW_LETTER=
9636         fi
9637     fi
9639     if test "$cross_compiling" = "yes"; then
9640         if test "$ICU_MAJOR" -ge "50"; then
9641             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9642             ICU_MINOR=""
9643         fi
9644     fi
9645 else
9646     AC_MSG_RESULT([internal])
9647     SYSTEM_ICU=
9648     BUILD_TYPE="$BUILD_TYPE ICU"
9649     # surprisingly set these only for "internal" (to be used by various other
9650     # external libs): the system icu-config is quite unhelpful and spits out
9651     # dozens of weird flags and also default path -I/usr/include
9652     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9653     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9655 if test "$ICU_MAJOR" -ge "59"; then
9656     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9657     # with -std=c++11 but not all external libraries can be built with that,
9658     # for those use a bit-compatible typedef uint16_t UChar; see
9659     # icu/source/common/unicode/umachine.h
9660     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9661 else
9662     ICU_UCHAR_TYPE=""
9664 AC_SUBST(SYSTEM_ICU)
9665 AC_SUBST(SYSTEM_GENBRK)
9666 AC_SUBST(SYSTEM_GENCCODE)
9667 AC_SUBST(SYSTEM_GENCMN)
9668 AC_SUBST(ICU_MAJOR)
9669 AC_SUBST(ICU_MINOR)
9670 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9671 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9672 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9673 AC_SUBST(ICU_CFLAGS)
9674 AC_SUBST(ICU_LIBS)
9675 AC_SUBST(ICU_UCHAR_TYPE)
9677 dnl ==================================================================
9678 dnl Breakpad
9679 dnl ==================================================================
9680 DEFAULT_CRASHDUMP_VALUE="true"
9681 AC_MSG_CHECKING([whether to enable breakpad])
9682 if test "$enable_breakpad" != yes; then
9683     AC_MSG_RESULT([no])
9684 else
9685     AC_MSG_RESULT([yes])
9686     ENABLE_BREAKPAD="TRUE"
9687     AC_DEFINE(ENABLE_BREAKPAD)
9688     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9689     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9691     AC_MSG_CHECKING([for disable crash dump])
9692     if test "$enable_crashdump" = no; then
9693         DEFAULT_CRASHDUMP_VALUE="false"
9694         AC_MSG_RESULT([yes])
9695     else
9696        AC_MSG_RESULT([no])
9697     fi
9699     AC_MSG_CHECKING([for crashreport config])
9700     if test "$with_symbol_config" = "no"; then
9701         BREAKPAD_SYMBOL_CONFIG="invalid"
9702         AC_MSG_RESULT([no])
9703     else
9704         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9705         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9706         AC_MSG_RESULT([yes])
9707     fi
9708     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9710 AC_SUBST(ENABLE_BREAKPAD)
9711 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9713 dnl ==================================================================
9714 dnl libfuzzer
9715 dnl ==================================================================
9716 AC_MSG_CHECKING([whether to enable fuzzers])
9717 if test "$enable_fuzzers" != yes; then
9718     AC_MSG_RESULT([no])
9719 else
9720     AC_MSG_RESULT([yes])
9721     ENABLE_FUZZERS="TRUE"
9722     AC_DEFINE([ENABLE_FUZZERS],1)
9723     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9725 AC_SUBST(ENABLE_FUZZERS)
9727 dnl ===================================================================
9728 dnl Orcus
9729 dnl ===================================================================
9730 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9731 if test "$with_system_orcus" != "yes"; then
9732     if test "$SYSTEM_BOOST" = "TRUE"; then
9733         # ===========================================================
9734         # Determine if we are going to need to link with Boost.System
9735         # ===========================================================
9736         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9737         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9738         dnl in documentation has no effect.
9739         AC_MSG_CHECKING([if we need to link with Boost.System])
9740         AC_LANG_PUSH([C++])
9741         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9742                 @%:@include <boost/version.hpp>
9743             ]],[[
9744                 #if BOOST_VERSION >= 105000
9745                 #   error yes, we need to link with Boost.System
9746                 #endif
9747             ]])],[
9748                 AC_MSG_RESULT([no])
9749             ],[
9750                 AC_MSG_RESULT([yes])
9751                 AX_BOOST_SYSTEM
9752         ])
9753         AC_LANG_POP([C++])
9754     fi
9756 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9757 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9758 AC_SUBST([BOOST_SYSTEM_LIB])
9759 AC_SUBST(SYSTEM_LIBORCUS)
9761 dnl ===================================================================
9762 dnl HarfBuzz
9763 dnl ===================================================================
9764 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9765                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9766                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9768 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9769                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9770                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9772 if test "$COM" = "MSC"; then # override the above
9773     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9774     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9777 if test "$with_system_harfbuzz" = "yes"; then
9778     if test "$with_system_graphite" = "no"; then
9779         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9780     fi
9781     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9782     _save_libs="$LIBS"
9783     _save_cflags="$CFLAGS"
9784     LIBS="$LIBS $HARFBUZZ_LIBS"
9785     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9786     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9787     LIBS="$_save_libs"
9788     CFLAGS="$_save_cflags"
9789 else
9790     if test "$with_system_graphite" = "yes"; then
9791         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9792     fi
9795 AC_MSG_CHECKING([whether to use X11])
9796 dnl ***************************************
9797 dnl testing for X libraries and includes...
9798 dnl ***************************************
9799 if test "$USING_X11" = TRUE; then
9800     AC_DEFINE(HAVE_FEATURE_X11)
9802 AC_MSG_RESULT([$USING_X11])
9804 if test "$USING_X11" = TRUE; then
9805     AC_PATH_X
9806     AC_PATH_XTRA
9807     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9809     if test -z "$x_includes"; then
9810         x_includes="default_x_includes"
9811     fi
9812     if test -z "$x_libraries"; then
9813         x_libraries="default_x_libraries"
9814     fi
9815     CFLAGS="$CFLAGS $X_CFLAGS"
9816     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9817     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9818 else
9819     x_includes="no_x_includes"
9820     x_libraries="no_x_libraries"
9823 if test "$USING_X11" = TRUE; then
9824     dnl ===================================================================
9825     dnl Check for extension headers
9826     dnl ===================================================================
9827     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9828      [#include <X11/extensions/shape.h>])
9830     # vcl needs ICE and SM
9831     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9832     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9833         [AC_MSG_ERROR(ICE library not found)])
9834     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9835     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9836         [AC_MSG_ERROR(SM library not found)])
9839 dnl ===================================================================
9840 dnl Check for system Xrender
9841 dnl ===================================================================
9842 AC_MSG_CHECKING([whether to use Xrender])
9843 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9844     AC_MSG_RESULT([yes])
9845     PKG_CHECK_MODULES(XRENDER, xrender)
9846     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9847     FilterLibs "${XRENDER_LIBS}"
9848     XRENDER_LIBS="${filteredlibs}"
9849     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9850       [AC_MSG_ERROR(libXrender not found or functional)], [])
9851     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9852       [AC_MSG_ERROR(Xrender not found. install X)], [])
9853 else
9854     AC_MSG_RESULT([no])
9856 AC_SUBST(XRENDER_CFLAGS)
9857 AC_SUBST(XRENDER_LIBS)
9859 dnl ===================================================================
9860 dnl Check for XRandr
9861 dnl ===================================================================
9862 AC_MSG_CHECKING([whether to enable RandR support])
9863 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9864     AC_MSG_RESULT([yes])
9865     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9866     if test "$ENABLE_RANDR" != "TRUE"; then
9867         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9868                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9869         XRANDR_CFLAGS=" "
9870         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9871           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9872         XRANDR_LIBS="-lXrandr "
9873         ENABLE_RANDR="TRUE"
9874     fi
9875     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9876     FilterLibs "${XRANDR_LIBS}"
9877     XRANDR_LIBS="${filteredlibs}"
9878 else
9879     ENABLE_RANDR=""
9880     AC_MSG_RESULT([no])
9882 AC_SUBST(XRANDR_CFLAGS)
9883 AC_SUBST(XRANDR_LIBS)
9884 AC_SUBST(ENABLE_RANDR)
9886 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9887     WITH_WEBDAV="serf"
9889 if test $_os = iOS -o $_os = Android; then
9890     WITH_WEBDAV="no"
9892 AC_MSG_CHECKING([for webdav library])
9893 case "$WITH_WEBDAV" in
9894 serf)
9895     AC_MSG_RESULT([serf])
9896     # Check for system apr-util
9897     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9898                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9899                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9900     if test "$COM" = "MSC"; then
9901         APR_LIB_DIR="LibR"
9902         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9903         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9904     fi
9906     # Check for system serf
9907     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9908                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9909     if test "$COM" = "MSC"; then
9910         SERF_LIB_DIR="Release"
9911         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9912         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9913     fi
9914     ;;
9915 neon)
9916     AC_MSG_RESULT([neon])
9917     # Check for system neon
9918     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9919     if test "$with_system_neon" = "yes"; then
9920         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9921     else
9922         NEON_VERSION=0295
9923     fi
9924     AC_SUBST(NEON_VERSION)
9925     ;;
9927     AC_MSG_RESULT([none, disabled])
9928     WITH_WEBDAV=""
9929     ;;
9930 esac
9931 AC_SUBST(WITH_WEBDAV)
9933 dnl ===================================================================
9934 dnl Check for disabling cve_tests
9935 dnl ===================================================================
9936 AC_MSG_CHECKING([whether to execute CVE tests])
9937 # If not explicitly enabled or disabled, default
9938 if test -z "$enable_cve_tests"; then
9939     case "$OS" in
9940     WNT)
9941         # Default cves off for Windows with its wild and wonderful
9942         # variety of AV software kicking in and panicking
9943         enable_cve_tests=no
9944         ;;
9945     *)
9946         # otherwise yes
9947         enable_cve_tests=yes
9948         ;;
9949     esac
9951 if test "$enable_cve_tests" = "no"; then
9952     AC_MSG_RESULT([no])
9953     DISABLE_CVE_TESTS=TRUE
9954     AC_SUBST(DISABLE_CVE_TESTS)
9955 else
9956     AC_MSG_RESULT([yes])
9959 dnl ===================================================================
9960 dnl Check for enabling chart XShape tests
9961 dnl ===================================================================
9962 AC_MSG_CHECKING([whether to execute chart XShape tests])
9963 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9964     AC_MSG_RESULT([yes])
9965     ENABLE_CHART_TESTS=TRUE
9966     AC_SUBST(ENABLE_CHART_TESTS)
9967 else
9968     AC_MSG_RESULT([no])
9971 dnl ===================================================================
9972 dnl Check for system openssl
9973 dnl ===================================================================
9974 DISABLE_OPENSSL=
9975 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9976 if test "$enable_openssl" = "yes"; then
9977     AC_MSG_RESULT([no])
9978     if test "$_os" = Darwin ; then
9979         # OpenSSL is deprecated when building for 10.7 or later.
9980         #
9981         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9982         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9984         with_system_openssl=no
9985         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9986     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9987             && test "$with_system_openssl" != "no"; then
9988         with_system_openssl=yes
9989         SYSTEM_OPENSSL=TRUE
9990         OPENSSL_CFLAGS=
9991         OPENSSL_LIBS="-lssl -lcrypto"
9992     else
9993         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9994     fi
9995     if test "$with_system_openssl" = "yes"; then
9996         AC_MSG_CHECKING([whether openssl supports SHA512])
9997         AC_LANG_PUSH([C])
9998         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9999             SHA512_CTX context;
10000 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10001         AC_LANG_POP(C)
10002     fi
10003 else
10004     AC_MSG_RESULT([yes])
10005     DISABLE_OPENSSL=TRUE
10007     # warn that although OpenSSL is disabled, system libraries may depend on it
10008     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10009     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10012 AC_SUBST([DISABLE_OPENSSL])
10014 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10015     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10016         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10017         enable_cipher_openssl_backend=no
10018     else
10019         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10020     fi
10022 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10023 ENABLE_CIPHER_OPENSSL_BACKEND=
10024 if test "$enable_cipher_openssl_backend" = yes; then
10025     AC_MSG_RESULT([yes])
10026     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10027 else
10028     AC_MSG_RESULT([no])
10030 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10032 dnl ===================================================================
10033 dnl Check for building gnutls
10034 dnl ===================================================================
10035 AC_MSG_CHECKING([whether to use gnutls])
10036 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10037     AC_MSG_RESULT([yes])
10038     AM_PATH_LIBGCRYPT()
10039     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10040         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10041                       available in the system to use as replacement.]]))
10042     FilterLibs "${LIBGCRYPT_LIBS}"
10043     LIBGCRYPT_LIBS="${filteredlibs}"
10044 else
10045     AC_MSG_RESULT([no])
10048 AC_SUBST([LIBGCRYPT_CFLAGS])
10049 AC_SUBST([LIBGCRYPT_LIBS])
10051 dnl ===================================================================
10052 dnl Check for system redland
10053 dnl ===================================================================
10054 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10055 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10056 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10057 if test "$with_system_redland" = "yes"; then
10058     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10059             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10060 else
10061     RAPTOR_MAJOR="0"
10062     RASQAL_MAJOR="3"
10063     REDLAND_MAJOR="0"
10065 AC_SUBST(RAPTOR_MAJOR)
10066 AC_SUBST(RASQAL_MAJOR)
10067 AC_SUBST(REDLAND_MAJOR)
10069 dnl ===================================================================
10070 dnl Check for system hunspell
10071 dnl ===================================================================
10072 AC_MSG_CHECKING([which libhunspell to use])
10073 if test "$_os" = iOS; then
10074    AC_MSG_RESULT([none])
10075 elif test "$with_system_hunspell" = "yes"; then
10076     AC_MSG_RESULT([external])
10077     SYSTEM_HUNSPELL=TRUE
10078     AC_LANG_PUSH([C++])
10079     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10080     if test "$HUNSPELL_PC" != "TRUE"; then
10081         AC_CHECK_HEADER(hunspell.hxx, [],
10082             [
10083             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10084             [AC_MSG_ERROR(hunspell headers not found.)], [])
10085             ], [])
10086         AC_CHECK_LIB([hunspell], [main], [:],
10087            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10088         HUNSPELL_LIBS=-lhunspell
10089     fi
10090     AC_LANG_POP([C++])
10091     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10092     FilterLibs "${HUNSPELL_LIBS}"
10093     HUNSPELL_LIBS="${filteredlibs}"
10094 else
10095     AC_MSG_RESULT([internal])
10096     SYSTEM_HUNSPELL=
10097     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10098     if test "$COM" = "MSC"; then
10099         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10100     else
10101         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10102     fi
10103     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10105 AC_SUBST(SYSTEM_HUNSPELL)
10106 AC_SUBST(HUNSPELL_CFLAGS)
10107 AC_SUBST(HUNSPELL_LIBS)
10109 dnl ===================================================================
10110 dnl Check for system qrcodegen
10111 dnl ===================================================================
10112 AC_MSG_CHECKING([which libqrcodegen to use])
10113 if test "$with_system_qrcodegen" = "yes"; then
10114     AC_MSG_RESULT([external])
10115     SYSTEM_QRCODEGEN=TRUE
10116     AC_LANG_PUSH([C++])
10117     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10118         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10119     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10120         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10121     QRCODEGEN_LIBS=-lqrcodegencpp
10122     AC_LANG_POP([C++])
10123     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10124     FilterLibs "${QRCODEGEN_LIBS}"
10125     QRCODEGEN_LIBS="${filteredlibs}"
10126 else
10127     AC_MSG_RESULT([internal])
10128     SYSTEM_QRCODEGEN=
10129     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10131 AC_SUBST(SYSTEM_QRCODEGEN)
10132 AC_SUBST(QRCODEGEN_CFLAGS)
10133 AC_SUBST(QRCODEGEN_LIBS)
10135 dnl ===================================================================
10136 dnl Checking for altlinuxhyph
10137 dnl ===================================================================
10138 AC_MSG_CHECKING([which altlinuxhyph to use])
10139 if test "$with_system_altlinuxhyph" = "yes"; then
10140     AC_MSG_RESULT([external])
10141     SYSTEM_HYPH=TRUE
10142     AC_CHECK_HEADER(hyphen.h, [],
10143        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10144     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10145        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10146        [#include <hyphen.h>])
10147     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10148         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10149     if test -z "$HYPHEN_LIB"; then
10150         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10151            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10152     fi
10153     if test -z "$HYPHEN_LIB"; then
10154         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10155            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10156     fi
10157 else
10158     AC_MSG_RESULT([internal])
10159     SYSTEM_HYPH=
10160     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10161     if test "$COM" = "MSC"; then
10162         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10163     else
10164         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10165     fi
10167 AC_SUBST(SYSTEM_HYPH)
10168 AC_SUBST(HYPHEN_LIB)
10170 dnl ===================================================================
10171 dnl Checking for mythes
10172 dnl ===================================================================
10173 AC_MSG_CHECKING([which mythes to use])
10174 if test "$_os" = iOS; then
10175    AC_MSG_RESULT([none])
10176 elif test "$with_system_mythes" = "yes"; then
10177     AC_MSG_RESULT([external])
10178     SYSTEM_MYTHES=TRUE
10179     AC_LANG_PUSH([C++])
10180     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10181     if test "$MYTHES_PKGCONFIG" = "no"; then
10182         AC_CHECK_HEADER(mythes.hxx, [],
10183             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10184         AC_CHECK_LIB([mythes-1.2], [main], [:],
10185             [ MYTHES_FOUND=no], [])
10186     if test "$MYTHES_FOUND" = "no"; then
10187         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10188                 [ MYTHES_FOUND=no], [])
10189     fi
10190     if test "$MYTHES_FOUND" = "no"; then
10191         AC_MSG_ERROR([mythes library not found!.])
10192     fi
10193     fi
10194     AC_LANG_POP([C++])
10195     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10196     FilterLibs "${MYTHES_LIBS}"
10197     MYTHES_LIBS="${filteredlibs}"
10198 else
10199     AC_MSG_RESULT([internal])
10200     SYSTEM_MYTHES=
10201     BUILD_TYPE="$BUILD_TYPE MYTHES"
10202     if test "$COM" = "MSC"; then
10203         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10204     else
10205         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10206     fi
10208 AC_SUBST(SYSTEM_MYTHES)
10209 AC_SUBST(MYTHES_CFLAGS)
10210 AC_SUBST(MYTHES_LIBS)
10212 dnl ===================================================================
10213 dnl How should we build the linear programming solver ?
10214 dnl ===================================================================
10216 ENABLE_COINMP=
10217 AC_MSG_CHECKING([whether to build with CoinMP])
10218 if test "$enable_coinmp" != "no"; then
10219     ENABLE_COINMP=TRUE
10220     AC_MSG_RESULT([yes])
10221     if test "$with_system_coinmp" = "yes"; then
10222         SYSTEM_COINMP=TRUE
10223         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10224         FilterLibs "${COINMP_LIBS}"
10225         COINMP_LIBS="${filteredlibs}"
10226     else
10227         BUILD_TYPE="$BUILD_TYPE COINMP"
10228     fi
10229 else
10230     AC_MSG_RESULT([no])
10232 AC_SUBST(ENABLE_COINMP)
10233 AC_SUBST(SYSTEM_COINMP)
10234 AC_SUBST(COINMP_CFLAGS)
10235 AC_SUBST(COINMP_LIBS)
10237 ENABLE_LPSOLVE=
10238 AC_MSG_CHECKING([whether to build with lpsolve])
10239 if test "$enable_lpsolve" != "no"; then
10240     ENABLE_LPSOLVE=TRUE
10241     AC_MSG_RESULT([yes])
10242 else
10243     AC_MSG_RESULT([no])
10245 AC_SUBST(ENABLE_LPSOLVE)
10247 if test "$ENABLE_LPSOLVE" = TRUE; then
10248     AC_MSG_CHECKING([which lpsolve to use])
10249     if test "$with_system_lpsolve" = "yes"; then
10250         AC_MSG_RESULT([external])
10251         SYSTEM_LPSOLVE=TRUE
10252         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10253            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10254         save_LIBS=$LIBS
10255         # some systems need this. Like Ubuntu...
10256         AC_CHECK_LIB(m, floor)
10257         AC_CHECK_LIB(dl, dlopen)
10258         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10259             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10260         LIBS=$save_LIBS
10261     else
10262         AC_MSG_RESULT([internal])
10263         SYSTEM_LPSOLVE=
10264         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10265     fi
10267 AC_SUBST(SYSTEM_LPSOLVE)
10269 dnl ===================================================================
10270 dnl Checking for libexttextcat
10271 dnl ===================================================================
10272 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10273 if test "$with_system_libexttextcat" = "yes"; then
10274     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10276 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10278 dnl ===================================================================
10279 dnl Checking for libnumbertext
10280 dnl ===================================================================
10281 AC_MSG_CHECKING([whether to use libnumbertext])
10282 if test "$enable_libnumbertext" = "no"; then
10283     AC_MSG_RESULT([no])
10284     ENABLE_LIBNUMBERTEXT=
10285     SYSTEM_LIBNUMBERTEXT=
10286 else
10287     AC_MSG_RESULT([yes])
10288     ENABLE_LIBNUMBERTEXT=TRUE
10289     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10290     if test "$with_system_libnumbertext" = "yes"; then
10291         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10292         SYSTEM_LIBNUMBERTEXT=YES
10293     else
10294         SYSTEM_LIBNUMBERTEXT=
10295         AC_LANG_PUSH([C++])
10296         save_CPPFLAGS=$CPPFLAGS
10297         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10298         AC_CHECK_HEADERS([codecvt regex])
10299         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10300                 [ ENABLE_LIBNUMBERTEXT=''
10301                   LIBNUMBERTEXT_CFLAGS=''
10302                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10303                                Enable libnumbertext fallback (missing number to number name conversion).])
10304                 ])
10305         CPPFLAGS=$save_CPPFLAGS
10306         AC_LANG_POP([C++])
10307     fi
10308     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10309         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10310     fi
10312 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10313 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10314 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10315 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10317 dnl ***************************************
10318 dnl testing libc version for Linux...
10319 dnl ***************************************
10320 if test "$_os" = "Linux"; then
10321     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10322     exec 6>/dev/null # no output
10323     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10324     exec 6>&1 # output on again
10325     if test "$HAVE_LIBC"; then
10326         AC_MSG_RESULT([yes])
10327     else
10328         AC_MSG_ERROR([no, upgrade libc])
10329     fi
10332 dnl =========================================
10333 dnl Check for uuidgen
10334 dnl =========================================
10335 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10336     # presence is already tested above in the WINDOWS_SDK_HOME check
10337     UUIDGEN=uuidgen.exe
10338     AC_SUBST(UUIDGEN)
10339 else
10340     AC_PATH_PROG([UUIDGEN], [uuidgen])
10341     if test -z "$UUIDGEN"; then
10342         AC_MSG_WARN([uuid is needed for building installation sets])
10343     fi
10346 dnl ***************************************
10347 dnl Checking for bison and flex
10348 dnl ***************************************
10349 AC_PATH_PROG(BISON, bison)
10350 if test -z "$BISON"; then
10351     AC_MSG_ERROR([no bison found in \$PATH, install it])
10352 else
10353     AC_MSG_CHECKING([the bison version])
10354     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10355     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10356     # Accept newer than 2.0
10357     if test "$_bison_longver" -lt 2000; then
10358         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10359     fi
10362 AC_PATH_PROG(FLEX, flex)
10363 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10364     FLEX=`cygpath -m $FLEX`
10366 if test -z "$FLEX"; then
10367     AC_MSG_ERROR([no flex found in \$PATH, install it])
10368 else
10369     AC_MSG_CHECKING([the flex version])
10370     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10371     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10372         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10373     fi
10375 AC_SUBST([FLEX])
10376 dnl ***************************************
10377 dnl Checking for patch
10378 dnl ***************************************
10379 AC_PATH_PROG(PATCH, patch)
10380 if test -z "$PATCH"; then
10381     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10384 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10385 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10386     if test -z "$with_gnu_patch"; then
10387         GNUPATCH=$PATCH
10388     else
10389         if test -x "$with_gnu_patch"; then
10390             GNUPATCH=$with_gnu_patch
10391         else
10392             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10393         fi
10394     fi
10396     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10397     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10398         AC_MSG_RESULT([yes])
10399     else
10400         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10401     fi
10402 else
10403     GNUPATCH=$PATCH
10406 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10407     GNUPATCH=`cygpath -m $GNUPATCH`
10410 dnl We also need to check for --with-gnu-cp
10412 if test -z "$with_gnu_cp"; then
10413     # check the place where the good stuff is hidden on Solaris...
10414     if test -x /usr/gnu/bin/cp; then
10415         GNUCP=/usr/gnu/bin/cp
10416     else
10417         AC_PATH_PROGS(GNUCP, gnucp cp)
10418     fi
10419     if test -z $GNUCP; then
10420         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10421     fi
10422 else
10423     if test -x "$with_gnu_cp"; then
10424         GNUCP=$with_gnu_cp
10425     else
10426         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10427     fi
10430 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10431     GNUCP=`cygpath -m $GNUCP`
10434 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10435 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10436     AC_MSG_RESULT([yes])
10437 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10438     AC_MSG_RESULT([yes])
10439 else
10440     case "$build_os" in
10441     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10442         x_GNUCP=[\#]
10443         GNUCP=''
10444         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10445         ;;
10446     *)
10447         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10448         ;;
10449     esac
10452 AC_SUBST(GNUPATCH)
10453 AC_SUBST(GNUCP)
10454 AC_SUBST(x_GNUCP)
10456 dnl ***************************************
10457 dnl testing assembler path
10458 dnl ***************************************
10459 ML_EXE=""
10460 if test "$_os" = "WINNT"; then
10461     if test "$BITNESS_OVERRIDE" = ""; then
10462         assembler=ml.exe
10463     else
10464         assembler=ml64.exe
10465     fi
10467     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10468     if test -f "$CL_PATH/$assembler"; then
10469         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10470         AC_MSG_RESULT([$ML_EXE])
10471     else
10472         AC_MSG_ERROR([not found])
10473     fi
10476 AC_SUBST(ML_EXE)
10478 dnl ===================================================================
10479 dnl We need zip and unzip
10480 dnl ===================================================================
10481 AC_PATH_PROG(ZIP, zip)
10482 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10483 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10484     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],,)
10487 AC_PATH_PROG(UNZIP, unzip)
10488 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10490 dnl ===================================================================
10491 dnl Zip must be a specific type for different build types.
10492 dnl ===================================================================
10493 if test $build_os = cygwin; then
10494     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10495         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10496     fi
10499 dnl ===================================================================
10500 dnl We need touch with -h option support.
10501 dnl ===================================================================
10502 AC_PATH_PROG(TOUCH, touch)
10503 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10504 touch warn
10505 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10506     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],,)
10509 dnl ===================================================================
10510 dnl Check for system epoxy
10511 dnl ===================================================================
10512 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10514 dnl ===================================================================
10515 dnl Set vcl option: coordinate device in double or sal_Int32
10516 dnl ===================================================================
10518 dnl disabled for now, we don't want subtle differences between OSs
10519 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10520 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10521 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10522 dnl     AC_MSG_RESULT([double])
10523 dnl else
10524 dnl     AC_MSG_RESULT([sal_Int32])
10525 dnl fi
10527 dnl ===================================================================
10528 dnl Test which vclplugs have to be built.
10529 dnl ===================================================================
10530 R=""
10531 if test "$USING_X11" != TRUE; then
10532     enable_gtk3=no
10534 GTK3_CFLAGS=""
10535 GTK3_LIBS=""
10536 ENABLE_GTK3=""
10537 if test "x$enable_gtk3" = "xyes"; then
10538     if test "$with_system_cairo" = no; then
10539         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10540     fi
10541     : ${with_system_cairo:=yes}
10542     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="")
10543     if test "x$ENABLE_GTK3" = "xTRUE"; then
10544         AC_DEFINE(ENABLE_GTK3)
10545         R="gtk3"
10546     else
10547         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10548     fi
10549     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10550     FilterLibs "${GTK3_LIBS}"
10551     GTK3_LIBS="${filteredlibs}"
10553     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10554     if test "$with_system_epoxy" != "yes"; then
10555         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10556         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10557                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10558     fi
10560 AC_SUBST(GTK3_LIBS)
10561 AC_SUBST(GTK3_CFLAGS)
10562 AC_SUBST(ENABLE_GTK3)
10564 if test "$enable_introspection" = yes; then
10565     if test "$ENABLE_GTK3" = TRUE; then
10566         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10567     else
10568         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10569     fi
10572 ENABLE_QT5=""
10573 if test "x$enable_qt5" = "xyes"; then
10574     ENABLE_QT5="TRUE"
10575     AC_DEFINE(ENABLE_QT5)
10576     R="$R qt5"
10578 AC_SUBST(ENABLE_QT5)
10580 ENABLE_KF5=""
10581 if test "x$enable_kf5" = "xyes"; then
10582     ENABLE_KF5="TRUE"
10583     AC_DEFINE(ENABLE_KF5)
10584     R="$R kf5"
10586 AC_SUBST(ENABLE_KF5)
10588 ENABLE_GTK3_KDE5=""
10589 if test "x$enable_gtk3_kde5" = "xyes"; then
10590     ENABLE_GTK3_KDE5="TRUE"
10591     AC_DEFINE(ENABLE_GTK3_KDE5)
10592     R="$R gtk3_kde5"
10594 AC_SUBST(ENABLE_GTK3_KDE5)
10596 if test "$_os" = "WINNT"; then
10597     R="$R win"
10598 elif test "$_os" = "Darwin"; then
10599     R="$R osx"
10600 elif test "$_os" = "iOS"; then
10601     R="ios (builtin)"
10604 build_vcl_plugins="$R"
10605 if test -z "$build_vcl_plugins"; then
10606     build_vcl_plugins="none"
10608 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10610 dnl ===================================================================
10611 dnl check for dbus support
10612 dnl ===================================================================
10613 ENABLE_DBUS=""
10614 DBUS_CFLAGS=""
10615 DBUS_LIBS=""
10616 DBUS_GLIB_CFLAGS=""
10617 DBUS_GLIB_LIBS=""
10618 DBUS_HAVE_GLIB=""
10620 if test "$enable_dbus" = "no"; then
10621     test_dbus=no
10624 AC_MSG_CHECKING([whether to enable DBUS support])
10625 if test "$test_dbus" = "yes"; then
10626     ENABLE_DBUS="TRUE"
10627     AC_MSG_RESULT([yes])
10628     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10629     AC_DEFINE(ENABLE_DBUS)
10630     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10631     FilterLibs "${DBUS_LIBS}"
10632     DBUS_LIBS="${filteredlibs}"
10634     # Glib is needed for BluetoothServer
10635     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10636     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10637         [
10638             DBUS_HAVE_GLIB="TRUE"
10639             AC_DEFINE(DBUS_HAVE_GLIB,1)
10640         ],
10641         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10642     )
10643 else
10644     AC_MSG_RESULT([no])
10647 AC_SUBST(ENABLE_DBUS)
10648 AC_SUBST(DBUS_CFLAGS)
10649 AC_SUBST(DBUS_LIBS)
10650 AC_SUBST(DBUS_GLIB_CFLAGS)
10651 AC_SUBST(DBUS_GLIB_LIBS)
10652 AC_SUBST(DBUS_HAVE_GLIB)
10654 AC_MSG_CHECKING([whether to enable Impress remote control])
10655 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10656     AC_MSG_RESULT([yes])
10657     ENABLE_SDREMOTE=TRUE
10658     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10660     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10661         # The Bluetooth code doesn't compile with macOS SDK 10.15
10662         enable_sdremote_bluetooth=no
10663     fi
10664     # If not explicitly enabled or disabled, default
10665     if test -z "$enable_sdremote_bluetooth"; then
10666         case "$OS" in
10667         LINUX|MACOSX|WNT)
10668             # Default to yes for these
10669             enable_sdremote_bluetooth=yes
10670             ;;
10671         *)
10672             # otherwise no
10673             enable_sdremote_bluetooth=no
10674             ;;
10675         esac
10676     fi
10677     # $enable_sdremote_bluetooth is guaranteed non-empty now
10679     if test "$enable_sdremote_bluetooth" != "no"; then
10680         if test "$OS" = "LINUX"; then
10681             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10682                 AC_MSG_RESULT([yes])
10683                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10684                 dnl ===================================================================
10685                 dnl Check for system bluez
10686                 dnl ===================================================================
10687                 AC_MSG_CHECKING([which Bluetooth header to use])
10688                 if test "$with_system_bluez" = "yes"; then
10689                     AC_MSG_RESULT([external])
10690                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10691                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10692                     SYSTEM_BLUEZ=TRUE
10693                 else
10694                     AC_MSG_RESULT([internal])
10695                     SYSTEM_BLUEZ=
10696                 fi
10697             else
10698                 AC_MSG_RESULT([no, dbus disabled])
10699                 ENABLE_SDREMOTE_BLUETOOTH=
10700                 SYSTEM_BLUEZ=
10701             fi
10702         else
10703             AC_MSG_RESULT([yes])
10704             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10705             SYSTEM_BLUEZ=
10706         fi
10707     else
10708         AC_MSG_RESULT([no])
10709         ENABLE_SDREMOTE_BLUETOOTH=
10710         SYSTEM_BLUEZ=
10711     fi
10712 else
10713     ENABLE_SDREMOTE=
10714     SYSTEM_BLUEZ=
10715     AC_MSG_RESULT([no])
10717 AC_SUBST(ENABLE_SDREMOTE)
10718 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10719 AC_SUBST(SYSTEM_BLUEZ)
10721 dnl ===================================================================
10722 dnl Check whether to enable GIO support
10723 dnl ===================================================================
10724 if test "$ENABLE_GTK3" = "TRUE"; then
10725     AC_MSG_CHECKING([whether to enable GIO support])
10726     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10727         dnl Need at least 2.26 for the dbus support.
10728         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10729                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10730         if test "$ENABLE_GIO" = "TRUE"; then
10731             AC_DEFINE(ENABLE_GIO)
10732             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10733             FilterLibs "${GIO_LIBS}"
10734             GIO_LIBS="${filteredlibs}"
10735         fi
10736     else
10737         AC_MSG_RESULT([no])
10738     fi
10740 AC_SUBST(ENABLE_GIO)
10741 AC_SUBST(GIO_CFLAGS)
10742 AC_SUBST(GIO_LIBS)
10745 dnl ===================================================================
10747 SPLIT_APP_MODULES=""
10748 if test "$enable_split_app_modules" = "yes"; then
10749     SPLIT_APP_MODULES="TRUE"
10751 AC_SUBST(SPLIT_APP_MODULES)
10753 SPLIT_OPT_FEATURES=""
10754 if test "$enable_split_opt_features" = "yes"; then
10755     SPLIT_OPT_FEATURES="TRUE"
10757 AC_SUBST(SPLIT_OPT_FEATURES)
10759 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10760     if test "$enable_cairo_canvas" = yes; then
10761         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10762     fi
10763     enable_cairo_canvas=no
10764 elif test -z "$enable_cairo_canvas"; then
10765     enable_cairo_canvas=yes
10768 ENABLE_CAIRO_CANVAS=""
10769 if test "$enable_cairo_canvas" = "yes"; then
10770     test_cairo=yes
10771     ENABLE_CAIRO_CANVAS="TRUE"
10772     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10774 AC_SUBST(ENABLE_CAIRO_CANVAS)
10776 dnl ===================================================================
10777 dnl Check whether the GStreamer libraries are available.
10778 dnl ===================================================================
10780 ENABLE_GSTREAMER_1_0=""
10782 if test "$build_gstreamer_1_0" = "yes"; then
10784     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10785     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10786         ENABLE_GSTREAMER_1_0="TRUE"
10787         AC_MSG_RESULT([yes])
10788         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10789         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10790         FilterLibs "${GSTREAMER_1_0_LIBS}"
10791         GSTREAMER_1_0_LIBS="${filteredlibs}"
10792         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10793     else
10794         AC_MSG_RESULT([no])
10795     fi
10797 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10798 AC_SUBST(GSTREAMER_1_0_LIBS)
10799 AC_SUBST(ENABLE_GSTREAMER_1_0)
10801 dnl ===================================================================
10802 dnl Check whether to build the VLC avmedia backend
10803 dnl ===================================================================
10805 ENABLE_VLC=""
10807 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10808 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10809     ENABLE_VLC="TRUE"
10810     AC_MSG_RESULT([yes])
10811 else
10812     AC_MSG_RESULT([no])
10814 AC_SUBST(ENABLE_VLC)
10816 ENABLE_OPENGL_TRANSITIONS=
10817 ENABLE_OPENGL_CANVAS=
10818 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10819    : # disable
10820 elif test "$_os" = "Darwin"; then
10821     # We use frameworks on macOS, no need for detail checks
10822     ENABLE_OPENGL_TRANSITIONS=TRUE
10823     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10824     ENABLE_OPENGL_CANVAS=TRUE
10825 elif test $_os = WINNT; then
10826     ENABLE_OPENGL_TRANSITIONS=TRUE
10827     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10828     ENABLE_OPENGL_CANVAS=TRUE
10829 else
10830     if test "$USING_X11" = TRUE; then
10831         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10832         ENABLE_OPENGL_TRANSITIONS=TRUE
10833         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10834         ENABLE_OPENGL_CANVAS=TRUE
10835     fi
10838 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10839 AC_SUBST(ENABLE_OPENGL_CANVAS)
10841 dnl =================================================
10842 dnl Check whether to build with OpenCL support.
10843 dnl =================================================
10845 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10846     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10847     # platform (optional at run-time, used through clew).
10848     BUILD_TYPE="$BUILD_TYPE OPENCL"
10849     AC_DEFINE(HAVE_FEATURE_OPENCL)
10852 dnl =================================================
10853 dnl Check whether to build with dconf support.
10854 dnl =================================================
10856 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10857     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10858         if test "$enable_dconf" = yes; then
10859             AC_MSG_ERROR([dconf not found])
10860         else
10861             enable_dconf=no
10862         fi])
10864 AC_MSG_CHECKING([whether to enable dconf])
10865 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10866     DCONF_CFLAGS=
10867     DCONF_LIBS=
10868     ENABLE_DCONF=
10869     AC_MSG_RESULT([no])
10870 else
10871     ENABLE_DCONF=TRUE
10872     AC_DEFINE(ENABLE_DCONF)
10873     AC_MSG_RESULT([yes])
10875 AC_SUBST([DCONF_CFLAGS])
10876 AC_SUBST([DCONF_LIBS])
10877 AC_SUBST([ENABLE_DCONF])
10879 # pdf import?
10880 AC_MSG_CHECKING([whether to build the PDF import feature])
10881 ENABLE_PDFIMPORT=
10882 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10883     AC_MSG_RESULT([yes])
10884     ENABLE_PDFIMPORT=TRUE
10885     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10886 else
10887     AC_MSG_RESULT([no])
10890 # Pdfium?
10891 AC_MSG_CHECKING([whether to build PDFium])
10892 ENABLE_PDFIUM=
10893 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10894     AC_MSG_RESULT([yes])
10895     ENABLE_PDFIUM=TRUE
10896     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10897     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10898 else
10899     AC_MSG_RESULT([no])
10901 AC_SUBST(ENABLE_PDFIUM)
10903 dnl ===================================================================
10904 dnl Check for poppler
10905 dnl ===================================================================
10906 ENABLE_POPPLER=
10907 AC_MSG_CHECKING([whether to build Poppler])
10908 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
10909     AC_MSG_RESULT([yes])
10910     ENABLE_POPPLER=TRUE
10911     AC_DEFINE(HAVE_FEATURE_POPPLER)
10912 else
10913     AC_MSG_RESULT([no])
10915 AC_SUBST(ENABLE_POPPLER)
10917 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10918     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10921 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
10922     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10925 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
10926     dnl ===================================================================
10927     dnl Check for system poppler
10928     dnl ===================================================================
10929     AC_MSG_CHECKING([which PDF import poppler to use])
10930     if test "$with_system_poppler" = "yes"; then
10931         AC_MSG_RESULT([external])
10932         SYSTEM_POPPLER=TRUE
10933         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10934         AC_LANG_PUSH([C++])
10935         save_CXXFLAGS=$CXXFLAGS
10936         save_CPPFLAGS=$CPPFLAGS
10937         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10938         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10939         AC_CHECK_HEADER([cpp/poppler-version.h],
10940             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10941             [])
10942         CXXFLAGS=$save_CXXFLAGS
10943         CPPFLAGS=$save_CPPFLAGS
10944         AC_LANG_POP([C++])
10945         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10947         FilterLibs "${POPPLER_LIBS}"
10948         POPPLER_LIBS="${filteredlibs}"
10949     else
10950         AC_MSG_RESULT([internal])
10951         SYSTEM_POPPLER=
10952         BUILD_TYPE="$BUILD_TYPE POPPLER"
10953         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10954     fi
10955     AC_DEFINE([ENABLE_PDFIMPORT],1)
10957 AC_SUBST(ENABLE_PDFIMPORT)
10958 AC_SUBST(SYSTEM_POPPLER)
10959 AC_SUBST(POPPLER_CFLAGS)
10960 AC_SUBST(POPPLER_LIBS)
10962 SYSTEM_GPGMEPP=
10964 if test "$build_for_ios" = "YES"; then
10965     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10966     AC_MSG_RESULT([yes])
10967 elif test "$enable_mpl_subset" = "yes"; then
10968     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10969     AC_MSG_RESULT([yes])
10970 elif test "$enable_fuzzers" = "yes"; then
10971     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10972     AC_MSG_RESULT([yes])
10973 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10974     dnl ===================================================================
10975     dnl Check for system gpgme
10976     dnl ===================================================================
10977     AC_MSG_CHECKING([which gpgmepp to use])
10978     if test "$with_system_gpgmepp" = "yes"; then
10979         AC_MSG_RESULT([external])
10980         SYSTEM_GPGMEPP=TRUE
10982         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10983         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10984             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10985         # progress_callback is the only func with plain C linkage
10986         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10987         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10988             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10989         AC_CHECK_HEADER(gpgme.h, [],
10990             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10991     else
10992         AC_MSG_RESULT([internal])
10993         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10994         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10996         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10997         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10998         if test "$_os" != "WINNT"; then
10999             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11000             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11001         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11002             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11003         fi
11004     fi
11005     ENABLE_GPGMEPP=TRUE
11006     AC_DEFINE([HAVE_FEATURE_GPGME])
11007     AC_PATH_PROG(GPG, gpg)
11008     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11009     # so let's exclude that manually for the moment
11010     if test -n "$GPG" -a "$_os" != "WINNT"; then
11011         # make sure we not only have a working gpgme, but a full working
11012         # gpg installation to run OpenPGP signature verification
11013         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11014     fi
11015     if test "$_os" = "Linux"; then
11016       uid=`id -u`
11017       AC_MSG_CHECKING([for /run/user/$uid])
11018       if test -d /run/user/$uid; then
11019         AC_MSG_RESULT([yes])
11020         AC_PATH_PROG(GPGCONF, gpgconf)
11022         # Older versions of gpgconf are not working as expected, since
11023         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11024         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11025         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11026         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11027         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11028         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11029         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11030           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11031           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11032           if $GPGCONF --dump-options > /dev/null ; then
11033             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11034               AC_MSG_RESULT([yes])
11035               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11036               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11037             else
11038               AC_MSG_RESULT([no])
11039             fi
11040           else
11041             AC_MSG_RESULT([no. missing or broken gpgconf?])
11042           fi
11043         else
11044           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11045         fi
11046       else
11047         AC_MSG_RESULT([no])
11048      fi
11049    fi
11051 AC_SUBST(ENABLE_GPGMEPP)
11052 AC_SUBST(SYSTEM_GPGMEPP)
11053 AC_SUBST(GPG_ERROR_CFLAGS)
11054 AC_SUBST(GPG_ERROR_LIBS)
11055 AC_SUBST(LIBASSUAN_CFLAGS)
11056 AC_SUBST(LIBASSUAN_LIBS)
11057 AC_SUBST(GPGMEPP_CFLAGS)
11058 AC_SUBST(GPGMEPP_LIBS)
11060 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11061 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11062     AC_MSG_RESULT([yes])
11063     ENABLE_MEDIAWIKI=TRUE
11064     BUILD_TYPE="$BUILD_TYPE XSLTML"
11065     if test  "x$with_java" = "xno"; then
11066         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11067     fi
11068 else
11069     AC_MSG_RESULT([no])
11070     ENABLE_MEDIAWIKI=
11071     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11073 AC_SUBST(ENABLE_MEDIAWIKI)
11075 AC_MSG_CHECKING([whether to build the Report Builder])
11076 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11077     AC_MSG_RESULT([yes])
11078     ENABLE_REPORTBUILDER=TRUE
11079     AC_MSG_CHECKING([which jfreereport libs to use])
11080     if test "$with_system_jfreereport" = "yes"; then
11081         SYSTEM_JFREEREPORT=TRUE
11082         AC_MSG_RESULT([external])
11083         if test -z $SAC_JAR; then
11084             SAC_JAR=/usr/share/java/sac.jar
11085         fi
11086         if ! test -f $SAC_JAR; then
11087              AC_MSG_ERROR(sac.jar not found.)
11088         fi
11090         if test -z $LIBXML_JAR; then
11091             if test -f /usr/share/java/libxml-1.0.0.jar; then
11092                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11093             elif test -f /usr/share/java/libxml.jar; then
11094                 LIBXML_JAR=/usr/share/java/libxml.jar
11095             else
11096                 AC_MSG_ERROR(libxml.jar replacement not found.)
11097             fi
11098         elif ! test -f $LIBXML_JAR; then
11099             AC_MSG_ERROR(libxml.jar not found.)
11100         fi
11102         if test -z $FLUTE_JAR; then
11103             if test -f/usr/share/java/flute-1.3.0.jar; then
11104                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11105             elif test -f /usr/share/java/flute.jar; then
11106                 FLUTE_JAR=/usr/share/java/flute.jar
11107             else
11108                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11109             fi
11110         elif ! test -f $FLUTE_JAR; then
11111             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11112         fi
11114         if test -z $JFREEREPORT_JAR; then
11115             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11116                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11117             elif test -f /usr/share/java/flow-engine.jar; then
11118                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11119             else
11120                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11121             fi
11122         elif ! test -f  $JFREEREPORT_JAR; then
11123                 AC_MSG_ERROR(jfreereport.jar not found.)
11124         fi
11126         if test -z $LIBLAYOUT_JAR; then
11127             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11128                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11129             elif test -f /usr/share/java/liblayout.jar; then
11130                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11131             else
11132                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11133             fi
11134         elif ! test -f $LIBLAYOUT_JAR; then
11135                 AC_MSG_ERROR(liblayout.jar not found.)
11136         fi
11138         if test -z $LIBLOADER_JAR; then
11139             if test -f /usr/share/java/libloader-1.0.0.jar; then
11140                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11141             elif test -f /usr/share/java/libloader.jar; then
11142                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11143             else
11144                 AC_MSG_ERROR(libloader.jar replacement not found.)
11145             fi
11146         elif ! test -f  $LIBLOADER_JAR; then
11147             AC_MSG_ERROR(libloader.jar not found.)
11148         fi
11150         if test -z $LIBFORMULA_JAR; then
11151             if test -f /usr/share/java/libformula-0.2.0.jar; then
11152                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11153             elif test -f /usr/share/java/libformula.jar; then
11154                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11155             else
11156                 AC_MSG_ERROR(libformula.jar replacement not found.)
11157             fi
11158         elif ! test -f $LIBFORMULA_JAR; then
11159                 AC_MSG_ERROR(libformula.jar not found.)
11160         fi
11162         if test -z $LIBREPOSITORY_JAR; then
11163             if test -f /usr/share/java/librepository-1.0.0.jar; then
11164                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11165             elif test -f /usr/share/java/librepository.jar; then
11166                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11167             else
11168                 AC_MSG_ERROR(librepository.jar replacement not found.)
11169             fi
11170         elif ! test -f $LIBREPOSITORY_JAR; then
11171             AC_MSG_ERROR(librepository.jar not found.)
11172         fi
11174         if test -z $LIBFONTS_JAR; then
11175             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11176                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11177             elif test -f /usr/share/java/libfonts.jar; then
11178                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11179             else
11180                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11181             fi
11182         elif ! test -f $LIBFONTS_JAR; then
11183                 AC_MSG_ERROR(libfonts.jar not found.)
11184         fi
11186         if test -z $LIBSERIALIZER_JAR; then
11187             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11188                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11189             elif test -f /usr/share/java/libserializer.jar; then
11190                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11191             else
11192                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11193             fi
11194         elif ! test -f $LIBSERIALIZER_JAR; then
11195                 AC_MSG_ERROR(libserializer.jar not found.)
11196         fi
11198         if test -z $LIBBASE_JAR; then
11199             if test -f /usr/share/java/libbase-1.0.0.jar; then
11200                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11201             elif test -f /usr/share/java/libbase.jar; then
11202                 LIBBASE_JAR=/usr/share/java/libbase.jar
11203             else
11204                 AC_MSG_ERROR(libbase.jar replacement not found.)
11205             fi
11206         elif ! test -f $LIBBASE_JAR; then
11207             AC_MSG_ERROR(libbase.jar not found.)
11208         fi
11210     else
11211         AC_MSG_RESULT([internal])
11212         SYSTEM_JFREEREPORT=
11213         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11214         NEED_ANT=TRUE
11215     fi
11216 else
11217     AC_MSG_RESULT([no])
11218     ENABLE_REPORTBUILDER=
11219     SYSTEM_JFREEREPORT=
11221 AC_SUBST(ENABLE_REPORTBUILDER)
11222 AC_SUBST(SYSTEM_JFREEREPORT)
11223 AC_SUBST(SAC_JAR)
11224 AC_SUBST(LIBXML_JAR)
11225 AC_SUBST(FLUTE_JAR)
11226 AC_SUBST(JFREEREPORT_JAR)
11227 AC_SUBST(LIBBASE_JAR)
11228 AC_SUBST(LIBLAYOUT_JAR)
11229 AC_SUBST(LIBLOADER_JAR)
11230 AC_SUBST(LIBFORMULA_JAR)
11231 AC_SUBST(LIBREPOSITORY_JAR)
11232 AC_SUBST(LIBFONTS_JAR)
11233 AC_SUBST(LIBSERIALIZER_JAR)
11235 # this has to be here because both the Wiki Publisher and the SRB use
11236 # commons-logging
11237 COMMONS_LOGGING_VERSION=1.2
11238 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11239     AC_MSG_CHECKING([which Apache commons-* libs to use])
11240     if test "$with_system_apache_commons" = "yes"; then
11241         SYSTEM_APACHE_COMMONS=TRUE
11242         AC_MSG_RESULT([external])
11243         if test -z $COMMONS_LOGGING_JAR; then
11244             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11245                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11246            elif test -f /usr/share/java/commons-logging.jar; then
11247                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11248             else
11249                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11250             fi
11251         elif ! test -f $COMMONS_LOGGING_JAR; then
11252             AC_MSG_ERROR(commons-logging.jar not found.)
11253         fi
11254     else
11255         AC_MSG_RESULT([internal])
11256         SYSTEM_APACHE_COMMONS=
11257         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11258         NEED_ANT=TRUE
11259     fi
11261 AC_SUBST(SYSTEM_APACHE_COMMONS)
11262 AC_SUBST(COMMONS_LOGGING_JAR)
11263 AC_SUBST(COMMONS_LOGGING_VERSION)
11265 # scripting provider for BeanShell?
11266 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11267 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11268     AC_MSG_RESULT([yes])
11269     ENABLE_SCRIPTING_BEANSHELL=TRUE
11271     dnl ===================================================================
11272     dnl Check for system beanshell
11273     dnl ===================================================================
11274     AC_MSG_CHECKING([which beanshell to use])
11275     if test "$with_system_beanshell" = "yes"; then
11276         AC_MSG_RESULT([external])
11277         SYSTEM_BSH=TRUE
11278         if test -z $BSH_JAR; then
11279             BSH_JAR=/usr/share/java/bsh.jar
11280         fi
11281         if ! test -f $BSH_JAR; then
11282             AC_MSG_ERROR(bsh.jar not found.)
11283         fi
11284     else
11285         AC_MSG_RESULT([internal])
11286         SYSTEM_BSH=
11287         BUILD_TYPE="$BUILD_TYPE BSH"
11288     fi
11289 else
11290     AC_MSG_RESULT([no])
11291     ENABLE_SCRIPTING_BEANSHELL=
11292     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11294 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11295 AC_SUBST(SYSTEM_BSH)
11296 AC_SUBST(BSH_JAR)
11298 # scripting provider for JavaScript?
11299 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11300 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11301     AC_MSG_RESULT([yes])
11302     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11304     dnl ===================================================================
11305     dnl Check for system rhino
11306     dnl ===================================================================
11307     AC_MSG_CHECKING([which rhino to use])
11308     if test "$with_system_rhino" = "yes"; then
11309         AC_MSG_RESULT([external])
11310         SYSTEM_RHINO=TRUE
11311         if test -z $RHINO_JAR; then
11312             RHINO_JAR=/usr/share/java/js.jar
11313         fi
11314         if ! test -f $RHINO_JAR; then
11315             AC_MSG_ERROR(js.jar not found.)
11316         fi
11317     else
11318         AC_MSG_RESULT([internal])
11319         SYSTEM_RHINO=
11320         BUILD_TYPE="$BUILD_TYPE RHINO"
11321         NEED_ANT=TRUE
11322     fi
11323 else
11324     AC_MSG_RESULT([no])
11325     ENABLE_SCRIPTING_JAVASCRIPT=
11326     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11328 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11329 AC_SUBST(SYSTEM_RHINO)
11330 AC_SUBST(RHINO_JAR)
11332 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11333 # paths should be added to library search path. So lets put all 64-bit
11334 # platforms there.
11335 supports_multilib=
11336 case "$host_cpu" in
11337 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11338     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11339         supports_multilib="yes"
11340     fi
11341     ;;
11343     ;;
11344 esac
11346 dnl ===================================================================
11347 dnl QT5 Integration
11348 dnl ===================================================================
11350 QT5_CFLAGS=""
11351 QT5_LIBS=""
11352 QMAKE5="qmake"
11353 MOC5="moc"
11354 QT5_GOBJECT_CFLAGS=""
11355 QT5_GOBJECT_LIBS=""
11356 QT5_HAVE_GOBJECT=""
11357 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11358         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11359         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11360 then
11361     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11362     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11364     if test -n "$supports_multilib"; then
11365         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11366     fi
11368     qt5_test_include="QtWidgets/qapplication.h"
11369     qt5_test_library="libQt5Widgets.so"
11371     dnl Check for qmake5
11372     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11373     if test "$QMAKE5" = "no"; then
11374         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11375     else
11376         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11377         if test -z "$qmake5_test_ver"; then
11378             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11379         fi
11380         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11381         qt5_minimal_minor="6"
11382         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11383             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11384         else
11385             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11386         fi
11387     fi
11389     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11390     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11392     AC_MSG_CHECKING([for Qt5 headers])
11393     qt5_incdir="no"
11394     for inc_dir in $qt5_incdirs; do
11395         if test -r "$inc_dir/$qt5_test_include"; then
11396             qt5_incdir="$inc_dir"
11397             break
11398         fi
11399     done
11400     AC_MSG_RESULT([$qt5_incdir])
11401     if test "x$qt5_incdir" = "xno"; then
11402         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11403     fi
11405     AC_MSG_CHECKING([for Qt5 libraries])
11406     qt5_libdir="no"
11407     for lib_dir in $qt5_libdirs; do
11408         if test -r "$lib_dir/$qt5_test_library"; then
11409             qt5_libdir="$lib_dir"
11410             break
11411         fi
11412     done
11413     AC_MSG_RESULT([$qt5_libdir])
11414     if test "x$qt5_libdir" = "xno"; then
11415         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11416     fi
11418     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11419     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11420     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11422     if test "$USING_X11" = TRUE; then
11423         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11424         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11425             QT5_HAVE_XCB_ICCCM=1
11426             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11427         ],[
11428             AC_MSG_WARN([XCB ICCCM not found, which is needed for old Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)])
11429             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11430         ])
11431         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11432         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11433         QT5_USING_X11=1
11434         AC_DEFINE(QT5_USING_X11)
11435     fi
11437     dnl Check for Meta Object Compiler
11439     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11440     if test "$MOC5" = "no"; then
11441         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11442 the root of your Qt installation by exporting QT5DIR before running "configure".])
11443     fi
11445     if test "$build_gstreamer_1_0" = "yes"; then
11446         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11447                 QT5_HAVE_GOBJECT=1
11448                 AC_DEFINE(QT5_HAVE_GOBJECT)
11449             ],
11450             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11451         )
11452     fi
11454 AC_SUBST(QT5_CFLAGS)
11455 AC_SUBST(QT5_LIBS)
11456 AC_SUBST(MOC5)
11457 AC_SUBST(QT5_GOBJECT_CFLAGS)
11458 AC_SUBST(QT5_GOBJECT_LIBS)
11459 AC_SUBST(QT5_HAVE_GOBJECT)
11461 dnl ===================================================================
11462 dnl KF5 Integration
11463 dnl ===================================================================
11465 KF5_CFLAGS=""
11466 KF5_LIBS=""
11467 KF5_CONFIG="kf5-config"
11468 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11469         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11470 then
11471     if test "$OS" = "HAIKU"; then
11472         haiku_arch="`echo $RTL_ARCH | tr X x`"
11473         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11474         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11475     fi
11477     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11478     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11479     if test -n "$supports_multilib"; then
11480         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11481     fi
11483     kf5_test_include="KF5/kcoreaddons_version.h"
11484     kf5_test_library="libKF5CoreAddons.so"
11485     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11487     dnl kf5 KDE4 support compatibility installed
11488     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11489     if test "$KF5_CONFIG" != "no"; then
11490         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11491         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11492     fi
11494     dnl Check for KF5 headers
11495     AC_MSG_CHECKING([for KF5 headers])
11496     kf5_incdir="no"
11497     for kf5_check in $kf5_incdirs; do
11498         if test -r "$kf5_check/$kf5_test_include"; then
11499             kf5_incdir="$kf5_check/KF5"
11500             break
11501         fi
11502     done
11503     AC_MSG_RESULT([$kf5_incdir])
11504     if test "x$kf5_incdir" = "xno"; then
11505         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11506     fi
11508     dnl Check for KF5 libraries
11509     AC_MSG_CHECKING([for KF5 libraries])
11510     kf5_libdir="no"
11511     for kf5_check in $kf5_libdirs; do
11512         if test -r "$kf5_check/$kf5_test_library"; then
11513             kf5_libdir="$kf5_check"
11514             break
11515         fi
11516     done
11518     AC_MSG_RESULT([$kf5_libdir])
11519     if test "x$kf5_libdir" = "xno"; then
11520         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11521     fi
11523     KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$kf5_incdir/KIOWidgets -I$kf5_incdir/KIOFileWidgets -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11524     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11525     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11527     if test "$USING_X11" = TRUE; then
11528         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11529     fi
11531     AC_LANG_PUSH([C++])
11532     save_CXXFLAGS=$CXXFLAGS
11533     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11534     AC_MSG_CHECKING([whether KDE is >= 5.0])
11535        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11536 #include <kcoreaddons_version.h>
11538 int main(int argc, char **argv) {
11539        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11540        else return 1;
11542        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11543     CXXFLAGS=$save_CXXFLAGS
11544     AC_LANG_POP([C++])
11546 AC_SUBST(KF5_CFLAGS)
11547 AC_SUBST(KF5_LIBS)
11549 dnl ===================================================================
11550 dnl Test whether to include Evolution 2 support
11551 dnl ===================================================================
11552 AC_MSG_CHECKING([whether to enable evolution 2 support])
11553 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11554     AC_MSG_RESULT([yes])
11555     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11556     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11557     FilterLibs "${GOBJECT_LIBS}"
11558     GOBJECT_LIBS="${filteredlibs}"
11559     ENABLE_EVOAB2="TRUE"
11560 else
11561     ENABLE_EVOAB2=""
11562     AC_MSG_RESULT([no])
11564 AC_SUBST(ENABLE_EVOAB2)
11565 AC_SUBST(GOBJECT_CFLAGS)
11566 AC_SUBST(GOBJECT_LIBS)
11568 dnl ===================================================================
11569 dnl Test which themes to include
11570 dnl ===================================================================
11571 AC_MSG_CHECKING([which themes to include])
11572 # if none given use default subset of available themes
11573 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11574     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg tango"
11577 WITH_THEMES=""
11578 if test "x$with_theme" != "xno"; then
11579     for theme in $with_theme; do
11580         case $theme in
11581         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|tango) real_theme="$theme" ;;
11582         default) real_theme=colibre ;;
11583         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11584         esac
11585         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11586     done
11588 AC_MSG_RESULT([$WITH_THEMES])
11589 AC_SUBST([WITH_THEMES])
11590 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11591 for theme in $with_theme; do
11592     case $theme in
11593     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11594     *) ;;
11595     esac
11596 done
11598 dnl ===================================================================
11599 dnl Test whether to integrate helppacks into the product's installer
11600 dnl ===================================================================
11601 AC_MSG_CHECKING([for helppack integration])
11602 if test "$with_helppack_integration" = "no"; then
11603     AC_MSG_RESULT([no integration])
11604 else
11605     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11606     AC_MSG_RESULT([integration])
11609 ###############################################################################
11610 # Extensions checking
11611 ###############################################################################
11612 AC_MSG_CHECKING([for extensions integration])
11613 if test "x$enable_extension_integration" != "xno"; then
11614     WITH_EXTENSION_INTEGRATION=TRUE
11615     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11616     AC_MSG_RESULT([yes, use integration])
11617 else
11618     WITH_EXTENSION_INTEGRATION=
11619     AC_MSG_RESULT([no, do not integrate])
11621 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11623 dnl Should any extra extensions be included?
11624 dnl There are standalone tests for each of these below.
11625 WITH_EXTRA_EXTENSIONS=
11626 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11628 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11629 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11630 if test "x$with_java" != "xno"; then
11631     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11632     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11635 AC_MSG_CHECKING([whether to build opens___.ttf])
11636 if test "$enable_build_opensymbol" = "yes"; then
11637     AC_MSG_RESULT([yes])
11638     AC_PATH_PROG(FONTFORGE, fontforge)
11639     if test -z "$FONTFORGE"; then
11640         AC_MSG_ERROR([fontforge not installed])
11641     fi
11642 else
11643     AC_MSG_RESULT([no])
11644     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11645     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11647 AC_SUBST(OPENSYMBOL_TTF)
11648 AC_SUBST(FONTFORGE)
11650 dnl ===================================================================
11651 dnl Test whether to include fonts
11652 dnl ===================================================================
11653 AC_MSG_CHECKING([whether to include third-party fonts])
11654 if test "$with_fonts" != "no"; then
11655     AC_MSG_RESULT([yes])
11656     WITH_FONTS=TRUE
11657     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11658     AC_DEFINE(HAVE_MORE_FONTS)
11659 else
11660     AC_MSG_RESULT([no])
11661     WITH_FONTS=
11662     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11664 AC_SUBST(WITH_FONTS)
11666 dnl Test whether to include more Google Noto fonts
11667 dnl ===================================================================
11668 AC_MSG_CHECKING([whether to include more Google Noto fonts])
11669 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11670     AC_MSG_RESULT([no])
11671     WITH_NOTO_FONT=
11672 else
11673     AC_MSG_RESULT([yes])
11674     WITH_NOTO_FONT=TRUE
11675     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11676     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11678 AC_SUBST(WITH_NOTO_FONT)
11680 dnl ===================================================================
11681 dnl Test whether to enable online update service
11682 dnl ===================================================================
11683 AC_MSG_CHECKING([whether to enable online update])
11684 ENABLE_ONLINE_UPDATE=
11685 ENABLE_ONLINE_UPDATE_MAR=
11686 UPDATE_CONFIG=
11687 if test "$enable_online_update" = ""; then
11688     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11689         AC_MSG_RESULT([yes])
11690         ENABLE_ONLINE_UPDATE="TRUE"
11691     else
11692         AC_MSG_RESULT([no])
11693     fi
11694 else
11695     if test "$enable_online_update" = "mar"; then
11696         AC_MSG_RESULT([yes - MAR-based online update])
11697         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11698         if test "$with_update_config" = ""; then
11699             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11700         fi
11701         UPDATE_CONFIG="$with_update_config"
11702         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11703     elif test "$enable_online_update" = "yes"; then
11704         AC_MSG_RESULT([yes])
11705         ENABLE_ONLINE_UPDATE="TRUE"
11706     else
11707         AC_MSG_RESULT([no])
11708     fi
11710 AC_SUBST(ENABLE_ONLINE_UPDATE)
11711 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11712 AC_SUBST(UPDATE_CONFIG)
11714 dnl ===================================================================
11715 dnl Test whether we need bzip2
11716 dnl ===================================================================
11717 SYSTEM_BZIP2=
11718 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11719     AC_MSG_CHECKING([whether to use system bzip2])
11720     if test "$with_system_bzip2" = yes; then
11721         SYSTEM_BZIP2=TRUE
11722         AC_MSG_RESULT([yes])
11723         PKG_CHECK_MODULES(BZIP2, bzip2)
11724         FilterLibs "${BZIP2_LIBS}"
11725         BZIP2_LIBS="${filteredlibs}"
11726     else
11727         AC_MSG_RESULT([no])
11728         BUILD_TYPE="$BUILD_TYPE BZIP2"
11729     fi
11731 AC_SUBST(SYSTEM_BZIP2)
11732 AC_SUBST(BZIP2_CFLAGS)
11733 AC_SUBST(BZIP2_LIBS)
11735 dnl ===================================================================
11736 dnl Test whether to enable extension update
11737 dnl ===================================================================
11738 AC_MSG_CHECKING([whether to enable extension update])
11739 ENABLE_EXTENSION_UPDATE=
11740 if test "x$enable_extension_update" = "xno"; then
11741     AC_MSG_RESULT([no])
11742 else
11743     AC_MSG_RESULT([yes])
11744     ENABLE_EXTENSION_UPDATE="TRUE"
11745     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11746     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11748 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11751 dnl ===================================================================
11752 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11753 dnl ===================================================================
11754 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11755 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11756     AC_MSG_RESULT([no])
11757     ENABLE_SILENT_MSI=
11758 else
11759     AC_MSG_RESULT([yes])
11760     ENABLE_SILENT_MSI=TRUE
11761     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11763 AC_SUBST(ENABLE_SILENT_MSI)
11765 AC_MSG_CHECKING([whether and how to use Xinerama])
11766 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11767     if test "$x_libraries" = "default_x_libraries"; then
11768         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11769         if test "x$XINERAMALIB" = x; then
11770            XINERAMALIB="/usr/lib"
11771         fi
11772     else
11773         XINERAMALIB="$x_libraries"
11774     fi
11775     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11776         # we have both versions, let the user decide but use the dynamic one
11777         # per default
11778         USE_XINERAMA=TRUE
11779         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11780             XINERAMA_LINK=dynamic
11781         else
11782             XINERAMA_LINK=static
11783         fi
11784     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11785         # we have only the dynamic version
11786         USE_XINERAMA=TRUE
11787         XINERAMA_LINK=dynamic
11788     elif test -e "$XINERAMALIB/libXinerama.a"; then
11789         # static version
11790         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11791             USE_XINERAMA=TRUE
11792             XINERAMA_LINK=static
11793         else
11794             USE_XINERAMA=
11795             XINERAMA_LINK=none
11796         fi
11797     else
11798         # no Xinerama
11799         USE_XINERAMA=
11800         XINERAMA_LINK=none
11801     fi
11802     if test "$USE_XINERAMA" = "TRUE"; then
11803         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11804         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11805             [AC_MSG_ERROR(Xinerama header not found.)], [])
11806         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11807         if test "x$XEXTLIB" = x; then
11808            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11809         fi
11810         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11811         if test "$_os" = "FreeBSD"; then
11812             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11813         fi
11814         if test "$_os" = "Linux"; then
11815             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11816         fi
11817         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11818             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11819     else
11820         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11821     fi
11822 else
11823     USE_XINERAMA=
11824     XINERAMA_LINK=none
11825     AC_MSG_RESULT([no])
11827 AC_SUBST(USE_XINERAMA)
11828 AC_SUBST(XINERAMA_LINK)
11830 dnl ===================================================================
11831 dnl Test whether to build cairo or rely on the system version
11832 dnl ===================================================================
11834 if test "$USING_X11" = TRUE; then
11835     # Used in vcl/Library_vclplug_gen.mk
11836     test_cairo=yes
11839 if test "$test_cairo" = "yes"; then
11840     AC_MSG_CHECKING([whether to use the system cairo])
11842     : ${with_system_cairo:=$with_system_libs}
11843     if test "$with_system_cairo" = "yes"; then
11844         SYSTEM_CAIRO=TRUE
11845         AC_MSG_RESULT([yes])
11847         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11848         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11849         FilterLibs "${CAIRO_LIBS}"
11850         CAIRO_LIBS="${filteredlibs}"
11852         if test "$test_xrender" = "yes"; then
11853             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11854             AC_LANG_PUSH([C])
11855             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11856 #ifdef PictStandardA8
11857 #else
11858       return fail;
11859 #endif
11860 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11862             AC_LANG_POP([C])
11863         fi
11864     else
11865         SYSTEM_CAIRO=
11866         AC_MSG_RESULT([no])
11868         BUILD_TYPE="$BUILD_TYPE CAIRO"
11869     fi
11872 AC_SUBST(SYSTEM_CAIRO)
11873 AC_SUBST(CAIRO_CFLAGS)
11874 AC_SUBST(CAIRO_LIBS)
11876 dnl ===================================================================
11877 dnl Test whether to use avahi
11878 dnl ===================================================================
11879 if test "$_os" = "WINNT"; then
11880     # Windows uses bundled mDNSResponder
11881     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11882 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11883     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11884                       [ENABLE_AVAHI="TRUE"])
11885     AC_DEFINE(HAVE_FEATURE_AVAHI)
11886     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11887     FilterLibs "${AVAHI_LIBS}"
11888     AVAHI_LIBS="${filteredlibs}"
11891 AC_SUBST(ENABLE_AVAHI)
11892 AC_SUBST(AVAHI_CFLAGS)
11893 AC_SUBST(AVAHI_LIBS)
11895 dnl ===================================================================
11896 dnl Test whether to use liblangtag
11897 dnl ===================================================================
11898 SYSTEM_LIBLANGTAG=
11899 AC_MSG_CHECKING([whether to use system liblangtag])
11900 if test "$with_system_liblangtag" = yes; then
11901     SYSTEM_LIBLANGTAG=TRUE
11902     AC_MSG_RESULT([yes])
11903     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11904     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11905     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11906     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11907     FilterLibs "${LIBLANGTAG_LIBS}"
11908     LIBLANGTAG_LIBS="${filteredlibs}"
11909 else
11910     SYSTEM_LIBLANGTAG=
11911     AC_MSG_RESULT([no])
11912     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11913     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11914     if test "$COM" = "MSC"; then
11915         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11916     else
11917         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11918     fi
11920 AC_SUBST(SYSTEM_LIBLANGTAG)
11921 AC_SUBST(LIBLANGTAG_CFLAGS)
11922 AC_SUBST(LIBLANGTAG_LIBS)
11924 dnl ===================================================================
11925 dnl Test whether to build libpng or rely on the system version
11926 dnl ===================================================================
11928 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11930 dnl ===================================================================
11931 dnl Check for runtime JVM search path
11932 dnl ===================================================================
11933 if test "$ENABLE_JAVA" != ""; then
11934     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11935     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11936         AC_MSG_RESULT([yes])
11937         if ! test -d "$with_jvm_path"; then
11938             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11939         fi
11940         if ! test -d "$with_jvm_path"jvm; then
11941             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11942         fi
11943         JVM_ONE_PATH_CHECK="$with_jvm_path"
11944         AC_SUBST(JVM_ONE_PATH_CHECK)
11945     else
11946         AC_MSG_RESULT([no])
11947     fi
11950 dnl ===================================================================
11951 dnl Test for the presence of Ant and that it works
11952 dnl ===================================================================
11954 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11955     ANT_HOME=; export ANT_HOME
11956     WITH_ANT_HOME=; export WITH_ANT_HOME
11957     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11958         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11959             if test "$_os" = "WINNT"; then
11960                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11961             else
11962                 with_ant_home="$LODE_HOME/opt/ant"
11963             fi
11964         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11965             with_ant_home="$LODE_HOME/opt/ant"
11966         fi
11967     fi
11968     if test -z "$with_ant_home"; then
11969         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11970     else
11971         if test "$_os" = "WINNT"; then
11972             # AC_PATH_PROGS needs unix path
11973             with_ant_home=`cygpath -u "$with_ant_home"`
11974         fi
11975         AbsolutePath "$with_ant_home"
11976         with_ant_home=$absolute_path
11977         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11978         WITH_ANT_HOME=$with_ant_home
11979         ANT_HOME=$with_ant_home
11980     fi
11982     if test -z "$ANT"; then
11983         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11984     else
11985         # resolve relative or absolute symlink
11986         while test -h "$ANT"; do
11987             a_cwd=`pwd`
11988             a_basename=`basename "$ANT"`
11989             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11990             cd "`dirname "$ANT"`"
11991             cd "`dirname "$a_script"`"
11992             ANT="`pwd`"/"`basename "$a_script"`"
11993             cd "$a_cwd"
11994         done
11996         AC_MSG_CHECKING([if $ANT works])
11997         mkdir -p conftest.dir
11998         a_cwd=$(pwd)
11999         cd conftest.dir
12000         cat > conftest.java << EOF
12001         public class conftest {
12002             int testmethod(int a, int b) {
12003                     return a + b;
12004             }
12005         }
12008         cat > conftest.xml << EOF
12009         <project name="conftest" default="conftest">
12010         <target name="conftest">
12011             <javac srcdir="." includes="conftest.java">
12012             </javac>
12013         </target>
12014         </project>
12017         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12018         if test $? = 0 -a -f ./conftest.class; then
12019             AC_MSG_RESULT([Ant works])
12020             if test -z "$WITH_ANT_HOME"; then
12021                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12022                 if test -z "$ANT_HOME"; then
12023                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12024                 fi
12025             else
12026                 ANT_HOME="$WITH_ANT_HOME"
12027             fi
12028         else
12029             echo "configure: Ant test failed" >&5
12030             cat conftest.java >&5
12031             cat conftest.xml >&5
12032             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12033         fi
12034         cd "$a_cwd"
12035         rm -fr conftest.dir
12036     fi
12037     if test -z "$ANT_HOME"; then
12038         ANT_HOME="NO_ANT_HOME"
12039     else
12040         PathFormat "$ANT_HOME"
12041         ANT_HOME="$formatted_path"
12042         PathFormat "$ANT"
12043         ANT="$formatted_path"
12044     fi
12045     AC_SUBST(ANT_HOME)
12046     AC_SUBST(ANT)
12048     dnl Checking for ant.jar
12049     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12050         AC_MSG_CHECKING([Ant lib directory])
12051         if test -f $ANT_HOME/lib/ant.jar; then
12052             ANT_LIB="$ANT_HOME/lib"
12053         else
12054             if test -f $ANT_HOME/ant.jar; then
12055                 ANT_LIB="$ANT_HOME"
12056             else
12057                 if test -f /usr/share/java/ant.jar; then
12058                     ANT_LIB=/usr/share/java
12059                 else
12060                     if test -f /usr/share/ant-core/lib/ant.jar; then
12061                         ANT_LIB=/usr/share/ant-core/lib
12062                     else
12063                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12064                             ANT_LIB="$ANT_HOME/lib/ant"
12065                         else
12066                             if test -f /usr/share/lib/ant/ant.jar; then
12067                                 ANT_LIB=/usr/share/lib/ant
12068                             else
12069                                 AC_MSG_ERROR([Ant libraries not found!])
12070                             fi
12071                         fi
12072                     fi
12073                 fi
12074             fi
12075         fi
12076         PathFormat "$ANT_LIB"
12077         ANT_LIB="$formatted_path"
12078         AC_MSG_RESULT([Ant lib directory found.])
12079     fi
12080     AC_SUBST(ANT_LIB)
12082     ant_minver=1.6.0
12083     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12085     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12086     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12087     ant_version_major=`echo $ant_version | cut -d. -f1`
12088     ant_version_minor=`echo $ant_version | cut -d. -f2`
12089     echo "configure: ant_version $ant_version " >&5
12090     echo "configure: ant_version_major $ant_version_major " >&5
12091     echo "configure: ant_version_minor $ant_version_minor " >&5
12092     if test "$ant_version_major" -ge "2"; then
12093         AC_MSG_RESULT([yes, $ant_version])
12094     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12095         AC_MSG_RESULT([yes, $ant_version])
12096     else
12097         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12098     fi
12100     rm -f conftest* core core.* *.core
12103 OOO_JUNIT_JAR=
12104 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12105     AC_MSG_CHECKING([for JUnit 4])
12106     if test "$with_junit" = "yes"; then
12107         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12108             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12109         elif test -e /usr/share/java/junit4.jar; then
12110             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12111         else
12112            if test -e /usr/share/lib/java/junit.jar; then
12113               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12114            else
12115               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12116            fi
12117         fi
12118     else
12119         OOO_JUNIT_JAR=$with_junit
12120     fi
12121     if test "$_os" = "WINNT"; then
12122         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12123     fi
12124     printf 'import org.junit.Before;' > conftest.java
12125     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12126         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12127     else
12128         AC_MSG_ERROR(
12129 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12130  specify its pathname via --with-junit=..., or disable it via --without-junit])
12131     fi
12132     rm -f conftest.class conftest.java
12133     if test $OOO_JUNIT_JAR != ""; then
12134     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12135     fi
12137 AC_SUBST(OOO_JUNIT_JAR)
12139 HAMCREST_JAR=
12140 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12141     AC_MSG_CHECKING([for included Hamcrest])
12142     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12143     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12144         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12145     else
12146         AC_MSG_RESULT([Not included])
12147         AC_MSG_CHECKING([for standalone hamcrest jar.])
12148         if test "$with_hamcrest" = "yes"; then
12149             if test -e /usr/share/lib/java/hamcrest.jar; then
12150                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12151             elif test -e /usr/share/java/hamcrest/core.jar; then
12152                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12153             else
12154                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12155             fi
12156         else
12157             HAMCREST_JAR=$with_hamcrest
12158         fi
12159         if test "$_os" = "WINNT"; then
12160             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12161         fi
12162         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12163             AC_MSG_RESULT([$HAMCREST_JAR])
12164         else
12165             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),
12166                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12167         fi
12168     fi
12169     rm -f conftest.class conftest.java
12171 AC_SUBST(HAMCREST_JAR)
12174 AC_SUBST(SCPDEFS)
12177 # check for wget and curl
12179 WGET=
12180 CURL=
12182 if test "$enable_fetch_external" != "no"; then
12184 CURL=`which curl 2>/dev/null`
12186 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12187     # wget new enough?
12188     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12189     if test $? -eq 0; then
12190         WGET=$i
12191         break
12192     fi
12193 done
12195 if test -z "$WGET" -a -z "$CURL"; then
12196     AC_MSG_ERROR([neither wget nor curl found!])
12201 AC_SUBST(WGET)
12202 AC_SUBST(CURL)
12205 # check for sha256sum
12207 SHA256SUM=
12209 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12210     eval "$i -a 256 --version" > /dev/null 2>&1
12211     ret=$?
12212     if test $ret -eq 0; then
12213         SHA256SUM="$i -a 256"
12214         break
12215     fi
12216 done
12218 if test -z "$SHA256SUM"; then
12219     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12220         eval "$i --version" > /dev/null 2>&1
12221         ret=$?
12222         if test $ret -eq 0; then
12223             SHA256SUM=$i
12224             break
12225         fi
12226     done
12229 if test -z "$SHA256SUM"; then
12230     AC_MSG_ERROR([no sha256sum found!])
12233 AC_SUBST(SHA256SUM)
12235 dnl ===================================================================
12236 dnl Dealing with l10n options
12237 dnl ===================================================================
12238 AC_MSG_CHECKING([which languages to be built])
12239 # get list of all languages
12240 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12241 # the sed command does the following:
12242 #   + if a line ends with a backslash, append the next line to it
12243 #   + adds " on the beginning of the value (after =)
12244 #   + adds " at the end of the value
12245 #   + removes en-US; we want to put it on the beginning
12246 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12247 [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)]
12248 ALL_LANGS="en-US $completelangiso"
12249 # check the configured localizations
12250 WITH_LANG="$with_lang"
12252 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12253 # (Norwegian is "nb" and "nn".)
12254 if test "$WITH_LANG" = "no"; then
12255     WITH_LANG=
12258 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12259     AC_MSG_RESULT([en-US])
12260 else
12261     AC_MSG_RESULT([$WITH_LANG])
12262     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12263     if test -z "$MSGFMT"; then
12264         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12265             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12266         elif test -x "/opt/lo/bin/msgfmt"; then
12267             MSGFMT="/opt/lo/bin/msgfmt"
12268         else
12269             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12270             if test -z "$MSGFMT"; then
12271                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12272             fi
12273         fi
12274     fi
12275     if test -z "$MSGUNIQ"; then
12276         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12277             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12278         elif test -x "/opt/lo/bin/msguniq"; then
12279             MSGUNIQ="/opt/lo/bin/msguniq"
12280         else
12281             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12282             if test -z "$MSGUNIQ"; then
12283                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12284             fi
12285         fi
12286     fi
12288 AC_SUBST(MSGFMT)
12289 AC_SUBST(MSGUNIQ)
12290 # check that the list is valid
12291 for lang in $WITH_LANG; do
12292     test "$lang" = "ALL" && continue
12293     # need to check for the exact string, so add space before and after the list of all languages
12294     for vl in $ALL_LANGS; do
12295         if test "$vl" = "$lang"; then
12296            break
12297         fi
12298     done
12299     if test "$vl" != "$lang"; then
12300         # if you're reading this - you prolly quoted your languages remove the quotes ...
12301         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12302     fi
12303 done
12304 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12305     echo $WITH_LANG | grep -q en-US
12306     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12308 # list with substituted ALL
12309 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12310 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12311 test "$WITH_LANG" = "en-US" && WITH_LANG=
12312 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12313     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12314     ALL_LANGS=`echo $ALL_LANGS qtz`
12316 AC_SUBST(ALL_LANGS)
12317 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12318 AC_SUBST(WITH_LANG)
12319 AC_SUBST(WITH_LANG_LIST)
12320 AC_SUBST(GIT_NEEDED_SUBMODULES)
12322 WITH_POOR_HELP_LOCALIZATIONS=
12323 if test -d "$SRC_ROOT/translations/source"; then
12324     for l in `ls -1 $SRC_ROOT/translations/source`; do
12325         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12326             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12327         fi
12328     done
12330 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12332 if test -n "$with_locales"; then
12333     WITH_LOCALES="$with_locales"
12335     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12336     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12337     # config_host/config_locales.h.in
12338     for locale in $WITH_LOCALES; do
12339         lang=${locale%_*}
12341         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12343         case $lang in
12344         hi|mr*ne)
12345             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12346             ;;
12347         bg|ru)
12348             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12349             ;;
12350         esac
12351     done
12352 else
12353     AC_DEFINE(WITH_LOCALE_ALL)
12355 AC_SUBST(WITH_LOCALES)
12357 dnl git submodule update --reference
12358 dnl ===================================================================
12359 if test -n "${GIT_REFERENCE_SRC}"; then
12360     for repo in ${GIT_NEEDED_SUBMODULES}; do
12361         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12362             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12363         fi
12364     done
12366 AC_SUBST(GIT_REFERENCE_SRC)
12368 dnl git submodules linked dirs
12369 dnl ===================================================================
12370 if test -n "${GIT_LINK_SRC}"; then
12371     for repo in ${GIT_NEEDED_SUBMODULES}; do
12372         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12373             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12374         fi
12375     done
12377 AC_SUBST(GIT_LINK_SRC)
12379 dnl branding
12380 dnl ===================================================================
12381 AC_MSG_CHECKING([for alternative branding images directory])
12382 # initialize mapped arrays
12383 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12384 brand_files="$BRAND_INTRO_IMAGES about.svg"
12386 if test -z "$with_branding" -o "$with_branding" = "no"; then
12387     AC_MSG_RESULT([none])
12388     DEFAULT_BRAND_IMAGES="$brand_files"
12389 else
12390     if ! test -d $with_branding ; then
12391         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12392     else
12393         AC_MSG_RESULT([$with_branding])
12394         CUSTOM_BRAND_DIR="$with_branding"
12395         for lfile in $brand_files
12396         do
12397             if ! test -f $with_branding/$lfile ; then
12398                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12399                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12400             else
12401                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12402             fi
12403         done
12404         check_for_progress="yes"
12405     fi
12407 AC_SUBST([BRAND_INTRO_IMAGES])
12408 AC_SUBST([CUSTOM_BRAND_DIR])
12409 AC_SUBST([CUSTOM_BRAND_IMAGES])
12410 AC_SUBST([DEFAULT_BRAND_IMAGES])
12413 AC_MSG_CHECKING([for 'intro' progress settings])
12414 PROGRESSBARCOLOR=
12415 PROGRESSSIZE=
12416 PROGRESSPOSITION=
12417 PROGRESSFRAMECOLOR=
12418 PROGRESSTEXTCOLOR=
12419 PROGRESSTEXTBASELINE=
12421 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12422     source "$with_branding/progress.conf"
12423     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12424 else
12425     AC_MSG_RESULT([none])
12428 AC_SUBST(PROGRESSBARCOLOR)
12429 AC_SUBST(PROGRESSSIZE)
12430 AC_SUBST(PROGRESSPOSITION)
12431 AC_SUBST(PROGRESSFRAMECOLOR)
12432 AC_SUBST(PROGRESSTEXTCOLOR)
12433 AC_SUBST(PROGRESSTEXTBASELINE)
12436 AC_MSG_CHECKING([for extra build ID])
12437 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12438     EXTRA_BUILDID="$with_extra_buildid"
12440 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12441 if test -n "$EXTRA_BUILDID" ; then
12442     AC_MSG_RESULT([$EXTRA_BUILDID])
12443 else
12444     AC_MSG_RESULT([not set])
12446 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12448 OOO_VENDOR=
12449 AC_MSG_CHECKING([for vendor])
12450 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12451     OOO_VENDOR="$USERNAME"
12453     if test -z "$OOO_VENDOR"; then
12454         OOO_VENDOR="$USER"
12455     fi
12457     if test -z "$OOO_VENDOR"; then
12458         OOO_VENDOR="`id -u -n`"
12459     fi
12461     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12462 else
12463     OOO_VENDOR="$with_vendor"
12464     AC_MSG_RESULT([$OOO_VENDOR])
12466 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12467 AC_SUBST(OOO_VENDOR)
12469 if test "$_os" = "Android" ; then
12470     ANDROID_PACKAGE_NAME=
12471     AC_MSG_CHECKING([for Android package name])
12472     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12473         if test -n "$ENABLE_DEBUG"; then
12474             # Default to the package name that makes ndk-gdb happy.
12475             ANDROID_PACKAGE_NAME="org.libreoffice"
12476         else
12477             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12478         fi
12480         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12481     else
12482         ANDROID_PACKAGE_NAME="$with_android_package_name"
12483         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12484     fi
12485     AC_SUBST(ANDROID_PACKAGE_NAME)
12488 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12489 if test "$with_compat_oowrappers" = "yes"; then
12490     WITH_COMPAT_OOWRAPPERS=TRUE
12491     AC_MSG_RESULT(yes)
12492 else
12493     WITH_COMPAT_OOWRAPPERS=
12494     AC_MSG_RESULT(no)
12496 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12498 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12499 AC_MSG_CHECKING([for install dirname])
12500 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12501     INSTALLDIRNAME="$with_install_dirname"
12503 AC_MSG_RESULT([$INSTALLDIRNAME])
12504 AC_SUBST(INSTALLDIRNAME)
12506 AC_MSG_CHECKING([for prefix])
12507 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12508 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12509 PREFIXDIR="$prefix"
12510 AC_MSG_RESULT([$PREFIXDIR])
12511 AC_SUBST(PREFIXDIR)
12513 LIBDIR=[$(eval echo $(eval echo $libdir))]
12514 AC_SUBST(LIBDIR)
12516 DATADIR=[$(eval echo $(eval echo $datadir))]
12517 AC_SUBST(DATADIR)
12519 MANDIR=[$(eval echo $(eval echo $mandir))]
12520 AC_SUBST(MANDIR)
12522 DOCDIR=[$(eval echo $(eval echo $docdir))]
12523 AC_SUBST(DOCDIR)
12525 BINDIR=[$(eval echo $(eval echo $bindir))]
12526 AC_SUBST(BINDIR)
12528 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12529 AC_SUBST(INSTALLDIR)
12531 TESTINSTALLDIR="${BUILDDIR}/test-install"
12532 AC_SUBST(TESTINSTALLDIR)
12535 # ===================================================================
12536 # OAuth2 id and secrets
12537 # ===================================================================
12539 AC_MSG_CHECKING([for Google Drive client id and secret])
12540 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12541     AC_MSG_RESULT([not set])
12542     GDRIVE_CLIENT_ID="\"\""
12543     GDRIVE_CLIENT_SECRET="\"\""
12544 else
12545     AC_MSG_RESULT([set])
12546     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12547     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12549 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12550 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12552 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12553 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12554     AC_MSG_RESULT([not set])
12555     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12556     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12557 else
12558     AC_MSG_RESULT([set])
12559     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12560     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12562 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12563 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12565 AC_MSG_CHECKING([for OneDrive client id and secret])
12566 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12567     AC_MSG_RESULT([not set])
12568     ONEDRIVE_CLIENT_ID="\"\""
12569     ONEDRIVE_CLIENT_SECRET="\"\""
12570 else
12571     AC_MSG_RESULT([set])
12572     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12573     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12575 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12576 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12579 dnl ===================================================================
12580 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12581 dnl --enable-dependency-tracking configure option
12582 dnl ===================================================================
12583 AC_MSG_CHECKING([whether to enable dependency tracking])
12584 if test "$enable_dependency_tracking" = "no"; then
12585     nodep=TRUE
12586     AC_MSG_RESULT([no])
12587 else
12588     AC_MSG_RESULT([yes])
12590 AC_SUBST(nodep)
12592 dnl ===================================================================
12593 dnl Number of CPUs to use during the build
12594 dnl ===================================================================
12595 AC_MSG_CHECKING([for number of processors to use])
12596 # plain --with-parallelism is just the default
12597 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12598     if test "$with_parallelism" = "no"; then
12599         PARALLELISM=0
12600     else
12601         PARALLELISM=$with_parallelism
12602     fi
12603 else
12604     if test "$enable_icecream" = "yes"; then
12605         PARALLELISM="40"
12606     else
12607         case `uname -s` in
12609         Darwin|FreeBSD|NetBSD|OpenBSD)
12610             PARALLELISM=`sysctl -n hw.ncpu`
12611             ;;
12613         Linux)
12614             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12615         ;;
12616         # what else than above does profit here *and* has /proc?
12617         *)
12618             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12619             ;;
12620         esac
12622         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12623         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12624     fi
12627 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12628     if test -z "$with_parallelism"; then
12629             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12630             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12631             PARALLELISM="1"
12632     else
12633         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."
12634     fi
12637 if test $PARALLELISM -eq 0; then
12638     AC_MSG_RESULT([explicit make -j option needed])
12639 else
12640     AC_MSG_RESULT([$PARALLELISM])
12642 AC_SUBST(PARALLELISM)
12644 IWYU_PATH="$with_iwyu"
12645 AC_SUBST(IWYU_PATH)
12646 if test ! -z "$IWYU_PATH"; then
12647     if test ! -f "$IWYU_PATH"; then
12648         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12649     fi
12653 # Set up ILIB for MSVC build
12655 ILIB1=
12656 if test "$build_os" = "cygwin"; then
12657     ILIB="."
12658     if test -n "$JAVA_HOME"; then
12659         ILIB="$ILIB;$JAVA_HOME/lib"
12660     fi
12661     ILIB1=-link
12662     if test "$BITNESS_OVERRIDE" = 64; then
12663         ILIB="$ILIB;$COMPATH/lib/x64"
12664         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12665         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12666         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12667         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12668             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12669             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12670         fi
12671         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12672         ucrtlibpath_formatted=$formatted_path
12673         ILIB="$ILIB;$ucrtlibpath_formatted"
12674         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12675     else
12676         ILIB="$ILIB;$COMPATH/lib/x86"
12677         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12678         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12679         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12680         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12681             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12682             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12683         fi
12684         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12685         ucrtlibpath_formatted=$formatted_path
12686         ILIB="$ILIB;$ucrtlibpath_formatted"
12687         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12688     fi
12689     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12690         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12691     else
12692         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12693     fi
12695     AC_SUBST(ILIB)
12698 # ===================================================================
12699 # Creating bigger shared library to link against
12700 # ===================================================================
12701 AC_MSG_CHECKING([whether to create huge library])
12702 MERGELIBS=
12704 if test $_os = iOS -o $_os = Android; then
12705     # Never any point in mergelibs for these as we build just static
12706     # libraries anyway...
12707     enable_mergelibs=no
12710 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12711     if test $_os != Linux -a $_os != WINNT; then
12712         add_warning "--enable-mergelibs is not tested for this platform"
12713     fi
12714     MERGELIBS="TRUE"
12715     AC_MSG_RESULT([yes])
12716 else
12717     AC_MSG_RESULT([no])
12719 AC_SUBST([MERGELIBS])
12721 dnl ===================================================================
12722 dnl icerun is a wrapper that stops us spawning tens of processes
12723 dnl locally - for tools that can't be executed on the compile cluster
12724 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12725 dnl ===================================================================
12726 AC_MSG_CHECKING([whether to use icerun wrapper])
12727 ICECREAM_RUN=
12728 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12729     ICECREAM_RUN=icerun
12730     AC_MSG_RESULT([yes])
12731 else
12732     AC_MSG_RESULT([no])
12734 AC_SUBST(ICECREAM_RUN)
12736 dnl ===================================================================
12737 dnl Setup the ICECC_VERSION for the build the same way it was set for
12738 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12739 dnl ===================================================================
12740 x_ICECC_VERSION=[\#]
12741 if test -n "$ICECC_VERSION" ; then
12742     x_ICECC_VERSION=
12744 AC_SUBST(x_ICECC_VERSION)
12745 AC_SUBST(ICECC_VERSION)
12747 dnl ===================================================================
12749 AC_MSG_CHECKING([MPL subset])
12750 MPL_SUBSET=
12752 if test "$enable_mpl_subset" = "yes"; then
12753     warn_report=false
12754     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12755         warn_report=true
12756     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12757         warn_report=true
12758     fi
12759     if test "$warn_report" = "true"; then
12760         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12761     fi
12762     if test "x$enable_postgresql_sdbc" != "xno"; then
12763         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12764     fi
12765     if test "$enable_lotuswordpro" = "yes"; then
12766         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12767     fi
12768     if test "$WITH_WEBDAV" = "neon"; then
12769         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12770     fi
12771     if test -n "$ENABLE_POPPLER"; then
12772         if test "x$SYSTEM_POPPLER" = "x"; then
12773             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12774         fi
12775     fi
12776     # cf. m4/libo_check_extension.m4
12777     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12778         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12779     fi
12780     for theme in $WITH_THEMES; do
12781         case $theme in
12782         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12783             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12784         *) : ;;
12785         esac
12786     done
12788     ENABLE_OPENGL_TRANSITIONS=
12790     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12791         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12792     fi
12794     MPL_SUBSET="TRUE"
12795     AC_DEFINE(MPL_HAVE_SUBSET)
12796     AC_MSG_RESULT([only])
12797 else
12798     AC_MSG_RESULT([no restrictions])
12800 AC_SUBST(MPL_SUBSET)
12802 dnl ===================================================================
12804 AC_MSG_CHECKING([formula logger])
12805 ENABLE_FORMULA_LOGGER=
12807 if test "x$enable_formula_logger" = "xyes"; then
12808     AC_MSG_RESULT([yes])
12809     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12810     ENABLE_FORMULA_LOGGER=TRUE
12811 elif test -n "$ENABLE_DBGUTIL" ; then
12812     AC_MSG_RESULT([yes])
12813     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12814     ENABLE_FORMULA_LOGGER=TRUE
12815 else
12816     AC_MSG_RESULT([no])
12819 AC_SUBST(ENABLE_FORMULA_LOGGER)
12821 dnl ===================================================================
12822 dnl Setting up the environment.
12823 dnl ===================================================================
12824 AC_MSG_NOTICE([setting up the build environment variables...])
12826 AC_SUBST(COMPATH)
12828 if test "$build_os" = "cygwin"; then
12829     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12830         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12831         ATL_INCLUDE="$COMPATH/atlmfc/include"
12832     elif test -d "$COMPATH/atlmfc/lib"; then
12833         ATL_LIB="$COMPATH/atlmfc/lib"
12834         ATL_INCLUDE="$COMPATH/atlmfc/include"
12835     else
12836         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12837         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12838     fi
12839     if test "$BITNESS_OVERRIDE" = 64; then
12840         ATL_LIB="$ATL_LIB/x64"
12841     else
12842         ATL_LIB="$ATL_LIB/x86"
12843     fi
12844     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12845     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12847     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12848     PathFormat "/usr/bin/find.exe"
12849     FIND="$formatted_path"
12850     PathFormat "/usr/bin/sort.exe"
12851     SORT="$formatted_path"
12852     PathFormat "/usr/bin/grep.exe"
12853     WIN_GREP="$formatted_path"
12854     PathFormat "/usr/bin/ls.exe"
12855     WIN_LS="$formatted_path"
12856     PathFormat "/usr/bin/touch.exe"
12857     WIN_TOUCH="$formatted_path"
12858 else
12859     FIND=find
12860     SORT=sort
12863 AC_SUBST(ATL_INCLUDE)
12864 AC_SUBST(ATL_LIB)
12865 AC_SUBST(FIND)
12866 AC_SUBST(SORT)
12867 AC_SUBST(WIN_GREP)
12868 AC_SUBST(WIN_LS)
12869 AC_SUBST(WIN_TOUCH)
12871 AC_SUBST(BUILD_TYPE)
12873 AC_SUBST(SOLARINC)
12875 PathFormat "$PERL"
12876 PERL="$formatted_path"
12877 AC_SUBST(PERL)
12879 if test -n "$TMPDIR"; then
12880     TEMP_DIRECTORY="$TMPDIR"
12881 else
12882     TEMP_DIRECTORY="/tmp"
12884 if test "$build_os" = "cygwin"; then
12885     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12887 AC_SUBST(TEMP_DIRECTORY)
12889 # setup the PATH for the environment
12890 if test -n "$LO_PATH_FOR_BUILD"; then
12891     LO_PATH="$LO_PATH_FOR_BUILD"
12892 else
12893     LO_PATH="$PATH"
12895     case "$host_os" in
12897     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12898         if test "$ENABLE_JAVA" != ""; then
12899             pathmunge "$JAVA_HOME/bin" "after"
12900         fi
12901         ;;
12903     cygwin*)
12904         # Win32 make needs native paths
12905         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12906             LO_PATH=`cygpath -p -m "$PATH"`
12907         fi
12908         if test "$BITNESS_OVERRIDE" = 64; then
12909             # needed for msi packaging
12910             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12911         fi
12912         # .NET 4.6 and higher don't have bin directory
12913         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12914             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12915         fi
12916         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12917         pathmunge "$CSC_PATH" "before"
12918         pathmunge "$MIDL_PATH" "before"
12919         pathmunge "$AL_PATH" "before"
12920         pathmunge "$MSPDB_PATH" "before"
12921         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12922             pathmunge "$CL_PATH" "before"
12923         fi
12924         if test -n "$MSBUILD_PATH" ; then
12925             pathmunge "$MSBUILD_PATH" "before"
12926         fi
12927         if test "$BITNESS_OVERRIDE" = 64; then
12928             pathmunge "$COMPATH/bin/amd64" "before"
12929             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12930         else
12931             pathmunge "$COMPATH/bin" "before"
12932             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12933         fi
12934         if test "$ENABLE_JAVA" != ""; then
12935             if test -d "$JAVA_HOME/jre/bin/client"; then
12936                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12937             fi
12938             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12939                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12940             fi
12941             pathmunge "$JAVA_HOME/bin" "before"
12942         fi
12943         ;;
12945     solaris*)
12946         pathmunge "/usr/css/bin" "before"
12947         if test "$ENABLE_JAVA" != ""; then
12948             pathmunge "$JAVA_HOME/bin" "after"
12949         fi
12950         ;;
12951     esac
12954 AC_SUBST(LO_PATH)
12956 libo_FUZZ_SUMMARY
12958 # Generate a configuration sha256 we can use for deps
12959 if test -f config_host.mk; then
12960     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12962 if test -f config_host_lang.mk; then
12963     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12966 CFLAGS=$my_original_CFLAGS
12967 CXXFLAGS=$my_original_CXXFLAGS
12968 CPPFLAGS=$my_original_CPPFLAGS
12970 AC_LINK_FILES([include], [include])
12971 AC_CONFIG_FILES([config_host.mk
12972                  config_host_lang.mk
12973                  Makefile
12974                  bin/bffvalidator.sh
12975                  bin/odfvalidator.sh
12976                  bin/officeotron.sh
12977                  instsetoo_native/util/openoffice.lst
12978                  setup_native/source/packinfo/finals_instsetoo.txt
12979                  sysui/desktop/macosx/Info.plist])
12980 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12981 AC_CONFIG_HEADERS([config_host/config_clang.h])
12982 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12983 AC_CONFIG_HEADERS([config_host/config_eot.h])
12984 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12985 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12986 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12987 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12988 AC_CONFIG_HEADERS([config_host/config_features.h])
12989 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
12990 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
12991 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12992 AC_CONFIG_HEADERS([config_host/config_folders.h])
12993 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12994 AC_CONFIG_HEADERS([config_host/config_gio.h])
12995 AC_CONFIG_HEADERS([config_host/config_global.h])
12996 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12997 AC_CONFIG_HEADERS([config_host/config_java.h])
12998 AC_CONFIG_HEADERS([config_host/config_langs.h])
12999 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13000 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13001 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13002 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13003 AC_CONFIG_HEADERS([config_host/config_locales.h])
13004 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13005 AC_CONFIG_HEADERS([config_host/config_oox.h])
13006 AC_CONFIG_HEADERS([config_host/config_options.h])
13007 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13008 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13009 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13010 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13011 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13012 AC_CONFIG_HEADERS([config_host/config_version.h])
13013 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13014 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13015 AC_CONFIG_HEADERS([config_host/config_python.h])
13016 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13017 AC_OUTPUT
13019 if test "$CROSS_COMPILING" = TRUE; then
13020     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13023 # touch the config timestamp file
13024 if test ! -f config_host.mk.stamp; then
13025     echo > config_host.mk.stamp
13026 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13027     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13028 else
13029     echo > config_host.mk.stamp
13032 # touch the config lang timestamp file
13033 if test ! -f config_host_lang.mk.stamp; then
13034     echo > config_host_lang.mk.stamp
13035 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13036     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13037 else
13038     echo > config_host_lang.mk.stamp
13042 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13043         -a "$build_os" = "cygwin"; then
13045 cat << _EOS
13046 ****************************************************************************
13047 WARNING:
13048 Your make version is known to be horribly slow, and hard to debug
13049 problems with. To get a reasonably functional make please do:
13051 to install a pre-compiled binary make for Win32
13053  mkdir -p /opt/lo/bin
13054  cd /opt/lo/bin
13055  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13056  cp make-4.2.1-msvc.exe make
13057  chmod +x make
13059 to install from source:
13060 place yourself in a working directory of you choice.
13062  git clone git://git.savannah.gnu.org/make.git
13064  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13065  set PATH=%PATH%;C:\Cygwin\bin
13066  [or Cygwin64, if that is what you have]
13067  cd path-to-make-repo-you-cloned-above
13068  build_w32.bat --without-guile
13070 should result in a WinRel/gnumake.exe.
13071 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13073 Then re-run autogen.sh
13075 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13076 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13078 _EOS
13079 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13080     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13085 cat << _EOF
13086 ****************************************************************************
13088 To build, run:
13089 $GNUMAKE
13091 To view some help, run:
13092 $GNUMAKE help
13094 _EOF
13096 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13097     cat << _EOF
13098 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13099 _EOF
13101     if test $_os = Darwin; then
13102         echo open instdir/$PRODUCTNAME.app
13103     else
13104         echo instdir/program/soffice
13105     fi
13106     cat << _EOF
13108 If you want to run the smoketest, run:
13109 $GNUMAKE check
13111 _EOF
13114 if test -f warn; then
13115     cat warn
13116     rm warn
13119 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: