tdf#95854 Same shortcut for insert and edit comment
[LibreOffice.git] / configure.ac
blobeb2befed52761d70613ee44ce47e4617f927e51d
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[7.0.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
336 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
338 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
339     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
342 # need sed in os checks...
343 AC_PATH_PROGS(SED, sed)
344 if test -z "$SED"; then
345     AC_MSG_ERROR([install sed to run this script])
348 # Set the ENABLE_LTO variable
349 # ===================================================================
350 AC_MSG_CHECKING([whether to use link-time optimization])
351 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
352     ENABLE_LTO="TRUE"
353     AC_MSG_RESULT([yes])
354     AC_DEFINE(STATIC_LINKING)
355 else
356     ENABLE_LTO=""
357     AC_MSG_RESULT([no])
359 AC_SUBST(ENABLE_LTO)
361 AC_ARG_ENABLE(fuzz-options,
362     AS_HELP_STRING([--enable-fuzz-options],
363         [Randomly enable or disable each of those configurable options
364          that are supposed to be freely selectable without interdependencies,
365          or where bad interaction from interdependencies is automatically avoided.])
368 dnl ===================================================================
369 dnl When building for Android, --with-android-ndk,
370 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
371 dnl mandatory
372 dnl ===================================================================
374 AC_ARG_WITH(android-ndk,
375     AS_HELP_STRING([--with-android-ndk],
376         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
379 AC_ARG_WITH(android-ndk-toolchain-version,
380     AS_HELP_STRING([--with-android-ndk-toolchain-version],
381         [Specify which toolchain version to use, of those present in the
382         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
383         with_android_ndk_toolchain_version=clang5.0)
385 AC_ARG_WITH(android-sdk,
386     AS_HELP_STRING([--with-android-sdk],
387         [Specify location of the Android SDK. Mandatory when building for Android.]),
390 AC_ARG_WITH(android-api-level,
391     AS_HELP_STRING([--with-android-api-level],
392         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
395 ANDROID_NDK_HOME=
396 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
397     with_android_ndk="$SRC_ROOT/external/android-ndk"
399 if test -n "$with_android_ndk"; then
400     eval ANDROID_NDK_HOME=$with_android_ndk
402     # Set up a lot of pre-canned defaults
404     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
405         if test ! -f $ANDROID_NDK_HOME/source.properties; then
406             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
407         fi
408         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
409     else
410         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
411     fi
412     if test -z "$ANDROID_NDK_VERSION";  then
413         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
414     fi
415     case $ANDROID_NDK_VERSION in
416     r9*|r10*)
417         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
418         ;;
419     11.1.*|12.1.*|13.1.*|14.1.*)
420         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
421         ;;
422     16.*|17.*|18.*|19.*|20.*)
423         ;;
424     *)
425         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
426         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
427         ;;
428     esac
430     ANDROID_API_LEVEL=16
431     if test -n "$with_android_api_level" ; then
432         ANDROID_API_LEVEL="$with_android_api_level"
433     fi
435     android_cpu=$host_cpu
436     if test $host_cpu = arm; then
437         android_platform_prefix=arm-linux-androideabi
438         android_gnu_prefix=$android_platform_prefix
439         LLVM_TRIPLE=armv7a-linux-androideabi
440         ANDROID_APP_ABI=armeabi-v7a
441         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
442     elif test $host_cpu = aarch64; then
443         android_platform_prefix=aarch64-linux-android
444         android_gnu_prefix=$android_platform_prefix
445         LLVM_TRIPLE=$android_platform_prefix
446         # minimum android version that supports aarch64
447         if test "$ANDROID_API_LEVEL" -lt "21" ; then
448             ANDROID_API_LEVEL=21
449         fi
450         ANDROID_APP_ABI=arm64-v8a
451     elif test $host_cpu = x86_64; then
452         android_platform_prefix=x86_64-linux-android
453         android_gnu_prefix=$android_platform_prefix
454         LLVM_TRIPLE=$android_platform_prefix
455         # minimum android version that supports x86_64
456         ANDROID_API_LEVEL=21
457         ANDROID_APP_ABI=x86_64
458     else
459         # host_cpu is something like "i386" or "i686" I guess, NDK uses
460         # "x86" in some contexts
461         android_cpu=x86
462         android_platform_prefix=$android_cpu
463         android_gnu_prefix=i686-linux-android
464         LLVM_TRIPLE=$android_gnu_prefix
465         ANDROID_APP_ABI=x86
466     fi
468     case "$with_android_ndk_toolchain_version" in
469     clang5.0)
470         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
471         ;;
472     *)
473         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
474     esac
476     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
478     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
479     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
480     # manage to link the (app-specific) single huge .so that is built for the app in
481     # android/source/ if there is debug information in a significant part of the object files.
482     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
483     # all objects have been built with debug information.)
484     case $build_os in
485     linux-gnu*)
486         android_HOST_TAG=linux-x86_64
487         ;;
488     darwin*)
489         android_HOST_TAG=darwin-x86_64
490         ;;
491     *)
492         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
493         # ndk would also support windows and windows-x86_64
494         ;;
495     esac
496     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
497     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
498     dnl TODO: NSS build uses it...
499     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
500     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
502     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
503     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
504     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
505     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
506     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
508     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
510     if test "$ENABLE_LTO" = TRUE; then
511         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
512         # $CC and $CXX when building external libraries
513         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
514     fi
516     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
518     if test -z "$CC"; then
519         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
520         CC_BASE="clang"
521     fi
522     if test -z "$CXX"; then
523         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
524         CXX_BASE="clang++"
525     fi
527     # remember to download the ownCloud Android library later
528     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
530 AC_SUBST(ANDROID_NDK_HOME)
531 AC_SUBST(ANDROID_APP_ABI)
532 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
534 dnl ===================================================================
535 dnl --with-android-sdk
536 dnl ===================================================================
537 ANDROID_SDK_HOME=
538 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
539     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
541 if test -n "$with_android_sdk"; then
542     eval ANDROID_SDK_HOME=$with_android_sdk
543     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
545 AC_SUBST(ANDROID_SDK_HOME)
547 AC_ARG_ENABLE([android-lok],
548     AS_HELP_STRING([--enable-android-lok],
549         [The Android app from the android/ subdir needs several tweaks all
550          over the place that break the LOK when used in the Online-based
551          Android app.  This switch indicates that the intent of this build is
552          actually the Online-based, non-modified LOK.])
554 ENABLE_ANDROID_LOK=
555 if test -n "$ANDROID_NDK_HOME" ; then
556     if test "$enable_android_lok" = yes; then
557         ENABLE_ANDROID_LOK=TRUE
558         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
559         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
560     else
561         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
562     fi
564 AC_SUBST([ENABLE_ANDROID_LOK])
566 libo_FUZZ_ARG_ENABLE([android-editing],
567     AS_HELP_STRING([--enable-android-editing],
568         [Enable the experimental editing feature on Android.])
570 ENABLE_ANDROID_EDITING=
571 if test "$enable_android_editing" = yes; then
572     ENABLE_ANDROID_EDITING=TRUE
574 AC_SUBST([ENABLE_ANDROID_EDITING])
576 dnl ===================================================================
577 dnl The following is a list of supported systems.
578 dnl Sequential to keep the logic very simple
579 dnl These values may be checked and reset later.
580 dnl ===================================================================
581 #defaults unless the os test overrides this:
582 test_randr=yes
583 test_xrender=yes
584 test_cups=yes
585 test_dbus=yes
586 test_fontconfig=yes
587 test_cairo=no
588 test_gdb_index=no
589 test_split_debug=no
591 # Default values, as such probably valid just for Linux, set
592 # differently below just for Mac OSX, but at least better than
593 # hardcoding these as we used to do. Much of this is duplicated also
594 # in solenv for old build system and for gbuild, ideally we should
595 # perhaps define stuff like this only here in configure.ac?
597 LINKFLAGSSHL="-shared"
598 PICSWITCH="-fpic"
599 DLLPOST=".so"
601 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
603 INSTROOTBASESUFFIX=
604 INSTROOTCONTENTSUFFIX=
605 SDKDIRNAME=sdk
607 case "$host_os" in
609 solaris*)
610     build_gstreamer_1_0=yes
611     test_freetype=yes
612     build_skia=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     build_skia=yes
640     test_gdb_index=yes
641     test_split_debug=yes
642     if test "$enable_fuzzers" != yes; then
643         test_freetype=yes
644         test_fontconfig=yes
645     else
646         test_freetype=no
647         test_fontconfig=no
648         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
649     fi
650     _os=Linux
651     ;;
653 gnu)
654     test_randr=no
655     test_xrender=no
656     _os=GNU
657      ;;
659 cygwin*|interix*)
661     # When building on Windows normally with MSVC under Cygwin,
662     # configure thinks that the host platform (the platform the
663     # built code will run on) is Cygwin, even if it obviously is
664     # Windows, which in Autoconf terminology is called
665     # "mingw32". (Which is misleading as MinGW is the name of the
666     # tool-chain, not an operating system.)
668     # Somewhat confusing, yes. But this configure script doesn't
669     # look at $host etc that much, it mostly uses its own $_os
670     # variable, set here in this case statement.
672     test_cups=no
673     test_dbus=no
674     test_randr=no
675     test_xrender=no
676     test_freetype=no
677     test_fontconfig=no
678     build_skia=yes
679     _os=WINNT
681     DLLPOST=".dll"
682     LINKFLAGSNOUNDEFS=
683     ;;
685 darwin*) # macOS or iOS
686     test_randr=no
687     test_xrender=no
688     test_freetype=no
689     test_fontconfig=no
690     test_dbus=no
691     if test -n "$LODE_HOME" ; then
692         mac_sanitize_path
693         AC_MSG_NOTICE([sanitized the PATH to $PATH])
694     fi
695     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
696         build_for_ios=YES
697         _os=iOS
698         test_cups=no
699         enable_mpl_subset=yes
700         enable_lotuswordpro=no
701         enable_coinmp=no
702         enable_lpsolve=no
703         enable_postgresql_sdbc=no
704         enable_extension_integration=no
705         enable_report_builder=no
706         with_ppds=no
707         if test "$enable_ios_simulator" = "yes"; then
708             host=x86_64-apple-darwin
709         fi
710     else
711         _os=Darwin
712         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
713         INSTROOTCONTENTSUFFIX=/Contents
714         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
715     fi
716     # See comment above the case "$host_os"
717     LINKFLAGSSHL="-dynamiclib -single_module"
719     # -fPIC is default
720     PICSWITCH=""
722     DLLPOST=".dylib"
724     # -undefined error is the default
725     LINKFLAGSNOUNDEFS=""
728 freebsd*)
729     build_gstreamer_1_0=yes
730     test_kf5=yes
731     test_gtk3_kde5=yes
732     test_freetype=yes
733     build_skia=yes
734     AC_MSG_CHECKING([the FreeBSD operating system release])
735     if test -n "$with_os_version"; then
736         OSVERSION="$with_os_version"
737     else
738         OSVERSION=`/sbin/sysctl -n kern.osreldate`
739     fi
740     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
741     AC_MSG_CHECKING([which thread library to use])
742     if test "$OSVERSION" -lt "500016"; then
743         PTHREAD_CFLAGS="-D_THREAD_SAFE"
744         PTHREAD_LIBS="-pthread"
745     elif test "$OSVERSION" -lt "502102"; then
746         PTHREAD_CFLAGS="-D_THREAD_SAFE"
747         PTHREAD_LIBS="-lc_r"
748     else
749         PTHREAD_CFLAGS=""
750         PTHREAD_LIBS="-pthread"
751     fi
752     AC_MSG_RESULT([$PTHREAD_LIBS])
753     _os=FreeBSD
754     ;;
756 *netbsd*)
757     build_gstreamer_1_0=yes
758     test_kf5=yes
759     test_gtk3_kde5=yes
760     test_freetype=yes
761     build_skia=yes
762     PTHREAD_LIBS="-pthread -lpthread"
763     _os=NetBSD
764     ;;
766 aix*)
767     test_randr=no
768     test_freetype=yes
769     PTHREAD_LIBS=-pthread
770     _os=AIX
771     ;;
773 openbsd*)
774     test_freetype=yes
775     PTHREAD_CFLAGS="-D_THREAD_SAFE"
776     PTHREAD_LIBS="-pthread"
777     _os=OpenBSD
778     ;;
780 dragonfly*)
781     build_gstreamer_1_0=yes
782     test_kf5=yes
783     test_gtk3_kde5=yes
784     test_freetype=yes
785     build_skia=yes
786     PTHREAD_LIBS="-pthread"
787     _os=DragonFly
788     ;;
790 linux-android*)
791     build_gstreamer_1_0=no
792     enable_lotuswordpro=no
793     enable_mpl_subset=yes
794     enable_coinmp=yes
795     enable_lpsolve=no
796     enable_report_builder=no
797     enable_odk=no
798     enable_postgresql_sdbc=no
799     enable_python=no
800     test_cups=no
801     test_dbus=no
802     test_fontconfig=no
803     test_freetype=no
804     test_kf5=no
805     test_qt5=no
806     test_gtk3_kde5=no
807     test_randr=no
808     test_xrender=no
809     _os=Android
811     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
812     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
813     ;;
815 haiku*)
816     test_cups=no
817     test_dbus=no
818     test_randr=no
819     test_xrender=no
820     test_freetype=yes
821     enable_odk=no
822     enable_gstreamer_1_0=no
823     enable_vlc=no
824     enable_coinmp=no
825     enable_pdfium=no
826     enable_sdremote=no
827     enable_postgresql_sdbc=no
828     enable_firebird_sdbc=no
829     _os=Haiku
830     ;;
833     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
834     ;;
835 esac
837 if test "$_os" = "Android" ; then
838     # Verify that the NDK and SDK options are proper
839     if test -z "$with_android_ndk"; then
840         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
841     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
842         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
843     fi
845     if test -z "$ANDROID_SDK_HOME"; then
846         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
847     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
848         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
849     fi
851     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
852     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
853         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
854                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
855                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
856         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
857         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
858         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
859     fi
860     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
861         AC_MSG_WARN([android support repository not found - install with
862                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
863                      to allow the build to download the specified version of the android support libraries])
864         add_warning "android support repository not found - install with"
865         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
866         add_warning "to allow the build to download the specified version of the android support libraries"
867     fi
870 if test "$_os" = "AIX"; then
871     AC_PATH_PROG(GAWK, gawk)
872     if test -z "$GAWK"; then
873         AC_MSG_ERROR([gawk not found in \$PATH])
874     fi
877 AC_SUBST(SDKDIRNAME)
879 AC_SUBST(PTHREAD_CFLAGS)
880 AC_SUBST(PTHREAD_LIBS)
882 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
883 # By default use the ones specified by our build system,
884 # but explicit override is possible.
885 AC_MSG_CHECKING(for explicit AFLAGS)
886 if test -n "$AFLAGS"; then
887     AC_MSG_RESULT([$AFLAGS])
888     x_AFLAGS=
889 else
890     AC_MSG_RESULT(no)
891     x_AFLAGS=[\#]
893 AC_MSG_CHECKING(for explicit CFLAGS)
894 if test -n "$CFLAGS"; then
895     AC_MSG_RESULT([$CFLAGS])
896     x_CFLAGS=
897 else
898     AC_MSG_RESULT(no)
899     x_CFLAGS=[\#]
901 AC_MSG_CHECKING(for explicit CXXFLAGS)
902 if test -n "$CXXFLAGS"; then
903     AC_MSG_RESULT([$CXXFLAGS])
904     x_CXXFLAGS=
905 else
906     AC_MSG_RESULT(no)
907     x_CXXFLAGS=[\#]
909 AC_MSG_CHECKING(for explicit OBJCFLAGS)
910 if test -n "$OBJCFLAGS"; then
911     AC_MSG_RESULT([$OBJCFLAGS])
912     x_OBJCFLAGS=
913 else
914     AC_MSG_RESULT(no)
915     x_OBJCFLAGS=[\#]
917 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
918 if test -n "$OBJCXXFLAGS"; then
919     AC_MSG_RESULT([$OBJCXXFLAGS])
920     x_OBJCXXFLAGS=
921 else
922     AC_MSG_RESULT(no)
923     x_OBJCXXFLAGS=[\#]
925 AC_MSG_CHECKING(for explicit LDFLAGS)
926 if test -n "$LDFLAGS"; then
927     AC_MSG_RESULT([$LDFLAGS])
928     x_LDFLAGS=
929 else
930     AC_MSG_RESULT(no)
931     x_LDFLAGS=[\#]
933 AC_SUBST(AFLAGS)
934 AC_SUBST(CFLAGS)
935 AC_SUBST(CXXFLAGS)
936 AC_SUBST(OBJCFLAGS)
937 AC_SUBST(OBJCXXFLAGS)
938 AC_SUBST(LDFLAGS)
939 AC_SUBST(x_AFLAGS)
940 AC_SUBST(x_CFLAGS)
941 AC_SUBST(x_CXXFLAGS)
942 AC_SUBST(x_OBJCFLAGS)
943 AC_SUBST(x_OBJCXXFLAGS)
944 AC_SUBST(x_LDFLAGS)
946 dnl These are potentially set for MSVC, in the code checking for UCRT below:
947 my_original_CFLAGS=$CFLAGS
948 my_original_CXXFLAGS=$CXXFLAGS
949 my_original_CPPFLAGS=$CPPFLAGS
951 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
952 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
953 dnl AC_PROG_CC internally.
954 if test "$_os" != "WINNT"; then
955     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
956     save_CFLAGS=$CFLAGS
957     AC_PROG_CC
958     CFLAGS=$save_CFLAGS
959     if test -z "$CC_BASE"; then
960         CC_BASE=`first_arg_basename "$CC"`
961     fi
964 if test "$_os" != "WINNT"; then
965     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
966 else
967     ENDIANNESS=little
969 AC_SUBST(ENDIANNESS)
971 if test $_os != "WINNT"; then
972     save_LIBS="$LIBS"
973     AC_SEARCH_LIBS([dlsym], [dl],
974         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
975         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
976     LIBS="$save_LIBS"
978 AC_SUBST(DLOPEN_LIBS)
980 AC_ARG_ENABLE(ios-simulator,
981     AS_HELP_STRING([--enable-ios-simulator],
982         [build i386 or x86_64 for ios simulator])
985 AC_ARG_ENABLE(ios-libreofficelight-app,
986     AS_HELP_STRING([--enable-ios-libreofficelight-app],
987         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
988          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
989          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
992 ENABLE_IOS_LIBREOFFICELIGHT_APP=
993 if test "$enable_ios_libreofficelight_app" = yes; then
994     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
996 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
998 ###############################################################################
999 # Extensions switches --enable/--disable
1000 ###############################################################################
1001 # By default these should be enabled unless having extra dependencies.
1002 # If there is extra dependency over configure options then the enable should
1003 # be automagic based on whether the requiring feature is enabled or not.
1004 # All this options change anything only with --enable-extension-integration.
1006 # The name of this option and its help string makes it sound as if
1007 # extensions are built anyway, just not integrated in the installer,
1008 # if you use --disable-extension-integration. Is that really the
1009 # case?
1011 libo_FUZZ_ARG_ENABLE(extension-integration,
1012     AS_HELP_STRING([--disable-extension-integration],
1013         [Disable integration of the built extensions in the installer of the
1014          product. Use this switch to disable the integration.])
1017 AC_ARG_ENABLE(avmedia,
1018     AS_HELP_STRING([--disable-avmedia],
1019         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1022 AC_ARG_ENABLE(database-connectivity,
1023     AS_HELP_STRING([--disable-database-connectivity],
1024         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1027 # This doesn't mean not building (or "integrating") extensions
1028 # (although it probably should; i.e. it should imply
1029 # --disable-extension-integration I guess), it means not supporting
1030 # any extension mechanism at all
1031 libo_FUZZ_ARG_ENABLE(extensions,
1032     AS_HELP_STRING([--disable-extensions],
1033         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1036 AC_ARG_ENABLE(scripting,
1037     AS_HELP_STRING([--disable-scripting],
1038         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1041 # This is mainly for Android and iOS, but could potentially be used in some
1042 # special case otherwise, too, so factored out as a separate setting
1044 AC_ARG_ENABLE(dynamic-loading,
1045     AS_HELP_STRING([--disable-dynamic-loading],
1046         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1049 libo_FUZZ_ARG_ENABLE(report-builder,
1050     AS_HELP_STRING([--disable-report-builder],
1051         [Disable the Report Builder.])
1054 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1055     AS_HELP_STRING([--enable-ext-wiki-publisher],
1056         [Enable the Wiki Publisher extension.])
1059 libo_FUZZ_ARG_ENABLE(lpsolve,
1060     AS_HELP_STRING([--disable-lpsolve],
1061         [Disable compilation of the lp solve solver ])
1063 libo_FUZZ_ARG_ENABLE(coinmp,
1064     AS_HELP_STRING([--disable-coinmp],
1065         [Disable compilation of the CoinMP solver ])
1068 libo_FUZZ_ARG_ENABLE(pdfimport,
1069     AS_HELP_STRING([--disable-pdfimport],
1070         [Disable building the PDF import feature.])
1073 libo_FUZZ_ARG_ENABLE(pdfium,
1074     AS_HELP_STRING([--disable-pdfium],
1075         [Disable building PDFium.])
1078 libo_FUZZ_ARG_ENABLE(skia,
1079     AS_HELP_STRING([--disable-skia],
1080         [Disable building Skia.])
1083 ###############################################################################
1085 dnl ---------- *** ----------
1087 libo_FUZZ_ARG_ENABLE(mergelibs,
1088     AS_HELP_STRING([--enable-mergelibs],
1089         [Merge several of the smaller libraries into one big, "merged", one.])
1092 libo_FUZZ_ARG_ENABLE(breakpad,
1093     AS_HELP_STRING([--enable-breakpad],
1094         [Enables breakpad for crash reporting.])
1097 libo_FUZZ_ARG_ENABLE(crashdump,
1098     AS_HELP_STRING([--disable-crashdump],
1099         [Disable dump.ini and dump-file, when --enable-breakpad])
1102 AC_ARG_ENABLE(fetch-external,
1103     AS_HELP_STRING([--disable-fetch-external],
1104         [Disables fetching external tarballs from web sources.])
1107 AC_ARG_ENABLE(fuzzers,
1108     AS_HELP_STRING([--enable-fuzzers],
1109         [Enables building libfuzzer targets for fuzz testing.])
1112 libo_FUZZ_ARG_ENABLE(pch,
1113     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1114         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1115          Using 'system' will include only external headers, 'base' will add also headers
1116          from base modules, 'normal' will also add all headers except from the module built,
1117          'full' will use all suitable headers even from a module itself.])
1120 libo_FUZZ_ARG_ENABLE(epm,
1121     AS_HELP_STRING([--enable-epm],
1122         [LibreOffice includes self-packaging code, that requires epm, however epm is
1123          useless for large scale package building.])
1126 libo_FUZZ_ARG_ENABLE(odk,
1127     AS_HELP_STRING([--disable-odk],
1128         [LibreOffice includes an ODK, office development kit which some packagers may
1129          wish to build without.])
1132 AC_ARG_ENABLE(mpl-subset,
1133     AS_HELP_STRING([--enable-mpl-subset],
1134         [Don't compile any pieces which are not MPL or more liberally licensed])
1137 libo_FUZZ_ARG_ENABLE(evolution2,
1138     AS_HELP_STRING([--enable-evolution2],
1139         [Allows the built-in evolution 2 addressbook connectivity build to be
1140          enabled.])
1143 AC_ARG_ENABLE(avahi,
1144     AS_HELP_STRING([--enable-avahi],
1145         [Determines whether to use Avahi to advertise Impress to remote controls.])
1148 libo_FUZZ_ARG_ENABLE(werror,
1149     AS_HELP_STRING([--enable-werror],
1150         [Turn warnings to errors. (Has no effect in modules where the treating
1151          of warnings as errors is disabled explicitly.)]),
1154 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1155     AS_HELP_STRING([--enable-assert-always-abort],
1156         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1159 libo_FUZZ_ARG_ENABLE(dbgutil,
1160     AS_HELP_STRING([--enable-dbgutil],
1161         [Provide debugging support from --enable-debug and include additional debugging
1162          utilities such as object counting or more expensive checks.
1163          This is the recommended option for developers.
1164          Note that this makes the build ABI incompatible, it is not possible to mix object
1165          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1167 libo_FUZZ_ARG_ENABLE(debug,
1168     AS_HELP_STRING([--enable-debug],
1169         [Include debugging information, disable compiler optimization and inlining plus
1170          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1172 libo_FUZZ_ARG_ENABLE(split-debug,
1173     AS_HELP_STRING([--disable-split-debug],
1174         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1175          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1177 libo_FUZZ_ARG_ENABLE(gdb-index,
1178     AS_HELP_STRING([--disable-gdb-index],
1179         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1180          The feature requires the gold or lld linker.]))
1182 libo_FUZZ_ARG_ENABLE(sal-log,
1183     AS_HELP_STRING([--enable-sal-log],
1184         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1186 libo_FUZZ_ARG_ENABLE(symbols,
1187     AS_HELP_STRING([--enable-symbols],
1188         [Generate debug information.
1189          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1190          otherwise. It is possible to explicitly specify gbuild build targets
1191          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1192          everything in the directory; there is no ordering, more specific overrides
1193          more general, and disabling takes precedence).
1194          Example: --enable-symbols="all -sw/ -Library_sc".]))
1196 libo_FUZZ_ARG_ENABLE(optimized,
1197     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1198         [Whether to compile with optimization flags.
1199          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1200          otherwise. Using 'debug' will try to use only optimizations that should
1201          not interfere with debugging.]))
1203 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1204     AS_HELP_STRING([--disable-runtime-optimizations],
1205         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1206          JVM JIT) that are known to interact badly with certain dynamic analysis
1207          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1208          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1209          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1211 AC_ARG_WITH(valgrind,
1212     AS_HELP_STRING([--with-valgrind],
1213         [Make availability of Valgrind headers a hard requirement.]))
1215 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1216     AS_HELP_STRING([--enable-compiler-plugins],
1217         [Enable compiler plugins that will perform additional checks during
1218          building. Enabled automatically by --enable-dbgutil.
1219          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1220 COMPILER_PLUGINS_DEBUG=
1221 if test "$enable_compiler_plugins" = debug; then
1222     enable_compiler_plugins=yes
1223     COMPILER_PLUGINS_DEBUG=TRUE
1226 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1227     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1228         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1229          relevant in the --disable-compiler-plugins case.]))
1231 libo_FUZZ_ARG_ENABLE(ooenv,
1232     AS_HELP_STRING([--disable-ooenv],
1233         [Disable ooenv for the instdir installation.]))
1235 libo_FUZZ_ARG_ENABLE(libnumbertext,
1236     AS_HELP_STRING([--disable-libnumbertext],
1237         [Disable use of numbertext external library.]))
1239 AC_ARG_ENABLE(lto,
1240     AS_HELP_STRING([--enable-lto],
1241         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1242          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1243          linker. For MSVC, this option is broken at the moment. This is experimental work
1244          in progress that shouldn't be used unless you are working on it.)]))
1246 AC_ARG_ENABLE(python,
1247     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1248         [Enables or disables Python support at run-time.
1249          Also specifies what Python to use. 'auto' is the default.
1250          'fully-internal' even forces the internal version for uses of Python
1251          during the build.]))
1253 libo_FUZZ_ARG_ENABLE(gtk3,
1254     AS_HELP_STRING([--disable-gtk3],
1255         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1256 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1258 AC_ARG_ENABLE(introspection,
1259     AS_HELP_STRING([--enable-introspection],
1260         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1261          Linux distributions.)]))
1263 AC_ARG_ENABLE(split-app-modules,
1264     AS_HELP_STRING([--enable-split-app-modules],
1265         [Split file lists for app modules, e.g. base, calc.
1266          Has effect only with make distro-pack-install]),
1269 AC_ARG_ENABLE(split-opt-features,
1270     AS_HELP_STRING([--enable-split-opt-features],
1271         [Split file lists for some optional features, e.g. pyuno, testtool.
1272          Has effect only with make distro-pack-install]),
1275 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1276     AS_HELP_STRING([--disable-cairo-canvas],
1277         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1280 libo_FUZZ_ARG_ENABLE(dbus,
1281     AS_HELP_STRING([--disable-dbus],
1282         [Determines whether to enable features that depend on dbus.
1283          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1284 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1286 libo_FUZZ_ARG_ENABLE(sdremote,
1287     AS_HELP_STRING([--disable-sdremote],
1288         [Determines whether to enable Impress remote control (i.e. the server component).]),
1289 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1291 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1292     AS_HELP_STRING([--disable-sdremote-bluetooth],
1293         [Determines whether to build sdremote with bluetooth support.
1294          Requires dbus on Linux.]))
1296 libo_FUZZ_ARG_ENABLE(gio,
1297     AS_HELP_STRING([--disable-gio],
1298         [Determines whether to use the GIO support.]),
1299 ,test "${enable_gio+set}" = set || enable_gio=yes)
1301 AC_ARG_ENABLE(qt5,
1302     AS_HELP_STRING([--enable-qt5],
1303         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1304          available.]),
1307 AC_ARG_ENABLE(kf5,
1308     AS_HELP_STRING([--enable-kf5],
1309         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1310          KF5 are available.]),
1313 AC_ARG_ENABLE(kde5,
1314     AS_HELP_STRING([--enable-kde5],
1315         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1318 AC_ARG_ENABLE(gtk3_kde5,
1319     AS_HELP_STRING([--enable-gtk3-kde5],
1320         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1321          platforms where Gtk3, Qt5 and Plasma is available.]),
1324 AC_ARG_ENABLE(gui,
1325     AS_HELP_STRING([--disable-gui],
1326         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1327 ,enable_gui=yes)
1329 libo_FUZZ_ARG_ENABLE(randr,
1330     AS_HELP_STRING([--disable-randr],
1331         [Disable RandR support in the vcl project.]),
1332 ,test "${enable_randr+set}" = set || enable_randr=yes)
1334 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1335     AS_HELP_STRING([--disable-gstreamer-1-0],
1336         [Disable building with the gstreamer 1.0 avmedia backend.]),
1337 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1339 libo_FUZZ_ARG_ENABLE(vlc,
1340     AS_HELP_STRING([--enable-vlc],
1341         [Enable building with the (experimental) VLC avmedia backend.]),
1342 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1344 libo_FUZZ_ARG_ENABLE(neon,
1345     AS_HELP_STRING([--disable-neon],
1346         [Disable neon and the compilation of webdav binding.]),
1349 libo_FUZZ_ARG_ENABLE([eot],
1350     [AS_HELP_STRING([--enable-eot],
1351         [Enable support for Embedded OpenType fonts.])],
1352 ,test "${enable_eot+set}" = set || enable_eot=no)
1354 libo_FUZZ_ARG_ENABLE(cve-tests,
1355     AS_HELP_STRING([--disable-cve-tests],
1356         [Prevent CVE tests to be executed]),
1359 libo_FUZZ_ARG_ENABLE(chart-tests,
1360     AS_HELP_STRING([--enable-chart-tests],
1361         [Executes chart XShape tests. In a perfect world these tests would be
1362          stable and everyone could run them, in reality it is best to run them
1363          only on a few machines that are known to work and maintained by people
1364          who can judge if a test failure is a regression or not.]),
1367 AC_ARG_ENABLE(build-unowinreg,
1368     AS_HELP_STRING([--enable-build-unowinreg],
1369         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1370          compiler is needed on Linux.]),
1373 AC_ARG_ENABLE(build-opensymbol,
1374     AS_HELP_STRING([--enable-build-opensymbol],
1375         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1376          fontforge installed.]),
1379 AC_ARG_ENABLE(dependency-tracking,
1380     AS_HELP_STRING([--enable-dependency-tracking],
1381         [Do not reject slow dependency extractors.])[
1382   --disable-dependency-tracking
1383                           Disables generation of dependency information.
1384                           Speed up one-time builds.],
1387 AC_ARG_ENABLE(icecream,
1388     AS_HELP_STRING([--enable-icecream],
1389         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1390          It defaults to /opt/icecream for the location of the icecream gcc/g++
1391          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1394 AC_ARG_ENABLE(ld,
1395     AS_HELP_STRING([--enable-ld=<linker>],
1396         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1397          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1400 libo_FUZZ_ARG_ENABLE(cups,
1401     AS_HELP_STRING([--disable-cups],
1402         [Do not build cups support.])
1405 AC_ARG_ENABLE(ccache,
1406     AS_HELP_STRING([--disable-ccache],
1407         [Do not try to use ccache automatically.
1408          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1409          CC/CXX are not yet set, and --enable-icecream is not given, we
1410          attempt to use ccache. --disable-ccache disables ccache completely.
1411          Additionally ccache's depend mode is enabled if possible,
1412          use --enable-ccache=nodepend to enable ccache without depend mode.
1416 AC_ARG_ENABLE(64-bit,
1417     AS_HELP_STRING([--enable-64-bit],
1418         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1419          At the moment meaningful only for Windows.]), ,)
1421 libo_FUZZ_ARG_ENABLE(online-update,
1422     AS_HELP_STRING([--enable-online-update],
1423         [Enable the online update service that will check for new versions of
1424          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1425          If the value is "mar", the experimental Mozilla-like update will be
1426          enabled instead of the traditional update mechanism.]),
1429 AC_ARG_WITH(update-config,
1430     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1431                    [Path to the update config ini file]))
1433 libo_FUZZ_ARG_ENABLE(extension-update,
1434     AS_HELP_STRING([--disable-extension-update],
1435         [Disable possibility to update installed extensions.]),
1438 libo_FUZZ_ARG_ENABLE(release-build,
1439     AS_HELP_STRING([--enable-release-build],
1440         [Enable release build. Note that the "release build" choice is orthogonal to
1441          whether symbols are present, debug info is generated, or optimization
1442          is done.
1443          See http://wiki.documentfoundation.org/Development/DevBuild]),
1446 AC_ARG_ENABLE(windows-build-signing,
1447     AS_HELP_STRING([--enable-windows-build-signing],
1448         [Enable signing of windows binaries (*.exe, *.dll)]),
1451 AC_ARG_ENABLE(silent-msi,
1452     AS_HELP_STRING([--enable-silent-msi],
1453         [Enable MSI with LIMITUI=1 (silent install).]),
1456 AC_ARG_ENABLE(macosx-code-signing,
1457     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1458         [Sign executables, dylibs, frameworks and the app bundle. If you
1459          don't provide an identity the first suitable certificate
1460          in your keychain is used.]),
1463 AC_ARG_ENABLE(macosx-package-signing,
1464     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1465         [Create a .pkg suitable for uploading to the Mac App Store and sign
1466          it. If you don't provide an identity the first suitable certificate
1467          in your keychain is used.]),
1470 AC_ARG_ENABLE(macosx-sandbox,
1471     AS_HELP_STRING([--enable-macosx-sandbox],
1472         [Make the app bundle run in a sandbox. Requires code signing.
1473          Is required by apps distributed in the Mac App Store, and implies
1474          adherence to App Store rules.]),
1477 AC_ARG_WITH(macosx-bundle-identifier,
1478     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1479         [Define the macOS bundle identifier. Default is the somewhat weird
1480          org.libreoffice.script ("script", huh?).]),
1481 ,with_macosx_bundle_identifier=org.libreoffice.script)
1483 AC_ARG_WITH(product-name,
1484     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1485         [Define the product name. Default is AC_PACKAGE_NAME.]),
1486 ,with_product_name=$PRODUCTNAME)
1488 AC_ARG_WITH(package-version,
1489     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1490         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1493 libo_FUZZ_ARG_ENABLE(readonly-installset,
1494     AS_HELP_STRING([--enable-readonly-installset],
1495         [Prevents any attempts by LibreOffice to write into its installation. That means
1496          at least that no "system-wide" extensions can be added. Partly experimental work in
1497          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1500 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1501     AS_HELP_STRING([--disable-postgresql-sdbc],
1502         [Disable the build of the PostgreSQL-SDBC driver.])
1505 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1506     AS_HELP_STRING([--disable-lotuswordpro],
1507         [Disable the build of the Lotus Word Pro filter.]),
1508 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1510 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1511     AS_HELP_STRING([--disable-firebird-sdbc],
1512         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1513 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1515 AC_ARG_ENABLE(bogus-pkg-config,
1516     AS_HELP_STRING([--enable-bogus-pkg-config],
1517         [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.]),
1520 AC_ARG_ENABLE(openssl,
1521     AS_HELP_STRING([--disable-openssl],
1522         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1523          components will either use GNUTLS or NSS. Work in progress,
1524          use only if you are hacking on it.]),
1525 ,enable_openssl=yes)
1527 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1528     AS_HELP_STRING([--enable-cipher-openssl-backend],
1529         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1530          Requires --enable-openssl.]))
1532 AC_ARG_ENABLE(library-bin-tar,
1533     AS_HELP_STRING([--enable-library-bin-tar],
1534         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1535         Some libraries can save their build result in a tarball
1536         stored in TARFILE_LOCATION. That binary tarball is
1537         uniquely identified by the source tarball,
1538         the content of the config_host.mk file and the content
1539         of the top-level directory in core for that library
1540         If this option is enabled, then if such a tarfile exist, it will be untarred
1541         instead of the source tarfile, and the build step will be skipped for that
1542         library.
1543         If a proper tarfile does not exist, then the normal source-based
1544         build is done for that library and a proper binary tarfile is created
1545         for the next time.]),
1548 AC_ARG_ENABLE(dconf,
1549     AS_HELP_STRING([--disable-dconf],
1550         [Disable the dconf configuration backend (enabled by default where
1551          available).]))
1553 libo_FUZZ_ARG_ENABLE(formula-logger,
1554     AS_HELP_STRING(
1555         [--enable-formula-logger],
1556         [Enable formula logger for logging formula calculation flow in Calc.]
1557     )
1560 AC_ARG_ENABLE(ldap,
1561     AS_HELP_STRING([--disable-ldap],
1562         [Disable LDAP support.]),
1563 ,enable_ldap=yes)
1565 dnl ===================================================================
1566 dnl Optional Packages (--with/without-)
1567 dnl ===================================================================
1569 AC_ARG_WITH(gcc-home,
1570     AS_HELP_STRING([--with-gcc-home],
1571         [Specify the location of gcc/g++ manually. This can be used in conjunction
1572          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1573          non-default path.]),
1576 AC_ARG_WITH(gnu-patch,
1577     AS_HELP_STRING([--with-gnu-patch],
1578         [Specify location of GNU patch on Solaris or FreeBSD.]),
1581 AC_ARG_WITH(build-platform-configure-options,
1582     AS_HELP_STRING([--with-build-platform-configure-options],
1583         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1586 AC_ARG_WITH(gnu-cp,
1587     AS_HELP_STRING([--with-gnu-cp],
1588         [Specify location of GNU cp on Solaris or FreeBSD.]),
1591 AC_ARG_WITH(external-tar,
1592     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1593         [Specify an absolute path of where to find (and store) tarfiles.]),
1594     TARFILE_LOCATION=$withval ,
1597 AC_ARG_WITH(referenced-git,
1598     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1599         [Specify another checkout directory to reference. This makes use of
1600                  git submodule update --reference, and saves a lot of diskspace
1601                  when having multiple trees side-by-side.]),
1602     GIT_REFERENCE_SRC=$withval ,
1605 AC_ARG_WITH(linked-git,
1606     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1607         [Specify a directory where the repositories of submodules are located.
1608          This uses a method similar to git-new-workdir to get submodules.]),
1609     GIT_LINK_SRC=$withval ,
1612 AC_ARG_WITH(galleries,
1613     AS_HELP_STRING([--with-galleries],
1614         [Specify how galleries should be built. It is possible either to
1615          build these internally from source ("build"),
1616          or to disable them ("no")]),
1619 AC_ARG_WITH(theme,
1620     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1621         [Choose which themes to include. By default those themes with an '*' are included.
1622          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1623          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg, *tango.]),
1626 libo_FUZZ_ARG_WITH(helppack-integration,
1627     AS_HELP_STRING([--without-helppack-integration],
1628         [It will not integrate the helppacks to the installer
1629          of the product. Please use this switch to use the online help
1630          or separate help packages.]),
1633 libo_FUZZ_ARG_WITH(fonts,
1634     AS_HELP_STRING([--without-fonts],
1635         [LibreOffice includes some third-party fonts to provide a reliable basis for
1636          help content, templates, samples, etc. When these fonts are already
1637          known to be available on the system then you should use this option.]),
1640 AC_ARG_WITH(epm,
1641     AS_HELP_STRING([--with-epm],
1642         [Decides which epm to use. Default is to use the one from the system if
1643          one is built. When either this is not there or you say =internal epm
1644          will be built.]),
1647 AC_ARG_WITH(package-format,
1648     AS_HELP_STRING([--with-package-format],
1649         [Specify package format(s) for LibreOffice installation sets. The
1650          implicit --without-package-format leads to no installation sets being
1651          generated. Possible values: aix, archive, bsd, deb, dmg,
1652          installed, msi, pkg, and rpm.
1653          Example: --with-package-format='deb rpm']),
1656 AC_ARG_WITH(tls,
1657     AS_HELP_STRING([--with-tls],
1658         [Decides which TLS/SSL and cryptographic implementations to use for
1659          LibreOffice's code. Notice that this doesn't apply for depending
1660          libraries like "neon", for example. Default is to use NSS
1661          although OpenSSL is also possible. Notice that selecting NSS restricts
1662          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1663          restrict by now the usage of NSS in LO's code. Possible values:
1664          openssl, nss. Example: --with-tls="nss"]),
1667 AC_ARG_WITH(system-libs,
1668     AS_HELP_STRING([--with-system-libs],
1669         [Use libraries already on system -- enables all --with-system-* flags.]),
1672 AC_ARG_WITH(system-bzip2,
1673     AS_HELP_STRING([--with-system-bzip2],
1674         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1675     [with_system_bzip2="$with_system_libs"])
1677 AC_ARG_WITH(system-headers,
1678     AS_HELP_STRING([--with-system-headers],
1679         [Use headers already on system -- enables all --with-system-* flags for
1680          external packages whose headers are the only entities used i.e.
1681          boost/odbc/sane-header(s).]),,
1682     [with_system_headers="$with_system_libs"])
1684 AC_ARG_WITH(system-jars,
1685     AS_HELP_STRING([--without-system-jars],
1686         [When building with --with-system-libs, also the needed jars are expected
1687          on the system. Use this to disable that]),,
1688     [with_system_jars="$with_system_libs"])
1690 AC_ARG_WITH(system-cairo,
1691     AS_HELP_STRING([--with-system-cairo],
1692         [Use cairo libraries already on system.  Happens automatically for
1693          (implicit) --enable-gtk3.]))
1695 AC_ARG_WITH(system-epoxy,
1696     AS_HELP_STRING([--with-system-epoxy],
1697         [Use epoxy libraries already on system.  Happens automatically for
1698          (implicit) --enable-gtk3.]),,
1699        [with_system_epoxy="$with_system_libs"])
1701 AC_ARG_WITH(myspell-dicts,
1702     AS_HELP_STRING([--with-myspell-dicts],
1703         [Adds myspell dictionaries to the LibreOffice installation set]),
1706 AC_ARG_WITH(system-dicts,
1707     AS_HELP_STRING([--without-system-dicts],
1708         [Do not use dictionaries from system paths.]),
1711 AC_ARG_WITH(external-dict-dir,
1712     AS_HELP_STRING([--with-external-dict-dir],
1713         [Specify external dictionary dir.]),
1716 AC_ARG_WITH(external-hyph-dir,
1717     AS_HELP_STRING([--with-external-hyph-dir],
1718         [Specify external hyphenation pattern dir.]),
1721 AC_ARG_WITH(external-thes-dir,
1722     AS_HELP_STRING([--with-external-thes-dir],
1723         [Specify external thesaurus dir.]),
1726 AC_ARG_WITH(system-zlib,
1727     AS_HELP_STRING([--with-system-zlib],
1728         [Use zlib already on system.]),,
1729     [with_system_zlib=auto])
1731 AC_ARG_WITH(system-jpeg,
1732     AS_HELP_STRING([--with-system-jpeg],
1733         [Use jpeg already on system.]),,
1734     [with_system_jpeg="$with_system_libs"])
1736 AC_ARG_WITH(system-clucene,
1737     AS_HELP_STRING([--with-system-clucene],
1738         [Use clucene already on system.]),,
1739     [with_system_clucene="$with_system_libs"])
1741 AC_ARG_WITH(system-expat,
1742     AS_HELP_STRING([--with-system-expat],
1743         [Use expat already on system.]),,
1744     [with_system_expat="$with_system_libs"])
1746 AC_ARG_WITH(system-libxml,
1747     AS_HELP_STRING([--with-system-libxml],
1748         [Use libxml/libxslt already on system.]),,
1749     [with_system_libxml=auto])
1751 AC_ARG_WITH(system-icu,
1752     AS_HELP_STRING([--with-system-icu],
1753         [Use icu already on system.]),,
1754     [with_system_icu="$with_system_libs"])
1756 AC_ARG_WITH(system-ucpp,
1757     AS_HELP_STRING([--with-system-ucpp],
1758         [Use ucpp already on system.]),,
1759     [])
1761 AC_ARG_WITH(system-openldap,
1762     AS_HELP_STRING([--with-system-openldap],
1763         [Use the OpenLDAP LDAP SDK already on system.]),,
1764     [with_system_openldap="$with_system_libs"])
1766 libo_FUZZ_ARG_ENABLE(poppler,
1767     AS_HELP_STRING([--disable-poppler],
1768         [Disable building Poppler.])
1771 AC_ARG_WITH(system-poppler,
1772     AS_HELP_STRING([--with-system-poppler],
1773         [Use system poppler (only needed for PDF import).]),,
1774     [with_system_poppler="$with_system_libs"])
1776 AC_ARG_WITH(system-gpgmepp,
1777     AS_HELP_STRING([--with-system-gpgmepp],
1778         [Use gpgmepp already on system]),,
1779     [with_system_gpgmepp="$with_system_libs"])
1781 AC_ARG_WITH(system-apache-commons,
1782     AS_HELP_STRING([--with-system-apache-commons],
1783         [Use Apache commons libraries already on system.]),,
1784     [with_system_apache_commons="$with_system_jars"])
1786 AC_ARG_WITH(system-mariadb,
1787     AS_HELP_STRING([--with-system-mariadb],
1788         [Use MariaDB/MySQL libraries already on system.]),,
1789     [with_system_mariadb="$with_system_libs"])
1791 AC_ARG_ENABLE(bundle-mariadb,
1792     AS_HELP_STRING([--enable-bundle-mariadb],
1793         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1796 AC_ARG_WITH(system-postgresql,
1797     AS_HELP_STRING([--with-system-postgresql],
1798         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1799          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1800     [with_system_postgresql="$with_system_libs"])
1802 AC_ARG_WITH(libpq-path,
1803     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1804         [Use this PostgreSQL C interface (libpq) installation for building
1805          the PostgreSQL-SDBC extension.]),
1808 AC_ARG_WITH(system-firebird,
1809     AS_HELP_STRING([--with-system-firebird],
1810         [Use Firebird libraries already on system, for building the Firebird-SDBC
1811          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1812     [with_system_firebird="$with_system_libs"])
1814 AC_ARG_WITH(system-libtommath,
1815             AS_HELP_STRING([--with-system-libtommath],
1816                            [Use libtommath already on system]),,
1817             [with_system_libtommath="$with_system_libs"])
1819 AC_ARG_WITH(system-hsqldb,
1820     AS_HELP_STRING([--with-system-hsqldb],
1821         [Use hsqldb already on system.]))
1823 AC_ARG_WITH(hsqldb-jar,
1824     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1825         [Specify path to jarfile manually.]),
1826     HSQLDB_JAR=$withval)
1828 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1829     AS_HELP_STRING([--disable-scripting-beanshell],
1830         [Disable support for scripts in BeanShell.]),
1834 AC_ARG_WITH(system-beanshell,
1835     AS_HELP_STRING([--with-system-beanshell],
1836         [Use beanshell already on system.]),,
1837     [with_system_beanshell="$with_system_jars"])
1839 AC_ARG_WITH(beanshell-jar,
1840     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1841         [Specify path to jarfile manually.]),
1842     BSH_JAR=$withval)
1844 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1845     AS_HELP_STRING([--disable-scripting-javascript],
1846         [Disable support for scripts in JavaScript.]),
1850 AC_ARG_WITH(system-rhino,
1851     AS_HELP_STRING([--with-system-rhino],
1852         [Use rhino already on system.]),,)
1853 #    [with_system_rhino="$with_system_jars"])
1854 # Above is not used as we have different debug interface
1855 # patched into internal rhino. This code needs to be fixed
1856 # before we can enable it by default.
1858 AC_ARG_WITH(rhino-jar,
1859     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1860         [Specify path to jarfile manually.]),
1861     RHINO_JAR=$withval)
1863 AC_ARG_WITH(commons-logging-jar,
1864     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1865         [Specify path to jarfile manually.]),
1866     COMMONS_LOGGING_JAR=$withval)
1868 AC_ARG_WITH(system-jfreereport,
1869     AS_HELP_STRING([--with-system-jfreereport],
1870         [Use JFreeReport already on system.]),,
1871     [with_system_jfreereport="$with_system_jars"])
1873 AC_ARG_WITH(sac-jar,
1874     AS_HELP_STRING([--with-sac-jar=JARFILE],
1875         [Specify path to jarfile manually.]),
1876     SAC_JAR=$withval)
1878 AC_ARG_WITH(libxml-jar,
1879     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1880         [Specify path to jarfile manually.]),
1881     LIBXML_JAR=$withval)
1883 AC_ARG_WITH(flute-jar,
1884     AS_HELP_STRING([--with-flute-jar=JARFILE],
1885         [Specify path to jarfile manually.]),
1886     FLUTE_JAR=$withval)
1888 AC_ARG_WITH(jfreereport-jar,
1889     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1890         [Specify path to jarfile manually.]),
1891     JFREEREPORT_JAR=$withval)
1893 AC_ARG_WITH(liblayout-jar,
1894     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1895         [Specify path to jarfile manually.]),
1896     LIBLAYOUT_JAR=$withval)
1898 AC_ARG_WITH(libloader-jar,
1899     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1900         [Specify path to jarfile manually.]),
1901     LIBLOADER_JAR=$withval)
1903 AC_ARG_WITH(libformula-jar,
1904     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1905         [Specify path to jarfile manually.]),
1906     LIBFORMULA_JAR=$withval)
1908 AC_ARG_WITH(librepository-jar,
1909     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1910         [Specify path to jarfile manually.]),
1911     LIBREPOSITORY_JAR=$withval)
1913 AC_ARG_WITH(libfonts-jar,
1914     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1915         [Specify path to jarfile manually.]),
1916     LIBFONTS_JAR=$withval)
1918 AC_ARG_WITH(libserializer-jar,
1919     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1920         [Specify path to jarfile manually.]),
1921     LIBSERIALIZER_JAR=$withval)
1923 AC_ARG_WITH(libbase-jar,
1924     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1925         [Specify path to jarfile manually.]),
1926     LIBBASE_JAR=$withval)
1928 AC_ARG_WITH(system-odbc,
1929     AS_HELP_STRING([--with-system-odbc],
1930         [Use the odbc headers already on system.]),,
1931     [with_system_odbc="auto"])
1933 AC_ARG_WITH(system-sane,
1934     AS_HELP_STRING([--with-system-sane],
1935         [Use sane.h already on system.]),,
1936     [with_system_sane="$with_system_headers"])
1938 AC_ARG_WITH(system-bluez,
1939     AS_HELP_STRING([--with-system-bluez],
1940         [Use bluetooth.h already on system.]),,
1941     [with_system_bluez="$with_system_headers"])
1943 AC_ARG_WITH(system-curl,
1944     AS_HELP_STRING([--with-system-curl],
1945         [Use curl already on system.]),,
1946     [with_system_curl=auto])
1948 AC_ARG_WITH(system-boost,
1949     AS_HELP_STRING([--with-system-boost],
1950         [Use boost already on system.]),,
1951     [with_system_boost="$with_system_headers"])
1953 AC_ARG_WITH(system-glm,
1954     AS_HELP_STRING([--with-system-glm],
1955         [Use glm already on system.]),,
1956     [with_system_glm="$with_system_headers"])
1958 AC_ARG_WITH(system-hunspell,
1959     AS_HELP_STRING([--with-system-hunspell],
1960         [Use libhunspell already on system.]),,
1961     [with_system_hunspell="$with_system_libs"])
1963 AC_ARG_WITH(system-qrcodegen,
1964     AS_HELP_STRING([--with-system-qrcodegen],
1965         [Use libqrcodegen already on system.]),,
1966     [with_system_qrcodegen="$with_system_libs"])
1968 AC_ARG_WITH(system-mythes,
1969     AS_HELP_STRING([--with-system-mythes],
1970         [Use mythes already on system.]),,
1971     [with_system_mythes="$with_system_libs"])
1973 AC_ARG_WITH(system-altlinuxhyph,
1974     AS_HELP_STRING([--with-system-altlinuxhyph],
1975         [Use ALTLinuxhyph already on system.]),,
1976     [with_system_altlinuxhyph="$with_system_libs"])
1978 AC_ARG_WITH(system-lpsolve,
1979     AS_HELP_STRING([--with-system-lpsolve],
1980         [Use lpsolve already on system.]),,
1981     [with_system_lpsolve="$with_system_libs"])
1983 AC_ARG_WITH(system-coinmp,
1984     AS_HELP_STRING([--with-system-coinmp],
1985         [Use CoinMP already on system.]),,
1986     [with_system_coinmp="$with_system_libs"])
1988 AC_ARG_WITH(system-liblangtag,
1989     AS_HELP_STRING([--with-system-liblangtag],
1990         [Use liblangtag library already on system.]),,
1991     [with_system_liblangtag="$with_system_libs"])
1993 AC_ARG_WITH(webdav,
1994     AS_HELP_STRING([--with-webdav],
1995         [Specify which library to use for webdav implementation.
1996          Possible values: "neon", "serf", "no". The default value is "neon".
1997          Example: --with-webdav="serf"]),
1998     WITH_WEBDAV=$withval,
1999     WITH_WEBDAV="neon")
2001 AC_ARG_WITH(linker-hash-style,
2002     AS_HELP_STRING([--with-linker-hash-style],
2003         [Use linker with --hash-style=<style> when linking shared objects.
2004          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2005          if supported on the build system, and "sysv" otherwise.]))
2007 AC_ARG_WITH(jdk-home,
2008     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2009         [If you have installed JDK 8 or later on your system please supply the
2010          path here. Note that this is not the location of the java command but the
2011          location of the entire distribution.]),
2014 AC_ARG_WITH(help,
2015     AS_HELP_STRING([--with-help],
2016         [Enable the build of help. There is a special parameter "common" that
2017          can be used to bundle only the common part, .e.g help-specific icons.
2018          This is useful when you build the helpcontent separately.])
2019     [
2020                           Usage:     --with-help    build the old local help
2021                                  --without-help     no local help (default)
2022                                  --with-help=html   build the new HTML local help
2023                                  --with-help=online build the new HTML online help
2024     ],
2027 AC_ARG_WITH(omindex,
2028    AS_HELP_STRING([--with-omindex],
2029         [Enable the support of xapian-omega index for online help.])
2030    [
2031                          Usage: --with-omindex=server prepare the pages for omindex
2032                                 but let xapian-omega be built in server.
2033                                 --with-omindex=noxap do not prepare online pages
2034                                 for xapian-omega
2035   ],
2038 libo_FUZZ_ARG_WITH(java,
2039     AS_HELP_STRING([--with-java=<java command>],
2040         [Specify the name of the Java interpreter command. Typically "java"
2041          which is the default.
2043          To build without support for Java components, applets, accessibility
2044          or the XML filters written in Java, use --without-java or --with-java=no.]),
2045     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2046     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2049 AC_ARG_WITH(jvm-path,
2050     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2051         [Use a specific JVM search path at runtime.
2052          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2055 AC_ARG_WITH(ant-home,
2056     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2057         [If you have installed Apache Ant on your system, please supply the path here.
2058          Note that this is not the location of the Ant binary but the location
2059          of the entire distribution.]),
2062 AC_ARG_WITH(symbol-config,
2063     AS_HELP_STRING([--with-symbol-config],
2064         [Configuration for the crashreport symbol upload]),
2065         [],
2066         [with_symbol_config=no])
2068 AC_ARG_WITH(export-validation,
2069     AS_HELP_STRING([--without-export-validation],
2070         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2071 ,with_export_validation=auto)
2073 AC_ARG_WITH(bffvalidator,
2074     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2075         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2076          Requires installed Microsoft Office Binary File Format Validator.
2077          Note: export-validation (--with-export-validation) is required to be turned on.
2078          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2079 ,with_bffvalidator=no)
2081 libo_FUZZ_ARG_WITH(junit,
2082     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2083         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2084          --without-junit disables those tests. Not relevant in the --without-java case.]),
2085 ,with_junit=yes)
2087 AC_ARG_WITH(hamcrest,
2088     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2089         [Specifies the hamcrest jar file to use for JUnit-based tests.
2090          --without-junit disables those tests. Not relevant in the --without-java case.]),
2091 ,with_hamcrest=yes)
2093 AC_ARG_WITH(perl-home,
2094     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2095         [If you have installed Perl 5 Distribution, on your system, please
2096          supply the path here. Note that this is not the location of the Perl
2097          binary but the location of the entire distribution.]),
2100 libo_FUZZ_ARG_WITH(doxygen,
2101     AS_HELP_STRING(
2102         [--with-doxygen=<absolute path to doxygen executable>],
2103         [Specifies the doxygen executable to use when generating ODK C/C++
2104          documentation. --without-doxygen disables generation of ODK C/C++
2105          documentation. Not relevant in the --disable-odk case.]),
2106 ,with_doxygen=yes)
2108 AC_ARG_WITH(visual-studio,
2109     AS_HELP_STRING([--with-visual-studio=<2019>],
2110         [Specify which Visual Studio version to use in case several are
2111          installed. Currently only 2019 (default) is supported.]),
2114 AC_ARG_WITH(windows-sdk,
2115     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2116         [Specify which Windows SDK, or "Windows Kit", version to use
2117          in case the one that came with the selected Visual Studio
2118          is not what you want for some reason. Note that not all compiler/SDK
2119          combinations are supported. The intent is that this option should not
2120          be needed.]),
2123 AC_ARG_WITH(lang,
2124     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2125         [Use this option to build LibreOffice with additional UI language support.
2126          English (US) is always included by default.
2127          Separate multiple languages with space.
2128          For all languages, use --with-lang=ALL.]),
2131 AC_ARG_WITH(locales,
2132     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2133         [Use this option to limit the locale information built in.
2134          Separate multiple locales with space.
2135          Very experimental and might well break stuff.
2136          Just a desperate measure to shrink code and data size.
2137          By default all the locales available is included.
2138          This option is completely unrelated to --with-lang.])
2139     [
2140                           Affects also our character encoding conversion
2141                           tables for encodings mainly targeted for a
2142                           particular locale, like EUC-CN and EUC-TW for
2143                           zh, ISO-2022-JP for ja.
2145                           Affects also our add-on break iterator data for
2146                           some languages.
2148                           For the default, all locales, don't use this switch at all.
2149                           Specifying just the language part of a locale means all matching
2150                           locales will be included.
2151     ],
2154 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2155 libo_FUZZ_ARG_WITH(krb5,
2156     AS_HELP_STRING([--with-krb5],
2157         [Enable MIT Kerberos 5 support in modules that support it.
2158          By default automatically enabled on platforms
2159          where a good system Kerberos 5 is available.]),
2162 libo_FUZZ_ARG_WITH(gssapi,
2163     AS_HELP_STRING([--with-gssapi],
2164         [Enable GSSAPI support in modules that support it.
2165          By default automatically enabled on platforms
2166          where a good system GSSAPI is available.]),
2169 AC_ARG_WITH(iwyu,
2170     AS_HELP_STRING([--with-iwyu],
2171         [Use given IWYU binary path to check unneeded includes instead of building.
2172          Use only if you are hacking on it.]),
2175 libo_FUZZ_ARG_WITH(lxml,
2176     AS_HELP_STRING([--without-lxml],
2177         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2178          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2179          report widget classes and ids.]),
2182 dnl ===================================================================
2183 dnl Branding
2184 dnl ===================================================================
2186 AC_ARG_WITH(branding,
2187     AS_HELP_STRING([--with-branding=/path/to/images],
2188         [Use given path to retrieve branding images set.])
2189     [
2190                           Search for intro.png about.svg and flat_logo.svg.
2191                           If any is missing, default ones will be used instead.
2193                           Search also progress.conf for progress
2194                           settings on intro screen :
2196                           PROGRESSBARCOLOR="255,255,255" Set color of
2197                           progress bar. Comma separated RGB decimal values.
2198                           PROGRESSSIZE="407,6" Set size of progress bar.
2199                           Comma separated decimal values (width, height).
2200                           PROGRESSPOSITION="61,317" Set position of progress
2201                           bar from left,top. Comma separated decimal values.
2202                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2203                           bar frame. Comma separated RGB decimal values.
2204                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2205                           bar text. Comma separated RGB decimal values.
2206                           PROGRESSTEXTBASELINE="287" Set vertical position of
2207                           progress bar text from top. Decimal value.
2209                           Default values will be used if not found.
2210     ],
2214 AC_ARG_WITH(extra-buildid,
2215     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2216         [Show addition build identification in about dialog.]),
2220 AC_ARG_WITH(vendor,
2221     AS_HELP_STRING([--with-vendor="John the Builder"],
2222         [Set vendor of the build.]),
2225 AC_ARG_WITH(android-package-name,
2226     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2227         [Set Android package name of the build.]),
2230 AC_ARG_WITH(compat-oowrappers,
2231     AS_HELP_STRING([--with-compat-oowrappers],
2232         [Install oo* wrappers in parallel with
2233          lo* ones to keep backward compatibility.
2234          Has effect only with make distro-pack-install]),
2237 AC_ARG_WITH(os-version,
2238     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2239         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2242 AC_ARG_WITH(mingw-cross-compiler,
2243     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2244         [Specify the MinGW cross-compiler to use.
2245          When building on the ODK on Unix and building unowinreg.dll,
2246          specify the MinGW C++ cross-compiler.]),
2249 AC_ARG_WITH(idlc-cpp,
2250     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2251         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2254 AC_ARG_WITH(build-version,
2255     AS_HELP_STRING([--with-build-version="Built by Jim"],
2256         [Allows the builder to add a custom version tag that will appear in the
2257          Help/About box for QA purposes.]),
2258 with_build_version=$withval,
2261 AC_ARG_WITH(parallelism,
2262     AS_HELP_STRING([--with-parallelism],
2263         [Number of jobs to run simultaneously during build. Parallel builds can
2264         save a lot of time on multi-cpu machines. Defaults to the number of
2265         CPUs on the machine, unless you configure --enable-icecream - then to
2266         40.]),
2269 AC_ARG_WITH(all-tarballs,
2270     AS_HELP_STRING([--with-all-tarballs],
2271         [Download all external tarballs unconditionally]))
2273 AC_ARG_WITH(gdrive-client-id,
2274     AS_HELP_STRING([--with-gdrive-client-id],
2275         [Provides the client id of the application for OAuth2 authentication
2276         on Google Drive. If either this or --with-gdrive-client-secret is
2277         empty, the feature will be disabled]),
2280 AC_ARG_WITH(gdrive-client-secret,
2281     AS_HELP_STRING([--with-gdrive-client-secret],
2282         [Provides the client secret of the application for OAuth2
2283         authentication on Google Drive. If either this or
2284         --with-gdrive-client-id is empty, the feature will be disabled]),
2287 AC_ARG_WITH(alfresco-cloud-client-id,
2288     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2289         [Provides the client id of the application for OAuth2 authentication
2290         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2291         empty, the feature will be disabled]),
2294 AC_ARG_WITH(alfresco-cloud-client-secret,
2295     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2296         [Provides the client secret of the application for OAuth2
2297         authentication on Alfresco Cloud. If either this or
2298         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2301 AC_ARG_WITH(onedrive-client-id,
2302     AS_HELP_STRING([--with-onedrive-client-id],
2303         [Provides the client id of the application for OAuth2 authentication
2304         on OneDrive. If either this or --with-onedrive-client-secret is
2305         empty, the feature will be disabled]),
2308 AC_ARG_WITH(onedrive-client-secret,
2309     AS_HELP_STRING([--with-onedrive-client-secret],
2310         [Provides the client secret of the application for OAuth2
2311         authentication on OneDrive. If either this or
2312         --with-onedrive-client-id is empty, the feature will be disabled]),
2314 dnl ===================================================================
2315 dnl Do we want to use pre-build binary tarball for recompile
2316 dnl ===================================================================
2318 if test "$enable_library_bin_tar" = "yes" ; then
2319     USE_LIBRARY_BIN_TAR=TRUE
2320 else
2321     USE_LIBRARY_BIN_TAR=
2323 AC_SUBST(USE_LIBRARY_BIN_TAR)
2325 dnl ===================================================================
2326 dnl Test whether build target is Release Build
2327 dnl ===================================================================
2328 AC_MSG_CHECKING([whether build target is Release Build])
2329 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2330     AC_MSG_RESULT([no])
2331     ENABLE_RELEASE_BUILD=
2332 else
2333     AC_MSG_RESULT([yes])
2334     ENABLE_RELEASE_BUILD=TRUE
2336 AC_SUBST(ENABLE_RELEASE_BUILD)
2338 dnl ===================================================================
2339 dnl Test whether to sign Windows Build
2340 dnl ===================================================================
2341 AC_MSG_CHECKING([whether to sign windows build])
2342 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2343     AC_MSG_RESULT([yes])
2344     WINDOWS_BUILD_SIGNING="TRUE"
2345 else
2346     AC_MSG_RESULT([no])
2347     WINDOWS_BUILD_SIGNING="FALSE"
2349 AC_SUBST(WINDOWS_BUILD_SIGNING)
2351 dnl ===================================================================
2352 dnl MacOSX build and runtime environment options
2353 dnl ===================================================================
2355 AC_ARG_WITH(macosx-sdk,
2356     AS_HELP_STRING([--with-macosx-sdk=<version>],
2357         [Prefer a specific SDK for building.])
2358     [
2359                           If the requested SDK is not available, a search for the oldest one will be done.
2360                           With current Xcode versions, only the latest SDK is included, so this option is
2361                           not terribly useful. It works fine to build with a new SDK and run the result
2362                           on an older OS.
2364                           e. g.: --with-macosx-sdk=10.10
2366                           there are 3 options to control the MacOSX build:
2367                           --with-macosx-sdk (referred as 'sdk' below)
2368                           --with-macosx-version-min-required (referred as 'min' below)
2369                           --with-macosx-version-max-allowed (referred as 'max' below)
2371                           the connection between these value and the default they take is as follow:
2372                           ( ? means not specified on the command line, s means the SDK version found,
2373                           constraint: 8 <= x <= y <= z)
2375                           ==========================================
2376                            command line      || config result
2377                           ==========================================
2378                           min  | max  | sdk  || min   | max  | sdk  |
2379                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2380                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2381                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2382                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2383                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2384                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2385                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2386                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2389                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2390                           for a detailed technical explanation of these variables
2392                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2393     ],
2396 AC_ARG_WITH(macosx-version-min-required,
2397     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2398         [set the minimum OS version needed to run the built LibreOffice])
2399     [
2400                           e. g.: --with-macos-version-min-required=10.10
2401                           see --with-macosx-sdk for more info
2402     ],
2405 AC_ARG_WITH(macosx-version-max-allowed,
2406     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2407         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2408     [
2409                           e. g.: --with-macos-version-max-allowed=10.10
2410                           see --with-macosx-sdk for more info
2411     ],
2415 dnl ===================================================================
2416 dnl options for stuff used during cross-compilation build
2417 dnl Not quite superseded by --with-build-platform-configure-options.
2418 dnl TODO: check, if the "force" option is still needed anywhere.
2419 dnl ===================================================================
2421 AC_ARG_WITH(system-icu-for-build,
2422     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2423         [Use icu already on system for build tools (cross-compilation only).]))
2426 dnl ===================================================================
2427 dnl Check for incompatible options set by fuzzing, and reset those
2428 dnl automatically to working combinations
2429 dnl ===================================================================
2431 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2432         "$enable_dbus" != "$enable_avahi"; then
2433     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2434     enable_avahi=$enable_dbus
2437 add_lopath_after ()
2439     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2440         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2441     fi
2444 add_lopath_before ()
2446     local IFS=${P_SEP}
2447     local path_cleanup
2448     local dir
2449     for dir in $LO_PATH ; do
2450         if test "$dir" != "$1" ; then
2451             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2452         fi
2453     done
2454     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2457 dnl ===================================================================
2458 dnl check for required programs (grep, awk, sed, bash)
2459 dnl ===================================================================
2461 pathmunge ()
2463     if test -n "$1"; then
2464         if test "$build_os" = "cygwin"; then
2465             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2466                 PathFormat "$1"
2467                 new_path=`cygpath -sm "$formatted_path"`
2468             else
2469                 PathFormat "$1"
2470                 new_path=`cygpath -u "$formatted_path"`
2471             fi
2472         else
2473             new_path="$1"
2474         fi
2475         if test "$2" = "after"; then
2476             add_lopath_after "$new_path"
2477         else
2478             add_lopath_before "$new_path"
2479         fi
2480         unset new_path
2481     fi
2484 AC_PROG_AWK
2485 AC_PATH_PROG( AWK, $AWK)
2486 if test -z "$AWK"; then
2487     AC_MSG_ERROR([install awk to run this script])
2490 AC_PATH_PROG(BASH, bash)
2491 if test -z "$BASH"; then
2492     AC_MSG_ERROR([bash not found in \$PATH])
2494 AC_SUBST(BASH)
2496 AC_MSG_CHECKING([for GNU or BSD tar])
2497 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2498     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2499     if test $? -eq 0;  then
2500         GNUTAR=$a
2501         break
2502     fi
2503 done
2504 AC_MSG_RESULT($GNUTAR)
2505 if test -z "$GNUTAR"; then
2506     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2508 AC_SUBST(GNUTAR)
2510 AC_MSG_CHECKING([for tar's option to strip components])
2511 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2512 if test $? -eq 0; then
2513     STRIP_COMPONENTS="--strip-components"
2514 else
2515     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2516     if test $? -eq 0; then
2517         STRIP_COMPONENTS="--strip-path"
2518     else
2519         STRIP_COMPONENTS="unsupported"
2520     fi
2522 AC_MSG_RESULT($STRIP_COMPONENTS)
2523 if test x$STRIP_COMPONENTS = xunsupported; then
2524     AC_MSG_ERROR([you need a tar that is able to strip components.])
2526 AC_SUBST(STRIP_COMPONENTS)
2528 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2529 dnl desktop OSes from "mobile" ones.
2531 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2532 dnl In other words, that when building for an OS that is not a
2533 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2535 dnl Note the direction of the implication; there is no assumption that
2536 dnl cross-compiling would imply a non-desktop OS.
2538 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2539     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2540     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2541     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2544 # Whether to build "avmedia" functionality or not.
2546 if test -z "$enable_avmedia"; then
2547     enable_avmedia=yes
2550 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2551 if test "$enable_avmedia" = yes; then
2552     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2553 else
2554     USE_AVMEDIA_DUMMY='TRUE'
2556 AC_SUBST(USE_AVMEDIA_DUMMY)
2558 # Decide whether to build database connectivity stuff (including
2559 # Base) or not. We probably don't want to on non-desktop OSes.
2560 if test -z "$enable_database_connectivity"; then
2561     # --disable-database-connectivity is unfinished work in progress
2562     # and the iOS test app doesn't link if we actually try to use it.
2563     # if test $_os != iOS -a $_os != Android; then
2564     if test $_os != iOS; then
2565         enable_database_connectivity=yes
2566     fi
2569 if test "$enable_database_connectivity" = yes; then
2570     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2571     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2574 if test -z "$enable_extensions"; then
2575     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2576     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2577         enable_extensions=yes
2578     fi
2581 if test "$enable_extensions" = yes; then
2582     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2583     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2586 if test -z "$enable_scripting"; then
2587     # Disable scripting for iOS unless specifically overridden
2588     # with --enable-scripting.
2589     if test $_os != iOS; then
2590         enable_scripting=yes
2591     fi
2594 DISABLE_SCRIPTING=''
2595 if test "$enable_scripting" = yes; then
2596     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2597     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2598 else
2599     DISABLE_SCRIPTING='TRUE'
2600     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2603 if test $_os = iOS -o $_os = Android; then
2604     # Disable dynamic_loading always for iOS and Android
2605     enable_dynamic_loading=no
2606 elif test -z "$enable_dynamic_loading"; then
2607     # Otherwise enable it unless specifically disabled
2608     enable_dynamic_loading=yes
2611 DISABLE_DYNLOADING=''
2612 if test "$enable_dynamic_loading" = yes; then
2613     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2614 else
2615     DISABLE_DYNLOADING='TRUE'
2617 AC_SUBST(DISABLE_DYNLOADING)
2619 # remember SYSBASE value
2620 AC_SUBST(SYSBASE)
2622 dnl ===================================================================
2623 dnl  Sort out various gallery compilation options
2624 dnl ===================================================================
2625 AC_MSG_CHECKING([how to build and package galleries])
2626 if test -n "${with_galleries}"; then
2627     if test "$with_galleries" = "build"; then
2628         WITH_GALLERY_BUILD=TRUE
2629         AC_MSG_RESULT([build from source images internally])
2630     elif test "$with_galleries" = "no"; then
2631         WITH_GALLERY_BUILD=
2632         AC_MSG_RESULT([disable non-internal gallery build])
2633     else
2634         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2635     fi
2636 else
2637     if test $_os != iOS -a $_os != Android; then
2638         WITH_GALLERY_BUILD=TRUE
2639         AC_MSG_RESULT([internal src images for desktop])
2640     else
2641         WITH_GALLERY_BUILD=
2642         AC_MSG_RESULT([disable src image build])
2643     fi
2645 AC_SUBST(WITH_GALLERY_BUILD)
2647 dnl ===================================================================
2648 dnl  Checks if ccache is available
2649 dnl ===================================================================
2650 CCACHE_DEPEND_MODE=
2651 if test "$_os" = "WINNT"; then
2652     # on windows/VC build do not use ccache
2653     CCACHE=""
2654 elif test "$enable_ccache" = "no"; then
2655     CCACHE=""
2656 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2657     case "%$CC%$CXX%" in
2658     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2659     # assume that's good then
2660     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2661         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2662         CCACHE_DEPEND_MODE=1
2663         ;;
2664     *)
2665         AC_PATH_PROG([CCACHE],[ccache],[not found])
2666         if test "$CCACHE" = "not found"; then
2667             CCACHE=""
2668         else
2669             CCACHE_DEPEND_MODE=1
2670             # Need to check for ccache version: otherwise prevents
2671             # caching of the results (like "-x objective-c++" for Mac)
2672             if test $_os = Darwin -o $_os = iOS; then
2673                 # Check ccache version
2674                 AC_MSG_CHECKING([whether version of ccache is suitable])
2675                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2676                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2677                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2678                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2679                 else
2680                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2681                     CCACHE=""
2682                     CCACHE_DEPEND_MODE=
2683                 fi
2684             fi
2685         fi
2686         ;;
2687     esac
2688 else
2689     CCACHE=""
2691 if test "$enable_ccache" = "nodepend"; then
2692     CCACHE_DEPEND_MODE=""
2694 AC_SUBST(CCACHE_DEPEND_MODE)
2696 if test "$CCACHE" != ""; then
2697     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2698     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2699     if test "$ccache_size" = ""; then
2700         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2701         if test "$ccache_size" = ""; then
2702             ccache_size=0
2703         fi
2704         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2705         if test $ccache_size -lt 1024; then
2706             CCACHE=""
2707             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2708             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2709         else
2710             # warn that ccache may be too small for debug build
2711             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2712             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2713         fi
2714     else
2715         if test $ccache_size -lt 5; then
2716             #warn that ccache may be too small for debug build
2717             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2718             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2719         fi
2720     fi
2723 dnl ===================================================================
2724 dnl  Checks for C compiler,
2725 dnl  The check for the C++ compiler is later on.
2726 dnl ===================================================================
2727 if test "$_os" != "WINNT"; then
2728     GCC_HOME_SET="true"
2729     AC_MSG_CHECKING([gcc home])
2730     if test -z "$with_gcc_home"; then
2731         if test "$enable_icecream" = "yes"; then
2732             if test -d "/usr/lib/icecc/bin"; then
2733                 GCC_HOME="/usr/lib/icecc/"
2734             elif test -d "/usr/libexec/icecc/bin"; then
2735                 GCC_HOME="/usr/libexec/icecc/"
2736             elif test -d "/opt/icecream/bin"; then
2737                 GCC_HOME="/opt/icecream/"
2738             else
2739                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2741             fi
2742         else
2743             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2744             GCC_HOME_SET="false"
2745         fi
2746     else
2747         GCC_HOME="$with_gcc_home"
2748     fi
2749     AC_MSG_RESULT($GCC_HOME)
2750     AC_SUBST(GCC_HOME)
2752     if test "$GCC_HOME_SET" = "true"; then
2753         if test -z "$CC"; then
2754             CC="$GCC_HOME/bin/gcc"
2755             CC_BASE="gcc"
2756         fi
2757         if test -z "$CXX"; then
2758             CXX="$GCC_HOME/bin/g++"
2759             CXX_BASE="g++"
2760         fi
2761     fi
2764 COMPATH=`dirname "$CC"`
2765 if test "$COMPATH" = "."; then
2766     AC_PATH_PROGS(COMPATH, $CC)
2767     dnl double square bracket to get single because of M4 quote...
2768     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2770 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2772 dnl ===================================================================
2773 dnl Java support
2774 dnl ===================================================================
2775 AC_MSG_CHECKING([whether to build with Java support])
2776 if test "$with_java" != "no"; then
2777     if test "$DISABLE_SCRIPTING" = TRUE; then
2778         AC_MSG_RESULT([no, overridden by --disable-scripting])
2779         ENABLE_JAVA=""
2780         with_java=no
2781     else
2782         AC_MSG_RESULT([yes])
2783         ENABLE_JAVA="TRUE"
2784         AC_DEFINE(HAVE_FEATURE_JAVA)
2785     fi
2786 else
2787     AC_MSG_RESULT([no])
2788     ENABLE_JAVA=""
2791 AC_SUBST(ENABLE_JAVA)
2793 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2795 dnl ENABLE_JAVA="" indicate no Java support at all
2797 dnl ===================================================================
2798 dnl Check macOS SDK and compiler
2799 dnl ===================================================================
2801 if test $_os = Darwin; then
2803     # If no --with-macosx-sdk option is given, look for one
2805     # The intent is that for "most" Mac-based developers, a suitable
2806     # SDK will be found automatically without any configure options.
2808     # For developers with a current Xcode, the lowest-numbered SDK
2809     # higher than or equal to the minimum required should be found.
2811     AC_MSG_CHECKING([what macOS SDK to use])
2812     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13}; do
2813         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2814         if test -d "$MACOSX_SDK_PATH"; then
2815             with_macosx_sdk="${_macosx_sdk}"
2816             break
2817         else
2818             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2819             if test -d "$MACOSX_SDK_PATH"; then
2820                 with_macosx_sdk="${_macosx_sdk}"
2821                 break
2822             fi
2823         fi
2824     done
2825     if test ! -d "$MACOSX_SDK_PATH"; then
2826         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2827     fi
2829     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2831     case $with_macosx_sdk in
2832     10.13)
2833         MACOSX_SDK_VERSION=101300
2834         ;;
2835     10.14)
2836         MACOSX_SDK_VERSION=101400
2837         ;;
2838     10.15)
2839         MACOSX_SDK_VERSION=101500
2840         ;;
2841     *)
2842         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--15])
2843         ;;
2844     esac
2846     if test "$with_macosx_version_min_required" = "" ; then
2847         with_macosx_version_min_required="10.10";
2848     fi
2850     if test "$with_macosx_version_max_allowed" = "" ; then
2851         with_macosx_version_max_allowed="$with_macosx_sdk"
2852     fi
2854     # export this so that "xcrun" invocations later return matching values
2855     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2856     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2857     export DEVELOPER_DIR
2858     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2859     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2861     AC_MSG_CHECKING([whether Xcode is new enough])
2862     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2863     my_xcode_ver2=${my_xcode_ver1#Xcode }
2864     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2865     if test "$my_xcode_ver3" -ge 1103; then
2866         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2867     else
2868         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
2869     fi
2871     case "$with_macosx_version_min_required" in
2872     10.10)
2873         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2874         ;;
2875     10.11)
2876         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2877         ;;
2878     10.12)
2879         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2880         ;;
2881     10.13)
2882         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2883         ;;
2884     10.14)
2885         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2886         ;;
2887     10.15)
2888         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2889         ;;
2890     *)
2891         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2892         ;;
2893     esac
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_SUBST(MACOSX_SDK_PATH)
3037 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3038 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3039 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3040 AC_SUBST(INSTALL_NAME_TOOL)
3041 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3042 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3043 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3044 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3045 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3047 dnl ===================================================================
3048 dnl Check iOS SDK and compiler
3049 dnl ===================================================================
3051 if test $_os = iOS; then
3052     AC_MSG_CHECKING([what iOS SDK to use])
3053     current_sdk_ver=13.2
3054     older_sdk_vers="13.1 13.0 12.4 12.2"
3055     if test "$enable_ios_simulator" = "yes"; then
3056         platform=iPhoneSimulator
3057         versionmin=-mios-simulator-version-min=12.2
3058     else
3059         platform=iPhoneOS
3060         versionmin=-miphoneos-version-min=12.2
3061     fi
3062     xcode_developer=`xcode-select -print-path`
3064     for sdkver in $current_sdk_ver $older_sdk_vers; do
3065         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3066         if test -d $t; then
3067             sysroot=$t
3068             break
3069         fi
3070     done
3072     if test -z "$sysroot"; then
3073         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3074     fi
3076     AC_MSG_RESULT($sysroot)
3078     # LTO is not really recommended for iOS builds,
3079     # the link time will be astronomical
3080     if test "$ENABLE_LTO" = TRUE; then
3081         lto=-flto
3082     fi
3084     stdlib="-stdlib=libc++"
3086     AC_MSG_CHECKING([what C compiler to use])
3087     CC="`xcrun -find clang`"
3088     CC_BASE=`first_arg_basename "$CC"`
3089     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3090     AC_MSG_RESULT([$CC])
3092     AC_MSG_CHECKING([what C++ compiler to use])
3093     CXX="`xcrun -find clang++`"
3094     CXX_BASE=`first_arg_basename "$CXX"`
3095     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3096     AC_MSG_RESULT([$CXX])
3098     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3099     AR=`xcrun -find ar`
3100     NM=`xcrun -find nm`
3101     STRIP=`xcrun -find strip`
3102     LIBTOOL=`xcrun -find libtool`
3103     RANLIB=`xcrun -find ranlib`
3106 AC_MSG_CHECKING([whether to treat the installation as read-only])
3108 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3109         "$enable_extensions" != yes; then
3110     enable_readonly_installset=yes
3112 if test "$enable_readonly_installset" = yes; then
3113     AC_MSG_RESULT([yes])
3114     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3115 else
3116     AC_MSG_RESULT([no])
3119 dnl ===================================================================
3120 dnl Structure of install set
3121 dnl ===================================================================
3123 if test $_os = Darwin; then
3124     LIBO_BIN_FOLDER=MacOS
3125     LIBO_ETC_FOLDER=Resources
3126     LIBO_LIBEXEC_FOLDER=MacOS
3127     LIBO_LIB_FOLDER=Frameworks
3128     LIBO_LIB_PYUNO_FOLDER=Resources
3129     LIBO_SHARE_FOLDER=Resources
3130     LIBO_SHARE_HELP_FOLDER=Resources/help
3131     LIBO_SHARE_JAVA_FOLDER=Resources/java
3132     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3133     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3134     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3135     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3136     LIBO_URE_BIN_FOLDER=MacOS
3137     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3138     LIBO_URE_LIB_FOLDER=Frameworks
3139     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3140     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3141 elif test $_os = WINNT; then
3142     LIBO_BIN_FOLDER=program
3143     LIBO_ETC_FOLDER=program
3144     LIBO_LIBEXEC_FOLDER=program
3145     LIBO_LIB_FOLDER=program
3146     LIBO_LIB_PYUNO_FOLDER=program
3147     LIBO_SHARE_FOLDER=share
3148     LIBO_SHARE_HELP_FOLDER=help
3149     LIBO_SHARE_JAVA_FOLDER=program/classes
3150     LIBO_SHARE_PRESETS_FOLDER=presets
3151     LIBO_SHARE_READMES_FOLDER=readmes
3152     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3153     LIBO_SHARE_SHELL_FOLDER=program/shell
3154     LIBO_URE_BIN_FOLDER=program
3155     LIBO_URE_ETC_FOLDER=program
3156     LIBO_URE_LIB_FOLDER=program
3157     LIBO_URE_MISC_FOLDER=program
3158     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3159 else
3160     LIBO_BIN_FOLDER=program
3161     LIBO_ETC_FOLDER=program
3162     LIBO_LIBEXEC_FOLDER=program
3163     LIBO_LIB_FOLDER=program
3164     LIBO_LIB_PYUNO_FOLDER=program
3165     LIBO_SHARE_FOLDER=share
3166     LIBO_SHARE_HELP_FOLDER=help
3167     LIBO_SHARE_JAVA_FOLDER=program/classes
3168     LIBO_SHARE_PRESETS_FOLDER=presets
3169     LIBO_SHARE_READMES_FOLDER=readmes
3170     if test "$enable_fuzzers" != yes; then
3171         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3172     else
3173         LIBO_SHARE_RESOURCE_FOLDER=resource
3174     fi
3175     LIBO_SHARE_SHELL_FOLDER=program/shell
3176     LIBO_URE_BIN_FOLDER=program
3177     LIBO_URE_ETC_FOLDER=program
3178     LIBO_URE_LIB_FOLDER=program
3179     LIBO_URE_MISC_FOLDER=program
3180     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3182 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3183 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3184 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3185 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3186 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3187 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3188 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3189 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3190 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3191 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3192 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3193 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3194 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3195 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3196 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3197 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3199 # Not all of them needed in config_host.mk, add more if need arises
3200 AC_SUBST(LIBO_BIN_FOLDER)
3201 AC_SUBST(LIBO_ETC_FOLDER)
3202 AC_SUBST(LIBO_LIB_FOLDER)
3203 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3204 AC_SUBST(LIBO_SHARE_FOLDER)
3205 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3206 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3207 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3208 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3209 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3210 AC_SUBST(LIBO_URE_BIN_FOLDER)
3211 AC_SUBST(LIBO_URE_ETC_FOLDER)
3212 AC_SUBST(LIBO_URE_LIB_FOLDER)
3213 AC_SUBST(LIBO_URE_MISC_FOLDER)
3214 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3216 dnl ===================================================================
3217 dnl Windows specific tests and stuff
3218 dnl ===================================================================
3220 reg_get_value()
3222     # Return value: $regvalue
3223     unset regvalue
3225     local _regentry="/proc/registry${1}/${2}"
3226     if test -f "$_regentry"; then
3227         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3228         # Registry keys read via /proc/registry* are always \0 terminated!
3229         local _regvalue=$(tr -d '\0' < "$_regentry")
3230         if test $? -eq 0; then
3231             regvalue=$_regvalue
3232         fi
3233     fi
3236 # Get a value from the 32-bit side of the Registry
3237 reg_get_value_32()
3239     reg_get_value "32" "$1"
3242 # Get a value from the 64-bit side of the Registry
3243 reg_get_value_64()
3245     reg_get_value "64" "$1"
3248 if test "$_os" = "WINNT"; then
3249     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3250     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3251         AC_MSG_RESULT([no])
3252         WINDOWS_SDK_ARCH="x86"
3253     else
3254         AC_MSG_RESULT([yes])
3255         WINDOWS_SDK_ARCH="x64"
3256         BITNESS_OVERRIDE=64
3257     fi
3259 if test "$_os" = "iOS"; then
3260     cross_compiling="yes"
3263 if test "$cross_compiling" = "yes"; then
3264     export CROSS_COMPILING=TRUE
3265 else
3266     CROSS_COMPILING=
3267     BUILD_TYPE="$BUILD_TYPE NATIVE"
3269 AC_SUBST(CROSS_COMPILING)
3271 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3272 # NOTE: must _not_ be used for bundled external libraries!
3273 ISYSTEM=
3274 if test "$GCC" = "yes"; then
3275     AC_MSG_CHECKING( for -isystem )
3276     save_CFLAGS=$CFLAGS
3277     CFLAGS="$CFLAGS -Werror"
3278     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3279     CFLAGS=$save_CFLAGS
3280     if test -n "$ISYSTEM"; then
3281         AC_MSG_RESULT(yes)
3282     else
3283         AC_MSG_RESULT(no)
3284     fi
3286 if test -z "$ISYSTEM"; then
3287     # fall back to using -I
3288     ISYSTEM=-I
3290 AC_SUBST(ISYSTEM)
3292 dnl ===================================================================
3293 dnl  Check which Visual Studio compiler is used
3294 dnl ===================================================================
3296 map_vs_year_to_version()
3298     # Return value: $vsversion
3300     unset vsversion
3302     case $1 in
3303     2019)
3304         vsversion=16;;
3305     *)
3306         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3307     esac
3310 vs_versions_to_check()
3312     # Args: $1 (optional) : versions to check, in the order of preference
3313     # Return value: $vsversions
3315     unset vsversions
3317     if test -n "$1"; then
3318         map_vs_year_to_version "$1"
3319         vsversions=$vsversion
3320     else
3321         # We accept only 2019
3322         vsversions="16"
3323     fi
3326 win_get_env_from_vsvars32bat()
3328     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3329     # Also seems to be located in another directory under the same name: vsvars32.bat
3330     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3331     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3332     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3333     chmod +x $WRAPPERBATCHFILEPATH
3334     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3335     rm -f $WRAPPERBATCHFILEPATH
3336     printf '%s' "$_win_get_env_from_vsvars32bat"
3339 find_ucrt()
3341     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3342     if test -n "$regvalue"; then
3343         PathFormat "$regvalue"
3344         UCRTSDKDIR=$formatted_path
3345         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3346         UCRTVERSION=$regvalue
3347         # Rest if not exist
3348         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3349           UCRTSDKDIR=
3350         fi
3351     fi
3352     if test -z "$UCRTSDKDIR"; then
3353         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3354         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3355         if test -f "$ide_env_file"; then
3356             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3357             UCRTSDKDIR=$formatted_path
3358             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3359             dnl Hack needed at least by tml:
3360             if test "$UCRTVERSION" = 10.0.15063.0 \
3361                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3362                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3363             then
3364                 UCRTVERSION=10.0.14393.0
3365             fi
3366         else
3367           AC_MSG_ERROR([No UCRT found])
3368         fi
3369     fi
3372 find_msvc()
3374     # Find Visual C++ 2019
3375     # Args: $1 (optional) : The VS version year
3376     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3378     unset vctest vcnum vcnumwithdot vcbuildnumber
3380     vs_versions_to_check "$1"
3381     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3382     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3383     PathFormat "$vswhere"
3384     vswhere=$formatted_path
3385     for ver in $vsversions; do
3386         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3387         # Fall back to all MS products (this includes VC++ Build Tools)
3388         if ! test -n "$vswhereoutput"; then
3389             AC_MSG_CHECKING([VC++ Build Tools and similar])
3390             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3391         fi
3392         if test -n "$vswhereoutput"; then
3393             PathFormat "$vswhereoutput"
3394             vctest=$formatted_path
3395             break
3396         fi
3397     done
3399     if test -n "$vctest"; then
3400         vcnumwithdot="$ver.0"
3401         case "$vcnumwithdot" in
3402         16.0)
3403             vcyear=2019
3404             vcnum=160
3405             ;;
3406         esac
3407         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3409     fi
3412 SOLARINC=
3413 MSBUILD_PATH=
3414 DEVENV=
3415 if test "$_os" = "WINNT"; then
3416     AC_MSG_CHECKING([Visual C++])
3417     find_msvc "$with_visual_studio"
3418     if test -z "$vctest"; then
3419         if test -n "$with_visual_studio"; then
3420             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3421         else
3422             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3423         fi
3424     fi
3426     if test "$BITNESS_OVERRIDE" = ""; then
3427         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3428             VC_PRODUCT_DIR=$vctest/VC
3429         else
3430             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3431         fi
3432     else
3433         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3434             VC_PRODUCT_DIR=$vctest/VC
3435         else
3436             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3437         fi
3438     fi
3439     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3441     AC_MSG_CHECKING([for short pathname of VC product directory])
3442     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3443     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3445     UCRTSDKDIR=
3446     UCRTVERSION=
3448     AC_MSG_CHECKING([for UCRT location])
3449     find_ucrt
3450     # find_ucrt errors out if it doesn't find it
3451     AC_MSG_RESULT([found])
3452     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3453     ucrtincpath_formatted=$formatted_path
3454     # SOLARINC is used for external modules and must be set too.
3455     # And no, it's not sufficient to set SOLARINC only, as configure
3456     # itself doesn't honour it.
3457     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3458     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3459     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3460     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3462     AC_SUBST(UCRTSDKDIR)
3463     AC_SUBST(UCRTVERSION)
3465     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3466     # Find the proper version of MSBuild.exe to use based on the VS version
3467     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3468     if test -n "$regvalue" ; then
3469         AC_MSG_RESULT([found: $regvalue])
3470         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3471     else
3472         if test "$vcnumwithdot" = "16.0"; then
3473             if test "$BITNESS_OVERRIDE" = ""; then
3474                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3475             else
3476                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3477             fi
3478         else
3479             if test "$BITNESS_OVERRIDE" = ""; then
3480                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3481             else
3482                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3483             fi
3484         fi
3485         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3486         AC_MSG_RESULT([$regvalue])
3487     fi
3489     # Find the version of devenv.exe
3490     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3491     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3492     if test ! -e "$DEVENV"; then
3493         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3494     fi
3496     dnl ===========================================================
3497     dnl  Check for the corresponding mspdb*.dll
3498     dnl ===========================================================
3500     VC_HOST_DIR=
3501     MSPDB_PATH=
3502     CL_PATH=
3504     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3505         VC_HOST_DIR="HostX64"
3506         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3507     else
3508         VC_HOST_DIR="HostX86"
3509         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3510     fi
3512     if test "$BITNESS_OVERRIDE" = ""; then
3513         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3514     else
3515         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3516     fi
3518     # MSVC 15.0 has libraries from 14.0?
3519     mspdbnum="140"
3521     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3522         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3523     fi
3525     dnl The path needs to be added before cl is called
3526     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3527     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3529     AC_MSG_CHECKING([cl.exe])
3531     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3532     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3533     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3534     # is not enough?
3536     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3537     dnl needed when building CLR code:
3538     if test -z "$MSVC_CXX"; then
3539         if test -f "$CL_PATH/cl.exe"; then
3540             MSVC_CXX="$CL_PATH/cl.exe"
3541         fi
3543         # This gives us a posix path with 8.3 filename restrictions
3544         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3545     fi
3547     if test -z "$CC"; then
3548         CC=$MSVC_CXX
3549         CC_BASE=`first_arg_basename "$CC"`
3550     fi
3551     if test "$BITNESS_OVERRIDE" = ""; then
3552         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3553         MSVC_CXX="$MSVC_CXX -arch:SSE"
3554     fi
3555     if test -z "$CXX"; then
3556         CXX=$MSVC_CXX
3557         CXX_BASE=`first_arg_basename "$CXX"`
3558     fi
3560     if test -n "$CC"; then
3561         # Remove /cl.exe from CC case insensitive
3562         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3563         if test "$BITNESS_OVERRIDE" = ""; then
3564            COMPATH="$VC_PRODUCT_DIR"
3565         else
3566             if test -n "$VC_PRODUCT_DIR"; then
3567                 COMPATH=$VC_PRODUCT_DIR
3568             fi
3569         fi
3570         if test "$BITNESS_OVERRIDE" = ""; then
3571             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3572             CC="$CC -arch:SSE"
3573         fi
3575         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3577         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3579         PathFormat "$COMPATH"
3580         COMPATH=`win_short_path_for_make "$formatted_path"`
3582         VCVER=$vcnum
3584         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3585         # are always "better", we list them in reverse chronological order.
3587         case "$vcnum" in
3588         160)
3589             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3590             ;;
3591         esac
3593         # The expectation is that --with-windows-sdk should not need to be used
3594         if test -n "$with_windows_sdk"; then
3595             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3596             *" "$with_windows_sdk" "*)
3597                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3598                 ;;
3599             *)
3600                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
3601                 ;;
3602             esac
3603         fi
3605         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3606         ac_objext=obj
3607         ac_exeext=exe
3609     else
3610         AC_MSG_ERROR([Visual C++ not found after all, huh])
3611     fi
3613     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
3614     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3615         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3616         // between Visual Studio versions and _MSC_VER:
3617         #if _MSC_VER < 1924
3618         #error
3619         #endif
3620     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3622     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3623     # version of the Explorer extension (and maybe other small
3624     # bits, too) needed when installing a 32-bit LibreOffice on a
3625     # 64-bit OS. The 64-bit Explorer extension is a feature that
3626     # has been present since long in OOo. Don't confuse it with
3627     # building LibreOffice itself as 64-bit code.
3629     BUILD_X64=
3630     CXX_X64_BINARY=
3632     if test "$BITNESS_OVERRIDE" = ""; then
3633         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3634         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3635              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3636             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3637                 BUILD_X64=TRUE
3638                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3639             fi
3640         fi
3641         if test "$BUILD_X64" = TRUE; then
3642             AC_MSG_RESULT([found])
3643         else
3644             AC_MSG_RESULT([not found])
3645             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3646         fi
3647     else
3648         CXX_X64_BINARY=$CXX
3649     fi
3650     AC_SUBST(BUILD_X64)
3652     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3653     AC_SUBST(CXX_X64_BINARY)
3655     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3656     # needed to support TWAIN scan on both 32- and 64-bit systems
3658     BUILD_X86=
3660     if test "$BITNESS_OVERRIDE" = "64"; then
3661         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3662         if test -n "$CXX_X86_BINARY"; then
3663             BUILD_X86=TRUE
3664             AC_MSG_RESULT([preset])
3665         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3666             BUILD_X86=TRUE
3667             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3668             CXX_X86_BINARY+=" /arch:SSE"
3669             AC_MSG_RESULT([found])
3670         else
3671             CXX_X86_BINARY=
3672             AC_MSG_RESULT([not found])
3673             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3674         fi
3675     else
3676         BUILD_X86=TRUE
3677         CXX_X86_BINARY=$MSVC_CXX
3678     fi
3679     AC_SUBST(BUILD_X86)
3680     AC_SUBST(CXX_X86_BINARY)
3682 AC_SUBST(VCVER)
3683 AC_SUBST(DEVENV)
3684 AC_SUBST(MSVC_CXX)
3687 # unowinreg.dll
3689 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3690 AC_SUBST(UNOWINREG_DLL)
3692 COM_IS_CLANG=
3693 AC_MSG_CHECKING([whether the compiler is actually Clang])
3694 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3695     #ifndef __clang__
3696     you lose
3697     #endif
3698     int foo=42;
3699     ]])],
3700     [AC_MSG_RESULT([yes])
3701      COM_IS_CLANG=TRUE],
3702     [AC_MSG_RESULT([no])])
3703 AC_SUBST(COM_IS_CLANG)
3705 CC_PLAIN=$CC
3706 CLANGVER=
3707 if test "$COM_IS_CLANG" = TRUE; then
3708     AC_MSG_CHECKING([whether Clang is new enough])
3709     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3710         #if !defined __apple_build_version__
3711         #error
3712         #endif
3713         ]])],
3714         [my_apple_clang=yes],[my_apple_clang=])
3715     if test "$my_apple_clang" = yes; then
3716         AC_MSG_RESULT([assumed yes (Apple Clang)])
3717     else
3718         if test "$_os" = WINNT; then
3719             dnl In which case, assume clang-cl:
3720             my_args="/EP /TC"
3721             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3722             dnl clang-cl:
3723             CC_PLAIN=
3724             for i in $CC; do
3725                 case $i in
3726                 -FIIntrin.h)
3727                     ;;
3728                 *)
3729                     CC_PLAIN="$CC_PLAIN $i"
3730                     ;;
3731                 esac
3732             done
3733         else
3734             my_args="-E -P"
3735         fi
3736         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3737         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3738         CLANGVER=`echo $clang_version \
3739             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3740         if test "$CLANGVER" -ge 50002; then
3741             AC_MSG_RESULT([yes ($clang_version)])
3742         else
3743             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3744         fi
3745         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3746         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3747     fi
3750 SHOWINCLUDES_PREFIX=
3751 if test "$_os" = WINNT; then
3752     dnl We need to guess the prefix of the -showIncludes output, it can be
3753     dnl localized
3754     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3755     echo "#include <stdlib.h>" > conftest.c
3756     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3757         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3758     rm -f conftest.c conftest.obj
3759     if test -z "$SHOWINCLUDES_PREFIX"; then
3760         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3761     else
3762         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3763     fi
3765 AC_SUBST(SHOWINCLUDES_PREFIX)
3768 # prefix C with ccache if needed
3770 if test "$CCACHE" != ""; then
3771     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3773     AC_LANG_PUSH([C])
3774     save_CFLAGS=$CFLAGS
3775     CFLAGS="$CFLAGS --ccache-skip -O2"
3776     dnl an empty program will do, we're checking the compiler flags
3777     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3778                       [use_ccache=yes], [use_ccache=no])
3779     if test $use_ccache = yes; then
3780         AC_MSG_RESULT([yes])
3781     else
3782         CC="$CCACHE $CC"
3783         CC_BASE="ccache $CC_BASE"
3784         AC_MSG_RESULT([no])
3785     fi
3786     CFLAGS=$save_CFLAGS
3787     AC_LANG_POP([C])
3790 # ===================================================================
3791 # check various GCC options that Clang does not support now but maybe
3792 # will somewhen in the future, check them even for GCC, so that the
3793 # flags are set
3794 # ===================================================================
3796 HAVE_GCC_GGDB2=
3797 if test "$GCC" = "yes"; then
3798     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3799     save_CFLAGS=$CFLAGS
3800     CFLAGS="$CFLAGS -Werror -ggdb2"
3801     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3802     CFLAGS=$save_CFLAGS
3803     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3804         AC_MSG_RESULT([yes])
3805     else
3806         AC_MSG_RESULT([no])
3807     fi
3809     if test "$host_cpu" = "m68k"; then
3810         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3811         save_CFLAGS=$CFLAGS
3812         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3813         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3814         CFLAGS=$save_CFLAGS
3815         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3816             AC_MSG_RESULT([yes])
3817         else
3818             AC_MSG_ERROR([no])
3819         fi
3820     fi
3822 AC_SUBST(HAVE_GCC_GGDB2)
3824 dnl ===================================================================
3825 dnl  Test the gcc version
3826 dnl ===================================================================
3827 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3828     AC_MSG_CHECKING([the GCC version])
3829     _gcc_version=`$CC -dumpversion`
3830     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3831         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3832     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3834     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3836     if test "$gcc_full_version" -lt 70000; then
3837         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3838     fi
3839 else
3840     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3841     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3842     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3843     # (which reports itself as GCC 4.2.1).
3844     GCC_VERSION=
3846 AC_SUBST(GCC_VERSION)
3848 dnl Set the ENABLE_DBGUTIL variable
3849 dnl ===================================================================
3850 AC_MSG_CHECKING([whether to build with additional debug utilities])
3851 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3852     ENABLE_DBGUTIL="TRUE"
3853     # this is an extra var so it can have different default on different MSVC
3854     # versions (in case there are version specific problems with it)
3855     MSVC_USE_DEBUG_RUNTIME="TRUE"
3857     AC_MSG_RESULT([yes])
3858     # cppunit and graphite expose STL in public headers
3859     if test "$with_system_cppunit" = "yes"; then
3860         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3861     else
3862         with_system_cppunit=no
3863     fi
3864     if test "$with_system_graphite" = "yes"; then
3865         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3866     else
3867         with_system_graphite=no
3868     fi
3869     if test "$with_system_orcus" = "yes"; then
3870         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3871     else
3872         with_system_orcus=no
3873     fi
3874     if test "$with_system_libcmis" = "yes"; then
3875         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3876     else
3877         with_system_libcmis=no
3878     fi
3879     if test "$with_system_hunspell" = "yes"; then
3880         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3881     else
3882         with_system_hunspell=no
3883     fi
3884     if test "$with_system_gpgmepp" = "yes"; then
3885         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3886     else
3887         with_system_gpgmepp=no
3888     fi
3889     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3890     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3891     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3892     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3893     # of those two is using the system variant:
3894     if test "$with_system_libnumbertext" = "yes"; then
3895         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3896     else
3897         with_system_libnumbertext=no
3898     fi
3899     if test "$with_system_libwps" = "yes"; then
3900         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3901     else
3902         with_system_libwps=no
3903     fi
3904 else
3905     ENABLE_DBGUTIL=""
3906     MSVC_USE_DEBUG_RUNTIME=""
3907     AC_MSG_RESULT([no])
3909 AC_SUBST(ENABLE_DBGUTIL)
3910 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3912 dnl Set the ENABLE_DEBUG variable.
3913 dnl ===================================================================
3914 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3915     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3917 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3918     if test -z "$libo_fuzzed_enable_debug"; then
3919         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3920     else
3921         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3922         enable_debug=yes
3923     fi
3926 AC_MSG_CHECKING([whether to do a debug build])
3927 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3928     ENABLE_DEBUG="TRUE"
3929     if test -n "$ENABLE_DBGUTIL" ; then
3930         AC_MSG_RESULT([yes (dbgutil)])
3931     else
3932         AC_MSG_RESULT([yes])
3933     fi
3934 else
3935     ENABLE_DEBUG=""
3936     AC_MSG_RESULT([no])
3938 AC_SUBST(ENABLE_DEBUG)
3940 dnl ===================================================================
3941 dnl Select the linker to use (gold/lld/ld.bfd).
3942 dnl This is done only after compiler checks (need to know if Clang is
3943 dnl used, for different defaults) and after checking if a debug build
3944 dnl is wanted (non-debug builds get the default linker if not explicitly
3945 dnl specified otherwise).
3946 dnl All checks for linker features/options should come after this.
3947 dnl ===================================================================
3948 check_use_ld()
3950     use_ld=$1
3951     use_ld_fail_if_error=$2
3952     use_ld_ok=
3953     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3954     use_ld_ldflags_save="$LDFLAGS"
3955     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3956     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3957 #include <stdio.h>
3958         ],[
3959 printf ("hello world\n");
3960         ])], USE_LD=$use_ld, [])
3961     if test -n "$USE_LD"; then
3962         AC_MSG_RESULT( yes )
3963         use_ld_ok=yes
3964     else
3965         if test -n "$use_ld_fail_if_error"; then
3966             AC_MSG_ERROR( no )
3967         else
3968             AC_MSG_RESULT( no )
3969         fi
3970     fi
3971     if test -n "$use_ld_ok"; then
3972         dnl keep the value of LDFLAGS
3973         return 0
3974     fi
3975     LDFLAGS="$use_ld_ldflags_save"
3976     return 1
3978 USE_LD=
3979 if test "$enable_ld" != "no"; then
3980     if test "$GCC" = "yes"; then
3981         if test -n "$enable_ld"; then
3982             check_use_ld "$enable_ld" fail_if_error
3983         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3984             dnl non-debug builds default to the default linker
3985             true
3986         elif test -n "$COM_IS_CLANG"; then
3987             check_use_ld lld
3988             if test $? -ne 0; then
3989                 check_use_ld gold
3990             fi
3991         else
3992             # For gcc first try gold, new versions also support lld.
3993             check_use_ld gold
3994             if test $? -ne 0; then
3995                 check_use_ld lld
3996             fi
3997         fi
3998         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
3999         rm conftest.out
4000         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4001         if test -z "$ld_used"; then
4002             ld_used="unknown"
4003         fi
4004         AC_MSG_CHECKING([for linker that is used])
4005         AC_MSG_RESULT([$ld_used])
4006         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4007             if echo "$ld_used" | grep -q "^GNU ld"; then
4008                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4009                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4010             fi
4011         fi
4012     else
4013         if test "$enable_ld" = "yes"; then
4014             AC_MSG_ERROR([--enable-ld not supported])
4015         fi
4016     fi
4018 AC_SUBST(USE_LD)
4020 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4021 if test "$GCC" = "yes"; then
4022     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4023     bsymbolic_functions_ldflags_save=$LDFLAGS
4024     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4025     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4026 #include <stdio.h>
4027         ],[
4028 printf ("hello world\n");
4029         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4030     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4031         AC_MSG_RESULT( found )
4032     else
4033         AC_MSG_RESULT( not found )
4034     fi
4035     LDFLAGS=$bsymbolic_functions_ldflags_save
4037 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4039 LD_GC_SECTIONS=
4040 if test "$GCC" = "yes"; then
4041     for flag in "--gc-sections" "-dead_strip"; do
4042         AC_MSG_CHECKING([for $flag linker support])
4043         ldflags_save=$LDFLAGS
4044         LDFLAGS="$LDFLAGS -Wl,$flag"
4045         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4046 #include <stdio.h>
4047             ],[
4048 printf ("hello world\n");
4049             ])],[
4050             LD_GC_SECTIONS="-Wl,$flag"
4051             AC_MSG_RESULT( found )
4052             ], [
4053             AC_MSG_RESULT( not found )
4054             ])
4055         LDFLAGS=$ldflags_save
4056         if test -n "$LD_GC_SECTIONS"; then
4057             break
4058         fi
4059     done
4061 AC_SUBST(LD_GC_SECTIONS)
4063 HAVE_GSPLIT_DWARF=
4064 if test "$enable_split_debug" != no; then
4065     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4066     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4067         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4068         save_CFLAGS=$CFLAGS
4069         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4070         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4071         CFLAGS=$save_CFLAGS
4072         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4073             AC_MSG_RESULT([yes])
4074         else
4075             if test "$enable_split_debug" = yes; then
4076                 AC_MSG_ERROR([no])
4077             else
4078                 AC_MSG_RESULT([no])
4079             fi
4080         fi
4081     fi
4082     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4083         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4084         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4085     fi
4087 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4089 ENABLE_GDB_INDEX=
4090 if test "$enable_gdb_index" != "no"; then
4091     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4092     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4093         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4094         save_CFLAGS=$CFLAGS
4095         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4096         have_ggnu_pubnames=
4097         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4098         if test "$have_ggnu_pubnames" != "TRUE"; then
4099             if test "$enable_gdb_index" = "yes"; then
4100                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4101             else
4102                 AC_MSG_RESULT( no )
4103             fi
4104         else
4105             AC_MSG_RESULT( yes )
4106             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4107             ldflags_save=$LDFLAGS
4108             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4109             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4110 #include <stdio.h>
4111                 ],[
4112 printf ("hello world\n");
4113                 ])], ENABLE_GDB_INDEX=TRUE, [])
4114             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4115                 AC_MSG_RESULT( yes )
4116             else
4117                 if test "$enable_gdb_index" = "yes"; then
4118                     AC_MSG_ERROR( no )
4119                 else
4120                     AC_MSG_RESULT( no )
4121                 fi
4122             fi
4123             LDFLAGS=$ldflags_save
4124         fi
4125         CFLAGS=$save_CFLAGS
4126         fi
4127     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4128         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4129         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4130     fi
4132 AC_SUBST(ENABLE_GDB_INDEX)
4134 if test "$enable_sal_log" = yes; then
4135     ENABLE_SAL_LOG=TRUE
4137 AC_SUBST(ENABLE_SAL_LOG)
4139 dnl Check for enable symbols option
4140 dnl ===================================================================
4141 AC_MSG_CHECKING([whether to generate debug information])
4142 if test -z "$enable_symbols"; then
4143     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4144         enable_symbols=yes
4145     else
4146         enable_symbols=no
4147     fi
4149 if test "$enable_symbols" = yes; then
4150     ENABLE_SYMBOLS_FOR=all
4151     AC_MSG_RESULT([yes])
4152 elif test "$enable_symbols" = no; then
4153     ENABLE_SYMBOLS_FOR=
4154     AC_MSG_RESULT([no])
4155 else
4156     # Selective debuginfo.
4157     ENABLE_SYMBOLS_FOR="$enable_symbols"
4158     AC_MSG_RESULT([for "$enable_symbols"])
4160 AC_SUBST(ENABLE_SYMBOLS_FOR)
4162 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4163     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4164     AC_MSG_CHECKING([whether enough memory is available for linking])
4165     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4166     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4167     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4168         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4169     else
4170         AC_MSG_RESULT([yes])
4171     fi
4174 ENABLE_OPTIMIZED=
4175 ENABLE_OPTIMIZED_DEBUG=
4176 AC_MSG_CHECKING([whether to compile with optimization flags])
4177 if test -z "$enable_optimized"; then
4178     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4179         enable_optimized=no
4180     else
4181         enable_optimized=yes
4182     fi
4184 if test "$enable_optimized" = yes; then
4185     ENABLE_OPTIMIZED=TRUE
4186     AC_MSG_RESULT([yes])
4187 elif test "$enable_optimized" = debug; then
4188     ENABLE_OPTIMIZED_DEBUG=TRUE
4189     AC_MSG_RESULT([yes (debug)])
4190     HAVE_GCC_OG=
4191     if test "$GCC" = "yes"; then
4192         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4193         save_CFLAGS=$CFLAGS
4194         CFLAGS="$CFLAGS -Werror -Og"
4195         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4196         CFLAGS=$save_CFLAGS
4197         if test "$HAVE_GCC_OG" = "TRUE"; then
4198             AC_MSG_RESULT([yes])
4199         else
4200             AC_MSG_RESULT([no])
4201         fi
4202     fi
4203     if test -z "$HAVE_GCC_OG"; then
4204         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4205     fi
4206 else
4207     AC_MSG_RESULT([no])
4209 AC_SUBST(ENABLE_OPTIMIZED)
4210 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4213 # determine CPUNAME, OS, ...
4214 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4216 case "$host_os" in
4218 aix*)
4219     COM=GCC
4220     CPUNAME=POWERPC
4221     USING_X11=TRUE
4222     OS=AIX
4223     RTL_OS=AIX
4224     RTL_ARCH=PowerPC
4225     PLATFORMID=aix_powerpc
4226     P_SEP=:
4227     ;;
4229 cygwin*)
4230     COM=MSC
4231     USING_X11=
4232     OS=WNT
4233     RTL_OS=Windows
4234     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4235         P_SEP=";"
4236     else
4237         P_SEP=:
4238     fi
4239     case "$host_cpu" in
4240     i*86|x86_64)
4241         if test "$BITNESS_OVERRIDE" = 64; then
4242             CPUNAME=X86_64
4243             RTL_ARCH=X86_64
4244             PLATFORMID=windows_x86_64
4245             WINDOWS_X64=1
4246             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4247         else
4248             CPUNAME=INTEL
4249             RTL_ARCH=x86
4250             PLATFORMID=windows_x86
4251         fi
4252         ;;
4253     *)
4254         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4255         ;;
4256     esac
4257     SCPDEFS="$SCPDEFS -D_MSC_VER"
4258     ;;
4260 darwin*)
4261     COM=GCC
4262     USING_X11=
4263     OS=MACOSX
4264     RTL_OS=MacOSX
4265     P_SEP=:
4267     case "$host_cpu" in
4268     arm)
4269         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4270         ;;
4271     arm64)
4272         OS=iOS
4273         RTL_OS=iOS
4274         if test "$enable_ios_simulator" = "yes"; then
4275             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4276         else
4277             CPUNAME=ARM64
4278             RTL_ARCH=ARM_EABI
4279             PLATFORMID=ios_arm64
4280         fi
4281         ;;
4282     i*86)
4283         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4284         ;;
4285     x86_64)
4286         if test "$enable_ios_simulator" = "yes"; then
4287             OS=iOS
4288         fi
4289         CPUNAME=X86_64
4290         RTL_ARCH=X86_64
4291         PLATFORMID=macosx_x86_64
4292         ;;
4293     *)
4294         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4295         ;;
4296     esac
4297     ;;
4299 dragonfly*)
4300     COM=GCC
4301     USING_X11=TRUE
4302     OS=DRAGONFLY
4303     RTL_OS=DragonFly
4304     P_SEP=:
4306     case "$host_cpu" in
4307     i*86)
4308         CPUNAME=INTEL
4309         RTL_ARCH=x86
4310         PLATFORMID=dragonfly_x86
4311         ;;
4312     x86_64)
4313         CPUNAME=X86_64
4314         RTL_ARCH=X86_64
4315         PLATFORMID=dragonfly_x86_64
4316         ;;
4317     *)
4318         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4319         ;;
4320     esac
4321     ;;
4323 freebsd*)
4324     COM=GCC
4325     USING_X11=TRUE
4326     RTL_OS=FreeBSD
4327     OS=FREEBSD
4328     P_SEP=:
4330     case "$host_cpu" in
4331     i*86)
4332         CPUNAME=INTEL
4333         RTL_ARCH=x86
4334         PLATFORMID=freebsd_x86
4335         ;;
4336     x86_64|amd64)
4337         CPUNAME=X86_64
4338         RTL_ARCH=X86_64
4339         PLATFORMID=freebsd_x86_64
4340         ;;
4341     *)
4342         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4343         ;;
4344     esac
4345     ;;
4347 haiku*)
4348     COM=GCC
4349     USING_X11=
4350     GUIBASE=haiku
4351     RTL_OS=Haiku
4352     OS=HAIKU
4353     P_SEP=:
4355     case "$host_cpu" in
4356     i*86)
4357         CPUNAME=INTEL
4358         RTL_ARCH=x86
4359         PLATFORMID=haiku_x86
4360         ;;
4361     x86_64|amd64)
4362         CPUNAME=X86_64
4363         RTL_ARCH=X86_64
4364         PLATFORMID=haiku_x86_64
4365         ;;
4366     *)
4367         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4368         ;;
4369     esac
4370     ;;
4372 kfreebsd*)
4373     COM=GCC
4374     USING_X11=TRUE
4375     OS=LINUX
4376     RTL_OS=kFreeBSD
4377     P_SEP=:
4379     case "$host_cpu" in
4381     i*86)
4382         CPUNAME=INTEL
4383         RTL_ARCH=x86
4384         PLATFORMID=kfreebsd_x86
4385         ;;
4386     x86_64)
4387         CPUNAME=X86_64
4388         RTL_ARCH=X86_64
4389         PLATFORMID=kfreebsd_x86_64
4390         ;;
4391     *)
4392         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4393         ;;
4394     esac
4395     ;;
4397 linux-gnu*)
4398     COM=GCC
4399     USING_X11=TRUE
4400     OS=LINUX
4401     RTL_OS=Linux
4402     P_SEP=:
4404     case "$host_cpu" in
4406     aarch64)
4407         CPUNAME=AARCH64
4408         PLATFORMID=linux_aarch64
4409         RTL_ARCH=AARCH64
4410         ;;
4411     alpha)
4412         CPUNAME=AXP
4413         RTL_ARCH=ALPHA
4414         PLATFORMID=linux_alpha
4415         ;;
4416     arm*)
4417         CPUNAME=ARM
4418         EPM_FLAGS="-a arm"
4419         RTL_ARCH=ARM_EABI
4420         PLATFORMID=linux_arm_eabi
4421         case "$host_cpu" in
4422         arm*-linux)
4423             RTL_ARCH=ARM_OABI
4424             PLATFORMID=linux_arm_oabi
4425             ;;
4426         esac
4427         ;;
4428     hppa)
4429         CPUNAME=HPPA
4430         RTL_ARCH=HPPA
4431         EPM_FLAGS="-a hppa"
4432         PLATFORMID=linux_hppa
4433         ;;
4434     i*86)
4435         CPUNAME=INTEL
4436         RTL_ARCH=x86
4437         PLATFORMID=linux_x86
4438         ;;
4439     ia64)
4440         CPUNAME=IA64
4441         RTL_ARCH=IA64
4442         PLATFORMID=linux_ia64
4443         ;;
4444     mips)
4445         CPUNAME=GODSON
4446         RTL_ARCH=MIPS_EB
4447         EPM_FLAGS="-a mips"
4448         PLATFORMID=linux_mips_eb
4449         ;;
4450     mips64)
4451         CPUNAME=GODSON64
4452         RTL_ARCH=MIPS64_EB
4453         EPM_FLAGS="-a mips64"
4454         PLATFORMID=linux_mips64_eb
4455         ;;
4456     mips64el)
4457         CPUNAME=GODSON64
4458         RTL_ARCH=MIPS64_EL
4459         EPM_FLAGS="-a mips64el"
4460         PLATFORMID=linux_mips64_el
4461         ;;
4462     mipsel)
4463         CPUNAME=GODSON
4464         RTL_ARCH=MIPS_EL
4465         EPM_FLAGS="-a mipsel"
4466         PLATFORMID=linux_mips_el
4467         ;;
4468     m68k)
4469         CPUNAME=M68K
4470         RTL_ARCH=M68K
4471         PLATFORMID=linux_m68k
4472         ;;
4473     powerpc)
4474         CPUNAME=POWERPC
4475         RTL_ARCH=PowerPC
4476         PLATFORMID=linux_powerpc
4477         ;;
4478     powerpc64)
4479         CPUNAME=POWERPC64
4480         RTL_ARCH=PowerPC_64
4481         PLATFORMID=linux_powerpc64
4482         ;;
4483     powerpc64le)
4484         CPUNAME=POWERPC64
4485         RTL_ARCH=PowerPC_64_LE
4486         PLATFORMID=linux_powerpc64_le
4487         ;;
4488     sparc)
4489         CPUNAME=SPARC
4490         RTL_ARCH=SPARC
4491         PLATFORMID=linux_sparc
4492         ;;
4493     sparc64)
4494         CPUNAME=SPARC64
4495         RTL_ARCH=SPARC64
4496         PLATFORMID=linux_sparc64
4497         ;;
4498     s390)
4499         CPUNAME=S390
4500         RTL_ARCH=S390
4501         PLATFORMID=linux_s390
4502         ;;
4503     s390x)
4504         CPUNAME=S390X
4505         RTL_ARCH=S390x
4506         PLATFORMID=linux_s390x
4507         ;;
4508     x86_64)
4509         CPUNAME=X86_64
4510         RTL_ARCH=X86_64
4511         PLATFORMID=linux_x86_64
4512         ;;
4513     *)
4514         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4515         ;;
4516     esac
4517     ;;
4519 linux-android*)
4520     COM=GCC
4521     USING_X11=
4522     OS=ANDROID
4523     RTL_OS=Android
4524     P_SEP=:
4526     case "$host_cpu" in
4528     arm|armel)
4529         CPUNAME=ARM
4530         RTL_ARCH=ARM_EABI
4531         PLATFORMID=android_arm_eabi
4532         ;;
4533     aarch64)
4534         CPUNAME=AARCH64
4535         RTL_ARCH=AARCH64
4536         PLATFORMID=android_aarch64
4537         ;;
4538     i*86)
4539         CPUNAME=INTEL
4540         RTL_ARCH=x86
4541         PLATFORMID=android_x86
4542         ;;
4543     x86_64)
4544         CPUNAME=X86_64
4545         RTL_ARCH=X86_64
4546         PLATFORMID=android_x86_64
4547         ;;
4548     *)
4549         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4550         ;;
4551     esac
4552     ;;
4554 *netbsd*)
4555     COM=GCC
4556     USING_X11=TRUE
4557     OS=NETBSD
4558     RTL_OS=NetBSD
4559     P_SEP=:
4561     case "$host_cpu" in
4562     i*86)
4563         CPUNAME=INTEL
4564         RTL_ARCH=x86
4565         PLATFORMID=netbsd_x86
4566         ;;
4567     powerpc)
4568         CPUNAME=POWERPC
4569         RTL_ARCH=PowerPC
4570         PLATFORMID=netbsd_powerpc
4571         ;;
4572     sparc)
4573         CPUNAME=SPARC
4574         RTL_ARCH=SPARC
4575         PLATFORMID=netbsd_sparc
4576         ;;
4577     x86_64)
4578         CPUNAME=X86_64
4579         RTL_ARCH=X86_64
4580         PLATFORMID=netbsd_x86_64
4581         ;;
4582     *)
4583         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4584         ;;
4585     esac
4586     ;;
4588 openbsd*)
4589     COM=GCC
4590     USING_X11=TRUE
4591     OS=OPENBSD
4592     RTL_OS=OpenBSD
4593     P_SEP=:
4595     case "$host_cpu" in
4596     i*86)
4597         CPUNAME=INTEL
4598         RTL_ARCH=x86
4599         PLATFORMID=openbsd_x86
4600         ;;
4601     x86_64)
4602         CPUNAME=X86_64
4603         RTL_ARCH=X86_64
4604         PLATFORMID=openbsd_x86_64
4605         ;;
4606     *)
4607         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4608         ;;
4609     esac
4610     SOLARINC="$SOLARINC -I/usr/local/include"
4611     ;;
4613 solaris*)
4614     COM=GCC
4615     USING_X11=TRUE
4616     OS=SOLARIS
4617     RTL_OS=Solaris
4618     P_SEP=:
4620     case "$host_cpu" in
4621     i*86)
4622         CPUNAME=INTEL
4623         RTL_ARCH=x86
4624         PLATFORMID=solaris_x86
4625         ;;
4626     sparc)
4627         CPUNAME=SPARC
4628         RTL_ARCH=SPARC
4629         PLATFORMID=solaris_sparc
4630         ;;
4631     sparc64)
4632         CPUNAME=SPARC64
4633         RTL_ARCH=SPARC64
4634         PLATFORMID=solaris_sparc64
4635         ;;
4636     *)
4637         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4638         ;;
4639     esac
4640     SOLARINC="$SOLARINC -I/usr/local/include"
4641     ;;
4644     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4645     ;;
4646 esac
4648 if test "$with_x" = "no"; then
4649     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4652 DISABLE_GUI=""
4653 if test "$enable_gui" = "no"; then
4654     if test "$USING_X11" != TRUE; then
4655         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4656     fi
4657     USING_X11=
4658     DISABLE_GUI=TRUE
4659     AC_DEFINE(HAVE_FEATURE_UI,0)
4660     test_cairo=yes
4662 AC_SUBST(DISABLE_GUI)
4664 WORKDIR="${BUILDDIR}/workdir"
4665 INSTDIR="${BUILDDIR}/instdir"
4666 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4667 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4668 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4669 AC_SUBST(COM)
4670 AC_SUBST(CPUNAME)
4671 AC_SUBST(RTL_OS)
4672 AC_SUBST(RTL_ARCH)
4673 AC_SUBST(EPM_FLAGS)
4674 AC_SUBST(USING_X11)
4675 AC_SUBST([INSTDIR])
4676 AC_SUBST([INSTROOT])
4677 AC_SUBST([INSTROOTBASE])
4678 AC_SUBST(OS)
4679 AC_SUBST(P_SEP)
4680 AC_SUBST(WORKDIR)
4681 AC_SUBST(PLATFORMID)
4682 AC_SUBST(WINDOWS_X64)
4683 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4685 dnl ===================================================================
4686 dnl Test which package format to use
4687 dnl ===================================================================
4688 AC_MSG_CHECKING([which package format to use])
4689 if test -n "$with_package_format" -a "$with_package_format" != no; then
4690     for i in $with_package_format; do
4691         case "$i" in
4692         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4693             ;;
4694         *)
4695             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4696 aix - AIX software distribution
4697 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4698 deb - Debian software distribution
4699 pkg - Solaris software distribution
4700 rpm - RedHat software distribution
4702 LibreOffice additionally supports:
4703 archive - .tar.gz or .zip
4704 dmg - macOS .dmg
4705 installed - installation tree
4706 msi - Windows .msi
4707         ])
4708             ;;
4709         esac
4710     done
4711     # fakeroot is needed to ensure correct file ownerships/permissions
4712     # inside deb packages and tar archives created on Linux and Solaris.
4713     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4714         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4715         if test "$FAKEROOT" = "no"; then
4716             AC_MSG_ERROR(
4717                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4718         fi
4719     fi
4720     PKGFORMAT="$with_package_format"
4721     AC_MSG_RESULT([$PKGFORMAT])
4722 else
4723     PKGFORMAT=
4724     AC_MSG_RESULT([none])
4726 AC_SUBST(PKGFORMAT)
4728 dnl ===================================================================
4729 dnl Set up a different compiler to produce tools to run on the build
4730 dnl machine when doing cross-compilation
4731 dnl ===================================================================
4733 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4734 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4735 if test "$cross_compiling" = "yes"; then
4736     AC_MSG_CHECKING([for BUILD platform configuration])
4737     echo
4738     rm -rf CONF-FOR-BUILD config_build.mk
4739     mkdir CONF-FOR-BUILD
4740     # Here must be listed all files needed when running the configure script. In particular, also
4741     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4742     # keep them in the same order as there.
4743     (cd $SRC_ROOT && tar cf - \
4744         config.guess \
4745         bin/get_config_variables \
4746         solenv/bin/getcompver.awk \
4747         solenv/inc/langlist.mk \
4748         download.lst \
4749         config_host.mk.in \
4750         config_host_lang.mk.in \
4751         Makefile.in \
4752         bin/bffvalidator.sh.in \
4753         bin/odfvalidator.sh.in \
4754         bin/officeotron.sh.in \
4755         instsetoo_native/util/openoffice.lst.in \
4756         config_host/*.in \
4757         sysui/desktop/macosx/Info.plist.in) \
4758     | (cd CONF-FOR-BUILD && tar xf -)
4759     cp configure CONF-FOR-BUILD
4760     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4761     (
4762     unset COM USING_X11 OS CPUNAME
4763     unset CC CXX SYSBASE CFLAGS
4764     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4765     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4766     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4767     if test -n "$CC_FOR_BUILD"; then
4768         export CC="$CC_FOR_BUILD"
4769         CC_BASE=`first_arg_basename "$CC"`
4770     fi
4771     if test -n "$CXX_FOR_BUILD"; then
4772         export CXX="$CXX_FOR_BUILD"
4773         CXX_BASE=`first_arg_basename "$CXX"`
4774     fi
4775     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4776     cd CONF-FOR-BUILD
4777     sub_conf_opts=""
4778     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4779     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4780     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4781     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4782     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4783     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4784     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4785     # Don't bother having configure look for stuff not needed for the build platform anyway
4786     ./configure \
4787         --disable-cups \
4788         --disable-gstreamer-1-0 \
4789         --disable-gtk \
4790         --disable-gtk3 \
4791         --disable-pdfimport \
4792         --disable-postgresql-sdbc \
4793         --enable-icecream="$enable_icecream" \
4794         --with-parallelism="$with_parallelism" \
4795         --without-doxygen \
4796         --without-java \
4797         $sub_conf_opts \
4798         --srcdir=$srcdir \
4799         2>&1 | sed -e 's/^/    /'
4800     test -f ./config_host.mk 2>/dev/null || exit
4801     cp config_host.mk ../config_build.mk
4802     cp config_host_lang.mk ../config_build_lang.mk
4803     mv config.log ../config.Build.log
4804     mkdir -p ../config_build
4805     mv config_host/*.h ../config_build
4806     . ./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
4808     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
4809         VV='$'$V
4810         VV=`eval "echo $VV"`
4811         if test -n "$VV"; then
4812             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4813             echo "$line" >>build-config
4814         fi
4815     done
4817     for V in INSTDIR INSTROOT WORKDIR; do
4818         VV='$'$V
4819         VV=`eval "echo $VV"`
4820         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4821         if test -n "$VV"; then
4822             line="${V}_FOR_BUILD='$VV'"
4823             echo "$line" >>build-config
4824         fi
4825     done
4827     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4828     echo "$line" >>build-config
4830     )
4831     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4832     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])
4833     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4834              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4836     eval `cat CONF-FOR-BUILD/build-config`
4838     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4840     rm -rf CONF-FOR-BUILD
4841 else
4842     OS_FOR_BUILD="$OS"
4843     CC_FOR_BUILD="$CC"
4844     CXX_FOR_BUILD="$CXX"
4845     INSTDIR_FOR_BUILD="$INSTDIR"
4846     INSTROOT_FOR_BUILD="$INSTROOT"
4847     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4848     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4849     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4850     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4851     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4852     WORKDIR_FOR_BUILD="$WORKDIR"
4854 AC_SUBST(OS_FOR_BUILD)
4855 AC_SUBST(INSTDIR_FOR_BUILD)
4856 AC_SUBST(INSTROOT_FOR_BUILD)
4857 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4858 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4859 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4860 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4861 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4862 AC_SUBST(WORKDIR_FOR_BUILD)
4864 dnl ===================================================================
4865 dnl Check for syslog header
4866 dnl ===================================================================
4867 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4869 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4870 dnl ===================================================================
4871 AC_MSG_CHECKING([whether to turn warnings to errors])
4872 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4873     ENABLE_WERROR="TRUE"
4874     AC_MSG_RESULT([yes])
4875 else
4876     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4877         ENABLE_WERROR="TRUE"
4878         AC_MSG_RESULT([yes])
4879     else
4880         AC_MSG_RESULT([no])
4881     fi
4883 AC_SUBST(ENABLE_WERROR)
4885 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4886 dnl ===================================================================
4887 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4888 if test -z "$enable_assert_always_abort"; then
4889    if test "$ENABLE_DEBUG" = TRUE; then
4890        enable_assert_always_abort=yes
4891    else
4892        enable_assert_always_abort=no
4893    fi
4895 if test "$enable_assert_always_abort" = "yes"; then
4896     ASSERT_ALWAYS_ABORT="TRUE"
4897     AC_MSG_RESULT([yes])
4898 else
4899     ASSERT_ALWAYS_ABORT="FALSE"
4900     AC_MSG_RESULT([no])
4902 AC_SUBST(ASSERT_ALWAYS_ABORT)
4904 # Determine whether to use ooenv for the instdir installation
4905 # ===================================================================
4906 if test $_os != "WINNT" -a $_os != "Darwin"; then
4907     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4908     if test "$enable_ooenv" = "no"; then
4909         AC_MSG_RESULT([no])
4910     else
4911         ENABLE_OOENV="TRUE"
4912         AC_MSG_RESULT([yes])
4913     fi
4915 AC_SUBST(ENABLE_OOENV)
4917 if test "$USING_X11" != TRUE; then
4918     # be sure to do not mess with unneeded stuff
4919     test_randr=no
4920     test_xrender=no
4921     test_cups=no
4922     test_dbus=no
4923     build_gstreamer_1_0=no
4924     test_kf5=no
4925     test_qt5=no
4926     test_gtk3_kde5=no
4927     enable_cairo_canvas=no
4930 if test "$OS" = "HAIKU"; then
4931     enable_cairo_canvas=yes
4932     test_kf5=yes
4935 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4936     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!])
4937     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!"
4938     enable_kf5=yes
4941 if test "$test_kf5" = "yes"; then
4942     test_qt5=yes
4945 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4946     if test "$enable_qt5" = "no"; then
4947         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4948     else
4949         enable_qt5=yes
4950     fi
4953 dnl ===================================================================
4954 dnl check for cups support
4955 dnl ===================================================================
4956 ENABLE_CUPS=""
4958 if test "$enable_cups" = "no"; then
4959     test_cups=no
4962 AC_MSG_CHECKING([whether to enable CUPS support])
4963 if test "$test_cups" = "yes"; then
4964     ENABLE_CUPS="TRUE"
4965     AC_MSG_RESULT([yes])
4967     AC_MSG_CHECKING([whether cups support is present])
4968     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4969     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4970     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4971         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4972     fi
4974 else
4975     AC_MSG_RESULT([no])
4978 AC_SUBST(ENABLE_CUPS)
4980 # fontconfig checks
4981 if test "$test_fontconfig" = "yes"; then
4982     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4983     SYSTEM_FONTCONFIG=TRUE
4984     FilterLibs "${FONTCONFIG_LIBS}"
4985     FONTCONFIG_LIBS="${filteredlibs}"
4987 AC_SUBST(FONTCONFIG_CFLAGS)
4988 AC_SUBST(FONTCONFIG_LIBS)
4989 AC_SUBST([SYSTEM_FONTCONFIG])
4991 dnl whether to find & fetch external tarballs?
4992 dnl ===================================================================
4993 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4994    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4995        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4996    else
4997        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4998    fi
5000 if test -z "$TARFILE_LOCATION"; then
5001     if test -d "$SRC_ROOT/src" ; then
5002         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5003         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5004     fi
5005     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5006 else
5007     AbsolutePath "$TARFILE_LOCATION"
5008     PathFormat "${absolute_path}"
5009     TARFILE_LOCATION="${formatted_path}"
5011 AC_SUBST(TARFILE_LOCATION)
5013 AC_MSG_CHECKING([whether we want to fetch tarballs])
5014 if test "$enable_fetch_external" != "no"; then
5015     if test "$with_all_tarballs" = "yes"; then
5016         AC_MSG_RESULT([yes, all of them])
5017         DO_FETCH_TARBALLS="ALL"
5018     else
5019         AC_MSG_RESULT([yes, if we use them])
5020         DO_FETCH_TARBALLS="TRUE"
5021     fi
5022 else
5023     AC_MSG_RESULT([no])
5024     DO_FETCH_TARBALLS=
5026 AC_SUBST(DO_FETCH_TARBALLS)
5028 AC_MSG_CHECKING([whether to build help])
5029 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5030     BUILD_TYPE="$BUILD_TYPE HELP"
5031     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5032     case "$with_help" in
5033     "html")
5034         ENABLE_HTMLHELP=TRUE
5035         SCPDEFS="$SCPDEFS -DWITH_HELP"
5036         AC_MSG_RESULT([HTML])
5037         ;;
5038     "online")
5039         ENABLE_HTMLHELP=TRUE
5040         HELP_ONLINE=TRUE
5041         AC_MSG_RESULT([HTML])
5042         ;;
5043     yes)
5044         SCPDEFS="$SCPDEFS -DWITH_HELP"
5045         AC_MSG_RESULT([yes])
5046         ;;
5047     *)
5048         AC_MSG_ERROR([Unknown --with-help=$with_help])
5049         ;;
5050     esac
5051 else
5052     AC_MSG_RESULT([no])
5054 AC_SUBST([ENABLE_HTMLHELP])
5055 AC_SUBST([HELP_ONLINE])
5057 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5058 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5059     BUILD_TYPE="$BUILD_TYPE HELP"
5060     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5061     case "$with_omindex" in
5062     "server")
5063         ENABLE_HTMLHELP=TRUE
5064         HELP_ONLINE=TRUE
5065         HELP_OMINDEX_PAGE=TRUE
5066         AC_MSG_RESULT([SERVER])
5067         ;;
5068     "noxap")
5069         ENABLE_HTMLHELP=TRUE
5070         HELP_ONLINE=TRUE
5071         HELP_OMINDEX_PAGE=FALSE
5072         AC_MSG_RESULT([NOXAP])
5073         ;;
5074     *)
5075         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5076         ;;
5077     esac
5078 else
5079     HELP_OMINDEX_PAGE=FALSE
5080     AC_MSG_RESULT([no])
5082 AC_SUBST([ENABLE_HTMLHELP])
5083 AC_SUBST([HELP_OMINDEX_PAGE])
5084 AC_SUBST([HELP_ONLINE])
5087 dnl Test whether to include MySpell dictionaries
5088 dnl ===================================================================
5089 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5090 if test "$with_myspell_dicts" = "yes"; then
5091     AC_MSG_RESULT([yes])
5092     WITH_MYSPELL_DICTS=TRUE
5093     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5094     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5095 else
5096     AC_MSG_RESULT([no])
5097     WITH_MYSPELL_DICTS=
5099 AC_SUBST(WITH_MYSPELL_DICTS)
5101 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5102 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5103     if test "$with_system_dicts" = yes; then
5104         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5105     fi
5106     with_system_dicts=no
5109 AC_MSG_CHECKING([whether to use dicts from external paths])
5110 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5111     AC_MSG_RESULT([yes])
5112     SYSTEM_DICTS=TRUE
5113     AC_MSG_CHECKING([for spelling dictionary directory])
5114     if test -n "$with_external_dict_dir"; then
5115         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5116     else
5117         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5118         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5119             DICT_SYSTEM_DIR=file:///usr/share/myspell
5120         fi
5121     fi
5122     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5123     AC_MSG_CHECKING([for hyphenation patterns directory])
5124     if test -n "$with_external_hyph_dir"; then
5125         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5126     else
5127         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5128     fi
5129     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5130     AC_MSG_CHECKING([for thesaurus directory])
5131     if test -n "$with_external_thes_dir"; then
5132         THES_SYSTEM_DIR=file://$with_external_thes_dir
5133     else
5134         THES_SYSTEM_DIR=file:///usr/share/mythes
5135     fi
5136     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5137 else
5138     AC_MSG_RESULT([no])
5139     SYSTEM_DICTS=
5141 AC_SUBST(SYSTEM_DICTS)
5142 AC_SUBST(DICT_SYSTEM_DIR)
5143 AC_SUBST(HYPH_SYSTEM_DIR)
5144 AC_SUBST(THES_SYSTEM_DIR)
5146 dnl ===================================================================
5147 dnl Precompiled headers.
5148 ENABLE_PCH=""
5149 AC_MSG_CHECKING([whether to enable pch feature])
5150 if test -z "$enable_pch"; then
5151     if test "$_os" = "WINNT"; then
5152         # Enabled by default on Windows.
5153         enable_pch=yes
5154     else
5155         enable_pch=no
5156     fi
5158 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5159     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5161 if test "$enable_pch" = "system"; then
5162     ENABLE_PCH="1"
5163     AC_MSG_RESULT([yes (system headers)])
5164 elif test "$enable_pch" = "base"; then
5165     ENABLE_PCH="2"
5166     AC_MSG_RESULT([yes (system and base headers)])
5167 elif test "$enable_pch" = "normal"; then
5168     ENABLE_PCH="3"
5169     AC_MSG_RESULT([yes (normal)])
5170 elif test "$enable_pch" = "full"; then
5171     ENABLE_PCH="4"
5172     AC_MSG_RESULT([yes (full)])
5173 elif test "$enable_pch" = "yes"; then
5174     # Pick a suitable default.
5175     if test "$GCC" = "yes"; then
5176         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5177         # while making the PCHs larger and rebuilds more likely.
5178         ENABLE_PCH="2"
5179         AC_MSG_RESULT([yes (system and base headers)])
5180     else
5181         # With MSVC the highest level makes a significant difference,
5182         # and it was the default when there used to be no PCH levels.
5183         ENABLE_PCH="4"
5184         AC_MSG_RESULT([yes (full)])
5185     fi
5186 elif test "$enable_pch" = "no"; then
5187     AC_MSG_RESULT([no])
5188 else
5189     AC_MSG_ERROR([Unknown value for --enable-pch])
5191 AC_SUBST(ENABLE_PCH)
5192 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5193 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5194     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5195     if test "$CCACHE_BIN" != "not found"; then
5196         AC_MSG_CHECKING([ccache version])
5197         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5198         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5199         AC_MSG_RESULT([$CCACHE_VERSION])
5200         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5201         if test "$CCACHE_NUMVER" -gt "030701"; then
5202             AC_MSG_RESULT([yes])
5203         else
5204             AC_MSG_RESULT([no (not newer than 3.7.1)])
5205             CCACHE_DEPEND_MODE=
5206         fi
5207     fi
5210 BUILDING_PCH_WITH_OBJ=
5211 if test -n "$ENABLE_PCH"; then
5212     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5213     save_CFLAGS=$CFLAGS
5214     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5215     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5216     CFLAGS=$save_CFLAGS
5217     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5218         AC_MSG_RESULT(yes)
5219     else
5220         AC_MSG_RESULT(no)
5221     fi
5223 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5225 PCH_MODULES_CODEGEN=
5226 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5227     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-codegen])
5228     save_CFLAGS=$CFLAGS
5229     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-codegen"
5230     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_CODEGEN="-Xclang -fmodules-codegen" ],[])
5231     CFLAGS=$save_CFLAGS
5232     if test -n "$PCH_MODULES_CODEGEN"; then
5233         AC_MSG_RESULT(yes)
5234     else
5235         AC_MSG_RESULT(no)
5236     fi
5237     CFLAGS=$save_CFLAGS
5239 AC_SUBST(PCH_MODULES_CODEGEN)
5240 PCH_MODULES_DEBUGINFO=
5241 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5242     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-debuginfo])
5243     save_CFLAGS=$CFLAGS
5244     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-debuginfo"
5245     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_DEBUGINFO="-Xclang -fmodules-debuginfo" ],[])
5246     CFLAGS=$save_CFLAGS
5247     if test -n "$PCH_MODULES_DEBUGINFO"; then
5248         AC_MSG_RESULT(yes)
5249     else
5250         AC_MSG_RESULT(no)
5251     fi
5252     CFLAGS=$save_CFLAGS
5254 AC_SUBST(PCH_MODULES_DEBUGINFO)
5256 TAB=`printf '\t'`
5258 AC_MSG_CHECKING([the GNU Make version])
5259 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5260 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5261 if test "$_make_longver" -ge "038200"; then
5262     AC_MSG_RESULT([$GNUMAKE $_make_version])
5264 elif test "$_make_longver" -ge "038100"; then
5265     if test "$build_os" = "cygwin"; then
5266         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5267     fi
5268     AC_MSG_RESULT([$GNUMAKE $_make_version])
5270     dnl ===================================================================
5271     dnl Search all the common names for sha1sum
5272     dnl ===================================================================
5273     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5274     if test -z "$SHA1SUM"; then
5275         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5276     elif test "$SHA1SUM" = "openssl"; then
5277         SHA1SUM="openssl sha1"
5278     fi
5279     AC_MSG_CHECKING([for GNU Make bug 20033])
5280     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5281     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5282 A := \$(wildcard *.a)
5284 .PHONY: all
5285 all: \$(A:.a=.b)
5286 <TAB>@echo survived bug20033.
5288 .PHONY: setup
5289 setup:
5290 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5292 define d1
5293 @echo lala \$(1)
5294 @sleep 1
5295 endef
5297 define d2
5298 @echo tyty \$(1)
5299 @sleep 1
5300 endef
5302 %.b : %.a
5303 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5304 <TAB>\$(call d1,\$(CHECKSUM)),\
5305 <TAB>\$(call d2,\$(CHECKSUM)))
5307     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5308         no_parallelism_make="YES"
5309         AC_MSG_RESULT([yes, disable parallelism])
5310     else
5311         AC_MSG_RESULT([no, keep parallelism enabled])
5312     fi
5313     rm -rf $TESTGMAKEBUG20033
5314 else
5315     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5318 # find if gnumake support file function
5319 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5320 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5321 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5322     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5324 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5325 \$(file >test.txt,Success )
5327 .PHONY: all
5328 all:
5329 <TAB>@cat test.txt
5332 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5333 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5334     HAVE_GNUMAKE_FILE_FUNC=TRUE
5335     AC_MSG_RESULT([yes])
5336 else
5337     AC_MSG_RESULT([no])
5339 rm -rf $TESTGMAKEFILEFUNC
5340 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5341 AC_SUBST(GNUMAKE_WIN_NATIVE)
5343 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5344 STALE_MAKE=
5345 if test "$_make_ver_check" = ""; then
5346    STALE_MAKE=TRUE
5349 HAVE_LD_HASH_STYLE=FALSE
5350 WITH_LINKER_HASH_STYLE=
5351 AC_MSG_CHECKING([for --hash-style gcc linker support])
5352 if test "$GCC" = "yes"; then
5353     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5354         hash_styles="gnu sysv"
5355     elif test "$with_linker_hash_style" = "no"; then
5356         hash_styles=
5357     else
5358         hash_styles="$with_linker_hash_style"
5359     fi
5361     for hash_style in $hash_styles; do
5362         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5363         hash_style_ldflags_save=$LDFLAGS
5364         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5366         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5367             [
5368 #include <stdio.h>
5369             ],[
5370 printf ("");
5371             ])],
5372             [
5373                   HAVE_LD_HASH_STYLE=TRUE
5374                   WITH_LINKER_HASH_STYLE=$hash_style
5375             ],
5376             [HAVE_LD_HASH_STYLE=FALSE],
5377             [HAVE_LD_HASH_STYLE=FALSE])
5378         LDFLAGS=$hash_style_ldflags_save
5379     done
5381     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5382         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5383     else
5384         AC_MSG_RESULT( no )
5385     fi
5386     LDFLAGS=$hash_style_ldflags_save
5387 else
5388     AC_MSG_RESULT( no )
5390 AC_SUBST(HAVE_LD_HASH_STYLE)
5391 AC_SUBST(WITH_LINKER_HASH_STYLE)
5393 dnl ===================================================================
5394 dnl Check whether there's a Perl version available.
5395 dnl ===================================================================
5396 if test -z "$with_perl_home"; then
5397     AC_PATH_PROG(PERL, perl)
5398 else
5399     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5400     _perl_path="$with_perl_home/bin/perl"
5401     if test -x "$_perl_path"; then
5402         PERL=$_perl_path
5403     else
5404         AC_MSG_ERROR([$_perl_path not found])
5405     fi
5408 dnl ===================================================================
5409 dnl Testing for Perl version 5 or greater.
5410 dnl $] is the Perl version variable, it is returned as an integer
5411 dnl ===================================================================
5412 if test "$PERL"; then
5413     AC_MSG_CHECKING([the Perl version])
5414     ${PERL} -e "exit($]);"
5415     _perl_version=$?
5416     if test "$_perl_version" -lt 5; then
5417         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5418     fi
5419     AC_MSG_RESULT([Perl $_perl_version])
5420 else
5421     AC_MSG_ERROR([Perl not found, install Perl 5])
5424 dnl ===================================================================
5425 dnl Testing for required Perl modules
5426 dnl ===================================================================
5428 AC_MSG_CHECKING([for required Perl modules])
5429 perl_use_string="use Cwd ; use Digest::MD5"
5430 if test "$_os" = "WINNT"; then
5431     if test -n "$PKGFORMAT"; then
5432         for i in $PKGFORMAT; do
5433             case "$i" in
5434             msi)
5435                 # for getting fonts versions to use in MSI
5436                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5437                 ;;
5438             esac
5439         done
5440     fi
5442 if test "$with_system_hsqldb" = "yes"; then
5443     perl_use_string="$perl_use_string ; use Archive::Zip"
5445 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5446     AC_MSG_RESULT([all modules found])
5447 else
5448     AC_MSG_RESULT([failed to find some modules])
5449     # Find out which modules are missing.
5450     for i in $perl_use_string; do
5451         if test "$i" != "use" -a "$i" != ";"; then
5452             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5453                 missing_perl_modules="$missing_perl_modules $i"
5454             fi
5455         fi
5456     done
5457     AC_MSG_ERROR([
5458     The missing Perl modules are: $missing_perl_modules
5459     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5462 dnl ===================================================================
5463 dnl Check for pkg-config
5464 dnl ===================================================================
5465 if test "$_os" != "WINNT"; then
5466     PKG_PROG_PKG_CONFIG
5469 if test "$_os" != "WINNT"; then
5471     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5472     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5473     # explicitly. Or put /path/to/compiler in PATH yourself.
5475     # Use wrappers for LTO
5476     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5477         AC_CHECK_TOOL(AR,gcc-ar)
5478         AC_CHECK_TOOL(NM,gcc-nm)
5479         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5480     else
5481         AC_CHECK_TOOL(AR,ar)
5482         AC_CHECK_TOOL(NM,nm)
5483         AC_CHECK_TOOL(RANLIB,ranlib)
5484     fi
5485     AC_CHECK_TOOL(OBJDUMP,objdump)
5486     AC_CHECK_TOOL(READELF,readelf)
5487     AC_CHECK_TOOL(STRIP,strip)
5488     if test "$_os" = "WINNT"; then
5489         AC_CHECK_TOOL(DLLTOOL,dlltool)
5490         AC_CHECK_TOOL(WINDRES,windres)
5491     fi
5493 AC_SUBST(AR)
5494 AC_SUBST(DLLTOOL)
5495 AC_SUBST(NM)
5496 AC_SUBST(OBJDUMP)
5497 AC_SUBST(PKG_CONFIG)
5498 AC_SUBST(RANLIB)
5499 AC_SUBST(READELF)
5500 AC_SUBST(STRIP)
5501 AC_SUBST(WINDRES)
5503 dnl ===================================================================
5504 dnl pkg-config checks on macOS
5505 dnl ===================================================================
5507 if test $_os = Darwin; then
5508     AC_MSG_CHECKING([for bogus pkg-config])
5509     if test -n "$PKG_CONFIG"; then
5510         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5511             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5512         else
5513             if test "$enable_bogus_pkg_config" = "yes"; then
5514                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5515             else
5516                 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.])
5517             fi
5518         fi
5519     else
5520         AC_MSG_RESULT([no, good])
5521     fi
5524 find_csc()
5526     # Return value: $csctest
5528     unset csctest
5530     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5531     if test -n "$regvalue"; then
5532         csctest=$regvalue
5533         return
5534     fi
5537 find_al()
5539     # Return value: $altest
5541     unset altest
5543     # We need this check to detect 4.6.1 or above.
5544     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5545         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5546         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5547             altest=$regvalue
5548             return
5549         fi
5550     done
5552     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5553         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5554         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5555             altest=$regvalue
5556             return
5557         fi
5558     done
5563 find_dotnetsdk46()
5565     unset frametest
5567     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5568         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5569         if test -n "$regvalue"; then
5570             frametest=$regvalue
5571             return
5572         fi
5573     done
5576 find_winsdk_version()
5578     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5579     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5581     unset winsdktest winsdkbinsubdir winsdklibsubdir
5583     case "$1" in
5584     8.0|8.0A)
5585         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5586         if test -n "$regvalue"; then
5587             winsdktest=$regvalue
5588             winsdklibsubdir=win8
5589             return
5590         fi
5591         ;;
5592     8.1|8.1A)
5593         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5594         if test -n "$regvalue"; then
5595             winsdktest=$regvalue
5596             winsdklibsubdir=winv6.3
5597             return
5598         fi
5599         ;;
5600     10.0)
5601         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5602         if test -n "$regvalue"; then
5603             winsdktest=$regvalue
5604             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5605             if test -n "$regvalue"; then
5606                 winsdkbinsubdir="$regvalue".0
5607                 winsdklibsubdir=$winsdkbinsubdir
5608                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5609                 # test exist the SDK path
5610                 if test -d "$tmppath"; then
5611                    # when path is convertible to a short path then path is okay
5612                    cygpath -d "$tmppath" >/dev/null 2>&1
5613                    if test $? -ne 0; then
5614                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5615                    fi
5616                 else
5617                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5618                 fi
5619             fi
5620             return
5621         fi
5622         ;;
5623     esac
5626 find_winsdk()
5628     # Return value: From find_winsdk_version
5630     unset winsdktest
5632     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5633         find_winsdk_version $ver
5634         if test -n "$winsdktest"; then
5635             return
5636         fi
5637     done
5640 find_msms()
5642     AC_MSG_CHECKING([for MSVC merge modules directory])
5643     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5644     case "$VCVER" in
5645         160)
5646         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5647         ;;
5648     esac
5649     for f in $my_msm_files; do
5650         echo "$as_me:$LINENO: searching for $f" >&5
5651     done
5653     msmdir=
5654     for ver in 14.0 15.0; do
5655         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5656         if test -n "$regvalue"; then
5657             for f in ${my_msm_files}; do
5658                 if test -e "$regvalue/${f}"; then
5659                     msmdir=$regvalue
5660                     break
5661                 fi
5662             done
5663         fi
5664     done
5665     dnl Is the following fallback really necessary, or was it added in response
5666     dnl to never having started Visual Studio on a given machine, so the
5667     dnl registry keys checked above had presumably not yet been created?
5668     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5669     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5670     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5671     dnl expanding to "C:\Program Files\Common Files"), which would need
5672     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5673     dnl obtain its value from cygwin:
5674     if test -z "$msmdir"; then
5675         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5676         for f in ${my_msm_files}; do
5677             if test -e "$my_msm_dir/${f}"; then
5678                 msmdir=$my_msm_dir
5679             fi
5680         done
5681     fi
5683     dnl Starting from MSVC 15.0, merge modules are located in different directory
5684     case "$VCVER" in
5685     160)
5686         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5687             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5688             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5689             for f in ${my_msm_files}; do
5690                 if test -e "$my_msm_dir/${f}"; then
5691                     msmdir=$my_msm_dir
5692                     break
5693                 fi
5694             done
5695         done
5696         ;;
5697     esac
5699     if test -n "$msmdir"; then
5700         msmdir=`cygpath -m "$msmdir"`
5701         AC_MSG_RESULT([$msmdir])
5702     else
5703         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5704             AC_MSG_FAILURE([not found])
5705         else
5706             AC_MSG_WARN([not found (check config.log)])
5707             add_warning "MSM none of ${my_msm_files} found"
5708         fi
5709     fi
5712 find_msvc_x64_dlls()
5714     AC_MSG_CHECKING([for MSVC x64 DLL path])
5715     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5716     case "$VCVER" in
5717     160)
5718         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5719             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5720             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5721                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5722                 break
5723             fi
5724             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5725             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5726                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5727                 break
5728             fi
5729         done
5730         ;;
5731     esac
5732     AC_MSG_RESULT([$msvcdllpath])
5733     AC_MSG_CHECKING([for MSVC x64 DLLs])
5734     msvcdlls="msvcp140.dll vcruntime140.dll"
5735     for dll in $msvcdlls; do
5736         if ! test -f "$msvcdllpath/$dll"; then
5737             AC_MSG_FAILURE([missing $dll])
5738         fi
5739     done
5740     AC_MSG_RESULT([found all ($msvcdlls)])
5743 dnl =========================================
5744 dnl Check for the Windows  SDK.
5745 dnl =========================================
5746 if test "$_os" = "WINNT"; then
5747     AC_MSG_CHECKING([for Windows SDK])
5748     if test "$build_os" = "cygwin"; then
5749         find_winsdk
5750         WINDOWS_SDK_HOME=$winsdktest
5752         # normalize if found
5753         if test -n "$WINDOWS_SDK_HOME"; then
5754             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5755             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5756         fi
5758         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5759     fi
5761     if test -n "$WINDOWS_SDK_HOME"; then
5762         # Remove a possible trailing backslash
5763         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5765         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5766              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5767              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5768             have_windows_sdk_headers=yes
5769         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5770              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5771              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5772             have_windows_sdk_headers=yes
5773         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5774              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5775              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5776             have_windows_sdk_headers=yes
5777         else
5778             have_windows_sdk_headers=no
5779         fi
5781         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5782             have_windows_sdk_libs=yes
5783         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5784             have_windows_sdk_libs=yes
5785         else
5786             have_windows_sdk_libs=no
5787         fi
5789         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5790             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5791 the  Windows SDK are installed.])
5792         fi
5793     fi
5795     if test -z "$WINDOWS_SDK_HOME"; then
5796         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5797     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5798         WINDOWS_SDK_VERSION=80
5799         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5800     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5801         WINDOWS_SDK_VERSION=81
5802         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5803     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5804         WINDOWS_SDK_VERSION=10
5805         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5806     else
5807         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5808     fi
5809     PathFormat "$WINDOWS_SDK_HOME"
5810     WINDOWS_SDK_HOME="$formatted_path"
5811     if test "$build_os" = "cygwin"; then
5812         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5813         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5814             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5815         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5816             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5817         fi
5818     fi
5820     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5821     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5822     dnl but not in v8.0), so allow this to be overridden with a
5823     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5824     dnl and configuration error if no WiLangId.vbs is found would arguably be
5825     dnl better, but I do not know under which conditions exactly it is needed by
5826     dnl msiglobal.pm:
5827     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5828         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5829         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5830             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5831         fi
5832         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5833             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5834         fi
5835         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5836             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5837         fi
5838     fi
5839     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5840         if test -n "$with_package_format" -a "$with_package_format" != no; then
5841             for i in "$with_package_format"; do
5842                 if test "$i" = "msi"; then
5843                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5844                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5845                     fi
5846                 fi
5847             done
5848         fi
5849     fi
5851 AC_SUBST(WINDOWS_SDK_HOME)
5852 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5853 AC_SUBST(WINDOWS_SDK_VERSION)
5854 AC_SUBST(WINDOWS_SDK_WILANGID)
5856 if test "$build_os" = "cygwin"; then
5857     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5858     dnl dir, it also determines that dir's path w/o an arch segment if any,
5859     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5860     AC_MSG_CHECKING([for midl.exe])
5862     find_winsdk
5863     if test -n "$winsdkbinsubdir" \
5864         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5865     then
5866         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5867         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5868     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5869         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5870         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5871     elif test -f "$winsdktest/Bin/midl.exe"; then
5872         MIDL_PATH=$winsdktest/Bin
5873         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5874     fi
5875     if test ! -f "$MIDL_PATH/midl.exe"; then
5876         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5877     else
5878         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5879     fi
5881     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5882     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5884     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5885          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5886          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5887          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5888     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5889          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5890          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5891          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5892     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5893          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5894          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5895          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5896     else
5897         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5898     fi
5900     dnl Check csc.exe
5901     AC_MSG_CHECKING([for csc.exe])
5902     find_csc
5903     if test -f "$csctest/csc.exe"; then
5904         CSC_PATH="$csctest"
5905     fi
5906     if test ! -f "$CSC_PATH/csc.exe"; then
5907         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5908     else
5909         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5910     fi
5912     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5914     dnl Check al.exe
5915     AC_MSG_CHECKING([for al.exe])
5916     find_winsdk
5917     if test -n "$winsdkbinsubdir" \
5918         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5919     then
5920         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5921     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5922         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5923     elif test -f "$winsdktest/Bin/al.exe"; then
5924         AL_PATH="$winsdktest/Bin"
5925     fi
5927     if test -z "$AL_PATH"; then
5928         find_al
5929         if test -f "$altest/bin/al.exe"; then
5930             AL_PATH="$altest/bin"
5931         elif test -f "$altest/al.exe"; then
5932             AL_PATH="$altest"
5933         fi
5934     fi
5935     if test ! -f "$AL_PATH/al.exe"; then
5936         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5937     else
5938         AC_MSG_RESULT([$AL_PATH/al.exe])
5939     fi
5941     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5943     dnl Check mscoree.lib / .NET Framework dir
5944     AC_MSG_CHECKING(.NET Framework)
5945     find_dotnetsdk46
5946     PathFormat "$frametest"
5947     frametest="$formatted_path"
5948     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5949         DOTNET_FRAMEWORK_HOME="$frametest"
5950     else
5951         find_winsdk
5952         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5953             DOTNET_FRAMEWORK_HOME="$winsdktest"
5954         fi
5955     fi
5956     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
5957         AC_MSG_ERROR([mscoree.lib not found])
5958     fi
5959     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5961     PathFormat "$MIDL_PATH"
5962     MIDL_PATH="$formatted_path"
5964     PathFormat "$AL_PATH"
5965     AL_PATH="$formatted_path"
5967     PathFormat "$DOTNET_FRAMEWORK_HOME"
5968     DOTNET_FRAMEWORK_HOME="$formatted_path"
5970     PathFormat "$CSC_PATH"
5971     CSC_PATH="$formatted_path"
5974 dnl ===================================================================
5975 dnl Check if stdc headers are available excluding MSVC.
5976 dnl ===================================================================
5977 if test "$_os" != "WINNT"; then
5978     AC_HEADER_STDC
5981 dnl ===================================================================
5982 dnl Testing for C++ compiler and version...
5983 dnl ===================================================================
5985 if test "$_os" != "WINNT"; then
5986     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5987     save_CXXFLAGS=$CXXFLAGS
5988     AC_PROG_CXX
5989     CXXFLAGS=$save_CXXFLAGS
5990     if test -z "$CXX_BASE"; then
5991         CXX_BASE=`first_arg_basename "$CXX"`
5992     fi
5995 dnl check for GNU C++ compiler version
5996 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5997     AC_MSG_CHECKING([the GNU C++ compiler version])
5999     _gpp_version=`$CXX -dumpversion`
6000     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6002     if test "$_gpp_majmin" -lt "700"; then
6003         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6004     else
6005         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6006     fi
6008     dnl see https://code.google.com/p/android/issues/detail?id=41770
6009         glibcxx_threads=no
6010         AC_LANG_PUSH([C++])
6011         AC_REQUIRE_CPP
6012         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6013         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6014             #include <bits/c++config.h>]],[[
6015             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6016             && !defined(_GLIBCXX__PTHREADS) \
6017             && !defined(_GLIBCXX_HAS_GTHREADS)
6018             choke me
6019             #endif
6020         ]])],[AC_MSG_RESULT([yes])
6021         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6022         AC_LANG_POP([C++])
6023         if test $glibcxx_threads = yes; then
6024             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6025         fi
6027 AC_SUBST(BOOST_CXXFLAGS)
6030 # prefx CXX with ccache if needed
6032 if test "$CCACHE" != ""; then
6033     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6034     AC_LANG_PUSH([C++])
6035     save_CXXFLAGS=$CXXFLAGS
6036     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6037     dnl an empty program will do, we're checking the compiler flags
6038     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6039                       [use_ccache=yes], [use_ccache=no])
6040     if test $use_ccache = yes; then
6041         AC_MSG_RESULT([yes])
6042     else
6043         CXX="$CCACHE $CXX"
6044         CXX_BASE="ccache $CXX_BASE"
6045         AC_MSG_RESULT([no])
6046     fi
6047     CXXFLAGS=$save_CXXFLAGS
6048     AC_LANG_POP([C++])
6051 dnl ===================================================================
6052 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6053 dnl ===================================================================
6055 if test "$_os" != "WINNT"; then
6056     AC_PROG_CXXCPP
6058     dnl Check whether there's a C pre-processor.
6059     AC_PROG_CPP
6063 dnl ===================================================================
6064 dnl Find integral type sizes and alignments
6065 dnl ===================================================================
6067 if test "$_os" != "WINNT"; then
6069 if test "$_os" = "iOS"; then
6070     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6071     ac_cv_sizeof_long=8
6072     ac_cv_sizeof_short=2
6073     ac_cv_sizeof_int=4
6074     ac_cv_sizeof_long_long=8
6075     ac_cv_sizeof_double=8
6076     ac_cv_sizeof_voidp=8
6077 else
6078     AC_CHECK_SIZEOF(long)
6079     AC_CHECK_SIZEOF(short)
6080     AC_CHECK_SIZEOF(int)
6081     AC_CHECK_SIZEOF(long long)
6082     AC_CHECK_SIZEOF(double)
6083     AC_CHECK_SIZEOF(void*)
6086     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6087     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6088     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6089     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6090     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6092     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6093     m4_pattern_allow([AC_CHECK_ALIGNOF])
6094     m4_ifdef([AC_CHECK_ALIGNOF],
6095         [
6096             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6097             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6098             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6099             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6100         ],
6101         [
6102             case "$_os-$host_cpu" in
6103             Linux-i686)
6104                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6105                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6106                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6107                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6108                 ;;
6109             Linux-x86_64)
6110                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6111                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6112                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6113                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6114                 ;;
6115             *)
6116                 if test -z "$ac_cv_alignof_short" -o \
6117                         -z "$ac_cv_alignof_int" -o \
6118                         -z "$ac_cv_alignof_long" -o \
6119                         -z "$ac_cv_alignof_double"; then
6120                    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.])
6121                 fi
6122                 ;;
6123             esac
6124         ])
6126     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6127     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6128     if test $ac_cv_sizeof_long -eq 8; then
6129         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6130     elif test $ac_cv_sizeof_double -eq 8; then
6131         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6132     else
6133         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6134     fi
6136     dnl Check for large file support
6137     AC_SYS_LARGEFILE
6138     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6139         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6140     fi
6141     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6142         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6143     fi
6144 else
6145     # Hardcode for MSVC
6146     SAL_TYPES_SIZEOFSHORT=2
6147     SAL_TYPES_SIZEOFINT=4
6148     SAL_TYPES_SIZEOFLONG=4
6149     SAL_TYPES_SIZEOFLONGLONG=8
6150     if test "$BITNESS_OVERRIDE" = ""; then
6151         SAL_TYPES_SIZEOFPOINTER=4
6152     else
6153         SAL_TYPES_SIZEOFPOINTER=8
6154     fi
6155     SAL_TYPES_ALIGNMENT2=2
6156     SAL_TYPES_ALIGNMENT4=4
6157     SAL_TYPES_ALIGNMENT8=8
6158     LFS_CFLAGS=''
6160 AC_SUBST(LFS_CFLAGS)
6162 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6163 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6164 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6165 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6166 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6167 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6168 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6169 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6171 dnl ===================================================================
6172 dnl Check whether to enable runtime optimizations
6173 dnl ===================================================================
6174 ENABLE_RUNTIME_OPTIMIZATIONS=
6175 AC_MSG_CHECKING([whether to enable runtime optimizations])
6176 if test -z "$enable_runtime_optimizations"; then
6177     for i in $CC; do
6178         case $i in
6179         -fsanitize=*)
6180             enable_runtime_optimizations=no
6181             break
6182             ;;
6183         esac
6184     done
6186 if test "$enable_runtime_optimizations" != no; then
6187     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6188     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6189     AC_MSG_RESULT([yes])
6190 else
6191     AC_MSG_RESULT([no])
6193 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6195 dnl ===================================================================
6196 dnl Check if valgrind headers are available
6197 dnl ===================================================================
6198 ENABLE_VALGRIND=
6199 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6200     prev_cppflags=$CPPFLAGS
6201     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6202     # or where does it come from?
6203     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6204     AC_CHECK_HEADER([valgrind/valgrind.h],
6205         [ENABLE_VALGRIND=TRUE])
6206     CPPFLAGS=$prev_cppflags
6208 AC_SUBST([ENABLE_VALGRIND])
6209 if test -z "$ENABLE_VALGRIND"; then
6210     if test "$with_valgrind" = yes; then
6211         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6212     fi
6213     VALGRIND_CFLAGS=
6215 AC_SUBST([VALGRIND_CFLAGS])
6218 dnl ===================================================================
6219 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6220 dnl ===================================================================
6222 # We need at least the sys/sdt.h include header.
6223 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6224 if test "$SDT_H_FOUND" = "TRUE"; then
6225     # Found sys/sdt.h header, now make sure the c++ compiler works.
6226     # Old g++ versions had problems with probes in constructors/destructors.
6227     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6228     AC_LANG_PUSH([C++])
6229     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6230     #include <sys/sdt.h>
6231     class ProbeClass
6232     {
6233     private:
6234       int& ref;
6235       const char *name;
6237     public:
6238       ProbeClass(int& v, const char *n) : ref(v), name(n)
6239       {
6240         DTRACE_PROBE2(_test_, cons, name, ref);
6241       }
6243       void method(int min)
6244       {
6245         DTRACE_PROBE3(_test_, meth, name, ref, min);
6246         ref -= min;
6247       }
6249       ~ProbeClass()
6250       {
6251         DTRACE_PROBE2(_test_, dest, name, ref);
6252       }
6253     };
6254     ]],[[
6255     int i = 64;
6256     DTRACE_PROBE1(_test_, call, i);
6257     ProbeClass inst = ProbeClass(i, "call");
6258     inst.method(24);
6259     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6260           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6261     AC_LANG_POP([C++])
6263 AC_CONFIG_HEADERS([config_host/config_probes.h])
6265 dnl ===================================================================
6266 dnl GCC features
6267 dnl ===================================================================
6268 HAVE_GCC_STACK_CLASH_PROTECTION=
6269 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6270     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6271     save_CFLAGS=$CFLAGS
6272     CFLAGS="$CFLAGS -fstack-clash-protection"
6273     AC_LINK_IFELSE(
6274         [AC_LANG_PROGRAM(, [[return 0;]])],
6275         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6276         [AC_MSG_RESULT([no])])
6277     CFLAGS=$save_CFLAGS
6279     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6280     save_CFLAGS=$CFLAGS
6281     CFLAGS="$CFLAGS -Werror -mno-avx"
6282     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6283     CFLAGS=$save_CFLAGS
6284     if test "$HAVE_GCC_AVX" = "TRUE"; then
6285         AC_MSG_RESULT([yes])
6286     else
6287         AC_MSG_RESULT([no])
6288     fi
6290     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6291     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6292     int v = 0;
6293     if (__sync_add_and_fetch(&v, 1) != 1 ||
6294         __sync_sub_and_fetch(&v, 1) != 0)
6295         return 1;
6296     __sync_synchronize();
6297     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6298         v != 1)
6299         return 1;
6300     return 0;
6301 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6302     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6303         AC_MSG_RESULT([yes])
6304         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6305     else
6306         AC_MSG_RESULT([no])
6307     fi
6309     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6310     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6311     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6312         AC_MSG_RESULT([yes])
6313         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6314     else
6315         AC_MSG_RESULT([no])
6316     fi
6318     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6319     save_CFLAGS=$CFLAGS
6320     CFLAGS="$CFLAGS -Werror"
6321     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6322             __attribute__((deprecated("test"))) void f();
6323         ])], [
6324             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6325             AC_MSG_RESULT([yes])
6326         ], [AC_MSG_RESULT([no])])
6327     CFLAGS=$save_CFLAGS
6329     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6330     AC_LANG_PUSH([C++])
6331     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6332             #include <cstddef>
6333             #include <cxxabi.h>
6334             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6335         ])], [
6336             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6337             AC_MSG_RESULT([yes])
6338         ], [AC_MSG_RESULT([no])])
6339     AC_LANG_POP([C++])
6341     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6342     AC_LANG_PUSH([C++])
6343     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6344             #include <cstddef>
6345             #include <cxxabi.h>
6346             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6347         ])], [
6348             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6349             AC_MSG_RESULT([yes])
6350         ], [AC_MSG_RESULT([no])])
6351     AC_LANG_POP([C++])
6353     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6354     AC_LANG_PUSH([C++])
6355     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6356             #include <cxxabi.h>
6357             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6358         ])], [
6359             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6360             AC_MSG_RESULT([yes])
6361         ], [AC_MSG_RESULT([no])])
6362     AC_LANG_POP([C++])
6364     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6365     AC_LANG_PUSH([C++])
6366     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6367             #include <cstddef>
6368             #include <cxxabi.h>
6369             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6370         ])], [
6371             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6372             AC_MSG_RESULT([yes])
6373         ], [AC_MSG_RESULT([no])])
6374     AC_LANG_POP([C++])
6376     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6377     AC_LANG_PUSH([C++])
6378     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6379             #include <cstddef>
6380             #include <cxxabi.h>
6381             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6382         ])], [
6383             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6384             AC_MSG_RESULT([yes])
6385         ], [AC_MSG_RESULT([no])])
6386     AC_LANG_POP([C++])
6388     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6389     AC_LANG_PUSH([C++])
6390     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6391             #include <cxxabi.h>
6392             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6393         ])], [
6394             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6395             AC_MSG_RESULT([yes])
6396         ], [AC_MSG_RESULT([no])])
6397     AC_LANG_POP([C++])
6399     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6400     AC_LANG_PUSH([C++])
6401     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6402             #include <cxxabi.h>
6403             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6404         ])], [
6405             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6406             AC_MSG_RESULT([yes])
6407         ], [AC_MSG_RESULT([no])])
6408     AC_LANG_POP([C++])
6410     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6411     AC_LANG_PUSH([C++])
6412     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6413             #include <cxxabi.h>
6414             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6415         ])], [
6416             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6417             AC_MSG_RESULT([yes])
6418         ], [AC_MSG_RESULT([no])])
6419     AC_LANG_POP([C++])
6421     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6422     AC_LANG_PUSH([C++])
6423     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6424             #include <cstddef>
6425             #include <cxxabi.h>
6426             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6427         ])], [
6428             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6429             AC_MSG_RESULT([yes])
6430         ], [AC_MSG_RESULT([no])])
6431     AC_LANG_POP([C++])
6433     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6434     AC_LANG_PUSH([C++])
6435     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6436             #include <cstddef>
6437             #include <cxxabi.h>
6438             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6439         ])], [
6440             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6441             AC_MSG_RESULT([yes])
6442         ], [AC_MSG_RESULT([no])])
6443     AC_LANG_POP([C++])
6445     dnl Available in GCC 4.9 and at least since Clang 3.4; this check can eventually be removed
6446     dnl completely (e.g., after libreoffice-6-5 branch off):
6447     AC_MSG_CHECKING([that $CXX_BASE supports __attribute__((warn_unused))])
6448     AC_LANG_PUSH([C++])
6449     save_CXXFLAGS=$CXXFLAGS
6450     CXXFLAGS="$CXXFLAGS -Werror"
6451     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6452             struct __attribute__((warn_unused)) dummy {};
6453         ])], [
6454             AC_MSG_RESULT([yes])
6455         ], [AC_MSG_ERROR([no])])
6456     CXXFLAGS=$save_CXXFLAGS
6457 AC_LANG_POP([C++])
6460 AC_SUBST(HAVE_GCC_AVX)
6461 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6462 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6463 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6465 dnl ===================================================================
6466 dnl Identify the C++ library
6467 dnl ===================================================================
6469 AC_MSG_CHECKING([what the C++ library is])
6470 AC_LANG_PUSH([C++])
6471 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6472 #include <utility>
6473 #ifndef __GLIBCXX__
6474 foo bar
6475 #endif
6476 ]])],
6477     [CPP_LIBRARY=GLIBCXX
6478      cpp_library_name="GNU libstdc++"
6479     ],
6480     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6481 #include <utility>
6482 #ifndef _LIBCPP_VERSION
6483 foo bar
6484 #endif
6485 ]])],
6486     [CPP_LIBRARY=LIBCPP
6487      cpp_library_name="LLVM libc++"
6488      AC_DEFINE([HAVE_LIBCXX])
6489     ],
6490     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6491 #include <utility>
6492 #ifndef _MSC_VER
6493 foo bar
6494 #endif
6495 ]])],
6496     [CPP_LIBRARY=MSVCRT
6497      cpp_library_name="Microsoft"
6498     ],
6499     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6500 AC_MSG_RESULT([$cpp_library_name])
6501 AC_LANG_POP([C++])
6503 dnl ===================================================================
6504 dnl Check for gperf
6505 dnl ===================================================================
6506 AC_PATH_PROG(GPERF, gperf)
6507 if test -z "$GPERF"; then
6508     AC_MSG_ERROR([gperf not found but needed. Install it.])
6510 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6511     GPERF=`cygpath -m $GPERF`
6513 AC_MSG_CHECKING([whether gperf is new enough])
6514 my_gperf_ver1=$($GPERF --version | head -n 1)
6515 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6516 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6517 if test "$my_gperf_ver3" -ge 301; then
6518     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6519 else
6520     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6522 AC_SUBST(GPERF)
6524 dnl ===================================================================
6525 dnl Check for system libcmis
6526 dnl ===================================================================
6527 # libcmis requires curl and we can't build curl for iOS
6528 if test $_os != iOS; then
6529     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6530     ENABLE_LIBCMIS=TRUE
6531 else
6532     ENABLE_LIBCMIS=
6534 AC_SUBST(ENABLE_LIBCMIS)
6536 dnl ===================================================================
6537 dnl C++11
6538 dnl ===================================================================
6540 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6541 CXXFLAGS_CXX11=
6542 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6543     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6544 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6545     my_flags='-std=c++20 -std=c++2a -std=c++17 -std=c++1z'
6546     for flag in $my_flags; do
6547         if test "$COM" = MSC; then
6548             flag="-Xclang $flag"
6549         fi
6550         save_CXXFLAGS=$CXXFLAGS
6551         CXXFLAGS="$CXXFLAGS $flag -Werror"
6552         if test "$SYSTEM_LIBCMIS" = TRUE; then
6553             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6554         fi
6555         AC_LANG_PUSH([C++])
6556         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6557             #include <algorithm>
6558             #include <functional>
6559             #include <vector>
6561             #if defined SYSTEM_LIBCMIS
6562             // See ucb/source/ucp/cmis/auth_provider.hxx:
6563             #if !defined __clang__
6564             #pragma GCC diagnostic push
6565             #pragma GCC diagnostic ignored "-Wdeprecated"
6566             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6567             #endif
6568             #include <libcmis/libcmis.hxx>
6569             #if !defined __clang__
6570             #pragma GCC diagnostic pop
6571             #endif
6572             #endif
6574             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6575                 std::sort(v.begin(), v.end(), fn);
6576             }
6577             ]])],[CXXFLAGS_CXX11=$flag])
6578         AC_LANG_POP([C++])
6579         CXXFLAGS=$save_CXXFLAGS
6580         if test -n "$CXXFLAGS_CXX11"; then
6581             break
6582         fi
6583     done
6585 if test -n "$CXXFLAGS_CXX11"; then
6586     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6587 else
6588     AC_MSG_ERROR(no)
6590 AC_SUBST(CXXFLAGS_CXX11)
6592 if test "$GCC" = "yes"; then
6593     save_CXXFLAGS=$CXXFLAGS
6594     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6595     CHECK_L_ATOMIC
6596     CXXFLAGS=$save_CXXFLAGS
6597     AC_SUBST(ATOMIC_LIB)
6600 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6601 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6602 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6603 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6604 dnl again towards 4.7.2:
6605 if test $CPP_LIBRARY = GLIBCXX; then
6606     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6607     AC_LANG_PUSH([C++])
6608     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6609 #include <list>
6610 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6611     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6612     //   GCC 4.7.0: 20120322
6613     //   GCC 4.7.1: 20120614
6614     // and using a range check is not possible as the mapping between
6615     // __GLIBCXX__ values and GCC versions is not monotonic
6616 /* ok */
6617 #else
6618 abi broken
6619 #endif
6620         ]])], [AC_MSG_RESULT(no, ok)],
6621         [AC_MSG_ERROR(yes)])
6622     AC_LANG_POP([C++])
6625 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6626 save_CXXFLAGS=$CXXFLAGS
6627 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6628 AC_LANG_PUSH([C++])
6630 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6631 #include <stddef.h>
6633 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6635 namespace
6637         struct b
6638         {
6639                 int i;
6640                 int j;
6641         };
6643 ]], [[
6644 struct a
6646         int i;
6647         int j;
6649 a thinga[]={{0,0}, {1,1}};
6650 b thingb[]={{0,0}, {1,1}};
6651 size_t i = sizeof(sal_n_array_size(thinga));
6652 size_t j = sizeof(sal_n_array_size(thingb));
6653 return !(i != 0 && j != 0);
6655     ], [ AC_MSG_RESULT(yes) ],
6656     [ AC_MSG_ERROR(no)])
6657 AC_LANG_POP([C++])
6658 CXXFLAGS=$save_CXXFLAGS
6660 dnl _Pragma support (may require C++11)
6661 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6662     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6663     AC_LANG_PUSH([C++])
6664     save_CXXFLAGS=$CXXFLAGS
6665     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6666     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6667             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6668         ])], [
6669             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6670             AC_MSG_RESULT([yes])
6671         ], [AC_MSG_RESULT([no])])
6672     AC_LANG_POP([C++])
6673     CXXFLAGS=$save_CXXFLAGS
6676 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6677 if test "$GCC" = yes; then
6678     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6679     AC_LANG_PUSH([C++])
6680     save_CXXFLAGS=$CXXFLAGS
6681     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6682     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6683     CXXFLAGS=$save_CXXFLAGS
6684     AC_LANG_POP([C++])
6685     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6686         AC_MSG_RESULT([yes])
6687     else
6688         AC_MSG_RESULT([no])
6689     fi
6691 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6693 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6694 AC_LANG_PUSH([C++])
6695 save_CXXFLAGS=$CXXFLAGS
6696 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6697 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6698         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6699         // supporting it:
6700         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6701         struct S {
6702         private:
6703             S(S const &);
6704         public:
6705             S();
6706             ~S();
6707         };
6708         S copy();
6709         void f() { S c(copy()); }
6710         #endif
6711     ])], [
6712         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6713         AC_MSG_RESULT([yes])
6714     ], [AC_MSG_RESULT([no])])
6715 CXXFLAGS=$save_CXXFLAGS
6716 AC_LANG_POP([C++])
6718 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6719 AC_LANG_PUSH([C++])
6720 save_CXXFLAGS=$CXXFLAGS
6721 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6722 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6723         #include <algorithm>
6724         #include <initializer_list>
6725         #include <vector>
6726         template<typename T> class S {
6727         private:
6728             std::vector<T> v_;
6729         public:
6730             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6731         };
6732         constinit S<int> s{3, 2, 1};
6733     ])], [
6734         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6735         AC_MSG_RESULT([yes])
6736     ], [AC_MSG_RESULT([no])])
6737 CXXFLAGS=$save_CXXFLAGS
6738 AC_LANG_POP([C++])
6740 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6741 AC_LANG_PUSH([C++])
6742 save_CXXFLAGS=$CXXFLAGS
6743 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6744 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6745         #include <span>
6746         #include <type_traits>
6747         // Don't check size_type directly, as it was called index_type before P1872R0:
6748         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6749     ])], [
6750         AC_DEFINE([HAVE_CPP_SPAN],[1])
6751         AC_MSG_RESULT([yes])
6752     ], [AC_MSG_RESULT([no])])
6753 CXXFLAGS=$save_CXXFLAGS
6754 AC_LANG_POP([C++])
6756 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
6757 AC_LANG_PUSH([C++])
6758 save_CXXFLAGS=$CXXFLAGS
6759 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6760 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6761         struct S1 { S1(S1 &&); };
6762         struct S2: S1 {};
6763         S1 f(S2 s) { return s; }
6764     ])], [
6765         AC_DEFINE([HAVE_P1155R3],[1])
6766         AC_MSG_RESULT([yes])
6767     ], [AC_MSG_RESULT([no])])
6768 CXXFLAGS=$save_CXXFLAGS
6769 AC_LANG_POP([C++])
6771 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
6772 dnl which is included in -Wextra anyway):
6773 HAVE_WDEPRECATED_COPY_DTOR=
6774 if test "$GCC" = yes; then
6775     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
6776     AC_LANG_PUSH([C++])
6777     save_CXXFLAGS=$CXXFLAGS
6778     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
6779     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
6780             HAVE_WDEPRECATED_COPY_DTOR=TRUE
6781             AC_MSG_RESULT([yes])
6782         ], [AC_MSG_RESULT([no])])
6783     CXXFLAGS=$save_CXXFLAGS
6784     AC_LANG_POP([C++])
6786 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
6788 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6789 dnl uninitialized warning for code like
6791 dnl   OString f();
6792 dnl   boost::optional<OString> * g(bool b) {
6793 dnl       boost::optional<OString> o;
6794 dnl       if (b) o = f();
6795 dnl       return new boost::optional<OString>(o);
6796 dnl   }
6798 dnl (as is e.g. present, in a slightly more elaborate form, in
6799 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6800 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6801 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6802 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6803     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6804     AC_LANG_PUSH([C++])
6805     save_CXXFLAGS=$CXXFLAGS
6806     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6807     if test "$ENABLE_OPTIMIZED" = TRUE; then
6808         CXXFLAGS="$CXXFLAGS -O2"
6809     else
6810         CXXFLAGS="$CXXFLAGS -O0"
6811     fi
6812     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6813             #include <new>
6814             void f1(int);
6815             struct S1 {
6816                 ~S1() { f1(n); }
6817                 int n = 0;
6818             };
6819             struct S2 {
6820                 S2() {}
6821                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6822                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6823                 void set(S1 s) {
6824                     new (stg) S1(s);
6825                     init = true;
6826                 }
6827                 bool init = false;
6828                 char stg[sizeof (S1)];
6829             } ;
6830             S1 f2();
6831             S2 * f3(bool b) {
6832                 S2 o;
6833                 if (b) o.set(f2());
6834                 return new S2(o);
6835             }
6836         ]])], [AC_MSG_RESULT([no])], [
6837             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6838             AC_MSG_RESULT([yes])
6839         ])
6840     CXXFLAGS=$save_CXXFLAGS
6841     AC_LANG_POP([C++])
6843 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6845 dnl ===================================================================
6846 dnl CPU Intrinsics support - SSE, AVX
6847 dnl ===================================================================
6849 CXXFLAGS_INTRINSICS_SSE2=
6850 CXXFLAGS_INTRINSICS_SSSE3=
6851 CXXFLAGS_INTRINSICS_SSE41=
6852 CXXFLAGS_INTRINSICS_SSE42=
6853 CXXFLAGS_INTRINSICS_AVX=
6854 CXXFLAGS_INTRINSICS_AVX2=
6855 CXXFLAGS_INTRINSICS_F16C=
6856 CXXFLAGS_INTRINSICS_FMA=
6858 if test "$GCC" = "yes"; then
6859     flag_sse2=-msse2
6860     flag_ssse3=-mssse3
6861     flag_sse41=-msse4.1
6862     flag_sse42=-msse4.2
6863     flag_avx=-mavx
6864     flag_avx2=-mavx2
6865     flag_f16c=-mf16c
6866     flag_fma=-mfma
6867 else
6868     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
6869     # MSVC seems to differentiate only between SSE and SSE2, where in fact
6870     # SSE2 seems to be SSE2+.
6871     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
6872     # is not empty (and can be tested in gbuild), moreover we now default to SSE
6873     # for 32bit x86.
6874     flag_sse2=-arch:SSE2
6875     flag_ssse3=-arch:SSE2
6876     flag_sse41=-arch:SSE2
6877     flag_sse42=-arch:SSE2
6878     flag_avx=-arch:AVX
6879     flag_avx2=-arch:AVX2
6880     # These are part of -arch:AVX2
6881     flag_f16c=-arch:AVX2
6882     flag_fma=-arch:AVX2
6885 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6886 AC_LANG_PUSH([C++])
6887 save_CXXFLAGS=$CXXFLAGS
6888 CXXFLAGS="$CXXFLAGS $flag_sse2"
6889 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6890     #include <emmintrin.h>
6891     int main () {
6892         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6893         c = _mm_xor_si128 (a, b);
6894         return 0;
6895     }
6896     ])],
6897     [can_compile_sse2=yes],
6898     [can_compile_sse2=no])
6899 AC_LANG_POP([C++])
6900 CXXFLAGS=$save_CXXFLAGS
6901 AC_MSG_RESULT([${can_compile_sse2}])
6902 if test "${can_compile_sse2}" = "yes" ; then
6903     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
6906 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6907 AC_LANG_PUSH([C++])
6908 save_CXXFLAGS=$CXXFLAGS
6909 CXXFLAGS="$CXXFLAGS $flag_ssse3"
6910 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6911     #include <tmmintrin.h>
6912     int main () {
6913         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6914         c = _mm_maddubs_epi16 (a, b);
6915         return 0;
6916     }
6917     ])],
6918     [can_compile_ssse3=yes],
6919     [can_compile_ssse3=no])
6920 AC_LANG_POP([C++])
6921 CXXFLAGS=$save_CXXFLAGS
6922 AC_MSG_RESULT([${can_compile_ssse3}])
6923 if test "${can_compile_ssse3}" = "yes" ; then
6924     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
6927 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
6928 AC_LANG_PUSH([C++])
6929 save_CXXFLAGS=$CXXFLAGS
6930 CXXFLAGS="$CXXFLAGS $flag_sse41"
6931 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6932     #include <smmintrin.h>
6933     int main () {
6934         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6935         c = _mm_cmpeq_epi64 (a, b);
6936         return 0;
6937     }
6938     ])],
6939     [can_compile_sse41=yes],
6940     [can_compile_sse41=no])
6941 AC_LANG_POP([C++])
6942 CXXFLAGS=$save_CXXFLAGS
6943 AC_MSG_RESULT([${can_compile_sse41}])
6944 if test "${can_compile_sse41}" = "yes" ; then
6945     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
6948 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
6949 AC_LANG_PUSH([C++])
6950 save_CXXFLAGS=$CXXFLAGS
6951 CXXFLAGS="$CXXFLAGS $flag_sse42"
6952 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6953     #include <nmmintrin.h>
6954     int main () {
6955         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6956         c = _mm_cmpgt_epi64 (a, b);
6957         return 0;
6958     }
6959     ])],
6960     [can_compile_sse42=yes],
6961     [can_compile_sse42=no])
6962 AC_LANG_POP([C++])
6963 CXXFLAGS=$save_CXXFLAGS
6964 AC_MSG_RESULT([${can_compile_sse42}])
6965 if test "${can_compile_sse42}" = "yes" ; then
6966     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
6969 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6970 AC_LANG_PUSH([C++])
6971 save_CXXFLAGS=$CXXFLAGS
6972 CXXFLAGS="$CXXFLAGS $flag_avx"
6973 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6974     #include <immintrin.h>
6975     int main () {
6976         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6977         c = _mm256_xor_ps(a, b);
6978         return 0;
6979     }
6980     ])],
6981     [can_compile_avx=yes],
6982     [can_compile_avx=no])
6983 AC_LANG_POP([C++])
6984 CXXFLAGS=$save_CXXFLAGS
6985 AC_MSG_RESULT([${can_compile_avx}])
6986 if test "${can_compile_avx}" = "yes" ; then
6987     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
6990 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6991 AC_LANG_PUSH([C++])
6992 save_CXXFLAGS=$CXXFLAGS
6993 CXXFLAGS="$CXXFLAGS $flag_avx2"
6994 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6995     #include <immintrin.h>
6996     int main () {
6997         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6998         c = _mm256_maddubs_epi16(a, b);
6999         return 0;
7000     }
7001     ])],
7002     [can_compile_avx2=yes],
7003     [can_compile_avx2=no])
7004 AC_LANG_POP([C++])
7005 CXXFLAGS=$save_CXXFLAGS
7006 AC_MSG_RESULT([${can_compile_avx2}])
7007 if test "${can_compile_avx2}" = "yes" ; then
7008     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7011 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7012 AC_LANG_PUSH([C++])
7013 save_CXXFLAGS=$CXXFLAGS
7014 CXXFLAGS="$CXXFLAGS $flag_f16c"
7015 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7016     #include <immintrin.h>
7017     int main () {
7018         __m128i a = _mm_set1_epi32 (0);
7019         __m128 c;
7020         c = _mm_cvtph_ps(a);
7021         return 0;
7022     }
7023     ])],
7024     [can_compile_f16c=yes],
7025     [can_compile_f16c=no])
7026 AC_LANG_POP([C++])
7027 CXXFLAGS=$save_CXXFLAGS
7028 AC_MSG_RESULT([${can_compile_f16c}])
7029 if test "${can_compile_f16c}" = "yes" ; then
7030     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7033 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7034 AC_LANG_PUSH([C++])
7035 save_CXXFLAGS=$CXXFLAGS
7036 CXXFLAGS="$CXXFLAGS $flag_fma"
7037 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7038     #include <immintrin.h>
7039     int main () {
7040         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7041         d = _mm256_fmadd_ps(a, b, c);
7042         return 0;
7043     }
7044     ])],
7045     [can_compile_fma=yes],
7046     [can_compile_fma=no])
7047 AC_LANG_POP([C++])
7048 CXXFLAGS=$save_CXXFLAGS
7049 AC_MSG_RESULT([${can_compile_fma}])
7050 if test "${can_compile_fma}" = "yes" ; then
7051     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7054 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7055 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7056 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7057 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7058 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7059 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7060 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7061 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7063 dnl ===================================================================
7064 dnl system stl sanity tests
7065 dnl ===================================================================
7066 if test "$_os" != "WINNT"; then
7068     AC_LANG_PUSH([C++])
7070     save_CPPFLAGS="$CPPFLAGS"
7071     if test -n "$MACOSX_SDK_PATH"; then
7072         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7073     fi
7075     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7076     # only.
7077     if test "$CPP_LIBRARY" = GLIBCXX; then
7078         dnl gcc#19664, gcc#22482, rhbz#162935
7079         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7080         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7081         AC_MSG_RESULT([$stlvisok])
7082         if test "$stlvisok" = "no"; then
7083             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7084         fi
7085     fi
7087     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7088     # when we don't make any dynamic libraries?
7089     if test "$DISABLE_DYNLOADING" = ""; then
7090         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7091         cat > conftestlib1.cc <<_ACEOF
7092 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7093 struct S2: S1<int> { virtual ~S2(); };
7094 S2::~S2() {}
7095 _ACEOF
7096         cat > conftestlib2.cc <<_ACEOF
7097 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7098 struct S2: S1<int> { virtual ~S2(); };
7099 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7100 _ACEOF
7101         gccvisinlineshiddenok=yes
7102         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7103             gccvisinlineshiddenok=no
7104         else
7105             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7106             dnl known to not work with -z defs (unsetting which makes the test
7107             dnl moot, though):
7108             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7109             if test "$COM_IS_CLANG" = TRUE; then
7110                 for i in $CXX $CXXFLAGS; do
7111                     case $i in
7112                     -fsanitize=*)
7113                         my_linkflagsnoundefs=
7114                         break
7115                         ;;
7116                     esac
7117                 done
7118             fi
7119             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7120                 gccvisinlineshiddenok=no
7121             fi
7122         fi
7124         rm -fr libconftest*
7125         AC_MSG_RESULT([$gccvisinlineshiddenok])
7126         if test "$gccvisinlineshiddenok" = "no"; then
7127             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7128         fi
7129     fi
7131    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7132     cat >visibility.cxx <<_ACEOF
7133 #pragma GCC visibility push(hidden)
7134 struct __attribute__ ((visibility ("default"))) TestStruct {
7135   static void Init();
7137 __attribute__ ((visibility ("default"))) void TestFunc() {
7138   TestStruct::Init();
7140 _ACEOF
7141     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7142         gccvisbroken=yes
7143     else
7144         case "$host_cpu" in
7145         i?86|x86_64)
7146             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7147                 gccvisbroken=no
7148             else
7149                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7150                     gccvisbroken=no
7151                 else
7152                     gccvisbroken=yes
7153                 fi
7154             fi
7155             ;;
7156         *)
7157             gccvisbroken=no
7158             ;;
7159         esac
7160     fi
7161     rm -f visibility.s visibility.cxx
7163     AC_MSG_RESULT([$gccvisbroken])
7164     if test "$gccvisbroken" = "yes"; then
7165         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7166     fi
7168     CPPFLAGS="$save_CPPFLAGS"
7170     AC_LANG_POP([C++])
7173 dnl ===================================================================
7174 dnl  Clang++ tests
7175 dnl ===================================================================
7177 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7178 if test "$GCC" = "yes"; then
7179     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7180     AC_LANG_PUSH([C++])
7181     save_CXXFLAGS=$CXXFLAGS
7182     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7183     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7184     CXXFLAGS=$save_CXXFLAGS
7185     AC_LANG_POP([C++])
7186     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7187         AC_MSG_RESULT([yes])
7188     else
7189         AC_MSG_RESULT([no])
7190     fi
7192 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7194 dnl ===================================================================
7195 dnl Compiler plugins
7196 dnl ===================================================================
7198 COMPILER_PLUGINS=
7199 # currently only Clang
7201 if test "$COM_IS_CLANG" != "TRUE"; then
7202     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7203         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7204         enable_compiler_plugins=no
7205     fi
7208 COMPILER_PLUGINS_COM_IS_CLANG=
7209 if test "$COM_IS_CLANG" = "TRUE"; then
7210     if test -n "$enable_compiler_plugins"; then
7211         compiler_plugins="$enable_compiler_plugins"
7212     elif test -n "$ENABLE_DBGUTIL"; then
7213         compiler_plugins=test
7214     else
7215         compiler_plugins=no
7216     fi
7217     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7218         if test "$CLANGVER" -lt 50002; then
7219             if test "$compiler_plugins" = yes; then
7220                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7221             else
7222                 compiler_plugins=no
7223             fi
7224         fi
7225     fi
7226     if test "$compiler_plugins" != "no"; then
7227         dnl The prefix where Clang resides, override to where Clang resides if
7228         dnl using a source build:
7229         if test -z "$CLANGDIR"; then
7230             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7231         fi
7232         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7233         if test -z "$COMPILER_PLUGINS_CXX"; then
7234             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7235         fi
7236         clangbindir=$CLANGDIR/bin
7237         if test "$build_os" = "cygwin"; then
7238             clangbindir=$(cygpath -u "$clangbindir")
7239         fi
7240         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7241         if test -n "$LLVM_CONFIG"; then
7242             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7243             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7244             if test -z "$CLANGLIBDIR"; then
7245                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7246             fi
7247             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7248             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7249             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7250             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7251                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7252             fi
7253             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7254             clangobjdir=$($LLVM_CONFIG --obj-root)
7255             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7256                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7257             fi
7258         fi
7259         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7260         AC_LANG_PUSH([C++])
7261         save_CXX=$CXX
7262         save_CXXCPP=$CXXCPP
7263         save_CPPFLAGS=$CPPFLAGS
7264         save_CXXFLAGS=$CXXFLAGS
7265         save_LDFLAGS=$LDFLAGS
7266         save_LIBS=$LIBS
7267         CXX=$COMPILER_PLUGINS_CXX
7268         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7269         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7270         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7271         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7272             [COMPILER_PLUGINS=TRUE],
7273             [
7274             if test "$compiler_plugins" = "yes"; then
7275                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7276             else
7277                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7278                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7279             fi
7280             ])
7281         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7282         dnl comment in compilerplugins/Makefile-clang.mk:
7283         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7284             LDFLAGS=""
7285             AC_MSG_CHECKING([for clang libraries to use])
7286             if test -z "$CLANGTOOLLIBS"; then
7287                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7288  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7289                 AC_LINK_IFELSE([
7290                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7291                         [[ clang::FullSourceLoc().dump(); ]])
7292                 ],[CLANGTOOLLIBS="$LIBS"],[])
7293             fi
7294             if test -z "$CLANGTOOLLIBS"; then
7295                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7296                 AC_LINK_IFELSE([
7297                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7298                         [[ clang::FullSourceLoc().dump(); ]])
7299                 ],[CLANGTOOLLIBS="$LIBS"],[])
7300             fi
7301             AC_MSG_RESULT([$CLANGTOOLLIBS])
7302             if test -z "$CLANGTOOLLIBS"; then
7303                 if test "$compiler_plugins" = "yes"; then
7304                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7305                 else
7306                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7307                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7308                 fi
7309                 COMPILER_PLUGINS=
7310             fi
7311             if test -n "$COMPILER_PLUGINS"; then
7312                 if test -z "$CLANGSYSINCLUDE"; then
7313                     if test -n "$LLVM_CONFIG"; then
7314                         # Path to the clang system headers (no idea if there's a better way to get it).
7315                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7316                     fi
7317                 fi
7318             fi
7319         fi
7320         CXX=$save_CXX
7321         CXXCPP=$save_CXXCPP
7322         CPPFLAGS=$save_CPPFLAGS
7323         CXXFLAGS=$save_CXXFLAGS
7324         LDFLAGS=$save_LDFLAGS
7325         LIBS="$save_LIBS"
7326         AC_LANG_POP([C++])
7328         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7329         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7330             #ifndef __clang__
7331             you lose
7332             #endif
7333             int foo=42;
7334             ]])],
7335             [AC_MSG_RESULT([yes])
7336              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7337             [AC_MSG_RESULT([no])])
7338         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7339     fi
7340 else
7341     if test "$enable_compiler_plugins" = "yes"; then
7342         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7343     fi
7345 COMPILER_PLUGINS_ANALYZER_PCH=
7346 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7347     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7349 AC_SUBST(COMPILER_PLUGINS)
7350 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7351 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7352 AC_SUBST(COMPILER_PLUGINS_CXX)
7353 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7354 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7355 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7356 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7357 AC_SUBST(CLANGDIR)
7358 AC_SUBST(CLANGLIBDIR)
7359 AC_SUBST(CLANGTOOLLIBS)
7360 AC_SUBST(CLANGSYSINCLUDE)
7362 # Plugin to help linker.
7363 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7364 # This makes --enable-lto build with clang work.
7365 AC_SUBST(LD_PLUGIN)
7367 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7368 AC_SUBST(HAVE_POSIX_FALLOCATE)
7370 dnl ===================================================================
7371 dnl Custom build version
7372 dnl ===================================================================
7374 AC_MSG_CHECKING([whether to add custom build version])
7375 if test "$with_build_version" != ""; then
7376     BUILD_VER_STRING=$with_build_version
7377     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7378 else
7379     BUILD_VER_STRING=
7380     AC_MSG_RESULT([no])
7382 AC_SUBST(BUILD_VER_STRING)
7384 JITC_PROCESSOR_TYPE=""
7385 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7386     # IBMs JDK needs this...
7387     JITC_PROCESSOR_TYPE=6
7388     export JITC_PROCESSOR_TYPE
7390 AC_SUBST([JITC_PROCESSOR_TYPE])
7392 # Misc Windows Stuff
7393 AC_ARG_WITH(ucrt-dir,
7394     AS_HELP_STRING([--with-ucrt-dir],
7395         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7396         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7397         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7398             Windows6.1-KB2999226-x64.msu
7399             Windows6.1-KB2999226-x86.msu
7400             Windows8.1-KB2999226-x64.msu
7401             Windows8.1-KB2999226-x86.msu
7402             Windows8-RT-KB2999226-x64.msu
7403             Windows8-RT-KB2999226-x86.msu
7404         A zip archive including those files is available from Microsoft site:
7405         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7407 UCRT_REDISTDIR="$with_ucrt_dir"
7408 if test $_os = "WINNT"; then
7409     find_msvc_x64_dlls
7410     find_msms
7411     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7412     MSVC_DLLS="$msvcdlls"
7413     MSM_PATH=`win_short_path_for_make "$msmdir"`
7414     # MSVC 15.3 changed it to VC141
7415     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
7416         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
7417     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7418         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7419     else
7420         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7421     fi
7423     if test "$UCRT_REDISTDIR" = "no"; then
7424         dnl explicitly disabled
7425         UCRT_REDISTDIR=""
7426     else
7427         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7428                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7429                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7430                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7431                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7432                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7433             UCRT_REDISTDIR=""
7434             if test -n "$PKGFORMAT"; then
7435                for i in $PKGFORMAT; do
7436                    case "$i" in
7437                    msi)
7438                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7439                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7440                        ;;
7441                    esac
7442                done
7443             fi
7444         fi
7445     fi
7448 AC_SUBST(UCRT_REDISTDIR)
7449 AC_SUBST(MSVC_DLL_PATH)
7450 AC_SUBST(MSVC_DLLS)
7451 AC_SUBST(MSM_PATH)
7453 dnl ===================================================================
7454 dnl Checks for Java
7455 dnl ===================================================================
7456 if test "$ENABLE_JAVA" != ""; then
7458     # Windows-specific tests
7459     if test "$build_os" = "cygwin"; then
7460         if test "$BITNESS_OVERRIDE" = 64; then
7461             bitness=64
7462         else
7463             bitness=32
7464         fi
7466         if test -z "$with_jdk_home"; then
7467             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7468             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7469             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7470             if test -n "$regvalue"; then
7471                 ver=$regvalue
7472                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7473                 _jdk_home=$regvalue
7474             fi
7475             if test -z "$with_jdk_home"; then
7476                 for ver in 1.8; do
7477                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7478                     if test -n "$regvalue"; then
7479                         _jdk_home=$regvalue
7480                         break
7481                     fi
7482                 done
7483             fi
7484             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7485                 with_jdk_home="$_jdk_home"
7486                 howfound="found automatically"
7487             else
7488                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7489             fi
7490         else
7491             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7492             howfound="you passed"
7493         fi
7494     fi
7496     # 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.
7497     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7498     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7499         with_jdk_home=`/usr/libexec/java_home`
7500     fi
7502     JAVA_HOME=; export JAVA_HOME
7503     if test -z "$with_jdk_home"; then
7504         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7505     else
7506         _java_path="$with_jdk_home/bin/$with_java"
7507         dnl Check if there is a Java interpreter at all.
7508         if test -x "$_java_path"; then
7509             JAVAINTERPRETER=$_java_path
7510         else
7511             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7512         fi
7513     fi
7515     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7516     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7517     dnl loaded by java to run JunitTests:
7518     if test "$build_os" = "cygwin"; then
7519         shortjdkhome=`cygpath -d "$with_jdk_home"`
7520         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
7521             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7522             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7523         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
7524             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7525             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7526         fi
7528         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7529             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7530         fi
7531         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7532     elif test "$cross_compiling" != "yes"; then
7533         case $CPUNAME in
7534             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7535                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7536                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7537                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7538                 fi
7539                 ;;
7540             *) # assumption: everything else 32-bit
7541                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7542                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7543                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7544                 fi
7545                 ;;
7546         esac
7547     fi
7550 dnl ===================================================================
7551 dnl Checks for JDK.
7552 dnl ===================================================================
7554 # Note that JAVA_HOME as for now always means the *build* platform's
7555 # JAVA_HOME. Whether all the complexity here actually is needed any
7556 # more or not, no idea.
7558 if test "$ENABLE_JAVA" != ""; then
7559     _gij_longver=0
7560     AC_MSG_CHECKING([the installed JDK])
7561     if test -n "$JAVAINTERPRETER"; then
7562         dnl java -version sends output to stderr!
7563         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7564             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7565         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7566             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7567         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7568             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7569         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7570             JDK=ibm
7572             dnl IBM JDK specific tests
7573             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7574             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7576             if test "$_jdk_ver" -lt 10800; then
7577                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7578             fi
7580             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7582             if test "$with_jdk_home" = ""; then
7583                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7584 you must use the "--with-jdk-home" configure option explicitly])
7585             fi
7587             JAVA_HOME=$with_jdk_home
7588         else
7589             JDK=sun
7591             dnl Sun JDK specific tests
7592             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7593             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7595             if test "$_jdk_ver" -lt 10800; then
7596                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7597             fi
7598             if test "$_jdk_ver" -gt 10800; then
7599                 JAVA_CLASSPATH_NOT_SET=TRUE
7600             fi
7602             AC_MSG_RESULT([found (JDK $_jdk)])
7603             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7604             if test "$_os" = "WINNT"; then
7605                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7606             fi
7608             # set to limit VM usage for JunitTests
7609             JAVAIFLAGS=-Xmx64M
7610             # set to limit VM usage for javac
7611             JAVAFLAGS=-J-Xmx128M
7612         fi
7613     else
7614         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7615     fi
7616 else
7617     dnl Java disabled
7618     JAVA_HOME=
7619     export JAVA_HOME
7622 dnl ===================================================================
7623 dnl Checks for javac
7624 dnl ===================================================================
7625 if test "$ENABLE_JAVA" != ""; then
7626     javacompiler="javac"
7627     : ${JAVA_SOURCE_VER=8}
7628     : ${JAVA_TARGET_VER=8}
7629     if test -z "$with_jdk_home"; then
7630         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7631     else
7632         _javac_path="$with_jdk_home/bin/$javacompiler"
7633         dnl Check if there is a Java compiler at all.
7634         if test -x "$_javac_path"; then
7635             JAVACOMPILER=$_javac_path
7636         fi
7637     fi
7638     if test -z "$JAVACOMPILER"; then
7639         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7640     fi
7641     if test "$build_os" = "cygwin"; then
7642         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7643             JAVACOMPILER="${JAVACOMPILER}.exe"
7644         fi
7645         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7646     fi
7649 dnl ===================================================================
7650 dnl Checks for javadoc
7651 dnl ===================================================================
7652 if test "$ENABLE_JAVA" != ""; then
7653     if test -z "$with_jdk_home"; then
7654         AC_PATH_PROG(JAVADOC, javadoc)
7655     else
7656         _javadoc_path="$with_jdk_home/bin/javadoc"
7657         dnl Check if there is a javadoc at all.
7658         if test -x "$_javadoc_path"; then
7659             JAVADOC=$_javadoc_path
7660         else
7661             AC_PATH_PROG(JAVADOC, javadoc)
7662         fi
7663     fi
7664     if test -z "$JAVADOC"; then
7665         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7666     fi
7667     if test "$build_os" = "cygwin"; then
7668         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7669             JAVADOC="${JAVADOC}.exe"
7670         fi
7671         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7672     fi
7674     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7675     JAVADOCISGJDOC="yes"
7676     fi
7678 AC_SUBST(JAVADOCISGJDOC)
7680 if test "$ENABLE_JAVA" != ""; then
7681     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7682     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7683         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7684            # try to recover first by looking whether we have an alternative
7685            # system as in Debian or newer SuSEs where following /usr/bin/javac
7686            # over /etc/alternatives/javac leads to the right bindir where we
7687            # just need to strip a bit away to get a valid JAVA_HOME
7688            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7689         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7690             # maybe only one level of symlink (e.g. on Mac)
7691             JAVA_HOME=$(readlink $JAVACOMPILER)
7692             if test "$(dirname $JAVA_HOME)" = "."; then
7693                 # we've got no path to trim back
7694                 JAVA_HOME=""
7695             fi
7696         else
7697             # else warn
7698             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7699             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7700             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7701             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7702         fi
7703         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7704         if test "$JAVA_HOME" != "/usr"; then
7705             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7706                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7707                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7708                 dnl Tiger already returns a JDK path...
7709                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7710             else
7711                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7712                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7713                 dnl that checks which version to run
7714                 if test -f "$JAVA_HOME"; then
7715                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7716                 fi
7717             fi
7718         fi
7719     fi
7720     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7722     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7723     if test -z "$JAVA_HOME"; then
7724         if test "x$with_jdk_home" = "x"; then
7725             cat > findhome.java <<_ACEOF
7726 [import java.io.File;
7728 class findhome
7730     public static void main(String args[])
7731     {
7732         String jrelocation = System.getProperty("java.home");
7733         File jre = new File(jrelocation);
7734         System.out.println(jre.getParent());
7735     }
7737 _ACEOF
7738             AC_MSG_CHECKING([if javac works])
7739             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7740             AC_TRY_EVAL(javac_cmd)
7741             if test $? = 0 -a -f ./findhome.class; then
7742                 AC_MSG_RESULT([javac works])
7743             else
7744                 echo "configure: javac test failed" >&5
7745                 cat findhome.java >&5
7746                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7747             fi
7748             AC_MSG_CHECKING([if gij knows its java.home])
7749             JAVA_HOME=`$JAVAINTERPRETER findhome`
7750             if test $? = 0 -a "$JAVA_HOME" != ""; then
7751                 AC_MSG_RESULT([$JAVA_HOME])
7752             else
7753                 echo "configure: java test failed" >&5
7754                 cat findhome.java >&5
7755                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7756             fi
7757             # clean-up after ourselves
7758             rm -f ./findhome.java ./findhome.class
7759         else
7760             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7761         fi
7762     fi
7764     # now check if $JAVA_HOME is really valid
7765     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7766         case "${JAVA_HOME}" in
7767             /Library/Java/JavaVirtualMachines/*)
7768                 ;;
7769             *)
7770                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7771                 ;;
7772         esac
7773         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7774             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7775             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7776             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7777             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7778             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7779             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7780         fi
7781     fi
7782     PathFormat "$JAVA_HOME"
7783     JAVA_HOME="$formatted_path"
7786 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7787     "$_os" != Darwin
7788 then
7789     AC_MSG_CHECKING([for JAWT lib])
7790     if test "$_os" = WINNT; then
7791         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7792         JAWTLIB=jawt.lib
7793     else
7794         case "$host_cpu" in
7795         arm*)
7796             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7797             JAVA_ARCH=$my_java_arch
7798             ;;
7799         i*86)
7800             my_java_arch=i386
7801             ;;
7802         m68k)
7803             my_java_arch=m68k
7804             ;;
7805         powerpc)
7806             my_java_arch=ppc
7807             ;;
7808         powerpc64)
7809             my_java_arch=ppc64
7810             ;;
7811         powerpc64le)
7812             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7813             JAVA_ARCH=$my_java_arch
7814             ;;
7815         sparc64)
7816             my_java_arch=sparcv9
7817             ;;
7818         x86_64)
7819             my_java_arch=amd64
7820             ;;
7821         *)
7822             my_java_arch=$host_cpu
7823             ;;
7824         esac
7825         # This is where JDK9 puts the library
7826         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7827             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7828         else
7829             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7830         fi
7831         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7832     fi
7833     AC_MSG_RESULT([$JAWTLIB])
7835 AC_SUBST(JAWTLIB)
7837 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7838     case "$host_os" in
7840     aix*)
7841         JAVAINC="-I$JAVA_HOME/include"
7842         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7843         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7844         ;;
7846     cygwin*)
7847         JAVAINC="-I$JAVA_HOME/include/win32"
7848         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7849         ;;
7851     darwin*)
7852         if test -d "$JAVA_HOME/include/darwin"; then
7853             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7854         else
7855             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7856         fi
7857         ;;
7859     dragonfly*)
7860         JAVAINC="-I$JAVA_HOME/include"
7861         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7862         ;;
7864     freebsd*)
7865         JAVAINC="-I$JAVA_HOME/include"
7866         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7867         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7868         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7869         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7870         ;;
7872     k*bsd*-gnu*)
7873         JAVAINC="-I$JAVA_HOME/include"
7874         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7875         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7876         ;;
7878     linux-gnu*)
7879         JAVAINC="-I$JAVA_HOME/include"
7880         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7881         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7882         ;;
7884     *netbsd*)
7885         JAVAINC="-I$JAVA_HOME/include"
7886         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7887         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7888        ;;
7890     openbsd*)
7891         JAVAINC="-I$JAVA_HOME/include"
7892         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7893         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7894         ;;
7896     solaris*)
7897         JAVAINC="-I$JAVA_HOME/include"
7898         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7899         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7900         ;;
7901     esac
7903 SOLARINC="$SOLARINC $JAVAINC"
7905 AC_SUBST(JAVACOMPILER)
7906 AC_SUBST(JAVADOC)
7907 AC_SUBST(JAVAINTERPRETER)
7908 AC_SUBST(JAVAIFLAGS)
7909 AC_SUBST(JAVAFLAGS)
7910 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7911 AC_SUBST(JAVA_HOME)
7912 AC_SUBST(JAVA_SOURCE_VER)
7913 AC_SUBST(JAVA_TARGET_VER)
7914 AC_SUBST(JDK)
7917 dnl ===================================================================
7918 dnl Export file validation
7919 dnl ===================================================================
7920 AC_MSG_CHECKING([whether to enable export file validation])
7921 if test "$with_export_validation" != "no"; then
7922     if test -z "$ENABLE_JAVA"; then
7923         if test "$with_export_validation" = "yes"; then
7924             AC_MSG_ERROR([requested, but Java is disabled])
7925         else
7926             AC_MSG_RESULT([no, as Java is disabled])
7927         fi
7928     elif ! test -d "${SRC_ROOT}/schema"; then
7929         if test "$with_export_validation" = "yes"; then
7930             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7931         else
7932             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7933         fi
7934     else
7935         AC_MSG_RESULT([yes])
7936         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7938         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7939         if test -z "$ODFVALIDATOR"; then
7940             # remember to download the ODF toolkit with validator later
7941             AC_MSG_NOTICE([no odfvalidator found, will download it])
7942             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7943             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7945             # and fetch name of odfvalidator jar name from download.lst
7946             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7947             AC_SUBST(ODFVALIDATOR_JAR)
7949             if test -z "$ODFVALIDATOR_JAR"; then
7950                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7951             fi
7952         fi
7953         if test "$build_os" = "cygwin"; then
7954             # In case of Cygwin it will be executed from Windows,
7955             # so we need to run bash and absolute path to validator
7956             # so instead of "odfvalidator" it will be
7957             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7958             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7959         else
7960             ODFVALIDATOR="sh $ODFVALIDATOR"
7961         fi
7962         AC_SUBST(ODFVALIDATOR)
7965         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7966         if test -z "$OFFICEOTRON"; then
7967             # remember to download the officeotron with validator later
7968             AC_MSG_NOTICE([no officeotron found, will download it])
7969             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7970             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7972             # and fetch name of officeotron jar name from download.lst
7973             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7974             AC_SUBST(OFFICEOTRON_JAR)
7976             if test -z "$OFFICEOTRON_JAR"; then
7977                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7978             fi
7979         else
7980             # check version of existing officeotron
7981             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7982             if test 0"$OFFICEOTRON_VER" -lt 704; then
7983                 AC_MSG_ERROR([officeotron too old])
7984             fi
7985         fi
7986         if test "$build_os" = "cygwin"; then
7987             # In case of Cygwin it will be executed from Windows,
7988             # so we need to run bash and absolute path to validator
7989             # so instead of "odfvalidator" it will be
7990             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7991             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7992         else
7993             OFFICEOTRON="sh $OFFICEOTRON"
7994         fi
7995     fi
7996     AC_SUBST(OFFICEOTRON)
7997 else
7998     AC_MSG_RESULT([no])
8001 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8002 if test "$with_bffvalidator" != "no"; then
8003     AC_DEFINE(HAVE_BFFVALIDATOR)
8005     if test "$with_export_validation" = "no"; then
8006         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8007     fi
8009     if test "$with_bffvalidator" = "yes"; then
8010         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8011     else
8012         BFFVALIDATOR="$with_bffvalidator"
8013     fi
8015     if test "$build_os" = "cygwin"; then
8016         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8017             AC_MSG_RESULT($BFFVALIDATOR)
8018         else
8019             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8020         fi
8021     elif test -n "$BFFVALIDATOR"; then
8022         # We are not in Cygwin but need to run Windows binary with wine
8023         AC_PATH_PROGS(WINE, wine)
8025         # so swap in a shell wrapper that converts paths transparently
8026         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8027         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8028         AC_SUBST(BFFVALIDATOR_EXE)
8029         AC_MSG_RESULT($BFFVALIDATOR)
8030     else
8031         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8032     fi
8033     AC_SUBST(BFFVALIDATOR)
8034 else
8035     AC_MSG_RESULT([no])
8038 dnl ===================================================================
8039 dnl Check for C preprocessor to use
8040 dnl ===================================================================
8041 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8042 if test -n "$with_idlc_cpp"; then
8043     AC_MSG_RESULT([$with_idlc_cpp])
8044     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8045 else
8046     AC_MSG_RESULT([ucpp])
8047     AC_MSG_CHECKING([which ucpp tp use])
8048     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8049         AC_MSG_RESULT([external])
8050         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8051     else
8052         AC_MSG_RESULT([internal])
8053         BUILD_TYPE="$BUILD_TYPE UCPP"
8054     fi
8056 AC_SUBST(SYSTEM_UCPP)
8058 dnl ===================================================================
8059 dnl Check for epm (not needed for Windows)
8060 dnl ===================================================================
8061 AC_MSG_CHECKING([whether to enable EPM for packing])
8062 if test "$enable_epm" = "yes"; then
8063     AC_MSG_RESULT([yes])
8064     if test "$_os" != "WINNT"; then
8065         if test $_os = Darwin; then
8066             EPM=internal
8067         elif test -n "$with_epm"; then
8068             EPM=$with_epm
8069         else
8070             AC_PATH_PROG(EPM, epm, no)
8071         fi
8072         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8073             AC_MSG_NOTICE([EPM will be built.])
8074             BUILD_TYPE="$BUILD_TYPE EPM"
8075             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8076         else
8077             # Gentoo has some epm which is something different...
8078             AC_MSG_CHECKING([whether the found epm is the right epm])
8079             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8080                 AC_MSG_RESULT([yes])
8081             else
8082                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8083             fi
8084             AC_MSG_CHECKING([epm version])
8085             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8086             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8087                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8088                 AC_MSG_RESULT([OK, >= 3.7])
8089             else
8090                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8091                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8092             fi
8093         fi
8094     fi
8096     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8097         AC_MSG_CHECKING([for rpm])
8098         for a in "$RPM" rpmbuild rpm; do
8099             $a --usage >/dev/null 2> /dev/null
8100             if test $? -eq 0; then
8101                 RPM=$a
8102                 break
8103             else
8104                 $a --version >/dev/null 2> /dev/null
8105                 if test $? -eq 0; then
8106                     RPM=$a
8107                     break
8108                 fi
8109             fi
8110         done
8111         if test -z "$RPM"; then
8112             AC_MSG_ERROR([not found])
8113         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8114             RPM_PATH=`which $RPM`
8115             AC_MSG_RESULT([$RPM_PATH])
8116             SCPDEFS="$SCPDEFS -DWITH_RPM"
8117         else
8118             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8119         fi
8120     fi
8121     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8122         AC_PATH_PROG(DPKG, dpkg, no)
8123         if test "$DPKG" = "no"; then
8124             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8125         fi
8126     fi
8127     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8128        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8129         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8130             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8131                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8132                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8133                     AC_MSG_RESULT([yes])
8134                 else
8135                     AC_MSG_RESULT([no])
8136                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8137                         _pt="rpm"
8138                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8139                         add_warning "the rpms will need to be installed with --nodeps"
8140                     else
8141                         _pt="pkg"
8142                     fi
8143                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8144                     add_warning "the ${_pt}s will not be relocatable"
8145                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8146                                  relocation will work, you need to patch your epm with the
8147                                  patch in epm/epm-3.7.patch or build with
8148                                  --with-epm=internal which will build a suitable epm])
8149                 fi
8150             fi
8151         fi
8152     fi
8153     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8154         AC_PATH_PROG(PKGMK, pkgmk, no)
8155         if test "$PKGMK" = "no"; then
8156             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8157         fi
8158     fi
8159     AC_SUBST(RPM)
8160     AC_SUBST(DPKG)
8161     AC_SUBST(PKGMK)
8162 else
8163     for i in $PKGFORMAT; do
8164         case "$i" in
8165         aix | bsd | deb | pkg | rpm | native | portable)
8166             AC_MSG_ERROR(
8167                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8168             ;;
8169         esac
8170     done
8171     AC_MSG_RESULT([no])
8172     EPM=NO
8174 AC_SUBST(EPM)
8176 ENABLE_LWP=
8177 if test "$enable_lotuswordpro" = "yes"; then
8178     ENABLE_LWP="TRUE"
8180 AC_SUBST(ENABLE_LWP)
8182 dnl ===================================================================
8183 dnl Check for building ODK
8184 dnl ===================================================================
8185 if test "$enable_odk" = no; then
8186     unset DOXYGEN
8187 else
8188     if test "$with_doxygen" = no; then
8189         AC_MSG_CHECKING([for doxygen])
8190         unset DOXYGEN
8191         AC_MSG_RESULT([no])
8192     else
8193         if test "$with_doxygen" = yes; then
8194             AC_PATH_PROG([DOXYGEN], [doxygen])
8195             if test -z "$DOXYGEN"; then
8196                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8197             fi
8198             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8199                 if ! dot -V 2>/dev/null; then
8200                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8201                 fi
8202             fi
8203         else
8204             AC_MSG_CHECKING([for doxygen])
8205             DOXYGEN=$with_doxygen
8206             AC_MSG_RESULT([$DOXYGEN])
8207         fi
8208         if test -n "$DOXYGEN"; then
8209             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8210             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8211             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8212                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8213             fi
8214         fi
8215     fi
8217 AC_SUBST([DOXYGEN])
8219 AC_MSG_CHECKING([whether to build the ODK])
8220 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8221     AC_MSG_RESULT([yes])
8223     if test "$with_java" != "no"; then
8224         AC_MSG_CHECKING([whether to build unowinreg.dll])
8225         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8226             # build on Win by default
8227             enable_build_unowinreg=yes
8228         fi
8229         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8230             AC_MSG_RESULT([no])
8231             BUILD_UNOWINREG=
8232         else
8233             AC_MSG_RESULT([yes])
8234             BUILD_UNOWINREG=TRUE
8235         fi
8236         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8237             if test -z "$with_mingw_cross_compiler"; then
8238                 dnl Guess...
8239                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8240             elif test -x "$with_mingw_cross_compiler"; then
8241                  MINGWCXX="$with_mingw_cross_compiler"
8242             else
8243                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8244             fi
8246             if test "$MINGWCXX" = "false"; then
8247                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8248             fi
8250             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8251             if test -x "$mingwstrip_test"; then
8252                 MINGWSTRIP="$mingwstrip_test"
8253             else
8254                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8255             fi
8257             if test "$MINGWSTRIP" = "false"; then
8258                 AC_MSG_ERROR(MinGW32 binutils not found.)
8259             fi
8260         fi
8261     fi
8262     BUILD_TYPE="$BUILD_TYPE ODK"
8263 else
8264     AC_MSG_RESULT([no])
8265     BUILD_UNOWINREG=
8267 AC_SUBST(BUILD_UNOWINREG)
8268 AC_SUBST(MINGWCXX)
8269 AC_SUBST(MINGWSTRIP)
8271 dnl ===================================================================
8272 dnl Check for system zlib
8273 dnl ===================================================================
8274 if test "$with_system_zlib" = "auto"; then
8275     case "$_os" in
8276     WINNT)
8277         with_system_zlib="$with_system_libs"
8278         ;;
8279     *)
8280         if test "$enable_fuzzers" != "yes"; then
8281             with_system_zlib=yes
8282         else
8283             with_system_zlib=no
8284         fi
8285         ;;
8286     esac
8289 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8290 dnl and has no pkg-config for it at least on some tinderboxes,
8291 dnl so leaving that out for now
8292 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8293 AC_MSG_CHECKING([which zlib to use])
8294 if test "$with_system_zlib" = "yes"; then
8295     AC_MSG_RESULT([external])
8296     SYSTEM_ZLIB=TRUE
8297     AC_CHECK_HEADER(zlib.h, [],
8298         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8299     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8300         [AC_MSG_ERROR(zlib not found or functional)], [])
8301 else
8302     AC_MSG_RESULT([internal])
8303     SYSTEM_ZLIB=
8304     BUILD_TYPE="$BUILD_TYPE ZLIB"
8305     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8306     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8308 AC_SUBST(ZLIB_CFLAGS)
8309 AC_SUBST(ZLIB_LIBS)
8310 AC_SUBST(SYSTEM_ZLIB)
8312 dnl ===================================================================
8313 dnl Check for system jpeg
8314 dnl ===================================================================
8315 AC_MSG_CHECKING([which libjpeg to use])
8316 if test "$with_system_jpeg" = "yes"; then
8317     AC_MSG_RESULT([external])
8318     SYSTEM_LIBJPEG=TRUE
8319     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8320         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8321     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8322         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8323 else
8324     SYSTEM_LIBJPEG=
8325     AC_MSG_RESULT([internal, libjpeg-turbo])
8326     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8327     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8328     if test "$COM" = "MSC"; then
8329         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8330     else
8331         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8332     fi
8334     case "$host_cpu" in
8335     x86_64 | amd64 | i*86 | x86 | ia32)
8336         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8337         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8338             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8339                 NASM="$LODE_HOME/opt/bin/nasm"
8340             elif test -x "/opt/lo/bin/nasm"; then
8341                 NASM="/opt/lo/bin/nasm"
8342             fi
8343         fi
8345         if test -n "$NASM"; then
8346             AC_MSG_CHECKING([for object file format of host system])
8347             case "$host_os" in
8348               cygwin* | mingw* | pw32* | interix*)
8349                 case "$host_cpu" in
8350                   x86_64)
8351                     objfmt='Win64-COFF'
8352                     ;;
8353                   *)
8354                     objfmt='Win32-COFF'
8355                     ;;
8356                 esac
8357               ;;
8358               msdosdjgpp* | go32*)
8359                 objfmt='COFF'
8360               ;;
8361               os2-emx*) # not tested
8362                 objfmt='MSOMF' # obj
8363               ;;
8364               linux*coff* | linux*oldld*)
8365                 objfmt='COFF' # ???
8366               ;;
8367               linux*aout*)
8368                 objfmt='a.out'
8369               ;;
8370               linux*)
8371                 case "$host_cpu" in
8372                   x86_64)
8373                     objfmt='ELF64'
8374                     ;;
8375                   *)
8376                     objfmt='ELF'
8377                     ;;
8378                 esac
8379               ;;
8380               kfreebsd* | freebsd* | netbsd* | openbsd*)
8381                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8382                   objfmt='BSD-a.out'
8383                 else
8384                   case "$host_cpu" in
8385                     x86_64 | amd64)
8386                       objfmt='ELF64'
8387                       ;;
8388                     *)
8389                       objfmt='ELF'
8390                       ;;
8391                   esac
8392                 fi
8393               ;;
8394               solaris* | sunos* | sysv* | sco*)
8395                 case "$host_cpu" in
8396                   x86_64)
8397                     objfmt='ELF64'
8398                     ;;
8399                   *)
8400                     objfmt='ELF'
8401                     ;;
8402                 esac
8403               ;;
8404               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8405                 case "$host_cpu" in
8406                   x86_64)
8407                     objfmt='Mach-O64'
8408                     ;;
8409                   *)
8410                     objfmt='Mach-O'
8411                     ;;
8412                 esac
8413               ;;
8414               *)
8415                 objfmt='ELF ?'
8416               ;;
8417             esac
8419             AC_MSG_RESULT([$objfmt])
8420             if test "$objfmt" = 'ELF ?'; then
8421               objfmt='ELF'
8422               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8423             fi
8425             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8426             case "$objfmt" in
8427               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8428               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8429               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8430               COFF)       NAFLAGS='-fcoff -DCOFF';;
8431               a.out)      NAFLAGS='-faout -DAOUT';;
8432               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8433               ELF)        NAFLAGS='-felf -DELF';;
8434               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8435               RDF)        NAFLAGS='-frdf -DRDF';;
8436               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8437               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8438             esac
8439             AC_MSG_RESULT([$NAFLAGS])
8441             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8442             cat > conftest.asm << EOF
8443             [%line __oline__ "configure"
8444                     section .text
8445                     global  _main,main
8446             _main:
8447             main:   xor     eax,eax
8448                     ret
8449             ]
8451             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8452             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8453               AC_MSG_RESULT(yes)
8454             else
8455               echo "configure: failed program was:" >&AC_FD_CC
8456               cat conftest.asm >&AC_FD_CC
8457               rm -rf conftest*
8458               AC_MSG_RESULT(no)
8459               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8460               NASM=""
8461             fi
8463         fi
8465         if test -z "$NASM"; then
8466 cat << _EOS
8467 ****************************************************************************
8468 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8469 To get one please:
8471 _EOS
8472             if test "$build_os" = "cygwin"; then
8473 cat << _EOS
8474 install a pre-compiled binary for Win32
8476 mkdir -p /opt/lo/bin
8477 cd /opt/lo/bin
8478 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8479 chmod +x nasm
8481 or get and install one from http://www.nasm.us/
8483 Then re-run autogen.sh
8485 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8486 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8488 _EOS
8489             else
8490 cat << _EOS
8491 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8493 _EOS
8494             fi
8495             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8496             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8497         fi
8498       ;;
8499     esac
8502 AC_SUBST(NASM)
8503 AC_SUBST(LIBJPEG_CFLAGS)
8504 AC_SUBST(LIBJPEG_LIBS)
8505 AC_SUBST(SYSTEM_LIBJPEG)
8507 dnl ===================================================================
8508 dnl Check for system clucene
8509 dnl ===================================================================
8510 dnl we should rather be using
8511 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8512 dnl but the contribs-lib check seems tricky
8513 AC_MSG_CHECKING([which clucene to use])
8514 if test "$with_system_clucene" = "yes"; then
8515     AC_MSG_RESULT([external])
8516     SYSTEM_CLUCENE=TRUE
8517     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8518     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8519     FilterLibs "${CLUCENE_LIBS}"
8520     CLUCENE_LIBS="${filteredlibs}"
8521     AC_LANG_PUSH([C++])
8522     save_CXXFLAGS=$CXXFLAGS
8523     save_CPPFLAGS=$CPPFLAGS
8524     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8525     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8526     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8527     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8528     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8529                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8530     CXXFLAGS=$save_CXXFLAGS
8531     CPPFLAGS=$save_CPPFLAGS
8532     AC_LANG_POP([C++])
8534     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8535 else
8536     AC_MSG_RESULT([internal])
8537     SYSTEM_CLUCENE=
8538     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8540 AC_SUBST(SYSTEM_CLUCENE)
8541 AC_SUBST(CLUCENE_CFLAGS)
8542 AC_SUBST(CLUCENE_LIBS)
8544 dnl ===================================================================
8545 dnl Check for system expat
8546 dnl ===================================================================
8547 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8549 dnl ===================================================================
8550 dnl Check for system xmlsec
8551 dnl ===================================================================
8552 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8554 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8555 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8556     ENABLE_EOT="TRUE"
8557     AC_DEFINE([ENABLE_EOT])
8558     AC_MSG_RESULT([yes])
8560     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8561 else
8562     ENABLE_EOT=
8563     AC_MSG_RESULT([no])
8565 AC_SUBST([ENABLE_EOT])
8567 dnl ===================================================================
8568 dnl Check for DLP libs
8569 dnl ===================================================================
8570 AS_IF([test "$COM" = "MSC"],
8571       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8572       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8574 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8576 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8578 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8580 AS_IF([test "$COM" = "MSC"],
8581       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8582       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8584 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8586 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8588 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8589 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8591 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8593 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8595 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8597 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8598 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8600 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8601 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8603 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8605 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8606 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8608 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8610 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8612 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8614 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8616 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8617 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8619 dnl ===================================================================
8620 dnl Check for system lcms2
8621 dnl ===================================================================
8622 if test "$with_system_lcms2" != "yes"; then
8623     SYSTEM_LCMS2=
8625 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8626 if test "$GCC" = "yes"; then
8627     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8629 if test "$COM" = "MSC"; then # override the above
8630     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8633 dnl ===================================================================
8634 dnl Check for system cppunit
8635 dnl ===================================================================
8636 if test "$_os" != "Android" ; then
8637     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8640 dnl ===================================================================
8641 dnl Check whether freetype is available
8642 dnl ===================================================================
8643 if test  "$test_freetype" = "yes"; then
8644     AC_MSG_CHECKING([whether freetype is available])
8645     # FreeType has 3 different kinds of versions
8646     # * release, like 2.4.10
8647     # * libtool, like 13.0.7 (this what pkg-config returns)
8648     # * soname
8649     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8650     #
8651     # 9.9.3 is 2.2.0
8652     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8653     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8654     FilterLibs "${FREETYPE_LIBS}"
8655     FREETYPE_LIBS="${filteredlibs}"
8656     SYSTEM_FREETYPE=TRUE
8657 else
8658     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8659     if test "x$ac_config_site_64bit_host" = xYES; then
8660         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8661     else
8662         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8663     fi
8665 AC_SUBST(FREETYPE_CFLAGS)
8666 AC_SUBST(FREETYPE_LIBS)
8667 AC_SUBST([SYSTEM_FREETYPE])
8669 # ===================================================================
8670 # Check for system libxslt
8671 # to prevent incompatibilities between internal libxml2 and external libxslt,
8672 # or vice versa, use with_system_libxml here
8673 # ===================================================================
8674 if test "$with_system_libxml" = "auto"; then
8675     case "$_os" in
8676     WINNT|iOS|Android)
8677         with_system_libxml="$with_system_libs"
8678         ;;
8679     *)
8680         if test "$enable_fuzzers" != "yes"; then
8681             with_system_libxml=yes
8682         else
8683             with_system_libxml=no
8684         fi
8685         ;;
8686     esac
8689 AC_MSG_CHECKING([which libxslt to use])
8690 if test "$with_system_libxml" = "yes"; then
8691     AC_MSG_RESULT([external])
8692     SYSTEM_LIBXSLT=TRUE
8693     if test "$_os" = "Darwin"; then
8694         dnl make sure to use SDK path
8695         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8696         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8697         dnl omit -L/usr/lib
8698         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8699         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8700     else
8701         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8702         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8703         FilterLibs "${LIBXSLT_LIBS}"
8704         LIBXSLT_LIBS="${filteredlibs}"
8705         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8706         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8707         FilterLibs "${LIBEXSLT_LIBS}"
8708         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8709     fi
8711     dnl Check for xsltproc
8712     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8713     if test "$XSLTPROC" = "no"; then
8714         AC_MSG_ERROR([xsltproc is required])
8715     fi
8716 else
8717     AC_MSG_RESULT([internal])
8718     SYSTEM_LIBXSLT=
8719     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8721     if test "$cross_compiling" = "yes"; then
8722         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8723         if test "$XSLTPROC" = "no"; then
8724             AC_MSG_ERROR([xsltproc is required])
8725         fi
8726     fi
8728 AC_SUBST(SYSTEM_LIBXSLT)
8729 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8730     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8732 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8734 AC_SUBST(LIBEXSLT_CFLAGS)
8735 AC_SUBST(LIBEXSLT_LIBS)
8736 AC_SUBST(LIBXSLT_CFLAGS)
8737 AC_SUBST(LIBXSLT_LIBS)
8738 AC_SUBST(XSLTPROC)
8740 # ===================================================================
8741 # Check for system libxml
8742 # ===================================================================
8743 AC_MSG_CHECKING([which libxml to use])
8744 if test "$with_system_libxml" = "yes"; then
8745     AC_MSG_RESULT([external])
8746     SYSTEM_LIBXML=TRUE
8747     if test "$_os" = "Darwin"; then
8748         dnl make sure to use SDK path
8749         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8750         dnl omit -L/usr/lib
8751         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8752     elif test $_os = iOS; then
8753         dnl make sure to use SDK path
8754         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8755         LIBXML_CFLAGS="-I$usr/include/libxml2"
8756         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8757     else
8758         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8759         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8760         FilterLibs "${LIBXML_LIBS}"
8761         LIBXML_LIBS="${filteredlibs}"
8762     fi
8764     dnl Check for xmllint
8765     AC_PATH_PROG(XMLLINT, xmllint, no)
8766     if test "$XMLLINT" = "no"; then
8767         AC_MSG_ERROR([xmllint is required])
8768     fi
8769 else
8770     AC_MSG_RESULT([internal])
8771     SYSTEM_LIBXML=
8772     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8773     if test "$COM" = "MSC"; then
8774         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8775     fi
8776     if test "$COM" = "MSC"; then
8777         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8778     else
8779         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8780     fi
8781     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8783 AC_SUBST(SYSTEM_LIBXML)
8784 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8785     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8787 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8788 AC_SUBST(LIBXML_CFLAGS)
8789 AC_SUBST(LIBXML_LIBS)
8790 AC_SUBST(XMLLINT)
8792 # =====================================================================
8793 # Checking for a Python interpreter with version >= 2.7.
8794 # Build and runtime requires Python 3 compatible version (>= 2.7).
8795 # Optionally user can pass an option to configure, i. e.
8796 # ./configure PYTHON=/usr/bin/python
8797 # =====================================================================
8798 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8799     if test -n "$PYTHON"; then
8800         PYTHON_FOR_BUILD=$PYTHON
8801     else
8802         # This allows a lack of system python with no error, we use internal one in that case.
8803         AM_PATH_PYTHON([2.7],, [:])
8804         # Clean PYTHON_VERSION checked below if cross-compiling
8805         PYTHON_VERSION=""
8806         if test "$PYTHON" != ":"; then
8807             PYTHON_FOR_BUILD=$PYTHON
8808         fi
8809     fi
8811 AC_SUBST(PYTHON_FOR_BUILD)
8813 # Checks for Python to use for Pyuno
8814 AC_MSG_CHECKING([which Python to use for Pyuno])
8815 case "$enable_python" in
8816 no|disable)
8817     if test -z $PYTHON_FOR_BUILD; then
8818         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8819         # requirement from the choice whether to include Python stuff in the installer, but why
8820         # bother?
8821         AC_MSG_ERROR([Python is required at build time.])
8822     fi
8823     enable_python=no
8824     AC_MSG_RESULT([none])
8825     ;;
8826 ""|yes|auto)
8827     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8828         AC_MSG_RESULT([no, overridden by --disable-scripting])
8829         enable_python=no
8830     elif test $build_os = cygwin; then
8831         dnl When building on Windows we don't attempt to use any installed
8832         dnl "system"  Python.
8833         AC_MSG_RESULT([fully internal])
8834         enable_python=internal
8835     elif test "$cross_compiling" = yes; then
8836         AC_MSG_RESULT([system])
8837         enable_python=system
8838     else
8839         # Unset variables set by the above AM_PATH_PYTHON so that
8840         # we actually do check anew.
8841         AC_MSG_RESULT([])
8842         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
8843         AM_PATH_PYTHON([3.3],, [:])
8844         AC_MSG_CHECKING([which Python to use for Pyuno])
8845         if test "$PYTHON" = ":"; then
8846             if test -z "$PYTHON_FOR_BUILD"; then
8847                 AC_MSG_RESULT([fully internal])
8848             else
8849                 AC_MSG_RESULT([internal])
8850             fi
8851             enable_python=internal
8852         else
8853             AC_MSG_RESULT([system])
8854             enable_python=system
8855         fi
8856     fi
8857     ;;
8858 internal)
8859     AC_MSG_RESULT([internal])
8860     ;;
8861 fully-internal)
8862     AC_MSG_RESULT([fully internal])
8863     enable_python=internal
8864     ;;
8865 system)
8866     AC_MSG_RESULT([system])
8867     if test "$_os" = Darwin; then
8868         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])
8869     fi
8870     ;;
8872     AC_MSG_ERROR([Incorrect --enable-python option])
8873     ;;
8874 esac
8876 if test $enable_python != no; then
8877     BUILD_TYPE="$BUILD_TYPE PYUNO"
8880 if test $enable_python = system; then
8881     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8882         # Fallback: Accept these in the environment, or as set above
8883         # for MacOSX.
8884         :
8885     elif test "$cross_compiling" != yes; then
8886         # Unset variables set by the above AM_PATH_PYTHON so that
8887         # we actually do check anew.
8888         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
8889         # This causes an error if no python command is found
8890         AM_PATH_PYTHON([3.3])
8891         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8892         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8893         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8894         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8895         if test -z "$PKG_CONFIG"; then
8896             PYTHON_CFLAGS="-I$python_include"
8897             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8898         elif $PKG_CONFIG --exists python-$python_version-embed; then
8899             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8900             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8901         elif $PKG_CONFIG --exists python-$python_version; then
8902             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8903             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8904         else
8905             PYTHON_CFLAGS="-I$python_include"
8906             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8907         fi
8908         FilterLibs "${PYTHON_LIBS}"
8909         PYTHON_LIBS="${filteredlibs}"
8910     else
8911         dnl How to find out the cross-compilation Python installation path?
8912         AC_MSG_CHECKING([for python version])
8913         AS_IF([test -n "$PYTHON_VERSION"],
8914               [AC_MSG_RESULT([$PYTHON_VERSION])],
8915               [AC_MSG_RESULT([not found])
8916                AC_MSG_ERROR([no usable python found])])
8917         test -n "$PYTHON_CFLAGS" && break
8918     fi
8920     dnl Check if the headers really work
8921     save_CPPFLAGS="$CPPFLAGS"
8922     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8923     AC_CHECK_HEADER(Python.h)
8924     CPPFLAGS="$save_CPPFLAGS"
8926     # let the PYTHON_FOR_BUILD match the same python installation that
8927     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8928     # better for PythonTests.
8929     PYTHON_FOR_BUILD=$PYTHON
8932 if test "$with_lxml" != no; then
8933     if test -z "$PYTHON_FOR_BUILD"; then
8934         case $build_os in
8935             cygwin)
8936                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8937                 ;;
8938             *)
8939                 if test "$cross_compiling" != yes ; then
8940                     BUILD_TYPE="$BUILD_TYPE LXML"
8941                 fi
8942                 ;;
8943         esac
8944     else
8945         AC_MSG_CHECKING([for python lxml])
8946         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8947             AC_MSG_RESULT([yes])
8948         else
8949             case $build_os in
8950                 cygwin)
8951                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8952                     ;;
8953                 *)
8954                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8955                         BUILD_TYPE="$BUILD_TYPE LXML"
8956                         AC_MSG_RESULT([no, using internal lxml])
8957                     else
8958                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8959                     fi
8960                     ;;
8961             esac
8962         fi
8963     fi
8966 dnl By now enable_python should be "system", "internal" or "no"
8967 case $enable_python in
8968 system)
8969     SYSTEM_PYTHON=TRUE
8971     if test "x$ac_cv_header_Python_h" != "xyes"; then
8972        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8973     fi
8975     AC_LANG_PUSH(C)
8976     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8977     AC_MSG_CHECKING([for correct python library version])
8978        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8979 #include <Python.h>
8981 int main(int argc, char **argv) {
8982    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8983        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8984    else return 1;
8986        ]])],[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])])
8987     CFLAGS=$save_CFLAGS
8988     AC_LANG_POP(C)
8990     dnl FIXME Check if the Python library can be linked with, too?
8991     ;;
8993 internal)
8994     SYSTEM_PYTHON=
8995     PYTHON_VERSION_MAJOR=3
8996     PYTHON_VERSION_MINOR=7
8997     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.6
8998     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8999         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9000     fi
9001     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9002     BUILD_TYPE="$BUILD_TYPE PYTHON"
9003     if test "$OS" = LINUX; then
9004         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9005     fi
9006     # Embedded Python dies without Home set
9007     if test "$HOME" = ""; then
9008         export HOME=""
9009     fi
9010     ;;
9012     DISABLE_PYTHON=TRUE
9013     SYSTEM_PYTHON=
9014     ;;
9016     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9017     ;;
9018 esac
9020 AC_SUBST(DISABLE_PYTHON)
9021 AC_SUBST(SYSTEM_PYTHON)
9022 AC_SUBST(PYTHON_CFLAGS)
9023 AC_SUBST(PYTHON_LIBS)
9024 AC_SUBST(PYTHON_VERSION)
9025 AC_SUBST(PYTHON_VERSION_MAJOR)
9026 AC_SUBST(PYTHON_VERSION_MINOR)
9028 ENABLE_MARIADBC=TRUE
9029 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
9030     ENABLE_MARIADBC=
9032 MARIADBC_MAJOR=1
9033 MARIADBC_MINOR=0
9034 MARIADBC_MICRO=2
9035 if test "$ENABLE_MARIADBC" = "TRUE"; then
9036     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9039 AC_SUBST(ENABLE_MARIADBC)
9040 AC_SUBST(MARIADBC_MAJOR)
9041 AC_SUBST(MARIADBC_MINOR)
9042 AC_SUBST(MARIADBC_MICRO)
9044 if test "$ENABLE_MARIADBC" = "TRUE"; then
9045     dnl ===================================================================
9046     dnl Check for system MariaDB
9047     dnl ===================================================================
9048     AC_MSG_CHECKING([which MariaDB to use])
9049     if test "$with_system_mariadb" = "yes"; then
9050         AC_MSG_RESULT([external])
9051         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9052         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9053         if test -z "$MARIADBCONFIG"; then
9054             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9055             if test -z "$MARIADBCONFIG"; then
9056                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9057                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9058             fi
9059         fi
9060         AC_MSG_CHECKING([MariaDB version])
9061         MARIADB_VERSION=`$MARIADBCONFIG --version`
9062         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9063         if test "$MARIADB_MAJOR" -ge "5"; then
9064             AC_MSG_RESULT([OK])
9065         else
9066             AC_MSG_ERROR([too old, use 5.0.x or later])
9067         fi
9068         AC_MSG_CHECKING([for MariaDB Client library])
9069         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9070         if test "$COM_IS_CLANG" = TRUE; then
9071             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9072         fi
9073         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9074         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9075         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9076         dnl linux32:
9077         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9078             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9079             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9080                 | sed -e 's|/lib64/|/lib/|')
9081         fi
9082         FilterLibs "${MARIADB_LIBS}"
9083         MARIADB_LIBS="${filteredlibs}"
9084         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9085         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9086         if test "$enable_bundle_mariadb" = "yes"; then
9087             AC_MSG_RESULT([yes])
9088             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9089             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9091 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9093 /g' | grep -E '(mysqlclient|mariadb)')
9094             if test "$_os" = "Darwin"; then
9095                 LIBMARIADB=${LIBMARIADB}.dylib
9096             elif test "$_os" = "WINNT"; then
9097                 LIBMARIADB=${LIBMARIADB}.dll
9098             else
9099                 LIBMARIADB=${LIBMARIADB}.so
9100             fi
9101             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9102             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9103             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9104                 AC_MSG_RESULT([found.])
9105                 PathFormat "$LIBMARIADB_PATH"
9106                 LIBMARIADB_PATH="$formatted_path"
9107             else
9108                 AC_MSG_ERROR([not found.])
9109             fi
9110         else
9111             AC_MSG_RESULT([no])
9112             BUNDLE_MARIADB_CONNECTOR_C=
9113         fi
9114     else
9115         AC_MSG_RESULT([internal])
9116         SYSTEM_MARIADB_CONNECTOR_C=
9117         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9118         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9119         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9120     fi
9122     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9123     AC_SUBST(MARIADB_CFLAGS)
9124     AC_SUBST(MARIADB_LIBS)
9125     AC_SUBST(LIBMARIADB)
9126     AC_SUBST(LIBMARIADB_PATH)
9127     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9130 dnl ===================================================================
9131 dnl Check for system hsqldb
9132 dnl ===================================================================
9133 if test "$with_java" != "no"; then
9134     HSQLDB_USE_JDBC_4_1=
9135     AC_MSG_CHECKING([which hsqldb to use])
9136     if test "$with_system_hsqldb" = "yes"; then
9137         AC_MSG_RESULT([external])
9138         SYSTEM_HSQLDB=TRUE
9139         if test -z $HSQLDB_JAR; then
9140             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9141         fi
9142         if ! test -f $HSQLDB_JAR; then
9143                AC_MSG_ERROR(hsqldb.jar not found.)
9144         fi
9145         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9146         export HSQLDB_JAR
9147         if $PERL -e \
9148            'use Archive::Zip;
9149             my $file = "$ENV{'HSQLDB_JAR'}";
9150             my $zip = Archive::Zip->new( $file );
9151             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9152             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9153             {
9154                 push @l, split(/\n/, $mf);
9155                 foreach my $line (@l)
9156                 {
9157                     if ($line =~ m/Specification-Version:/)
9158                     {
9159                         ($t, $version) = split (/:/,$line);
9160                         $version =~ s/^\s//;
9161                         ($a, $b, $c, $d) = split (/\./,$version);
9162                         if ($c == "0" && $d > "8")
9163                         {
9164                             exit 0;
9165                         }
9166                         else
9167                         {
9168                             exit 1;
9169                         }
9170                     }
9171                 }
9172             }
9173             else
9174             {
9175                 exit 1;
9176             }'; then
9177             AC_MSG_RESULT([yes])
9178         else
9179             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9180         fi
9181     else
9182         AC_MSG_RESULT([internal])
9183         SYSTEM_HSQLDB=
9184         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9185         NEED_ANT=TRUE
9186         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9187         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9188         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9189             AC_MSG_RESULT([yes])
9190             HSQLDB_USE_JDBC_4_1=TRUE
9191         else
9192             AC_MSG_RESULT([no])
9193         fi
9194     fi
9195     AC_SUBST(SYSTEM_HSQLDB)
9196     AC_SUBST(HSQLDB_JAR)
9197     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9200 dnl ===================================================================
9201 dnl Check for PostgreSQL stuff
9202 dnl ===================================================================
9203 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9204 if test "x$enable_postgresql_sdbc" != "xno"; then
9205     AC_MSG_RESULT([yes])
9206     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9208     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9209         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9210     fi
9211     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9212         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9213     fi
9215     postgres_interface=""
9216     if test "$with_system_postgresql" = "yes"; then
9217         postgres_interface="external PostgreSQL"
9218         SYSTEM_POSTGRESQL=TRUE
9219         if test "$_os" = Darwin; then
9220             supp_path=''
9221             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9222                 pg_supp_path="$P_SEP$d$pg_supp_path"
9223             done
9224         fi
9225         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9226         if test -n "$PGCONFIG"; then
9227             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9228             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9229         else
9230             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9231               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9232               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9233             ],[
9234               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9235             ])
9236         fi
9237         FilterLibs "${POSTGRESQL_LIB}"
9238         POSTGRESQL_LIB="${filteredlibs}"
9239     else
9240         # if/when anything else than PostgreSQL uses Kerberos,
9241         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9242         WITH_KRB5=
9243         WITH_GSSAPI=
9244         case "$_os" in
9245         Darwin)
9246             # macOS has system MIT Kerberos 5 since 10.4
9247             if test "$with_krb5" != "no"; then
9248                 WITH_KRB5=TRUE
9249                 save_LIBS=$LIBS
9250                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9251                 # that the libraries where these functions are located on macOS will change, is it?
9252                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9253                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9254                 KRB5_LIBS=$LIBS
9255                 LIBS=$save_LIBS
9256                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9257                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9258                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9259                 LIBS=$save_LIBS
9260             fi
9261             if test "$with_gssapi" != "no"; then
9262                 WITH_GSSAPI=TRUE
9263                 save_LIBS=$LIBS
9264                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9265                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9266                 GSSAPI_LIBS=$LIBS
9267                 LIBS=$save_LIBS
9268             fi
9269             ;;
9270         WINNT)
9271             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9272                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9273             fi
9274             ;;
9275         Linux|GNU|*BSD|DragonFly)
9276             if test "$with_krb5" != "no"; then
9277                 WITH_KRB5=TRUE
9278                 save_LIBS=$LIBS
9279                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9280                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9281                 KRB5_LIBS=$LIBS
9282                 LIBS=$save_LIBS
9283                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9284                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9285                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9286                 LIBS=$save_LIBS
9287             fi
9288             if test "$with_gssapi" != "no"; then
9289                 WITH_GSSAPI=TRUE
9290                 save_LIBS=$LIBS
9291                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9292                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9293                 GSSAPI_LIBS=$LIBS
9294                 LIBS=$save_LIBS
9295             fi
9296             ;;
9297         *)
9298             if test "$with_krb5" = "yes"; then
9299                 WITH_KRB5=TRUE
9300                 save_LIBS=$LIBS
9301                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9302                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9303                 KRB5_LIBS=$LIBS
9304                 LIBS=$save_LIBS
9305                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9306                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9307                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9308                 LIBS=$save_LIBS
9309             fi
9310             if test "$with_gssapi" = "yes"; then
9311                 WITH_GSSAPI=TRUE
9312                 save_LIBS=$LIBS
9313                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9314                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9315                 LIBS=$save_LIBS
9316                 GSSAPI_LIBS=$LIBS
9317             fi
9318         esac
9320         if test -n "$with_libpq_path"; then
9321             SYSTEM_POSTGRESQL=TRUE
9322             postgres_interface="external libpq"
9323             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9324             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9325         else
9326             SYSTEM_POSTGRESQL=
9327             postgres_interface="internal"
9328             POSTGRESQL_LIB=""
9329             POSTGRESQL_INC="%OVERRIDE_ME%"
9330             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9331         fi
9332     fi
9334     AC_MSG_CHECKING([PostgreSQL C interface])
9335     AC_MSG_RESULT([$postgres_interface])
9337     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9338         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9339         save_CFLAGS=$CFLAGS
9340         save_CPPFLAGS=$CPPFLAGS
9341         save_LIBS=$LIBS
9342         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9343         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9344         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9345         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9346             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9347         CFLAGS=$save_CFLAGS
9348         CPPFLAGS=$save_CPPFLAGS
9349         LIBS=$save_LIBS
9350     fi
9351     BUILD_POSTGRESQL_SDBC=TRUE
9352 else
9353     AC_MSG_RESULT([no])
9355 AC_SUBST(WITH_KRB5)
9356 AC_SUBST(WITH_GSSAPI)
9357 AC_SUBST(GSSAPI_LIBS)
9358 AC_SUBST(KRB5_LIBS)
9359 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9360 AC_SUBST(SYSTEM_POSTGRESQL)
9361 AC_SUBST(POSTGRESQL_INC)
9362 AC_SUBST(POSTGRESQL_LIB)
9364 dnl ===================================================================
9365 dnl Check for Firebird stuff
9366 dnl ===================================================================
9367 ENABLE_FIREBIRD_SDBC=
9368 if test "$enable_firebird_sdbc" = "yes" ; then
9369     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9371     dnl ===================================================================
9372     dnl Check for system Firebird
9373     dnl ===================================================================
9374     AC_MSG_CHECKING([which Firebird to use])
9375     if test "$with_system_firebird" = "yes"; then
9376         AC_MSG_RESULT([external])
9377         SYSTEM_FIREBIRD=TRUE
9378         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9379         if test -z "$FIREBIRDCONFIG"; then
9380             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9381             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9382                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9383             ])
9384             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9385         else
9386             AC_MSG_NOTICE([fb_config found])
9387             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9388             AC_MSG_CHECKING([for Firebird Client library])
9389             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9390             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9391             FilterLibs "${FIREBIRD_LIBS}"
9392             FIREBIRD_LIBS="${filteredlibs}"
9393         fi
9394         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9395         AC_MSG_CHECKING([Firebird version])
9396         if test -n "${FIREBIRD_VERSION}"; then
9397             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9398             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9399             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9400                 AC_MSG_RESULT([OK])
9401             else
9402                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9403             fi
9404         else
9405             __save_CFLAGS="${CFLAGS}"
9406             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9407             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9408 #if defined(FB_API_VER) && FB_API_VER == 30
9409 int fb_api_is_30(void) { return 0; }
9410 #else
9411 #error "Wrong Firebird API version"
9412 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9413             CFLAGS="${__save_CFLAGS}"
9414         fi
9415         ENABLE_FIREBIRD_SDBC=TRUE
9416         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9417     elif test "$enable_database_connectivity" != yes; then
9418         AC_MSG_RESULT([none])
9419     elif test "$cross_compiling" = "yes"; then
9420         AC_MSG_RESULT([none])
9421     else
9422         dnl Embedded Firebird has version 3.0
9423         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9424         dnl We need libatomic_ops for any non X86/X64 system
9425         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9426             dnl ===================================================================
9427             dnl Check for system libatomic_ops
9428             dnl ===================================================================
9429             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9430             if test "$with_system_libatomic_ops" = "yes"; then
9431                 SYSTEM_LIBATOMIC_OPS=TRUE
9432                 AC_CHECK_HEADERS(atomic_ops.h, [],
9433                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9434             else
9435                 SYSTEM_LIBATOMIC_OPS=
9436                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9437                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9438                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9439             fi
9440         fi
9442         AC_MSG_RESULT([internal])
9443         SYSTEM_FIREBIRD=
9444         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9445         FIREBIRD_LIBS="-lfbclient"
9447         if test "$with_system_libtommath" = "yes"; then
9448             SYSTEM_LIBTOMMATH=TRUE
9449             dnl check for tommath presence
9450             save_LIBS=$LIBS
9451             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9452             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9453             LIBS=$save_LIBS
9454         else
9455             SYSTEM_LIBTOMMATH=
9456             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9457             LIBTOMMATH_LIBS="-ltommath"
9458             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9459         fi
9461         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9462         ENABLE_FIREBIRD_SDBC=TRUE
9463         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9464     fi
9466 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9467 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9468 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9469 AC_SUBST(LIBATOMIC_OPS_LIBS)
9470 AC_SUBST(SYSTEM_FIREBIRD)
9471 AC_SUBST(FIREBIRD_CFLAGS)
9472 AC_SUBST(FIREBIRD_LIBS)
9473 AC_SUBST([TOMMATH_CFLAGS])
9474 AC_SUBST([TOMMATH_LIBS])
9476 dnl ===================================================================
9477 dnl Check for system curl
9478 dnl ===================================================================
9479 AC_MSG_CHECKING([which libcurl to use])
9480 if test "$with_system_curl" = "auto"; then
9481     with_system_curl="$with_system_libs"
9484 if test "$with_system_curl" = "yes"; then
9485     AC_MSG_RESULT([external])
9486     SYSTEM_CURL=TRUE
9488     # First try PKGCONFIG and then fall back
9489     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9491     if test -n "$CURL_PKG_ERRORS"; then
9492         AC_PATH_PROG(CURLCONFIG, curl-config)
9493         if test -z "$CURLCONFIG"; then
9494             AC_MSG_ERROR([curl development files not found])
9495         fi
9496         CURL_LIBS=`$CURLCONFIG --libs`
9497         FilterLibs "${CURL_LIBS}"
9498         CURL_LIBS="${filteredlibs}"
9499         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9500         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9502         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9503         case $curl_version in
9504         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9505         dnl so they need to be doubled to end up in the configure script
9506         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9507             AC_MSG_RESULT([yes])
9508             ;;
9509         *)
9510             AC_MSG_ERROR([no, you have $curl_version])
9511             ;;
9512         esac
9513     fi
9515     ENABLE_CURL=TRUE
9516 elif test $_os = iOS; then
9517     # Let's see if we need curl, I think not?
9518     AC_MSG_RESULT([none])
9519     ENABLE_CURL=
9520 else
9521     AC_MSG_RESULT([internal])
9522     SYSTEM_CURL=
9523     BUILD_TYPE="$BUILD_TYPE CURL"
9524     ENABLE_CURL=TRUE
9526 AC_SUBST(SYSTEM_CURL)
9527 AC_SUBST(CURL_CFLAGS)
9528 AC_SUBST(CURL_LIBS)
9529 AC_SUBST(ENABLE_CURL)
9531 dnl ===================================================================
9532 dnl Check for system boost
9533 dnl ===================================================================
9534 AC_MSG_CHECKING([which boost to use])
9535 if test "$with_system_boost" = "yes"; then
9536     AC_MSG_RESULT([external])
9537     SYSTEM_BOOST=TRUE
9538     AX_BOOST_BASE(1.47)
9539     AX_BOOST_DATE_TIME
9540     AX_BOOST_FILESYSTEM
9541     AX_BOOST_IOSTREAMS
9542     AX_BOOST_LOCALE
9543     AC_LANG_PUSH([C++])
9544     save_CXXFLAGS=$CXXFLAGS
9545     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9546     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9547        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9548     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9549        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9550     CXXFLAGS=$save_CXXFLAGS
9551     AC_LANG_POP([C++])
9552     # this is in m4/ax_boost_base.m4
9553     FilterLibs "${BOOST_LDFLAGS}"
9554     BOOST_LDFLAGS="${filteredlibs}"
9555 else
9556     AC_MSG_RESULT([internal])
9557     BUILD_TYPE="$BUILD_TYPE BOOST"
9558     SYSTEM_BOOST=
9559     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9560         # use warning-suppressing wrapper headers
9561         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9562     else
9563         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9564     fi
9566 AC_SUBST(SYSTEM_BOOST)
9568 dnl ===================================================================
9569 dnl Check for system mdds
9570 dnl ===================================================================
9571 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9573 dnl ===================================================================
9574 dnl Check for system glm
9575 dnl ===================================================================
9576 AC_MSG_CHECKING([which glm to use])
9577 if test "$with_system_glm" = "yes"; then
9578     AC_MSG_RESULT([external])
9579     SYSTEM_GLM=TRUE
9580     AC_LANG_PUSH([C++])
9581     AC_CHECK_HEADER([glm/glm.hpp], [],
9582        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9583     AC_LANG_POP([C++])
9584 else
9585     AC_MSG_RESULT([internal])
9586     BUILD_TYPE="$BUILD_TYPE GLM"
9587     SYSTEM_GLM=
9588     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9590 AC_SUBST([GLM_CFLAGS])
9591 AC_SUBST([SYSTEM_GLM])
9593 dnl ===================================================================
9594 dnl Check for system odbc
9595 dnl ===================================================================
9596 AC_MSG_CHECKING([which odbc headers to use])
9597 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
9598     AC_MSG_RESULT([external])
9599     SYSTEM_ODBC_HEADERS=TRUE
9601     if test "$build_os" = "cygwin"; then
9602         save_CPPFLAGS=$CPPFLAGS
9603         find_winsdk
9604         PathFormat "$winsdktest"
9605         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"
9606         AC_CHECK_HEADER(sqlext.h, [],
9607             [AC_MSG_ERROR(odbc not found. install odbc)],
9608             [#include <windows.h>])
9609         CPPFLAGS=$save_CPPFLAGS
9610     else
9611         AC_CHECK_HEADER(sqlext.h, [],
9612             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9613     fi
9614 elif test "$enable_database_connectivity" != yes; then
9615     AC_MSG_RESULT([none])
9616 else
9617     AC_MSG_RESULT([internal])
9618     SYSTEM_ODBC_HEADERS=
9620 AC_SUBST(SYSTEM_ODBC_HEADERS)
9622 dnl ===================================================================
9623 dnl Enable LDAP support
9624 dnl ===================================================================
9626 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9627 AC_MSG_CHECKING([whether to enable LDAP support])
9628     if test "$enable_ldap" != "yes"; then
9629         AC_MSG_RESULT([no])
9630         ENABLE_LDAP=""
9631         enable_ldap=no
9632     else
9633         AC_MSG_RESULT([yes])
9634         ENABLE_LDAP="TRUE"
9635     fi
9637 AC_SUBST(ENABLE_LDAP)
9639 dnl ===================================================================
9640 dnl Check for system openldap
9641 dnl ===================================================================
9643 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9644 AC_MSG_CHECKING([which openldap library to use])
9645 if test "$with_system_openldap" = "yes"; then
9646     AC_MSG_RESULT([external])
9647     SYSTEM_OPENLDAP=TRUE
9648     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9649     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9650     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9651 else
9652     AC_MSG_RESULT([internal])
9653     SYSTEM_OPENLDAP=
9654     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9657 AC_SUBST(SYSTEM_OPENLDAP)
9659 dnl ===================================================================
9660 dnl Check for system NSS
9661 dnl ===================================================================
9662 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9663     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9664     AC_DEFINE(HAVE_FEATURE_NSS)
9665     ENABLE_NSS="TRUE"
9666     AC_DEFINE(ENABLE_NSS)
9667 elif test $_os != iOS ; then
9668     with_tls=openssl
9670 AC_SUBST(ENABLE_NSS)
9672 dnl ===================================================================
9673 dnl Check for TLS/SSL and cryptographic implementation to use
9674 dnl ===================================================================
9675 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9676 if test -n "$with_tls"; then
9677     case $with_tls in
9678     openssl)
9679         AC_DEFINE(USE_TLS_OPENSSL)
9680         TLS=OPENSSL
9682         if test "$enable_openssl" != "yes"; then
9683             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9684         fi
9686         # warn that OpenSSL has been selected but not all TLS code has this option
9687         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9688         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9689         ;;
9690     nss)
9691         AC_DEFINE(USE_TLS_NSS)
9692         TLS=NSS
9693         ;;
9694     no)
9695         AC_MSG_WARN([Skipping TLS/SSL])
9696         ;;
9697     *)
9698         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9699 openssl - OpenSSL
9700 nss - Mozilla's Network Security Services (NSS)
9701     ])
9702         ;;
9703     esac
9704 else
9705     # default to using NSS, it results in smaller oox lib
9706     AC_DEFINE(USE_TLS_NSS)
9707     TLS=NSS
9709 AC_MSG_RESULT([$TLS])
9710 AC_SUBST(TLS)
9712 dnl ===================================================================
9713 dnl Check for system sane
9714 dnl ===================================================================
9715 AC_MSG_CHECKING([which sane header to use])
9716 if test "$with_system_sane" = "yes"; then
9717     AC_MSG_RESULT([external])
9718     AC_CHECK_HEADER(sane/sane.h, [],
9719       [AC_MSG_ERROR(sane not found. install sane)], [])
9720 else
9721     AC_MSG_RESULT([internal])
9722     BUILD_TYPE="$BUILD_TYPE SANE"
9725 dnl ===================================================================
9726 dnl Check for system icu
9727 dnl ===================================================================
9728 SYSTEM_GENBRK=
9729 SYSTEM_GENCCODE=
9730 SYSTEM_GENCMN=
9732 ICU_MAJOR=65
9733 ICU_MINOR=1
9734 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9735 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9736 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9737 AC_MSG_CHECKING([which icu to use])
9738 if test "$with_system_icu" = "yes"; then
9739     AC_MSG_RESULT([external])
9740     SYSTEM_ICU=TRUE
9741     AC_LANG_PUSH([C++])
9742     AC_MSG_CHECKING([for unicode/rbbi.h])
9743     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9744     AC_LANG_POP([C++])
9746     if test "$cross_compiling" != "yes"; then
9747         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9748         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9749         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9750         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9751     fi
9753     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9754         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9755         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9756         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9757         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9758         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9759             AC_MSG_RESULT([yes])
9760         else
9761             AC_MSG_RESULT([no])
9762             if test "$with_system_icu_for_build" != "force"; then
9763                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9764 You can use --with-system-icu-for-build=force to use it anyway.])
9765             fi
9766         fi
9767     fi
9769     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9770         # using the system icu tools can lead to version confusion, use the
9771         # ones from the build environment when cross-compiling
9772         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9773         if test -z "$SYSTEM_GENBRK"; then
9774             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9775         fi
9776         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9777         if test -z "$SYSTEM_GENCCODE"; then
9778             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9779         fi
9780         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9781         if test -z "$SYSTEM_GENCMN"; then
9782             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9783         fi
9784         if test "$ICU_MAJOR" -ge "49"; then
9785             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9786             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9787             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9788         else
9789             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9790             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9791             ICU_RECLASSIFIED_HEBREW_LETTER=
9792         fi
9793     fi
9795     if test "$cross_compiling" = "yes"; then
9796         if test "$ICU_MAJOR" -ge "50"; then
9797             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9798             ICU_MINOR=""
9799         fi
9800     fi
9801 else
9802     AC_MSG_RESULT([internal])
9803     SYSTEM_ICU=
9804     BUILD_TYPE="$BUILD_TYPE ICU"
9805     # surprisingly set these only for "internal" (to be used by various other
9806     # external libs): the system icu-config is quite unhelpful and spits out
9807     # dozens of weird flags and also default path -I/usr/include
9808     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9809     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9811 if test "$ICU_MAJOR" -ge "59"; then
9812     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9813     # with -std=c++11 but not all external libraries can be built with that,
9814     # for those use a bit-compatible typedef uint16_t UChar; see
9815     # icu/source/common/unicode/umachine.h
9816     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9817 else
9818     ICU_UCHAR_TYPE=""
9820 AC_SUBST(SYSTEM_ICU)
9821 AC_SUBST(SYSTEM_GENBRK)
9822 AC_SUBST(SYSTEM_GENCCODE)
9823 AC_SUBST(SYSTEM_GENCMN)
9824 AC_SUBST(ICU_MAJOR)
9825 AC_SUBST(ICU_MINOR)
9826 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9827 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9828 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9829 AC_SUBST(ICU_CFLAGS)
9830 AC_SUBST(ICU_LIBS)
9831 AC_SUBST(ICU_UCHAR_TYPE)
9833 dnl ==================================================================
9834 dnl Breakpad
9835 dnl ==================================================================
9836 DEFAULT_CRASHDUMP_VALUE="true"
9837 AC_MSG_CHECKING([whether to enable breakpad])
9838 if test "$enable_breakpad" != yes; then
9839     AC_MSG_RESULT([no])
9840 else
9841     AC_MSG_RESULT([yes])
9842     ENABLE_BREAKPAD="TRUE"
9843     AC_DEFINE(ENABLE_BREAKPAD)
9844     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9845     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9847     AC_MSG_CHECKING([for disable crash dump])
9848     if test "$enable_crashdump" = no; then
9849         DEFAULT_CRASHDUMP_VALUE="false"
9850         AC_MSG_RESULT([yes])
9851     else
9852        AC_MSG_RESULT([no])
9853     fi
9855     AC_MSG_CHECKING([for crashreport config])
9856     if test "$with_symbol_config" = "no"; then
9857         BREAKPAD_SYMBOL_CONFIG="invalid"
9858         AC_MSG_RESULT([no])
9859     else
9860         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9861         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9862         AC_MSG_RESULT([yes])
9863     fi
9864     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9866 AC_SUBST(ENABLE_BREAKPAD)
9867 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9869 dnl ==================================================================
9870 dnl libfuzzer
9871 dnl ==================================================================
9872 AC_MSG_CHECKING([whether to enable fuzzers])
9873 if test "$enable_fuzzers" != yes; then
9874     AC_MSG_RESULT([no])
9875 else
9876     AC_MSG_RESULT([yes])
9877     ENABLE_FUZZERS="TRUE"
9878     AC_DEFINE([ENABLE_FUZZERS],1)
9879     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9881 AC_SUBST(ENABLE_FUZZERS)
9883 dnl ===================================================================
9884 dnl Orcus
9885 dnl ===================================================================
9886 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9887 if test "$with_system_orcus" != "yes"; then
9888     if test "$SYSTEM_BOOST" = "TRUE"; then
9889         # ===========================================================
9890         # Determine if we are going to need to link with Boost.System
9891         # ===========================================================
9892         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9893         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9894         dnl in documentation has no effect.
9895         AC_MSG_CHECKING([if we need to link with Boost.System])
9896         AC_LANG_PUSH([C++])
9897         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9898                 @%:@include <boost/version.hpp>
9899             ]],[[
9900                 #if BOOST_VERSION >= 105000
9901                 #   error yes, we need to link with Boost.System
9902                 #endif
9903             ]])],[
9904                 AC_MSG_RESULT([no])
9905             ],[
9906                 AC_MSG_RESULT([yes])
9907                 AX_BOOST_SYSTEM
9908         ])
9909         AC_LANG_POP([C++])
9910     fi
9912 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9913 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9914 AC_SUBST([BOOST_SYSTEM_LIB])
9915 AC_SUBST(SYSTEM_LIBORCUS)
9917 dnl ===================================================================
9918 dnl HarfBuzz
9919 dnl ===================================================================
9920 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9921                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9922                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9924 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9925                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9926                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9928 if test "$COM" = "MSC"; then # override the above
9929     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9930     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9933 if test "$with_system_harfbuzz" = "yes"; then
9934     if test "$with_system_graphite" = "no"; then
9935         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9936     fi
9937     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9938     _save_libs="$LIBS"
9939     _save_cflags="$CFLAGS"
9940     LIBS="$LIBS $HARFBUZZ_LIBS"
9941     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9942     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9943     LIBS="$_save_libs"
9944     CFLAGS="$_save_cflags"
9945 else
9946     if test "$with_system_graphite" = "yes"; then
9947         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9948     fi
9951 AC_MSG_CHECKING([whether to use X11])
9952 dnl ***************************************
9953 dnl testing for X libraries and includes...
9954 dnl ***************************************
9955 if test "$USING_X11" = TRUE; then
9956     AC_DEFINE(HAVE_FEATURE_X11)
9958 AC_MSG_RESULT([$USING_X11])
9960 if test "$USING_X11" = TRUE; then
9961     AC_PATH_X
9962     AC_PATH_XTRA
9963     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9965     if test -z "$x_includes"; then
9966         x_includes="default_x_includes"
9967     fi
9968     if test -z "$x_libraries"; then
9969         x_libraries="default_x_libraries"
9970     fi
9971     CFLAGS="$CFLAGS $X_CFLAGS"
9972     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9973     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9974 else
9975     x_includes="no_x_includes"
9976     x_libraries="no_x_libraries"
9979 if test "$USING_X11" = TRUE; then
9980     dnl ===================================================================
9981     dnl Check for extension headers
9982     dnl ===================================================================
9983     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9984      [#include <X11/extensions/shape.h>])
9986     # vcl needs ICE and SM
9987     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9988     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9989         [AC_MSG_ERROR(ICE library not found)])
9990     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9991     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9992         [AC_MSG_ERROR(SM library not found)])
9995 dnl ===================================================================
9996 dnl Check for system Xrender
9997 dnl ===================================================================
9998 AC_MSG_CHECKING([whether to use Xrender])
9999 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10000     AC_MSG_RESULT([yes])
10001     PKG_CHECK_MODULES(XRENDER, xrender)
10002     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10003     FilterLibs "${XRENDER_LIBS}"
10004     XRENDER_LIBS="${filteredlibs}"
10005     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10006       [AC_MSG_ERROR(libXrender not found or functional)], [])
10007     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10008       [AC_MSG_ERROR(Xrender not found. install X)], [])
10009 else
10010     AC_MSG_RESULT([no])
10012 AC_SUBST(XRENDER_CFLAGS)
10013 AC_SUBST(XRENDER_LIBS)
10015 dnl ===================================================================
10016 dnl Check for XRandr
10017 dnl ===================================================================
10018 AC_MSG_CHECKING([whether to enable RandR support])
10019 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10020     AC_MSG_RESULT([yes])
10021     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10022     if test "$ENABLE_RANDR" != "TRUE"; then
10023         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10024                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10025         XRANDR_CFLAGS=" "
10026         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10027           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10028         XRANDR_LIBS="-lXrandr "
10029         ENABLE_RANDR="TRUE"
10030     fi
10031     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10032     FilterLibs "${XRANDR_LIBS}"
10033     XRANDR_LIBS="${filteredlibs}"
10034 else
10035     ENABLE_RANDR=""
10036     AC_MSG_RESULT([no])
10038 AC_SUBST(XRANDR_CFLAGS)
10039 AC_SUBST(XRANDR_LIBS)
10040 AC_SUBST(ENABLE_RANDR)
10042 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10043     WITH_WEBDAV="serf"
10045 if test $_os = iOS -o $_os = Android; then
10046     WITH_WEBDAV="no"
10048 AC_MSG_CHECKING([for webdav library])
10049 case "$WITH_WEBDAV" in
10050 serf)
10051     AC_MSG_RESULT([serf])
10052     # Check for system apr-util
10053     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10054                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10055                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10056     if test "$COM" = "MSC"; then
10057         APR_LIB_DIR="LibR"
10058         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10059         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10060     fi
10062     # Check for system serf
10063     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
10064                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
10065     if test "$COM" = "MSC"; then
10066         SERF_LIB_DIR="Release"
10067         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
10068         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
10069     fi
10070     ;;
10071 neon)
10072     AC_MSG_RESULT([neon])
10073     # Check for system neon
10074     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
10075     if test "$with_system_neon" = "yes"; then
10076         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10077     else
10078         NEON_VERSION=0295
10079     fi
10080     AC_SUBST(NEON_VERSION)
10081     ;;
10083     AC_MSG_RESULT([none, disabled])
10084     WITH_WEBDAV=""
10085     ;;
10086 esac
10087 AC_SUBST(WITH_WEBDAV)
10089 dnl ===================================================================
10090 dnl Check for disabling cve_tests
10091 dnl ===================================================================
10092 AC_MSG_CHECKING([whether to execute CVE tests])
10093 # If not explicitly enabled or disabled, default
10094 if test -z "$enable_cve_tests"; then
10095     case "$OS" in
10096     WNT)
10097         # Default cves off for Windows with its wild and wonderful
10098         # variety of AV software kicking in and panicking
10099         enable_cve_tests=no
10100         ;;
10101     *)
10102         # otherwise yes
10103         enable_cve_tests=yes
10104         ;;
10105     esac
10107 if test "$enable_cve_tests" = "no"; then
10108     AC_MSG_RESULT([no])
10109     DISABLE_CVE_TESTS=TRUE
10110     AC_SUBST(DISABLE_CVE_TESTS)
10111 else
10112     AC_MSG_RESULT([yes])
10115 dnl ===================================================================
10116 dnl Check for enabling chart XShape tests
10117 dnl ===================================================================
10118 AC_MSG_CHECKING([whether to execute chart XShape tests])
10119 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10120     AC_MSG_RESULT([yes])
10121     ENABLE_CHART_TESTS=TRUE
10122     AC_SUBST(ENABLE_CHART_TESTS)
10123 else
10124     AC_MSG_RESULT([no])
10127 dnl ===================================================================
10128 dnl Check for system openssl
10129 dnl ===================================================================
10130 DISABLE_OPENSSL=
10131 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10132 if test "$enable_openssl" = "yes"; then
10133     AC_MSG_RESULT([no])
10134     if test "$_os" = Darwin ; then
10135         # OpenSSL is deprecated when building for 10.7 or later.
10136         #
10137         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10138         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10140         with_system_openssl=no
10141         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10142     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10143             && test "$with_system_openssl" != "no"; then
10144         with_system_openssl=yes
10145         SYSTEM_OPENSSL=TRUE
10146         OPENSSL_CFLAGS=
10147         OPENSSL_LIBS="-lssl -lcrypto"
10148     else
10149         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10150     fi
10151     if test "$with_system_openssl" = "yes"; then
10152         AC_MSG_CHECKING([whether openssl supports SHA512])
10153         AC_LANG_PUSH([C])
10154         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10155             SHA512_CTX context;
10156 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10157         AC_LANG_POP(C)
10158     fi
10159 else
10160     AC_MSG_RESULT([yes])
10161     DISABLE_OPENSSL=TRUE
10163     # warn that although OpenSSL is disabled, system libraries may depend on it
10164     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10165     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10168 AC_SUBST([DISABLE_OPENSSL])
10170 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10171     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10172         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10173         enable_cipher_openssl_backend=no
10174     else
10175         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10176     fi
10178 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10179 ENABLE_CIPHER_OPENSSL_BACKEND=
10180 if test "$enable_cipher_openssl_backend" = yes; then
10181     AC_MSG_RESULT([yes])
10182     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10183 else
10184     AC_MSG_RESULT([no])
10186 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10188 dnl ===================================================================
10189 dnl Check for building gnutls
10190 dnl ===================================================================
10191 AC_MSG_CHECKING([whether to use gnutls])
10192 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10193     AC_MSG_RESULT([yes])
10194     AM_PATH_LIBGCRYPT()
10195     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10196         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10197                       available in the system to use as replacement.]]))
10198     FilterLibs "${LIBGCRYPT_LIBS}"
10199     LIBGCRYPT_LIBS="${filteredlibs}"
10200 else
10201     AC_MSG_RESULT([no])
10204 AC_SUBST([LIBGCRYPT_CFLAGS])
10205 AC_SUBST([LIBGCRYPT_LIBS])
10207 dnl ===================================================================
10208 dnl Check for system redland
10209 dnl ===================================================================
10210 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10211 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10212 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10213 if test "$with_system_redland" = "yes"; then
10214     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10215             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10216 else
10217     RAPTOR_MAJOR="0"
10218     RASQAL_MAJOR="3"
10219     REDLAND_MAJOR="0"
10221 AC_SUBST(RAPTOR_MAJOR)
10222 AC_SUBST(RASQAL_MAJOR)
10223 AC_SUBST(REDLAND_MAJOR)
10225 dnl ===================================================================
10226 dnl Check for system hunspell
10227 dnl ===================================================================
10228 AC_MSG_CHECKING([which libhunspell to use])
10229 if test "$_os" = iOS; then
10230    AC_MSG_RESULT([none])
10231 elif test "$with_system_hunspell" = "yes"; then
10232     AC_MSG_RESULT([external])
10233     SYSTEM_HUNSPELL=TRUE
10234     AC_LANG_PUSH([C++])
10235     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10236     if test "$HUNSPELL_PC" != "TRUE"; then
10237         AC_CHECK_HEADER(hunspell.hxx, [],
10238             [
10239             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10240             [AC_MSG_ERROR(hunspell headers not found.)], [])
10241             ], [])
10242         AC_CHECK_LIB([hunspell], [main], [:],
10243            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10244         HUNSPELL_LIBS=-lhunspell
10245     fi
10246     AC_LANG_POP([C++])
10247     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10248     FilterLibs "${HUNSPELL_LIBS}"
10249     HUNSPELL_LIBS="${filteredlibs}"
10250 else
10251     AC_MSG_RESULT([internal])
10252     SYSTEM_HUNSPELL=
10253     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10254     if test "$COM" = "MSC"; then
10255         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10256     else
10257         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10258     fi
10259     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10261 AC_SUBST(SYSTEM_HUNSPELL)
10262 AC_SUBST(HUNSPELL_CFLAGS)
10263 AC_SUBST(HUNSPELL_LIBS)
10265 dnl ===================================================================
10266 dnl Check for system qrcodegen
10267 dnl ===================================================================
10268 AC_MSG_CHECKING([which libqrcodegen to use])
10269 if test "$with_system_qrcodegen" = "yes"; then
10270     AC_MSG_RESULT([external])
10271     SYSTEM_QRCODEGEN=TRUE
10272     AC_LANG_PUSH([C++])
10273     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10274         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10275     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10276         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10277     QRCODEGEN_LIBS=-lqrcodegencpp
10278     AC_LANG_POP([C++])
10279     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10280     FilterLibs "${QRCODEGEN_LIBS}"
10281     QRCODEGEN_LIBS="${filteredlibs}"
10282 else
10283     AC_MSG_RESULT([internal])
10284     SYSTEM_QRCODEGEN=
10285     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10287 AC_SUBST(SYSTEM_QRCODEGEN)
10288 AC_SUBST(QRCODEGEN_CFLAGS)
10289 AC_SUBST(QRCODEGEN_LIBS)
10291 dnl ===================================================================
10292 dnl Checking for altlinuxhyph
10293 dnl ===================================================================
10294 AC_MSG_CHECKING([which altlinuxhyph to use])
10295 if test "$with_system_altlinuxhyph" = "yes"; then
10296     AC_MSG_RESULT([external])
10297     SYSTEM_HYPH=TRUE
10298     AC_CHECK_HEADER(hyphen.h, [],
10299        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10300     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10301        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10302        [#include <hyphen.h>])
10303     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10304         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10305     if test -z "$HYPHEN_LIB"; then
10306         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10307            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10308     fi
10309     if test -z "$HYPHEN_LIB"; then
10310         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10311            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10312     fi
10313 else
10314     AC_MSG_RESULT([internal])
10315     SYSTEM_HYPH=
10316     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10317     if test "$COM" = "MSC"; then
10318         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10319     else
10320         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10321     fi
10323 AC_SUBST(SYSTEM_HYPH)
10324 AC_SUBST(HYPHEN_LIB)
10326 dnl ===================================================================
10327 dnl Checking for mythes
10328 dnl ===================================================================
10329 AC_MSG_CHECKING([which mythes to use])
10330 if test "$_os" = iOS; then
10331    AC_MSG_RESULT([none])
10332 elif test "$with_system_mythes" = "yes"; then
10333     AC_MSG_RESULT([external])
10334     SYSTEM_MYTHES=TRUE
10335     AC_LANG_PUSH([C++])
10336     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10337     if test "$MYTHES_PKGCONFIG" = "no"; then
10338         AC_CHECK_HEADER(mythes.hxx, [],
10339             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10340         AC_CHECK_LIB([mythes-1.2], [main], [:],
10341             [ MYTHES_FOUND=no], [])
10342     if test "$MYTHES_FOUND" = "no"; then
10343         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10344                 [ MYTHES_FOUND=no], [])
10345     fi
10346     if test "$MYTHES_FOUND" = "no"; then
10347         AC_MSG_ERROR([mythes library not found!.])
10348     fi
10349     fi
10350     AC_LANG_POP([C++])
10351     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10352     FilterLibs "${MYTHES_LIBS}"
10353     MYTHES_LIBS="${filteredlibs}"
10354 else
10355     AC_MSG_RESULT([internal])
10356     SYSTEM_MYTHES=
10357     BUILD_TYPE="$BUILD_TYPE MYTHES"
10358     if test "$COM" = "MSC"; then
10359         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10360     else
10361         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10362     fi
10364 AC_SUBST(SYSTEM_MYTHES)
10365 AC_SUBST(MYTHES_CFLAGS)
10366 AC_SUBST(MYTHES_LIBS)
10368 dnl ===================================================================
10369 dnl How should we build the linear programming solver ?
10370 dnl ===================================================================
10372 ENABLE_COINMP=
10373 AC_MSG_CHECKING([whether to build with CoinMP])
10374 if test "$enable_coinmp" != "no"; then
10375     ENABLE_COINMP=TRUE
10376     AC_MSG_RESULT([yes])
10377     if test "$with_system_coinmp" = "yes"; then
10378         SYSTEM_COINMP=TRUE
10379         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10380         FilterLibs "${COINMP_LIBS}"
10381         COINMP_LIBS="${filteredlibs}"
10382     else
10383         BUILD_TYPE="$BUILD_TYPE COINMP"
10384     fi
10385 else
10386     AC_MSG_RESULT([no])
10388 AC_SUBST(ENABLE_COINMP)
10389 AC_SUBST(SYSTEM_COINMP)
10390 AC_SUBST(COINMP_CFLAGS)
10391 AC_SUBST(COINMP_LIBS)
10393 ENABLE_LPSOLVE=
10394 AC_MSG_CHECKING([whether to build with lpsolve])
10395 if test "$enable_lpsolve" != "no"; then
10396     ENABLE_LPSOLVE=TRUE
10397     AC_MSG_RESULT([yes])
10398 else
10399     AC_MSG_RESULT([no])
10401 AC_SUBST(ENABLE_LPSOLVE)
10403 if test "$ENABLE_LPSOLVE" = TRUE; then
10404     AC_MSG_CHECKING([which lpsolve to use])
10405     if test "$with_system_lpsolve" = "yes"; then
10406         AC_MSG_RESULT([external])
10407         SYSTEM_LPSOLVE=TRUE
10408         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10409            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10410         save_LIBS=$LIBS
10411         # some systems need this. Like Ubuntu...
10412         AC_CHECK_LIB(m, floor)
10413         AC_CHECK_LIB(dl, dlopen)
10414         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10415             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10416         LIBS=$save_LIBS
10417     else
10418         AC_MSG_RESULT([internal])
10419         SYSTEM_LPSOLVE=
10420         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10421     fi
10423 AC_SUBST(SYSTEM_LPSOLVE)
10425 dnl ===================================================================
10426 dnl Checking for libexttextcat
10427 dnl ===================================================================
10428 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10429 if test "$with_system_libexttextcat" = "yes"; then
10430     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10432 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10434 dnl ===================================================================
10435 dnl Checking for libnumbertext
10436 dnl ===================================================================
10437 AC_MSG_CHECKING([whether to use libnumbertext])
10438 if test "$enable_libnumbertext" = "no"; then
10439     AC_MSG_RESULT([no])
10440     ENABLE_LIBNUMBERTEXT=
10441     SYSTEM_LIBNUMBERTEXT=
10442 else
10443     AC_MSG_RESULT([yes])
10444     ENABLE_LIBNUMBERTEXT=TRUE
10445     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10446     if test "$with_system_libnumbertext" = "yes"; then
10447         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10448         SYSTEM_LIBNUMBERTEXT=YES
10449     else
10450         SYSTEM_LIBNUMBERTEXT=
10451         AC_LANG_PUSH([C++])
10452         save_CPPFLAGS=$CPPFLAGS
10453         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10454         AC_CHECK_HEADERS([codecvt regex])
10455         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10456                 [ ENABLE_LIBNUMBERTEXT=''
10457                   LIBNUMBERTEXT_CFLAGS=''
10458                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10459                                Enable libnumbertext fallback (missing number to number name conversion).])
10460                 ])
10461         CPPFLAGS=$save_CPPFLAGS
10462         AC_LANG_POP([C++])
10463     fi
10464     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10465         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10466     fi
10468 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10469 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10470 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10471 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10473 dnl ***************************************
10474 dnl testing libc version for Linux...
10475 dnl ***************************************
10476 if test "$_os" = "Linux"; then
10477     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10478     exec 6>/dev/null # no output
10479     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10480     exec 6>&1 # output on again
10481     if test "$HAVE_LIBC"; then
10482         AC_MSG_RESULT([yes])
10483     else
10484         AC_MSG_ERROR([no, upgrade libc])
10485     fi
10488 dnl =========================================
10489 dnl Check for uuidgen
10490 dnl =========================================
10491 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10492     # presence is already tested above in the WINDOWS_SDK_HOME check
10493     UUIDGEN=uuidgen.exe
10494     AC_SUBST(UUIDGEN)
10495 else
10496     AC_PATH_PROG([UUIDGEN], [uuidgen])
10497     if test -z "$UUIDGEN"; then
10498         AC_MSG_WARN([uuid is needed for building installation sets])
10499     fi
10502 dnl ***************************************
10503 dnl Checking for bison and flex
10504 dnl ***************************************
10505 AC_PATH_PROG(BISON, bison)
10506 if test -z "$BISON"; then
10507     AC_MSG_ERROR([no bison found in \$PATH, install it])
10508 else
10509     AC_MSG_CHECKING([the bison version])
10510     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10511     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10512     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
10513     dnl cause
10514     dnl
10515     dnl   idlc/source/parser.y:222:15: error: externally available entity 'YYSTYPE' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]
10516     dnl   typedef union YYSTYPE
10517     dnl           ~~~~~~^~~~~~~
10518     dnl
10519     dnl while at least 3.4.1 is know to be good:
10520     if test "$COMPILER_PLUGINS" = TRUE; then
10521         if test "$_bison_longver" -lt 2004; then
10522             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
10523         fi
10524     else
10525         if test "$_bison_longver" -lt 2000; then
10526             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10527         fi
10528     fi
10530 AC_SUBST([BISON])
10532 AC_PATH_PROG(FLEX, flex)
10533 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10534     FLEX=`cygpath -m $FLEX`
10536 if test -z "$FLEX"; then
10537     AC_MSG_ERROR([no flex found in \$PATH, install it])
10538 else
10539     AC_MSG_CHECKING([the flex version])
10540     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10541     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10542         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10543     fi
10545 AC_SUBST([FLEX])
10546 dnl ***************************************
10547 dnl Checking for patch
10548 dnl ***************************************
10549 AC_PATH_PROG(PATCH, patch)
10550 if test -z "$PATCH"; then
10551     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10554 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10555 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10556     if test -z "$with_gnu_patch"; then
10557         GNUPATCH=$PATCH
10558     else
10559         if test -x "$with_gnu_patch"; then
10560             GNUPATCH=$with_gnu_patch
10561         else
10562             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10563         fi
10564     fi
10566     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10567     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10568         AC_MSG_RESULT([yes])
10569     else
10570         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10571     fi
10572 else
10573     GNUPATCH=$PATCH
10576 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10577     GNUPATCH=`cygpath -m $GNUPATCH`
10580 dnl We also need to check for --with-gnu-cp
10582 if test -z "$with_gnu_cp"; then
10583     # check the place where the good stuff is hidden on Solaris...
10584     if test -x /usr/gnu/bin/cp; then
10585         GNUCP=/usr/gnu/bin/cp
10586     else
10587         AC_PATH_PROGS(GNUCP, gnucp cp)
10588     fi
10589     if test -z $GNUCP; then
10590         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10591     fi
10592 else
10593     if test -x "$with_gnu_cp"; then
10594         GNUCP=$with_gnu_cp
10595     else
10596         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10597     fi
10600 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10601     GNUCP=`cygpath -m $GNUCP`
10604 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10605 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10606     AC_MSG_RESULT([yes])
10607 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10608     AC_MSG_RESULT([yes])
10609 else
10610     case "$build_os" in
10611     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10612         x_GNUCP=[\#]
10613         GNUCP=''
10614         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10615         ;;
10616     *)
10617         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10618         ;;
10619     esac
10622 AC_SUBST(GNUPATCH)
10623 AC_SUBST(GNUCP)
10624 AC_SUBST(x_GNUCP)
10626 dnl ***************************************
10627 dnl testing assembler path
10628 dnl ***************************************
10629 ML_EXE=""
10630 if test "$_os" = "WINNT"; then
10631     if test "$BITNESS_OVERRIDE" = ""; then
10632         assembler=ml.exe
10633     else
10634         assembler=ml64.exe
10635     fi
10637     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10638     if test -f "$CL_PATH/$assembler"; then
10639         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10640         AC_MSG_RESULT([$ML_EXE])
10641     else
10642         AC_MSG_ERROR([not found])
10643     fi
10646 AC_SUBST(ML_EXE)
10648 dnl ===================================================================
10649 dnl We need zip and unzip
10650 dnl ===================================================================
10651 AC_PATH_PROG(ZIP, zip)
10652 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10653 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10654     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],,)
10657 AC_PATH_PROG(UNZIP, unzip)
10658 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10660 dnl ===================================================================
10661 dnl Zip must be a specific type for different build types.
10662 dnl ===================================================================
10663 if test $build_os = cygwin; then
10664     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10665         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10666     fi
10669 dnl ===================================================================
10670 dnl We need touch with -h option support.
10671 dnl ===================================================================
10672 AC_PATH_PROG(TOUCH, touch)
10673 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10674 touch warn
10675 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10676     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],,)
10679 dnl ===================================================================
10680 dnl Check for system epoxy
10681 dnl ===================================================================
10682 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10684 dnl ===================================================================
10685 dnl Set vcl option: coordinate device in double or sal_Int32
10686 dnl ===================================================================
10688 dnl disabled for now, we don't want subtle differences between OSs
10689 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10690 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10691 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10692 dnl     AC_MSG_RESULT([double])
10693 dnl else
10694 dnl     AC_MSG_RESULT([sal_Int32])
10695 dnl fi
10697 dnl ===================================================================
10698 dnl Test which vclplugs have to be built.
10699 dnl ===================================================================
10700 R=""
10701 if test "$USING_X11" != TRUE; then
10702     enable_gtk3=no
10704 GTK3_CFLAGS=""
10705 GTK3_LIBS=""
10706 ENABLE_GTK3=""
10707 if test "x$enable_gtk3" = "xyes"; then
10708     if test "$with_system_cairo" = no; then
10709         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10710     fi
10711     : ${with_system_cairo:=yes}
10712     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="")
10713     if test "x$ENABLE_GTK3" = "xTRUE"; then
10714         AC_DEFINE(ENABLE_GTK3)
10715         R="gtk3"
10716     else
10717         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10718     fi
10719     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10720     FilterLibs "${GTK3_LIBS}"
10721     GTK3_LIBS="${filteredlibs}"
10723     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10724     if test "$with_system_epoxy" != "yes"; then
10725         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10726         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10727                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10728     fi
10730 AC_SUBST(GTK3_LIBS)
10731 AC_SUBST(GTK3_CFLAGS)
10732 AC_SUBST(ENABLE_GTK3)
10734 if test "$enable_introspection" = yes; then
10735     if test "$ENABLE_GTK3" = TRUE; then
10736         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10737     else
10738         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10739     fi
10742 ENABLE_QT5=""
10743 if test "x$enable_qt5" = "xyes"; then
10744     ENABLE_QT5="TRUE"
10745     AC_DEFINE(ENABLE_QT5)
10746     R="$R qt5"
10748 AC_SUBST(ENABLE_QT5)
10750 ENABLE_KF5=""
10751 if test "x$enable_kf5" = "xyes"; then
10752     ENABLE_KF5="TRUE"
10753     AC_DEFINE(ENABLE_KF5)
10754     R="$R kf5"
10756 AC_SUBST(ENABLE_KF5)
10758 ENABLE_GTK3_KDE5=""
10759 if test "x$enable_gtk3_kde5" = "xyes"; then
10760     ENABLE_GTK3_KDE5="TRUE"
10761     AC_DEFINE(ENABLE_GTK3_KDE5)
10762     R="$R gtk3_kde5"
10764 AC_SUBST(ENABLE_GTK3_KDE5)
10766 if test "$_os" = "WINNT"; then
10767     R="$R win"
10768 elif test "$_os" = "Darwin"; then
10769     R="$R osx"
10770 elif test "$_os" = "iOS"; then
10771     R="ios (builtin)"
10774 build_vcl_plugins="$R"
10775 if test -z "$build_vcl_plugins"; then
10776     build_vcl_plugins="none"
10778 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10780 dnl ===================================================================
10781 dnl check for dbus support
10782 dnl ===================================================================
10783 ENABLE_DBUS=""
10784 DBUS_CFLAGS=""
10785 DBUS_LIBS=""
10786 DBUS_GLIB_CFLAGS=""
10787 DBUS_GLIB_LIBS=""
10788 DBUS_HAVE_GLIB=""
10790 if test "$enable_dbus" = "no"; then
10791     test_dbus=no
10794 AC_MSG_CHECKING([whether to enable DBUS support])
10795 if test "$test_dbus" = "yes"; then
10796     ENABLE_DBUS="TRUE"
10797     AC_MSG_RESULT([yes])
10798     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10799     AC_DEFINE(ENABLE_DBUS)
10800     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10801     FilterLibs "${DBUS_LIBS}"
10802     DBUS_LIBS="${filteredlibs}"
10804     # Glib is needed for BluetoothServer
10805     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10806     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10807         [
10808             DBUS_HAVE_GLIB="TRUE"
10809             AC_DEFINE(DBUS_HAVE_GLIB,1)
10810         ],
10811         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10812     )
10813 else
10814     AC_MSG_RESULT([no])
10817 AC_SUBST(ENABLE_DBUS)
10818 AC_SUBST(DBUS_CFLAGS)
10819 AC_SUBST(DBUS_LIBS)
10820 AC_SUBST(DBUS_GLIB_CFLAGS)
10821 AC_SUBST(DBUS_GLIB_LIBS)
10822 AC_SUBST(DBUS_HAVE_GLIB)
10824 AC_MSG_CHECKING([whether to enable Impress remote control])
10825 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10826     AC_MSG_RESULT([yes])
10827     ENABLE_SDREMOTE=TRUE
10828     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10830     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
10831         # The Bluetooth code doesn't compile with macOS SDK 10.15
10832         if test "$enable_sdremote_bluetooth" = yes; then
10833             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
10834         fi
10835         enable_sdremote_bluetooth=no
10836     fi
10837     # If not explicitly enabled or disabled, default
10838     if test -z "$enable_sdremote_bluetooth"; then
10839         case "$OS" in
10840         LINUX|MACOSX|WNT)
10841             # Default to yes for these
10842             enable_sdremote_bluetooth=yes
10843             ;;
10844         *)
10845             # otherwise no
10846             enable_sdremote_bluetooth=no
10847             ;;
10848         esac
10849     fi
10850     # $enable_sdremote_bluetooth is guaranteed non-empty now
10852     if test "$enable_sdremote_bluetooth" != "no"; then
10853         if test "$OS" = "LINUX"; then
10854             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10855                 AC_MSG_RESULT([yes])
10856                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10857                 dnl ===================================================================
10858                 dnl Check for system bluez
10859                 dnl ===================================================================
10860                 AC_MSG_CHECKING([which Bluetooth header to use])
10861                 if test "$with_system_bluez" = "yes"; then
10862                     AC_MSG_RESULT([external])
10863                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10864                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10865                     SYSTEM_BLUEZ=TRUE
10866                 else
10867                     AC_MSG_RESULT([internal])
10868                     SYSTEM_BLUEZ=
10869                 fi
10870             else
10871                 AC_MSG_RESULT([no, dbus disabled])
10872                 ENABLE_SDREMOTE_BLUETOOTH=
10873                 SYSTEM_BLUEZ=
10874             fi
10875         else
10876             AC_MSG_RESULT([yes])
10877             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10878             SYSTEM_BLUEZ=
10879         fi
10880     else
10881         AC_MSG_RESULT([no])
10882         ENABLE_SDREMOTE_BLUETOOTH=
10883         SYSTEM_BLUEZ=
10884     fi
10885 else
10886     ENABLE_SDREMOTE=
10887     SYSTEM_BLUEZ=
10888     AC_MSG_RESULT([no])
10890 AC_SUBST(ENABLE_SDREMOTE)
10891 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10892 AC_SUBST(SYSTEM_BLUEZ)
10894 dnl ===================================================================
10895 dnl Check whether to enable GIO support
10896 dnl ===================================================================
10897 if test "$ENABLE_GTK3" = "TRUE"; then
10898     AC_MSG_CHECKING([whether to enable GIO support])
10899     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10900         dnl Need at least 2.26 for the dbus support.
10901         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10902                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10903         if test "$ENABLE_GIO" = "TRUE"; then
10904             AC_DEFINE(ENABLE_GIO)
10905             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10906             FilterLibs "${GIO_LIBS}"
10907             GIO_LIBS="${filteredlibs}"
10908         fi
10909     else
10910         AC_MSG_RESULT([no])
10911     fi
10913 AC_SUBST(ENABLE_GIO)
10914 AC_SUBST(GIO_CFLAGS)
10915 AC_SUBST(GIO_LIBS)
10918 dnl ===================================================================
10920 SPLIT_APP_MODULES=""
10921 if test "$enable_split_app_modules" = "yes"; then
10922     SPLIT_APP_MODULES="TRUE"
10924 AC_SUBST(SPLIT_APP_MODULES)
10926 SPLIT_OPT_FEATURES=""
10927 if test "$enable_split_opt_features" = "yes"; then
10928     SPLIT_OPT_FEATURES="TRUE"
10930 AC_SUBST(SPLIT_OPT_FEATURES)
10932 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10933     if test "$enable_cairo_canvas" = yes; then
10934         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10935     fi
10936     enable_cairo_canvas=no
10937 elif test -z "$enable_cairo_canvas"; then
10938     enable_cairo_canvas=yes
10941 ENABLE_CAIRO_CANVAS=""
10942 if test "$enable_cairo_canvas" = "yes"; then
10943     test_cairo=yes
10944     ENABLE_CAIRO_CANVAS="TRUE"
10945     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10947 AC_SUBST(ENABLE_CAIRO_CANVAS)
10949 dnl ===================================================================
10950 dnl Check whether the GStreamer libraries are available.
10951 dnl ===================================================================
10953 ENABLE_GSTREAMER_1_0=""
10955 if test "$build_gstreamer_1_0" = "yes"; then
10957     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10958     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10959         ENABLE_GSTREAMER_1_0="TRUE"
10960         AC_MSG_RESULT([yes])
10961         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10962         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10963         FilterLibs "${GSTREAMER_1_0_LIBS}"
10964         GSTREAMER_1_0_LIBS="${filteredlibs}"
10965         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10966     else
10967         AC_MSG_RESULT([no])
10968     fi
10970 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10971 AC_SUBST(GSTREAMER_1_0_LIBS)
10972 AC_SUBST(ENABLE_GSTREAMER_1_0)
10974 dnl ===================================================================
10975 dnl Check whether to build the VLC avmedia backend
10976 dnl ===================================================================
10978 ENABLE_VLC=""
10980 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10981 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10982     ENABLE_VLC="TRUE"
10983     AC_MSG_RESULT([yes])
10984 else
10985     AC_MSG_RESULT([no])
10987 AC_SUBST(ENABLE_VLC)
10989 ENABLE_OPENGL_TRANSITIONS=
10990 ENABLE_OPENGL_CANVAS=
10991 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10992    : # disable
10993 elif test "$_os" = "Darwin"; then
10994     # We use frameworks on macOS, no need for detail checks
10995     ENABLE_OPENGL_TRANSITIONS=TRUE
10996     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10997     ENABLE_OPENGL_CANVAS=TRUE
10998 elif test $_os = WINNT; then
10999     ENABLE_OPENGL_TRANSITIONS=TRUE
11000     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11001     ENABLE_OPENGL_CANVAS=TRUE
11002 else
11003     if test "$USING_X11" = TRUE; then
11004         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11005         ENABLE_OPENGL_TRANSITIONS=TRUE
11006         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11007         ENABLE_OPENGL_CANVAS=TRUE
11008     fi
11011 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11012 AC_SUBST(ENABLE_OPENGL_CANVAS)
11014 dnl =================================================
11015 dnl Check whether to build with OpenCL support.
11016 dnl =================================================
11018 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
11019     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11020     # platform (optional at run-time, used through clew).
11021     BUILD_TYPE="$BUILD_TYPE OPENCL"
11022     AC_DEFINE(HAVE_FEATURE_OPENCL)
11025 dnl =================================================
11026 dnl Check whether to build with dconf support.
11027 dnl =================================================
11029 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11030     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11031         if test "$enable_dconf" = yes; then
11032             AC_MSG_ERROR([dconf not found])
11033         else
11034             enable_dconf=no
11035         fi])
11037 AC_MSG_CHECKING([whether to enable dconf])
11038 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11039     DCONF_CFLAGS=
11040     DCONF_LIBS=
11041     ENABLE_DCONF=
11042     AC_MSG_RESULT([no])
11043 else
11044     ENABLE_DCONF=TRUE
11045     AC_DEFINE(ENABLE_DCONF)
11046     AC_MSG_RESULT([yes])
11048 AC_SUBST([DCONF_CFLAGS])
11049 AC_SUBST([DCONF_LIBS])
11050 AC_SUBST([ENABLE_DCONF])
11052 # pdf import?
11053 AC_MSG_CHECKING([whether to build the PDF import feature])
11054 ENABLE_PDFIMPORT=
11055 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
11056     AC_MSG_RESULT([yes])
11057     ENABLE_PDFIMPORT=TRUE
11058     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11059 else
11060     AC_MSG_RESULT([no])
11063 # Pdfium?
11064 AC_MSG_CHECKING([whether to build PDFium])
11065 ENABLE_PDFIUM=
11066 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11067     AC_MSG_RESULT([yes])
11068     ENABLE_PDFIUM=TRUE
11069     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11070     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11071 else
11072     AC_MSG_RESULT([no])
11074 AC_SUBST(ENABLE_PDFIUM)
11076 dnl ===================================================================
11077 dnl Check for poppler
11078 dnl ===================================================================
11079 ENABLE_POPPLER=
11080 AC_MSG_CHECKING([whether to build Poppler])
11081 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11082     AC_MSG_RESULT([yes])
11083     ENABLE_POPPLER=TRUE
11084     AC_DEFINE(HAVE_FEATURE_POPPLER)
11085 else
11086     AC_MSG_RESULT([no])
11088 AC_SUBST(ENABLE_POPPLER)
11090 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11091     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11094 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11095     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11098 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11099     dnl ===================================================================
11100     dnl Check for system poppler
11101     dnl ===================================================================
11102     AC_MSG_CHECKING([which PDF import poppler to use])
11103     if test "$with_system_poppler" = "yes"; then
11104         AC_MSG_RESULT([external])
11105         SYSTEM_POPPLER=TRUE
11106         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11107         AC_LANG_PUSH([C++])
11108         save_CXXFLAGS=$CXXFLAGS
11109         save_CPPFLAGS=$CPPFLAGS
11110         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11111         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11112         AC_CHECK_HEADER([cpp/poppler-version.h],
11113             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11114             [])
11115         CXXFLAGS=$save_CXXFLAGS
11116         CPPFLAGS=$save_CPPFLAGS
11117         AC_LANG_POP([C++])
11118         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11120         FilterLibs "${POPPLER_LIBS}"
11121         POPPLER_LIBS="${filteredlibs}"
11122     else
11123         AC_MSG_RESULT([internal])
11124         SYSTEM_POPPLER=
11125         BUILD_TYPE="$BUILD_TYPE POPPLER"
11126         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11127     fi
11128     AC_DEFINE([ENABLE_PDFIMPORT],1)
11130 AC_SUBST(ENABLE_PDFIMPORT)
11131 AC_SUBST(SYSTEM_POPPLER)
11132 AC_SUBST(POPPLER_CFLAGS)
11133 AC_SUBST(POPPLER_LIBS)
11135 # Skia?
11136 AC_MSG_CHECKING([whether to build Skia])
11137 ENABLE_SKIA=
11138 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
11139     AC_MSG_RESULT([yes])
11140     ENABLE_SKIA=TRUE
11141     AC_DEFINE(HAVE_FEATURE_SKIA)
11142     BUILD_TYPE="$BUILD_TYPE SKIA"
11143 else
11144     AC_MSG_RESULT([no])
11146 AC_SUBST(ENABLE_SKIA)
11148 SYSTEM_GPGMEPP=
11150 if test "$build_for_ios" = "YES"; then
11151     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
11152     AC_MSG_RESULT([yes])
11153 elif test "$enable_mpl_subset" = "yes"; then
11154     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11155     AC_MSG_RESULT([yes])
11156 elif test "$enable_fuzzers" = "yes"; then
11157     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11158     AC_MSG_RESULT([yes])
11159 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11160     dnl ===================================================================
11161     dnl Check for system gpgme
11162     dnl ===================================================================
11163     AC_MSG_CHECKING([which gpgmepp to use])
11164     if test "$with_system_gpgmepp" = "yes"; then
11165         AC_MSG_RESULT([external])
11166         SYSTEM_GPGMEPP=TRUE
11168         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11169         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11170             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11171         # progress_callback is the only func with plain C linkage
11172         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11173         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11174             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11175         AC_CHECK_HEADER(gpgme.h, [],
11176             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11177     else
11178         AC_MSG_RESULT([internal])
11179         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11180         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11182         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11183         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11184         if test "$_os" != "WINNT"; then
11185             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11186             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11187         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11188             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11189         fi
11190     fi
11191     ENABLE_GPGMEPP=TRUE
11192     AC_DEFINE([HAVE_FEATURE_GPGME])
11193     AC_PATH_PROG(GPG, gpg)
11194     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11195     # so let's exclude that manually for the moment
11196     if test -n "$GPG" -a "$_os" != "WINNT"; then
11197         # make sure we not only have a working gpgme, but a full working
11198         # gpg installation to run OpenPGP signature verification
11199         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11200     fi
11201     if test "$_os" = "Linux"; then
11202       uid=`id -u`
11203       AC_MSG_CHECKING([for /run/user/$uid])
11204       if test -d /run/user/$uid; then
11205         AC_MSG_RESULT([yes])
11206         AC_PATH_PROG(GPGCONF, gpgconf)
11208         # Older versions of gpgconf are not working as expected, since
11209         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11210         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11211         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11212         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11213         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11214         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11215         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11216           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11217           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11218           if $GPGCONF --dump-options > /dev/null ; then
11219             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11220               AC_MSG_RESULT([yes])
11221               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11222               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11223             else
11224               AC_MSG_RESULT([no])
11225             fi
11226           else
11227             AC_MSG_RESULT([no. missing or broken gpgconf?])
11228           fi
11229         else
11230           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11231         fi
11232       else
11233         AC_MSG_RESULT([no])
11234      fi
11235    fi
11237 AC_SUBST(ENABLE_GPGMEPP)
11238 AC_SUBST(SYSTEM_GPGMEPP)
11239 AC_SUBST(GPG_ERROR_CFLAGS)
11240 AC_SUBST(GPG_ERROR_LIBS)
11241 AC_SUBST(LIBASSUAN_CFLAGS)
11242 AC_SUBST(LIBASSUAN_LIBS)
11243 AC_SUBST(GPGMEPP_CFLAGS)
11244 AC_SUBST(GPGMEPP_LIBS)
11246 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11247 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11248     AC_MSG_RESULT([yes])
11249     ENABLE_MEDIAWIKI=TRUE
11250     BUILD_TYPE="$BUILD_TYPE XSLTML"
11251     if test  "x$with_java" = "xno"; then
11252         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11253     fi
11254 else
11255     AC_MSG_RESULT([no])
11256     ENABLE_MEDIAWIKI=
11257     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11259 AC_SUBST(ENABLE_MEDIAWIKI)
11261 AC_MSG_CHECKING([whether to build the Report Builder])
11262 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11263     AC_MSG_RESULT([yes])
11264     ENABLE_REPORTBUILDER=TRUE
11265     AC_MSG_CHECKING([which jfreereport libs to use])
11266     if test "$with_system_jfreereport" = "yes"; then
11267         SYSTEM_JFREEREPORT=TRUE
11268         AC_MSG_RESULT([external])
11269         if test -z $SAC_JAR; then
11270             SAC_JAR=/usr/share/java/sac.jar
11271         fi
11272         if ! test -f $SAC_JAR; then
11273              AC_MSG_ERROR(sac.jar not found.)
11274         fi
11276         if test -z $LIBXML_JAR; then
11277             if test -f /usr/share/java/libxml-1.0.0.jar; then
11278                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11279             elif test -f /usr/share/java/libxml.jar; then
11280                 LIBXML_JAR=/usr/share/java/libxml.jar
11281             else
11282                 AC_MSG_ERROR(libxml.jar replacement not found.)
11283             fi
11284         elif ! test -f $LIBXML_JAR; then
11285             AC_MSG_ERROR(libxml.jar not found.)
11286         fi
11288         if test -z $FLUTE_JAR; then
11289             if test -f/usr/share/java/flute-1.3.0.jar; then
11290                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11291             elif test -f /usr/share/java/flute.jar; then
11292                 FLUTE_JAR=/usr/share/java/flute.jar
11293             else
11294                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11295             fi
11296         elif ! test -f $FLUTE_JAR; then
11297             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11298         fi
11300         if test -z $JFREEREPORT_JAR; then
11301             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11302                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11303             elif test -f /usr/share/java/flow-engine.jar; then
11304                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11305             else
11306                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11307             fi
11308         elif ! test -f  $JFREEREPORT_JAR; then
11309                 AC_MSG_ERROR(jfreereport.jar not found.)
11310         fi
11312         if test -z $LIBLAYOUT_JAR; then
11313             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11314                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11315             elif test -f /usr/share/java/liblayout.jar; then
11316                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11317             else
11318                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11319             fi
11320         elif ! test -f $LIBLAYOUT_JAR; then
11321                 AC_MSG_ERROR(liblayout.jar not found.)
11322         fi
11324         if test -z $LIBLOADER_JAR; then
11325             if test -f /usr/share/java/libloader-1.0.0.jar; then
11326                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11327             elif test -f /usr/share/java/libloader.jar; then
11328                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11329             else
11330                 AC_MSG_ERROR(libloader.jar replacement not found.)
11331             fi
11332         elif ! test -f  $LIBLOADER_JAR; then
11333             AC_MSG_ERROR(libloader.jar not found.)
11334         fi
11336         if test -z $LIBFORMULA_JAR; then
11337             if test -f /usr/share/java/libformula-0.2.0.jar; then
11338                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11339             elif test -f /usr/share/java/libformula.jar; then
11340                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11341             else
11342                 AC_MSG_ERROR(libformula.jar replacement not found.)
11343             fi
11344         elif ! test -f $LIBFORMULA_JAR; then
11345                 AC_MSG_ERROR(libformula.jar not found.)
11346         fi
11348         if test -z $LIBREPOSITORY_JAR; then
11349             if test -f /usr/share/java/librepository-1.0.0.jar; then
11350                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11351             elif test -f /usr/share/java/librepository.jar; then
11352                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11353             else
11354                 AC_MSG_ERROR(librepository.jar replacement not found.)
11355             fi
11356         elif ! test -f $LIBREPOSITORY_JAR; then
11357             AC_MSG_ERROR(librepository.jar not found.)
11358         fi
11360         if test -z $LIBFONTS_JAR; then
11361             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11362                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11363             elif test -f /usr/share/java/libfonts.jar; then
11364                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11365             else
11366                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11367             fi
11368         elif ! test -f $LIBFONTS_JAR; then
11369                 AC_MSG_ERROR(libfonts.jar not found.)
11370         fi
11372         if test -z $LIBSERIALIZER_JAR; then
11373             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11374                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11375             elif test -f /usr/share/java/libserializer.jar; then
11376                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11377             else
11378                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11379             fi
11380         elif ! test -f $LIBSERIALIZER_JAR; then
11381                 AC_MSG_ERROR(libserializer.jar not found.)
11382         fi
11384         if test -z $LIBBASE_JAR; then
11385             if test -f /usr/share/java/libbase-1.0.0.jar; then
11386                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11387             elif test -f /usr/share/java/libbase.jar; then
11388                 LIBBASE_JAR=/usr/share/java/libbase.jar
11389             else
11390                 AC_MSG_ERROR(libbase.jar replacement not found.)
11391             fi
11392         elif ! test -f $LIBBASE_JAR; then
11393             AC_MSG_ERROR(libbase.jar not found.)
11394         fi
11396     else
11397         AC_MSG_RESULT([internal])
11398         SYSTEM_JFREEREPORT=
11399         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11400         NEED_ANT=TRUE
11401     fi
11402 else
11403     AC_MSG_RESULT([no])
11404     ENABLE_REPORTBUILDER=
11405     SYSTEM_JFREEREPORT=
11407 AC_SUBST(ENABLE_REPORTBUILDER)
11408 AC_SUBST(SYSTEM_JFREEREPORT)
11409 AC_SUBST(SAC_JAR)
11410 AC_SUBST(LIBXML_JAR)
11411 AC_SUBST(FLUTE_JAR)
11412 AC_SUBST(JFREEREPORT_JAR)
11413 AC_SUBST(LIBBASE_JAR)
11414 AC_SUBST(LIBLAYOUT_JAR)
11415 AC_SUBST(LIBLOADER_JAR)
11416 AC_SUBST(LIBFORMULA_JAR)
11417 AC_SUBST(LIBREPOSITORY_JAR)
11418 AC_SUBST(LIBFONTS_JAR)
11419 AC_SUBST(LIBSERIALIZER_JAR)
11421 # this has to be here because both the Wiki Publisher and the SRB use
11422 # commons-logging
11423 COMMONS_LOGGING_VERSION=1.2
11424 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11425     AC_MSG_CHECKING([which Apache commons-* libs to use])
11426     if test "$with_system_apache_commons" = "yes"; then
11427         SYSTEM_APACHE_COMMONS=TRUE
11428         AC_MSG_RESULT([external])
11429         if test -z $COMMONS_LOGGING_JAR; then
11430             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11431                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11432            elif test -f /usr/share/java/commons-logging.jar; then
11433                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11434             else
11435                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11436             fi
11437         elif ! test -f $COMMONS_LOGGING_JAR; then
11438             AC_MSG_ERROR(commons-logging.jar not found.)
11439         fi
11440     else
11441         AC_MSG_RESULT([internal])
11442         SYSTEM_APACHE_COMMONS=
11443         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11444         NEED_ANT=TRUE
11445     fi
11447 AC_SUBST(SYSTEM_APACHE_COMMONS)
11448 AC_SUBST(COMMONS_LOGGING_JAR)
11449 AC_SUBST(COMMONS_LOGGING_VERSION)
11451 # scripting provider for BeanShell?
11452 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11453 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11454     AC_MSG_RESULT([yes])
11455     ENABLE_SCRIPTING_BEANSHELL=TRUE
11457     dnl ===================================================================
11458     dnl Check for system beanshell
11459     dnl ===================================================================
11460     AC_MSG_CHECKING([which beanshell to use])
11461     if test "$with_system_beanshell" = "yes"; then
11462         AC_MSG_RESULT([external])
11463         SYSTEM_BSH=TRUE
11464         if test -z $BSH_JAR; then
11465             BSH_JAR=/usr/share/java/bsh.jar
11466         fi
11467         if ! test -f $BSH_JAR; then
11468             AC_MSG_ERROR(bsh.jar not found.)
11469         fi
11470     else
11471         AC_MSG_RESULT([internal])
11472         SYSTEM_BSH=
11473         BUILD_TYPE="$BUILD_TYPE BSH"
11474     fi
11475 else
11476     AC_MSG_RESULT([no])
11477     ENABLE_SCRIPTING_BEANSHELL=
11478     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11480 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11481 AC_SUBST(SYSTEM_BSH)
11482 AC_SUBST(BSH_JAR)
11484 # scripting provider for JavaScript?
11485 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11486 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11487     AC_MSG_RESULT([yes])
11488     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11490     dnl ===================================================================
11491     dnl Check for system rhino
11492     dnl ===================================================================
11493     AC_MSG_CHECKING([which rhino to use])
11494     if test "$with_system_rhino" = "yes"; then
11495         AC_MSG_RESULT([external])
11496         SYSTEM_RHINO=TRUE
11497         if test -z $RHINO_JAR; then
11498             RHINO_JAR=/usr/share/java/js.jar
11499         fi
11500         if ! test -f $RHINO_JAR; then
11501             AC_MSG_ERROR(js.jar not found.)
11502         fi
11503     else
11504         AC_MSG_RESULT([internal])
11505         SYSTEM_RHINO=
11506         BUILD_TYPE="$BUILD_TYPE RHINO"
11507         NEED_ANT=TRUE
11508     fi
11509 else
11510     AC_MSG_RESULT([no])
11511     ENABLE_SCRIPTING_JAVASCRIPT=
11512     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11514 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11515 AC_SUBST(SYSTEM_RHINO)
11516 AC_SUBST(RHINO_JAR)
11518 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11519 # paths should be added to library search path. So lets put all 64-bit
11520 # platforms there.
11521 supports_multilib=
11522 case "$host_cpu" in
11523 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11524     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11525         supports_multilib="yes"
11526     fi
11527     ;;
11529     ;;
11530 esac
11532 dnl ===================================================================
11533 dnl QT5 Integration
11534 dnl ===================================================================
11536 QT5_CFLAGS=""
11537 QT5_LIBS=""
11538 QMAKE5="qmake"
11539 MOC5="moc"
11540 QT5_GOBJECT_CFLAGS=""
11541 QT5_GOBJECT_LIBS=""
11542 QT5_HAVE_GOBJECT=""
11543 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11544         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11545         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11546 then
11547     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11548     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11550     if test -n "$supports_multilib"; then
11551         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11552     fi
11554     qt5_test_include="QtWidgets/qapplication.h"
11555     qt5_test_library="libQt5Widgets.so"
11557     dnl Check for qmake5
11558     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11559     if test "$QMAKE5" = "no"; then
11560         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11561     else
11562         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11563         if test -z "$qmake5_test_ver"; then
11564             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11565         fi
11566         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11567         qt5_minimal_minor="6"
11568         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11569             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11570         else
11571             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11572         fi
11573     fi
11575     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11576     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11578     AC_MSG_CHECKING([for Qt5 headers])
11579     qt5_incdir="no"
11580     for inc_dir in $qt5_incdirs; do
11581         if test -r "$inc_dir/$qt5_test_include"; then
11582             qt5_incdir="$inc_dir"
11583             break
11584         fi
11585     done
11586     AC_MSG_RESULT([$qt5_incdir])
11587     if test "x$qt5_incdir" = "xno"; then
11588         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11589     fi
11591     AC_MSG_CHECKING([for Qt5 libraries])
11592     qt5_libdir="no"
11593     for lib_dir in $qt5_libdirs; do
11594         if test -r "$lib_dir/$qt5_test_library"; then
11595             qt5_libdir="$lib_dir"
11596             break
11597         fi
11598     done
11599     AC_MSG_RESULT([$qt5_libdir])
11600     if test "x$qt5_libdir" = "xno"; then
11601         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11602     fi
11604     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11605     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11606     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11608     if test "$USING_X11" = TRUE; then
11609         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11610         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11611             QT5_HAVE_XCB_ICCCM=1
11612             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11613         ],[
11614             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)])
11615             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11616         ])
11617         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11618         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11619         QT5_USING_X11=1
11620         AC_DEFINE(QT5_USING_X11)
11621     fi
11623     dnl Check for Meta Object Compiler
11625     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11626     if test "$MOC5" = "no"; then
11627         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11628 the root of your Qt installation by exporting QT5DIR before running "configure".])
11629     fi
11631     if test "$build_gstreamer_1_0" = "yes"; then
11632         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11633                 QT5_HAVE_GOBJECT=1
11634                 AC_DEFINE(QT5_HAVE_GOBJECT)
11635             ],
11636             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11637         )
11638     fi
11640 AC_SUBST(QT5_CFLAGS)
11641 AC_SUBST(QT5_LIBS)
11642 AC_SUBST(MOC5)
11643 AC_SUBST(QT5_GOBJECT_CFLAGS)
11644 AC_SUBST(QT5_GOBJECT_LIBS)
11645 AC_SUBST(QT5_HAVE_GOBJECT)
11647 dnl ===================================================================
11648 dnl KF5 Integration
11649 dnl ===================================================================
11651 KF5_CFLAGS=""
11652 KF5_LIBS=""
11653 KF5_CONFIG="kf5-config"
11654 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11655         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11656 then
11657     if test "$OS" = "HAIKU"; then
11658         haiku_arch="`echo $RTL_ARCH | tr X x`"
11659         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11660         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11661     fi
11663     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11664     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11665     if test -n "$supports_multilib"; then
11666         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11667     fi
11669     kf5_test_include="KF5/kcoreaddons_version.h"
11670     kf5_test_library="libKF5CoreAddons.so"
11671     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11673     dnl kf5 KDE4 support compatibility installed
11674     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11675     if test "$KF5_CONFIG" != "no"; then
11676         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11677         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11678     fi
11680     dnl Check for KF5 headers
11681     AC_MSG_CHECKING([for KF5 headers])
11682     kf5_incdir="no"
11683     for kf5_check in $kf5_incdirs; do
11684         if test -r "$kf5_check/$kf5_test_include"; then
11685             kf5_incdir="$kf5_check/KF5"
11686             break
11687         fi
11688     done
11689     AC_MSG_RESULT([$kf5_incdir])
11690     if test "x$kf5_incdir" = "xno"; then
11691         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11692     fi
11694     dnl Check for KF5 libraries
11695     AC_MSG_CHECKING([for KF5 libraries])
11696     kf5_libdir="no"
11697     for kf5_check in $kf5_libdirs; do
11698         if test -r "$kf5_check/$kf5_test_library"; then
11699             kf5_libdir="$kf5_check"
11700             break
11701         fi
11702     done
11704     AC_MSG_RESULT([$kf5_libdir])
11705     if test "x$kf5_libdir" = "xno"; then
11706         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11707     fi
11709     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"
11710     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11711     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11713     if test "$USING_X11" = TRUE; then
11714         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11715     fi
11717     AC_LANG_PUSH([C++])
11718     save_CXXFLAGS=$CXXFLAGS
11719     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11720     AC_MSG_CHECKING([whether KDE is >= 5.0])
11721        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11722 #include <kcoreaddons_version.h>
11724 int main(int argc, char **argv) {
11725        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11726        else return 1;
11728        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11729     CXXFLAGS=$save_CXXFLAGS
11730     AC_LANG_POP([C++])
11732 AC_SUBST(KF5_CFLAGS)
11733 AC_SUBST(KF5_LIBS)
11735 dnl ===================================================================
11736 dnl Test whether to include Evolution 2 support
11737 dnl ===================================================================
11738 AC_MSG_CHECKING([whether to enable evolution 2 support])
11739 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11740     AC_MSG_RESULT([yes])
11741     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11742     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11743     FilterLibs "${GOBJECT_LIBS}"
11744     GOBJECT_LIBS="${filteredlibs}"
11745     ENABLE_EVOAB2="TRUE"
11746 else
11747     ENABLE_EVOAB2=""
11748     AC_MSG_RESULT([no])
11750 AC_SUBST(ENABLE_EVOAB2)
11751 AC_SUBST(GOBJECT_CFLAGS)
11752 AC_SUBST(GOBJECT_LIBS)
11754 dnl ===================================================================
11755 dnl Test which themes to include
11756 dnl ===================================================================
11757 AC_MSG_CHECKING([which themes to include])
11758 # if none given use default subset of available themes
11759 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11760     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg sukapura sukapura_svg tango"
11763 WITH_THEMES=""
11764 if test "x$with_theme" != "xno"; then
11765     for theme in $with_theme; do
11766         case $theme in
11767         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|sukapura|sukapura_svg|tango) real_theme="$theme" ;;
11768         default) real_theme=colibre ;;
11769         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11770         esac
11771         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11772     done
11774 AC_MSG_RESULT([$WITH_THEMES])
11775 AC_SUBST([WITH_THEMES])
11776 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11777 for theme in $with_theme; do
11778     case $theme in
11779     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11780     *) ;;
11781     esac
11782 done
11784 dnl ===================================================================
11785 dnl Test whether to integrate helppacks into the product's installer
11786 dnl ===================================================================
11787 AC_MSG_CHECKING([for helppack integration])
11788 if test "$with_helppack_integration" = "no"; then
11789     AC_MSG_RESULT([no integration])
11790 else
11791     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11792     AC_MSG_RESULT([integration])
11795 ###############################################################################
11796 # Extensions checking
11797 ###############################################################################
11798 AC_MSG_CHECKING([for extensions integration])
11799 if test "x$enable_extension_integration" != "xno"; then
11800     WITH_EXTENSION_INTEGRATION=TRUE
11801     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11802     AC_MSG_RESULT([yes, use integration])
11803 else
11804     WITH_EXTENSION_INTEGRATION=
11805     AC_MSG_RESULT([no, do not integrate])
11807 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11809 dnl Should any extra extensions be included?
11810 dnl There are standalone tests for each of these below.
11811 WITH_EXTRA_EXTENSIONS=
11812 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11814 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11815 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11816 if test "x$with_java" != "xno"; then
11817     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11818     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11821 AC_MSG_CHECKING([whether to build opens___.ttf])
11822 if test "$enable_build_opensymbol" = "yes"; then
11823     AC_MSG_RESULT([yes])
11824     AC_PATH_PROG(FONTFORGE, fontforge)
11825     if test -z "$FONTFORGE"; then
11826         AC_MSG_ERROR([fontforge not installed])
11827     fi
11828 else
11829     AC_MSG_RESULT([no])
11830     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11831     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11833 AC_SUBST(OPENSYMBOL_TTF)
11834 AC_SUBST(FONTFORGE)
11836 dnl ===================================================================
11837 dnl Test whether to include fonts
11838 dnl ===================================================================
11839 AC_MSG_CHECKING([whether to include third-party fonts])
11840 if test "$with_fonts" != "no"; then
11841     AC_MSG_RESULT([yes])
11842     WITH_FONTS=TRUE
11843     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11844     AC_DEFINE(HAVE_MORE_FONTS)
11845 else
11846     AC_MSG_RESULT([no])
11847     WITH_FONTS=
11848     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11850 AC_SUBST(WITH_FONTS)
11853 dnl ===================================================================
11854 dnl Test whether to enable online update service
11855 dnl ===================================================================
11856 AC_MSG_CHECKING([whether to enable online update])
11857 ENABLE_ONLINE_UPDATE=
11858 ENABLE_ONLINE_UPDATE_MAR=
11859 UPDATE_CONFIG=
11860 if test "$enable_online_update" = ""; then
11861     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11862         AC_MSG_RESULT([yes])
11863         ENABLE_ONLINE_UPDATE="TRUE"
11864     else
11865         AC_MSG_RESULT([no])
11866     fi
11867 else
11868     if test "$enable_online_update" = "mar"; then
11869         AC_MSG_RESULT([yes - MAR-based online update])
11870         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11871         if test "$with_update_config" = ""; then
11872             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11873         fi
11874         UPDATE_CONFIG="$with_update_config"
11875         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11876     elif test "$enable_online_update" = "yes"; then
11877         AC_MSG_RESULT([yes])
11878         ENABLE_ONLINE_UPDATE="TRUE"
11879     else
11880         AC_MSG_RESULT([no])
11881     fi
11883 AC_SUBST(ENABLE_ONLINE_UPDATE)
11884 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11885 AC_SUBST(UPDATE_CONFIG)
11887 dnl ===================================================================
11888 dnl Test whether we need bzip2
11889 dnl ===================================================================
11890 SYSTEM_BZIP2=
11891 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11892     AC_MSG_CHECKING([whether to use system bzip2])
11893     if test "$with_system_bzip2" = yes; then
11894         SYSTEM_BZIP2=TRUE
11895         AC_MSG_RESULT([yes])
11896         PKG_CHECK_MODULES(BZIP2, bzip2)
11897         FilterLibs "${BZIP2_LIBS}"
11898         BZIP2_LIBS="${filteredlibs}"
11899     else
11900         AC_MSG_RESULT([no])
11901         BUILD_TYPE="$BUILD_TYPE BZIP2"
11902     fi
11904 AC_SUBST(SYSTEM_BZIP2)
11905 AC_SUBST(BZIP2_CFLAGS)
11906 AC_SUBST(BZIP2_LIBS)
11908 dnl ===================================================================
11909 dnl Test whether to enable extension update
11910 dnl ===================================================================
11911 AC_MSG_CHECKING([whether to enable extension update])
11912 ENABLE_EXTENSION_UPDATE=
11913 if test "x$enable_extension_update" = "xno"; then
11914     AC_MSG_RESULT([no])
11915 else
11916     AC_MSG_RESULT([yes])
11917     ENABLE_EXTENSION_UPDATE="TRUE"
11918     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11919     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11921 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11924 dnl ===================================================================
11925 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11926 dnl ===================================================================
11927 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11928 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11929     AC_MSG_RESULT([no])
11930     ENABLE_SILENT_MSI=
11931 else
11932     AC_MSG_RESULT([yes])
11933     ENABLE_SILENT_MSI=TRUE
11934     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11936 AC_SUBST(ENABLE_SILENT_MSI)
11938 AC_MSG_CHECKING([whether and how to use Xinerama])
11939 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11940     if test "$x_libraries" = "default_x_libraries"; then
11941         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11942         if test "x$XINERAMALIB" = x; then
11943            XINERAMALIB="/usr/lib"
11944         fi
11945     else
11946         XINERAMALIB="$x_libraries"
11947     fi
11948     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11949         # we have both versions, let the user decide but use the dynamic one
11950         # per default
11951         USE_XINERAMA=TRUE
11952         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11953             XINERAMA_LINK=dynamic
11954         else
11955             XINERAMA_LINK=static
11956         fi
11957     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11958         # we have only the dynamic version
11959         USE_XINERAMA=TRUE
11960         XINERAMA_LINK=dynamic
11961     elif test -e "$XINERAMALIB/libXinerama.a"; then
11962         # static version
11963         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11964             USE_XINERAMA=TRUE
11965             XINERAMA_LINK=static
11966         else
11967             USE_XINERAMA=
11968             XINERAMA_LINK=none
11969         fi
11970     else
11971         # no Xinerama
11972         USE_XINERAMA=
11973         XINERAMA_LINK=none
11974     fi
11975     if test "$USE_XINERAMA" = "TRUE"; then
11976         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11977         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11978             [AC_MSG_ERROR(Xinerama header not found.)], [])
11979         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11980         if test "x$XEXTLIB" = x; then
11981            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11982         fi
11983         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11984         if test "$_os" = "FreeBSD"; then
11985             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11986         fi
11987         if test "$_os" = "Linux"; then
11988             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11989         fi
11990         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11991             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11992     else
11993         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11994     fi
11995 else
11996     USE_XINERAMA=
11997     XINERAMA_LINK=none
11998     AC_MSG_RESULT([no])
12000 AC_SUBST(USE_XINERAMA)
12001 AC_SUBST(XINERAMA_LINK)
12003 dnl ===================================================================
12004 dnl Test whether to build cairo or rely on the system version
12005 dnl ===================================================================
12007 if test "$USING_X11" = TRUE; then
12008     # Used in vcl/Library_vclplug_gen.mk
12009     test_cairo=yes
12012 if test "$test_cairo" = "yes"; then
12013     AC_MSG_CHECKING([whether to use the system cairo])
12015     : ${with_system_cairo:=$with_system_libs}
12016     if test "$with_system_cairo" = "yes"; then
12017         SYSTEM_CAIRO=TRUE
12018         AC_MSG_RESULT([yes])
12020         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
12021         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12022         FilterLibs "${CAIRO_LIBS}"
12023         CAIRO_LIBS="${filteredlibs}"
12025         if test "$test_xrender" = "yes"; then
12026             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
12027             AC_LANG_PUSH([C])
12028             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
12029 #ifdef PictStandardA8
12030 #else
12031       return fail;
12032 #endif
12033 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
12035             AC_LANG_POP([C])
12036         fi
12037     else
12038         SYSTEM_CAIRO=
12039         AC_MSG_RESULT([no])
12041         BUILD_TYPE="$BUILD_TYPE CAIRO"
12042     fi
12045 AC_SUBST(SYSTEM_CAIRO)
12046 AC_SUBST(CAIRO_CFLAGS)
12047 AC_SUBST(CAIRO_LIBS)
12049 dnl ===================================================================
12050 dnl Test whether to use avahi
12051 dnl ===================================================================
12052 if test "$_os" = "WINNT"; then
12053     # Windows uses bundled mDNSResponder
12054     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
12055 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12056     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12057                       [ENABLE_AVAHI="TRUE"])
12058     AC_DEFINE(HAVE_FEATURE_AVAHI)
12059     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12060     FilterLibs "${AVAHI_LIBS}"
12061     AVAHI_LIBS="${filteredlibs}"
12064 AC_SUBST(ENABLE_AVAHI)
12065 AC_SUBST(AVAHI_CFLAGS)
12066 AC_SUBST(AVAHI_LIBS)
12068 dnl ===================================================================
12069 dnl Test whether to use liblangtag
12070 dnl ===================================================================
12071 SYSTEM_LIBLANGTAG=
12072 AC_MSG_CHECKING([whether to use system liblangtag])
12073 if test "$with_system_liblangtag" = yes; then
12074     SYSTEM_LIBLANGTAG=TRUE
12075     AC_MSG_RESULT([yes])
12076     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12077     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12078     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12079     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12080     FilterLibs "${LIBLANGTAG_LIBS}"
12081     LIBLANGTAG_LIBS="${filteredlibs}"
12082 else
12083     SYSTEM_LIBLANGTAG=
12084     AC_MSG_RESULT([no])
12085     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12086     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12087     if test "$COM" = "MSC"; then
12088         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12089     else
12090         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12091     fi
12093 AC_SUBST(SYSTEM_LIBLANGTAG)
12094 AC_SUBST(LIBLANGTAG_CFLAGS)
12095 AC_SUBST(LIBLANGTAG_LIBS)
12097 dnl ===================================================================
12098 dnl Test whether to build libpng or rely on the system version
12099 dnl ===================================================================
12101 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12103 dnl ===================================================================
12104 dnl Check for runtime JVM search path
12105 dnl ===================================================================
12106 if test "$ENABLE_JAVA" != ""; then
12107     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12108     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12109         AC_MSG_RESULT([yes])
12110         if ! test -d "$with_jvm_path"; then
12111             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12112         fi
12113         if ! test -d "$with_jvm_path"jvm; then
12114             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12115         fi
12116         JVM_ONE_PATH_CHECK="$with_jvm_path"
12117         AC_SUBST(JVM_ONE_PATH_CHECK)
12118     else
12119         AC_MSG_RESULT([no])
12120     fi
12123 dnl ===================================================================
12124 dnl Test for the presence of Ant and that it works
12125 dnl ===================================================================
12127 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12128     ANT_HOME=; export ANT_HOME
12129     WITH_ANT_HOME=; export WITH_ANT_HOME
12130     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12131         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12132             if test "$_os" = "WINNT"; then
12133                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12134             else
12135                 with_ant_home="$LODE_HOME/opt/ant"
12136             fi
12137         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12138             with_ant_home="$LODE_HOME/opt/ant"
12139         fi
12140     fi
12141     if test -z "$with_ant_home"; then
12142         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12143     else
12144         if test "$_os" = "WINNT"; then
12145             # AC_PATH_PROGS needs unix path
12146             with_ant_home=`cygpath -u "$with_ant_home"`
12147         fi
12148         AbsolutePath "$with_ant_home"
12149         with_ant_home=$absolute_path
12150         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12151         WITH_ANT_HOME=$with_ant_home
12152         ANT_HOME=$with_ant_home
12153     fi
12155     if test -z "$ANT"; then
12156         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12157     else
12158         # resolve relative or absolute symlink
12159         while test -h "$ANT"; do
12160             a_cwd=`pwd`
12161             a_basename=`basename "$ANT"`
12162             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12163             cd "`dirname "$ANT"`"
12164             cd "`dirname "$a_script"`"
12165             ANT="`pwd`"/"`basename "$a_script"`"
12166             cd "$a_cwd"
12167         done
12169         AC_MSG_CHECKING([if $ANT works])
12170         mkdir -p conftest.dir
12171         a_cwd=$(pwd)
12172         cd conftest.dir
12173         cat > conftest.java << EOF
12174         public class conftest {
12175             int testmethod(int a, int b) {
12176                     return a + b;
12177             }
12178         }
12181         cat > conftest.xml << EOF
12182         <project name="conftest" default="conftest">
12183         <target name="conftest">
12184             <javac srcdir="." includes="conftest.java">
12185             </javac>
12186         </target>
12187         </project>
12190         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12191         if test $? = 0 -a -f ./conftest.class; then
12192             AC_MSG_RESULT([Ant works])
12193             if test -z "$WITH_ANT_HOME"; then
12194                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12195                 if test -z "$ANT_HOME"; then
12196                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12197                 fi
12198             else
12199                 ANT_HOME="$WITH_ANT_HOME"
12200             fi
12201         else
12202             echo "configure: Ant test failed" >&5
12203             cat conftest.java >&5
12204             cat conftest.xml >&5
12205             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12206         fi
12207         cd "$a_cwd"
12208         rm -fr conftest.dir
12209     fi
12210     if test -z "$ANT_HOME"; then
12211         ANT_HOME="NO_ANT_HOME"
12212     else
12213         PathFormat "$ANT_HOME"
12214         ANT_HOME="$formatted_path"
12215         PathFormat "$ANT"
12216         ANT="$formatted_path"
12217     fi
12218     AC_SUBST(ANT_HOME)
12219     AC_SUBST(ANT)
12221     dnl Checking for ant.jar
12222     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12223         AC_MSG_CHECKING([Ant lib directory])
12224         if test -f $ANT_HOME/lib/ant.jar; then
12225             ANT_LIB="$ANT_HOME/lib"
12226         else
12227             if test -f $ANT_HOME/ant.jar; then
12228                 ANT_LIB="$ANT_HOME"
12229             else
12230                 if test -f /usr/share/java/ant.jar; then
12231                     ANT_LIB=/usr/share/java
12232                 else
12233                     if test -f /usr/share/ant-core/lib/ant.jar; then
12234                         ANT_LIB=/usr/share/ant-core/lib
12235                     else
12236                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12237                             ANT_LIB="$ANT_HOME/lib/ant"
12238                         else
12239                             if test -f /usr/share/lib/ant/ant.jar; then
12240                                 ANT_LIB=/usr/share/lib/ant
12241                             else
12242                                 AC_MSG_ERROR([Ant libraries not found!])
12243                             fi
12244                         fi
12245                     fi
12246                 fi
12247             fi
12248         fi
12249         PathFormat "$ANT_LIB"
12250         ANT_LIB="$formatted_path"
12251         AC_MSG_RESULT([Ant lib directory found.])
12252     fi
12253     AC_SUBST(ANT_LIB)
12255     ant_minver=1.6.0
12256     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12258     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12259     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12260     ant_version_major=`echo $ant_version | cut -d. -f1`
12261     ant_version_minor=`echo $ant_version | cut -d. -f2`
12262     echo "configure: ant_version $ant_version " >&5
12263     echo "configure: ant_version_major $ant_version_major " >&5
12264     echo "configure: ant_version_minor $ant_version_minor " >&5
12265     if test "$ant_version_major" -ge "2"; then
12266         AC_MSG_RESULT([yes, $ant_version])
12267     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12268         AC_MSG_RESULT([yes, $ant_version])
12269     else
12270         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12271     fi
12273     rm -f conftest* core core.* *.core
12276 OOO_JUNIT_JAR=
12277 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12278     AC_MSG_CHECKING([for JUnit 4])
12279     if test "$with_junit" = "yes"; then
12280         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12281             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12282         elif test -e /usr/share/java/junit4.jar; then
12283             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12284         else
12285            if test -e /usr/share/lib/java/junit.jar; then
12286               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12287            else
12288               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12289            fi
12290         fi
12291     else
12292         OOO_JUNIT_JAR=$with_junit
12293     fi
12294     if test "$_os" = "WINNT"; then
12295         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12296     fi
12297     printf 'import org.junit.Before;' > conftest.java
12298     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12299         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12300     else
12301         AC_MSG_ERROR(
12302 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12303  specify its pathname via --with-junit=..., or disable it via --without-junit])
12304     fi
12305     rm -f conftest.class conftest.java
12306     if test $OOO_JUNIT_JAR != ""; then
12307     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12308     fi
12310 AC_SUBST(OOO_JUNIT_JAR)
12312 HAMCREST_JAR=
12313 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12314     AC_MSG_CHECKING([for included Hamcrest])
12315     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12316     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12317         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12318     else
12319         AC_MSG_RESULT([Not included])
12320         AC_MSG_CHECKING([for standalone hamcrest jar.])
12321         if test "$with_hamcrest" = "yes"; then
12322             if test -e /usr/share/lib/java/hamcrest.jar; then
12323                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12324             elif test -e /usr/share/java/hamcrest/core.jar; then
12325                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12326             else
12327                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12328             fi
12329         else
12330             HAMCREST_JAR=$with_hamcrest
12331         fi
12332         if test "$_os" = "WINNT"; then
12333             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12334         fi
12335         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12336             AC_MSG_RESULT([$HAMCREST_JAR])
12337         else
12338             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),
12339                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12340         fi
12341     fi
12342     rm -f conftest.class conftest.java
12344 AC_SUBST(HAMCREST_JAR)
12347 AC_SUBST(SCPDEFS)
12350 # check for wget and curl
12352 WGET=
12353 CURL=
12355 if test "$enable_fetch_external" != "no"; then
12357 CURL=`which curl 2>/dev/null`
12359 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12360     # wget new enough?
12361     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12362     if test $? -eq 0; then
12363         WGET=$i
12364         break
12365     fi
12366 done
12368 if test -z "$WGET" -a -z "$CURL"; then
12369     AC_MSG_ERROR([neither wget nor curl found!])
12374 AC_SUBST(WGET)
12375 AC_SUBST(CURL)
12378 # check for sha256sum
12380 SHA256SUM=
12382 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12383     eval "$i -a 256 --version" > /dev/null 2>&1
12384     ret=$?
12385     if test $ret -eq 0; then
12386         SHA256SUM="$i -a 256"
12387         break
12388     fi
12389 done
12391 if test -z "$SHA256SUM"; then
12392     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12393         eval "$i --version" > /dev/null 2>&1
12394         ret=$?
12395         if test $ret -eq 0; then
12396             SHA256SUM=$i
12397             break
12398         fi
12399     done
12402 if test -z "$SHA256SUM"; then
12403     AC_MSG_ERROR([no sha256sum found!])
12406 AC_SUBST(SHA256SUM)
12408 dnl ===================================================================
12409 dnl Dealing with l10n options
12410 dnl ===================================================================
12411 AC_MSG_CHECKING([which languages to be built])
12412 # get list of all languages
12413 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12414 # the sed command does the following:
12415 #   + if a line ends with a backslash, append the next line to it
12416 #   + adds " on the beginning of the value (after =)
12417 #   + adds " at the end of the value
12418 #   + removes en-US; we want to put it on the beginning
12419 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12420 [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)]
12421 ALL_LANGS="en-US $completelangiso"
12422 # check the configured localizations
12423 WITH_LANG="$with_lang"
12425 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12426 # (Norwegian is "nb" and "nn".)
12427 if test "$WITH_LANG" = "no"; then
12428     WITH_LANG=
12431 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12432     AC_MSG_RESULT([en-US])
12433 else
12434     AC_MSG_RESULT([$WITH_LANG])
12435     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12436     if test -z "$MSGFMT"; then
12437         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12438             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12439         elif test -x "/opt/lo/bin/msgfmt"; then
12440             MSGFMT="/opt/lo/bin/msgfmt"
12441         else
12442             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12443             if test -z "$MSGFMT"; then
12444                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12445             fi
12446         fi
12447     fi
12448     if test -z "$MSGUNIQ"; then
12449         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12450             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12451         elif test -x "/opt/lo/bin/msguniq"; then
12452             MSGUNIQ="/opt/lo/bin/msguniq"
12453         else
12454             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12455             if test -z "$MSGUNIQ"; then
12456                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12457             fi
12458         fi
12459     fi
12461 AC_SUBST(MSGFMT)
12462 AC_SUBST(MSGUNIQ)
12463 # check that the list is valid
12464 for lang in $WITH_LANG; do
12465     test "$lang" = "ALL" && continue
12466     # need to check for the exact string, so add space before and after the list of all languages
12467     for vl in $ALL_LANGS; do
12468         if test "$vl" = "$lang"; then
12469            break
12470         fi
12471     done
12472     if test "$vl" != "$lang"; then
12473         # if you're reading this - you prolly quoted your languages remove the quotes ...
12474         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12475     fi
12476 done
12477 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12478     echo $WITH_LANG | grep -q en-US
12479     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12481 # list with substituted ALL
12482 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12483 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12484 test "$WITH_LANG" = "en-US" && WITH_LANG=
12485 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12486     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12487     ALL_LANGS=`echo $ALL_LANGS qtz`
12489 AC_SUBST(ALL_LANGS)
12490 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12491 AC_SUBST(WITH_LANG)
12492 AC_SUBST(WITH_LANG_LIST)
12493 AC_SUBST(GIT_NEEDED_SUBMODULES)
12495 WITH_POOR_HELP_LOCALIZATIONS=
12496 if test -d "$SRC_ROOT/translations/source"; then
12497     for l in `ls -1 $SRC_ROOT/translations/source`; do
12498         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12499             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12500         fi
12501     done
12503 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12505 if test -n "$with_locales"; then
12506     WITH_LOCALES="$with_locales"
12508     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12509     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12510     # config_host/config_locales.h.in
12511     for locale in $WITH_LOCALES; do
12512         lang=${locale%_*}
12514         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12516         case $lang in
12517         hi|mr*ne)
12518             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12519             ;;
12520         bg|ru)
12521             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12522             ;;
12523         esac
12524     done
12525 else
12526     AC_DEFINE(WITH_LOCALE_ALL)
12528 AC_SUBST(WITH_LOCALES)
12530 dnl git submodule update --reference
12531 dnl ===================================================================
12532 if test -n "${GIT_REFERENCE_SRC}"; then
12533     for repo in ${GIT_NEEDED_SUBMODULES}; do
12534         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12535             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12536         fi
12537     done
12539 AC_SUBST(GIT_REFERENCE_SRC)
12541 dnl git submodules linked dirs
12542 dnl ===================================================================
12543 if test -n "${GIT_LINK_SRC}"; then
12544     for repo in ${GIT_NEEDED_SUBMODULES}; do
12545         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12546             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12547         fi
12548     done
12550 AC_SUBST(GIT_LINK_SRC)
12552 dnl branding
12553 dnl ===================================================================
12554 AC_MSG_CHECKING([for alternative branding images directory])
12555 # initialize mapped arrays
12556 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12557 brand_files="$BRAND_INTRO_IMAGES about.svg"
12559 if test -z "$with_branding" -o "$with_branding" = "no"; then
12560     AC_MSG_RESULT([none])
12561     DEFAULT_BRAND_IMAGES="$brand_files"
12562 else
12563     if ! test -d $with_branding ; then
12564         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12565     else
12566         AC_MSG_RESULT([$with_branding])
12567         CUSTOM_BRAND_DIR="$with_branding"
12568         for lfile in $brand_files
12569         do
12570             if ! test -f $with_branding/$lfile ; then
12571                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12572                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12573             else
12574                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12575             fi
12576         done
12577         check_for_progress="yes"
12578     fi
12580 AC_SUBST([BRAND_INTRO_IMAGES])
12581 AC_SUBST([CUSTOM_BRAND_DIR])
12582 AC_SUBST([CUSTOM_BRAND_IMAGES])
12583 AC_SUBST([DEFAULT_BRAND_IMAGES])
12586 AC_MSG_CHECKING([for 'intro' progress settings])
12587 PROGRESSBARCOLOR=
12588 PROGRESSSIZE=
12589 PROGRESSPOSITION=
12590 PROGRESSFRAMECOLOR=
12591 PROGRESSTEXTCOLOR=
12592 PROGRESSTEXTBASELINE=
12594 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12595     source "$with_branding/progress.conf"
12596     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12597 else
12598     AC_MSG_RESULT([none])
12601 AC_SUBST(PROGRESSBARCOLOR)
12602 AC_SUBST(PROGRESSSIZE)
12603 AC_SUBST(PROGRESSPOSITION)
12604 AC_SUBST(PROGRESSFRAMECOLOR)
12605 AC_SUBST(PROGRESSTEXTCOLOR)
12606 AC_SUBST(PROGRESSTEXTBASELINE)
12609 AC_MSG_CHECKING([for extra build ID])
12610 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12611     EXTRA_BUILDID="$with_extra_buildid"
12613 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12614 if test -n "$EXTRA_BUILDID" ; then
12615     AC_MSG_RESULT([$EXTRA_BUILDID])
12616 else
12617     AC_MSG_RESULT([not set])
12619 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12621 OOO_VENDOR=
12622 AC_MSG_CHECKING([for vendor])
12623 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12624     OOO_VENDOR="$USERNAME"
12626     if test -z "$OOO_VENDOR"; then
12627         OOO_VENDOR="$USER"
12628     fi
12630     if test -z "$OOO_VENDOR"; then
12631         OOO_VENDOR="`id -u -n`"
12632     fi
12634     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12635 else
12636     OOO_VENDOR="$with_vendor"
12637     AC_MSG_RESULT([$OOO_VENDOR])
12639 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12640 AC_SUBST(OOO_VENDOR)
12642 if test "$_os" = "Android" ; then
12643     ANDROID_PACKAGE_NAME=
12644     AC_MSG_CHECKING([for Android package name])
12645     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12646         if test -n "$ENABLE_DEBUG"; then
12647             # Default to the package name that makes ndk-gdb happy.
12648             ANDROID_PACKAGE_NAME="org.libreoffice"
12649         else
12650             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12651         fi
12653         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12654     else
12655         ANDROID_PACKAGE_NAME="$with_android_package_name"
12656         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12657     fi
12658     AC_SUBST(ANDROID_PACKAGE_NAME)
12661 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12662 if test "$with_compat_oowrappers" = "yes"; then
12663     WITH_COMPAT_OOWRAPPERS=TRUE
12664     AC_MSG_RESULT(yes)
12665 else
12666     WITH_COMPAT_OOWRAPPERS=
12667     AC_MSG_RESULT(no)
12669 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12671 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12672 AC_MSG_CHECKING([for install dirname])
12673 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12674     INSTALLDIRNAME="$with_install_dirname"
12676 AC_MSG_RESULT([$INSTALLDIRNAME])
12677 AC_SUBST(INSTALLDIRNAME)
12679 AC_MSG_CHECKING([for prefix])
12680 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12681 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12682 PREFIXDIR="$prefix"
12683 AC_MSG_RESULT([$PREFIXDIR])
12684 AC_SUBST(PREFIXDIR)
12686 LIBDIR=[$(eval echo $(eval echo $libdir))]
12687 AC_SUBST(LIBDIR)
12689 DATADIR=[$(eval echo $(eval echo $datadir))]
12690 AC_SUBST(DATADIR)
12692 MANDIR=[$(eval echo $(eval echo $mandir))]
12693 AC_SUBST(MANDIR)
12695 DOCDIR=[$(eval echo $(eval echo $docdir))]
12696 AC_SUBST(DOCDIR)
12698 BINDIR=[$(eval echo $(eval echo $bindir))]
12699 AC_SUBST(BINDIR)
12701 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12702 AC_SUBST(INSTALLDIR)
12704 TESTINSTALLDIR="${BUILDDIR}/test-install"
12705 AC_SUBST(TESTINSTALLDIR)
12708 # ===================================================================
12709 # OAuth2 id and secrets
12710 # ===================================================================
12712 AC_MSG_CHECKING([for Google Drive client id and secret])
12713 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12714     AC_MSG_RESULT([not set])
12715     GDRIVE_CLIENT_ID="\"\""
12716     GDRIVE_CLIENT_SECRET="\"\""
12717 else
12718     AC_MSG_RESULT([set])
12719     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12720     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12722 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12723 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12725 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12726 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12727     AC_MSG_RESULT([not set])
12728     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12729     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12730 else
12731     AC_MSG_RESULT([set])
12732     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12733     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12735 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12736 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12738 AC_MSG_CHECKING([for OneDrive client id and secret])
12739 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12740     AC_MSG_RESULT([not set])
12741     ONEDRIVE_CLIENT_ID="\"\""
12742     ONEDRIVE_CLIENT_SECRET="\"\""
12743 else
12744     AC_MSG_RESULT([set])
12745     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12746     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12748 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12749 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12752 dnl ===================================================================
12753 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12754 dnl --enable-dependency-tracking configure option
12755 dnl ===================================================================
12756 AC_MSG_CHECKING([whether to enable dependency tracking])
12757 if test "$enable_dependency_tracking" = "no"; then
12758     nodep=TRUE
12759     AC_MSG_RESULT([no])
12760 else
12761     AC_MSG_RESULT([yes])
12763 AC_SUBST(nodep)
12765 dnl ===================================================================
12766 dnl Number of CPUs to use during the build
12767 dnl ===================================================================
12768 AC_MSG_CHECKING([for number of processors to use])
12769 # plain --with-parallelism is just the default
12770 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12771     if test "$with_parallelism" = "no"; then
12772         PARALLELISM=0
12773     else
12774         PARALLELISM=$with_parallelism
12775     fi
12776 else
12777     if test "$enable_icecream" = "yes"; then
12778         PARALLELISM="40"
12779     else
12780         case `uname -s` in
12782         Darwin|FreeBSD|NetBSD|OpenBSD)
12783             PARALLELISM=`sysctl -n hw.ncpu`
12784             ;;
12786         Linux)
12787             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12788         ;;
12789         # what else than above does profit here *and* has /proc?
12790         *)
12791             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12792             ;;
12793         esac
12795         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12796         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12797     fi
12800 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12801     if test -z "$with_parallelism"; then
12802             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12803             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12804             PARALLELISM="1"
12805     else
12806         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."
12807     fi
12810 if test $PARALLELISM -eq 0; then
12811     AC_MSG_RESULT([explicit make -j option needed])
12812 else
12813     AC_MSG_RESULT([$PARALLELISM])
12815 AC_SUBST(PARALLELISM)
12817 IWYU_PATH="$with_iwyu"
12818 AC_SUBST(IWYU_PATH)
12819 if test ! -z "$IWYU_PATH"; then
12820     if test ! -f "$IWYU_PATH"; then
12821         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12822     fi
12826 # Set up ILIB for MSVC build
12828 ILIB1=
12829 if test "$build_os" = "cygwin"; then
12830     ILIB="."
12831     if test -n "$JAVA_HOME"; then
12832         ILIB="$ILIB;$JAVA_HOME/lib"
12833     fi
12834     ILIB1=-link
12835     if test "$BITNESS_OVERRIDE" = 64; then
12836         ILIB="$ILIB;$COMPATH/lib/x64"
12837         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12838         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12839         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12840         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12841             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12842             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12843         fi
12844         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12845         ucrtlibpath_formatted=$formatted_path
12846         ILIB="$ILIB;$ucrtlibpath_formatted"
12847         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12848     else
12849         ILIB="$ILIB;$COMPATH/lib/x86"
12850         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12851         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12852         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12853         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12854             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12855             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12856         fi
12857         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12858         ucrtlibpath_formatted=$formatted_path
12859         ILIB="$ILIB;$ucrtlibpath_formatted"
12860         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12861     fi
12862     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12863         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12864     else
12865         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12866     fi
12868     AC_SUBST(ILIB)
12871 # ===================================================================
12872 # Creating bigger shared library to link against
12873 # ===================================================================
12874 AC_MSG_CHECKING([whether to create huge library])
12875 MERGELIBS=
12877 if test $_os = iOS -o $_os = Android; then
12878     # Never any point in mergelibs for these as we build just static
12879     # libraries anyway...
12880     enable_mergelibs=no
12883 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12884     if test $_os != Linux -a $_os != WINNT; then
12885         add_warning "--enable-mergelibs is not tested for this platform"
12886     fi
12887     MERGELIBS="TRUE"
12888     AC_MSG_RESULT([yes])
12889     AC_DEFINE(ENABLE_MERGELIBS)
12890 else
12891     AC_MSG_RESULT([no])
12893 AC_SUBST([MERGELIBS])
12895 dnl ===================================================================
12896 dnl icerun is a wrapper that stops us spawning tens of processes
12897 dnl locally - for tools that can't be executed on the compile cluster
12898 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12899 dnl ===================================================================
12900 AC_MSG_CHECKING([whether to use icerun wrapper])
12901 ICECREAM_RUN=
12902 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12903     ICECREAM_RUN=icerun
12904     AC_MSG_RESULT([yes])
12905 else
12906     AC_MSG_RESULT([no])
12908 AC_SUBST(ICECREAM_RUN)
12910 dnl ===================================================================
12911 dnl Setup the ICECC_VERSION for the build the same way it was set for
12912 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12913 dnl ===================================================================
12914 x_ICECC_VERSION=[\#]
12915 if test -n "$ICECC_VERSION" ; then
12916     x_ICECC_VERSION=
12918 AC_SUBST(x_ICECC_VERSION)
12919 AC_SUBST(ICECC_VERSION)
12921 dnl ===================================================================
12923 AC_MSG_CHECKING([MPL subset])
12924 MPL_SUBSET=
12926 if test "$enable_mpl_subset" = "yes"; then
12927     warn_report=false
12928     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12929         warn_report=true
12930     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12931         warn_report=true
12932     fi
12933     if test "$warn_report" = "true"; then
12934         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12935     fi
12936     if test "x$enable_postgresql_sdbc" != "xno"; then
12937         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12938     fi
12939     if test "$enable_lotuswordpro" = "yes"; then
12940         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12941     fi
12942     if test "$WITH_WEBDAV" = "neon"; then
12943         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12944     fi
12945     if test -n "$ENABLE_POPPLER"; then
12946         if test "x$SYSTEM_POPPLER" = "x"; then
12947             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12948         fi
12949     fi
12950     # cf. m4/libo_check_extension.m4
12951     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12952         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12953     fi
12954     for theme in $WITH_THEMES; do
12955         case $theme in
12956         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sukapura|sukapura_svg) #blacklist of icon themes under GPL or LGPL
12957             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12958         *) : ;;
12959         esac
12960     done
12962     ENABLE_OPENGL_TRANSITIONS=
12964     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12965         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12966     fi
12968     MPL_SUBSET="TRUE"
12969     AC_DEFINE(MPL_HAVE_SUBSET)
12970     AC_MSG_RESULT([only])
12971 else
12972     AC_MSG_RESULT([no restrictions])
12974 AC_SUBST(MPL_SUBSET)
12976 dnl ===================================================================
12978 AC_MSG_CHECKING([formula logger])
12979 ENABLE_FORMULA_LOGGER=
12981 if test "x$enable_formula_logger" = "xyes"; then
12982     AC_MSG_RESULT([yes])
12983     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12984     ENABLE_FORMULA_LOGGER=TRUE
12985 elif test -n "$ENABLE_DBGUTIL" ; then
12986     AC_MSG_RESULT([yes])
12987     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12988     ENABLE_FORMULA_LOGGER=TRUE
12989 else
12990     AC_MSG_RESULT([no])
12993 AC_SUBST(ENABLE_FORMULA_LOGGER)
12995 dnl ===================================================================
12996 dnl Checking for active Antivirus software.
12997 dnl ===================================================================
12999 if test $_os = WINNT ; then
13000     AC_MSG_CHECKING([for active Antivirus software])
13001     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
13002     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
13003         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
13004             AC_MSG_RESULT([found])
13005             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
13006             echo $EICAR_STRING > $SRC_ROOT/eicar
13007             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
13008             rm $SRC_ROOT/eicar
13009             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13010                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13011             fi
13012             echo $EICAR_STRING > $BUILDDIR/eicar
13013             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
13014             rm $BUILDDIR/eicar
13015             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13016                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13017             fi
13018             add_warning "To speed up builds and avoid failures in unit tests, it is highly recommended that you exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST"
13019         else
13020             AC_MSG_RESULT([not found])
13021         fi
13022     else
13023         AC_MSG_RESULT([n/a])
13024     fi
13027 dnl ===================================================================
13028 dnl Setting up the environment.
13029 dnl ===================================================================
13030 AC_MSG_NOTICE([setting up the build environment variables...])
13032 AC_SUBST(COMPATH)
13034 if test "$build_os" = "cygwin"; then
13035     if test -d "$COMPATH/atlmfc/lib/spectre"; then
13036         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
13037         ATL_INCLUDE="$COMPATH/atlmfc/include"
13038     elif test -d "$COMPATH/atlmfc/lib"; then
13039         ATL_LIB="$COMPATH/atlmfc/lib"
13040         ATL_INCLUDE="$COMPATH/atlmfc/include"
13041     else
13042         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
13043         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
13044     fi
13045     if test "$BITNESS_OVERRIDE" = 64; then
13046         ATL_LIB="$ATL_LIB/x64"
13047     else
13048         ATL_LIB="$ATL_LIB/x86"
13049     fi
13050     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
13051     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
13053     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
13054     PathFormat "/usr/bin/find.exe"
13055     FIND="$formatted_path"
13056     PathFormat "/usr/bin/sort.exe"
13057     SORT="$formatted_path"
13058     PathFormat "/usr/bin/grep.exe"
13059     WIN_GREP="$formatted_path"
13060     PathFormat "/usr/bin/ls.exe"
13061     WIN_LS="$formatted_path"
13062     PathFormat "/usr/bin/touch.exe"
13063     WIN_TOUCH="$formatted_path"
13064 else
13065     FIND=find
13066     SORT=sort
13069 AC_SUBST(ATL_INCLUDE)
13070 AC_SUBST(ATL_LIB)
13071 AC_SUBST(FIND)
13072 AC_SUBST(SORT)
13073 AC_SUBST(WIN_GREP)
13074 AC_SUBST(WIN_LS)
13075 AC_SUBST(WIN_TOUCH)
13077 AC_SUBST(BUILD_TYPE)
13079 AC_SUBST(SOLARINC)
13081 PathFormat "$PERL"
13082 PERL="$formatted_path"
13083 AC_SUBST(PERL)
13085 if test -n "$TMPDIR"; then
13086     TEMP_DIRECTORY="$TMPDIR"
13087 else
13088     TEMP_DIRECTORY="/tmp"
13090 if test "$build_os" = "cygwin"; then
13091     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
13093 AC_SUBST(TEMP_DIRECTORY)
13095 # setup the PATH for the environment
13096 if test -n "$LO_PATH_FOR_BUILD"; then
13097     LO_PATH="$LO_PATH_FOR_BUILD"
13098 else
13099     LO_PATH="$PATH"
13101     case "$host_os" in
13103     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13104         if test "$ENABLE_JAVA" != ""; then
13105             pathmunge "$JAVA_HOME/bin" "after"
13106         fi
13107         ;;
13109     cygwin*)
13110         # Win32 make needs native paths
13111         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13112             LO_PATH=`cygpath -p -m "$PATH"`
13113         fi
13114         if test "$BITNESS_OVERRIDE" = 64; then
13115             # needed for msi packaging
13116             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13117         fi
13118         # .NET 4.6 and higher don't have bin directory
13119         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13120             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13121         fi
13122         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13123         pathmunge "$CSC_PATH" "before"
13124         pathmunge "$MIDL_PATH" "before"
13125         pathmunge "$AL_PATH" "before"
13126         pathmunge "$MSPDB_PATH" "before"
13127         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13128             pathmunge "$CL_PATH" "before"
13129         fi
13130         if test -n "$MSBUILD_PATH" ; then
13131             pathmunge "$MSBUILD_PATH" "before"
13132         fi
13133         if test "$BITNESS_OVERRIDE" = 64; then
13134             pathmunge "$COMPATH/bin/amd64" "before"
13135             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13136         else
13137             pathmunge "$COMPATH/bin" "before"
13138             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13139         fi
13140         if test "$ENABLE_JAVA" != ""; then
13141             if test -d "$JAVA_HOME/jre/bin/client"; then
13142                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13143             fi
13144             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13145                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13146             fi
13147             pathmunge "$JAVA_HOME/bin" "before"
13148         fi
13149         ;;
13151     solaris*)
13152         pathmunge "/usr/css/bin" "before"
13153         if test "$ENABLE_JAVA" != ""; then
13154             pathmunge "$JAVA_HOME/bin" "after"
13155         fi
13156         ;;
13157     esac
13160 AC_SUBST(LO_PATH)
13162 libo_FUZZ_SUMMARY
13164 # Generate a configuration sha256 we can use for deps
13165 if test -f config_host.mk; then
13166     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13168 if test -f config_host_lang.mk; then
13169     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13172 CFLAGS=$my_original_CFLAGS
13173 CXXFLAGS=$my_original_CXXFLAGS
13174 CPPFLAGS=$my_original_CPPFLAGS
13176 AC_CONFIG_FILES([config_host.mk
13177                  config_host_lang.mk
13178                  Makefile
13179                  bin/bffvalidator.sh
13180                  bin/odfvalidator.sh
13181                  bin/officeotron.sh
13182                  instsetoo_native/util/openoffice.lst
13183                  sysui/desktop/macosx/Info.plist])
13184 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13185 AC_CONFIG_HEADERS([config_host/config_clang.h])
13186 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13187 AC_CONFIG_HEADERS([config_host/config_eot.h])
13188 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13189 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13190 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13191 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13192 AC_CONFIG_HEADERS([config_host/config_features.h])
13193 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13194 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13195 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13196 AC_CONFIG_HEADERS([config_host/config_folders.h])
13197 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13198 AC_CONFIG_HEADERS([config_host/config_gio.h])
13199 AC_CONFIG_HEADERS([config_host/config_global.h])
13200 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13201 AC_CONFIG_HEADERS([config_host/config_java.h])
13202 AC_CONFIG_HEADERS([config_host/config_langs.h])
13203 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13204 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13205 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13206 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13207 AC_CONFIG_HEADERS([config_host/config_locales.h])
13208 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13209 AC_CONFIG_HEADERS([config_host/config_oox.h])
13210 AC_CONFIG_HEADERS([config_host/config_options.h])
13211 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13212 AC_CONFIG_HEADERS([config_host/config_skia.h])
13213 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13214 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13215 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13216 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13217 AC_CONFIG_HEADERS([config_host/config_version.h])
13218 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13219 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13220 AC_CONFIG_HEADERS([config_host/config_python.h])
13221 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13222 AC_OUTPUT
13224 if test "$CROSS_COMPILING" = TRUE; then
13225     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13228 # touch the config timestamp file
13229 if test ! -f config_host.mk.stamp; then
13230     echo > config_host.mk.stamp
13231 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13232     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13233 else
13234     echo > config_host.mk.stamp
13237 # touch the config lang timestamp file
13238 if test ! -f config_host_lang.mk.stamp; then
13239     echo > config_host_lang.mk.stamp
13240 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13241     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13242 else
13243     echo > config_host_lang.mk.stamp
13247 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13248         -a "$build_os" = "cygwin"; then
13250 cat << _EOS
13251 ****************************************************************************
13252 WARNING:
13253 Your make version is known to be horribly slow, and hard to debug
13254 problems with. To get a reasonably functional make please do:
13256 to install a pre-compiled binary make for Win32
13258  mkdir -p /opt/lo/bin
13259  cd /opt/lo/bin
13260  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13261  cp make-4.2.1-msvc.exe make
13262  chmod +x make
13264 to install from source:
13265 place yourself in a working directory of you choice.
13267  git clone git://git.savannah.gnu.org/make.git
13269  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
13270  set PATH=%PATH%;C:\Cygwin\bin
13271  [or Cygwin64, if that is what you have]
13272  cd path-to-make-repo-you-cloned-above
13273  build_w32.bat --without-guile
13275 should result in a WinRel/gnumake.exe.
13276 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13278 Then re-run autogen.sh
13280 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13281 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13283 _EOS
13284 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13285     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13290 cat << _EOF
13291 ****************************************************************************
13293 To build, run:
13294 $GNUMAKE
13296 To view some help, run:
13297 $GNUMAKE help
13299 _EOF
13301 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13302     cat << _EOF
13303 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13304 _EOF
13306     if test $_os = Darwin; then
13307         echo open instdir/$PRODUCTNAME.app
13308     else
13309         echo instdir/program/soffice
13310     fi
13311     cat << _EOF
13313 If you want to run the smoketest, run:
13314 $GNUMAKE check
13316 _EOF
13319 if test -f warn; then
13320     cat warn
13321     rm warn
13324 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: